aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2014-05-15 10:37:23 -0400
committerWolfram Sang <wsa@the-dreams.de>2014-06-02 13:18:39 -0400
commit1fc2fe204cb9d8010e70716aa48b5c3db6379da3 (patch)
tree49ec06b9ace6dac7a955230865c2fb9dba0a7e3a /drivers/i2c
parentf537295a58ddc4460b9857c6e4a6959685447f3b (diff)
i2c: designware: Add runtime PM hooks
It is possible that after entering runtime PM suspend the controller context is lost due the fact that its power is removed. This happens for example on Asus T100, an Intel Baytrail based tablet/laptop. In order to get the controller back to functional state, we need to implement runtime PM hooks which will re-initialize the hardware during runtime PM resume. We can re-use the existing system suspend hooks as the steps to resume/suspend the controller are the same. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-designware-platdrv.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index f72102f389c5..402ec3970fed 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -247,7 +247,7 @@ static const struct of_device_id dw_i2c_of_match[] = {
247MODULE_DEVICE_TABLE(of, dw_i2c_of_match); 247MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
248#endif 248#endif
249 249
250#ifdef CONFIG_PM_SLEEP 250#ifdef CONFIG_PM
251static int dw_i2c_suspend(struct device *dev) 251static int dw_i2c_suspend(struct device *dev)
252{ 252{
253 struct platform_device *pdev = to_platform_device(dev); 253 struct platform_device *pdev = to_platform_device(dev);
@@ -269,13 +269,11 @@ static int dw_i2c_resume(struct device *dev)
269 269
270 return 0; 270 return 0;
271} 271}
272
273static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);
274#define DW_I2C_DEV_PM_OPS (&dw_i2c_dev_pm_ops)
275#else
276#define DW_I2C_DEV_PM_OPS NULL
277#endif 272#endif
278 273
274static UNIVERSAL_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend,
275 dw_i2c_resume, NULL);
276
279/* work with hotplug and coldplug */ 277/* work with hotplug and coldplug */
280MODULE_ALIAS("platform:i2c_designware"); 278MODULE_ALIAS("platform:i2c_designware");
281 279
@@ -287,7 +285,7 @@ static struct platform_driver dw_i2c_driver = {
287 .owner = THIS_MODULE, 285 .owner = THIS_MODULE,
288 .of_match_table = of_match_ptr(dw_i2c_of_match), 286 .of_match_table = of_match_ptr(dw_i2c_of_match),
289 .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match), 287 .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match),
290 .pm = DW_I2C_DEV_PM_OPS, 288 .pm = &dw_i2c_dev_pm_ops,
291 }, 289 },
292}; 290};
293 291