Message ID | 20230425034010.3789376-1-quic_bjorande@quicinc.com |
---|---|
Headers | show |
Series | phy: qcom-qmp-combo: Support orientation switching | expand |
Hi Bjorn, On Mon, Apr 24, 2023 at 10:40 PM Bjorn Andersson <quic_bjorande@quicinc.com> wrote: > > This adds support for USB and DisplayPort orientation switching to the > QMP combo PHY, as well as updating the sc8280xp devices to include the > QMP in the SuperSpeed graph. > > Bjorn Andersson (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and > orientation-switch > phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit > phy: qcom-qmp-combo: Introduce orientation variable > phy: qcom-qmp-combo: Introduce orientation switching > phy: qcom-qmp-combo: Introduce drm_bridge > arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph > arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph > > .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 51 ++++ > arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 28 ++- > .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 28 ++- > arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 34 +++ > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 227 ++++++++++++++---- > 5 files changed, 309 insertions(+), 59 deletions(-) > > -- > 2.39.2 > Thank you! I have been looking forward to this patchset for a while :) Tested with 05ac:1460 Apple, Inc. Digital AV Multiport Adapter and 0639:7210 Chrontel, Inc. Billboard and both work with orientation switching. Tested-by: Steev Klimaszewski <steev@kali.org>
On Tue, Apr 25, 2023 at 4:40 AM Bjorn Andersson <quic_bjorande@quicinc.com> wrote: > > The QMP combo PHY sits in an of_graph connected between the DisplayPort > controller and a USB Type-C connector (or possibly a redriver). > > The TCPM needs to be able to convey the HPD signal to the DisplayPort > controller, but no directly link is provided by DeviceTree so the signal > needs to "pass through" the QMP combo phy. > > Handle this by introducing a drm_bridge which upon initialization finds > the next bridge (i.e. the usb-c-connector) and chain this together. This > way HPD changes in the connector will propagate to the DisplayPort > driver. > > The connector bridge is resolved lazily, as the TCPM is expected to be > able to resolve the typec mux and switch at probe time, so the QMP combo > phy will probe before the TCPM. > > Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> > --- > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 36 +++++++++++++++++++++++ > 1 file changed, 36 insertions(+) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > index 5d6d6ef3944b..84bc08002537 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c > @@ -22,6 +22,8 @@ > #include <linux/usb/typec.h> > #include <linux/usb/typec_mux.h> > > +#include <drm/drm_bridge.h> > + > #include <dt-bindings/phy/phy-qcom-qmp.h> > > #include "phy-qcom-qmp.h" > @@ -1332,6 +1334,8 @@ struct qmp_combo { > struct clk_hw dp_link_hw; > struct clk_hw dp_pixel_hw; > > + struct drm_bridge bridge; > + > struct typec_switch_dev *sw; > enum typec_orientation orientation; > }; > @@ -3196,6 +3200,34 @@ static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node * > return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, dp_np); > } > > +static int qmp_combo_bridge_attach(struct drm_bridge *bridge, > + enum drm_bridge_attach_flags flags) > +{ > + struct qmp_combo *qmp = container_of(bridge, struct qmp_combo, bridge); > + struct drm_bridge *next_bridge; > + > + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) > + return -EINVAL; > + > + next_bridge = devm_drm_of_get_bridge(qmp->dev, qmp->dev->of_node, 0, 0); > + if (IS_ERR(next_bridge)) > + return dev_err_probe(qmp->dev, PTR_ERR(next_bridge), "failed to acquire drm_bridge\n"); > + > + return drm_bridge_attach(bridge->encoder, next_bridge, bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); > +} > + > +static const struct drm_bridge_funcs qmp_combo_bridge_funcs = { > + .attach = qmp_combo_bridge_attach, > +}; > + > +static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp) > +{ > + qmp->bridge.funcs = &qmp_combo_bridge_funcs; > + qmp->bridge.of_node = qmp->dev->of_node; > + > + return devm_drm_bridge_add(qmp->dev, &qmp->bridge); > +} > + > static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np) > { > struct device *dev = qmp->dev; > @@ -3459,6 +3491,10 @@ static int qmp_combo_probe(struct platform_device *pdev) > if (ret) > return ret; > > + ret = qmp_combo_dp_register_bridge(qmp); > + if (ret) > + return ret; > + > /* Check for legacy binding with child nodes. */ > usb_np = of_get_child_by_name(dev->of_node, "usb3-phy"); > if (usb_np) { > -- > 2.39.2 > You need to add some or all of these select DRM_DISPLAY_DP_HELPER select DRM_DISPLAY_HELPER select DRM_DP_AUX_BUS select DRM_KMS_HELPER select DRM_MIPI_DSI select DRM_PANEL /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: Unexpected GOT/PLT entries detected! /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: Unexpected run-time procedure linkages detected! drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_bridge_attach': phy-qcom-qmp-combo.c:(.text+0xb50): undefined reference to `devm_drm_of_get_bridge' phy-qcom-qmp-combo.c:(.text+0xb6c): undefined reference to `drm_bridge_attach' drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_probe': phy-qcom-qmp-combo.c:(.text+0x13fc): undefined reference to `devm_drm_bridge_add' --- bod
On 23-04-24 20:40:03, Bjorn Andersson wrote: > This adds support for USB and DisplayPort orientation switching to the > QMP combo PHY, as well as updating the sc8280xp devices to include the > QMP in the SuperSpeed graph. > Tested this entire patchset on my X13s. Therefore: Tested-by: Abel Vesa <abel.vesa@linaro.org> > Bjorn Andersson (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and > orientation-switch > phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit > phy: qcom-qmp-combo: Introduce orientation variable > phy: qcom-qmp-combo: Introduce orientation switching > phy: qcom-qmp-combo: Introduce drm_bridge > arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph > arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph > > .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 51 ++++ > arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 28 ++- > .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 28 ++- > arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 34 +++ > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 227 ++++++++++++++---- > 5 files changed, 309 insertions(+), 59 deletions(-) > > -- > 2.39.2 >
On 26/04/2023 12:33, Bryan O'Donoghue wrote: > On Tue, Apr 25, 2023 at 4:40 AM Bjorn Andersson > <quic_bjorande@quicinc.com> wrote: >> >> The QMP combo PHY sits in an of_graph connected between the DisplayPort >> controller and a USB Type-C connector (or possibly a redriver). >> >> The TCPM needs to be able to convey the HPD signal to the DisplayPort >> controller, but no directly link is provided by DeviceTree so the signal >> needs to "pass through" the QMP combo phy. >> >> Handle this by introducing a drm_bridge which upon initialization finds >> the next bridge (i.e. the usb-c-connector) and chain this together. This >> way HPD changes in the connector will propagate to the DisplayPort >> driver. >> >> The connector bridge is resolved lazily, as the TCPM is expected to be >> able to resolve the typec mux and switch at probe time, so the QMP combo >> phy will probe before the TCPM. >> >> Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> >> --- >> drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 36 +++++++++++++++++++++++ >> 1 file changed, 36 insertions(+) >> >> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >> index 5d6d6ef3944b..84bc08002537 100644 >> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >> @@ -22,6 +22,8 @@ >> #include <linux/usb/typec.h> >> #include <linux/usb/typec_mux.h> >> >> +#include <drm/drm_bridge.h> >> + >> #include <dt-bindings/phy/phy-qcom-qmp.h> >> >> #include "phy-qcom-qmp.h" >> @@ -1332,6 +1334,8 @@ struct qmp_combo { >> struct clk_hw dp_link_hw; >> struct clk_hw dp_pixel_hw; >> >> + struct drm_bridge bridge; >> + >> struct typec_switch_dev *sw; >> enum typec_orientation orientation; >> }; >> @@ -3196,6 +3200,34 @@ static int qmp_combo_register_clocks(struct qmp_combo *qmp, struct device_node * >> return devm_add_action_or_reset(qmp->dev, phy_clk_release_provider, dp_np); >> } >> >> +static int qmp_combo_bridge_attach(struct drm_bridge *bridge, >> + enum drm_bridge_attach_flags flags) >> +{ >> + struct qmp_combo *qmp = container_of(bridge, struct qmp_combo, bridge); >> + struct drm_bridge *next_bridge; >> + >> + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) >> + return -EINVAL; >> + >> + next_bridge = devm_drm_of_get_bridge(qmp->dev, qmp->dev->of_node, 0, 0); >> + if (IS_ERR(next_bridge)) >> + return dev_err_probe(qmp->dev, PTR_ERR(next_bridge), "failed to acquire drm_bridge\n"); >> + >> + return drm_bridge_attach(bridge->encoder, next_bridge, bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); >> +} >> + >> +static const struct drm_bridge_funcs qmp_combo_bridge_funcs = { >> + .attach = qmp_combo_bridge_attach, >> +}; >> + >> +static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp) >> +{ >> + qmp->bridge.funcs = &qmp_combo_bridge_funcs; >> + qmp->bridge.of_node = qmp->dev->of_node; >> + >> + return devm_drm_bridge_add(qmp->dev, &qmp->bridge); >> +} >> + >> static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, struct device_node *np) >> { >> struct device *dev = qmp->dev; >> @@ -3459,6 +3491,10 @@ static int qmp_combo_probe(struct platform_device *pdev) >> if (ret) >> return ret; >> >> + ret = qmp_combo_dp_register_bridge(qmp); >> + if (ret) >> + return ret; I think the DRM part should be only built if CONFIG_DRM is enabled, I don't have a strong opinion on this, I think Vinod could help here. >> + >> /* Check for legacy binding with child nodes. */ >> usb_np = of_get_child_by_name(dev->of_node, "usb3-phy"); >> if (usb_np) { >> -- >> 2.39.2 >> > > You need to add some or all of these > select DRM_DISPLAY_DP_HELPER > select DRM_DISPLAY_HELPER > select DRM_DP_AUX_BUS > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select DRM_PANEL > > > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > Unexpected GOT/PLT entries detected! > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > Unexpected run-time procedure linkages detected! > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function > `qmp_combo_bridge_attach': > phy-qcom-qmp-combo.c:(.text+0xb50): undefined reference to > `devm_drm_of_get_bridge' > phy-qcom-qmp-combo.c:(.text+0xb6c): undefined reference to `drm_bridge_attach' > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_probe': > phy-qcom-qmp-combo.c:(.text+0x13fc): undefined reference to > `devm_drm_bridge_add' I think CONFIG_DRM_PANEL_BRIDGE in addition to CONFIG_DRM. should be enough. With this config added and my drm-bridge hat: Acked-by: Neil Armstrong <neil.armstrong@linaro.org> Neil > > --- > bod
On Wed, Apr 26, 2023 at 11:33:40AM +0100, Bryan O'Donoghue wrote: > On Tue, Apr 25, 2023 at 4:40 AM Bjorn Andersson > <quic_bjorande@quicinc.com> wrote: > > [..] > You need to add some or all of these > select DRM_DISPLAY_DP_HELPER > select DRM_DISPLAY_HELPER > select DRM_DP_AUX_BUS > select DRM_KMS_HELPER > select DRM_MIPI_DSI > select DRM_PANEL > > > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > Unexpected GOT/PLT entries detected! > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > Unexpected run-time procedure linkages detected! > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function > `qmp_combo_bridge_attach': > phy-qcom-qmp-combo.c:(.text+0xb50): undefined reference to > `devm_drm_of_get_bridge' > phy-qcom-qmp-combo.c:(.text+0xb6c): undefined reference to `drm_bridge_attach' > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_probe': > phy-qcom-qmp-combo.c:(.text+0x13fc): undefined reference to > `devm_drm_bridge_add' > You're correct, and TYPEC. Realized that I forgot these once I had posted the patches. Will figure out the actual set for v2. Thanks, Bjorn
On Thu, Apr 27, 2023 at 8:56 PM Bjorn Andersson <quic_bjorande@quicinc.com> wrote: > > On Wed, Apr 26, 2023 at 11:33:40AM +0100, Bryan O'Donoghue wrote: > > On Tue, Apr 25, 2023 at 4:40 AM Bjorn Andersson > > <quic_bjorande@quicinc.com> wrote: > > > > [..] > > You need to add some or all of these > > select DRM_DISPLAY_DP_HELPER > > select DRM_DISPLAY_HELPER > > select DRM_DP_AUX_BUS > > select DRM_KMS_HELPER > > select DRM_MIPI_DSI > > select DRM_PANEL > > > > > > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > > Unexpected GOT/PLT entries detected! > > /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: > > Unexpected run-time procedure linkages detected! > > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function > > `qmp_combo_bridge_attach': > > phy-qcom-qmp-combo.c:(.text+0xb50): undefined reference to > > `devm_drm_of_get_bridge' > > phy-qcom-qmp-combo.c:(.text+0xb6c): undefined reference to `drm_bridge_attach' > > drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_probe': > > phy-qcom-qmp-combo.c:(.text+0x13fc): undefined reference to > > `devm_drm_bridge_add' > > > > You're correct, and TYPEC. Realized that I forgot these once I had > posted the patches. Will figure out the actual set for v2. > > Thanks, > Bjorn So I added CONFIG_DRM to Kconfig for the combo phy and then replaced the old patch we had with your series. Works for me with my TCPM set with zero changes - aside from slotting the old PHY patch with your expanded series on SM8250 Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> https://git.codelinaro.org/bryan.odonoghue/kernel/-/tree/linux-next-23-04-28-pm8150b-tcpm-qcom-wrapper-typec-mux-bjorn
On Mon, Apr 24, 2023 at 08:40:03PM -0700, Bjorn Andersson wrote: > This adds support for USB and DisplayPort orientation switching to the > QMP combo PHY, as well as updating the sc8280xp devices to include the > QMP in the SuperSpeed graph. Nice and clean series! I've tested it a bit on the X13s and verified that DP works on both ports and in both orientations. Coldplug also appears to work reliably. Tested-by: Johan Hovold <johan+linaro@kernel.org> # X13s > Bjorn Andersson (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and > orientation-switch > phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit > phy: qcom-qmp-combo: Introduce orientation variable > phy: qcom-qmp-combo: Introduce orientation switching > phy: qcom-qmp-combo: Introduce drm_bridge > arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph > arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph > > .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 51 ++++ > arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 28 ++- > .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 28 ++- > arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 34 +++ > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 227 ++++++++++++++---- > 5 files changed, 309 insertions(+), 59 deletions(-) Johan
On 25/04/2023 05:40, Bjorn Andersson wrote: > This adds support for USB and DisplayPort orientation switching to the > QMP combo PHY, as well as updating the sc8280xp devices to include the > QMP in the SuperSpeed graph. > > Bjorn Andersson (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and > orientation-switch > phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit > phy: qcom-qmp-combo: Introduce orientation variable > phy: qcom-qmp-combo: Introduce orientation switching > phy: qcom-qmp-combo: Introduce drm_bridge > arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph > arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph > > .../phy/qcom,sc8280xp-qmp-usb43dp-phy.yaml | 51 ++++ > arch/arm64/boot/dts/qcom/sc8280xp-crd.dts | 28 ++- > .../qcom/sc8280xp-lenovo-thinkpad-x13s.dts | 28 ++- > arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 34 +++ > drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 227 ++++++++++++++---- > 5 files changed, 309 insertions(+), 59 deletions(-) > I succesfully tested this on the SM8450 HDK, and the following works: - USB-C to HDMI, both directions - USB-C to DP cable to DP display, both directions - USB-C to USB SuperSpeed, both directions - USB-C to USB-C, both directions, enables SuperSpeed Plus Gen 2x1 Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on HDK8450 Thanks, Neil
On Mon, 24 Apr 2023 20:40:03 -0700, Bjorn Andersson wrote: > This adds support for USB and DisplayPort orientation switching to the > QMP combo PHY, as well as updating the sc8280xp devices to include the > QMP in the SuperSpeed graph. > > Bjorn Andersson (7): > dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and > orientation-switch > phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit > phy: qcom-qmp-combo: Introduce orientation variable > phy: qcom-qmp-combo: Introduce orientation switching > phy: qcom-qmp-combo: Introduce drm_bridge > arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph > arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph > > [...] Applied, thanks! [1/7] dt-bindings: phy: qcom,sc8280xp-qmp-usb43dp: Add ports and orientation-switch (no commit info) [2/7] phy: qcom-qmp-combo: Move phy_mutex out of com_init/exit (no commit info) [3/7] phy: qcom-qmp-combo: Introduce orientation variable (no commit info) [4/7] phy: qcom-qmp-combo: Introduce orientation switching (no commit info) [5/7] phy: qcom-qmp-combo: Introduce drm_bridge (no commit info) [6/7] arm64: dts: qcom: sc8280xp-crd: Add QMP to SuperSpeed graph commit: 507ceaa5ca9fac0d9fe2521c29d7d6237c1214f4 [7/7] arm64: dts: qcom: sc8280xp-x13s: Add QMP to SuperSpeed graph commit: 42b08375498e74f094425fad10d10c338fd29858 Best regards,