regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg

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@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260706-add_pm4125-vbus-reg-v3-3-999d78a87b81@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Rakesh Kota 2026-07-06 18:01:07 +05:30 committed by Mark Brown
parent 56cb4a0e8e
commit d37664f99e
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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);