Commit a1a0dcca authored by Semwal, Sumit's avatar Semwal, Sumit Committed by Tomi Valkeinen

OMAP2PLUS:DSS2: Use opt_clock_available from pdata

hwmod databases provide information about which optional clocks are available
for a given platform. This is available via a function pointer opt_clock_enable
in pdata.

Use this information during get/enable/disable/put of clocks.
Signed-off-by: default avatarSumit Semwal <sumit.semwal@ti.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent fd4b34f6
...@@ -706,6 +706,7 @@ static int dss_get_clock(struct clk **clock, const char *clk_name) ...@@ -706,6 +706,7 @@ static int dss_get_clock(struct clk **clock, const char *clk_name)
static int dss_get_clocks(void) static int dss_get_clocks(void)
{ {
int r; int r;
struct omap_display_platform_data *pdata = dss.pdev->dev.platform_data;
dss.dss_ick = NULL; dss.dss_ick = NULL;
dss.dss_fck = NULL; dss.dss_fck = NULL;
...@@ -721,17 +722,28 @@ static int dss_get_clocks(void) ...@@ -721,17 +722,28 @@ static int dss_get_clocks(void)
if (r) if (r)
goto err; goto err;
r = dss_get_clock(&dss.dss_sys_clk, "sys_clk"); if (!pdata->opt_clock_available) {
if (r) r = -ENODEV;
goto err; goto err;
}
r = dss_get_clock(&dss.dss_tv_fck, "tv_clk"); if (pdata->opt_clock_available("sys_clk")) {
if (r) r = dss_get_clock(&dss.dss_sys_clk, "sys_clk");
goto err; if (r)
goto err;
}
r = dss_get_clock(&dss.dss_video_fck, "video_clk"); if (pdata->opt_clock_available("tv_clk")) {
if (r) r = dss_get_clock(&dss.dss_tv_fck, "tv_clk");
goto err; if (r)
goto err;
}
if (pdata->opt_clock_available("video_clk")) {
r = dss_get_clock(&dss.dss_video_fck, "video_clk");
if (r)
goto err;
}
return 0; return 0;
...@@ -754,9 +766,11 @@ static void dss_put_clocks(void) ...@@ -754,9 +766,11 @@ static void dss_put_clocks(void)
{ {
if (dss.dss_video_fck) if (dss.dss_video_fck)
clk_put(dss.dss_video_fck); clk_put(dss.dss_video_fck);
clk_put(dss.dss_tv_fck); if (dss.dss_tv_fck)
clk_put(dss.dss_tv_fck);
if (dss.dss_sys_clk)
clk_put(dss.dss_sys_clk);
clk_put(dss.dss_fck); clk_put(dss.dss_fck);
clk_put(dss.dss_sys_clk);
clk_put(dss.dss_ick); clk_put(dss.dss_ick);
} }
...@@ -805,11 +819,11 @@ static void dss_clk_enable_no_ctx(enum dss_clock clks) ...@@ -805,11 +819,11 @@ static void dss_clk_enable_no_ctx(enum dss_clock clks)
clk_enable(dss.dss_ick); clk_enable(dss.dss_ick);
if (clks & DSS_CLK_FCK) if (clks & DSS_CLK_FCK)
clk_enable(dss.dss_fck); clk_enable(dss.dss_fck);
if (clks & DSS_CLK_SYSCK) if ((clks & DSS_CLK_SYSCK) && dss.dss_sys_clk)
clk_enable(dss.dss_sys_clk); clk_enable(dss.dss_sys_clk);
if (clks & DSS_CLK_TVFCK) if ((clks & DSS_CLK_TVFCK) && dss.dss_tv_fck)
clk_enable(dss.dss_tv_fck); clk_enable(dss.dss_tv_fck);
if (clks & DSS_CLK_VIDFCK) if ((clks & DSS_CLK_VIDFCK) && dss.dss_video_fck)
clk_enable(dss.dss_video_fck); clk_enable(dss.dss_video_fck);
dss.num_clks_enabled += num_clks; dss.num_clks_enabled += num_clks;
...@@ -833,11 +847,11 @@ static void dss_clk_disable_no_ctx(enum dss_clock clks) ...@@ -833,11 +847,11 @@ static void dss_clk_disable_no_ctx(enum dss_clock clks)
clk_disable(dss.dss_ick); clk_disable(dss.dss_ick);
if (clks & DSS_CLK_FCK) if (clks & DSS_CLK_FCK)
clk_disable(dss.dss_fck); clk_disable(dss.dss_fck);
if (clks & DSS_CLK_SYSCK) if ((clks & DSS_CLK_SYSCK) && dss.dss_sys_clk)
clk_disable(dss.dss_sys_clk); clk_disable(dss.dss_sys_clk);
if (clks & DSS_CLK_TVFCK) if ((clks & DSS_CLK_TVFCK) && dss.dss_tv_fck)
clk_disable(dss.dss_tv_fck); clk_disable(dss.dss_tv_fck);
if (clks & DSS_CLK_VIDFCK) if ((clks & DSS_CLK_VIDFCK) && dss.dss_video_fck)
clk_disable(dss.dss_video_fck); clk_disable(dss.dss_video_fck);
dss.num_clks_enabled -= num_clks; dss.num_clks_enabled -= num_clks;
......
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