Repository navigation
usb: typec: report and mitigate SN201202x liquid detection - #1053
Conversation
Add a capability-gated Type-C contaminant state with unknown, none and liquid values. Notify sysfs and emit a port change uevent only when the state changes. Enable the SN201202x LDCM event, validate and decode its complete status snapshot in serialized work, and refresh it after controller reset and system resume. Keep this patch read-only so status reporting can be qualified independently from controller-side mitigation. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
Acknowledge liquid and indeterminate LDCM states by enabling the controller's mitigation before publishing them. Remove mitigation only after a clean snapshot, then re-read the detector before reporting dry. Keep the local Type-C role and data path disconnected while the state is liquid or unknown. On status or command failure, publish unknown, retain the safe local state and retry without a bounded failure window. Apply the same ordering to suspend-time events and controller reset recovery. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
The SN201202x SPMI driver is a separate module and calls tps6598x_block_read() and tps6598x_exec_cmd_tmo() for the LDCM status. With CONFIG_TYPEC_TPS6598X=m modpost fails on both undefined symbols. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
|
J616s test (kernel
Not merging until the s2idle A/B is clean. Dock plug and unplug could not be tested remotely. 🤖 Generated with Claude Code |
Picks up the tools/aurora-sep source-check fix (c60537c) and the current release branch, so CI runs against today's base. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
|
No-regression hardware run on the Neo (J700, two SN201202x ports), 11-08 01:33, silent, one-shot test kernel 7.3.0-aurora-b2t3 = integration/aurora 4114f76 + this PR's head 825ce7d (merged locally) + #1105: both ports expose |
On the J616s the dock port's USB3 PHY failed to come back after suspend-to-idle with liquid detection enabled (2 of 2 cycles; never without it). Every system sleep published "unknown" and every LDCM event did too, so a cable revalidation that ran before the detector was read again saw no plug and tore the partner down. The suspend prepare and resume also sent an LDCM command each time, even when nothing had changed. Keep the last result until the controller reports a new one: - read the detector synchronously in the interrupt and in .complete, before the cable state is applied, instead of publishing "unknown" and reading it later - treat a measurement in progress as "no new result" when an earlier result exists: no mitigation change, no publish, no wake from sleep - send the LDCM command only for a mitigation change, or when the controller state is unknown after a reset or a failed command - invalidate the state only when the controller was actually reset (its power state or event mask had to be restored) - revalidate the cable from the retry worker only when the published state changed Failed reads still publish "unknown" with mitigation enabled, and a liquid result is still reported only after the mitigation ACK. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
Picks up the current release branch so the test kernel and CI run against today's base. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
|
Note on my 01:33 Neo run: it used this PR's old head (825ce7d). GAPNEO since found that every suspend/LDCM IRQ published 'unknown' and cd321x_connect() hid the plug until 'none' (J616s dock USB3 lost after s2idle) and has the fix (gapneo/liquid 182b62d). The Neo has no dock on these ports, so that run could not show it; treat it as old-code evidence only. GAPNEO owns this PR now. |
|
Pushed c312d74: 182b62d "usb: typec: tipd: keep SN201202x ports up across liquid checks", plus a merge of integration/aurora 1eac5fa. Why. In the first hardware run on the J616s (2 suspend-to-idle cycles), the dock port's USB3 PHY did not come back: Code cause:
Change.
Checks (buildbox).
Next. No-regression run on the J616s (all 4 ports, the dock port, repeated s2idle), then the Neo once it is back. This stays a draft until those pass. |
The quiesce and transaction fixtures compile tipd_remove() and tipd_init() from core.c against a reduced struct tps6598x. Both now call through tps->contaminant_ops, so the fixtures stopped compiling and 20 apple-dcp host tests failed to build. Add the member and the two callbacks those paths use; the fixtures leave it NULL, as on controllers without liquid detection. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
|
J616s no-regression run, 2026-11-08 06:07-06:14 AEDT (lane GAPNEO; posted by the J616s queue keeper). Stage 2 DTB: integration J616s e4292d96.
Not exercised: a real liquid or contaminant event. Merge is held for Ryan's hands-on unplug/replug pass, because the mitigation can cut VBUS/charging. |
Summary
contaminantattribute withunknown,none, andliquidstatesThe first patch contains only the ABI and read-only status path so it can be qualified independently. The second patch adds the mitigation command and fail-safe connection policy.
Verification
git diff --check origin/integration/aurora..HEADLLVM=1 W=1Image and modules build (rc=0)class.o,spmi.o, andcore.obuild (
rc=0)sn201202x-pmKUnit suite, 29 passed andone existing
CONFIG_DEBUG_FS-only test skippedHardware qualification plan
Use a controlled resistance/connector fixture only; do not introduce free liquid. Instrument VBUS voltage and current independently of software.
Run the matrix on all four J616s HPM ports and both Neo HPM ports, in both cable orientations:
KOBJ_CHANGEtransition toliquidafter controller mitigation completes.noneand normal connection reconciliation.unknown, the local port stays disconnected, mitigation retries continue, and no source VBUS or sink charging is re-enabled.Record oscilloscope/current traces, uevents, sysfs state, controller errors, and kernel logs for every physical port. The fixture matrix (real contaminant, instrumented VBUS) needs hands on the machine; the dry no-regression runs below are what landing is gated on.
Hardware results (dry connectors, no regression)
contaminantreadsnoneon all 4 ports at boot and after each of 3 suspend-to-idle cycles (rtcwake -d rtc1 -m freeze).USB3 PHY bring-up failed (-110), USB2 onlyon the dock port).contaminant=noneon both ports before and after a suspend-to-idle cycle with a charger attached; journal-p errempty. The Neo has no dock, so it could not show the resume problem. It gets a re-run on c312d74 when it is back online.tipd_init()/tipd_remove()gain thecontaminant_opsmember. Before it, 20 of the 86 tests failed to build;run.shnow passes 86/86 on the buildbox.🤖 Generated with Claude Code