Skip to content

usb: typec: tipd: key the native display HPD path on a DT property, not T8140/T8142 - #2399

Draft
RyanTheTide wants to merge 4 commits into
integration/aurorafrom
sweep/tipd-display
Draft

RyanTheTide wants to merge 4 commits into
integration/aurorafrom
sweep/tipd-display

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Problem

drivers/usb/typec/tipd/core.c picks three DisplayPort policies by SoC compatible:

  • cd321x_uses_dp_sid(): !apple,t8140 && !apple,t8142. Follow the partner's DP status (event 37). From 7220ae0, scoped in the adaptation.
  • cd321x_update_work(): !apple,t8140 && !apple,t8142. On a USB4 start, ask the display connector to recheck. From 3c9a8c5.
  • tipd_resume(): h17_display = apple,t8140 || apple,t8142. Do not synthesize an IRQ_HPD pulse. From 46e2253.

The reason is not the SoC. On those machines the display coprocessor's Type-C route has its own HPD path (46e2253: "Integration's DP status interrupt and its HPD rules stay off on those SoCs"). A new board with that route would need its compatible added in three places. h17_display was also set only in tipd_resume(), so it was false from probe until the first resume.

Change

  • New boolean DT property apple,display-native-hpd on the SN201202x node (documented in apple,sn201202x.yaml). tipd_init() reads it into tps->display_native_hpd, and the three sites use that flag.
  • The property is set on every SN201202x node of the T8140 and T8142 boards: t8140-j700.dts (2), t8142-j704-usb.dtsi (3), t8142-j813-usb.dtsi (2, used by J813 and J815).
  • These boards behave as before, except that the IRQ_HPD rule now applies from probe and not only after the first resume. Every other board is unchanged.
DT coverage

From dtc -I dtb -O dts of the built DTBs:

t8140-j700:  sn201202x nodes=2  apple,display-native-hpd=2
t8142-j704:  sn201202x nodes=3  apple,display-native-hpd=3
t8142-j813:  sn201202x nodes=2  apple,display-native-hpd=2
t8142-j815:  sn201202x nodes=2  apple,display-native-hpd=2
t6040-j616s: sn201202x nodes=4  apple,display-native-hpd=0
t6041-j614c: sn201202x nodes=4  apple,display-native-hpd=0

t8140-j700, t8142-j704, t8142-j813 and t8142-j815 are every T8140/T8142 DTB in the Makefile.

Credit

Chris Kearney wrote the DP status follow and the display-route keying (7220ae0, 3c9a8c5). Diljit Singh wrote the H17 route handshake (46e2253). Both are credited with Suggested-by.

Testing

Build (buildbox, LLVM=1, release config + TYPEC_SN201202X=m, both tipd KUnit suites =m, TYPEC_TPS6598X_DEBUG_COMMANDS=y, W=1), tree = this branch plus #2398: make -j8 W=1 drivers/usb/typec/tipd/ passes. core.o, i2c.o, spmi.o and all six KUnit test objects build. The only warning is the existing i2c.c:21 enum cast, which is untouched.

KUnit was not run: the build host is at load ~450. The test objects compile.

DTBs build: apple/t8140-j700 t8142-j704 t8142-j813 t8142-j815 t6040-j616s t6041-j614c. The binding YAML parses. dtschema is not installed on the build host, so dt_binding_check was not run.

Still to run

Hardware rows: pending.

  • Neo (T8140 J700): ls /sys/class/typec shows port0 and port1. With the dock and display on the rear port: hot-unplug and replug the display. Expect the display to come back as on the current kernel, and no "Invalid DP pin assignment" or mux errors in journalctl -k -b | grep -iE 'cd321x|sn201202x|typec'.
  • J616s (T6040) and the M1 Pro and M2: no property, so behavior is unchanged. A dock or display hotplug on any one of them is a regression check.
  • Not bootable here: J704 (T8142), J813, J815. Their DT gets the property, so behavior stays as before.

Assisted-by: LLM (Claude:Opus 5.5)

