aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/tps65910.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/tps65910.c')
-rw-r--r--drivers/mfd/tps65910.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index d3ce4d569deb..0d79ce2b5014 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -24,6 +24,14 @@
24#include <linux/mfd/tps65910.h> 24#include <linux/mfd/tps65910.h>
25#include <linux/of_device.h> 25#include <linux/of_device.h>
26 26
27static struct resource rtc_resources[] = {
28 {
29 .start = TPS65910_IRQ_RTC_ALARM,
30 .end = TPS65910_IRQ_RTC_ALARM,
31 .flags = IORESOURCE_IRQ,
32 }
33};
34
27static struct mfd_cell tps65910s[] = { 35static struct mfd_cell tps65910s[] = {
28 { 36 {
29 .name = "tps65910-gpio", 37 .name = "tps65910-gpio",
@@ -33,6 +41,8 @@ static struct mfd_cell tps65910s[] = {
33 }, 41 },
34 { 42 {
35 .name = "tps65910-rtc", 43 .name = "tps65910-rtc",
44 .num_resources = ARRAY_SIZE(rtc_resources),
45 .resources = &rtc_resources[0],
36 }, 46 },
37 { 47 {
38 .name = "tps65910-power", 48 .name = "tps65910-power",
@@ -198,6 +208,8 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
198 208
199 board_info->irq = client->irq; 209 board_info->irq = client->irq;
200 board_info->irq_base = -1; 210 board_info->irq_base = -1;
211 board_info->pm_off = of_property_read_bool(np,
212 "ti,system-power-controller");
201 213
202 return board_info; 214 return board_info;
203} 215}
@@ -210,6 +222,21 @@ struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
210} 222}
211#endif 223#endif
212 224
225static struct i2c_client *tps65910_i2c_client;
226static void tps65910_power_off(void)
227{
228 struct tps65910 *tps65910;
229
230 tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev);
231
232 if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL,
233 DEVCTRL_PWR_OFF_MASK) < 0)
234 return;
235
236 tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL,
237 DEVCTRL_DEV_ON_MASK);
238}
239
213static __devinit int tps65910_i2c_probe(struct i2c_client *i2c, 240static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
214 const struct i2c_device_id *id) 241 const struct i2c_device_id *id)
215{ 242{
@@ -267,6 +294,11 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c,
267 tps65910_ck32k_init(tps65910, pmic_plat_data); 294 tps65910_ck32k_init(tps65910, pmic_plat_data);
268 tps65910_sleepinit(tps65910, pmic_plat_data); 295 tps65910_sleepinit(tps65910, pmic_plat_data);
269 296
297 if (pmic_plat_data->pm_off && !pm_power_off) {
298 tps65910_i2c_client = i2c;
299 pm_power_off = tps65910_power_off;
300 }
301
270 return ret; 302 return ret;
271} 303}
272 304