diff --git a/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi b/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi index a15e5d77a70f52..a32f269b8e2ada 100644 --- a/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi +++ b/arch/arm64/boot/dts/apple/t600x-j314-j316.dtsi @@ -142,8 +142,12 @@ <&atcphy1 PHY_TYPE_DP>, <&atcphy2 PHY_TYPE_DP>; phy-names = "dp-phy", "typec0", "typec1", "typec2"; mux-controls = <&atcphy3_xbar 0>, <&atcphy0_xbar 0>, - <&atcphy1_xbar 0>, <&atcphy2_xbar 0>; - mux-control-names = "dp-xbar", "typec0", "typec1", "typec2"; + <&atcphy1_xbar 0>, <&atcphy2_xbar 0>, + <&atcphy0_xbar 1>, <&atcphy1_xbar 1>, <&atcphy2_xbar 1>, + <&atcphy0_xbar 2>, <&atcphy1_xbar 2>, <&atcphy2_xbar 2>; + mux-control-names = "dp-xbar", "typec0", "typec1", "typec2", + "typec0-dpin0", "typec1-dpin0", "typec2-dpin0", + "typec0-dpin1", "typec1-dpin1", "typec2-dpin1"; mux-index = <0>; apple,dptx-phy = <3>; @@ -233,8 +237,12 @@ <&atcphy2 PHY_TYPE_DP>; phy-names = "typec0", "typec1", "typec2"; mux-controls = <&atcphy0_xbar 0>, <&atcphy1_xbar 0>, - <&atcphy2_xbar 0>; - mux-control-names = "typec0", "typec1", "typec2"; + <&atcphy2_xbar 0>, + <&atcphy0_xbar 1>, <&atcphy1_xbar 1>, <&atcphy2_xbar 1>, + <&atcphy0_xbar 2>, <&atcphy1_xbar 2>, <&atcphy2_xbar 2>; + mux-control-names = "typec0", "typec1", "typec2", + "typec0-dpin0", "typec1-dpin0", "typec2-dpin0", + "typec0-dpin1", "typec1-dpin1", "typec2-dpin1"; apple,typec-mux-indices = <2 2 2>; apple,typec-dptx-phys = <0 1 2>; diff --git a/drivers/gpu/drm/apple/dptxep.c b/drivers/gpu/drm/apple/dptxep.c index 741f40bc8c9ed5..3158cbe3aa6854 100644 --- a/drivers/gpu/drm/apple/dptxep.c +++ b/drivers/gpu/drm/apple/dptxep.c @@ -25,6 +25,14 @@ #include "dptx-j700-training.h" +#include +#include + +static bool t600x_tunnel_max_hbr2 = true; +module_param(t600x_tunnel_max_hbr2, bool, 0644); +MODULE_PARM_DESC(t600x_tunnel_max_hbr2, + "Cap Thunderbolt DP tunnels on M1 Pro/Max at HBR2 so dual-stream docks share one tunnel pixel clock (default: true)"); + struct dcpdptx_connection_cmd { __le32 unk; __le32 target; @@ -337,12 +345,28 @@ static int dptxport_call_get_max_link_rate(struct apple_epic_service *service, void *reply_, size_t reply_size) { struct dptxport_apcall_link_rate *reply = reply_; + struct apple_dcp *dcp = service->ep->dcp; + u32 max_rate = LINK_RATE_HBR3; if (reply_size < sizeof(*reply)) return -EINVAL; + /* + * t600x feeds both Thunderbolt DP IN adapters of a port from one tunnel + * pixel clock (atc_tunnel_start_t8103()). A second stream training at a + * different link rate reselects that clock under the first one, which + * then dies with a DPTX FIFO error. Cap tunnels at HBR2 so both streams + * of a dual-stream dock run at the same rate. + */ + if (t600x_tunnel_max_hbr2 && READ_ONCE(dcp->dptx_tunnel) && + (of_machine_is_compatible("apple,t6000") || + of_machine_is_compatible("apple,t6001"))) { + max_rate = LINK_RATE_HBR2; + dev_dbg(dcp->dev, "DP tunnel: capping max link rate at HBR2 (t600x shared tunnel clock)\n"); + } + reply->retcode = cpu_to_le32(0); - reply->link_rate = cpu_to_le32(LINK_RATE_HBR3); + reply->link_rate = cpu_to_le32(max_rate); return 0; }