diff options
author | Dan Willemsen <dwillemsen@nvidia.com> | 2011-12-01 14:56:47 -0800 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-02-15 16:50:52 -0800 |
commit | d8d1a1ba8b469b1d177015ab2fe87a97a5af1c73 (patch) | |
tree | e05922bfd963530dd993794927685ba1514abcbc | |
parent | 831adda2f1fbf885212a975a39990135473f7143 (diff) |
mfd: tps80031: 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: Ia545f23b95f9727932aaf3f3b64a109dae0f2448
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
Reviewed-on: http://git-master/r/83592
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
-rw-r--r-- | drivers/mfd/tps80031.c | 10 | ||||
-rw-r--r-- | include/linux/mfd/tps80031.h | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c index e6bfd475f668..fb6ff3bf4d60 100644 --- a/drivers/mfd/tps80031.c +++ b/drivers/mfd/tps80031.c @@ -29,6 +29,7 @@ #include <linux/slab.h> #include <linux/gpio.h> #include <linux/i2c.h> +#include <linux/pm.h> #include <linux/mfd/core.h> #include <linux/mfd/tps80031.h> @@ -498,14 +499,14 @@ int tps80031_get_pmu_version(struct device *dev) EXPORT_SYMBOL_GPL(tps80031_get_pmu_version); static struct tps80031 *tps80031_dev; -int tps80031_power_off(void) +static void tps80031_power_off(void) { struct tps80031_client *tps = &tps80031_dev->tps_clients[SLAVE_ID1]; if (!tps->client) - return -EINVAL; + return; dev_info(&tps->client->dev, "switching off PMU\n"); - return __tps80031_write(tps->client, TPS80031_PHOENIX_DEV_ON, DEVOFF); + __tps80031_write(tps->client, TPS80031_PHOENIX_DEV_ON, DEVOFF); } static void tps80031_init_ext_control(struct tps80031 *tps80031, @@ -1210,6 +1211,9 @@ static int __devinit tps80031_i2c_probe(struct i2c_client *client, tps80031_debuginit(tps80031); + if (pdata->use_power_off && !pm_power_off) + pm_power_off = tps80031_power_off; + tps80031_dev = tps80031; return 0; diff --git a/include/linux/mfd/tps80031.h b/include/linux/mfd/tps80031.h index c6aa7eadbedd..1802dfefef05 100644 --- a/include/linux/mfd/tps80031.h +++ b/include/linux/mfd/tps80031.h @@ -164,6 +164,7 @@ struct tps80031_platform_data { int gpio_init_data_size; struct tps80031_clk32k_init_data *clk32k_init_data; int clk32k_init_data_size; + bool use_power_off; }; struct tps80031_bg_platform_data { @@ -193,8 +194,6 @@ extern int tps80031_ext_power_req_config(struct device *dev, unsigned long ext_ctrl_flag, int preq_bit, int state_reg_add, int trans_reg_add); -extern int tps80031_power_off(void); - extern unsigned long tps80031_get_chip_info(struct device *dev); extern int tps80031_gpadc_conversion(int channle_no); |