Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Daniel Mack and committed by
Linus Torvalds
74614f8d 57226e78

+7 -2
+7 -2
drivers/misc/isl29003.c
··· 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[] = { ··· 412 411 #ifdef CONFIG_PM 413 412 static int isl29003_suspend(struct i2c_client *client, pm_message_t mesg) 414 413 { 414 + struct isl29003_data *data = i2c_get_clientdata(client); 415 + 416 + data->power_state_before_suspend = isl29003_get_power_state(client); 415 417 return isl29003_set_power_state(client, 0); 416 418 } 417 419 ··· 425 421 426 422 /* restore registers from cache */ 427 423 for (i = 0; i < ARRAY_SIZE(data->reg_cache); i++) 428 - if (!i2c_smbus_write_byte_data(client, i, data->reg_cache[i])) 424 + if (i2c_smbus_write_byte_data(client, i, data->reg_cache[i])) 429 425 return -EIO; 430 426 431 - return 0; 427 + return isl29003_set_power_state(client, 428 + data->power_state_before_suspend); 432 429 } 433 430 434 431 #else