i2c: s3c2410: Fix pm_runtime to support fimc-is's I2C
authorEunki Kim <eunki_kim@samsung.com>
Thu, 2 Jan 2014 05:20:54 +0000 (14:20 +0900)
committermyung-su.cha <myung-su.cha@samsung.com>
Thu, 10 May 2018 04:40:42 +0000 (13:40 +0900)
Signed-off-by: Eunki Kim <eunki_kim@samsung.com>
Conflicts:

drivers/i2c/busses/i2c-s3c2410.c

Change-Id: I7cee624014e46e0b43b95f306b8ca39975be2a6b

drivers/i2c/busses/i2c-s3c2410.c

index 9f15b6d220ebe280318874ff977c574da8cefb0c..fe16e69a2bb5ac780fa386d09852d74f02a0273a 100644 (file)
@@ -1342,12 +1342,28 @@ static int s3c24xx_i2c_resume_noirq(struct device *dev)
        struct s3c24xx_i2c *i2c = dev_get_drvdata(dev);
        int ret;
 
-       ret = clk_enable(i2c->clk);
-       if (ret)
-               return ret;
-       s3c24xx_i2c_init(i2c);
-       clk_disable(i2c->clk);
        i2c->suspended = 0;
+       if (!(i2c->quirks & QUIRK_FIMC_I2C)) {
+               clk_prepare_enable(i2c->clk);
+               s3c24xx_i2c_init(i2c);
+               clk_disable_unprepare(i2c->clk);
+       }
+
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_PM_RUNTIME
+static int s3c24xx_i2c_runtime_resume(struct device *dev)
+{
+       struct platform_device *pdev = to_platform_device(dev);
+       struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
+
+       if (i2c->quirks & QUIRK_FIMC_I2C) {
+               clk_prepare_enable(i2c->clk);
+               s3c24xx_i2c_init(i2c);
+               clk_disable_unprepare(i2c->clk);
+       }
 
        return 0;
 }
@@ -1363,6 +1379,9 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = {
        .poweroff_noirq = s3c24xx_i2c_suspend_noirq,
        .restore_noirq = s3c24xx_i2c_resume_noirq,
 #endif
+#ifdef CONFIG_PM_RUNTIME
+       .runtime_resume = s3c24xx_i2c_runtime_resume,
+#endif
 };
 
 #define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops)