lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250818124110.8136-2-quic_nitirawa@quicinc.com>
Date: Mon, 18 Aug 2025 18:11:09 +0530
From: Nitin Rawat <quic_nitirawa@...cinc.com>
To: vkoul@...nel.org, kishon@...nel.org, mani@...nel.org,
        dmitry.baryshkov@....qualcomm.com, andersson@...nel.org,
        konradybcio@...nel.org
Cc: linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
        linux-kernel@...r.kernel.org, Nitin Rawat <quic_nitirawa@...cinc.com>
Subject: [PATCH V2 1/2] phy: qcom-qmp-ufs: Add regulator load voting for UFS QMP Phy

On some SoCs, regulators are shared between the QMP UFS PHY and other
IP blocks. Hence convey maximum load requirement for UFS PHY to the
regulator framework as supply's capabilities or mode(Low Power Mode
or High Power Mode) change depending on the maximum potential load
at any given time, which the regulator driver must be aware of.
This helps to ensure stable operation and proper power management,
set the regulator load before enabling the regulators.

This patch adds:

- vreg_load_uA field to qmp_phy_cfg structure for load value arrays.
- Enhanced qmp_ufs_vreg_init() to set init_load_uA when loads are
  specified.

Configurations without specific load requirements will continue
to work unchanged, as init_load_uA remains zero-initialized when
vreg_load_uA is not provided.

Signed-off-by: Nitin Rawat <quic_nitirawa@...cinc.com>
---
 drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
index 9c69c77d10c8..f7a4a8334026 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
@@ -1110,6 +1110,9 @@ struct qmp_phy_cfg {
 	const char * const *vreg_list;
 	int num_vregs;

+	/* regulator load values in same order as vreg_list */
+	const int *vreg_load_ua;
+
 	/* array of registers with different offsets */
 	const unsigned int *regs;

@@ -1901,8 +1904,11 @@ static int qmp_ufs_vreg_init(struct qmp_ufs *qmp)
 	if (!qmp->vregs)
 		return -ENOMEM;

-	for (i = 0; i < num; i++)
+	for (i = 0; i < num; i++) {
 		qmp->vregs[i].supply = cfg->vreg_list[i];
+		if (cfg->vreg_load_ua)
+			qmp->vregs[i].init_load_uA = cfg->vreg_load_ua[i];
+	}

 	return devm_regulator_bulk_get(dev, num, qmp->vregs);
 }
--
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