power: supply: bq27xxx: Stop and start delayed work in suspend and resume
authorMarek Vasut <marex@denx.de>
Sat, 4 Nov 2023 15:49:06 +0000 (16:49 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 15 Nov 2023 22:13:26 +0000 (23:13 +0100)
commitdfcb264a01a9199e8338a548731baf5bbe77ef19
tree0bb9aba3e87e1992d09807d18fed4e25e04884b1
parent5739da3e16ad0ebe99c31cabe960856b53eaaabe
power: supply: bq27xxx: Stop and start delayed work in suspend and resume

This driver uses delayed work to perform periodic battery state read out.
This delayed work is not stopped across suspend and resume cycle. The
read out can occur early in the resume cycle. In case of an I2C variant
of this hardware, that read out triggers I2C transfer. That I2C transfer
may happen while the I2C controller is still suspended, which produces a
WARNING in the kernel log.

Fix this by introducing trivial PM ops, which stop the delayed work before
the system enters suspend, and schedule the delayed work right after the
system resumes.

Signed-off-by: Marek Vasut <marex@denx.de>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20231104154920.68585-1-marex@denx.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq27xxx_battery.c
drivers/power/supply/bq27xxx_battery_i2c.c
include/linux/power/bq27xxx_battery.h