Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: qcom-qmp-ufs: Add regulator load voting for UFS QMP PHY

On certain SoCs, power regulators are shared between the QMP UFS PHY
and other IP blocks. To ensure proper operation, the regulator
framework must be informed of the UFS PHY's load requirements.
This is essential because the regulator's operating mode—whether Low
Power or High Power—depends on the maximum expected load at any given
time, which the regulator driver needs to manage accordingly.

To support this, replace devm_regulator_bulk_get() with
devm_regulator_bulk_get_const() and inline the qmp_ufs_vreg_init()
function. additionally replace the array of regulator names with a
bulk regulator data structure, and utilize the init_load_uA field
provided by the regulator framework. This ensures that
regulator_set_load() is automatically invoked before the
first enable operation.

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Nitin Rawat <quic_nitirawa@quicinc.com>
Link: https://lore.kernel.org/r/20250830070353.2694-2-nitin.rawat@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Nitin Rawat and committed by
Vinod Koul
0c4916aa 38404274

+8 -21
+8 -21
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c
··· 1107 1107 const struct qmp_phy_cfg_tbls tbls_hs_overlay[NUM_OVERLAY]; 1108 1108 1109 1109 /* regulators to be requested */ 1110 - const char * const *vreg_list; 1110 + const struct regulator_bulk_data *vreg_list; 1111 1111 int num_vregs; 1112 1112 1113 1113 /* array of registers with different offsets */ ··· 1164 1164 readl(base + offset); 1165 1165 } 1166 1166 1167 - /* list of regulators */ 1168 - static const char * const qmp_phy_vreg_l[] = { 1169 - "vdda-phy", "vdda-pll", 1167 + /* Default regulator bulk data (no load used) */ 1168 + static const struct regulator_bulk_data qmp_phy_vreg_l[] = { 1169 + { .supply = "vdda-phy" }, 1170 + { .supply = "vdda-pll" }, 1170 1171 }; 1171 1172 1172 1173 static const struct qmp_ufs_offsets qmp_ufs_offsets = { ··· 1891 1890 .owner = THIS_MODULE, 1892 1891 }; 1893 1892 1894 - static int qmp_ufs_vreg_init(struct qmp_ufs *qmp) 1895 - { 1896 - const struct qmp_phy_cfg *cfg = qmp->cfg; 1897 - struct device *dev = qmp->dev; 1898 - int num = cfg->num_vregs; 1899 - int i; 1900 - 1901 - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 1902 - if (!qmp->vregs) 1903 - return -ENOMEM; 1904 - 1905 - for (i = 0; i < num; i++) 1906 - qmp->vregs[i].supply = cfg->vreg_list[i]; 1907 - 1908 - return devm_regulator_bulk_get(dev, num, qmp->vregs); 1909 - } 1910 1893 1911 1894 static int qmp_ufs_clk_init(struct qmp_ufs *qmp) 1912 1895 { ··· 2053 2068 if (ret) 2054 2069 return ret; 2055 2070 2056 - ret = qmp_ufs_vreg_init(qmp); 2071 + ret = devm_regulator_bulk_get_const(dev, qmp->cfg->num_vregs, 2072 + qmp->cfg->vreg_list, 2073 + &qmp->vregs); 2057 2074 if (ret) 2058 2075 return ret; 2059 2076