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-usb: Set regulator load before enabling

Set the regulator load before enabling the regulators to ensure stable
operation and proper power management on platforms where regulators are
shared between the QMP USB PHY and other IP blocks.

Introduce a regulator data structure with explicit enable load values and
use the regulator framework's `init_load_uA` field along with
`devm_regulator_bulk_get_const()` to ensure that `regulator_set_load()` is
applied automatically before the first enable, providing consistent power
management behavior across platforms.

Signed-off-by: Faisal Hassan <faisal.hassan@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20250905101243.14815-1-faisal.hassan@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Faisal Hassan and committed by
Vinod Koul
346ba846 e5b4d593

+6 -21
+6 -21
drivers/phy/qualcomm/phy-qcom-qmp-usb.c
··· 1266 1266 int pcs_usb_tbl_num; 1267 1267 1268 1268 /* regulators to be requested */ 1269 - const char * const *vreg_list; 1269 + const struct regulator_bulk_data *vreg_list; 1270 1270 int num_vregs; 1271 1271 1272 1272 /* array of registers with different offsets */ ··· 1344 1344 }; 1345 1345 1346 1346 /* list of regulators */ 1347 - static const char * const qmp_phy_vreg_l[] = { 1348 - "vdda-phy", "vdda-pll", 1347 + static const struct regulator_bulk_data qmp_phy_vreg_l[] = { 1348 + { .supply = "vdda-phy", .init_load_uA = 21800, }, 1349 + { .supply = "vdda-pll", .init_load_uA = 36000, }, 1349 1350 }; 1350 1351 1351 1352 static const struct qmp_usb_offsets qmp_usb_offsets_v3 = { ··· 1987 1986 qmp_usb_runtime_resume, NULL) 1988 1987 }; 1989 1988 1990 - static int qmp_usb_vreg_init(struct qmp_usb *qmp) 1991 - { 1992 - const struct qmp_phy_cfg *cfg = qmp->cfg; 1993 - struct device *dev = qmp->dev; 1994 - int num = cfg->num_vregs; 1995 - int i; 1996 - 1997 - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 1998 - if (!qmp->vregs) 1999 - return -ENOMEM; 2000 - 2001 - for (i = 0; i < num; i++) 2002 - qmp->vregs[i].supply = cfg->vreg_list[i]; 2003 - 2004 - return devm_regulator_bulk_get(dev, num, qmp->vregs); 2005 - } 2006 - 2007 1989 static int qmp_usb_reset_init(struct qmp_usb *qmp, 2008 1990 const char *const *reset_list, 2009 1991 int num_resets) ··· 2235 2251 if (!qmp->cfg) 2236 2252 return -EINVAL; 2237 2253 2238 - ret = qmp_usb_vreg_init(qmp); 2254 + ret = devm_regulator_bulk_get_const(dev, qmp->cfg->num_vregs, 2255 + qmp->cfg->vreg_list, &qmp->vregs); 2239 2256 if (ret) 2240 2257 return ret; 2241 2258