Skip to content

arm64: dts: apple: t8132-laptop: describe the MagSafe 3 PD controller - #2395

Draft
RyanTheTide wants to merge 1 commit into
integration/aurorafrom
dtfill-power/hpm5-t8132
Draft

RyanTheTide wants to merge 1 commit into
integration/aurorafrom
dtfill-power/hpm5-t8132

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Problem

The M4 MacBook Air 13/15 (J713, J715) and the MacBook Pro 14 M4 (J604) have no node for the MagSafe 3 port's PD controller (hpm5). Charging works through the SMC, but there is no Type-C port and no tps6598x power supply for MagSafe. The J604 file said hpm5 "is not wired".

Change

  • t8132-laptop.dtsi (included by J604, J713 and J715): add hpm5: usb-pd@8 on nub_spmi_a0, compatible apple,t8132-sn201202x, apple,sn201202x, with the event, sleep and wake interrupts, apple,no-liquid-detection and no connector node. Same shape as the J714s hpm5 and the J815 one in arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907, with the T8132 interrupt layout of hpm0/hpm1.
  • t8132-j604.dts: the stale comment now points at the shared node.
  • No per-board deltas: the three ADTs give the same values. No wakeup-source for now (hpm0/hpm1 have it); MagSafe plug wake can be added once the port is seen working.

The tipd SPMI driver takes a node without a connector (the role switch and mux lookups get NULL, as on J714s). No board list in the driver excludes T8132 for this node. The sleep lists in core.c (tipd_sleep_ssps_rules) and spmi.c (sn201202x_sleep_board) do not name T8132 boards, the same as for hpm0/hpm1.

Testing

  • DTB build (cpp + dtc, kbuild flags) for all six T8132 boards. J623, J624, J773g: byte-identical DTB. J604, J713, J715: +1 node each, the same 7 lines. dtc warnings unchanged (J713 keeps its 1 existing warning).
  • dt-validate against the in-tree bindings (apple,sn201202x.yaml): 0 new messages on J604, J713, J715.

Still to run

  • J713 (lab Mac): plug MagSafe -> a new /sys/class/typec/portN appears and the hpm5 tps6598x-source-psy-* power supply shows online=1; unplug -> online=0; dmesg | grep -i tps6598x shows no probe errors for usb-pd@8.
  • J604 (owner IronsideXXVI): the same check.
  • J715 (no known owner): the same check.

No loader change is needed.

Per-board values and DTB diffs
Board Bus SID Interrupts (irq, sleep, wake) port-type features-supported
J604 nub-spmi-a0 8 63, 69, 71 0x11 3
J713 nub-spmi-a0 8 63, 69, 71 0x11 3
J715 nub-spmi-a0 8 63, 69, 71 0x11 3

Values come from each board's ADT (27.x), and also match the public live ADTs for J713 and J604.

DTB diff (identical on J604, J713, J715):

+			usb-pd@8 {
+				apple,no-liquid-detection;
+				compatible = "apple,t8132-sn201202x", "apple,sn201202x";
+				interrupt-names = "irq", "sleep", "wake";
+				interrupts = <0x3f 0x01 0x45 0x01 0x47 0x01>;
+				reg = <0x08 0x00>;
+			};

Assisted-by: LLM (Claude:Opus 5.5)

The M4 laptops (J604, J713, J715) have a third SN201202x on nub-spmi-a0
for the MagSafe 3 port (hpm5). It is not described, so there is no
Type-C port and no tps6598x power supply for MagSafe; only the SMC sees
the charger.

Each board's ADT gives the same values: SID 8 on nub-spmi-a0, event,
sleep and wake interrupts 63, 69 and 71 (the order of hpm0's 11, 17,
19), port-type 0x11, and features-supported <3> ("Power In" only). Add
it once to t8132-laptop.dtsi, which all three include, with the T8132
compatible (selection is polled, event/sleep/wake use interrupts), no
connector node (no USB data path) and apple,no-liquid-detection, as the
J714s and the J815 MagSafe nodes do. The J604's comment that said hpm5
is not wired now points at the shared node.

The desktops (J623, J624, J773g) do not include t8132-laptop.dtsi and
build to identical DTBs.

The node follows the J815 MagSafe node by Nick (m0d16l14n1) and the
J714s one.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@aeries0x

Copy link
Copy Markdown
Contributor

Tested on a J604 (MacBook Pro 14", M4) with e2fac9f101ff cherry-picked onto 2c35f5094de1 (my J604 config, local revert of #1888 to keep the speakers off, DTB-only rebuild).

With MagSafe plugged in at boot, usb-pd@8 (1-08) probed on nub-spmi-a0 with no errors or warnings in dmesg. It registered /sys/class/typec/port0 (sink, USB PD 2.0) with port0-partner and tps6598x-source-psy-1-08 at online=1 alongside macsmc-ac (online=1), while the three USB-C supplies stayed online=0.

Unplugging MagSafe dropped tps6598x-source-psy-1-08 and macsmc-ac to online=0 and removed port0-partner. Replugging brought both back to online=1 with port0-partner restored (IRQ 63 counted 0 -> 2 -> 5; no dmesg errors).

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Looks good; approve once the J713 row is in.

The node is sound. I built all six T8132 DTBs from this PR merged onto the current integration/aurora: J604, J713 and J715 gain only usb-pd@8, and J623, J624 and J773g are byte-identical to the base. With "apple,t8132-sn201202x" the driver takes the T8132 path: the payload size read at drivers/usb/typec/tipd/spmi.c:119 and a polled select at :957-960 (no "select" interrupt here), so the three named interrupts are all it needs. The J604 test above (plug, unplug, replug, IRQ 63 counting, no errors) covers probe and the power supply.

The missing piece is the suspend path. This adds a third SN201202x to every T8132 laptop's system sleep: sn201202x_suspend()/resume() run for it, with no apple,sleep-ssps-rules, the same as for hpm0/hpm1. The J604 test did no sleep, and the J713 is the lab machine with this block.

HW row: J713 on this head: MagSafe plug/unplug toggles the hpm5 tps6598x-source-psy online with no tipd errors for 1-08. Then 3 s2idle cycles (rtcwake on rtc1) with MagSafe connected, with all ports and the supply back after each. Plus 0 AVC, 0 failed units and 0 new kernel errors. A J715 row would be welcome but should not hold the merge.

Assisted-by: LLM (Claude:Opus 5.5)

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