public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: dwc3: dwc3-generic-plat: Add optional VBUS regulator support
@ 2026-03-16  8:00 Chukun Pan
  2026-03-17  4:15 ` Ze Huang
  2026-03-18  0:29 ` Thinh Nguyen
  0 siblings, 2 replies; 13+ messages in thread
From: Chukun Pan @ 2026-03-16  8:00 UTC (permalink / raw)
  To: Thinh Nguyen
  Cc: Greg Kroah-Hartman, Ze Huang, Yixun Lan, linux-riscv,
	linux-kernel, linux-usb, spacemit, Chukun Pan

Some boards provide USB VBUS through a controllable regulator. Add
support for the optional vbus-supply property so the regulator can
be properly managed instead of left always-on. Note that this does
not apply to USB Hub downstream ports with different VBUS supplies.

The enabled and disabled actions of the regulator are handled
automatically by devm_regulator_get_enable_optional().

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
---
The vbus-supply property has been declared in spacemit,k1-dwc3.yaml
https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/usb/spacemit%2Ck1-dwc3.yaml#L71
---
 drivers/usb/dwc3/dwc3-generic-plat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index e846844e0023..83b4e4d69ba9 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -12,6 +12,7 @@
 #include <linux/reset.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
+#include <linux/regulator/consumer.h>
 #include "glue.h"
 
 #define EIC7700_HSP_BUS_FILTER_EN	BIT(0)
@@ -113,6 +114,10 @@ static int dwc3_generic_probe(struct platform_device *pdev)
 	if (ret < 0)
 		return dev_err_probe(dev, ret, "failed to get clocks\n");
 
+	ret = devm_regulator_get_enable_optional(dev, "vbus");
+	if (ret && ret != -ENODEV)
+		return dev_err_probe(dev, ret, "failed to enable VBUS\n");
+
 	dwc3g->num_clocks = ret;
 	dwc3g->dwc.dev = dev;
 	probe_data.dwc = &dwc3g->dwc;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-03-20 15:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16  8:00 [PATCH 1/1] usb: dwc3: dwc3-generic-plat: Add optional VBUS regulator support Chukun Pan
2026-03-17  4:15 ` Ze Huang
2026-03-18  0:29 ` Thinh Nguyen
2026-03-18  6:30   ` Chukun Pan
2026-03-18 23:15     ` Thinh Nguyen
2026-03-19  6:26       ` Chukun Pan
2026-03-19 21:46         ` Thinh Nguyen
2026-03-20  6:36           ` Chukun Pan
2026-03-20  7:45             ` Ze Huang
2026-03-20  8:18               ` Chukun Pan
2026-03-20  9:50                 ` Ze Huang
2026-03-20 10:40                   ` Chukun Pan
2026-03-20 15:05                     ` Ze Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox