aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2012-09-12 06:58:15 -0400
committerWolfram Sang <w.sang@pengutronix.de>2012-09-12 09:04:10 -0400
commit6d8451d55a2a9467bc9647aafe8b6faee0251687 (patch)
tree43cc514aefef7427a5047a7f366f2e463247b4b4 /drivers/i2c
parente3a36b207f76364c281aeecaf14c1b22a7247278 (diff)
i2c: omap: switch over to autosuspend API
this helps us reduce unnecessary pm transitions in case we have another i2c message starting soon. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-omap.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 6d38a570dc1..122f517c5bc 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -55,6 +55,9 @@
55/* timeout waiting for the controller to respond */ 55/* timeout waiting for the controller to respond */
56#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) 56#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
57 57
58/* timeout for pm runtime autosuspend */
59#define OMAP_I2C_PM_TIMEOUT 1000 /* ms */
60
58/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */ 61/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
59enum { 62enum {
60 OMAP_I2C_REV_REG = 0, 63 OMAP_I2C_REV_REG = 0,
@@ -645,7 +648,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
645 648
646 omap_i2c_wait_for_bb(dev); 649 omap_i2c_wait_for_bb(dev);
647out: 650out:
648 pm_runtime_put(dev->dev); 651 pm_runtime_mark_last_busy(dev->dev);
652 pm_runtime_put_autosuspend(dev->dev);
649 return r; 653 return r;
650} 654}
651 655
@@ -1113,6 +1117,9 @@ omap_i2c_probe(struct platform_device *pdev)
1113 dev->regs = (u8 *)reg_map_ip_v1; 1117 dev->regs = (u8 *)reg_map_ip_v1;
1114 1118
1115 pm_runtime_enable(dev->dev); 1119 pm_runtime_enable(dev->dev);
1120 pm_runtime_set_autosuspend_delay(dev->dev, OMAP_I2C_PM_TIMEOUT);
1121 pm_runtime_use_autosuspend(dev->dev);
1122
1116 r = pm_runtime_get_sync(dev->dev); 1123 r = pm_runtime_get_sync(dev->dev);
1117 if (IS_ERR_VALUE(r)) 1124 if (IS_ERR_VALUE(r))
1118 goto err_free_mem; 1125 goto err_free_mem;
@@ -1190,7 +1197,8 @@ omap_i2c_probe(struct platform_device *pdev)
1190 1197
1191 of_i2c_register_devices(adap); 1198 of_i2c_register_devices(adap);
1192 1199
1193 pm_runtime_put(dev->dev); 1200 pm_runtime_mark_last_busy(dev->dev);
1201 pm_runtime_put_autosuspend(dev->dev);
1194 1202
1195 return 0; 1203 return 0;
1196 1204