16 #include <linux/module.h>
20 #include <linux/slab.h>
21 #include <linux/i2c.h>
27 static struct resource rtc_resources[] = {
35 static struct mfd_cell tps65910s[] = {
37 .name =
"tps65910-gpio",
40 .name =
"tps65910-pmic",
43 .name =
"tps65910-rtc",
45 .resources = &rtc_resources[0],
48 .
name =
"tps65910-power",
53 static bool is_volatile_reg(
struct device *
dev,
unsigned int reg)
64 if (tps65910_chip_id(tps65910) ==
TPS65910)
73 static const struct regmap_config tps65910_regmap_config = {
76 .volatile_reg = is_volatile_reg,
81 static int __devinit tps65910_ck32k_init(
struct tps65910 *tps65910,
92 dev_err(tps65910->
dev,
"clear ck32k_ctrl failed: %d\n", ret);
99 static int __devinit tps65910_sleepinit(
struct tps65910 *tps65910,
114 dev_err(dev,
"set dev_slp failed: %d\n", ret);
123 ret = tps65910_reg_set_bits(tps65910,
127 dev_err(dev,
"set therm_keepon failed: %d\n", ret);
128 goto disable_dev_slp;
132 if (pmic_pdata->
slp_keepon->clkout32k_keepon) {
133 ret = tps65910_reg_set_bits(tps65910,
137 dev_err(dev,
"set clkout32k_keepon failed: %d\n", ret);
138 goto disable_dev_slp;
143 ret = tps65910_reg_set_bits(tps65910,
147 dev_err(dev,
"set i2chs_keepon failed: %d\n", ret);
148 goto disable_dev_slp;
165 { .compatible =
"ti,tps65911", .data = (
void *)
TPS65911},
181 dev_err(&client->
dev,
"Failed to find matching dt id\n");
190 dev_err(&client->
dev,
"Failed to allocate pdata\n");
194 ret = of_property_read_u32(np,
"ti,vmbch-threshold", &prop);
198 dev_warn(&client->
dev,
"VMBCH-Threshold not specified");
200 ret = of_property_read_u32(np,
"ti,vmbch2-threshold", &prop);
204 dev_warn(&client->
dev,
"VMBCH2-Threshold not specified");
206 prop = of_property_read_bool(np,
"ti,en-ck32k-xtal");
209 board_info->
irq = client->
irq;
211 board_info->
pm_off = of_property_read_bool(np,
212 "ti,system-power-controller");
225 static struct i2c_client *tps65910_i2c_client;
226 static void tps65910_power_off(
void)
228 struct tps65910 *tps65910;
243 struct tps65910 *tps65910;
248 int chip_id =
id->driver_data;
250 pmic_plat_data = dev_get_platdata(&i2c->
dev);
252 if (!pmic_plat_data && i2c->
dev.of_node) {
253 pmic_plat_data = tps65910_parse_dt(i2c, &chip_id);
254 of_pmic_plat_data = pmic_plat_data;
261 if (init_data ==
NULL)
265 if (tps65910 ==
NULL)
269 i2c_set_clientdata(i2c, tps65910);
270 tps65910->
dev = &i2c->
dev;
272 tps65910->
id = chip_id;
276 if (IS_ERR(tps65910->
regmap)) {
277 ret = PTR_ERR(tps65910->
regmap);
278 dev_err(&i2c->
dev,
"regmap initialization failed: %d\n", ret);
286 dev_err(&i2c->
dev,
"mfd_add_devices failed: %d\n", ret);
290 init_data->
irq = pmic_plat_data->
irq;
294 tps65910_ck32k_init(tps65910, pmic_plat_data);
295 tps65910_sleepinit(tps65910, pmic_plat_data);
298 tps65910_i2c_client = i2c;
307 struct tps65910 *tps65910 = i2c_get_clientdata(i2c);
323 static struct i2c_driver tps65910_i2c_driver = {
329 .probe = tps65910_i2c_probe,
331 .id_table = tps65910_i2c_id,
334 static int __init tps65910_i2c_init(
void)
336 return i2c_add_driver(&tps65910_i2c_driver);
341 static void __exit tps65910_i2c_exit(
void)