i2c: s3c2410: Enable idle ip status
authorYoungmin Nam <youngmin.nam@samsung.com>
Tue, 21 Apr 2015 17:13:02 +0000 (02:13 +0900)
committermyung-su.cha <myung-su.cha@samsung.com>
Thu, 10 May 2018 04:40:55 +0000 (13:40 +0900)
Change-Id: I754fd76eb9dd8c3a223f9e720cee527a265234f0
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
drivers/i2c/busses/i2c-s3c2410.c

index da853a1d094e2f5542232a4e4fbba450a0b50a67..f0a9b0d81567ed5fa1384cd6c973051fce019ed3 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/irq.h>
 
 #include <linux/platform_data/i2c-s3c2410.h>
+#include <soc/samsung/exynos-powermode.h>
 
 #ifdef CONFIG_CPU_IDLE
 #include <soc/samsung/exynos-pm.h>
@@ -139,6 +140,7 @@ struct s3c24xx_i2c {
        struct s3c2410_platform_i2c     *pdata;
        int                     gpios[2];
        struct pinctrl          *pctrl;
+       int                     idle_ip_index;
 };
 
 static const struct platform_device_id s3c24xx_driver_ids[] = {
@@ -844,6 +846,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
        int ret;
 
        pm_runtime_get_sync(&adap->dev);
+       exynos_update_ip_idle_status(i2c->idle_ip_index, 0);
        ret = clk_enable(i2c->clk);
        if (ret)
                return ret;
@@ -858,6 +861,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
 
                if (ret != -EAGAIN) {
                        clk_disable(i2c->clk);
+                       exynos_update_ip_idle_status(i2c->idle_ip_index, 1);
                        pm_runtime_put(&adap->dev);
                        return ret;
                }
@@ -868,6 +872,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
        }
 
        clk_disable(i2c->clk);
+       exynos_update_ip_idle_status(i2c->idle_ip_index, 1);
        pm_runtime_put(&adap->dev);
        return -EREMOTEIO;
 }
@@ -1187,6 +1192,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
        i2c->adap.class = I2C_CLASS_DEPRECATED;
        i2c->tx_setup = 50;
 
+       i2c->idle_ip_index = exynos_get_idle_ip_index(dev_name(&pdev->dev));
+
        init_waitqueue_head(&i2c->wait);
 
        /* find the clock and enable it */