diff options
author | Deepak Sikri <deepak.sikri@st.com> | 2012-02-24 06:31:15 -0500 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-05-12 08:28:15 -0400 |
commit | 3bf3b289c233c28aaef16546168a994070aa24a0 (patch) | |
tree | 811ed056c38c3b5cf3aaaadee7b9bf50493eab5a /drivers/i2c | |
parent | 6923229380bc8ac112f4e6e76d05542c006feaad (diff) |
i2c: designware: add PM support
This patch adds in support for standby/S2R/hybernate for i2c-designware driver.
Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-designware-platdrv.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 4ba589ab8614..f08d0248cf6b 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/interrupt.h> | 36 | #include <linux/interrupt.h> |
37 | #include <linux/of_i2c.h> | 37 | #include <linux/of_i2c.h> |
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/pm.h> | ||
39 | #include <linux/io.h> | 40 | #include <linux/io.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
41 | #include "i2c-designware-core.h" | 42 | #include "i2c-designware-core.h" |
@@ -198,6 +199,31 @@ static const struct of_device_id dw_i2c_of_match[] = { | |||
198 | MODULE_DEVICE_TABLE(of, dw_i2c_of_match); | 199 | MODULE_DEVICE_TABLE(of, dw_i2c_of_match); |
199 | #endif | 200 | #endif |
200 | 201 | ||
202 | #ifdef CONFIG_PM | ||
203 | static int dw_i2c_suspend(struct device *dev) | ||
204 | { | ||
205 | struct platform_device *pdev = to_platform_device(dev); | ||
206 | struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); | ||
207 | |||
208 | clk_disable(i_dev->clk); | ||
209 | |||
210 | return 0; | ||
211 | } | ||
212 | |||
213 | static int dw_i2c_resume(struct device *dev) | ||
214 | { | ||
215 | struct platform_device *pdev = to_platform_device(dev); | ||
216 | struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev); | ||
217 | |||
218 | clk_enable(i_dev->clk); | ||
219 | i2c_dw_init(i_dev); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | #endif | ||
224 | |||
225 | static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume); | ||
226 | |||
201 | /* work with hotplug and coldplug */ | 227 | /* work with hotplug and coldplug */ |
202 | MODULE_ALIAS("platform:i2c_designware"); | 228 | MODULE_ALIAS("platform:i2c_designware"); |
203 | 229 | ||
@@ -207,6 +233,7 @@ static struct platform_driver dw_i2c_driver = { | |||
207 | .name = "i2c_designware", | 233 | .name = "i2c_designware", |
208 | .owner = THIS_MODULE, | 234 | .owner = THIS_MODULE, |
209 | .of_match_table = of_match_ptr(dw_i2c_of_match), | 235 | .of_match_table = of_match_ptr(dw_i2c_of_match), |
236 | .pm = &dw_i2c_dev_pm_ops, | ||
210 | }, | 237 | }, |
211 | }; | 238 | }; |
212 | 239 | ||