Commit 74614f8d9d4141a3752fc1c38706859b63f4842b
Committed by
Linus Torvalds
1 parent
57226e7898
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 7 additions and 2 deletions Side-by-side Diff
drivers/misc/isl29003.c
... | ... | @@ -64,6 +64,7 @@ |
64 | 64 | struct i2c_client *client; |
65 | 65 | struct mutex lock; |
66 | 66 | u8 reg_cache[ISL29003_NUM_CACHABLE_REGS]; |
67 | + u8 power_state_before_suspend; | |
67 | 68 | }; |
68 | 69 | |
69 | 70 | static int gain_range[] = { |
... | ... | @@ -411,6 +412,9 @@ |
411 | 412 | #ifdef CONFIG_PM |
412 | 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 | 418 | return isl29003_set_power_state(client, 0); |
415 | 419 | } |
416 | 420 | |
417 | 421 | |
... | ... | @@ -421,10 +425,11 @@ |
421 | 425 | |
422 | 426 | /* restore registers from cache */ |
423 | 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 | 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 | 435 | #else |