Re: [PATCH 2/2] regulator: qcom_usb_vbus: add support for qcom,pm4125-vbus-reg
From: Konrad Dybcio
Date: Wed May 20 2026 - 05:53:09 EST
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@xxxxxxxxxxxxxxxx>
> ---
> 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