Re: [PATCH v2 3/7] regulator: qcom-pm8008: Add PM8010 mode support

From: Guru Das Srinagesh

Date: Mon Oct 19 2026 - 03:32:18 EST


On Wed, Oct 14, 2026 at 04:02:00PM +0530, Jishnu Prakash wrote:
> From: Dhruvin Rajpura <drajpura@xxxxxxxxxxxxxxxx>
>
> Implement set_mode/get_mode support for PM8010 LDOs using the mode
> control and status registers to allow clients to vote for LDO modes.
> Mode voting is not supported in the PM8008 LDOs.
>
> Signed-off-by: Dhruvin Rajpura <drajpura@xxxxxxxxxxxxxxxx>
> Tested-by: Oleg Keri <okerixx@xxxxxxxxx> # Lenovo Yoga Slim 7x Gen 11 (Glymur)
> Signed-off-by: Jishnu Prakash <jishnu.prakash@xxxxxxxxxxxxxxxx>
> ---
> drivers/regulator/qcom-pm8008-regulator.c | 75 ++++++++++++++++++++++++++++++-
> 1 file changed, 74 insertions(+), 1 deletion(-)

...

> static int pm8008_regulator_probe(struct platform_device *pdev)
> {
> const struct pm8008_match_data *match_data;
> @@ -155,6 +222,7 @@ static int pm8008_regulator_probe(struct platform_device *pdev)
> struct regulator_dev *rdev;
> struct regmap *regmap;
> unsigned int val;
> + bool is_pm8010;
> int ret, i;
>
> id = platform_get_device_id(pdev);
> @@ -169,6 +237,9 @@ static int pm8008_regulator_probe(struct platform_device *pdev)
> if (!regmap)
> return -EINVAL;
>
> + is_pm8010 = of_device_is_compatible(dev->parent->of_node,
> + "qcom,pm8010-i2c");

Patch 2 adds a new `driver_data` match data struct for PM8010. Could this is_pm8010
variable be avoided by stashing the regulator ops in the match data for each
variant and using that instead?

> +
> for (i = 0; i < match_data->num_regulators; i++) {
> data = &match_data->regulator_data[i];
>
> @@ -185,7 +256,9 @@ static int pm8008_regulator_probe(struct platform_device *pdev)
> desc->supply_name = data->supply_name;
> desc->of_match = data->name;
> desc->regulators_node = of_match_ptr("regulators");
> - desc->ops = &pm8008_regulator_ops;
> + desc->ops = is_pm8010 ? &pm8010_regulator_ops : &pm8008_regulator_ops;
> + if (is_pm8010)
> + desc->of_map_mode = pm8010_regulator_of_map_mode;
> desc->type = REGULATOR_VOLTAGE;
> desc->owner = THIS_MODULE;