diff options
author | Daniel Mack <daniel@caiaq.de> | 2009-05-06 19:03:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-06 19:36:10 -0400 |
commit | 74614f8d9d4141a3752fc1c38706859b63f4842b (patch) | |
tree | 5a8570b8315fe544ff24f7c82377ceda035f6de0 /drivers | |
parent | 57226e7898076f864d6ce41ddeff4bbc772b950c (diff) |
isl29003: fix resume functionality
The isl29003 does not interpret the return value of
i2c_smbus_write_byte_data() correctly and hence causes an error on system
resume.
Also introduce power_state_before_suspend and restore the chip's power
state upon wakeup.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/isl29003.c | 9 |
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 | ||
69 | static int gain_range[] = { | 70 | static int gain_range[] = { |
@@ -411,6 +412,9 @@ static int __devexit isl29003_remove(struct i2c_client *client) | |||
411 | #ifdef CONFIG_PM | 412 | #ifdef CONFIG_PM |
412 | static int isl29003_suspend(struct i2c_client *client, pm_message_t mesg) | 413 | static 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 |