[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250806154340.20122-5-quic_nitirawa@quicinc.com>
Date: Wed, 6 Aug 2025 21:13:40 +0530
From: Nitin Rawat <quic_nitirawa@...cinc.com>
To: 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,
Nitin Rawat <quic_nitirawa@...cinc.com>
Subject: [PATCH V1 4/4] phy: qcom-qmp-ufs: read max-microamp values from device tree
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);
+ }
return devm_regulator_bulk_get(dev, num, qmp->vregs);
}
--
2.48.1
Powered by blists - more mailing lists