[PATCH v3 03/12] regulator: qcom_usb_vbus: Add support for pmi8998
From: David Heidelberg via B4 Relay
Date: Sat Nov 21 2026 - 17:38:40 EST
From: David Heidelberg <david@xxxxxxx>
The PMI8998 uses different register layout, but due to the limited
functionality of the qcom_usb_vbus driver, the basic registers are the
same as the PM8150B, thus reuse these. Table of currents differentiate
in steps and maximum 2A current. For more advanced features it'll differ.
Signed-off-by: David Heidelberg <david@xxxxxxx>
---
drivers/regulator/qcom_usb_vbus-regulator.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/qcom_usb_vbus-regulator.c b/drivers/regulator/qcom_usb_vbus-regulator.c
index 88f5a6ba79e6e..61a1b45f36e84 100644
--- a/drivers/regulator/qcom_usb_vbus-regulator.c
+++ b/drivers/regulator/qcom_usb_vbus-regulator.c
@@ -36,17 +36,17 @@ struct qcom_usb_vbus_reg_data {
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[] = {
+static const unsigned int pm8150b_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 = {
@@ -58,18 +58,33 @@ static const struct regulator_ops qcom_usb_vbus_reg_ops = {
};
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),
+ .curr_table = pm8150b_curr_table,
+ .n_current_limits = ARRAY_SIZE(pm8150b_curr_table),
+ .ops = &qcom_usb_vbus_reg_ops,
+};
+
+static const unsigned int pmi8998_curr_table[] = {
+ 250000, 500000, 750000, 1000000, 1250000, 1500000, 1750000, 2000000,
+};
+
+static const struct qcom_usb_vbus_reg_data pmi8998_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 = pmi8998_curr_table,
+ .n_current_limits = ARRAY_SIZE(pmi8998_curr_table),
.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,
@@ -161,16 +176,17 @@ static int qcom_usb_vbus_regulator_probe(struct platform_device *pdev)
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", .data = &pm8150b_data },
{ .compatible = "qcom,pm4125-vbus-reg", .data = &pm4125_data },
+ { .compatible = "qcom,pmi8998-vbus-reg", .data = &pmi8998_data },
{ }
};
MODULE_DEVICE_TABLE(of, qcom_usb_vbus_regulator_match);
static struct platform_driver qcom_usb_vbus_regulator_driver = {
.driver = {
.name = "qcom-usb-vbus-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
--
2.55.0