summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@nvidia.com>2011-12-01 15:13:54 -0800
committerSimone Willett <swillett@nvidia.com>2012-02-15 16:56:33 -0800
commit88b5905d67d7ba03e98008fdcb4bf7874bcade18 (patch)
treee8efc9182211641d85002202565403602132d511 /drivers/mfd
parent8e9c3586d309db31fea2826f7d7f929bc715e3e7 (diff)
mfd: tps6586x: 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: I831c93026f8343d9962e174a3591e6832c5219d8 Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com> Reviewed-on: http://git-master/r/83598 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/tps6586x.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 6d842fa20693..9a146c8bba92 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -256,25 +256,19 @@ out:
EXPORT_SYMBOL_GPL(tps6586x_update);
static struct i2c_client *tps6586x_i2c_client = NULL;
-int tps6586x_power_off(void)
+static void tps6586x_power_off(void)
{
struct device *dev = NULL;
- int ret = -EINVAL;
if (!tps6586x_i2c_client)
- return ret;
+ return;
dev = &tps6586x_i2c_client->dev;
- ret = tps6586x_clr_bits(dev, TPS6586X_SUPPLYENE, EXITSLREQ_BIT);
- if (ret)
- return ret;
-
- ret = tps6586x_set_bits(dev, TPS6586X_SUPPLYENE, SLEEP_MODE_BIT);
- if (ret)
- return ret;
+ if (tps6586x_clr_bits(dev, TPS6586X_SUPPLYENE, EXITSLREQ_BIT))
+ return;
- return 0;
+ tps6586x_set_bits(dev, TPS6586X_SUPPLYENE, SLEEP_MODE_BIT);
}
static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset)
@@ -562,6 +556,9 @@ static int __devinit tps6586x_i2c_probe(struct i2c_client *client,
goto err_add_devs;
}
+ if (pdata->use_power_off && !pm_power_off)
+ pm_power_off = tps6586x_power_off;
+
tps6586x_i2c_client = client;
return 0;