[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250823-pm8008-negitive-selector-v1-1-52b026a4b5e8@quicinc.com>
Date: Sat, 23 Aug 2025 01:56:39 +0530
From: Kamal Wadhwa <kamal.wadhwa@....qualcomm.com>
To: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>
Cc: linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
johan+linaro@...nel.org, quic_skakitap@...cinc.com,
Kamal Wadhwa <kamal.wadhwa@....qualcomm.com>
Subject: [PATCH] regulator: pm8008: fix probe failure due to negative
voltage selector
In the current design, the `pm8008_regulator_get_voltage_sel()` callback
can return a negative value if the raw voltage value is read as 0 uV from
the PMIC HW register. This can cause the probe to fail when the
`machine_constraints_voltage()` check is called during the regulator
registration flow.
Fix this by using the helper `regulator_map_voltage_linear_range()` to
convert the raw value to a voltage selector inside the mentioned get
voltage selector function. This ensures that the value returned is always
within the defined range.
Signed-off-by: Kamal Wadhwa <kamal.wadhwa@....qualcomm.com>
---
drivers/regulator/qcom-pm8008-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/qcom-pm8008-regulator.c b/drivers/regulator/qcom-pm8008-regulator.c
index da017c1969d0cc2c6347b68c37518ea8a7ab44a3..90c78ee1c37bf9bf69f43e0bb7798fed94590e95 100644
--- a/drivers/regulator/qcom-pm8008-regulator.c
+++ b/drivers/regulator/qcom-pm8008-regulator.c
@@ -96,7 +96,7 @@ static int pm8008_regulator_get_voltage_sel(struct regulator_dev *rdev)
uV = le16_to_cpu(val) * 1000;
- return (uV - preg->desc.min_uV) / preg->desc.uV_step;
+ return regulator_map_voltage_linear_range(rdev, uV, INT_MAX);
}
static const struct regulator_ops pm8008_regulator_ops = {
---
base-commit: b9ddaa95fd283bce7041550ddbbe7e764c477110
change-id: 20250823-pm8008-negitive-selector-71646975befe
Best regards,
--
Kamal Wadhwa <quic_kamalw@...cinc.com>
Powered by blists - more mailing lists