summaryrefslogtreecommitdiff
path: root/patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch')
-rw-r--r--patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch b/patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch
new file mode 100644
index 00000000000..80723900e61
--- /dev/null
+++ b/patches.tizen/0299-exynos4-is-Handle-suspend-resume-of-fimc-is-i2c-corr.patch
@@ -0,0 +1,77 @@
+From 7eab02689586a62d1f7cfffbb95f1224bb0a489d Mon Sep 17 00:00:00 2001
+From: Tomasz Figa <t.figa@samsung.com>
+Date: Wed, 26 Jun 2013 15:37:14 +0200
+Subject: [PATCH 0299/1302] exynos4-is: Handle suspend/resume of fimc-is-i2c
+ correctly
+
+If the same callbacks are used for runtime and system suspend/resume,
+clocks can get disabled twice, which can lead to negative reference
+counts and kernel warnings.
+
+This patch splits suspend/resume callbacks into separate runtime and
+system-wide functions, so clock gating is done correctly.
+
+Signed-off-by: Tomasz Figa <t.figa@samsung.com>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+---
+ drivers/media/platform/exynos4-is/fimc-is-i2c.c | 33 ++++++++++++++++++++++---
+ 1 file changed, 29 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c
+index 617a798..6bc481a 100644
+--- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c
++++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c
+@@ -83,21 +83,46 @@ static int fimc_is_i2c_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-static int fimc_is_i2c_suspend(struct device *dev)
++#if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP)
++static int fimc_is_i2c_runtime_suspend(struct device *dev)
+ {
+ struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev);
++
+ clk_disable_unprepare(isp_i2c->clock);
+ return 0;
+ }
+
+-static int fimc_is_i2c_resume(struct device *dev)
++static int fimc_is_i2c_runtime_resume(struct device *dev)
+ {
+ struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev);
++
+ return clk_prepare_enable(isp_i2c->clock);
+ }
++#endif
+
+-static UNIVERSAL_DEV_PM_OPS(fimc_is_i2c_pm_ops, fimc_is_i2c_suspend,
+- fimc_is_i2c_resume, NULL);
++#ifdef CONFIG_PM_SLEEP
++static int fimc_is_i2c_suspend(struct device *dev)
++{
++ if (pm_runtime_suspended(dev))
++ return 0;
++
++ return fimc_is_i2c_runtime_suspend(dev);
++}
++
++static int fimc_is_i2c_resume(struct device *dev)
++{
++ if (pm_runtime_suspended(dev))
++ return 0;
++
++ return fimc_is_i2c_runtime_resume(dev);
++}
++#endif
++
++static struct dev_pm_ops fimc_is_i2c_pm_ops = {
++ SET_RUNTIME_PM_OPS(fimc_is_i2c_runtime_suspend,
++ fimc_is_i2c_runtime_resume, NULL)
++ SET_SYSTEM_SLEEP_PM_OPS(fimc_is_i2c_suspend, fimc_is_i2c_resume)
++};
+
+ static const struct of_device_id fimc_is_i2c_of_match[] = {
+ { .compatible = FIMC_IS_I2C_COMPATIBLE },
+--
+1.8.3.2
+