From 34d35cf08e19acd9da84b1c4fd2e676e285198e1 Mon Sep 17 00:00:00 2001 From: Eunki Kim Date: Thu, 2 Jan 2014 14:20:54 +0900 Subject: [PATCH] i2c: s3c2410: Fix pm_runtime to support fimc-is's I2C Signed-off-by: Eunki Kim Conflicts: drivers/i2c/busses/i2c-s3c2410.c Change-Id: I7cee624014e46e0b43b95f306b8ca39975be2a6b --- drivers/i2c/busses/i2c-s3c2410.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 9f15b6d220eb..fe16e69a2bb5 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -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) -- 2.20.1