Skip to content

arm64: dts: apple: t8142: Share the MagSafe 3 PD controller with J704 and J813 (on #1907) - #2401

Open
RyanTheTide wants to merge 4 commits into
mainfrom
dtfill-power/hpm5-t8142
Open

RyanTheTide wants to merge 4 commits into
mainfrom
dtfill-power/hpm5-t8142

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The J813 (MacBook Air 13-inch, M5) and J704 (MacBook Pro 14-inch, M5) have no node for the MagSafe 3 PD controller, so tipd registers no Type-C port and no power supply for MagSafe on them. #1907 adds this node for the J815 only.

Change

This branch is based on #1907 and keeps its commit as is. On top of it, one commit moves the J815's hpm5 node, unchanged, into a new t8142-magsafe.dtsi. That file is included at the end of t8142-j813-usb.dtsi (J813, J815) and t8142-j704-usb.dtsi (J704), after nub_spmi_a0 is defined.

Each board's ADT has hpm5 with the same values: nub-spmi-a0, SID 8, port-type 0x11, features-supported <3> (power in only), and the same interrupt numbers as on the J815. The bus is polled on T8142, so there are no interrupts in the node, as for hpm0 and hpm1. The public J813 ADT shows the same values.

The node was written by Nick (m0d16l14n1) in #1907. This should merge after #1907, or #1907 can be closed in favour of this one.

Testing

Still to run

  • J813 (sithglan): plug in MagSafe, then a new /sys/class/typec/portN appears with a partner, and tps6598x-source-psy-1-08 shows online = 1. Unplug it and online goes to 0. Then echo s2idle > /sys/power/mem_sleep; rtcwake -m mem -s 20 three times with MagSafe plugged in: no tipd or 1-08 errors in dmesg, and online is still 1 after each wake.
  • J704 (no owner yet): the same rows.
  • J815: tested in arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907. The DTB is unchanged.
Per-board values and DTB diffs

Values from each board's ADT (hpm5):

Board Bus SID port-type features-supported interrupts (ADT)
J704 nub-spmi-a0 8 0x11 3 63, 69, 71
J813 nub-spmi-a0 8 0x11 3 63, 69, 71
J815 nub-spmi-a0 8 0x11 3 63, 69, 71

The J704 also has hpm3 on nub-spmi-a1 (a USB-C port, already described). It does not affect hpm5.

The decompiled DTB diff is the same on J704 and J813 (J815: none compared with #1907):

 		spmi@388908000 {
 			...
+			usb-pd@8 {
+				apple,no-liquid-detection;
+				compatible = "apple,sn201202x";
+				reg = <0x08 0x00>;
+			};
+
 			usb-pd@a {

Driver notes (no change in this PR):

  • Nothing in drivers/usb/typec/tipd/ gates hpm5 by board. apple,no-liquid-detection is read in spmi.c.
  • tipd_sleep_ssps_rules() in core.c lists J714s, J716c, J813 and J815, but not J704. It only matters with apple,sleep-ssps, which this node does not set. On the J813 only hpm0 and hpm1 have it, in t8142-j813-j815-sleep.dtsi.

m0d16l14n1 and others added 2 commits November 19, 2026 14:26
hpm5 on nub-spmi-a0 (SID 8) is the MagSafe 3 port's PD controller (ADT
port-type 0x11). It has no USB data path, so it gets no connector node;
tipd registers a Type-C port and a power supply for it, as on J714s. The
bus is polled on T8142, so like hpm0 and hpm1 it has no interrupts. Its
ADT features-supported is <3> ("Power In" only), so it is marked
apple,no-liquid-detection.

Assisted-by: Claude Opus 5.5
Signed-off-by: Nick <nekreshen@yandex.ru>
… and J813

The J704 (MacBook Pro 14-inch, M5) and J813 (MacBook Air 13-inch, M5)
have the same MagSafe 3 PD controller as the J815: each board's ADT has
hpm5 on nub-spmi-a0, SID 8, port-type 0x11, features-supported <3>, with
the same values on all three boards.

Move the J815's hpm5 node into a new t8142-magsafe.dtsi and include it
at the end of t8142-j813-usb.dtsi (J813, J815) and t8142-j704-usb.dtsi
(J704), after nub_spmi_a0 is defined. The node itself is unchanged.

The J815 DTB is byte-identical to the one before this change. The J704
and J813 DTBs gain only the usb-pd@8 node under nub-spmi-a0.

The node was written by Nick for the J815.

Suggested-by: Nick <nekreshen@yandex.ru>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@gig3m

gig3m commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5), macOS 27.2 stub, with #2401 on #2135's merged head:

  • Port and supply: usb-pd@8 registers as typec port0 (device 1-08) with tps6598x-source-psy-1-08. The two USB-C controllers are 1-0a and 1-0c, ports 2 and 1.
  • Plugged into MagSafe: port0-partner appears and tps6598x-source-psy-1-08 reads online = 1, usb_type PD. macsmc-ac reads 1 and the battery Charging.
  • Unplugged: the partner goes away, online goes to 0 and the battery reads Discharging.
  • Sleep: two deep cycles with a 30 s alarm on this kernel were clean, on battery.
  • s2idle: not run.

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 2.

  1. This branch carries a stale copy of arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907. Its first commit is c3e48b3, the pre-review version of arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907. arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907's head is now 6dd5889, and that version adds apple,sleep-ssps-rules to hpm5 and drops the Assisted-by trailer from the commit. The node moved into arch/arm64/boot/dts/apple/t8142-magsafe.dtsi:16-20 has neither change. Since 6465f0a, tipd_sleep_ssps_rules() reads that per-controller property (drivers/usb/typec/tipd/core.c:362 on integration/aurora) instead of the board list described in "Driver notes". So once this merges, hpm5 on J815 loses what arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907 now gives it. On J813 and J704 it gets the old command handling: a read made past the limit is a timeout, with no per-second note and no sleep refusal on a failed S3. On J813 and J815, hpm0 and hpm1 next to it follow the rules (t8142-j813.dts:460-465, t8142-j815.dts:524-529). The two branches also conflict on t8142-j815.dts. Fix: rebase onto arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907's head (or the current integration branch once arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907 merges) and keep apple,sleep-ssps-rules in the shared node. "The J815 DTB is byte-identical to arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907" only holds against that head. Also update the "Driver notes", because core.c no longer lists boards.

  2. The branch is 398 commits behind its base (merge base 0abc2f3). The DTB diffs and dt-validate results in the body come from that old base, not from the tree this would merge into. Redo the DTB comparison for all three boards after the rebase.

The node values are the same on all three boards per the ADT table, and including the file after nub_spmi_a0 in each board's USB file is correct. I checked t8142-j704-usb.dtsi:65/490 and t8142-j813-usb.dtsi:57/327.

HW row: needed on the rebased head. The J813 row above was on a different kernel (#2135's head), with deep sleep only and no s2idle. Run J813 and J704: MagSafe plug/unplug (tps6598x-source-psy-1-08 online 1/0, partner appears/goes), then 3x s2idle rtcwake with MagSafe plugged in (no tipd or 1-08 errors, online still 1 after each wake), 0 AVC, 0 failed units, no new kernel errors. J704 has no owner yet, so the J704 row has to be requested.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Status check against integration/aurora 4a17f73: #1907 has merged (85e255d), so the J815 half of this branch is on the tip, in its reviewed form with apple,sleep-ssps-rules. This branch still carries the older copy of that commit, so although it merges without a textual conflict the result would leave the J815 node in the board file and add a second, rule-less copy from the shared file. The remaining change (moving the node into t8142-magsafe.dtsi and including it for J704 and J813) needs a rebase onto the tip that moves the node as it is there; the J815 DTB should then be byte-identical and J704/J813 gain only usb-pd@8. Still missing after that: the DTB comparison for the three boards on the new base, and a J813 row on the rebased head (the existing J813 row was on another kernel and has no s2idle cycles).

#1907 has landed on main in its reviewed form: the J815's hpm5 in
t8142-j815.dts with apple,sleep-ssps and apple,sleep-ssps-rules. This
branch still carried the pre-review copy of that commit, so the merge
was textually clean but left two hpm5 nodes (and labels) on the J815.

Resolve it the way the branch meant: the J815 board file no longer
defines hpm5; t8142-magsafe.dtsi (included from the J704 and J813 USB
files) does, and the sleep properties stay the board's: the J815 sets
both on &hpm5 where its node was, and the J813, whose hpm0/hpm1 follow
the same rules, sets them too. The J704's hpm0/hpm1 have no sleep
properties, so neither does its hpm5.

The J815 DTB is byte-identical to main's; the J704 and J813 gain only
usb-pd@8 under nub-spmi-a0 (the J813's with the two sleep properties).

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

Copy link
Copy Markdown
Contributor Author

Updated: merged main @f02bd68a08cb (bf71be2) and fixed the stale-#1907 problem from the review in the merge.

  • arm64: dts: apple: t8142-j815: MagSafe 3 PD controller #1907 is on main in its reviewed form. The merge was textually clean but would have left two hpm5 nodes/labels on the J815, so the merge also drops the J815's own node: t8142-magsafe.dtsi defines hpm5 for all three boards, and the sleep properties stay per board, as for hpm0/hpm1: J815 sets apple,sleep-ssps + apple,sleep-ssps-rules on &hpm5 where its node was, J813 sets the same (its hpm0/hpm1 follow those rules), J704 sets none (its hpm0/hpm1 have none).
  • DTB check (cpp + dtc 1.8.1, this head vs main): J815 byte-identical; J704 and J813 gain only usb-pd@8 under nub-spmi-a0 (J813's with the two sleep properties). No dtc warnings on any of the three.

Still needed (queued in HWROWS): a J813 row on this head including s2idle cycles (no M5 Air in the lab).

@RyanTheTide
RyanTheTide marked this pull request as ready for review December 5, 2026 01:15
@RyanTheTide
RyanTheTide requested review from a team as code owners December 5, 2026 01:15
@github-actions github-actions Bot added area:bringup Area from CODEOWNERS (bot) ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Dec 5, 2026
@github-actions github-actions Bot removed the ci-failing A check failed at the PR head (bot) label Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

Merge readiness at 82436589: not ready yet

Check Detail
CI at head running running: host-tests, pr-text / pr-text
Review no needs one approving review from Core, Omarchy Mac or Aurora Maintainers (not the author)
Requested changes ok none
Hardware row at head no no line with the head SHA 82436589, a Mac and a result in the PR body or a comment
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:bringup

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:bringup Area from CODEOWNERS (bot) needs-hw-row No hardware row at the PR head (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants