All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>,
	linux-usb@vger.kernel.org
Subject: [PATCH v2 1/1] usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch
Date: Thu, 25 Nov 2021 15:15:16 +0100	[thread overview]
Message-ID: <20211125141516.1668633-1-alexander.stein@ew.tq-group.com> (raw)

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>
---
Changes in v2:
* Added missing variable declaration

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

diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
index d7f76835137f..8b5ac689b8da 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>
 
@@ -542,6 +543,7 @@ static int dwc3_setup_role_switch(struct dwc3 *dwc)
 {
 	struct usb_role_switch_desc dwc3_role_switch = {NULL};
 	u32 mode;
+	int ret;
 
 	dwc->role_switch_default_mode = usb_get_role_switch_default_mode(dwc->dev);
 	if (dwc->role_switch_default_mode == USB_DR_MODE_HOST) {
@@ -559,6 +561,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;
 }
-- 
2.25.1


             reply	other threads:[~2021-11-25 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-25 14:15 Alexander Stein [this message]
2021-12-03 11:02 ` [PATCH v2 1/1] usb: dwc3: drd: Add support for usb-conn-gpio based usb-role-switch Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211125141516.1668633-1-alexander.stein@ew.tq-group.com \
    --to=alexander.stein@ew.tq-group.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.