Skip to content

J713: power the idle USB-C ports down - #528

Merged
RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
erikwb:j713/usb-c-idle-power
Oct 28, 2026
Merged

RyanTheTide merged 4 commits into
aurora-silicon:integration/aurorafrom
erikwb:j713/usb-c-idle-power

Conversation

@erikwb

@erikwb erikwb commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

On a J713 (MacBook Air 13" M4), each USB-C port keeps its ATC power domains on with nothing plugged in. This series lets an idle port switch ATCn_USB and ATCn_COMMON off, and brings them back on plug.

Patches

  1. bus: simple-pm-bus: Add apple,t8132-pmgr: binds the T8132 PMGR nodes like the other Apple PMGRs. Without it the mini PMGR node stays unbound, and fw_devlink holds sync_state() of the ATC common domains back forever (sync_state() pending due to 388280000.power-management), so genpd never powers them down.
  2. phy: apple: atc: Let an idle T8132 PHY runtime-suspend: T8132 runtime PM for the Type-C PHY, plus T8132 support in the existing T8122 restore-after-power-off mechanism.
    • The PHY shares the controller's ATCn_USB, which holds the PIPE handler it writes.
    • Every operation that can reach the hardware resumes the device.
    • A reference stays held while a power-down would lose state.
    • It is enabled only when the PHY follows its PM domain through the genpd notifier.
    • It comes with a new KUnit suite, phy-apple-atc-t8132-pm.
  3. usb: dwc3: apple: Let an idle T8132 controller runtime-suspend: enables the existing T6040 idle runtime PM on T8132. The glue also owns runtime PM before the first core probe, so a port that has never had a cable can suspend too.
  4. arm64: dts: apple: t8132: Let the idle J713 USB-C ports power down: puts the controllers, DARTs and PHYs in ATCn_USB, as on T8103, and lets the J713 policy manage ATCn_USB and ATCn_COMMON. ATCn_USB_AON stays inherited-on.
    • This is one commit because a consumer of a domain the J713 policy disables never probes.
    • A DTB with it needs patches 2 and 3: an older kernel would fault on the first plug.

The other T8132 boards (j604, j623, j624, j715, j773g) keep the USB-C nodes disabled. Patch 1 lets sync_state() complete on all T8132 PMGRs. On J713 only the two ATC common domains were pending; the other boards were not tested.

Testing (J713)

  • Idle: with both ports empty, all four devices are runtime-suspended and ATC0/1_USB and ATC0/1_COMMON are off (only USB_AON stays on). There are no sync_state pending messages and no oopses or warnings.
  • Plug/unplug: each cycle restores from domain-off and drops again after unplug.
    • A USB keyboard on the front port (USB2) and on the back port. The back port runs the driver's own cold USB3 bring-up after a COMMON power-off (calibration=1 common=1 ret=0).
    • An iPhone, which enumerates high-speed and charges.
  • s2idle: with the ports idle, and with a keyboard attached through suspend (it keeps working).
  • Power: same-boot A/B on battery at 150 nits, both idle ports held on (power/control=on) vs allowed off. Three paired runs: 90 and 130 mW less in two of them; the first pair, 218 mW, included drift.
  • Static checks:
    • checkpatch --strict is clean on all four commits;
    • each commit builds W=1 (the only output in atc.c is the kernel-doc warnings already present on integration/aurora);
    • a full Image/modules/DTB build succeeds;
    • CHECK_DTBS + W=1 for all six T8132 DTBs shows no new warnings.
  • KUnit on arm64 QEMU: 41/41, including the 4 new T8132 power-management cases.

Not tested: DisplayPort alt mode, USB-C power delivery into the Mac, hubs.

This change was developed and tested by Claude (Anthropic), working with me on the J713.

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]>
RyanTheTide added a commit that referenced this pull request Oct 28, 2026
J713: power the idle USB-C ports down (carry #528 with selftest fixtures)
@RyanTheTide
RyanTheTide merged commit cf4eb7c into aurora-silicon:integration/aurora Oct 28, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thank you, this is in integration/aurora through #529 with your four commits unchanged.

The only addition is a selftest fixture update: the apple-dcp host selftests build code from atc.c and dwc3-apple.c, and their stubs did not know atcphy_rpm_get()/atcphy_rpm_put(), atcphy_setup_pipehandler() or pre_core_rpm yet. No assertions changed. KUnit (47/47 including your new T8132 suite), a W=1 build with the release config and a Neo boot with its USB unchanged are in #529.

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