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 | |
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>
-rw-r--r-- | drivers/mfd/tps6591x.c | 19 | ||||
-rw-r--r-- | include/linux/mfd/tps6591x.h | 3 |
2 files changed, 10 insertions, 12 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; diff --git a/include/linux/mfd/tps6591x.h b/include/linux/mfd/tps6591x.h index 525a8616c44b..d0d829fc8aba 100644 --- a/include/linux/mfd/tps6591x.h +++ b/include/linux/mfd/tps6591x.h @@ -104,6 +104,8 @@ struct tps6591x_platform_data { struct tps6591x_gpio_init_data *gpio_init_data; int num_gpioinit_data; + + bool use_power_off; }; /* @@ -118,6 +120,5 @@ extern int tps6591x_set_bits(struct device *dev, int reg, uint8_t bit_mask); extern int tps6591x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); extern int tps6591x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); -extern int tps6591x_power_off(void); #endif /*__LINUX_MFD_TPS6591X_H */ |