diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-02-28 15:12:44 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-03-03 10:39:53 -0800 |
commit | d64db664f2e8d6f4d08db249135011e32d54bc7a (patch) | |
tree | 00ff258f157cf66238a6b973c21ab06e96bc0dd3 | |
parent | 58e9b14c5aec6590c9be6a6e5894e406aee5eef8 (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.
Change-Id: I8487c8b9039d2736acf66e8b02463658428bd5a3
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/21099
Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-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) |