Repository navigation
phy: apple: atc: enable T6030 runtime idle power-off - #4367
DjDeveloperr wants to merge 10 commits into
Conversation
t6030.dtsi lists its PMGR register banks as "apple,t6030-pmgr",
"apple,t8103-pmgr", "syscon", "simple-mfd". Because
simple_pm_bus_probe() refuses ONLY_BUS matches that are not the first
compatible string, the T6030 PMGR banks never bound, leaving
sync_state() permanently pending on ps_atc{0,1,2,3}_common (due to
pmgr_mini) and blocking genpd from clearing GENPD_FLAG_DEFER_OFF.
Add "apple,t6030-pmgr" to simple_pm_bus_of_match[] and extend
tools/asahi/pmgr-bus-tests.py with T6030 positive and negative checks.
Signed-off-by: DjDeveloperr <hey@djdev.me>
On T6030, the four ATC display crossbars sit in ps_atc{0,1,2,3}_usb
and previously fell back to the non-RPM T6020 hw table, holding the
ATC USB and common power domains powered continuously even when no
output is selected.
Add apple_dpxbar_hw_t6030 with t6030_flow, no_tunable, and runtime_pm
enabled and match "apple,t6030-display-crossbar" ahead of the T6020
fallback, matching T8122, T8132, and T6041.
Signed-off-by: DjDeveloperr <hey@djdev.me>
Enable runtime idle power-off for T6030 (M3 Pro) ATC PHYs: - Guard apple_atc_dp_tunnel_rate_source() against touching core MMIO when any idle_rpm PHY is outside USB4/TBT mode (matching the existing T8132 guard; leaving CIO mode already stops the tunnel clock). - Allow DP-only PHYs in atcphy_pd_can_power_off() when their attached power domain (ps_atcN_common) lacks apple,always-on even though its fabric bus parent (ps_lw30) is always-on. - Advertise apple,idle-power-off on atcphy0, atcphy1, atcphy2, and the HDMI DP-only atcphy3 in t6030.dtsi (atcphy_hw_t6030 already sets restore_after_pd_off and sleep_drops_common), and drop the apple,always-on override on ps_atc3_common in t603x-j514s-j516s-hdmi.dtsi now that atcphy3 and atcphy3_xbar manage ps_atc3_common dynamically and restore after power loss. - Extend atc-idle-pm-test.dtso and atcphy_test_idle_power_off_dt() in atc-test.c with T6030 USB-C and DP-only positive/negative cases. Signed-off-by: DjDeveloperr <hey@djdev.me>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
…PM on unbind Propagate failures from atcphy_restore_after_pd_off() instead of clearing pd_was_off early and letting callers proceed: - Defer clearing pd_was_off until cold restore completes cleanly. - Preserve atcphy->mode on power-off, PIPE-parking, and mode-replay failures; keep pipe_pending set rather than falsely recording ATCPHY_PIPEHANDLER_STATE_DUMMY when PIPE parking fails. - Propagate the error across callers including atcphy_dwc3_reset_deassert() and atcphy_resume(), and update host-test stubs/fixtures accordingly. - Add KUnit regression tests covering T6030 cold-restore PIPE parking timeout and DP-only mode-replay failure. In apple-display-crossbar, register a devm cleanup action right after devm_pm_runtime_enable() to serialize against active mux operations, mark the provider removed, and drop any runtime-PM references still held for selected or preselected outputs before runtime PM is disabled on unbind. Signed-off-by: DjDeveloperr <hey@djdev.me>
… on unbind Address cold-restore and crossbar-unbind edge cases: - Clear t8103_dummy_pending alongside pipe_pending once cold restore parks the PIPE on a freshly powered-up domain, so T8103 reset deassert retries are not stuck returning -EBUSY. - Discharge pending J700 usb_off_pending shutdowns after domain loss and baseline atcphy_power_off() instead of replaying the pre-OFF mode into the usb_off_pending guard. - In apple_dpxbar_rpm_release(), call apple_dpxbar_t6030_link(..., false) for any selected T6030 output while its runtime-PM hold is still owned so shared-domain registers do not retain stale enables or FIFO clocks across provider unbind/rebind. - Capture apple_dpxbar_t8103_link_up() debug register reads under dpxbar->lock before unlocking. Signed-off-by: DjDeveloperr <hey@djdev.me>
Address three state-recovery edge cases across cold restore and crossbar unbind: - Run pending atcphy_restore_after_pd_off() before the mode_dirty/pipe_pending guards in atcphy_dp_configure() and atcphy_dp_stop() so a transient PIPE timeout during cold restore does not trap subsequent DP retries or stop in -EBUSY without retrying restore. - Track whether cached common/AUX register ownership was already forgotten for the current domain-loss event (pd_state_forgotten) so retrying an incomplete replay without a second domain loss preserves partially acquired ownership (such as J700 aux_power_requested) for atcphy_power_off() to unwind cleanly. - Extract locked T8103 and T602x disconnect helpers in apple-display-crossbar and run the matching layout disconnect sequence from apple_dpxbar_rpm_release() while the runtime-PM hold is still owned, instead of only quiescing T6030. Signed-off-by: DjDeveloperr <hey@djdev.me>
…retries Close four remaining cold-restore recovery edge cases across T6030, T8103, and J700: - When a Type-C mux update requests SAFE (APPLE_ATCPHY_MODE_OFF) after a power-domain loss on a non-T8132-common-owned PHY, restore directly to OFF and clear mode_dirty rather than failing to replay an obsolete previous mode. - Clear stale t8103_usb3_retry alongside t8103_dummy_pending once cold PIPE parking succeeds so a later same-mode USB3 mux event cannot reconnect the PIPE while DWC3 is held in reset. - Run atcphy_restore_after_pd_off() unconditionally at the start of atcphy_dp_stop() and atcphy_dp_configure() so pending cold restores in USB3 and OFF modes are completed before dirty/pending guards. - Call atcphy_restore_after_pd_off() at the start of j700_dp_configure() (and wrap the J700 DP configure path with atcphy_rpm_get/put) so rate and stop retries recover from an incomplete AUX replay instead of returning -EBUSY, and stub atcphy_restore_after_pd_off() in the apple-dcp unwind host selftest. Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 8843ffd50af14e5d9fa23fc6275ae1412ec74922
Checked: T6030 selects idle power-off through DT and the block's compatible. The crossbar serializes PM get/put against provider removal and clears selected outputs before dropping their references. Cold-restore errors preserve the pending state so callers can retry. The current head also handles SAFE/OFF without replaying the old mode and balances the temporary PM reference in the J700 DP path. Exact-head DT checks passed.
When a valid superseding Type-C mux update arrives after a power-domain off event, restore to the baseline OFF state before switching rather than replaying the old mode first. This avoids failing J700 fixed-hub SAFE (which maps to USB2) or T6030 DP-to-USB2 transitions on obsolete DP AUX or RCAL bring-up, while preserving the current mode if the target mode is rejected by atcphy_mux_check(). Also check that the restored mode supports physical DisplayPort before programming the AUSPLL in atcphy_dp_configure(), and invalidate T602x tunnel ownership flags, saved registers, DP IN rates, and cached DP link rate in atcphy_forget_common_state() on domain loss. Update the apple-dcp host selftest struct stubs to carry the invalidated tunnel fields. Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 5bea9d8aed1d43f81930ff656c8613d9a0509b80
Checked: The superseding mode must pass the mux capability check before the stale mode is discarded. Failed cold restore keeps the previous mode for retry, and physical DP configuration now checks the restored mode before programming the PLL. Domain loss clears the cached link rate and tunnel state. All eight DP-drive controls and 17 selected PHY retry, PIPE, unwind and AUX controls passed at this head.
…l/validate on cold restore Avoid replaying an obsolete pre-domain-loss USB3 mode in atcphy_usb3_power_off() and atcphy_usb3_set_mode() when tearing down to OFF or falling back to USB2 device mode on PHYs with restore_after_pd_off, preventing failed RCAL polls from blocking phy_power_off() and pinning PHY power_count and runtime-PM references. Also run atcphy_restore_after_pd_off() and reject dirty/pending PIPE state in apple_atc_dp_tunnel_rate(), apple_atc_dp_tunnel_rate_source(), and apple_atc_dp_tunnel_open(), clear tunnel_dpin_rate[] on idle-rpm stop, and report zero usable DP lanes in atcphy_dpphy_validate() while a cold restore is pending or incomplete. Signed-off-by: DjDeveloperr <hey@djdev.me>
RyanTheTide
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES at 2ad5fc9
Failure: atcphy_usb3_set_mode() loses the USB2 target when configuration times out after a successful cold restore to OFF (drivers/phy/apple/atc.c:5392–5403, 5438–5457). I replayed the shipped host fixture with one USB2 configuration timeout. The prior code returns ETIMEDOUT, then succeeds on the next identical request and reaches USB2. This head returns ETIMEDOUT, then EBUSY with mode still OFF and dirty. The retry never attempts to configure USB2. Keep the fallback target available on retry.
Failure: atcphy_dpphy_validate() now reports zero lanes during pending cold restore (drivers/phy/apple/atc.c:5650–5655). The ordinary DPTX maximum-lane callback treats a successful result below two as four lanes (drivers/gpu/drm/apple/dptxep.c:440–457). A pending cold restore on a previously valid two-lane USB3+DP assignment now advertises four. Native DPTX can instead reject the request before the operation that would restore the PHY. Make the pending-restore result explicit to the DPTX callers.
Checked: All 39 shipped USB3 host cases passed, and hosted DT checks passed at this head.
…nd AUX state Fix six cold-restore and teardown edge cases across T8122/T6030, T8132, and T600x ATC PHYs: 1. Avoid replaying obsolete SuperSpeed modes during USB2-only device startup in atcphy_usb2_set_mode() so DWC3 can deassert reset without stalling on SuperSpeed RCAL after domain loss. 2. Restore directly to the USB2 fallback target inside atcphy_restore_after_pd_off() in atcphy_usb2_set_mode() and atcphy_usb3_set_mode(), restoring the prior mode on error so transient failures remain retryable with or without a second domain loss. 3. Clear t8132_common_owned once per domain loss in atcphy_forget_common_state() and allow pre-epoch teardown/fallback/mux shortcuts when the T8132 domain went off before any common touch, preventing pinned power_count and runtime-PM references. 4. Allow rate == 0 tunnel clock teardown to proceed when mode_dirty or pipe_pending is set (and short-circuit cleanly while pd_was_off) in apple_atc_dp_tunnel_rate_source() and apple_atc_dp_tunnel_rate(). 5. Record dp_t8122.aux = true in atcphy_dp_aux_on_t8122() only when atc_t8122_dp_aux_is_on() confirms power-up, turning AUX off on failure so DP validation reports 0 lanes instead of stale lane counts. 6. Check for CIO mode before calling atcphy_restore_after_pd_off() in apple_atc_dp_tunnel_open() so an idle OFF PHY is not woken or touched. Signed-off-by: DjDeveloperr <hey@djdev.me>
What:
Enable runtime idle power-off for unused Apple T6030 (M3 Pro) ATC PHYs and display crossbars, following the T6041 pattern:
apple,t6030-pmgronsimple-pm-busso all four T6030 PMGR banks bind cleanly and do not holdsync_stateonatc*_commonoratc*_*power domains.arch/arm64/boot/dts/apple/t6030.dtsiaddsapple,idle-power-offtoatcphy0–atcphy3(using their existingps_atc0_usb–ps_atc2_usb,ps_atc3_common, and crossbarpower-domains), andarch/arm64/boot/dts/apple/t603x-j514s-j516s-hdmi.dtsiremovesapple,always-onfromps_atc3_common..runtime_pm = trueonapple_dpxbar_t6030_hwindrivers/mux/apple-display-crossbar.c, quiesce any selected output across allruntime_pmlayouts (T6030/T6041/T8132, T8103, and T8122/T602x) and drop held runtime-PM references via a serialized devm cleanup action beforedevm_pm_runtime_enable()unwinds on provider unbind, and capture T8103 link-up debug register reads underdpxbar->lock.atcphy_restore_after_pd_off()and domain-loss recovery indrivers/phy/apple/atc.c:pd_was_offset and preserveatcphy->mode/pipe_pendingon power-off, PIPE-parking, or mode-replay failures instead of letting callers proceed.mode_dirty/pipe_pendingguards inatcphy_dp_configure()andatcphy_dp_stop(), and reject physical DP rate configuration inatcphy_dp_configure()with-EBUSYwhen the PHY is not in a physical DP mode (DPorUSB3_DP).pd_state_forgotten) separately from pending restore so retries after an incomplete replay unwind partially acquired ownership (such as J700aux_power_requested) cleanly while a genuine second domain loss forgets state again; clear stalet8103_dummy_pendingonce cold PIPE parking succeeds; invalidatedp_link_rateand tunnel state (tunnel_attempted,tunnel_saved,tunnel_saved_regs,tunnel_dpin_rate) on domain loss so stale tunnel snapshots are never kept across SAFE/power-loss transitions; finalize pendingusb_off_pendingtransitions toOFF; and skip replaying an obsolete prior mode inatcphy_mux_update_to()when a valid superseding target mode (includingOFFandUSB2/ fixed-hubSAFE) replaces it after domain loss.atcphy_test_t6030_restore_pipe_park_fail,atcphy_test_t6030_restore_dp_mode_fail) plus matching host-test fixture updates.Tested:
5bea9d8aed1d43f81930ff656c8613d9a0509b80built cleanly for ARM64 (Image,apple/t6030-j516s.dtb,phy-apple-atc.ko,mux-apple-display-crossbar.ko, zero warnings in changed drivers).5bea9d8aed1d43f81930ff656c8613d9a0509b80:pmgr-bus-tests.py,atc-usb3-tests.py(39 cases),atc-dp-drive-tests.py(8 cases),t6030-clock-tests.py(22 cases),atc-cio-sleep-tests.py(41 cases + 11 negative controls),atc-t8132-usb3.py(13 cases), andapple-dcpselftests (103/103 cases), plus exact-function host MMIO checks covering supersedingSAFE/USB2after domain loss, non-DPatcphy_dp_configure()rejection, and T602x tunnel state invalidation.Mac15,7,t6030-j516s, exact head5bea9d8aed1d43f81930ff656c8613d9a0509b80kernel, modules, andt6030-j516s.dtb):atcphy-mode(includingatcphy_test_idle_power_off_dt), 7/7atcphy-t8132-pm(includingatcphy_test_t6030_restore_pipe_park_failandatcphy_test_t6030_restore_dp_mode_fail), 16/16atcphy-t8152, and 2/2atcphy-t8103-dp.simple-pm-buswith zero pendingsync_state.70304c000.mux,b0304c000.mux,f0304c000.mux,130304c000.mux) stayedsuspendedwithactive_ms=0; liveunbind/bindof130304c000.muxsucceeded cleanly withstatus=suspended,active_ms=0,atc3_*remainingoff-0, and zero warnings.1303000000.phy(HDMI port with no display attached) suspended (status=suspended) and all sevenatc3_*domains (atc3_usb,atc3_usb_aon,atc3_cio_usb,atc3_cio_pcie,atc3_cio,atc3_pcie,atc3_common) enteredoff-0.1x s2idle(rtcwake -m freeze -s 8) +2x deep(rtcwake -m mem -s 10, with1.0.0b19stage2 tunables) all passed (suspend_stats/success=3,fail=0,last_failed_errno=0,boot object resumes 0 -> 1 -> 2), preserving idleoff-0across every wake with NVMe and USB4 dock intact and zero new kernel errors.Risk: two-way · M3 Pro (T6030). Scoped to T6030 PMGR/ATC/display-crossbar runtime PM,
apple_dpxbar_rpm_release()teardown, andatcphy_restore_after_pd_off()failure/domain-loss handling; a plain revert restores prior always-on behavior. Non-T6030 SoCs keep existing behavior; active Type-C/USB4/DP ports continue to hold their runtime-PM references while in use.Not yet:
dcpext0firmware,apple-dcpselectsfixed_xbarand setsatcphy3to DP mode at probe while bound, so the fixed HDMI port remains active whendcpext0is bound (no regression from current behavior; dynamic HPD-gated fixed-HDMI release indcpis separate follow-up work requiring physical HDMI display testing).