diff options
author | Jin Park <jinyoungp@nvidia.com> | 2011-10-27 19:14:18 +0900 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 01:06:03 -0700 |
commit | f96999cab31524a2949c9de636cc4fb7f40d4e9a (patch) | |
tree | 777d50691a1bff9133ac9878a10301fb5a98faa6 /drivers/mfd/max77663-core.c | |
parent | 9aaf508a5aa67b22c65de01c15e6172158a5511c (diff) |
mfd: max77663: Move sleep enable setting from suspend to resume
Moving sleep enable setting from suspend to resume.
And add sleep enable setting into probe.
Bug 849360
Reviewed-on: http://git-master/r/60656
(cherry picked from commit 9ba5f1f22d73fe62d0f509fd6cad26f34e25a017)
Signed-off-by: Jin Park <jinyoungp@nvidia.com>
Change-Id: I7275a5f8d8e0f8d75826854c91946e82d52c8278
Reviewed-on: http://git-master/r/65694
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Rebase-Id: Re4a4c87dd95180c17680c258b37490bdb3179634
Diffstat (limited to 'drivers/mfd/max77663-core.c')
-rw-r--r-- | drivers/mfd/max77663-core.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/mfd/max77663-core.c b/drivers/mfd/max77663-core.c index ac19e0754294..3f818892ee23 100644 --- a/drivers/mfd/max77663-core.c +++ b/drivers/mfd/max77663-core.c @@ -364,6 +364,22 @@ int max77663_power_off(void) } EXPORT_SYMBOL(max77663_power_off); +static int max77663_sleep_enable(struct max77663_chip *chip) +{ + int ret; + + /* Enable sleep that AP can be placed into sleep mode + * by pulling EN1 low */ + ret = max77663_set_bits(chip->dev, MAX77663_REG_ONOFF_CFG1, + ONOFF_SLPEN_MASK, ONOFF_SLPEN_MASK, 0); + if (ret < 0) + dev_err(chip->dev, + "sleep_enable: Failed to set on/off config1\n", + MAX77663_REG_ONOFF_CFG1); + + return ret; +} + static inline int max77663_cache_write(struct device *dev, u8 addr, u8 mask, u8 val, u8 *cache) { @@ -1278,6 +1294,7 @@ static int max77663_probe(struct i2c_client *client, max77663_gpio_init(chip); max77663_irq_init(chip); max77663_debugfs_init(chip); + max77663_sleep_enable(chip); ret = mfd_add_devices(&client->dev, 0, pdata->sub_devices, pdata->num_subdevs, NULL, 0); @@ -1318,31 +1335,23 @@ static int max77663_remove(struct i2c_client *client) static int max77663_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); - struct max77663_chip *chip = i2c_get_clientdata(client); - int ret; if (client->irq) disable_irq(client->irq); - /* Enable sleep that AP can be placed into sleep mode - * by pulling EN1 low */ - ret = max77663_set_bits(chip->dev, MAX77663_REG_ONOFF_CFG1, - ONOFF_SLPEN_MASK, ONOFF_SLPEN_MASK, 0); - if (ret < 0) - dev_err(&client->dev, - "suspend: Failed to set ONOFF_CFG1(0x%02x)\n", - MAX77663_REG_ONOFF_CFG1); - return 0; } static int max77663_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct max77663_chip *chip = i2c_get_clientdata(client); if (client->irq) enable_irq(client->irq); + max77663_sleep_enable(chip); + return 0; } #else |