Skip to content

power: supply: bq27xxx: fix wrong battery states after resume

Michael Auer linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3power: supply: bq27xxx: report discharging at zero current without a chargerdrivers/power/supply/bq27xxx_battery.c+8 -01 reply
2/3power: supply: bq27xxx: retry a failed register read oncedrivers/power/supply/bq27xxx_battery.c+11 -02 replies
3/3power: supply: bq27xxx: keep the last values over a short read failuredrivers/power/supply/bq27xxx_battery.c include/linux/power/bq27xxx_battery.h+43 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] power: supply: bq27xxx: fix wrong battery states after resume

On a OnePlus 6 (bq27541 on i2c-qcom-geni) user space sometimes sees a wrong battery state right after resume.

Patch 1 fixes "Not charging" while on battery, when the current reads 0 after deep sleep. Patches 2 and 3 fix a battery that is reported as missing at 0 % after a failed read, which made the desktop start its critical battery action. It happened in about 1 of 350 resumes. Patch 2 covers a single missed transfer, patch 3 a failure that lasts longer.

All three are in daily use on a OnePlus 6 with an sdm845-mainline 7.1-rc1 based kernel, patch 1 since late September, patches 2 and 3 since early October. On power-supply for-next they were only build tested (W=1, arm64 and x86_64 allmodconfig).

Tool use: the analysis, the code and the commit messages were written with an LLM coding assistant (Claude Code). I reviewed all of it and tested it on my phone as described above.

Michael Auer (3):
power: supply: bq27xxx: report discharging at zero current without a
charger
power: supply: bq27xxx: retry a failed register read once
power: supply: bq27xxx: keep the last values over a short read failure

 drivers/power/supply/bq27xxx_battery.c | 60 ++++++++++++++++++++++++++
 include/linux/power/bq27xxx_battery.h  |  2 +
 2 files changed, 62 insertions(+)

base-commit: abbe0a96bdbadae9e29489a1528fa436c55aca25

Signature · 1 line
2.43.0