Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] regulator: qcom_usb_vbus: add pm4125 VBUS regulator support
@ 2026-05-20  9:07 Rakesh Kota
  2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
  2026-05-20  9:07 ` [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg Rakesh Kota
  0 siblings, 2 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20  9:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng
  Cc: linux-arm-msm, linux-kernel, devicetree, jishnu.prakash,
	kamal.wadhwa, Rakesh Kota

Add support for PM4125 USB VBUS regulator. Unlike PM8150B which uses
a current-limit selector, PM4125 uses a 2-bit VBOOST voltage selector
supporting 4.25 V, 4.5 V, 4.75 V and 5.0 V output.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
---
Rakesh Kota (2):
      dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
      regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg

 .../regulator/qcom,usb-vbus-regulator.yaml         |  50 +++++++++-
 drivers/regulator/qcom_usb_vbus-regulator.c        | 102 ++++++++++++++++++---
 2 files changed, 133 insertions(+), 19 deletions(-)
---
base-commit: 6a50ba100ace43f43c87384367eb2d2605fcc16c
change-id: 20260520-add_pm4125-vbus-reg-95c858c6ae43

Best regards,
-- 
Rakesh Kota <rakesh.kota@oss.qualcomm.com>


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

* [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:07 [PATCH 0/2] regulator: qcom_usb_vbus: add pm4125 VBUS regulator support Rakesh Kota
@ 2026-05-20  9:07 ` Rakesh Kota
  2026-05-20  9:20   ` sashiko-bot
                     ` (2 more replies)
  2026-05-20  9:07 ` [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg Rakesh Kota
  1 sibling, 3 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20  9:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng
  Cc: linux-arm-msm, linux-kernel, devicetree, jishnu.prakash,
	kamal.wadhwa, Rakesh Kota

The pm4125 PMIC uses a different USB VBUS register layout than pm8150b.
It uses a 2-bit VBOOST voltage selector supporting output voltages of
4.25 V, 4.5 V, 4.75 V and 5.0 V, instead of a current-limit selector.

Move qcom,pm4125-vbus-reg from the pm8150b fallback items list into the
standalone enum since the driver handles it with its own match-data and
register layout.

Make regulator-min/max-microamp conditional so they are only required
for current-limit variants (pm8150b, pm6150, pm7250b, pmi632). Add an
if/then condition for qcom,pm4125-vbus-reg requiring regulator-min/
max-microvolt instead, and update the pm4125 example accordingly.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
---
 .../regulator/qcom,usb-vbus-regulator.yaml         | 50 +++++++++++++++++++---
 1 file changed, 45 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
index fcefc722ee2a495837fedba026669de97350c566..7c74573848bcdafbf6260f69cfcd7a9b58bc9f2d 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
@@ -14,17 +14,21 @@ description: |
   regulator will be enabled in situations where the device is required to
   provide power to the connected peripheral.
 
-allOf:
-  - $ref: regulator.yaml#
+  The pm8150b variant uses an OTG current-limit selector, supporting limits
+  of 500 mA, 1000 mA, 1500 mA, 2000 mA, 2500 mA and 3000 mA.
+
+  The pm4125 variant uses a different register layout with a 2-bit VBOOST
+  voltage selector supporting output voltages of 4.25 V, 4.5 V, 4.75 V
+  and 5.0 V.
 
 properties:
   compatible:
     oneOf:
       - enum:
           - qcom,pm8150b-vbus-reg
+          - qcom,pm4125-vbus-reg
       - items:
           - enum:
-              - qcom,pm4125-vbus-reg
               - qcom,pm6150-vbus-reg
               - qcom,pm7250b-vbus-reg
               - qcom,pmi632-vbus-reg
@@ -34,11 +38,35 @@ properties:
     maxItems: 1
     description: VBUS output base address
 
+allOf:
+  - $ref: regulator.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - qcom,pm8150b-vbus-reg
+              - qcom,pm6150-vbus-reg
+              - qcom,pm7250b-vbus-reg
+              - qcom,pmi632-vbus-reg
+    then:
+      required:
+        - regulator-min-microamp
+        - regulator-max-microamp
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: qcom,pm4125-vbus-reg
+    then:
+      required:
+        - regulator-min-microvolt
+        - regulator-max-microvolt
+
 required:
   - compatible
   - reg
-  - regulator-min-microamp
-  - regulator-max-microamp
 
 unevaluatedProperties: false
 
@@ -55,4 +83,16 @@ examples:
             regulator-max-microamp = <3000000>;
         };
      };
+  - |
+     pmic {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        usb-vbus-regulator@5000 {
+            compatible = "qcom,pm4125-vbus-reg";
+            reg = <0x1100>;
+            regulator-min-microvolt = <4250000>;
+            regulator-max-microvolt = <5000000>;
+        };
+     };
 ...

-- 
2.34.1


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

* [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
  2026-05-20  9:07 [PATCH 0/2] regulator: qcom_usb_vbus: add pm4125 VBUS regulator support Rakesh Kota
  2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
@ 2026-05-20  9:07 ` Rakesh Kota
  2026-05-20  9:51   ` Konrad Dybcio
  1 sibling, 1 reply; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20  9:07 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng
  Cc: linux-arm-msm, linux-kernel, devicetree, jishnu.prakash,
	kamal.wadhwa, Rakesh Kota

The PM4125 PMIC uses a different register layout for USB VBUS control
compared to PM8150B. On PM4125, CMD_OTG is at offset 0x50, OTG_CFG is
at 0x56, and offset 0x52 is a 2-bit VBOOST voltage selector rather than
a current-limit selector.

Introduce per-compatible regulator descriptor data to accommodate these
differences. This keeps the existing PM8150B current-limit logic intact
while adding a dedicated voltage-selector path for PM4125.

Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
---
 drivers/regulator/qcom_usb_vbus-regulator.c | 102 ++++++++++++++++++++++++----
 1 file changed, 88 insertions(+), 14 deletions(-)

diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
index cd94ed67621fee9f6d7a0327054db0ebab6cc7ee..3d425452a0b35b35c4b454f84eb28e87cc8ba4f8 100644
--- a/drivers/regulator/qcom_usb_vbus-regulator.c
+++ b/drivers/regulator/qcom_usb_vbus-regulator.c
@@ -20,10 +20,35 @@
 #define OTG_CFG				0x53
 #define OTG_EN_SRC_CFG			BIT(1)
 
+#define PM4125_CMD_OTG			0x50
+#define PM4125_VBOOST_CFG		0x52
+#define PM4125_VBOOST_CFG_MASK		GENMASK(1, 0)
+#define PM4125_OTG_CFG			0x56
+#define PM4125_OTG_EN_SRC_CFG          BIT(0)
+
+struct qcom_usb_vbus_reg_data {
+	u16 cmd_otg;
+	u16 otg_cfg;
+	u8  otg_en_src_cfg;
+	u16 csel_reg;
+	u8 csel_mask;
+	const unsigned int *curr_table;
+	unsigned int n_current_limits;
+	u16 vsel_reg;
+	u8 vsel_mask;
+	const unsigned int *volt_table;
+	unsigned int n_voltages;
+	const struct regulator_ops *ops;
+};
+
 static const unsigned int curr_table[] = {
 	500000, 1000000, 1500000, 2000000, 2500000, 3000000,
 };
 
+static const unsigned int pm4125_vboost_table[] = {
+	4250000, 4500000, 4750000, 5000000,
+};
+
 static const struct regulator_ops qcom_usb_vbus_reg_ops = {
 	.enable = regulator_enable_regmap,
 	.disable = regulator_disable_regmap,
@@ -32,19 +57,43 @@ static const struct regulator_ops qcom_usb_vbus_reg_ops = {
 	.set_current_limit = regulator_set_current_limit_regmap,
 };
 
-static struct regulator_desc qcom_usb_vbus_rdesc = {
-	.name = "usb_vbus",
-	.ops = &qcom_usb_vbus_reg_ops,
-	.owner = THIS_MODULE,
-	.type = REGULATOR_VOLTAGE,
+static const struct regulator_ops qcom_usb_vbus_pm4125_reg_ops = {
+	.enable = regulator_enable_regmap,
+	.disable = regulator_disable_regmap,
+	.is_enabled = regulator_is_enabled_regmap,
+	.get_voltage_sel = regulator_get_voltage_sel_regmap,
+	.set_voltage_sel = regulator_set_voltage_sel_regmap,
+	.list_voltage = regulator_list_voltage_table,
+};
+
+static const struct qcom_usb_vbus_reg_data pm8150b_data = {
+	.cmd_otg = CMD_OTG,
+	.otg_cfg = OTG_CFG,
+	.otg_en_src_cfg = OTG_EN_SRC_CFG,
+	.csel_reg = OTG_CURRENT_LIMIT_CFG,
+	.csel_mask = OTG_CURRENT_LIMIT_MASK,
 	.curr_table = curr_table,
 	.n_current_limits = ARRAY_SIZE(curr_table),
+	.ops = &qcom_usb_vbus_reg_ops,
+};
+
+static const struct qcom_usb_vbus_reg_data pm4125_data = {
+	.cmd_otg = PM4125_CMD_OTG,
+	.otg_cfg = PM4125_OTG_CFG,
+	.otg_en_src_cfg = PM4125_OTG_EN_SRC_CFG,
+	.vsel_reg = PM4125_VBOOST_CFG,
+	.vsel_mask = PM4125_VBOOST_CFG_MASK,
+	.volt_table = pm4125_vboost_table,
+	.n_voltages = ARRAY_SIZE(pm4125_vboost_table),
+	.ops = &qcom_usb_vbus_pm4125_reg_ops,
 };
 
 static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	const struct qcom_usb_vbus_reg_data *data;
 	struct regulator_dev *rdev;
+	struct regulator_desc *rdesc;
 	struct regmap *regmap;
 	struct regulator_config config = { };
 	struct regulator_init_data *init_data;
@@ -57,27 +106,51 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	data = of_device_get_match_data(dev);
+	if (!data)
+		return -EINVAL;
+
 	regmap = dev_get_regmap(dev->parent, NULL);
 	if (!regmap) {
 		dev_err(dev, "Failed to get regmap\n");
 		return -ENOENT;
 	}
 
-	init_data = of_get_regulator_init_data(dev, dev->of_node,
-					       &qcom_usb_vbus_rdesc);
+	rdesc = devm_kzalloc(dev, sizeof(*rdesc), GFP_KERNEL);
+	if (!rdesc)
+		return -ENOMEM;
+
+	rdesc->name = "usb_vbus";
+	rdesc->ops = data->ops;
+	rdesc->owner = THIS_MODULE;
+	rdesc->type = REGULATOR_VOLTAGE;
+	rdesc->enable_reg = base + data->cmd_otg;
+	rdesc->enable_mask = OTG_EN;
+
+	if (data->curr_table) {
+		rdesc->curr_table = data->curr_table;
+		rdesc->n_current_limits = data->n_current_limits;
+		rdesc->csel_reg = base + data->csel_reg;
+		rdesc->csel_mask = data->csel_mask;
+	}
+
+	if (data->volt_table) {
+		rdesc->volt_table = data->volt_table;
+		rdesc->n_voltages = data->n_voltages;
+		rdesc->vsel_reg = base + data->vsel_reg;
+		rdesc->vsel_mask = data->vsel_mask;
+	}
+
+	init_data = of_get_regulator_init_data(dev, dev->of_node, rdesc);
 	if (!init_data)
 		return -ENOMEM;
 
-	qcom_usb_vbus_rdesc.enable_reg = base + CMD_OTG;
-	qcom_usb_vbus_rdesc.enable_mask = OTG_EN;
-	qcom_usb_vbus_rdesc.csel_reg = base + OTG_CURRENT_LIMIT_CFG;
-	qcom_usb_vbus_rdesc.csel_mask = OTG_CURRENT_LIMIT_MASK;
 	config.dev = dev;
 	config.init_data = init_data;
 	config.of_node = dev->of_node;
 	config.regmap = regmap;
 
-	rdev = devm_regulator_register(dev, &qcom_usb_vbus_rdesc, &config);
+	rdev = devm_regulator_register(dev, rdesc, &config);
 	if (IS_ERR(rdev)) {
 		ret = PTR_ERR(rdev);
 		dev_err(dev, "not able to register vbus reg %d\n", ret);
@@ -85,13 +158,14 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
 	}
 
 	/* Disable HW logic for VBUS enable */
-	regmap_update_bits(regmap, base + OTG_CFG, OTG_EN_SRC_CFG, 0);
+	regmap_update_bits(regmap, base + data->otg_cfg, data->otg_en_src_cfg, 0);
 
 	return 0;
 }
 
 static const struct of_device_id qcom_usb_vbus_regulator_match[] = {
-	{ .compatible = "qcom,pm8150b-vbus-reg" },
+	{ .compatible = "qcom,pm8150b-vbus-reg", .data = &pm8150b_data },
+	{ .compatible = "qcom,pm4125-vbus-reg", .data = &pm4125_data },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, qcom_usb_vbus_regulator_match);

-- 
2.34.1


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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
@ 2026-05-20  9:20   ` sashiko-bot
  2026-05-20 10:18     ` Rakesh Kota
  2026-05-20  9:44   ` Konrad Dybcio
  2026-05-20  9:58   ` Dmitry Baryshkov
  2 siblings, 1 reply; 11+ messages in thread
From: sashiko-bot @ 2026-05-20  9:20 UTC (permalink / raw)
  To: Rakesh Kota; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Removing the fallback compatible string for `qcom,pm4125-vbus-reg` breaks backwards compatibility and schema validation for existing device trees.
- [Low] Unit-address mismatch in the newly added pm4125 device tree example causes a dtc compiler warning/error.
--

commit d88778938ce0889e7c6904b04eca901125a815cb
Author: Rakesh Kota <rakesh.kota@oss.qualcomm.com>

dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg

This commit moves qcom,pm4125-vbus-reg from the fallback items list into
a standalone enum since it has a different register layout. It also updates
the required properties for this variant to use microvolt instead of
microamp, and adds a new example.

> diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml

[ ... ]

>  properties:
>    compatible:
>      oneOf:
>        - enum:
>            - qcom,pm8150b-vbus-reg
> +          - qcom,pm4125-vbus-reg
>        - items:
>            - enum:
> -              - qcom,pm4125-vbus-reg
>                - qcom,pm6150-vbus-reg
>                - qcom,pm7250b-vbus-reg

[Severity: High]
Does removing this fallback compatible string break backwards compatibility
for existing device trees?

Previously, the binding allowed the compatible string list to be
qcom,pm4125-vbus-reg, qcom,pm8150b-vbus-reg, which is currently used in
arch/arm64/boot/dts/qcom/pm4125.dtsi.

Additionally, the required properties for qcom,pm4125-vbus-reg are changed
from regulator-min/max-microamp to regulator-min/max-microvolt. Since
existing device trees like qrb2210-rb1.dts rely on the microamp properties,
will this cause make dtbs_check to fail for existing in-tree device trees?

[ ... ]

> +  - |
> +     pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        usb-vbus-regulator@5000 {
> +            compatible = "qcom,pm4125-vbus-reg";
> +            reg = <0x1100>;

[Severity: Low]
Will this unit-address mismatch cause a compiler warning during validation?

The node name specifies an address of 5000, but the reg property specifies
0x1100. This usually triggers a unit_address_vs_reg warning from the dtc
compiler during make dt_binding_check.

Should the node name be updated to match the reg property address?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260520-add_pm4125-vbus-reg-v1-0-f6d15d7dbbe8@oss.qualcomm.com?part=1

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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
  2026-05-20  9:20   ` sashiko-bot
