[media] exynos4-is: Improve clock management
There is no need to keep all clocks prepared all the time. Call to clk_prepare/unprepare can be done on demand from runtime pm callbacks (it is allowed to call sleeping functions from that context). Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
438236e7c1
commit
5f6d636f91
|
@ -1454,25 +1454,17 @@ static void fimc_lite_clk_put(struct fimc_lite *fimc)
|
||||||
if (IS_ERR(fimc->clock))
|
if (IS_ERR(fimc->clock))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clk_unprepare(fimc->clock);
|
|
||||||
clk_put(fimc->clock);
|
clk_put(fimc->clock);
|
||||||
fimc->clock = ERR_PTR(-EINVAL);
|
fimc->clock = ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fimc_lite_clk_get(struct fimc_lite *fimc)
|
static int fimc_lite_clk_get(struct fimc_lite *fimc)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
fimc->clock = clk_get(&fimc->pdev->dev, FLITE_CLK_NAME);
|
fimc->clock = clk_get(&fimc->pdev->dev, FLITE_CLK_NAME);
|
||||||
if (IS_ERR(fimc->clock))
|
if (IS_ERR(fimc->clock))
|
||||||
return PTR_ERR(fimc->clock);
|
return PTR_ERR(fimc->clock);
|
||||||
|
|
||||||
ret = clk_prepare(fimc->clock);
|
return 0;
|
||||||
if (ret < 0) {
|
|
||||||
clk_put(fimc->clock);
|
|
||||||
fimc->clock = ERR_PTR(-EINVAL);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct of_device_id flite_of_match[];
|
static const struct of_device_id flite_of_match[];
|
||||||
|
@ -1543,7 +1535,7 @@ static int fimc_lite_probe(struct platform_device *pdev)
|
||||||
pm_runtime_enable(dev);
|
pm_runtime_enable(dev);
|
||||||
|
|
||||||
if (!pm_runtime_enabled(dev)) {
|
if (!pm_runtime_enabled(dev)) {
|
||||||
ret = clk_enable(fimc->clock);
|
ret = clk_prepare_enable(fimc->clock);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_sd;
|
goto err_sd;
|
||||||
}
|
}
|
||||||
|
@ -1568,7 +1560,7 @@ static int fimc_lite_runtime_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct fimc_lite *fimc = dev_get_drvdata(dev);
|
struct fimc_lite *fimc = dev_get_drvdata(dev);
|
||||||
|
|
||||||
clk_enable(fimc->clock);
|
clk_prepare_enable(fimc->clock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1576,7 +1568,7 @@ static int fimc_lite_runtime_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct fimc_lite *fimc = dev_get_drvdata(dev);
|
struct fimc_lite *fimc = dev_get_drvdata(dev);
|
||||||
|
|
||||||
clk_disable(fimc->clock);
|
clk_disable_unprepare(fimc->clock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue