Skip to content

J713: power the idle USB-C ports down (carry #528 with selftest fixtures) - #529

Merged
RyanTheTide merged 5 commits into
integration/aurorafrom
j713/usb-c-idle-power-carry
Oct 28, 2026
Merged

RyanTheTide merged 5 commits into
integration/aurorafrom
j713/usb-c-idle-power-carry

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

This carries #528 by Erik Bourget (powering the idle J713 USB-C ports down: apple,t8132-pmgr in simple-pm-bus, T8132 idle runtime PM for the ATC PHY and the dwc3-apple glue, and the J713 power domain policy) with one selftest fixture update. His four commits are unchanged and keep his authorship.

What this adds

selftests: apple-dcp: follow the T8132 idle runtime PM. The apple-dcp host selftests compile production code from phy/apple/atc.c and usb/dwc3/dwc3-apple.c, and went from 63/63 to 53/63 with #528 because the host stubs did not know the new atcphy_rpm_get()/atcphy_rpm_put() helpers, atcphy_setup_pipehandler() and the pre_core_rpm field. The fixtures now take the real helpers with idle_rpm left false, and a stub pm_runtime_get_noresume() fails the test if the PHY ever reaches runtime PM on non-T8132 hardware. No assertion changed, and the same fixtures still pass 63/63 on integration/aurora without #528.

Testing

Result
Host selftests (run.py) on this branch 63/63
KUnit, arm64 qemu: phy-apple-atc-mux, phy-apple-atc-t8132-pm, apple-atc-t8122-dp, apple-atc-tunnel, dwc3_host, dwc3_apple_state 47/47
drivers/phy/apple, drivers/usb/dwc3, simple-pm-bus.o at W=1, Fedora-based release config builds, no new warnings
Neo (J700, T8140), integration/aurora + #528 boots; Type-C ports, partner, dwc3 and ATC PHY binding and the attached USB hub identical to the 73x daily; 0 WARN, 0 Oops, 0 DART faults, 0 USB errors

The new runtime PM is reached only on T8132: idle_power_off is set only in atcphy_hw_t8132, and the dwc3 glue enables it only for apple,t8132-dwc3. On the hardware here the change is therefore a no-op, which is what the Neo boot checks; the T8132 behaviour itself rests on Erik's J713 results in #528. No KUnit suite covers dwc3-apple.c, so the new pre_core_rpm path is covered by his hardware testing only.

Supersedes #528.

🤖 Generated with Claude Code

erikwb and others added 5 commits October 27, 2026 20:04
The T8132 PMGR nodes are "apple,t8132-pmgr", "apple,t8103-pmgr", "syscon",
"simple-mfd". Their best match here is "apple,t8103-pmgr" (ONLY_BUS),
which is not their first compatible, so probe returns -ENODEV and both
nodes stay unbound.

The power domains in the mini PMGR take parents from the main PMGR, and
fw_devlink keeps waiting for the unbound mini PMGR node as a consumer of
those parents. On J713 this holds back the ATC common domains:

  sync_state() pending due to 388280000.power-management

genpd keeps a domain on until its provider's sync_state(), so these never
power down.

Bind the T8132 PMGRs as plain buses, like the other Apple PMGRs. With
sync_state() reached, genpd may switch off any unused domain the board
does not keep on. On J713 the two ATC common domains were the only ones
pending; the other T8132 boards were not tested.

Signed-off-by: Erik Bourget <[email protected]>
A J713 (MacBook Air M4) Type-C port keeps its ATC power domains on with
nothing plugged in. For the PHY's domain to drop, the PHY must runtime-
suspend, and its domain has to be the controller's ATCn_USB: that domain
also holds the PIPE handler, which the PHY writes to drive the USB
controller's reset and to route the PIPE, also while the Type-C mux
changes mode before the controller has resumed. A running controller
keeps the shared domain on by itself.

On T8132, once the PHY follows its PM domain with the genpd notifier,
enable runtime PM before the PHYs are created, so that they follow it
too. Power the device for each operation that can reach the hardware:
the USB2 and USB3 PHY ops, the controller's reset, the Type-C mux, and
the deferred SuperSpeed retry. The orientation switch only records the
orientation, and T8132 creates no DisplayPort PHY. Shutdown touches the
hardware only for an owned common epoch, which holds the device on.

Hold a reference while a power-down would lose state: a mode or a host,
a PIPE away from its parked dummy backend or between backends, and the
common-power epoch of a USB3 admission, which only its own stop may end.
The rest is the baseline the restore below sets up. With nothing held,
the PHY autosuspends after 2 s, which spans the burst of mux, orientation
and reset calls of one plug. Unbind drops a hold still taken.

The domain then switches off with the controller's and resets the block,
so also restore the PHY state after that on T8132, as on T8122. The
T8132 baseline is the one its probe sets up: the common block is
acquired only on USB3 admission, so it is not powered down, and the PIPE
is set up as at probe, with the dummy PIPE clock the USB2 controller
needs. System resume leaves a runtime-suspended PHY to its next
operation, as its domain may switch off again once resume completes.

Signed-off-by: Erik Bourget <[email protected]>
With no cable the controller's core is down, but on T8132 the
controller stays runtime-active, which would keep its power domain, its
DARTs and, through the PHY device link, the PHY powered. Allow runtime
PM there as on T6040, so that the glue's reference alone decides.

A port that has not seen a cable since boot has no core probe yet, and
runtime PM stays disabled until dwc3_core_probe() enables it. Until
then, on T8132, let the glue own runtime PM so that such a port can
suspend too, and hand it over powered, before the first reset deassert.
If that first core probe fails, runtime PM stays with the core and the
controller powered, as before.

Signed-off-by: Erik Bourget <[email protected]>
Place the USB controllers, their DARTs and the Type-C PHYs in their
ATCn_USB domains, as on T8103, and let the J713 policy manage ATCn_USB
and ATCn_COMMON: an idle port then switches both off. The ATCn_USB_AON
parents stay on, as handed over (apple,inherited-on): they are left out
of this change.

The SoC and board parts go together: a consumer of a domain the J713
policy disables never probes. The PHY shares the controller's domain
because it writes the PIPE handler in it, and the drivers must power
the domain down only while both are idle, so a DTB with this change
needs a kernel with the PHY and controller runtime PM changes. The
other T8132 boards keep these nodes disabled.

In three paired runs on a J713 on battery, with the display at 150 nits,
both idle ports drew 90 and 130 mW less than with their domains held on;
the first pair, 218 mW, included drift.

Signed-off-by: Erik Bourget <[email protected]>
The J713 idle power-down wraps the ATC mux callback in atcphy_rpm_get()
and atcphy_rpm_put(), brings a USB2-only PHY back through
atcphy_setup_pipehandler() after its domain was off, and gives the
dwc3-apple glue a pre_core_rpm flag.

Extract the production runtime PM wrappers next to the mux callback,
and atcphy_setup_pipehandler() where the restore calls it, and add the
idle_rpm, rpm_held and pre_core_rpm fields to the fixture structs. The
fixture PHYs and controllers are not T8132, so all three stay false: a
PHY runtime PM call would trip the existing root-port mocks or the new
pm_runtime_get_noresume() stub. No assertion changes.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide
RyanTheTide merged commit 93de587 into integration/aurora Oct 28, 2026
@RyanTheTide
RyanTheTide deleted the j713/usb-c-idle-power-carry branch October 28, 2026 00:51
erikwb pushed a commit to erikwb/linux that referenced this pull request Oct 28, 2026
Brings the J616s batch5 kernel (the tree running on the M4 Pro) up to the
current integration/aurora, which adds aurora-silicon#524 (J713 T8132 energy model), aurora-silicon#526
(the T6041 display fabric carry, whose peer allocation field group batch5
already has) and aurora-silicon#529 (J713 USB-C idle power).

Conflict resolution:
- selftests apple-dcp rate.py: keep batch5's version. Its fixtures follow
  aurora-silicon#451's desktop adaptive sync and the T6041 external EDID. The
  integration/aurora side only changed how the lookup_mode() definition is
  found; its line-start pattern also matches the indented
  "lookup_mode(dcp, ..." call that batch5's iomfb.c has before the
  definition, while batch5's 'bool lookup_mode(' marker finds the
  definition in either form.

aurora-silicon#529's ATC and dwc3 changes merge cleanly beside aurora-silicon#516's two-lane DP pin D.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants