aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/typec
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2021-06-02 14:22:53 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-02 16:40:43 +0200
commit7f7d0afe1d479990b712ecb494257dcd706a8016 (patch)
tree5e53d0ae190abd2335973eafeff2a97fd9aa2899 /drivers/usb/typec
parentaa10fab0f859ef86e998ee1cdaa89fc8e542e2c9 (diff)
Revert "usb: typec: mux: Remove requirement for the "orientation-switch" device property"
This reverts commit acad3e9c7250c5fd20d9778a163f2adc95de38f5. The device property that can be used to identify the device class/type of the remote port parent when device graph is used is always needed after all. Without it there is no real way to know is the requested connection actually described in the device graph or not. If the connection is described in the device graph but the device instance is still missing for what ever reason, the code defers probe for now. Adding a comment to the code to explain this. Reviewed-by: Li Jun <jun.li@nxp.com> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20210602112253.70200-1-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec')
-rw-r--r--drivers/usb/typec/mux.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c
index 603f3e698cc0..664fb3513f48 100644
--- a/drivers/usb/typec/mux.c
+++ b/drivers/usb/typec/mux.c
@@ -30,6 +30,22 @@ static void *typec_switch_match(struct fwnode_handle *fwnode, const char *id,
{
struct device *dev;
+ /*
+ * Device graph (OF graph) does not give any means to identify the
+ * device type or the device class of the remote port parent that @fwnode
+ * represents, so in order to identify the type or the class of @fwnode
+ * an additional device property is needed. With typec switches the
+ * property is named "orientation-switch" (@id). The value of the device
+ * property is ignored.
+ */
+ if (id && !fwnode_property_present(fwnode, id))
+ return NULL;
+
+ /*
+ * At this point we are sure that @fwnode is a typec switch in all
+ * cases. If the switch hasn't yet been registered for some reason, the
+ * function "defers probe" for now.
+ */
dev = class_find_device(&typec_mux_class, NULL, fwnode,
switch_fwnode_match);