diff options
author | Dan Willemsen <dwillemsen@nvidia.com> | 2011-12-01 15:08:12 -0800 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-02-15 16:55:14 -0800 |
commit | 1eb5269c6052eeb1f626aec9e5bb6cb33967517f (patch) | |
tree | 9bee110f78ea7c30382393530ef04591cf990477 /drivers | |
parent | 87f8601c668d7a8b93953bb2623028452c6f8e58 (diff) |
mfd: tps6591x: Natively register pm_power_off
Instead of forcing the board files to register this themselves, just add
a bool to the platform data to let the board files opt into this.
Change-Id: Ide3d6cbc49584c3ed993f30b1396c8ae56d87b3b
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Reviewed-on: http://git-master/r/83594
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/tps6591x.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/mfd/tps6591x.c b/drivers/mfd/tps6591x.c index 8ce44244e9ab..b475e06712d5 100644 --- a/drivers/mfd/tps6591x.c +++ b/drivers/mfd/tps6591x.c @@ -283,25 +283,19 @@ out: EXPORT_SYMBOL_GPL(tps6591x_update); static struct i2c_client *tps6591x_i2c_client; -int tps6591x_power_off(void) +static void tps6591x_power_off(void) { struct device *dev = NULL; - int ret; if (!tps6591x_i2c_client) - return -EINVAL; + return; dev = &tps6591x_i2c_client->dev; - ret = tps6591x_set_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_PWR_OFF_SEQ); - if (ret < 0) - return ret; - - ret = tps6591x_clr_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_ON); - if (ret < 0) - return ret; + if (tps6591x_set_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_PWR_OFF_SEQ) < 0) + return; - return 0; + tps6591x_clr_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_ON); } static int tps6591x_gpio_get(struct gpio_chip *gc, unsigned offset) @@ -841,6 +835,9 @@ static int __devinit tps6591x_i2c_probe(struct i2c_client *client, tps6591x_sleepinit(tps6591x, pdata); + if (pdata->use_power_off && !pm_power_off) + pm_power_off = tps6591x_power_off; + tps6591x_i2c_client = client; return 0; |