Repository navigation
fwk: reapply an explicitly requested battery charge limit - #100
Open
thelogicmatrix wants to merge 1 commit into
Open
thelogicmatrix wants to merge 1 commit into
thelogicmatrix wants to merge 1 commit into
Conversation
Another control path can disable or replace the live sustainer while the cached requested percentage stays unchanged. Re-sending that percentage then succeeds without restoring the requested static thresholds. Invalidate the cache on an accepted explicit SET in stage 0. Preserve the caps of active Battery Extender stages and leave timer/GET behavior alone. Add a host regression to the existing utility runner and export optional GCC coverage. Use Zephyr time units and the repository formatter to pass source checks. Keep minute/hour arithmetic 64-bit so the accepted 9999-minute reset interval is not truncated. Exercise extender deadlines, configuration round-trips and console timer controls as well as charge-limit recovery. Related: FrameworkComputer/SoftwareFirmwareIssueTracker#284 BUG=None TEST=python3 util/test_framework_battery_extender.py (10 pass) TEST=bash util/run_tests.sh (pass) TEST=lotus RO/RW build with Zephyr SDK 0.17.2 (pass) Change-Id: I3d0946955ea6b9c401674b42ae65ded7e531dc54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An explicit charge-limit SET can succeed without restoring the requested sustainer thresholds.
battery_percentage_control()compares the requested percentage withold_charger_limit, but another control path can disable or replace the live sustainer without changing that cache. Re-sending the same percentage then leaves the live configuration unchanged.Invalidate the cached percentage when
CHG_LIMIT_SET_LIMITaccepts a value inBATT_EXTENDER_STAGE_0. The existing call tobattery_percentage_control()then reapplies the requested static range, even if the stored percentage is unchanged. Active Battery Extender stages keep their existing caps. The periodic hook and GET command keep their existing behavior. The patch does not periodically reassert static thresholds over a separate host charge-control policy.This addresses the same-value SET defect. It does not establish which path originally changed the sustainer on the affected laptop, and it does not claim to repair fuel-gauge capacity estimates or all charge-limit failures.
Related field evidence is in SoftwareFirmwareIssueTracker#284. On a Laptop 16 Ryzen 7040 running BIOS 04.05 and EC
lotus-4.0.5-2246d58, re-sending 80 left the battery reported as charging at 96%. Changing the limit through 100, 60 and 80 changed the battery status to discharging. Archived samples show charging at 22:31:05 and discharging at 22:31:26 on 2026-10-22, Singapore time. A separate watcher recorded 95/80 before recovery and 81/80 afterward.Two corrections to the issue's original interpretation matter here. The sustainer already handles a percentage above its upper threshold, so a percentage jump does not by itself bypass that check. Also, the tool's
Charger Currentcomes from the charger's programmed current-limit register. It stayed at 2744 mA after the battery status changed to discharging, so it is not evidence of 2744 mA flowing into the battery. The event that changed the live sustainer configuration remains unknown.Validation:
battery_extender.ctranslation unit and the real protocol headers, with EC services mocked.util/run_tests.sh.lotusRO/RW images both build with Framework Zephyre414f3a266c2c83ef7fbde738cbe1990c12e11d6, CMSISada89e4063a02bf12797415ebab9d21f0cfaeef1, and Zephyr SDK 0.17.2. The build reports existing devicetree warnings in both versions.All 50 Chromium preupload checks pass on the complete consolidated change, including copyright, legacy-symbol, formatting and lint checks. The check runner uses an unprivileged account with the required Zephyr checkout and tool dependencies.
The inherited legacy board-fleet checks remain a validation limit.
make buildallrequires Chromium's multi-architecture coreboot SDK, which this environment lacks. The legacy host suite with the available native compiler stops on the unchangedmallinfo()call incommon/shared_mem_libc.c, which Debian 12 treats as a deprecated declaration with-Werror. Those separate build/test suites are not covered by the passing preupload result.Run the regression with Python 3.8+ and a C compiler on PATH:
Set
CCto select a different compiler. With GCC and gcov, export coverage using--coverage-dir /tmp/ec-coverage.AI disclosure: this patch and its regression tests were prepared with AI coding assistance. The executed validation and remaining limitations are listed above.
Cherry-pick status: