[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f368b6da-1aa3-4b8e-9106-3c29d4ab5c5e@oss.qualcomm.com>
Date: Wed, 6 Aug 2025 17:58:30 +0200
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Mark Brown <broonie@...nel.org>, Nitin Rawat <quic_nitirawa@...cinc.com>,
vkoul@...nel.org, kishon@...nel.org, mani@...nel.org,
conor+dt@...nel.org, bvanassche@....org, andersson@...nel.org,
neil.armstrong@...aro.org, dmitry.baryshkov@....qualcomm.com,
konradybcio@...nel.org, krzk+dt@...nel.org
Cc: linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH V1 4/4] phy: qcom-qmp-ufs: read max-microamp values from
device tree
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@...cinc.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
Powered by blists - more mailing lists