@ 2026-05-20  9:44   ` Konrad Dybcio
  2026-05-20 10:21     ` Rakesh Kota
  2026-05-20  9:58   ` Dmitry Baryshkov
  2 siblings, 1 reply; 11+ messages in thread
From: Konrad Dybcio @ 2026-05-20  9:44 UTC (permalink / raw)
  To: Rakesh Kota, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wesley Cheng
  Cc: linux-arm-msm, linux-kernel, devicetree, jishnu.prakash,
	kamal.wadhwa

On 5/20/26 11:07 AM, Rakesh Kota wrote:
> The pm4125 PMIC uses a different USB VBUS register layout than pm8150b.
> It uses a 2-bit VBOOST voltage selector supporting output voltages of
> 4.25 V, 4.5 V, 4.75 V and 5.0 V, instead of a current-limit selector.
> 
> Move qcom,pm4125-vbus-reg from the pm8150b fallback items list into the
> standalone enum since the driver handles it with its own match-data and
> register layout.
> 
> Make regulator-min/max-microamp conditional so they are only required
> for current-limit variants (pm8150b, pm6150, pm7250b, pmi632). Add an
> if/then condition for qcom,pm4125-vbus-reg requiring regulator-min/
> max-microvolt instead, and update the pm4125 example accordingly.
> 
> Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> ---
>  .../regulator/qcom,usb-vbus-regulator.yaml         | 50 +++++++++++++++++++---
>  1 file changed, 45 insertions(+), 5 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> index fcefc722ee2a495837fedba026669de97350c566..7c74573848bcdafbf6260f69cfcd7a9b58bc9f2d 100644
> --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> @@ -14,17 +14,21 @@ description: |
>    regulator will be enabled in situations where the device is required to
>    provide power to the connected peripheral.
>  
> -allOf:
> -  - $ref: regulator.yaml#
> +  The pm8150b variant uses an OTG current-limit selector, supporting limits
> +  of 500 mA, 1000 mA, 1500 mA, 2000 mA, 2500 mA and 3000 mA.
> +
> +  The pm4125 variant uses a different register layout with a 2-bit VBOOST
> +  voltage selector supporting output voltages of 4.25 V, 4.5 V, 4.75 V
> +  and 5.0 V.
>  
>  properties:
>    compatible:
>      oneOf:
>        - enum:
>            - qcom,pm8150b-vbus-reg
> +          - qcom,pm4125-vbus-reg
>        - items:
>            - enum:
> -              - qcom,pm4125-vbus-reg
>                - qcom,pm6150-vbus-reg
>                - qcom,pm7250b-vbus-reg
>                - qcom,pmi632-vbus-reg

This change needs to be paired with an update to the existing DTS users,
or validation will fail

[...]

> +     pmic {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        usb-vbus-regulator@5000 {
> +            compatible = "qcom,pm4125-vbus-reg";
> +            reg = <0x1100>;

This should fail make dt_binding_check, as the reg value doesn't match the
unit address (after the @ sign)

Konrad

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

* Re: [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
  2026-05-20  9:07 ` [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg Rakesh Kota
@ 2026-05-20  9:51   ` Konrad Dybcio
  2026-05-20 11:21     ` Rakesh Kota
  0 siblings, 1 reply; 11+ messages in thread
From: Konrad Dybcio @ 2026-05-20  9:51 UTC (permalink / raw)
  To: Rakesh Kota, Liam Girdwood, Mark Brown, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Wesley Cheng
  Cc: linux-arm-msm, linux-kernel, devicetree, jishnu.prakash,
	kamal.wadhwa

On 5/20/26 11:07 AM, Rakesh Kota wrote:
> The PM4125 PMIC uses a different register layout for USB VBUS control
> compared to PM8150B. On PM4125, CMD_OTG is at offset 0x50, OTG_CFG is
> at 0x56, and offset 0x52 is a 2-bit VBOOST voltage selector rather than
> a current-limit selector.
> 
> Introduce per-compatible regulator descriptor data to accommodate these
> differences. This keeps the existing PM8150B current-limit logic intact
> while adding a dedicated voltage-selector path for PM4125.
> 
> Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> ---
>  drivers/regulator/qcom_usb_vbus-regulator.c | 102 ++++++++++++++++++++++++----
>  1 file changed, 88 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
> index cd94ed67621fee9f6d7a0327054db0ebab6cc7ee..3d425452a0b35b35c4b454f84eb28e87cc8ba4f8 100644
> --- a/drivers/regulator/qcom_usb_vbus-regulator.c
> +++ b/drivers/regulator/qcom_usb_vbus-regulator.c
> @@ -20,10 +20,35 @@
>  #define OTG_CFG				0x53
>  #define OTG_EN_SRC_CFG			BIT(1)
>  
> +#define PM4125_CMD_OTG			0x50

This register is named differently

> +#define PM4125_VBOOST_CFG		0x52
> +#define PM4125_VBOOST_CFG_MASK		GENMASK(1, 0)
> +#define PM4125_OTG_CFG			0x56

And so is this one


> +#define PM4125_OTG_EN_SRC_CFG          BIT(0)
> +
> +struct qcom_usb_vbus_reg_data {
> +	u16 cmd_otg;
> +	u16 otg_cfg;
> +	u8  otg_en_src_cfg;
> +	u16 csel_reg;
> +	u8 csel_mask;
> +	const unsigned int *curr_table;
> +	unsigned int n_current_limits;
> +	u16 vsel_reg;
> +	u8 vsel_mask;
> +	const unsigned int *volt_table;
> +	unsigned int n_voltages;
> +	const struct regulator_ops *ops;
> +};

And because they're so different, keeping them in a single driver starts to
look a little odd

> +
>  static const unsigned int curr_table[] = {
>  	500000, 1000000, 1500000, 2000000, 2500000, 3000000,
>  };

And I think there's current-limiting on this PMIC too, except in a differnt
peripheral (@1300)

Konrad

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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
  2026-05-20  9:20   ` sashiko-bot
  2026-05-20  9:44   ` Konrad Dybcio
@ 2026-05-20  9:58   ` Dmitry Baryshkov
  2026-05-20 11:36     ` Rakesh Kota
  2 siblings, 1 reply; 11+ messages in thread
From: Dmitry Baryshkov @ 2026-05-20  9:58 UTC (permalink / raw)
  To: Rakesh Kota
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng, linux-arm-msm, linux-kernel,
	devicetree, jishnu.prakash, kamal.wadhwa

On Wed, May 20, 2026 at 02:37:11PM +0530, Rakesh Kota wrote:
> The pm4125 PMIC uses a different USB VBUS register layout than pm8150b.
> It uses a 2-bit VBOOST voltage selector supporting output voltages of
> 4.25 V, 4.5 V, 4.75 V and 5.0 V, instead of a current-limit selector.

Is it only PM4125? What about other PMICs which have the VBUS regulator
(e.g. PMI632)?

> 
> Move qcom,pm4125-vbus-reg from the pm8150b fallback items list into the
> standalone enum since the driver handles it with its own match-data and
> register layout.
> 
> Make regulator-min/max-microamp conditional so they are only required
> for current-limit variants (pm8150b, pm6150, pm7250b, pmi632). Add an
> if/then condition for qcom,pm4125-vbus-reg requiring regulator-min/
> max-microvolt instead, and update the pm4125 example accordingly.
> 
> Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> ---
>  .../regulator/qcom,usb-vbus-regulator.yaml         | 50 +++++++++++++++++++---
>  1 file changed, 45 insertions(+), 5 deletions(-)
> 

-- 
With best wishes
Dmitry

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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:20   ` sashiko-bot
@ 2026-05-20 10:18     ` Rakesh Kota
  0 siblings, 0 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20 10:18 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: robh, conor+dt, devicetree, jishnu.prakash, kamal.wadhwa

On Wed, May 20, 2026 at 09:20:17AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] Removing the fallback compatible string for `qcom,pm4125-vbus-reg` breaks backwards compatibility and schema validation for existing device trees.
> - [Low] Unit-address mismatch in the newly added pm4125 device tree example causes a dtc compiler warning/error.
> --
> 
> commit d88778938ce0889e7c6904b04eca901125a815cb
> Author: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> 
> dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
> 
> This commit moves qcom,pm4125-vbus-reg from the fallback items list into
> a standalone enum since it has a different register layout. It also updates
> the required properties for this variant to use microvolt instead of
> microamp, and adds a new example.
> 
> > diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> > --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> > +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> 
> [ ... ]
> 
> >  properties:
> >    compatible:
> >      oneOf:
> >        - enum:
> >            - qcom,pm8150b-vbus-reg
> > +          - qcom,pm4125-vbus-reg
> >        - items:
> >            - enum:
> > -              - qcom,pm4125-vbus-reg
> >                - qcom,pm6150-vbus-reg
> >                - qcom,pm7250b-vbus-reg
> 
> [Severity: High]
> Does removing this fallback compatible string break backwards compatibility
> for existing device trees?
> 
> Previously, the binding allowed the compatible string list to be
> qcom,pm4125-vbus-reg, qcom,pm8150b-vbus-reg, which is currently used in
> arch/arm64/boot/dts/qcom/pm4125.dtsi.
> 
> Additionally, the required properties for qcom,pm4125-vbus-reg are changed
> from regulator-min/max-microamp to regulator-min/max-microvolt. Since
> existing device trees like qrb2210-rb1.dts rely on the microamp properties,
> will this cause make dtbs_check to fail for existing in-tree device trees?
>
You are correct, I will include the DT changes in the same patch
series to keep things atomic and ensure dtbs_check compliance.

