summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@ew.tq-group.com>2022-01-05 08:14:07 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2022-11-02 14:20:20 +0100
commit9add5e5e1f7dd1e79eb0f7f7e32f1ab4851a9808 (patch)
tree807c964d49a6c15bb909897a0e2b0120ed473b33 /drivers
parentb4f7c3c44d8543d5c62b55fa2e23da8743471044 (diff)
usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch
usb-conn-gpio devices are a subnode of the USB interface controller, which needs to be populated. This allows having a non-type-c connector providing dual-role. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Link: https://lore.kernel.org/r/20220105071407.2240302-1-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Upstream-status: Backport [a102f07e4edf0f1cf06bf9825ab10e26a29dd945]
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/dwc3/drd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index 6c82493f7df9..cb737c276583 100644
--- a/drivers/usb/dwc3/drd.c
+++ b/drivers/usb/dwc3/drd.c
@@ -9,6 +9,7 @@
#include <linux/extcon.h>
#include <linux/of_graph.h>
+#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/property.h>
@@ -568,6 +569,18 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
if (IS_ERR(dwc->role_sw))
return PTR_ERR(dwc->role_sw);
+ if (IS_ENABLED(CONFIG_OF)) {
+ /* populate connector entry */
+ int ret = devm_of_platform_populate(dwc->dev);
+
+ if (ret) {
+ usb_role_switch_unregister(dwc->role_sw);
+ dwc->role_sw = NULL;
+ dev_err(dwc->dev, "DWC3 platform devices creation failed: %i\n", ret);
+ return ret;
+ }
+ }
+
dwc3_set_mode(dwc, mode);
return 0;
}