Commit 31c92767 authored by Archit Taneja's avatar Archit Taneja Committed by Rob Clark

drm/msm/dsi: Delay dsi_clk_init

Initialize clocks only after we get the DSI host version. This will allow
us to get clocks using a pre-defined list based on the DSI major/minor
version of the host. This is required since clock requirements of
different major DSI revisions(v2 vs 6g) aren't the same.

Modify dsi_get_version to get the interface clock, and then put it after
it is used.
Signed-off-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 648d5063
...@@ -177,21 +177,31 @@ static const struct msm_dsi_cfg_handler *dsi_get_config( ...@@ -177,21 +177,31 @@ static const struct msm_dsi_cfg_handler *dsi_get_config(
struct msm_dsi_host *msm_host) struct msm_dsi_host *msm_host)
{ {
const struct msm_dsi_cfg_handler *cfg_hnd = NULL; const struct msm_dsi_cfg_handler *cfg_hnd = NULL;
struct device *dev = &msm_host->pdev->dev;
struct regulator *gdsc_reg; struct regulator *gdsc_reg;
struct clk *ahb_clk;
int ret; int ret;
u32 major = 0, minor = 0; u32 major = 0, minor = 0;
gdsc_reg = regulator_get(&msm_host->pdev->dev, "gdsc"); gdsc_reg = regulator_get(dev, "gdsc");
if (IS_ERR(gdsc_reg)) { if (IS_ERR(gdsc_reg)) {
pr_err("%s: cannot get gdsc\n", __func__); pr_err("%s: cannot get gdsc\n", __func__);
goto exit; goto exit;
} }
ahb_clk = clk_get(dev, "iface_clk");
if (IS_ERR(ahb_clk)) {
pr_err("%s: cannot get interface clock\n", __func__);
goto put_gdsc;
}
ret = regulator_enable(gdsc_reg); ret = regulator_enable(gdsc_reg);
if (ret) { if (ret) {
pr_err("%s: unable to enable gdsc\n", __func__); pr_err("%s: unable to enable gdsc\n", __func__);
goto put_gdsc; goto put_clk;
} }
ret = clk_prepare_enable(msm_host->ahb_clk);
ret = clk_prepare_enable(ahb_clk);
if (ret) { if (ret) {
pr_err("%s: unable to enable ahb_clk\n", __func__); pr_err("%s: unable to enable ahb_clk\n", __func__);
goto disable_gdsc; goto disable_gdsc;
...@@ -208,9 +218,11 @@ static const struct msm_dsi_cfg_handler *dsi_get_config( ...@@ -208,9 +218,11 @@ static const struct msm_dsi_cfg_handler *dsi_get_config(
DBG("%s: Version %x:%x\n", __func__, major, minor); DBG("%s: Version %x:%x\n", __func__, major, minor);
disable_clks: disable_clks:
clk_disable_unprepare(msm_host->ahb_clk); clk_disable_unprepare(ahb_clk);
disable_gdsc: disable_gdsc:
regulator_disable(gdsc_reg); regulator_disable(gdsc_reg);
put_clk:
clk_put(ahb_clk);
put_gdsc: put_gdsc:
regulator_put(gdsc_reg); regulator_put(gdsc_reg);
exit: exit:
...@@ -1417,12 +1429,6 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) ...@@ -1417,12 +1429,6 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
goto fail; goto fail;
} }
ret = dsi_clk_init(msm_host);
if (ret) {
pr_err("%s: unable to initialize dsi clks\n", __func__);
goto fail;
}
msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL"); msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL");
if (IS_ERR(msm_host->ctrl_base)) { if (IS_ERR(msm_host->ctrl_base)) {
pr_err("%s: unable to map Dsi ctrl base\n", __func__); pr_err("%s: unable to map Dsi ctrl base\n", __func__);
...@@ -1446,6 +1452,12 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) ...@@ -1446,6 +1452,12 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
goto fail; goto fail;
} }
ret = dsi_clk_init(msm_host);
if (ret) {
pr_err("%s: unable to initialize dsi clks\n", __func__);
goto fail;
}
msm_host->rx_buf = devm_kzalloc(&pdev->dev, SZ_4K, GFP_KERNEL); msm_host->rx_buf = devm_kzalloc(&pdev->dev, SZ_4K, GFP_KERNEL);
if (!msm_host->rx_buf) { if (!msm_host->rx_buf) {
pr_err("%s: alloc rx temp buf failed\n", __func__); pr_err("%s: alloc rx temp buf failed\n", __func__);
......
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