]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tcpm: switch check for role_sw device with fw_node
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Mon, 13 Oct 2025 09:43:40 +0000 (11:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Oct 2025 13:07:05 +0000 (14:07 +0100)
commit 2d8713f807a49b8a67c221670e50ae04967e915d upstream.

When there is no port entry in the tcpci entry itself, the driver will
trigger an error message "OF: graph: no port node found in /...../typec" .

It is documented that the dts node should contain an connector entry
with ports and several port pointing to devices with usb-role-switch
property set. Only when those connector entry is missing, it should
check for port entries in the main node.

We switch the search order for looking after ports, which will avoid the
failure message while there are explicit connector entries.

Fixes: d56de8c9a17d ("usb: typec: tcpm: try to get role switch from tcpc fwnode")
Cc: stable <stable@kernel.org>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://patch.msgid.link/20251013-b4-ml-topic-tcpm-v2-1-63c9b2ab8a0b@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c

index 5774b50eeaf7f769e630e939dd913b58012112f7..2e39686e01c9e03a23c6d9339296de05e5a693a0 100644 (file)
@@ -6636,9 +6636,9 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
        port->partner_desc.identity = &port->partner_ident;
        port->port_type = port->typec_caps.type;
 
-       port->role_sw = usb_role_switch_get(port->dev);
+       port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode);
        if (!port->role_sw)
-               port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode);
+               port->role_sw = usb_role_switch_get(port->dev);
        if (IS_ERR(port->role_sw)) {
                err = PTR_ERR(port->role_sw);
                goto out_destroy_wq;