Skip to content

power: supply: apple_tristar_charger: Shared input sag hook, confirmed droop - #175

Merged
henrikklee merged 2 commits into
mainfrom
tristar-sag-hook
Dec 4, 2026
Merged

henrikklee merged 2 commits into
mainfrom
tristar-sag-hook

Conversation

@henrikklee

Copy link
Copy Markdown

Follow-up to #164 (Grier Johnson's A10X charging fix).

  • Move input sag detection into a chip hook. The VBUS droop backoff ran inline in the poll loop and only knew the Orion VBUS ADC. It is now an input_sag() hook in tristar_chip_info, acted on in one shared place called from the ramp and the guard. Boards without a VBUS ADC (J127/J128 through the PMIC's input-collapse state) can plug in later. Thresholds, read retries and the one-step backoff are unchanged; boards without a VBUS channel in their device tree see no change.
  • Confirm a sag before lowering the limit. One sample below 4.5 V capped the input for the whole attachment; now the first sag sample holds the step and only a second one in a row lowers the limit, as the SN2400 driver's foldback debounce does. Faults still fall back at once.

Compile-checked with orchard build hardware-check --platform apple-16k --kernel (the charger builds without warnings).

Assisted-by: LLM

… chip hook

The VBUS droop backoff ran inline in the poll loop and only knew the
Orion VBUS ADC. Boards without one (the A10's J127/J128, for example)
can still tell a sagging source, from the PMIC's input-collapse state,
but had no place to plug that in.

Add an input_sag() hook to tristar_chip_info that reports none, unsure,
droop or fault, and act on it in one shared place, called from the ramp
and the guard. The VBUS ADC reader becomes the hook of both PMICs; it
does nothing on boards whose device tree gives no VBUS channel. The
thresholds, the read retries and the one-step backoff are unchanged.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
…ng the limit

One VBUS sample below 4.5 V lowered the input limit for the rest of the
attachment. A short dip during a load step, or one noisy conversion, is
enough for that, and the attachment then charges slower until unplug.

Hold the step on the first sag sample and lower the limit only when the
next sample still shows it, as the SN2400 driver's foldback debounce
does. Faults (overvoltage, brownout, a VBUS still unreadable after its
retries) fall back at once as before.

Assisted-by: LLM
Signed-off-by: Henrik Klee <henrik@goat-code.com>
@henrikklee
henrikklee merged commit 6e3682a into main Dec 4, 2026
4 checks passed
@henrikklee
henrikklee deleted the tristar-sag-hook branch December 4, 2026 21:46
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