[PATCH v3 3/4] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg

From: Rakesh Kota

Date: Mon Jul 06 2026 - 09:35:03 EST


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.

Add pm4125_data using the abstraction introduced for PM8150B, along with
dedicated voltage-selector ops and the pm4125_vboost_table covering the
four supported boost voltages: 4.25 V, 4.5 V, 4.75 V, and 5.0 V.

Signed-off-by: Rakesh Kota <rakesh.kota@xxxxxxxxxxxxxxxx>
---
drivers/regulator/qcom_usb_vbus-regulator.c | 31 +++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)

diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
index 0201a3983981eec1f475d4b8cdccc9148b5e3b2e..9aea68876284e55427d03f667c9428af0ebb53d2 100644
--- a/drivers/regulator/qcom_usb_vbus-regulator.c
+++ b/drivers/regulator/qcom_usb_vbus-regulator.c
@@ -20,6 +20,12 @@
#define OTG_CFG 0x53
#define OTG_EN_SRC_CFG BIT(1)

+#define PM4125_VBOOST_EN 0x50
+#define PM4125_VBOOST_SEL 0x52
+#define PM4125_VBOOST_CFG_MASK GENMASK(1, 0)
+#define PM4125_VBOOST_CFG 0x56
+#define PM4125_VBOOST_EN_SRC_CFG BIT(0)
+
struct qcom_usb_vbus_reg_data {
u16 cmd_otg;
u16 otg_cfg;
@@ -39,6 +45,10 @@ 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,
@@ -58,6 +68,26 @@ static const struct qcom_usb_vbus_reg_data pm8150b_data = {
.ops = &qcom_usb_vbus_reg_ops,
};

+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 pm4125_data = {
+ .cmd_otg = PM4125_VBOOST_EN,
+ .otg_cfg = PM4125_VBOOST_CFG,
+ .otg_en_src_cfg = PM4125_VBOOST_EN_SRC_CFG,
+ .vsel_reg = PM4125_VBOOST_SEL,
+ .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;
@@ -135,6 +165,7 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)

static const struct of_device_id qcom_usb_vbus_regulator_match[] = {
{ .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