SM8750: drop USB data roles over suspend, re-derive at resume#3049
Open
aanze wants to merge 2 commits into
Open
SM8750: drop USB data roles over suspend, re-derive at resume#3049aanze wants to merge 2 commits into
aanze wants to merge 2 commits into
Conversation
Add a SM8750 kernel patch reverting the u_role gating introduced by
0c8ee850572 ("usb: typec: ucsi: Add UCSI_USB4_IMPLIES_USB quirk for
X1E80100"). Without that quirk the USB data role is never cleared for
a charger-only partner and stays attached across suspend, keeping the
USB power island up; the firmware power-collapse then hard-hangs the
SoC when the cable is unplugged while suspended. Device-tested on the
AYN Odin 3.
Companion to the charger-only fix (0509): a dock DOES advertise USB data, so its role survives suspend, the USB power island stays up and the SM8750 firmware power-collapse hard-hangs on cable events while asleep. Kernel patch 0510 quiesces the USB role on every UCSI connector at suspend entry and re-derives it from fresh PPM state at resume: - per-instance state: the PM notifier block lives in struct ucsi (container_of in the callback), no globals - symmetric teardown: registered in ucsi_register(), synchronously unregistered first thing in ucsi_unregister() -- the path the pmic_glink PDR/SSR teardown takes -- so an ADSP restart cannot leave a notifier pointing at freed connectors; ucsi->connector is NULLed after the kfree - synchronization: role writes happen under con->lock and a ucsi->usb_role_suspended flag makes every role-setting path compute USB_ROLE_NONE while suspend is in progress, closing the race with the connector workqueue - no blind restore: at PM_POST_SUSPEND a partner task re-reads GET_CONNECTOR_STATUS and re-derives the role from fresh state, covering partners that stayed, vanished or appeared during sleep Device-tested on AYN Odin 3: dock attached -> suspend -> unplug while asleep -> clean resume; suspend/resume with charger and with dock kept attached also verified (charging intact after resume).
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.
Summary
case): fix the hard SoC hang on SM8750 (AYN Odin 3) when a
data-capable partner (dock) is unplugged while the device is
suspended. Split out of SM8750: fix suspend wedge from ucsi USB role on charger unplug #3039 as requested in review, fully reworked
to address the review findings there (per-instance PM notifier state
in struct ucsi, symmetric teardown on the pmic_glink PDR/SSR path so
an ADSP restart cannot leave a use-after-free, role writes under
con->lock plus a suspend flag closing the connector-workqueue race,
and no saved-role restore: the role is re-derived from a fresh
GET_CONNECTOR_STATUS at resume).
Testing
top of 0509 and flashed an AYN Odin 3.
clean resume (previously a hard wedge, forced reset needed).
Suspend/resume with charger and with dock kept attached verified as
well: charging intact after resume (the resume path re-derives the
role from fresh PPM state). Several cycles each. Builds clean with
W=1; checkpatch --strict 0/0/0.
Additional Context
PM_SUSPEND_PREPARE the system is fully awake, so the USB controller
processes the switch to USB_ROLE_NONE and drops the power island
before any device suspends; a device PM callback would give no
ordering guarantee against the USB controller's own suspend.
AI Usage
Did you use AI tools to help write this code? YES