diff options
author | Bill Huang <bilhuang@nvidia.com> | 2012-08-19 21:07:56 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-09-14 03:52:14 -0400 |
commit | b079fa72069ba7f754ba8bdf737335abdb971b67 (patch) | |
tree | 475ae5a57cddff10d9a3905390ba80a38301250a /drivers/mfd/tps65910.c | |
parent | 004c15a68076f5bdc343bed92efed81087cecbfb (diff) |
mfd: dt: tps65910: Add power off control
Add DT property "ti,system-power-controller" telling whether or not this
pmic is in charge of controlling the system power, so the power off
routine can be hooked up to system call "pm_power_off".
Based on the work by:
Dan Willemsen <dwillemsen@nvidia.com>
Signed-off-by: Bill Huang <bilhuang@nvidia.com>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/tps65910.c')
-rw-r--r-- | drivers/mfd/tps65910.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index d3ce4d569deb..ca902943cfa9 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c | |||
@@ -198,6 +198,8 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | |||
198 | 198 | ||
199 | board_info->irq = client->irq; | 199 | board_info->irq = client->irq; |
200 | board_info->irq_base = -1; | 200 | board_info->irq_base = -1; |
201 | board_info->pm_off = of_property_read_bool(np, | ||
202 | "ti,system-power-controller"); | ||
201 | 203 | ||
202 | return board_info; | 204 | return board_info; |
203 | } | 205 | } |
@@ -210,6 +212,21 @@ struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | |||
210 | } | 212 | } |
211 | #endif | 213 | #endif |
212 | 214 | ||
215 | static struct i2c_client *tps65910_i2c_client; | ||
216 | static void tps65910_power_off(void) | ||
217 | { | ||
218 | struct tps65910 *tps65910; | ||
219 | |||
220 | tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); | ||
221 | |||
222 | if (tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, | ||
223 | DEVCTRL_PWR_OFF_MASK) < 0) | ||
224 | return; | ||
225 | |||
226 | tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, | ||
227 | DEVCTRL_DEV_ON_MASK); | ||
228 | } | ||
229 | |||
213 | static __devinit int tps65910_i2c_probe(struct i2c_client *i2c, | 230 | static __devinit int tps65910_i2c_probe(struct i2c_client *i2c, |
214 | const struct i2c_device_id *id) | 231 | const struct i2c_device_id *id) |
215 | { | 232 | { |
@@ -267,6 +284,11 @@ static __devinit int tps65910_i2c_probe(struct i2c_client *i2c, | |||
267 | tps65910_ck32k_init(tps65910, pmic_plat_data); | 284 | tps65910_ck32k_init(tps65910, pmic_plat_data); |
268 | tps65910_sleepinit(tps65910, pmic_plat_data); | 285 | tps65910_sleepinit(tps65910, pmic_plat_data); |
269 | 286 | ||
287 | if (pmic_plat_data->pm_off && !pm_power_off) { | ||
288 | tps65910_i2c_client = i2c; | ||
289 | pm_power_off = tps65910_power_off; | ||
290 | } | ||
291 | |||
270 | return ret; | 292 | return ret; |
271 | } | 293 | } |
272 | 294 | ||