summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJin Park <jinyoungp@nvidia.com>2011-10-27 19:14:18 +0900
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:50:17 -0800
commit1dbb851d2edeb50773b1411d070368259ba063e1 (patch)
tree88c1d196b8c14801dd94f2a36a963c36ed4b72e3
parent2679db0a395c64daf78b5b3edc342125c6f20590 (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
-rw-r--r--drivers/mfd/max77663-core.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/mfd/max77663-core.c b/drivers/mfd/max77663-core.c
index 05fda2d699af..e8b400afa45a 100644
--- a/drivers/mfd/max77663-core.c
+++ b/drivers/mfd/max77663-core.c
@@ -363,6 +363,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)
{
@@ -1277,6 +1293,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);
@@ -1317,31 +1334,23 @@ static int __devexit 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