Re: [PATCH v4 3/4] regulator: qcom-rpmh: readback voltage/bypass/mode/status set during bootup
From: Mark Brown
Date: Tue Apr 21 2026 - 17:17:08 EST
On Mon, Apr 20, 2026 at 09:13:40PM +0530, Kamal Wadhwa wrote:
> Currently, during regulator registration, regulator framework sends an
> unnecessary `min-microvolts` request for the rpmh-regulator device. This
> happens because in current design, we do not have a way to readback the
> voltage settings that was set during the bootloader stage.
> +static int _rpmh_regulator_vrm_get_voltage(struct regulator_dev *rdev, int *uV)
> +{
> + struct rpmh_vreg *vreg = rdev_get_drvdata(rdev);
> + struct tcs_cmd cmd = {
> + .addr = vreg->addr + RPMH_REGULATOR_REG_VRM_VOLTAGE,
> + };
> + int min_uV = rdev->constraints->min_uV;
> + int max_uV = rdev->constraints->max_uV;
> + int ret, _uV = 0;
> +
> + ret = rpmh_regulator_read_data(vreg, &cmd);
> + if (!ret)
> + _uV = (cmd.data & RPMH_REGULATOR_VOLTAGE_MASK) * 1000;
> + else
> + dev_err(vreg->dev, "failed to read VOLTAGE ret = %d\n", ret);
> +
> + if (!_uV || (_uV >= min_uV && _uV <= max_uV))
> + *uV = _uV;
> + else
> + dev_err(vreg->dev, "read voltage %d is out-of-range[%d:%d]\n",
> + _uV, min_uV, max_uV);
> +
> + return ret;
> +}
Why are we constraining the reported voltage? The hardware may have a
value that's outside of our constraints, we should report that if it's
the case.
Attachment:
signature.asc
Description: PGP signature