Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6cc25fd authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Samuel Ortiz
Browse files

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 7aa3d7c8
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -36,6 +36,7 @@ struct adp5520_chip {
	struct blocking_notifier_head notifier_list;
	struct blocking_notifier_head notifier_list;
	int irq;
	int irq;
	unsigned long id;
	unsigned long id;
	uint8_t mode;
};
};


static int __adp5520_read(struct i2c_client *client,
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 i2c_client *client = to_i2c_client(dev);
	struct adp5520_chip *chip = dev_get_drvdata(&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;
	return 0;
}
}


@@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)
	struct i2c_client *client = to_i2c_client(dev);
	struct i2c_client *client = to_i2c_client(dev);
	struct adp5520_chip *chip = dev_get_drvdata(&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;
	return 0;
}
}
#endif
#endif