diff mbox series

[1/1] usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch

Message ID 20211125104748.1418934-1-alexander.stein@ew.tq-group.com (mailing list archive)
State Superseded
Headers show
Series [1/1] usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch | expand

Commit Message

Alexander Stein Nov. 25, 2021, 10:47 a.m. UTC
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>
---
This change is inspired by commit f67213cee2b3 ("phy: tegra: xusb: Add
usb-role-switch support") for tegras xusb driver, which also does
populate the connector entry.

 drivers/usb/dwc3/drd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

kernel test robot Nov. 25, 2021, 2:03 p.m. UTC | #1
Hi Alexander,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.16-rc2 next-20211125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Alexander-Stein/usb-dwc3-drd-Add-support-for-usb-conn-gpio-based-usb-role-switch/20211125-185107
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20211125/202111252223.hSDDVm5l-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/4f8eca1973568289a7d33683cda0a0fc3db187ee
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Alexander-Stein/usb-dwc3-drd-Add-support-for-usb-conn-gpio-based-usb-role-switch/20211125-185107
        git checkout 4f8eca1973568289a7d33683cda0a0fc3db187ee
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash drivers/phy/freescale/ drivers/usb/dwc3/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/usb/dwc3/drd.c: In function 'dwc3_setup_role_switch':
>> drivers/usb/dwc3/drd.c:564:9: error: 'ret' undeclared (first use in this function); did you mean 'net'?
     564 |         ret = devm_of_platform_populate(dwc->dev);
         |         ^~~
         |         net
   drivers/usb/dwc3/drd.c:564:9: note: each undeclared identifier is reported only once for each function it appears in


vim +564 drivers/usb/dwc3/drd.c

   541	
   542	static int dwc3_setup_role_switch(struct dwc3 *dwc)
   543	{
   544		struct usb_role_switch_desc dwc3_role_switch = {NULL};
   545		u32 mode;
   546	
   547		dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
   548		if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
   549			mode = DWC3_GCTL_PRTCAP_HOST;
   550		} else {
   551			dwc->role_switch_default_mode = USB_DR_MODE_PERIPHERAL;
   552			mode = DWC3_GCTL_PRTCAP_DEVICE;
   553		}
   554	
   555		dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
   556		dwc3_role_switch.set = dwc3_usb_role_switch_set;
   557		dwc3_role_switch.get = dwc3_usb_role_switch_get;
   558		dwc3_role_switch.driver_data = dwc;
   559		dwc->role_sw = usb_role_switch_register(dwc->dev, &dwc3_role_switch);
   560		if (IS_ERR(dwc->role_sw))
   561			return PTR_ERR(dwc->role_sw);
   562	
   563		/* populate connector entry */
 > 564		ret = devm_of_platform_populate(dwc->dev);
   565		if (ret) {
   566			dev_err(dwc->dev, "DWC3 platform devices creation failed: %i\n", ret);
   567			return ret;
   568		}
   569	
   570		dwc3_set_mode(dwc, mode);
   571		return 0;
   572	}
   573	#else
   574	#define ROLE_SWITCH 0
   575	#define dwc3_setup_role_switch(x) 0
   576	#endif
   577	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index d7f76835137f..281d8a310c89 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>
 
@@ -559,6 +560,13 @@  static int dwc3_setup_role_switch(struct dwc3 *dwc)
 	if (IS_ERR(dwc->role_sw))
 		return PTR_ERR(dwc->role_sw);
 
+	/* populate connector entry */
+	ret = devm_of_platform_populate(dwc->dev);
+	if (ret) {
+		dev_err(dwc->dev, "DWC3 platform devices creation failed: %i\n", ret);
+		return ret;
+	}
+
 	dwc3_set_mode(dwc, mode);
 	return 0;
 }