diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/exynos4-is/fimc-is-i2c.c | 33 |
1 files 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 617a798d9235..6bc481a9e93f 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) | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int fimc_is_i2c_suspend(struct device *dev) | 86 | #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) |
87 | static int fimc_is_i2c_runtime_suspend(struct device *dev) | ||
87 | { | 88 | { |
88 | struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev); | 89 | struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev); |
90 | |||
89 | clk_disable_unprepare(isp_i2c->clock); | 91 | clk_disable_unprepare(isp_i2c->clock); |
90 | return 0; | 92 | return 0; |
91 | } | 93 | } |
92 | 94 | ||
93 | static int fimc_is_i2c_resume(struct device *dev) | 95 | static int fimc_is_i2c_runtime_resume(struct device *dev) |
94 | { | 96 | { |
95 | struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev); | 97 | struct fimc_is_i2c *isp_i2c = dev_get_drvdata(dev); |
98 | |||
96 | return clk_prepare_enable(isp_i2c->clock); | 99 | return clk_prepare_enable(isp_i2c->clock); |
97 | } | 100 | } |
101 | #endif | ||
98 | 102 | ||
99 | static UNIVERSAL_DEV_PM_OPS(fimc_is_i2c_pm_ops, fimc_is_i2c_suspend, | 103 | #ifdef CONFIG_PM_SLEEP |
100 | fimc_is_i2c_resume, NULL); | 104 | static int fimc_is_i2c_suspend(struct device *dev) |
105 | { | ||
106 | if (pm_runtime_suspended(dev)) | ||
107 | return 0; | ||
108 | |||
109 | return fimc_is_i2c_runtime_suspend(dev); | ||
110 | } | ||
111 | |||
112 | static int fimc_is_i2c_resume(struct device *dev) | ||
113 | { | ||
114 | if (pm_runtime_suspended(dev)) | ||
115 | return 0; | ||
116 | |||
117 | return fimc_is_i2c_runtime_resume(dev); | ||
118 | } | ||
119 | #endif | ||
120 | |||
121 | static struct dev_pm_ops fimc_is_i2c_pm_ops = { | ||
122 | SET_RUNTIME_PM_OPS(fimc_is_i2c_runtime_suspend, | ||
123 | fimc_is_i2c_runtime_resume, NULL) | ||
124 | SET_SYSTEM_SLEEP_PM_OPS(fimc_is_i2c_suspend, fimc_is_i2c_resume) | ||
125 | }; | ||
101 | 126 | ||
102 | static const struct of_device_id fimc_is_i2c_of_match[] = { | 127 | static const struct of_device_id fimc_is_i2c_of_match[] = { |
103 | { .compatible = FIMC_IS_I2C_COMPATIBLE }, | 128 | { .compatible = FIMC_IS_I2C_COMPATIBLE }, |