[PATCH 07/11] regulator: renesas-usb-vbus-regulator: Add RZ/G3L VBUS regulator support
From: Biju
Date: Fri Jun 12 2026 - 10:35:42 EST
From: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
Add support for registering two USB VBUS regulators for the RZ/G3L
(r9a08g046) SoC, which has 2 OTG controllers unlike RZ/G3S which has one.
Add a second regulator descriptor rzg2l_usb_vbus_rdesc1 for the second
USB port (regulator1-vbus, enable_mask BIT(1)) alongside the existing
rzg2l_usb_vbus_rdesc (regulator-vbus, enable_mask BIT(0)).
Introduce a common probe helper rzg2l_usb_vbus_regulator_common_probe()
with a multi_regulator parameter, and a dedicated
rzg3l_usb_vbus_regulator_probe() and platform driver
rzg3l-usb-vbus-regulator for RZ/G3L.
The existing rzg2l_usb_vbus_regulator_probe() continues to register only
regulator-vbus for other SoCs.
Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
---
.../regulator/renesas-usb-vbus-regulator.c | 46 +++++++++++++++++--
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
index 511631a788c2..ea04d29bb9c9 100644
--- a/drivers/regulator/renesas-usb-vbus-regulator.c
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -31,6 +31,19 @@ static const struct regulator_desc rzg2l_usb_vbus_rdesc = {
.n_voltages = 1,
};
+static const struct regulator_desc rzg2l_usb_vbus_rdesc1 = {
+ .name = "vbus1",
+ .of_match = of_match_ptr("regulator1-vbus"),
+ .ops = &rzg2l_usb_vbus_reg_ops,
+ .type = REGULATOR_VOLTAGE,
+ .owner = THIS_MODULE,
+ .enable_reg = 0,
+ .enable_mask = BIT(1),
+ .enable_is_inverted = true,
+ .fixed_uV = 5000000,
+ .n_voltages = 1,
+};
+
static int rzg2l_usb_vbus_regulator_register(struct device_node *np,
const char *name,
const struct regulator_desc *desc,
@@ -50,10 +63,12 @@ static int rzg2l_usb_vbus_regulator_register(struct device_node *np,
return 0;
}
-static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
+static int rzg2l_usb_vbus_regulator_common_probe(struct platform_device *pdev,
+ bool multi_regulator)
{
struct regulator_config config = { };
struct device *dev = &pdev->dev;
+ int ret;
config.regmap = dev_get_regmap(dev->parent, NULL);
if (!config.regmap)
@@ -61,8 +76,24 @@ static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
config.dev = dev;
- return rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator-vbus",
- &rzg2l_usb_vbus_rdesc, &config);
+ ret = rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator-vbus",
+ &rzg2l_usb_vbus_rdesc, &config);
+
+ if (ret || !multi_regulator)
+ return ret;
+
+ return rzg2l_usb_vbus_regulator_register(dev->parent->of_node, "regulator1-vbus",
+ &rzg2l_usb_vbus_rdesc1, &config);
+}
+
+static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+ return rzg2l_usb_vbus_regulator_common_probe(pdev, false);
+}
+
+static int rzg3l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+ return rzg2l_usb_vbus_regulator_common_probe(pdev, true);
}
static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
@@ -74,6 +105,15 @@ static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
};
module_platform_driver(rzg2l_usb_vbus_regulator_driver);
+static struct platform_driver rzg3l_usb_vbus_regulator_driver = {
+ .probe = rzg3l_usb_vbus_regulator_probe,
+ .driver = {
+ .name = "rzg3l-usb-vbus-regulator",
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ },
+};
+module_platform_driver(rzg3l_usb_vbus_regulator_driver);
+
MODULE_AUTHOR("Biju Das <biju.das.jz@xxxxxxxxxxxxxx>");
MODULE_DESCRIPTION("Renesas RZ/G2L USB Vbus Regulator Driver");
MODULE_LICENSE("GPL");
--
2.43.0