Skip to content

Commit a102f07

Browse files
tq-steinagregkh
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7bd42fb commit a102f07

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/usb/dwc3/drd.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/extcon.h>
1111
#include <linux/of_graph.h>
12+
#include <linux/of_platform.h>
1213
#include <linux/platform_device.h>
1314
#include <linux/property.h>
1415

@@ -559,6 +560,18 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
559560
if (IS_ERR(dwc->role_sw))
560561
return PTR_ERR(dwc->role_sw);
561562

563+
if (IS_ENABLED(CONFIG_OF)) {
564+
/* populate connector entry */
565+
int ret = devm_of_platform_populate(dwc->dev);
566+
567+
if (ret) {
568+
usb_role_switch_unregister(dwc->role_sw);
569+
dwc->role_sw = NULL;
570+
dev_err(dwc->dev, "DWC3 platform devices creation failed: %i\n", ret);
571+
return ret;
572+
}
573+
}
574+
562575
dwc3_set_mode(dwc, mode);
563576
return 0;
564577
}

0 commit comments

Comments
 (0)