* [PATCH] i2c-omap: Set latency requirements only once for several messages
@ 2010-11-18 10:04 Samu Onkalo
[not found] ` <1290074660-2640-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Samu Onkalo @ 2010-11-18 10:04 UTC (permalink / raw)
To: ben-linux-elnMNo+KYs3YtjvyW6yDsg
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR,
paul-DWxLp4Yu+b8AvxtiuMwx3w, linux-omap-u79uwXL29TY76Z2rM5mHXA
Ordinary I2C read consist of two messages. First a write operation
to tell register address and then read operation to get data.
CPU wake up latency is set and removed twice in read case.
Set latency requirement before the message processing loop
and remove the requirement after the loop to remove latency
adjustment operations between the messages.
Signed-off-by: Samu Onkalo <samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Acked-by: Kevin Hilman <khilman-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
Acked-by: Paul Walmsley <paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org>
---
drivers/i2c/busses/i2c-omap.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b33c785..3e9323e 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -616,12 +616,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
* REVISIT: We should abort the transfer on signals, but the bus goes
* into arbitration and we're currently unable to recover from it.
*/
- if (dev->set_mpu_wkup_lat != NULL)
- dev->set_mpu_wkup_lat(dev->dev, dev->latency);
r = wait_for_completion_timeout(&dev->cmd_complete,
OMAP_I2C_TIMEOUT);
- if (dev->set_mpu_wkup_lat != NULL)
- dev->set_mpu_wkup_lat(dev->dev, -1);
dev->buf_len = 0;
if (r < 0)
return r;
@@ -672,12 +668,18 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
if (r < 0)
goto out;
+ if (dev->set_mpu_wkup_lat != NULL)
+ dev->set_mpu_wkup_lat(dev->dev, dev->latency);
+
for (i = 0; i < num; i++) {
r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
if (r != 0)
break;
}
+ if (dev->set_mpu_wkup_lat != NULL)
+ dev->set_mpu_wkup_lat(dev->dev, -1);
+
if (r == 0)
r = num;
--
1.6.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH] i2c-omap: Set latency requirements only once for several messages
@ 2010-11-16 8:28 Samu Onkalo
2010-11-16 10:58 ` Paul Walmsley
2010-11-16 16:19 ` Kevin Hilman
0 siblings, 2 replies; 7+ messages in thread
From: Samu Onkalo @ 2010-11-16 8:28 UTC (permalink / raw)
To: tony; +Cc: linux-omap, samu.p.onkalo
Ordinary I2C read consist of two messages. First a write operation
to tell register address and then read operation to get data.
CPU wake up latency is set and removed twice in read case.
Set latency requirement before the message processing loop
and remove the requirement after the loop to remove latency
adjustment operations between the messages.
Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b33c785..3e9323e 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -616,12 +616,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
* REVISIT: We should abort the transfer on signals, but the bus goes
* into arbitration and we're currently unable to recover from it.
*/
- if (dev->set_mpu_wkup_lat != NULL)
- dev->set_mpu_wkup_lat(dev->dev, dev->latency);
r = wait_for_completion_timeout(&dev->cmd_complete,
OMAP_I2C_TIMEOUT);
- if (dev->set_mpu_wkup_lat != NULL)
- dev->set_mpu_wkup_lat(dev->dev, -1);
dev->buf_len = 0;
if (r < 0)
return r;
@@ -672,12 +668,18 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
if (r < 0)
goto out;
+ if (dev->set_mpu_wkup_lat != NULL)
+ dev->set_mpu_wkup_lat(dev->dev, dev->latency);
+
for (i = 0; i < num; i++) {
r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
if (r != 0)
break;
}
+ if (dev->set_mpu_wkup_lat != NULL)
+ dev->set_mpu_wkup_lat(dev->dev, -1);
+
if (r == 0)
r = num;
--
1.6.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] i2c-omap: Set latency requirements only once for several messages
2010-11-16 8:28 Samu Onkalo
@ 2010-11-16 10:58 ` Paul Walmsley
2010-11-16 16:19 ` Kevin Hilman
1 sibling, 0 replies; 7+ messages in thread
From: Paul Walmsley @ 2010-11-16 10:58 UTC (permalink / raw)
To: Samu Onkalo; +Cc: tony, linux-omap
On Tue, 16 Nov 2010, Samu Onkalo wrote:
> Ordinary I2C read consist of two messages. First a write operation
> to tell register address and then read operation to get data.
> CPU wake up latency is set and removed twice in read case.
> Set latency requirement before the message processing loop
> and remove the requirement after the loop to remove latency
> adjustment operations between the messages.
>
> Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Paul Walmsley <paul@pwsan.com>
- Paul
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c-omap: Set latency requirements only once for several messages
2010-11-16 8:28 Samu Onkalo
2010-11-16 10:58 ` Paul Walmsley
@ 2010-11-16 16:19 ` Kevin Hilman
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Hilman @ 2010-11-16 16:19 UTC (permalink / raw)
To: Samu Onkalo; +Cc: tony, linux-omap
Samu Onkalo <samu.p.onkalo@nokia.com> writes:
> Ordinary I2C read consist of two messages. First a write operation
> to tell register address and then read operation to get data.
> CPU wake up latency is set and removed twice in read case.
> Set latency requirement before the message processing loop
> and remove the requirement after the loop to remove latency
> adjustment operations between the messages.
>
> Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Acked-by: Kevin Hilman <khilman@deeprootsystems.com>
Samu,
Can you collect the acks and repost to linux-i2c@vger.kernel.org
and Cc Ben Dooks <ben-linux@fluff.org>.
This one should go upstream via Ben.
Thanks,
Kevin
> ---
> drivers/i2c/busses/i2c-omap.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index b33c785..3e9323e 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -616,12 +616,8 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
> * REVISIT: We should abort the transfer on signals, but the bus goes
> * into arbitration and we're currently unable to recover from it.
> */
> - if (dev->set_mpu_wkup_lat != NULL)
> - dev->set_mpu_wkup_lat(dev->dev, dev->latency);
> r = wait_for_completion_timeout(&dev->cmd_complete,
> OMAP_I2C_TIMEOUT);
> - if (dev->set_mpu_wkup_lat != NULL)
> - dev->set_mpu_wkup_lat(dev->dev, -1);
> dev->buf_len = 0;
> if (r < 0)
> return r;
> @@ -672,12 +668,18 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
> if (r < 0)
> goto out;
>
> + if (dev->set_mpu_wkup_lat != NULL)
> + dev->set_mpu_wkup_lat(dev->dev, dev->latency);
> +
> for (i = 0; i < num; i++) {
> r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
> if (r != 0)
> break;
> }
>
> + if (dev->set_mpu_wkup_lat != NULL)
> + dev->set_mpu_wkup_lat(dev->dev, -1);
> +
> if (r == 0)
> r = num;
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-03 8:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 10:04 [PATCH] i2c-omap: Set latency requirements only once for several messages Samu Onkalo
[not found] ` <1290074660-2640-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-12-03 2:37 ` Ben Dooks
[not found] ` <20101203023751.GF20097-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-12-03 6:43 ` samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w
2010-12-03 8:31 ` Paul Walmsley
-- strict thread matches above, loose matches on Subject: below --
2010-11-16 8:28 Samu Onkalo
2010-11-16 10:58 ` Paul Walmsley
2010-11-16 16:19 ` Kevin Hilman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.