mfd:adp5520: Restore mode bits on resume
Subsystems (2)
PATCH 1/1 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.
Signed-off-by Lars-Peter Clausen <[email protected]>
--- drivers/mfd/adp5520.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mfd/adp5520.c +6 -2
@@ -36,6 +36,7 @@ struct adp5520_chip {struct blocking_notifier_head notifier_list;int irq;unsigned long id; +uint8_t mode; }; static int __adp5520_read(struct i2c_client *client,
@@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_clr_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_read (chip->dev,ADP5520_MODE_STATUS , &chip->mode); +/* All other bits are W1C */ + chip->mode &=ADP5520_BL_EN |ADP5520_DIM_EN | ADP5520_nSTNBY; +adp5520_write (chip->dev,ADP5520_MODE_STATUS ,0 );return 0 ; }
@@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_set_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_write (chip->dev,ADP5520_MODE_STATUS , chip->mode); return 0; }#endif
Signature · 1 line
1.8.0
Quoted 6 lines · Lars-Peter Clausen
The adp5520 unfortunately also clears the
BL_ENbit when the nSTNDBY bit is cleared. So we need to make sure to restore it during resume if it was set before suspend.Signed-off-by Lars-Peter Clausen <[email protected]>
Quoted 37 lines
--- drivers/mfd/adp5520.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/mfd/adp5520.c +6
-2@@ -36,6 +36,7 @@ struct adp5520_chip {struct blocking_notifier_head notifier_list;int irq;unsigned long id; +uint8_t mode; }; static int __adp5520_read(struct i2c_client *client,@@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_clr_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_read (chip->dev,ADP5520_MODE_STATUS , &chip->mode); +/* All other bits are W1C */ + chip->mode &=ADP5520_BL_EN |ADP5520_DIM_EN | ADP5520_nSTNBY; +adp5520_write (chip->dev,ADP5520_MODE_STATUS ,0 );return 0 ; }@@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)struct i2c_client *client =to_i2c_client (dev);struct adp5520_chip *chip =dev_get_drvdata (&client->dev); -adp5520_set_bits (chip->dev,ADP5520_MODE_STATUS , ADP5520_nSTNBY); +adp5520_write (chip->dev,ADP5520_MODE_STATUS , chip->mode); return 0; }#endif
Signature · 8 lines
Greetings, Michael -- Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif
Hi Michael, Lars,
Quoted 11 lines · Michael Hennerich
Quoted 6 lines · Lars-Peter Clausen
The adp5520 unfortunately also clears the
BL_ENbit when the nSTNDBY bit is cleared. So we need to make sure to restore it during resume if it was set before suspend.Signed-off-by Lars-Peter Clausen <[email protected]>Quoted 3 lines
--- drivers/mfd/adp5520.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Patch applied, thanks.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/