summaryrefslogtreecommitdiff
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
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>
-rw-r--r--drivers/mfd/tps6586x.c19
-rw-r--r--include/linux/mfd/tps6586x.h3
2 files changed, 10 insertions, 12 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;
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
index e43184a43201..702cee59cc7b 100644
--- a/include/linux/mfd/tps6586x.h
+++ b/include/linux/mfd/tps6586x.h
@@ -112,6 +112,8 @@ struct tps6586x_platform_data {
int gpio_base;
int irq_base;
+
+ bool use_power_off;
};
/*
@@ -126,6 +128,5 @@ extern int tps6586x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int tps6586x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int tps6586x_update(struct device *dev, int reg, uint8_t val,
uint8_t mask);
-extern int tps6586x_power_off(void);
#endif /*__LINUX_MFD_TPS6586X_H */