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-combo: Use regulator_bulk_data with init_load_uA for regulator setup

Replace the custom qmp_regulator_data structure with the standard
regulator_bulk_data and use the init_load_uA field to set regulator
load during initialization.

This change simplifies the regulator setup by removing manual
allocation and load configuration logic, and leverages
devm_regulator_bulk_get_const() to automatically apply load settings
before enabling regulators.

Signed-off-by: Faisal Hassan <faisal.hassan@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Link: https://patch.msgid.link/20250922135901.2067-1-faisal.hassan@oss.qualcomm.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Faisal Hassan and committed by
Vinod Koul
81d75558 0d616c28

+6 -43
+6 -43
drivers/phy/qualcomm/phy-qcom-qmp-combo.c
··· 1643 1643 }; 1644 1644 1645 1645 /* list of regulators */ 1646 - struct qmp_regulator_data { 1647 - const char *name; 1648 - unsigned int enable_load; 1649 - }; 1650 - 1651 - static struct qmp_regulator_data qmp_phy_vreg_l[] = { 1652 - { .name = "vdda-phy", .enable_load = 21800 }, 1653 - { .name = "vdda-pll", .enable_load = 36000 }, 1646 + static struct regulator_bulk_data qmp_phy_vreg_l[] = { 1647 + { .supply = "vdda-phy", .init_load_uA = 21800, }, 1648 + { .supply = "vdda-pll", .init_load_uA = 36000, }, 1654 1649 }; 1655 1650 1656 1651 static const u8 qmp_dp_v3_pre_emphasis_hbr3_hbr2[4][4] = { ··· 1803 1808 const char * const *reset_list; 1804 1809 int num_resets; 1805 1810 /* regulators to be requested */ 1806 - const struct qmp_regulator_data *vreg_list; 1811 + const struct regulator_bulk_data *vreg_list; 1807 1812 int num_vregs; 1808 1813 1809 1814 /* array of registers with different offsets */ ··· 3434 3439 qmp_combo_runtime_resume, NULL) 3435 3440 }; 3436 3441 3437 - static int qmp_combo_vreg_init(struct qmp_combo *qmp) 3438 - { 3439 - const struct qmp_phy_cfg *cfg = qmp->cfg; 3440 - struct device *dev = qmp->dev; 3441 - int num = cfg->num_vregs; 3442 - int ret, i; 3443 - 3444 - qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL); 3445 - if (!qmp->vregs) 3446 - return -ENOMEM; 3447 - 3448 - for (i = 0; i < num; i++) 3449 - qmp->vregs[i].supply = cfg->vreg_list[i].name; 3450 - 3451 - ret = devm_regulator_bulk_get(dev, num, qmp->vregs); 3452 - if (ret) { 3453 - dev_err(dev, "failed at devm_regulator_bulk_get\n"); 3454 - return ret; 3455 - } 3456 - 3457 - for (i = 0; i < num; i++) { 3458 - ret = regulator_set_load(qmp->vregs[i].consumer, 3459 - cfg->vreg_list[i].enable_load); 3460 - if (ret) { 3461 - dev_err(dev, "failed to set load at %s\n", 3462 - qmp->vregs[i].supply); 3463 - return ret; 3464 - } 3465 - } 3466 - 3467 - return 0; 3468 - } 3469 - 3470 3442 static int qmp_combo_reset_init(struct qmp_combo *qmp) 3471 3443 { 3472 3444 const struct qmp_phy_cfg *cfg = qmp->cfg; ··· 4106 4144 if (ret) 4107 4145 return ret; 4108 4146 4109 - ret = qmp_combo_vreg_init(qmp); 4147 + ret = devm_regulator_bulk_get_const(dev, qmp->cfg->num_vregs, 4148 + qmp->cfg->vreg_list, &qmp->vregs); 4110 4149 if (ret) 4111 4150 return ret; 4112 4151