Three CD321x/SN201202x display policies were keyed on the SoC: on T8140
and T8142 the driver does not follow the partner's DP status (event 37
stays masked), does not synthesize an IRQ_HPD pulse for a quick HPD
low/high, and does not send the display connector a recheck when a USB4
route starts. The reason is the display route, not the SoC: on those
machines the display coprocessor's Type-C route has its own HPD path,
which is why the gates came with it (46e2253: "Integration's DP
status interrupt and its HPD rules stay off on those SoCs"). A new
board with the same route would need another compatible in three
places.

Describe it on the controller instead: apple,display-native-hpd, read
in tipd_init() into tps->display_native_hpd, and set on every
SN201202x node of the T8140 and T8142 boards (J700, J704, J813, J815).
Those boards keep their behavior, and every other board is unchanged.

h17_display was also only set in tipd_resume(), so it was false from
probe until the first resume on T8140 and T8142. The property is read
at probe, so the IRQ_HPD rule holds from boot.

Fixes: 7220ae0 ("usb: typec: tipd: follow the DP status of an SN201202x partner")
Fixes: 3c9a8c5 ("usb: typec: tipd: key the CD321x display route on the selected mode")
Fixes: 46e2253 ("usb: typec: keep the H17 display route handshake")
Suggested-by: Chris Kearney <303316+iconidentify@users.noreply.github.com>
Suggested-by: Diljit Singh <hey@djdev.me>
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…iption

The description of apple,display-native-hpd has a ": " in a plain
scalar, which YAML reads as a mapping, so the schema does not parse.
Make it a literal block.

Fixes: ea26780 ("usb: typec: tipd: key the native display HPD path on a DT property")
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Blockers: 3.

  1. drivers/usb/typec/tipd/core.c:761, :928, :1423, :3495: a T8140/T8142 machine booted with a DTB that predates apple,display-native-hpd silently switches to the generic display route. It then follows the partner's DP status (event 37 unmasked), synthesizes IRQ_HPD pulses and sends USB4 rechecks to the display connector, which are the behaviours 46e2253 kept off those routes. The DTB on these machines does not always ship with the kernel (the J700 has already hit an old-DTB display regression). Land the DT side first. Meanwhile keep today's SoC check as the fallback when the property is absent, with a comment that it goes once a release has carried the property. The rest of the board-gate removal is the right direction.

  2. host-tests fails on this head: apple-dcp not ok 59 physical-disconnect, 60 fast-replug-bounce, 62 dropped-swap-teardown, 79 probe-transaction-rollback. I reproduced it on the PR tree: "no member named 'display_native_hpd' in 'struct tps6598x'". The mock structs in tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py:209 and quiesce.py:104 (and the probe unit's) need the field. Add one case with the flag set and one without, so the three call sites are covered.

  3. The PR conflicts with integration/aurora in Documentation/devicetree/bindings/usb/apple,sn201202x.yaml and tps6598x.h, which gained apple,sleep-ssps-rules, apple,reset-on-failed-probe and the replug key since. Rebase, and fold the YAML quoting fix into the first commit.

HW row: Neo J700 on this head, booted once with the new DTB and once with the current production DTB. Rear-port display hot-unplug/replug x5 comes back each time with no "Invalid DP pin assignment" or mux errors. J616s (no property): one dock/display hotplug as a regression check. Plus 0 AVC, 0 failed units and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

Conflicts: apple,sn201202x.yaml (kept apple,display-native-hpd and integration's new properties), tps6598x.h (display_native_hpd replaces h17_display; kept integration's replug fields).

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
tipd now takes the native display HPD path from the controller's
apple,display-native-hpd property instead of the machine compatible.
The lifecycle, quiesce and transaction fixtures model a native H17
(T8140) controller: add display_native_hpd to their struct tps6598x
mocks, set it in the lifecycle fixture, and have the transaction
fixture's device_property_read_bool() report the property, so the
extracted tipd code builds and keeps the native path it had.

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

Copy link
Copy Markdown
Contributor Author

Merged integration/aurora (d1b022d); conflicts in apple,sn201202x.yaml and tps6598x.h resolved (kept both sides' properties/fields, h17_display dropped), plus the apple-dcp host-test mocks now carry display_native_hpd. tipd objects, t8140-j700/t8142-j704/j813/j815 dtbs and the apple-dcp host tests (92/92), sn201202x-transport and j613-mux-order build/pass.

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

The rebase and the host-test mocks are done. Still needed: keep the T8140/T8142 machine check as the fallback when apple,display-native-hpd is absent (a Stage 2 DTB without the property must keep today's behaviour), fold the YAML quoting fix into the first commit, then a J700 row with both the new and the current DTB (rear-port display replug x5) and a J616s hotplug regression row.

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.

1 participant