Commit 044c372a authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] exynos4-is: Simplify sclk_cam clocks handling

Use clk_prepare_enable()/clk_disable_unprepare() instead of
separately prearing/unparing the clk_cam clocks. This simplifies
the code that is now mostly not going to be used, function
__fimc_md_set_camclk() is only left for S5PV210 platform which
is not yet converted to Device Tree.
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent b74bee15
...@@ -1150,7 +1150,6 @@ static void fimc_md_put_clocks(struct fimc_md *fmd) ...@@ -1150,7 +1150,6 @@ static void fimc_md_put_clocks(struct fimc_md *fmd)
while (--i >= 0) { while (--i >= 0) {
if (IS_ERR(fmd->camclk[i].clock)) if (IS_ERR(fmd->camclk[i].clock))
continue; continue;
clk_unprepare(fmd->camclk[i].clock);
clk_put(fmd->camclk[i].clock); clk_put(fmd->camclk[i].clock);
fmd->camclk[i].clock = ERR_PTR(-EINVAL); fmd->camclk[i].clock = ERR_PTR(-EINVAL);
} }
...@@ -1169,7 +1168,7 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) ...@@ -1169,7 +1168,7 @@ static int fimc_md_get_clocks(struct fimc_md *fmd)
struct device *dev = NULL; struct device *dev = NULL;
char clk_name[32]; char clk_name[32];
struct clk *clock; struct clk *clock;
int ret, i; int i, ret = 0;
for (i = 0; i < FIMC_MAX_CAMCLKS; i++) for (i = 0; i < FIMC_MAX_CAMCLKS; i++)
fmd->camclk[i].clock = ERR_PTR(-EINVAL); fmd->camclk[i].clock = ERR_PTR(-EINVAL);
...@@ -1187,12 +1186,6 @@ static int fimc_md_get_clocks(struct fimc_md *fmd) ...@@ -1187,12 +1186,6 @@ static int fimc_md_get_clocks(struct fimc_md *fmd)
ret = PTR_ERR(clock); ret = PTR_ERR(clock);
break; break;
} }
ret = clk_prepare(clock);
if (ret < 0) {
clk_put(clock);
fmd->camclk[i].clock = ERR_PTR(-EINVAL);
break;
}
fmd->camclk[i].clock = clock; fmd->camclk[i].clock = clock;
} }
if (ret) if (ret)
...@@ -1249,7 +1242,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -1249,7 +1242,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
ret = pm_runtime_get_sync(fmd->pmf); ret = pm_runtime_get_sync(fmd->pmf);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = clk_enable(camclk->clock); ret = clk_prepare_enable(camclk->clock);
dbg("Enabled camclk %d: f: %lu", si->clk_id, dbg("Enabled camclk %d: f: %lu", si->clk_id,
clk_get_rate(camclk->clock)); clk_get_rate(camclk->clock));
} }
...@@ -1260,7 +1253,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd, ...@@ -1260,7 +1253,7 @@ static int __fimc_md_set_camclk(struct fimc_md *fmd,
return 0; return 0;
if (--camclk->use_count == 0) { if (--camclk->use_count == 0) {
clk_disable(camclk->clock); clk_disable_unprepare(camclk->clock);
pm_runtime_put(fmd->pmf); pm_runtime_put(fmd->pmf);
dbg("Disabled camclk %d", si->clk_id); dbg("Disabled camclk %d", si->clk_id);
} }
......
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