Commit d9fbb54d authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Rob Clark

drm/msm/dsi: use bulk clk API

Use clk_bulk_* API instead of hand-coding them. Note, this drops support
for legacy clk naming (e.g. "iface_clk" instead of just "iface"),
however all in-kernel device trees were converted long long ago. The
warning is present there since 2017.
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211002012715.691406-1-dmitry.baryshkov@linaro.orgSigned-off-by: default avatarRob Clark <robdclark@chromium.org>
parent 658f4c82
...@@ -106,7 +106,8 @@ struct msm_dsi_host { ...@@ -106,7 +106,8 @@ struct msm_dsi_host {
phys_addr_t ctrl_size; phys_addr_t ctrl_size;
struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX];
struct clk *bus_clks[DSI_BUS_CLK_MAX]; int num_bus_clks;
struct clk_bulk_data bus_clks[DSI_BUS_CLK_MAX];
struct clk *byte_clk; struct clk *byte_clk;
struct clk *esc_clk; struct clk *esc_clk;
...@@ -374,15 +375,14 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host) ...@@ -374,15 +375,14 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
int i, ret = 0; int i, ret = 0;
/* get bus clocks */ /* get bus clocks */
for (i = 0; i < cfg->num_bus_clks; i++) { for (i = 0; i < cfg->num_bus_clks; i++)
msm_host->bus_clks[i] = msm_clk_get(pdev, msm_host->bus_clks[i].id = cfg->bus_clk_names[i];
cfg->bus_clk_names[i]); msm_host->num_bus_clks = cfg->num_bus_clks;
if (IS_ERR(msm_host->bus_clks[i])) {
ret = PTR_ERR(msm_host->bus_clks[i]); ret = devm_clk_bulk_get(&pdev->dev, msm_host->num_bus_clks, msm_host->bus_clks);
pr_err("%s: Unable to get %s clock, ret = %d\n", if (ret < 0) {
__func__, cfg->bus_clk_names[i], ret); dev_err(&pdev->dev, "Unable to get clocks, ret = %d\n", ret);
goto exit; goto exit;
}
} }
/* get link and source clocks */ /* get link and source clocks */
...@@ -433,41 +433,6 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host) ...@@ -433,41 +433,6 @@ static int dsi_clk_init(struct msm_dsi_host *msm_host)
return ret; return ret;
} }
static int dsi_bus_clk_enable(struct msm_dsi_host *msm_host)
{
const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
int i, ret;
DBG("id=%d", msm_host->id);
for (i = 0; i < cfg->num_bus_clks; i++) {
ret = clk_prepare_enable(msm_host->bus_clks[i]);
if (ret) {
pr_err("%s: failed to enable bus clock %d ret %d\n",
__func__, i, ret);
goto err;
}
}
return 0;
err:
while (--i >= 0)
clk_disable_unprepare(msm_host->bus_clks[i]);
return ret;
}
static void dsi_bus_clk_disable(struct msm_dsi_host *msm_host)
{
const struct msm_dsi_config *cfg = msm_host->cfg_hnd->cfg;
int i;
DBG("");
for (i = cfg->num_bus_clks - 1; i >= 0; i--)
clk_disable_unprepare(msm_host->bus_clks[i]);
}
int msm_dsi_runtime_suspend(struct device *dev) int msm_dsi_runtime_suspend(struct device *dev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct platform_device *pdev = to_platform_device(dev);
...@@ -478,7 +443,7 @@ int msm_dsi_runtime_suspend(struct device *dev) ...@@ -478,7 +443,7 @@ int msm_dsi_runtime_suspend(struct device *dev)
if (!msm_host->cfg_hnd) if (!msm_host->cfg_hnd)
return 0; return 0;
dsi_bus_clk_disable(msm_host); clk_bulk_disable_unprepare(msm_host->num_bus_clks, msm_host->bus_clks);
return 0; return 0;
} }
...@@ -493,7 +458,7 @@ int msm_dsi_runtime_resume(struct device *dev) ...@@ -493,7 +458,7 @@ int msm_dsi_runtime_resume(struct device *dev)
if (!msm_host->cfg_hnd) if (!msm_host->cfg_hnd)
return 0; return 0;
return dsi_bus_clk_enable(msm_host); return clk_bulk_prepare_enable(msm_host->num_bus_clks, msm_host->bus_clks);
} }
int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host) int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment