[PATCH V1 4/4] phy: qcom-qmp-ufs: read max-microamp values from device tree
Konrad Dybcio
konrad.dybcio at oss.qualcomm.com
Wed Aug 6 08:58:30 PDT 2025
On 8/6/25 5:43 PM, Nitin Rawat wrote:
> Add support in QMP PHY driver to read optional vdda-phy-max-microamp
> and vdda-pll-max-microamp properties from the device tree.
>
> These properties define the expected maximum current (in microamps) for
> each supply. The driver uses this information to configure regulators
> more accurately and ensure they operate in the correct mode based on
> client load requirements.
>
> If the property is not present, the driver defaults load to
> `QMP_VREG_UNUSED`.
>
> Signed-off-by: Nitin Rawat <quic_nitirawa at quicinc.com>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> index 9c69c77d10c8..6e116f7370c3 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
> @@ -39,6 +39,8 @@
> #define PHY_INIT_COMPLETE_TIMEOUT 10000
>
> #define NUM_OVERLAY 2
> +#define QMP_VREG_UNUSED -1
> +#define MAX_PROP_NAME 32
>
> /* set of registers with offsets different per-PHY */
> enum qphy_reg_layout {
> @@ -1894,15 +1896,29 @@ static int qmp_ufs_vreg_init(struct qmp_ufs *qmp)
> {
> const struct qmp_phy_cfg *cfg = qmp->cfg;
> struct device *dev = qmp->dev;
> + struct device_node *np = dev->of_node;
> + char prop_name[MAX_PROP_NAME];
> int num = cfg->num_vregs;
> - int i;
> + const char *supply;
> + int i, ret;
>
> qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
> if (!qmp->vregs)
> return -ENOMEM;
>
> - for (i = 0; i < num; i++)
> - qmp->vregs[i].supply = cfg->vreg_list[i];
> + for (i = 0; i < num; i++) {
> + supply = cfg->vreg_list[i];
> + qmp->vregs[i].supply = supply;
> +
> + /* Defaults to unused */
> + qmp->vregs[i].init_load_uA = QMP_VREG_UNUSED;
> +
> + snprintf(prop_name, sizeof(prop_name), "%s-max-microamp", supply);
> + ret = of_property_read_u32(np, prop_name, &qmp->vregs[i].init_load_uA);
> + if (ret)
> + dev_dbg(qmp->dev, "No max microamp for %s, using default %d\n",
> + supply, QMP_VREG_UNUSED);
+Mark
do you think having this in regulator core would make sense?
Konrad
More information about the linux-phy
mailing list