aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c27
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 4ba589ab861..f08d0248cf6 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[] = {
198MODULE_DEVICE_TABLE(of, dw_i2c_of_match); 199MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
199#endif 200#endif
200 201
202#ifdef CONFIG_PM
203static 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
213static 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
225static 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 */
202MODULE_ALIAS("platform:i2c_designware"); 228MODULE_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