aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSamu Onkalo <samu.p.onkalo@nokia.com>2010-11-18 05:04:20 -0500
committerBen Dooks <ben-linux@fluff.org>2011-01-03 20:16:53 -0500
commit6a91b558648cffa94227b4ff9c6c996930bbdfd2 (patch)
tree87cafe789da2d072a68ca03db65da31ac13422f2 /drivers
parent03ed6a3aa600c48593c3984812fda2d5945ddb46 (diff)
i2c-omap: Set latency requirements only once for several messages
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> Acked-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-omap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index b33c78586bfc..3e9323effc7c 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,
616 * REVISIT: We should abort the transfer on signals, but the bus goes 616 * REVISIT: We should abort the transfer on signals, but the bus goes
617 * into arbitration and we're currently unable to recover from it. 617 * into arbitration and we're currently unable to recover from it.
618 */ 618 */
619 if (dev->set_mpu_wkup_lat != NULL)
620 dev->set_mpu_wkup_lat(dev->dev, dev->latency);
621 r = wait_for_completion_timeout(&dev->cmd_complete, 619 r = wait_for_completion_timeout(&dev->cmd_complete,
622 OMAP_I2C_TIMEOUT); 620 OMAP_I2C_TIMEOUT);
623 if (dev->set_mpu_wkup_lat != NULL)
624 dev->set_mpu_wkup_lat(dev->dev, -1);
625 dev->buf_len = 0; 621 dev->buf_len = 0;
626 if (r < 0) 622 if (r < 0)
627 return r; 623 return r;
@@ -672,12 +668,18 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
672 if (r < 0) 668 if (r < 0)
673 goto out; 669 goto out;
674 670
671 if (dev->set_mpu_wkup_lat != NULL)
672 dev->set_mpu_wkup_lat(dev->dev, dev->latency);
673
675 for (i = 0; i < num; i++) { 674 for (i = 0; i < num; i++) {
676 r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); 675 r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1)));
677 if (r != 0) 676 if (r != 0)
678 break; 677 break;
679 } 678 }
680 679
680 if (dev->set_mpu_wkup_lat != NULL)
681 dev->set_mpu_wkup_lat(dev->dev, -1);
682
681 if (r == 0) 683 if (r == 0)
682 r = num; 684 r = num;
683 685