Hi Bjorn,
In the Qualcomm platforms the USB/DP PHY handles muxing and orientation switching of the SuperSpeed lines, but the SBU lines needs to be connected and switched by external (to the SoC) hardware. It's therefor necessary to be able to have the TypeC controller operate multiple TypeC muxes and switches. Use the newly introduced indirection object to handle this, to avoid having to taint the TypeC controllers with knowledge about the downstream hardware configuration. The max number of devs per indirection is set to 3, which account for being able to mux/switch the USB HS, SS and SBU lines, as per defined defined in the usb-c-connector binding. This number could be grown if need arrises at a later point in time. Acked-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> Signed-off-by: Bjorn Andersson <bjorn.andersson@xxxxxxxxxx> --- Changes since v4: - None drivers/usb/typec/mux.c <https://lore.kernel.org/all/20220422222351.1297276-6-bjorn.andersson@xxxxxxxxxx/#Z31drivers:usb:typec:mux.c> | 128 ++++++++++++++++++++++++++++++++-------- 1 filechanged <https://lore.kernel.org/all/20220422222351.1297276-6-bjorn.andersson@xxxxxxxxxx/#related>, 102 insertions(+), 26 deletions(-)
With this commit, TCPC device shall match *two* endpoint port both for switch device and mux device if they have the same parent node like the following DT. It causes the callback funtion is invoked twice both for switch and mux in tcpm_mux_set() process. arch/arm64/boot/dts/rockchip/rk3588-evb1-v10.dts &usbdp_phy0 { mode-switch; orientation-switch; [...] port { #address-cells = <1>; #size-cells = <0>; usbdp_phy0_orientation_switch: endpoint@0 { reg = <0>; remote-endpoint = <&usbc0_orien_sw>; }; usbdp_phy0_dp_altmode_mux: endpoint@1 { reg = <1>; remote-endpoint = <&dp_altmode_mux>; }; }; }; BR. Frank