summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@nvidia.com>2011-12-01 15:08:56 -0800
committerSimone Willett <swillett@nvidia.com>2012-02-15 16:55:29 -0800
commitb2aed388161fc9642de76045cfce746d4175d63e (patch)
treebf1bb9753bfd183f8e058ed10fb7621029b47676
parent1eb5269c6052eeb1f626aec9e5bb6cb33967517f (diff)
mfd: max77663: 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: Id3342142e5e7b49d2e16a83889d0b6a1cace1d95 Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com> Reviewed-on: http://git-master/r/83595 Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
-rw-r--r--drivers/mfd/max77663-core.c12
-rw-r--r--include/linux/mfd/max77663-core.h8
2 files changed, 9 insertions, 11 deletions
diff --git a/drivers/mfd/max77663-core.c b/drivers/mfd/max77663-core.c
index aaea2e08292e..137c04b01e0d 100644
--- a/drivers/mfd/max77663-core.c
+++ b/drivers/mfd/max77663-core.c
@@ -358,18 +358,17 @@ int max77663_set_bits(struct device *dev, u8 addr, u8 mask, u8 value,
}
EXPORT_SYMBOL(max77663_set_bits);
-int max77663_power_off(void)
+static void max77663_power_off(void)
{
struct max77663_chip *chip = max77663_chip;
if (!chip)
- return -EINVAL;
+ return;
dev_info(chip->dev, "%s: Global shutdown\n", __func__);
- return max77663_set_bits(chip->dev, MAX77663_REG_ONOFF_CFG1,
- ONOFF_SFT_RST_MASK, ONOFF_SFT_RST_MASK, 0);
+ max77663_set_bits(chip->dev, MAX77663_REG_ONOFF_CFG1,
+ ONOFF_SFT_RST_MASK, ONOFF_SFT_RST_MASK, 0);
}
-EXPORT_SYMBOL(max77663_power_off);
static int max77663_sleep(struct max77663_chip *chip, bool on)
{
@@ -1316,6 +1315,9 @@ static int max77663_probe(struct i2c_client *client,
goto out_exit;
}
+ if (pdata->use_power_off && !pm_power_off)
+ pm_power_off = max77663_power_off;
+
ret = mfd_add_devices(&client->dev, 0, pdata->sub_devices,
pdata->num_subdevs, NULL, 0);
if (ret != 0) {
diff --git a/include/linux/mfd/max77663-core.h b/include/linux/mfd/max77663-core.h
index b3b9051f84f0..acfe22aac535 100644
--- a/include/linux/mfd/max77663-core.h
+++ b/include/linux/mfd/max77663-core.h
@@ -138,6 +138,8 @@ struct max77663_platform_data {
unsigned int flags;
unsigned char rtc_i2c_addr;
+
+ bool use_power_off;
};
#if defined(CONFIG_MFD_MAX77663)
@@ -147,7 +149,6 @@ int max77663_write(struct device *dev, u8 addr, void *values, u32 len,
bool is_rtc);
int max77663_set_bits(struct device *dev, u8 addr, u8 mask, u8 value,
bool is_rtc);
-int max77663_power_off(void);
int max77663_gpio_set_alternate(int gpio, int alternate);
#else
static inline int max77663_read(struct device *dev, u8 addr, void *values,
@@ -168,11 +169,6 @@ static inline int max77663_set_bits(struct device *dev, u8 addr, u8 mask,
return 0;
}
-static inline int max77663_power_off(void)
-{
- return 0;
-}
-
static inline int max77663_gpio_set_alternate(int gpio, int alternate)
{
return 0;