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

mfd: adp5520: Restore mode bits on resume

The adp5520 unfortunately also clears the BL_EN bit when the nSTNDBY bit is
cleared. So we need to make sure to restore it during resume if it was set
before suspend.

Cc: stable@vger.kernel.org
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

authored by

Lars-Peter Clausen and committed by
Samuel Ortiz
c6cc25fd 7aa3d7c8

+6 -2
+6 -2
drivers/mfd/adp5520.c
··· 36 36 struct blocking_notifier_head notifier_list; 37 37 int irq; 38 38 unsigned long id; 39 + uint8_t mode; 39 40 }; 40 41 41 42 static int __adp5520_read(struct i2c_client *client, ··· 327 326 struct i2c_client *client = to_i2c_client(dev); 328 327 struct adp5520_chip *chip = dev_get_drvdata(&client->dev); 329 328 330 - adp5520_clr_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY); 329 + adp5520_read(chip->dev, ADP5520_MODE_STATUS, &chip->mode); 330 + /* All other bits are W1C */ 331 + chip->mode &= ADP5520_BL_EN | ADP5520_DIM_EN | ADP5520_nSTNBY; 332 + adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0); 331 333 return 0; 332 334 } 333 335 ··· 339 335 struct i2c_client *client = to_i2c_client(dev); 340 336 struct adp5520_chip *chip = dev_get_drvdata(&client->dev); 341 337 342 - adp5520_set_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY); 338 + adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode); 343 339 return 0; 344 340 } 345 341 #endif