diff options
author | Bhavesh Parekh <bparekh@nvidia.com> | 2013-01-21 16:30:46 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 12:57:44 -0700 |
commit | 50cb2e4a61457781162312201a397363dc6e63b3 (patch) | |
tree | 3c92da6b11f7551ffb5d63932866da3cc4c0cb4c /drivers | |
parent | f48d35b05181b5106c6f034b758d14dc67a0e663 (diff) |
driver: tps6591: Prog sleep bit during suspend/resume
Set and clear the sleep bit during suspend/resume, and not
during init if dev_slp_delayed is true.
bug 1214183
Change-Id: I3b57d6d5fa82844607b67625b7de8b9f0f2a2baa
Signed-off-by: Sumeet Gupta <sumeetg@nvidia.com>
Signed-off-by: Bhavesh Parekh <bparekh@nvidia.com>
Reviewed-on: http://git-master/r/199356
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/tps6591x.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/mfd/tps6591x.c b/drivers/mfd/tps6591x.c index f5431b88d735..9eab2045f7fb 100644 --- a/drivers/mfd/tps6591x.c +++ b/drivers/mfd/tps6591x.c @@ -3,7 +3,7 @@ * * Core driver for TI TPS6591x PMIC family * - * Copyright (C) 2011 NVIDIA Corporation + * Copyright (c) 2011-2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -759,7 +759,10 @@ static int __devinit tps6591x_sleepinit(struct tps6591x *tpsi, } /* enabling SLEEP device state */ - ret = tps6591x_set_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_SLP); + if (!pdata->dev_slp_delayed) + ret = tps6591x_set_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_SLP); + else + ret = tps6591x_clr_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_SLP); if (ret < 0) { dev_err(dev, "set dev_slp failed: %d\n", ret); goto err_sleep_init; @@ -928,17 +931,37 @@ static int tps6591x_i2c_remove(struct i2c_client *client) static int tps6591x_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct tps6591x_platform_data *pdata = client->dev.platform_data; + int ret = 0; + + if (pdata->dev_slp_delayed) { + ret = tps6591x_set_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_SLP); + if (ret) { + dev_err(&client->dev, "Error in setting PMU's sleep bit; bailing out\n"); + return ret; + } + } + if (client->irq) disable_irq(client->irq); - return 0; + return ret; } static int tps6591x_i2c_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + struct tps6591x_platform_data *pdata = client->dev.platform_data; + int ret = 0; + if (client->irq) enable_irq(client->irq); - return 0; + if (pdata->dev_slp_delayed) { + ret = tps6591x_clr_bits(dev, TPS6591X_DEVCTRL, DEVCTRL_DEV_SLP); + if (ret) + dev_err(&client->dev, "Error in Clearing PMU's sleep bit\n"); + } + + return ret; } static const struct dev_pm_ops tps6591x_pm_ops = { |