Repository navigation
Conversation
During EPR entry/exit the EC intentionally puts the system into a transitional clamp state: charger input current is collapsed to 0mA (learn mode on) and a hard AP throttle is asserted via update_pmf_events(BIT(PD_PROGRESS_ENTER/EXIT_EPR_MODE), 1). On a healthy transition this lasts ~1.1s and both are released after the new contract lands. When the transition fails, two pieces of that transitional state currently persist beyond the transition: 1. Neither failure handler releases the PMF transition event. The normal release path, clear_prochot(), only clears the ENTER event when cypd_get_ac_power() > 100W, which is never true after a failed EPR entry (the standing SPR contract is at most 100W), so the hard throttle outlives the transition it was meant to cover and is left to the 3s force_clear_pmf_prochot backstop at best. Release the ENTER/EXIT transition events at both points where the flow is abandoned: the EPR_MODE_ENTER_FAILED/default branch of cypd_update_epr_state(), and the retry-exhausted branch of epr_flow_pending_deferred() (the path taken when the EPR event from the PD controller never arrives). The failure handler now leaves the system in the plain-SPR state (input limit is already restored by the existing cypd_update_port_state() call on both paths) instead of the mid-transition state. 2. The "EPR fail, do not retry" latch (epr_active = 0xff) is only cleared by clear_port_state() on a PORT_DISCONNECT/hard-reset response. cypd_update_port_state() deliberately preserves it, and a CCG_RESPONSE_PORT_CONNECT does not reset it, so if the disconnect response is missed (the same event-loss class the deferred retry exists for) or EC RAM outlives a PD controller reset, the latch outlives the connection that caused it and the port can never enter EPR again. Clear the latch on PORT_CONNECT: a fresh attach is a new connection, so the do-not-retry intent (no EPR retry on the contract that failed) is preserved while the latch can no longer outlive that connection. Field evidence (FW16 Ryzen AI 300 "tulip", RTX 5070, 240W EPR, EC tulip-4.0.1): instrumented captures show the system latching into the transitional state - charger input stuck at ~0/500-800mA, hard throttle asserted (BIOS runs slow, survives OS reboot), and a port stuck attach-without-contract where EC_CMD_GET_PD_PORT_STATE returns zeros and the EC reports "AC not connected". Resets of either or both PD controllers do not clear it (EC RAM state re-imposes it after every reset); only a physical AC removal recovers, because only the PD_PROGRESS_DISCONNECTED path clears the progress/event state. A healthy reference trace of the same transition (throttle on, input 500mA, ~1.1s, then release) was captured for comparison. Issue: tyeth/framework-system#1 Telemetry/data: https://github.com/tyeth/fw16-gpu-watchdog Related: FrameworkComputer/SoftwareFirmwareIssueTracker #160 #193 #241 #243 Compile-untested: no Zephyr build environment was available; changes were limited to call sites and symbols already used in these files and verified by read-through. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Oct 20, 2026
Author
|
Apologies for using AI to assist me with generating this patch and details. My intentions were good, even if not ideal behaviour 😬 And it needs #91 really. |
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.
Instrumented investigation and full telemetry: tyeth/framework-system#1 and https://github.com/tyeth/fw16-gpu-watchdog (public). Fork-side review copies: tyeth#1, issue tyeth#3.
Problem
On FW16 (Ryzen AI 300 "tulip", RTX 5070 module, 240W EPR charging), a failed EPR entry/exit leaves the system in the mid-transition state instead of the plain-SPR state, and that state persists until physical AC removal:
epr_active = 0xff("EPR fail, do not retry") and the latch survives PD controller resets — verified live: resets of controller 0, 1, or both do not clear it; the EC re-imposes the state from EC RAM. Only a physical AC disconnect recovers, because only thePD_PROGRESS_DISCONNECTEDpath clears the progress/event state.Full bug description with instrumented evidence (incident captures, healthy 1.1s reference trace of the same transition, stuck-port diagnostics): tyeth/framework-system#1. Raw telemetry/data repo: https://github.com/tyeth/fw16-gpu-watchdog. Related upstream reports: FrameworkComputer/SoftwareFirmwareIssueTracker#160, #193, #241, #243.
Why exactly these lines
The transitional clamp is intended behavior (healthy trace:
set AP throttling type 1 to on→ input forced to 500mA →Entered EPR→ restore →throttling off, ~1.1s). The bug is only that the failure paths do not undo the transitional state:cypd_update_epr_state()—EPR_MODE_ENTER_FAILED/default branch (cypd_ccg8.c): the handler latches the port but never releases the PMF transition event. The normal release path,clear_prochot()inlotus/src/cpu_power.c, only clears the ENTER event whencypd_get_ac_power() > 100W— which can never be true after a failed EPR entry, since the standing SPR contract is at most 100W. So the hard throttle outlives the transition and is left to the 3sforce_clear_pmf_prochotbackstop at best. The patch releases the ENTER/EXIT transition events (update_pmf_events(..., 0), the exact callsclear_prochot()makes) at the point the flow is declared failed. The charger input limit needs no new code here: thecypd_update_port_state()call that already follows the EPR event restores the limit from the standing SPR contract via the existingEPR_PROCESS_MASKrestore block.epr_flow_pending_deferred()— retry-exhausted branch (cypd_ccg8.c): this is the path taken when the EPR event from the PD controller never arrives (the handler's own comment: "Sometimes, EC does not receive the EPR event... from PD chip"). It already restores the input limit viacypd_update_port_state()on the active charge port, but it too leaves the PMF transition event set. Same two-line release.cypd_port_int()—CCG_RESPONSE_PORT_CONNECT(cypress_pd_common.c): theepr_active = 0xfflatch is cleared only byclear_port_state()on a PORT_DISCONNECT/hard-reset response;cypd_update_port_state()deliberately preserves it, and a fresh attach does not reset it. If the disconnect response is missed (the same event-loss class item 2 exists for), or EC RAM state outlives a PD controller reset, the latch outlives the connection that caused it and the port can never enter EPR again. The patch clears the latch when a new connection is reported, beforecypd_update_port_state()re-derivesepr_activefrom the status register.What this deliberately does not touch
clear_prochot()after the SB-RMI limit write, preserving the "wait for the charger to enter bypass mode" sequencing.Risk analysis
update_pmf_events(bit, 0)is idempotent (events &= ~pd_event; no action unless the mask actually changes) and is exactly whatclear_prochot()calls on the healthy path, including the GPUGPIO_FUNC_ACDCrestore tied to the ENTER bit. If other PMF events (e.g.PD_PROGRESS_DISCONNECTED) are still set, the throttle correctly stays asserted.epr_flow_pending_deferred), only one active charge port exists, and the failing-first ordering is benign: the surviving flow re-raises nothing because the event was per-flow anyway, and the 3s backstop still covers it.CONFIG_PD_CCG8_EPRand conditioned on the0xffsentinel, so non-EPR boards and normal attaches are untouched.How a FW16 owner would test
set AP throttling type 1 to on→CL: ... i500 ...→Entered EPR→CL: ... i5000 v48000→throttling off, ~1.1s) and that 240W negotiates.EPR failed/enter EPR stuck, retry!give-up, and then: input current returns to the SPR contract value (not 0/500mA),h_prochot_l/0x3E22 hard mask deasserts without waiting onpmf update timeout, and the system is not throttled.Entered EPRon the new connection (previously required a full AC-removal event).🤖 Generated with Claude Code