> [ ... ]
> 
> > +  - |
> > +     pmic {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        usb-vbus-regulator@5000 {
> > +            compatible = "qcom,pm4125-vbus-reg";
> > +            reg = <0x1100>;
> 
> [Severity: Low]
> Will this unit-address mismatch cause a compiler warning during validation?
> 
> The node name specifies an address of 5000, but the reg property specifies
> 0x1100. This usually triggers a unit_address_vs_reg warning from the dtc
> compiler during make dt_binding_check.
> 
> Should the node name be updated to match the reg property address?
>
Sure, will fix the node name to usb-vbus-regulator@1100 in the next
version.

regrads
Rakesh 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260520-add_pm4125-vbus-reg-v1-0-f6d15d7dbbe8@oss.qualcomm.com?part=1

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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:44   ` Konrad Dybcio
@ 2026-05-20 10:21     ` Rakesh Kota
  0 siblings, 0 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20 10:21 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng, linux-arm-msm, linux-kernel,
	devicetree, jishnu.prakash, kamal.wadhwa

On Wed, May 20, 2026 at 11:44:42AM +0200, Konrad Dybcio wrote:
> On 5/20/26 11:07 AM, Rakesh Kota wrote:
> > The pm4125 PMIC uses a different USB VBUS register layout than pm8150b.
> > It uses a 2-bit VBOOST voltage selector supporting output voltages of
> > 4.25 V, 4.5 V, 4.75 V and 5.0 V, instead of a current-limit selector.
> > 
> > Move qcom,pm4125-vbus-reg from the pm8150b fallback items list into the
> > standalone enum since the driver handles it with its own match-data and
> > register layout.
> > 
> > Make regulator-min/max-microamp conditional so they are only required
> > for current-limit variants (pm8150b, pm6150, pm7250b, pmi632). Add an
> > if/then condition for qcom,pm4125-vbus-reg requiring regulator-min/
> > max-microvolt instead, and update the pm4125 example accordingly.
> > 
> > Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> > ---
> >  .../regulator/qcom,usb-vbus-regulator.yaml         | 50 +++++++++++++++++++---
> >  1 file changed, 45 insertions(+), 5 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> > index fcefc722ee2a495837fedba026669de97350c566..7c74573848bcdafbf6260f69cfcd7a9b58bc9f2d 100644
> > --- a/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> > +++ b/Documentation/devicetree/bindings/regulator/qcom,usb-vbus-regulator.yaml
> > @@ -14,17 +14,21 @@ description: |
> >    regulator will be enabled in situations where the device is required to
> >    provide power to the connected peripheral.
> >  
> > -allOf:
> > -  - $ref: regulator.yaml#
> > +  The pm8150b variant uses an OTG current-limit selector, supporting limits
> > +  of 500 mA, 1000 mA, 1500 mA, 2000 mA, 2500 mA and 3000 mA.
> > +
> > +  The pm4125 variant uses a different register layout with a 2-bit VBOOST
> > +  voltage selector supporting output voltages of 4.25 V, 4.5 V, 4.75 V
> > +  and 5.0 V.
> >  
> >  properties:
> >    compatible:
> >      oneOf:
> >        - enum:
> >            - qcom,pm8150b-vbus-reg
> > +          - qcom,pm4125-vbus-reg
> >        - items:
> >            - enum:
> > -              - qcom,pm4125-vbus-reg
> >                - qcom,pm6150-vbus-reg
> >                - qcom,pm7250b-vbus-reg
> >                - qcom,pmi632-vbus-reg
> 
> This change needs to be paired with an update to the existing DTS users,
> or validation will fail
> 
sure, I will include the DT changes in the same patch
series to keep things atomic and ensure dtbs_check compliance.

> [...]
> 
> > +     pmic {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        usb-vbus-regulator@5000 {
> > +            compatible = "qcom,pm4125-vbus-reg";
> > +            reg = <0x1100>;
> 
> This should fail make dt_binding_check, as the reg value doesn't match the
> unit address (after the @ sign)
>
Ok, I will fix the node name to usb-vbus-regulator@1100 in the next version.

regards
Rakesh
> Konrad

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

* Re: [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
  2026-05-20  9:51   ` Konrad Dybcio
@ 2026-05-20 11:21     ` Rakesh Kota
  0 siblings, 0 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20 11:21 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng, linux-arm-msm, linux-kernel,
	devicetree, jishnu.prakash, kamal.wadhwa

On Wed, May 20, 2026 at 11:51:49AM +0200, Konrad Dybcio wrote:
> On 5/20/26 11:07 AM, Rakesh Kota wrote:
> > The PM4125 PMIC uses a different register layout for USB VBUS control
> > compared to PM8150B. On PM4125, CMD_OTG is at offset 0x50, OTG_CFG is
> > at 0x56, and offset 0x52 is a 2-bit VBOOST voltage selector rather than
> > a current-limit selector.
> > 
> > Introduce per-compatible regulator descriptor data to accommodate these
> > differences. This keeps the existing PM8150B current-limit logic intact
> > while adding a dedicated voltage-selector path for PM4125.
> > 
> > Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> > ---
> >  drivers/regulator/qcom_usb_vbus-regulator.c | 102 ++++++++++++++++++++++++----
> >  1 file changed, 88 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
> > index cd94ed67621fee9f6d7a0327054db0ebab6cc7ee..3d425452a0b35b35c4b454f84eb28e87cc8ba4f8 100644
> > --- a/drivers/regulator/qcom_usb_vbus-regulator.c
> > +++ b/drivers/regulator/qcom_usb_vbus-regulator.c
> > @@ -20,10 +20,35 @@
> >  #define OTG_CFG				0x53
> >  #define OTG_EN_SRC_CFG			BIT(1)
> >  
> > +#define PM4125_CMD_OTG			0x50
> 
> This register is named differently
Ok, i will update name to PM4125_VBOOST_EN in next version.
> 
> > +#define PM4125_VBOOST_CFG		0x52
> > +#define PM4125_VBOOST_CFG_MASK		GENMASK(1, 0)
> > +#define PM4125_OTG_CFG			0x56
> 
> And so is this one
update name to PM4125_VBOOST_CFG in next version
> 
> 
> > +#define PM4125_OTG_EN_SRC_CFG          BIT(0)
> > +
> > +struct qcom_usb_vbus_reg_data {
> > +	u16 cmd_otg;
> > +	u16 otg_cfg;
> > +	u8  otg_en_src_cfg;
> > +	u16 csel_reg;
> > +	u8 csel_mask;
> > +	const unsigned int *curr_table;
> > +	unsigned int n_current_limits;
> > +	u16 vsel_reg;
> > +	u8 vsel_mask;
> > +	const unsigned int *volt_table;
> > +	unsigned int n_voltages;
> > +	const struct regulator_ops *ops;
> > +};
> 
> And because they're so different, keeping them in a single driver starts to
> look a little odd

You are right, they differ in control mechanism — one uses current
control and the other uses voltage control for VBUS in host mode.
Since the functional purpose is the same (VBUS regulation in host
mode), I felt a single driver made sense to avoid code duplication.

But open to suggestions — should I split this into separate drivers
or is there a better way to handle this cleanly?
> 
> > +
> >  static const unsigned int curr_table[] = {
> >  	500000, 1000000, 1500000, 2000000, 2500000, 3000000,
> >  };
> 
> And I think there's current-limiting on this PMIC too, except in a differnt
> peripheral (@1300)
> 
The @1300 peripheral is for ICL (Input Current Limit) in device mode
charging — not for host mode VBUS regulation.

Could you share the register you're referring to for further clarity?

regards
Rakesh
> Konrad

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

* Re: [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg
  2026-05-20  9:58   ` Dmitry Baryshkov
@ 2026-05-20 11:36     ` Rakesh Kota
  0 siblings, 0 replies; 11+ messages in thread
From: Rakesh Kota @ 2026-05-20 11:36 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Wesley Cheng, linux-arm-msm, linux-kernel,
	devicetree, jishnu.prakash, kamal.wadhwa

On Wed, May 20, 2026 at 12:58:35PM +0300, Dmitry Baryshkov wrote:
> On Wed, May 20, 2026 at 02:37:11PM +0530, Rakesh Kota wrote:
> > The pm4125 PMIC uses a different USB VBUS register layout than pm8150b.
> > It uses a 2-bit VBOOST voltage selector supporting output voltages of
> > 4.25 V, 4.5 V, 4.75 V and 5.0 V, instead of a current-limit selector.
> 
> Is it only PM4125? What about other PMICs which have the VBUS regulator
> (e.g. PMI632)?
>
Yes, this change is specific to PM4125. I have verified that PM6150,
PM7250B, and PMI632 all use the same register offsets (0x40, 0x52
and 0x53) as PM8150B, so no changes are required for those PMICs.

regards
Rakesh
> > 
> > Move qcom,pm4125-vbus-reg from the pm8150b fallback items list into the
> > standalone enum since the driver handles it with its own match-data and
> > register layout.
> > 
> > Make regulator-min/max-microamp conditional so they are only required
> > for current-limit variants (pm8150b, pm6150, pm7250b, pmi632). Add an
> > if/then condition for qcom,pm4125-vbus-reg requiring regulator-min/
> > max-microvolt instead, and update the pm4125 example accordingly.
> > 
> > Signed-off-by: Rakesh Kota <rakesh.kota@oss.qualcomm.com>
> > ---
> >  .../regulator/qcom,usb-vbus-regulator.yaml         | 50 +++++++++++++++++++---
> >  1 file changed, 45 insertions(+), 5 deletions(-)
> > 
> 
> -- 
> With best wishes
> Dmitry

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

end of thread, other threads:[~2026-05-20 11:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  9:07 [PATCH 0/2] regulator: qcom_usb_vbus: add pm4125 VBUS regulator support Rakesh Kota
2026-05-20  9:07 ` [PATCH 1/2] dt-bindings: regulator: qcom,usb-vbus-regulator: add qcom,pm4125-vbus-reg Rakesh Kota
2026-05-20  9:20   ` sashiko-bot
2026-05-20 10:18     ` Rakesh Kota
2026-05-20  9:44   ` Konrad Dybcio
2026-05-20 10:21     ` Rakesh Kota
2026-05-20  9:58   ` Dmitry Baryshkov
2026-05-20 11:36     ` Rakesh Kota
2026-05-20  9:07 ` [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg Rakesh Kota
2026-05-20  9:51   ` Konrad Dybcio
2026-05-20 11:21     ` Rakesh Kota

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