From: balbi@ti.com (Felipe Balbi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] i2c: omap: switch over to autosuspend API
Date: Tue, 7 Aug 2012 15:38:07 +0300 [thread overview]
Message-ID: <1344343087-8947-1-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <B5906170F1614E41A8A28DE3B8D121433EB3087D@DBDE01.ent.ti.com>
this helps us reduce unnecessary pm transitions
in case we have another i2c message starting soon.
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
drivers/i2c/busses/i2c-omap.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 60928f2..35e8207 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -55,6 +55,9 @@
/* timeout waiting for the controller to respond */
#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
+/* timeout for pm runtime autosuspend */
+#define OMAP_I2C_PM_TIMEOUT 1000 /* ms */
+
/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
enum {
OMAP_I2C_REV_REG = 0,
@@ -645,7 +648,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
omap_i2c_wait_for_bb(dev);
out:
- pm_runtime_put(dev->dev);
+ pm_runtime_mark_last_busy(dev->dev);
+ pm_runtime_put_autosuspend(dev->dev);
return r;
}
@@ -1113,6 +1117,9 @@ omap_i2c_probe(struct platform_device *pdev)
dev->regs = (u8 *)reg_map_ip_v1;
pm_runtime_enable(dev->dev);
+ pm_runtime_set_autosuspend_delay(dev->dev, OMAP_I2C_PM_TIMEOUT);
+ pm_runtime_use_autosuspend(dev->dev);
+
r = pm_runtime_get_sync(dev->dev);
if (IS_ERR_VALUE(r))
goto err_free_mem;
@@ -1189,7 +1196,8 @@ omap_i2c_probe(struct platform_device *pdev)
of_i2c_register_devices(adap);
- pm_runtime_put(dev->dev);
+ pm_runtime_mark_last_busy(dev->dev);
+ pm_runtime_put_autosuspend(dev->dev);
return 0;
--
1.7.12.rc0
next prev parent reply other threads:[~2012-08-07 12:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-06 14:18 [PATCH 0/4] i2c: omap: few more patches Felipe Balbi
2012-08-06 14:18 ` [PATCH 1/4] i2c: omap: always return IRQ_HANDLED Felipe Balbi
2012-08-06 14:18 ` [PATCH 2/4] i2c: omap: switch to threaded IRQ support Felipe Balbi
2012-08-06 14:18 ` [PATCH 3/4] i2c: omap: remove unnecessary pm_runtime_suspended check Felipe Balbi
2012-08-06 14:18 ` [PATCH 4/4] i2c: omap: switch over to autosuspend API Felipe Balbi
2012-08-07 11:38 ` Shubhrajyoti
2012-08-07 12:07 ` Felipe Balbi
2012-08-07 12:11 ` [PATCH] " Felipe Balbi
2012-08-07 12:34 ` Bedia, Vaibhav
2012-08-07 12:38 ` Felipe Balbi [this message]
2012-08-07 14:40 ` [PATCH v3] " Bedia, Vaibhav
2012-08-07 11:27 ` [PATCH 0/4] i2c: omap: few more patches Shubhrajyoti
-- strict thread matches above, loose matches on Subject: below --
2012-08-07 12:37 [PATCH v3] i2c: omap: switch over to autosuspend API Felipe Balbi
2012-08-07 12:38 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1344343087-8947-1-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).