diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-02-28 15:12:44 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-03-08 17:40:38 -0800 |
commit | b514cec462faa2e29adc8c76e43acffcfca248f6 (patch) | |
tree | 57bbf4bab8602ec19eae7a750795a63e3d4140ed /drivers | |
parent | 849552d9be1871e621ba61bc21e9ce95968be32e (diff) |
mfd: tps6586x: add suspend/resume handlers
if the system is woken by an alarm, tps' irq handler
gets called and it tries to communicate on i2c. i2c adapters
resume later which causes communication failures in tps' irq
handler. the right way is to disable tps' irq while suspending
in order to avoid such i2c communication failures.
original change: http://git-master/r/#change,21099
(cherry picked from commit 5acaf09b682e5c9e0309bae53067f2fde557bbc1)
Change-Id: I76fb13db8b7a3543f5e6d772fda2549493d22876
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/22002
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/tps6586x.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 851049b38a6d..4d52fb0f84b7 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -578,6 +578,25 @@ static int __devexit tps6586x_i2c_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM +static int tps6586x_i2c_suspend(struct i2c_client *client, + pm_message_t state) +{ + if (client->irq) + disable_irq(client->irq); + + return 0; +} + +static int tps6586x_i2c_resume(struct i2c_client *client) +{ + if (client->irq) + enable_irq(client->irq); + + return 0; +} +#endif + static const struct i2c_device_id tps6586x_id_table[] = { { "tps6586x", 0 }, { }, @@ -592,6 +611,10 @@ static struct i2c_driver tps6586x_driver = { .probe = tps6586x_i2c_probe, .remove = __devexit_p(tps6586x_i2c_remove), .id_table = tps6586x_id_table, +#ifdef CONFIG_PM + .suspend = tps6586x_i2c_suspend, + .resume = tps6586x_i2c_resume, +#endif }; static int __init tps6586x_init(void) |