Commit 722a860e authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] exynos4-is: Fix FIMC-IS clocks initialization

The ISP clock register content is not preserved over the ISP power domain
off/on cycle. Instead of setting the clock frequencies once at probe time
the clock rates set up is moved to the runtime_resume handler, which is
invoked after the related power domain is already enabled, ensuring the
clocks are properly configured when the device is actively used.
This fixes the FIMC-IS malfunctions and STREAM ON timeout errors accuring
on some boards:
[ 59.860000] fimc_is_general_irq_handler:583 ISR_NDONE: 5: 0x800003e8, IS_ERROR_UNKNOWN
[ 59.860000] fimc_is_general_irq_handler:586 IS_ERROR_TIME_OUT
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a908eb99
...@@ -834,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev) ...@@ -834,23 +834,11 @@ static int fimc_is_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
/*
* Enable only the ISP power domain, keep FIMC-IS clocks off until
* the whole clock tree is configured. The ISP power domain needs
* be active in order to acces any CMU_ISP clock registers.
*/
ret = pm_runtime_get_sync(dev);
if (ret < 0)
goto err_irq;
ret = fimc_is_setup_clocks(is);
pm_runtime_put_sync(dev);
ret = pm_runtime_get_sync(dev);
if (ret < 0) if (ret < 0)
goto err_irq; goto err_irq;
is->clk_init = true;
is->alloc_ctx = vb2_dma_contig_init_ctx(dev); is->alloc_ctx = vb2_dma_contig_init_ctx(dev);
if (IS_ERR(is->alloc_ctx)) { if (IS_ERR(is->alloc_ctx)) {
ret = PTR_ERR(is->alloc_ctx); ret = PTR_ERR(is->alloc_ctx);
...@@ -872,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev) ...@@ -872,6 +860,8 @@ static int fimc_is_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto err_dfs; goto err_dfs;
pm_runtime_put_sync(dev);
dev_dbg(dev, "FIMC-IS registered successfully\n"); dev_dbg(dev, "FIMC-IS registered successfully\n");
return 0; return 0;
...@@ -891,9 +881,11 @@ static int fimc_is_probe(struct platform_device *pdev) ...@@ -891,9 +881,11 @@ static int fimc_is_probe(struct platform_device *pdev)
static int fimc_is_runtime_resume(struct device *dev) static int fimc_is_runtime_resume(struct device *dev)
{ {
struct fimc_is *is = dev_get_drvdata(dev); struct fimc_is *is = dev_get_drvdata(dev);
int ret;
if (!is->clk_init) ret = fimc_is_setup_clocks(is);
return 0; if (ret)
return ret;
return fimc_is_enable_clocks(is); return fimc_is_enable_clocks(is);
} }
...@@ -902,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev) ...@@ -902,9 +894,7 @@ static int fimc_is_runtime_suspend(struct device *dev)
{ {
struct fimc_is *is = dev_get_drvdata(dev); struct fimc_is *is = dev_get_drvdata(dev);
if (is->clk_init) fimc_is_disable_clocks(is);
fimc_is_disable_clocks(is);
return 0; return 0;
} }
......
...@@ -264,7 +264,6 @@ struct fimc_is { ...@@ -264,7 +264,6 @@ struct fimc_is {
spinlock_t slock; spinlock_t slock;
struct clk *clocks[ISS_CLKS_MAX]; struct clk *clocks[ISS_CLKS_MAX];
bool clk_init;
void __iomem *regs; void __iomem *regs;
void __iomem *pmu_regs; void __iomem *pmu_regs;
int irq; int irq;
......
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