diff --git a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml index ea3d497d46748..887c222101e0a 100644 --- a/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml +++ b/Documentation/devicetree/bindings/usb/apple,sn201202x.yaml @@ -117,6 +117,16 @@ properties: without end, as on the J613, so the port keeps the data role it negotiated and refuses a swap. + apple,no-hpd-synthesis: + type: boolean + description: + Pass the display side only the HPD changes the controller reports for + the port's DisplayPort route. No IRQ_HPD is made up for an HPD pulse + the controller coalesced, and the display connector is not probed + again when a USB4 route starts on the shared fabric. The T8140 and + T8142 machines' ports, whose external display pipes are driven this + way, have it. + connector: $ref: /schemas/connector/usb-connector.yaml# diff --git a/arch/arm64/boot/dts/apple/t8140-j700.dts b/arch/arm64/boot/dts/apple/t8140-j700.dts index 940431d7aac3b..0abe1090f9890 100644 --- a/arch/arm64/boot/dts/apple/t8140-j700.dts +++ b/arch/arm64/boot/dts/apple/t8140-j700.dts @@ -1936,6 +1936,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,no-hpd-synthesis; apple,sleep-ssps; interrupts = <37 IRQ_TYPE_EDGE_RISING>, <39 IRQ_TYPE_EDGE_RISING>, @@ -1962,6 +1963,7 @@ compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; apple,debug-lock-key = "007J"; + apple,no-hpd-synthesis; apple,sleep-ssps; interrupts = <11 IRQ_TYPE_EDGE_RISING>, <13 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 fac15e4d4099f..b9b16c249652c 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,no-hpd-synthesis; typec0: connector { compatible = "usb-c-connector"; @@ -208,6 +209,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,no-hpd-synthesis; typec1: connector { compatible = "usb-c-connector"; @@ -360,6 +362,7 @@ hpm3: usb-pd@c { compatible = "apple,sn201202x"; reg = <0xc SPMI_USID>; + apple,no-hpd-synthesis; 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 bf81e9b35ce21..e1c1691a2aec3 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,no-hpd-synthesis; typec0: connector { compatible = "usb-c-connector"; @@ -210,6 +211,7 @@ hpm1: usb-pd@a { compatible = "apple,sn201202x"; reg = <0xa SPMI_USID>; + apple,no-hpd-synthesis; typec1: connector { compatible = "usb-c-connector"; diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index 01c7d2fa4d048..46c0f183103fe 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -941,9 +941,10 @@ static int cd321x_typec_update_mode(struct tps6598x *tps, * disconnects and retrains the link anew, matching an * uncoalesced HPD drop. A port with a displayport reference * reports the pulse out of band instead, as a disconnect and - * a connect (see cd321x_update_work()). + * a connect (see cd321x_update_work()). A port whose DT gives + * apple,no-hpd-synthesis reports none. */ - hpd_pulse = !tps->h17_display && + hpd_pulse = !tps->no_hpd_synthesis && !(IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode) && cd321x->state_valid && cd321x->state.alt == cd321x->port_altmode_dp && @@ -1489,11 +1490,13 @@ static void cd321x_update_work(struct work_struct *work) goto retry; tipd_boot_host_started(tps, new_role); - /* A new USB4 route can disturb another port on the shared fabric. */ + /* + * A new USB4 route can disturb another port on the shared fabric: have + * the display side probe this one again, unless its DT says the display + * side takes only the controller's own HPD reports. + */ if (IS_REACHABLE(CONFIG_DRM) && cd321x->connector_fwnode && - !of_machine_is_compatible("apple,t8140") && - !of_machine_is_compatible("apple,t8142") && - usb4_started && !cd321x->display_route_active) + !tps->no_hpd_synthesis && usb4_started && !cd321x->display_route_active) drm_connector_oob_hotplug_event(cd321x->connector_fwnode, connector_status_unknown); @@ -4335,8 +4338,7 @@ int tipd_init(struct tps6598x *tps) return -EPROBE_DEFER; dev_dbg(tps->dev, "Type-C probe start\n"); - tps->h17_display = of_machine_is_compatible("apple,t8140") || - of_machine_is_compatible("apple,t8142"); + tps->no_hpd_synthesis = device_property_read_bool(tps->dev, "apple,no-hpd-synthesis"); 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), diff --git a/drivers/usb/typec/tipd/tps6598x.h b/drivers/usb/typec/tipd/tps6598x.h index 3881276bfb3fb..13552d754ade4 100644 --- a/drivers/usb/typec/tipd/tps6598x.h +++ b/drivers/usb/typec/tipd/tps6598x.h @@ -410,8 +410,11 @@ struct tipd_data { }; struct tps6598x { - /* Native H17 routes retain ENOSPC admission and their own HPD path. */ - u8 h17_display:1; + /* + * apple,no-hpd-synthesis: the display side gets only the HPD changes the + * controller reports (the T8140 and T8142 ports). + */ + u8 no_hpd_synthesis:1; /* On the list tipd_port_replug() looks a port up on, by its role switch; its replug. */ struct list_head port_node; struct work_struct replug_work; diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py b/tools/testing/selftests/drivers/gpu/apple-dcp/lifecycle.py index da985398722e0..bdca5f6e722d8 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 no_hpd_synthesis; }; 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; @@ -289,6 +289,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 J700 ports' DT, as in t8140-j700.dts */ + port.tps.no_hpd_synthesis = 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/transaction.py b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py index 8874c35b7fe50..2db840ac8f038 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/transaction.py @@ -447,7 +447,7 @@ def probe(root): unit = quiesce.make_unit(root) unit = unit.replace(block(unit, 'int main('), block(unit, 'int main(').replace('int main(', 'int __attribute__((unused)) prior_main(', 1), 1) unit = unit.replace('struct tipd_data {', 'struct fwnode_handle;\nstruct tipd_data { unsigned irq_mask1; int (*init)(struct tps6598x *); int (*switch_power_state)(struct tps6598x *, int); int (*register_port)(struct tps6598x *, struct fwnode_handle *); bool (*read_data_status)(struct tps6598x *); bool (*read_power_status)(struct tps6598x *); int (*connect)(struct tps6598x *,u32); void (*ready)(struct tps6598x *); void *irq_handler;') - unit = unit.replace('struct tps6598x {', 'struct tps6598x { bool dbma_at_probe,wakeup,h17_display; u32 status; bool (*sleep_event)(struct tps6598x *);') + unit = unit.replace('struct tps6598x {', 'struct tps6598x { bool dbma_at_probe,wakeup,no_hpd_synthesis; u32 status; bool (*sleep_event)(struct tps6598x *);') helpers = r""" #undef dev_err #define dev_err(...) ((void)0)