On Thu Feb 29, 2024 at 2:07 PM CET, Neil Armstrong wrote: > Register a typec mux in order to change the PHY mode on the Type-C > mux events depending on the mode and the svid when in Altmode setup. > > The DisplayPort phy should be left enabled if is still powered on > by the DRM DisplayPort controller, so bail out until the DisplayPort > PHY is not powered off. > > The Type-C Mode/SVID only changes on plug/unplug, and USB SAFE states > will be set in between of USB-Only, Combo and DisplayPort Only so > this will leave enough time to the DRM DisplayPort controller to > turn of the DisplayPort PHY. > > The patchset also includes bindings changes and DT changes. > > This has been successfully tested on an SM8550 board, but the > Thinkpad X13s deserved testing between non-PD USB, non-PD DisplayPort, > PD USB Hubs and PD Altmode Dongles to make sure the switch works > as expected. > > The DisplayPort 4 lanes setup can be check with: > $ cat /sys/kernel/debug/dri/ae01000.display-controller/DP-1/dp_debug > name = msm_dp > drm_dp_link > rate = 540000 > num_lanes = 4 Hi Neil, I tried this on QCM6490/SC7280 which should also support 4-lane DP but I haven't had any success so far. On top of your patches I added the following for my device: diff --git a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts index f5bd51806819..e7be17844da1 100644 --- a/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts +++ b/arch/arm64/boot/dts/qcom/qcm6490-fairphone-fp5.dts @@ -712,7 +712,7 @@ &mdss_dp { }; &mdss_dp_out { - data-lanes = <0 1>; + data-lanes = <0 1 2 3>; remote-endpoint = <&usb_dp_qmpphy_dp_in>; }; @@ -1344,6 +1344,7 @@ &usb_1_qmpphy { vdda-phy-supply = <&vreg_l6b>; vdda-pll-supply = <&vreg_l1b>; + mode-switch; orientation-switch; status = "okay"; The output of the dp_debug file shows it's trying to use 4 lanes: name = msm_dp drm_dp_link rate = 540000 num_lanes = 4 capabilities = 1 dp_panel_info: active = 0x0 back_porch = 0x0 front_porch = 0x0 sync_width = 0x0 active_low = 0x0 h_skew = 0 refresh rate = 0 pixel clock khz = 0 bpp = 0 dp_link: test_requested = 128 num_lanes = 4 bw_code = 20 lclk = 540000000 v_level = 2 p_level = 0 But the monitor stays black and the following appears in dmesg: (starts with plugging in a dongle, ends with unplugging it again) [ 1773.538161] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller [ 1773.538197] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 1 [ 1773.540215] xhci-hcd xhci-hcd.2.auto: hcc params 0x0230fe65 hci version 0x110 quirks 0x0000008000000010 [ 1773.540260] xhci-hcd xhci-hcd.2.auto: irq 185, io mem 0x0a600000 [ 1773.540372] xhci-hcd xhci-hcd.2.auto: xHCI Host Controller [ 1773.540384] xhci-hcd xhci-hcd.2.auto: new USB bus registered, assigned bus number 2 [ 1773.540396] xhci-hcd xhci-hcd.2.auto: Host supports USB 3.0 SuperSpeed [ 1773.540524] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.08 [ 1773.540534] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1773.540541] usb usb1: Product: xHCI Host Controller [ 1773.540547] usb usb1: Manufacturer: Linux 6.8.0-00058-g113103fa3b95 xhci-hcd [ 1773.540554] usb usb1: SerialNumber: xhci-hcd.2.auto [ 1773.540999] hub 1-0:1.0: USB hub found [ 1773.541028] hub 1-0:1.0: 1 port detected [ 1773.542010] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM. [ 1773.542146] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 6.08 [ 1773.542162] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1773.542174] usb usb2: Product: xHCI Host Controller [ 1773.542183] usb usb2: Manufacturer: Linux 6.8.0-00058-g113103fa3b95 xhci-hcd [ 1773.542193] usb usb2: SerialNumber: xhci-hcd.2.auto [ 1773.543241] hub 2-0:1.0: USB hub found [ 1773.543282] hub 2-0:1.0: 1 port detected [ 1775.563969] [drm:dp_ctrl_link_train] *ERROR* max v_level reached [ 1775.564031] [drm:dp_ctrl_link_train] *ERROR* link training #1 failed. ret=-11 [ 1775.597965] [drm:dp_display_process_hpd_high] *ERROR* failed to complete DP link training [ 1775.598149] [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy [ 1776.632081] [drm:dp_ctrl_link_train] *ERROR* max v_level reached [ 1776.632145] [drm:dp_ctrl_link_train] *ERROR* link training #1 failed. ret=-11 [ 1776.662978] [drm:dp_display_process_hpd_high] *ERROR* failed to complete DP link training [ 1776.663039] [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy [ 1777.717501] [drm:dp_ctrl_link_train] *ERROR* max v_level reached [ 1777.717524] [drm:dp_ctrl_link_train] *ERROR* link training #1 failed. ret=-11 [ 1777.751427] [drm:dp_display_process_hpd_high] *ERROR* failed to complete DP link training [ 1777.751518] [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy [ 1778.793550] [drm:dp_ctrl_link_train] *ERROR* max v_level reached [ 1778.793617] [drm:dp_ctrl_link_train] *ERROR* link training #1 failed. ret=-11 [ 1778.827260] [drm:dp_aux_isr] *ERROR* Unexpected DP AUX IRQ 0x01000000 when not busy [ 1778.827334] [drm:dp_display_process_hpd_high] *ERROR* failed to complete DP link training [ 1779.279889] xhci-hcd xhci-hcd.2.auto: remove, state 1 [ 1779.279942] usb usb2: USB disconnect, device number 1 [ 1779.311920] xhci-hcd xhci-hcd.2.auto: USB bus 2 deregistered [ 1779.311987] xhci-hcd xhci-hcd.2.auto: remove, state 4 [ 1779.312019] usb usb1: USB disconnect, device number 1 [ 1779.317772] xhci-hcd xhci-hcd.2.auto: USB bus 1 deregistered Regards Luca > ... > > Signed-off-by: Neil Armstrong <neil.armstrong@xxxxxxxxxx> > --- > Neil Armstrong (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add mode-switch > phy: qcom: qmp-combo: store DP phy power state > phy: qcom: qmp-combo: introduce QPHY_MODE > phy: qcom: qmp-combo: register a typec mux to change the QPHY_MODE > arm64: dts: qcom-sm8550: allow 4 lanes for DisplayPort and enable QMP PHY mode-switch > arm64: dts: qcom-sm8650: allow 4 lanes for DisplayPort and enable QMP PHY mode-switch > arm64: dts: qcom-mode-switch: allow 4 lanes for DisplayPort and enable QMP PHY mode-switch > > .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 5 + > .../dts/qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 6 +- > arch/arm64/boot/dts/qcom/sm8550-hdk.dts | 3 +- > arch/arm64/boot/dts/qcom/sm8550-qrd.dts | 3 +- > arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 3 +- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 168 +++++++++++++++++++-- > 6 files changed, 173 insertions(+), 15 deletions(-) > --- > base-commit: b321c0e8ca754d8cd9f23ceba958e3ea93c6519e > change-id: 20240229-topic-sm8x50-upstream-phy-combo-typec-mux-31b5252513c9 > > Best regards,