From ea26780843c0d40b5bcbecaf9a24420d34bda755 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Fri, 20 Nov 2026 00:09:13 +1100 Subject: [PATCH 1/3] usb: typec: tipd: key the native display HPD path on a DT property 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 (46e2253cae62: "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: 7220ae0f48f9 ("usb: typec: tipd: follow the DP status of an SN201202x partner") Fixes: 3c9a8c54fdcf ("usb: typec: tipd: key the CD321x display route on the selected mode") Fixes: 46e2253cae62 ("usb: typec: keep the H17 display route handshake") Suggested-by: Chris Kearney <303316+iconidentify@users.noreply.github.com> Suggested-by: Diljit Singh Signed-off-by: Ryan Murray --- .../bindings/usb/apple,sn201202x.yaml | 9 +++++++++ arch/arm64/boot/dts/apple/t8140-j700.dts | 2 ++ arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi | 3 +++ arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi | 2 ++ drivers/usb/typec/tipd/core.c | 19 ++++++++++--------- drivers/usb/typec/tipd/tps6598x.h | 7 +++++-- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml index a1f25de21b2e6..d45cb2f33794c 100644 --- a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml +++ b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml @@ -47,6 +47,15 @@ properties: Tell the controller the system's power state (SSPS) around a firmware-driven suspend, S3 before it and S0 after. + apple,display-native-hpd: + type: boolean + description: + The display route behind this controller's port has its own HPD path, + as the display coprocessor routes of the T8140 and T8142 do. The driver + passes on the HPD level of the port's data status only: it does not + follow the partner's DP status updates, synthesize IRQ_HPD pulses, or + send the display connector a recheck when a USB4 route starts. + apple,debug-lock-key: $ref: /schemas/types.yaml#/definitions/string description: diff --git a/arch/arm64/boot/dts/apple/t8140-j700.dts b/arch/arm64/boot/dts/apple/t8140-j700.dts index 4c69fcbd33063..99a062fcac676 100644 --- a/arch/arm64/boot/dts/apple/t8140-j700.dts +++ b/arch/arm64/boot/dts/apple/t8140-j700.dts @@ -1933,6 +1933,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,display-native-hpd; apple,sleep-ssps; interrupts = <37 IRQ_TYPE_EDGE_RISING>, <39 IRQ_TYPE_EDGE_RISING>, @@ -1958,6 +1959,7 @@ hpm0: usb-pd@c { compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; + apple,display-native-hpd; apple,debug-lock-key = "007J"; apple,sleep-ssps; interrupts = <11 IRQ_TYPE_EDGE_RISING>, diff --git a/arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi b/arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi index 09c51e0888aa2..020ca2ba0c3f8 100644 --- a/arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi +++ b/arch/arm64/boot/dts/apple/t8142-j704-usb.dtsi @@ -72,6 +72,7 @@ hpm0: usb-pd@c { compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; + apple,display-native-hpd; typec0: connector { compatible = "usb-c-connector"; @@ -208,6 +209,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,display-native-hpd; typec1: connector { compatible = "usb-c-connector"; @@ -360,6 +362,7 @@ hpm3: usb-pd@c { compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; + apple,display-native-hpd; typec3: connector { compatible = "usb-c-connector"; diff --git a/arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi b/arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi index 2eb0b1f16af47..e723a1250071e 100644 --- a/arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi +++ b/arch/arm64/boot/dts/apple/t8142-j813-usb.dtsi @@ -64,6 +64,7 @@ hpm0: usb-pd@c { compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; + apple,display-native-hpd; typec0: connector { compatible = "usb-c-connector"; @@ -210,6 +211,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,display-native-hpd; typec1: connector { compatible = "usb-c-connector"; diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 6ad1d66a67fb9..2dd44a55d2eff 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -752,12 +752,13 @@ EXPORT_SYMBOL_IF_KUNIT(cd321x_mux_gave_up); * converter can keep DATA_STATUS at HPD high while the display behind it is * unplugged, and report that only in its DP status. Once the controller has * signalled a DP status for this connection, that status must show HPD too. + * A display route with its own HPD path (apple,display-native-hpd) takes the + * DATA_STATUS level only. */ static bool cd321x_uses_dp_sid(const struct tps6598x *tps) { return device_is_compatible(tps->dev, "apple,sn201202x") && - !of_machine_is_compatible("apple,t8140") && - !of_machine_is_compatible("apple,t8142"); + !tps->display_native_hpd; } static u64 cd321x_irq_mask(const struct tps6598x *tps) @@ -924,7 +925,7 @@ static int cd321x_typec_update_mode(struct tps6598x *tps, * reference reports the pulse out of band instead, as a * disconnect and a connect (see cd321x_update_work()). */ - hpd_pulse = !tps->h17_display && + hpd_pulse = !tps->display_native_hpd && !(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode) && (st->data_status_changed & CD321X_DATA_STATUS_HPD_LEVEL) && (dp_data.status & DP_STATUS_HPD_STATE) && @@ -1414,10 +1415,12 @@ static void cd321x_update_work(struct work_struct *work) if (ret) goto retry; - /* A new USB4 route can disturb another port on the shared fabric. */ + /* + * A new USB4 route can disturb another port on the shared fabric. A display + * route with its own HPD path is not sent the hint. + */ if (IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode && - !of_machine_is_compatible("apple,t8140") && - !of_machine_is_compatible("apple,t8142") && + !tps->display_native_hpd && usb4_started && !cd321x->display_route_active) drm_connector_oob_hotplug_event(cd321x->connector_fwnode, connector_status_unknown); @@ -3489,6 +3492,7 @@ int tipd_init(struct tps6598x *tps) return -EPROBE_DEFER; dev_dbg(tps->dev, "Type-C probe start\n"); + tps->display_native_hpd = device_property_read_bool(tps->dev, "apple,display-native-hpd"); tps->reset = devm_gpiod_get_optional(tps->dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(tps->reset)) return dev_err_probe(tps->dev, PTR_ERR(tps->reset), @@ -3807,9 +3811,6 @@ int tipd_resume(struct tps6598x *tps) { int ret; - tps->h17_display = of_machine_is_compatible("apple,t8140") || - of_machine_is_compatible("apple,t8142"); - ret = tps6598x_check_mode(tps); if (ret < 0) return ret; diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h index 42692ced9ad3c..55bf59f74d87f 100644 --- a/drivers/usb/typec/tipd/tps6598x.h +++ b/drivers/usb/typec/tipd/tps6598x.h @@ -355,8 +355,11 @@ struct tipd_data { }; struct tps6598x { - /* Native H17 routes retain ENOSPC admission and their own HPD path. */ - u8 h17_display:1; + /* + * apple,display-native-hpd: the port's display route has its own HPD path + * (the T8140 and T8142 display routes). + */ + u8 display_native_hpd:1; struct device *dev; struct regmap *regmap; struct mutex lock; /* device lock */ From 19e906f36a56417e610a6dbec1088a601c34bffd Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Fri, 20 Nov 2026 01:29:24 +1100 Subject: [PATCH 2/3] dt-bindings: usb: apple,sn201202x: quote the display-native-hpd description 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: ea26780843c0 ("usb: typec: tipd: key the native display HPD path on a DT property") Signed-off-by: Ryan Murray --- Documentation/devicetree/bindings/usb/apple,sn201202x.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml index d45cb2f33794c..f806e09dd3295 100644 --- a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml +++ b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml @@ -49,7 +49,7 @@ properties: apple,display-native-hpd: type: boolean - description: + description: | The display route behind this controller's port has its own HPD path, as the display coprocessor routes of the T8140 and T8142 do. The driver passes on the HPD level of the port's data status only: it does not From ae2b97a6317b9aae5989fd5d64c0d22207c0a1a3 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sun, 22 Nov 2026 21:29:11 +1100 Subject: [PATCH 3/3] selftests: apple-dcp: give the tipd mocks apple,display-native-hpd 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 --- tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py | 4 +++- tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py | 2 +- tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py index e41e10447eb22..2cf3baf700051 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py @@ -207,7 +207,7 @@ def function(file, name): bool dp_sid_event,dp_sid_hpd_low,dp_sid_irq; struct { u32 status_rx,configure,mode_data; } dp_sid_status; }; struct tps6598x { void *partner, *dev, *port, *psy; int lock; u32 data_status; enum usb_role *role_sw; - void *partner_altmode_dp; }; + void *partner_altmode_dp; bool display_native_hpd; }; struct cd321x { struct tps6598x tps; struct cd321x_status update_status; struct cd321x_pm_state pm; struct delayed_work update_work, resume_work; struct typec_mux_state state; bool state_valid, display_route_active, cur_partner_is_pd; @@ -288,6 +288,8 @@ def function(file, name): static void init(void) { memset(&display,0,sizeof(display)); memset(&sink,0,sizeof(sink)); memset(&port,0,sizeof(port)); + /* The native H17 fixture's DT carries apple,display-native-hpd. */ + port.tps.display_native_hpd = true; sink.connected = true; display.connector = &sink; display.external_prepared = true; raw_error = raw_links = 0; display.external_running = display.external_power_attempted = true; diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py b/tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py index 9257b85dec643..313b99074f02e 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/quiesce.py @@ -101,7 +101,7 @@ def make_unit(source, parent=False, reference=None): struct typec_port { struct typec_mux *mux; }; struct tps6598x; struct tipd_contaminant_ops { int (*update)(struct tps6598x *); void (*stop)(struct tps6598x *); }; -struct tps6598x { bool remove_safe_prepared; struct typec_mux *mux; void *partner,*dev,*psy,*role_sw,*reset,*partner_altmode_dp; int irq,wq_poll; struct typec_port *port; struct tipd_data *data; const struct tipd_contaminant_ops *contaminant_ops; }; +struct tps6598x { bool display_native_hpd; bool remove_safe_prepared; struct typec_mux *mux; void *partner,*dev,*psy,*role_sw,*reset,*partner_altmode_dp; int irq,wq_poll; struct typec_port *port; struct tipd_data *data; const struct tipd_contaminant_ops *contaminant_ops; }; struct cd321x { struct tps6598x tps; struct typec_mux *mux; void *tbt_switch; }; struct typec_thunderbolt_switch_data { int state; }; static void cd321x_stop_work(struct cd321x *c) { (void)c;event('W'); } diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py index 1375b2683f4a4..969465f7a3124 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py @@ -423,7 +423,8 @@ def probe(root): static int system_power_efficient_wq; static unsigned msecs_to_jiffies(unsigned ms) { return ms; } static void queue_delayed_work(int wq,int *work,unsigned delay) { (void)wq;(void)work;(void)delay; } -static bool device_property_read_bool(void *d,const char *p) { (void)d;(void)p;return false; } +/* The native H17 fixture's DT: apple,display-native-hpd only. */ +static bool device_property_read_bool(void *d,const char *p) { (void)d;return !strcmp(p,"apple,display-native-hpd"); } static void tipd_debugfs_register(struct tps6598x *t) { (void)t; } static void tipd_port_list_add(struct tps6598x *t) { (void)t; } static int register_port(struct tps6598x *t,struct fwnode_handle *f) { (void)t;(void)f;return register_error; }