aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/isl29003.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/isl29003.c')
-rw-r--r--drivers/misc/isl29003.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c
index 2e2a5923d4c2..a71e245801ee 100644
--- a/drivers/misc/isl29003.c
+++ b/drivers/misc/isl29003.c
@@ -64,6 +64,7 @@ struct isl29003_data {
64 struct i2c_client *client; 64 struct i2c_client *client;
65 struct mutex lock; 65 struct mutex lock;
66 u8 reg_cache[ISL29003_NUM_CACHABLE_REGS]; 66 u8 reg_cache[ISL29003_NUM_CACHABLE_REGS];
67 u8 power_state_before_suspend;
67}; 68};
68 69
69static int gain_range[] = { 70static int gain_range[] = {
@@ -411,6 +412,9 @@ static int __devexit isl29003_remove(struct i2c_client *client)
411#ifdef CONFIG_PM 412#ifdef CONFIG_PM
412static int isl29003_suspend(struct i2c_client *client, pm_message_t mesg) 413static int isl29003_suspend(struct i2c_client *client, pm_message_t mesg)
413{ 414{
415 struct isl29003_data *data = i2c_get_clientdata(client);
416
417 data->power_state_before_suspend = isl29003_get_power_state(client);
414 return isl29003_set_power_state(client, 0); 418 return isl29003_set_power_state(client, 0);
415} 419}
416 420
@@ -421,10 +425,11 @@ static int isl29003_resume(struct i2c_client *client)
421 425
422 /* restore registers from cache */ 426 /* restore registers from cache */
423 for (i = 0; i < ARRAY_SIZE(data->reg_cache); i++) 427 for (i = 0; i < ARRAY_SIZE(data->reg_cache); i++)
424 if (!i2c_smbus_write_byte_data(client, i, data->reg_cache[i])) 428 if (i2c_smbus_write_byte_data(client, i, data->reg_cache[i]))
425 return -EIO; 429 return -EIO;
426 430
427 return 0; 431 return isl29003_set_power_state(client,
432 data->power_state_before_suspend);
428} 433}
429 434
430#else 435#else