Skip to content

Commit 81d7555

Browse files
Faisal Hassanvinodkoul
authored andcommitted
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>
1 parent 0d616c2 commit 81d7555

1 file changed

Lines changed: 6 additions & 43 deletions

File tree

drivers/phy/qualcomm/phy-qcom-qmp-combo.c

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,14 +1643,9 @@ static const struct qmp_phy_init_tbl x1e80100_usb43dp_pcs_usb_tbl[] = {
16431643
};
16441644

16451645
/* 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, },
16541649
};
16551650

16561651
static const u8 qmp_dp_v3_pre_emphasis_hbr3_hbr2[4][4] = {
@@ -1808,7 +1803,7 @@ struct qmp_phy_cfg {
18081803
const char * const *reset_list;
18091804
int num_resets;
18101805
/* regulators to be requested */
1811-
const struct qmp_regulator_data *vreg_list;
1806+
const struct regulator_bulk_data *vreg_list;
18121807
int num_vregs;
18131808

18141809
/* array of registers with different offsets */
@@ -3439,39 +3434,6 @@ static const struct dev_pm_ops qmp_combo_pm_ops = {
34393434
qmp_combo_runtime_resume, NULL)
34403435
};
34413436

3442-
static int qmp_combo_vreg_init(struct qmp_combo *qmp)
3443-
{
3444-
const struct qmp_phy_cfg *cfg = qmp->cfg;
3445-
struct device *dev = qmp->dev;
3446-
int num = cfg->num_vregs;
3447-
int ret, i;
3448-
3449-
qmp->vregs = devm_kcalloc(dev, num, sizeof(*qmp->vregs), GFP_KERNEL);
3450-
if (!qmp->vregs)
3451-
return -ENOMEM;
3452-
3453-
for (i = 0; i < num; i++)
3454-
qmp->vregs[i].supply = cfg->vreg_list[i].name;
3455-
3456-
ret = devm_regulator_bulk_get(dev, num, qmp->vregs);
3457-
if (ret) {
3458-
dev_err(dev, "failed at devm_regulator_bulk_get\n");
3459-
return ret;
3460-
}
3461-
3462-
for (i = 0; i < num; i++) {
3463-
ret = regulator_set_load(qmp->vregs[i].consumer,
3464-
cfg->vreg_list[i].enable_load);
3465-
if (ret) {
3466-
dev_err(dev, "failed to set load at %s\n",
3467-
qmp->vregs[i].supply);
3468-
return ret;
3469-
}
3470-
}
3471-
3472-
return 0;
3473-
}
3474-
34753437
static int qmp_combo_reset_init(struct qmp_combo *qmp)
34763438
{
34773439
const struct qmp_phy_cfg *cfg = qmp->cfg;
@@ -4144,7 +4106,8 @@ static int qmp_combo_probe(struct platform_device *pdev)
41444106
if (ret)
41454107
return ret;
41464108

4147-
ret = qmp_combo_vreg_init(qmp);
4109+
ret = devm_regulator_bulk_get_const(dev, qmp->cfg->num_vregs,
4110+
qmp->cfg->vreg_list, &qmp->vregs);
41484111
if (ret)
41494112
return ret;
41504113

0 commit comments

Comments
 (0)