Skip to content

batteryplus: snap the visible percent on resume in PMIC mode - #3325

Merged
porschemad911 merged 1 commit into
ROCKNIX:nextfrom
Jacob-Matthew-Cook:batteryplus-pmic-resume-snap
Sep 14, 2026
Merged

porschemad911 merged 1 commit into
ROCKNIX:nextfrom
Jacob-Matthew-Cook:batteryplus-pmic-resume-snap

Conversation

@Jacob-Matthew-Cook

Copy link
Copy Markdown
Contributor

Summary

  • What is the goal of this PR? Make batteryplus show the kernel's post-sleep battery value in PMIC mode. The daemon's long-gap snap only exists in voltage mode; in PMIC mode a resume goes through the step limiter, one point at a time and never counting down while charging, so a kernel gauge that corrected itself across a sleep stays hidden from the UI. Snap to the kernel value whenever a resume is detected (SIGUSR1 or a ≥15 min loop gap). Patch on the upstream daemon (Mikhailzrick/knubat.components), upstream candidate.

Testing

  • How was this tested? RG353M (RK817, PMIC mode). Failure reproduced first: after a 10 h unplugged sleep the kernel corrected 88 % → 63 % at wake while /tmp/battery.percent, and so ES, stayed at 87 % because the device woke on the charger. Fixed daemon run in place of the stock one, then a built image with the patch.
  • Test results: 19 min sleep on a charger from 71 %: kernel 85 % at wake, ES header 85 % within seconds of waking, /tmp/battery.percent tracking the kernel afterwards. Restart of the daemon with a stale value also resyncs immediately.
  • Artifacts: none published; tested from a local build on the RG353M.

Additional Context


AI Usage

Did you use AI tools to help write this code? YES

🤖 Generated with Claude Code

The daemon's long-gap snap only exists in voltage mode. In PMIC mode a
resume goes through the ordinary step limiter, one point at a time and
never counting down while charging, so a kernel gauge that corrected
itself across a sleep stays hidden from the UI: after a 10 h suspend on
an RG353M the kernel read 63 % while /tmp/battery.percent, and so ES,
sat at 87 % because the device woke on the charger.

In PMIC mode the kernel value is the authority and has already done its
own reconciliation. Snap to it whenever a resume is detected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Jacob-Matthew-Cook
Jacob-Matthew-Cook marked this pull request as ready for review September 14, 2026 05:09
@Jacob-Matthew-Cook

Copy link
Copy Markdown
Contributor Author

@porschemad911 ready for review — small batteryplus patch, validated on the RG353M (details in the description). #3324 is the companion for the RK3566 sleep drain.

@porschemad911

porschemad911 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@Jacob-Matthew-Cook

Jacob-Matthew-Cook commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@porschemad911 Opened upstream with both (
PR#3220’s change and this as separate commits: Mikhailzrick/knubat.components#1 (voltage_avg discovery fallback + this PMIC-mode resume snap). Once it lands, both ROCKNIX patches can be dropped and the pin bumped.

@porschemad911
porschemad911 added this pull request to the merge queue Sep 14, 2026
Merged via the queue into ROCKNIX:next with commit d879bd0 Sep 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants