Skip to content

BatteryPlus: RK817 discovery fallback and PMIC-mode resume snap - #1

Open
Jacob-Matthew-Cook wants to merge 2 commits into
Mikhailzrick:mainfrom
Jacob-Matthew-Cook:rk817-discovery-and-pmic-resume-snap
Open

Jacob-Matthew-Cook wants to merge 2 commits into
Mikhailzrick:mainfrom
Jacob-Matthew-Cook:rk817-discovery-and-pmic-resume-snap

Conversation

@Jacob-Matthew-Cook

Copy link
Copy Markdown

Summary

  • What is the goal of this PR? Upstream two fixes ROCKNIX carries for RK817-based handhelds (RK3326/RK3566).
    1. Discovery accepts voltage_avg when voltage_now is absent. The RK817 charger driver exposes only the averaged reading, so voltage mode exited with "No battery voltage path detected".
    2. PMIC mode snaps the visible percent on resume. The step limiter otherwise hides a kernel-side correction made across a sleep: after a 10 h suspend the kernel read 63 % while the daemon (and the frontend) stayed at 87 %, because the device woke on the charger and the limiter never counts down while charging.

Testing

  • How was this tested? Built into ROCKNIX images for RK3326 and RK3566; RG353M (RK817) in both modes.
  • Test results: (1) voltage mode starts and tracks on RK817. (2) 19 min charging sleep from 71 %: kernel 85 % at wake, frontend 85 % within seconds, /tmp/battery.percent tracking the kernel afterwards; a daemon restart with a stale value resyncs immediately.

Additional Context


AI Usage

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01RNwUueUVhNqodU1izyxqAK

Jacob-Matthew-Cook and others added 2 commits September 14, 2026 10:28
Battery discovery only accepts a supply exposing voltage_now, so in
voltage mode the daemon exits with "No battery voltage path detected"
on PMICs whose driver reports the averaged reading instead. The
Rockchip RK817 charger driver (RK3326/RK3566 handhelds) exposes
voltage_avg only. Use voltage_avg when voltage_now is missing; the
averaged value is, if anything, a better input for the daemon's own
smoothing, and unit autodetection is unchanged.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNwUueUVhNqodU1izyxqAK
The long-gap snap only exists in voltage mode. In PMIC mode a resume
goes through the ordinary step limiter, which moves one point at a time
and never counts down while charging, so a kernel gauge that corrected
itself across a sleep is hidden from the UI: after a 10 h suspend on an
RG353M the kernel read 63 % while /tmp/battery.percent, and with it the
frontend, stayed 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; smoothing is there for jitter, not for corrections.
Snap to it whenever a resume is detected.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNwUueUVhNqodU1izyxqAK
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.

1 participant