.reg_cfg = {
.num = 3,
.regs = {
- {"vdda", 100000, 100}, /* 1.2 V */
- {"avdd", 10000, 100}, /* 3.0 V */
- {"vddio", 100000, 100}, /* 1.8 V */
+ {"vdda", 100000}, /* 1.2 V */
+ {"avdd", 10000}, /* 3.0 V */
+ {"vddio", 100000}, /* 1.8 V */
},
},
.bus_clk_names = dsi_v2_bus_clk_names,
.reg_cfg = {
.num = 3,
.regs = {
- {"vdd", 150000, 100}, /* 3.0 V */
- {"vdda", 100000, 100}, /* 1.2 V */
- {"vddio", 100000, 100}, /* 1.8 V */
+ {"vdd", 150000}, /* 3.0 V */
+ {"vdda", 100000}, /* 1.2 V */
+ {"vddio", 100000}, /* 1.8 V */
},
},
.bus_clk_names = dsi_6g_bus_clk_names,
.reg_cfg = {
.num = 2,
.regs = {
- {"vdda", 100000, 100}, /* 1.2 V */
- {"vddio", 100000, 100}, /* 1.8 V */
+ {"vdda", 100000}, /* 1.2 V */
+ {"vddio", 100000}, /* 1.8 V */
},
},
.bus_clk_names = dsi_8916_bus_clk_names,
.reg_cfg = {
.num = 2,
.regs = {
- {"vdda", 100000, 100}, /* 1.2 V */
- {"vddio", 100000, 100}, /* 1.8 V */
+ {"vdda", 100000}, /* 1.2 V */
+ {"vddio", 100000}, /* 1.8 V */
},
},
.bus_clk_names = dsi_8976_bus_clk_names,
.reg_cfg = {
.num = 6,
.regs = {
- {"vdda", 100000, 100}, /* 1.25 V */
- {"vddio", 100000, 100}, /* 1.8 V */
- {"vcca", 10000, 100}, /* 1.0 V */
- {"vdd", 100000, 100}, /* 1.8 V */
- {"lab_reg", -1, -1},
- {"ibb_reg", -1, -1},
+ {"vdda", 100000}, /* 1.25 V */
+ {"vddio", 100000}, /* 1.8 V */
+ {"vcca", 10000}, /* 1.0 V */
+ {"vdd", 100000}, /* 1.8 V */
+ {"lab_reg", -1},
+ {"ibb_reg", -1},
},
},
.bus_clk_names = dsi_6g_bus_clk_names,
.reg_cfg = {
.num = 3,
.regs = {
- {"vdda", 18160, 1 }, /* 1.25 V */
- {"vcca", 17000, 32 }, /* 0.925 V */
- {"vddio", 100000, 100 },/* 1.8 V */
+ {"vdda", 18160}, /* 1.25 V */
+ {"vcca", 17000}, /* 0.925 V */
+ {"vddio", 100000},/* 1.8 V */
},
},
.bus_clk_names = dsi_8996_bus_clk_names,
.reg_cfg = {
.num = 2,
.regs = {
- {"vdd", 367000, 16 }, /* 0.9 V */
- {"vdda", 62800, 2 }, /* 1.2 V */
+ {"vdd", 367000}, /* 0.9 V */
+ {"vdda", 62800}, /* 1.2 V */
},
},
.bus_clk_names = dsi_msm8998_bus_clk_names,
.reg_cfg = {
.num = 1,
.regs = {
- {"vdda", 12560, 4 }, /* 1.2 V */
+ {"vdda", 12560}, /* 1.2 V */
},
},
.bus_clk_names = dsi_sdm660_bus_clk_names,
.reg_cfg = {
.num = 1,
.regs = {
- {"vdda", 21800, 4 }, /* 1.2 V */
+ {"vdda", 21800}, /* 1.2 V */
},
},
.bus_clk_names = dsi_sdm845_bus_clk_names,
.reg_cfg = {
.num = 1,
.regs = {
- {"vdda", 21800, 4 }, /* 1.2 V */
+ {"vdda", 21800}, /* 1.2 V */
},
},
.bus_clk_names = dsi_sc7180_bus_clk_names,
.reg_cfg = {
.num = 1,
.regs = {
- {"vdda", 8350, 0 }, /* 1.2 V */
+ {"vdda", 8350}, /* 1.2 V */
},
},
.bus_clk_names = dsi_sc7280_bus_clk_names,
.reg_cfg = {
.num = 1,
.regs = {
- {"vdda", 21800, 4 }, /* 1.2 V */
+ {"vdda", 21800}, /* 1.2 V */
},
},
.bus_clk_names = dsi_qcm2290_bus_clk_names,
msm_writel(data, msm_host->ctrl_base + reg);
}
-static int dsi_host_regulator_enable(struct msm_dsi_host *msm_host);
-static void dsi_host_regulator_disable(struct msm_dsi_host *msm_host);
-
static const struct msm_dsi_cfg_handler *dsi_get_config(
struct msm_dsi_host *msm_host)
{
return container_of(host, struct msm_dsi_host, base);
}
-static void dsi_host_regulator_disable(struct msm_dsi_host *msm_host)
-{
- struct regulator_bulk_data *s = msm_host->supplies;
- const struct dsi_reg_entry *regs = msm_host->cfg_hnd->cfg->reg_cfg.regs;
- int num = msm_host->cfg_hnd->cfg->reg_cfg.num;
- int i;
-
- DBG("");
- for (i = num - 1; i >= 0; i--)
- if (regs[i].disable_load >= 0)
- regulator_set_load(s[i].consumer,
- regs[i].disable_load);
-
- regulator_bulk_disable(num, s);
-}
-
-static int dsi_host_regulator_enable(struct msm_dsi_host *msm_host)
-{
- struct regulator_bulk_data *s = msm_host->supplies;
- const struct dsi_reg_entry *regs = msm_host->cfg_hnd->cfg->reg_cfg.regs;
- int num = msm_host->cfg_hnd->cfg->reg_cfg.num;
- int ret, i;
-
- DBG("");
- for (i = 0; i < num; i++) {
- if (regs[i].enable_load >= 0) {
- ret = regulator_set_load(s[i].consumer,
- regs[i].enable_load);
- if (ret < 0) {
- pr_err("regulator %d set op mode failed, %d\n",
- i, ret);
- goto fail;
- }
- }
- }
-
- ret = regulator_bulk_enable(num, s);
- if (ret < 0) {
- pr_err("regulator enable failed, %d\n", ret);
- goto fail;
- }
-
- return 0;
-
-fail:
- for (i--; i >= 0; i--)
- regulator_set_load(s[i].consumer, regs[i].disable_load);
- return ret;
-}
-
static int dsi_regulator_init(struct msm_dsi_host *msm_host)
{
struct regulator_bulk_data *s = msm_host->supplies;
return ret;
}
+ for (i = 0; i < num; i++) {
+ if (regs[i].enable_load >= 0) {
+ ret = regulator_set_load(s[i].consumer,
+ regs[i].enable_load);
+ if (ret < 0)
+ return ret;
+ }
+ }
+
return 0;
}
msm_dsi_sfpb_config(msm_host, true);
- ret = dsi_host_regulator_enable(msm_host);
+ ret = regulator_bulk_enable(msm_host->cfg_hnd->cfg->reg_cfg.num,
+ msm_host->supplies);
if (ret) {
pr_err("%s:Failed to enable vregs.ret=%d\n",
__func__, ret);
cfg_hnd->ops->link_clk_disable(msm_host);
pm_runtime_put(&msm_host->pdev->dev);
fail_disable_reg:
- dsi_host_regulator_disable(msm_host);
+ regulator_bulk_disable(msm_host->cfg_hnd->cfg->reg_cfg.num,
+ msm_host->supplies);
unlock_ret:
mutex_unlock(&msm_host->dev_mutex);
return ret;
cfg_hnd->ops->link_clk_disable(msm_host);
pm_runtime_put(&msm_host->pdev->dev);
- dsi_host_regulator_disable(msm_host);
+ regulator_bulk_disable(msm_host->cfg_hnd->cfg->reg_cfg.num,
+ msm_host->supplies);
msm_dsi_sfpb_config(msm_host, false);
return ret;
}
- return 0;
-}
-
-static void dsi_phy_regulator_disable(struct msm_dsi_phy *phy)
-{
- struct regulator_bulk_data *s = phy->supplies;
- const struct dsi_reg_entry *regs = phy->cfg->reg_cfg.regs;
- int num = phy->cfg->reg_cfg.num;
- int i;
-
- DBG("");
- for (i = num - 1; i >= 0; i--)
- if (regs[i].disable_load >= 0)
- regulator_set_load(s[i].consumer, regs[i].disable_load);
-
- regulator_bulk_disable(num, s);
-}
-
-static int dsi_phy_regulator_enable(struct msm_dsi_phy *phy)
-{
- struct regulator_bulk_data *s = phy->supplies;
- const struct dsi_reg_entry *regs = phy->cfg->reg_cfg.regs;
- struct device *dev = &phy->pdev->dev;
- int num = phy->cfg->reg_cfg.num;
- int ret, i;
-
- DBG("");
for (i = 0; i < num; i++) {
if (regs[i].enable_load >= 0) {
ret = regulator_set_load(s[i].consumer,
regs[i].enable_load);
- if (ret < 0) {
- DRM_DEV_ERROR(dev,
- "regulator %d set op mode failed, %d\n",
- i, ret);
- goto fail;
- }
+ if (ret < 0)
+ return ret;
}
}
- ret = regulator_bulk_enable(num, s);
- if (ret < 0) {
- DRM_DEV_ERROR(dev, "regulator enable failed, %d\n", ret);
- goto fail;
- }
-
return 0;
-
-fail:
- for (i--; i >= 0; i--)
- regulator_set_load(s[i].consumer, regs[i].disable_load);
- return ret;
}
static int dsi_phy_enable_resource(struct msm_dsi_phy *phy)
goto res_en_fail;
}
- ret = dsi_phy_regulator_enable(phy);
+ ret = regulator_bulk_enable(phy->cfg->reg_cfg.num, phy->supplies);
if (ret) {
DRM_DEV_ERROR(dev, "%s: regulator enable failed, %d\n",
__func__, ret);
if (phy->cfg->ops.disable)
phy->cfg->ops.disable(phy);
phy_en_fail:
- dsi_phy_regulator_disable(phy);
+ regulator_bulk_disable(phy->cfg->reg_cfg.num, phy->supplies);
reg_en_fail:
dsi_phy_disable_resource(phy);
res_en_fail:
phy->cfg->ops.disable(phy);
- dsi_phy_regulator_disable(phy);
+ regulator_bulk_disable(phy->cfg->reg_cfg.num, phy->supplies);
dsi_phy_disable_resource(phy);
}