diff options
author | Chris Morgan <macromorgan@hotmail.com> | 2024-09-26 09:43:45 -0500 |
---|---|---|
committer | Sebastian Reichel <sebastian.reichel@collabora.com> | 2024-10-16 23:40:02 +0200 |
commit | bded860c3110a45fe091f67b2fe6f3b2bb096165 (patch) | |
tree | 4ea07b87bec8c9c4943348a9d888faaa97ff586b /drivers/power | |
parent | c46a9ee5c6210682611d3d4276436c23a95e1996 (diff) | |
download | lwn-bded860c3110a45fe091f67b2fe6f3b2bb096165.tar.gz lwn-bded860c3110a45fe091f67b2fe6f3b2bb096165.zip |
power: supply: rk817: stop updating info in suspend
The driver has a thread that checks the battery every 8 seconds. Stop
this thread during device suspend as while the device is suspended not
all values seem to be read correctly (such as battery voltage). The
resume function triggers the thread to start again.
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20240926144346.94630-2-macroalpha82@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/supply/rk817_charger.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c index a3d377a32b49..d81fc7bd1cd2 100644 --- a/drivers/power/supply/rk817_charger.c +++ b/drivers/power/supply/rk817_charger.c @@ -1202,6 +1202,15 @@ static int rk817_charger_probe(struct platform_device *pdev) return 0; } +static int __maybe_unused rk817_suspend(struct device *dev) +{ + struct rk817_charger *charger = dev_get_drvdata(dev); + + cancel_delayed_work_sync(&charger->work); + + return 0; +} + static int __maybe_unused rk817_resume(struct device *dev) { @@ -1213,7 +1222,7 @@ static int __maybe_unused rk817_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(rk817_charger_pm, NULL, rk817_resume); +static SIMPLE_DEV_PM_OPS(rk817_charger_pm, rk817_suspend, rk817_resume); static struct platform_driver rk817_charger_driver = { .probe = rk817_charger_probe, |