From: Shubhrajyoti D <shubhrajyoti@ti.com> To: linux-omap@vger.kernel.org Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ben-linux@fluff.org, tony@atomide.com, w.sang@pengutronix.de, Felipe Balbi <balbi@ti.com>, Shubhrajyoti D <shubhrajyoti@ti.com> Subject: [RFC PATCH 2/3] i2c: omap: implement handling for 'actual' bytes transferred Date: Fri, 29 Jun 2012 16:35:26 +0530 [thread overview] Message-ID: <1340967927-27354-3-git-send-email-shubhrajyoti@ti.com> (raw) In-Reply-To: <1340967927-27354-1-git-send-email-shubhrajyoti@ti.com> From: Felipe Balbi <balbi@ti.com> this is important in cases where client driver wants to know how many bytes were actually transferred. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> --- drivers/i2c/busses/i2c-omap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 266bba7..fc726a6 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -189,6 +189,7 @@ struct omap_i2c_dev { u8 *buf; u8 *regs; size_t buf_len; + u16 actual; struct i2c_adapter adapter; u8 threshold; u8 fifo_size; /* use as flag and value @@ -601,6 +602,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, omap_i2c_init(dev); return -ETIMEDOUT; } + msg->actual = dev->actual; if (likely(!dev->cmd_err)) return 0; @@ -828,6 +830,7 @@ static void omap_i2c_receive_data(struct omap_i2c_dev *dev, u8 num_bytes, w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); *dev->buf++ = w; dev->buf_len--; + dev->actual++; /* * Data reg in 2430, omap3 and @@ -848,6 +851,7 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes, while (num_bytes--) { w = *dev->buf++; dev->buf_len--; + dev->actual++; /* * Data reg in 2430, omap3 and @@ -908,6 +912,7 @@ omap_i2c_isr(int this_irq, void *dev_id) if (stat & OMAP_I2C_STAT_NACK) { err |= OMAP_I2C_STAT_NACK; + dev->actual--; omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); goto out; } -- 1.7.5.4
WARNING: multiple messages have this Message-ID (diff)
From: shubhrajyoti@ti.com (Shubhrajyoti D) To: linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 2/3] i2c: omap: implement handling for 'actual' bytes transferred Date: Fri, 29 Jun 2012 16:35:26 +0530 [thread overview] Message-ID: <1340967927-27354-3-git-send-email-shubhrajyoti@ti.com> (raw) In-Reply-To: <1340967927-27354-1-git-send-email-shubhrajyoti@ti.com> From: Felipe Balbi <balbi@ti.com> this is important in cases where client driver wants to know how many bytes were actually transferred. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> --- drivers/i2c/busses/i2c-omap.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 266bba7..fc726a6 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -189,6 +189,7 @@ struct omap_i2c_dev { u8 *buf; u8 *regs; size_t buf_len; + u16 actual; struct i2c_adapter adapter; u8 threshold; u8 fifo_size; /* use as flag and value @@ -601,6 +602,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap, omap_i2c_init(dev); return -ETIMEDOUT; } + msg->actual = dev->actual; if (likely(!dev->cmd_err)) return 0; @@ -828,6 +830,7 @@ static void omap_i2c_receive_data(struct omap_i2c_dev *dev, u8 num_bytes, w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); *dev->buf++ = w; dev->buf_len--; + dev->actual++; /* * Data reg in 2430, omap3 and @@ -848,6 +851,7 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes, while (num_bytes--) { w = *dev->buf++; dev->buf_len--; + dev->actual++; /* * Data reg in 2430, omap3 and @@ -908,6 +912,7 @@ omap_i2c_isr(int this_irq, void *dev_id) if (stat & OMAP_I2C_STAT_NACK) { err |= OMAP_I2C_STAT_NACK; + dev->actual--; omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK); goto out; } -- 1.7.5.4
next prev parent reply other threads:[~2012-06-29 11:05 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-06-29 11:05 [RFC PATCH 0/3] I2C: Report the actual transferred bytes Shubhrajyoti D 2012-06-29 11:05 ` Shubhrajyoti D [not found] ` <1340967927-27354-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-06-29 11:05 ` [RFC PATCH 1/3] i2c: add 'actual' field to struct i2c_msg Shubhrajyoti D 2012-06-29 11:05 ` Shubhrajyoti D [not found] ` <1340967927-27354-2-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-06-29 12:33 ` Jean Delvare 2012-06-29 12:33 ` Jean Delvare 2012-07-02 13:27 ` Jean Delvare 2012-07-02 13:27 ` Jean Delvare 2012-06-29 11:05 ` Shubhrajyoti D [this message] 2012-06-29 11:05 ` [RFC PATCH 2/3] i2c: omap: implement handling for 'actual' bytes transferred Shubhrajyoti D 2012-06-29 11:05 ` [RFC PATCH 3/3] i2c: inititalise the actual transferred to zero Shubhrajyoti D 2012-06-29 11:05 ` Shubhrajyoti D 2012-06-29 12:40 ` Jean Delvare 2012-06-29 12:40 ` Jean Delvare [not found] ` <20120629144002.3b4a31ee-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 2012-06-29 12:57 ` Jean Delvare 2012-06-29 12:57 ` Jean Delvare 2012-06-29 13:12 ` Shubhrajyoti 2012-06-29 13:12 ` Shubhrajyoti [not found] ` <4FEDA9A8.1050504-l0cyMroinI0@public.gmane.org> 2012-06-29 13:18 ` Jean Delvare 2012-06-29 13:18 ` Jean Delvare 2012-07-02 11:54 ` Felipe Balbi 2012-07-02 11:54 ` Felipe Balbi [not found] ` <20120702115422.GC2730-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org> 2012-07-02 13:20 ` Jean Delvare 2012-07-02 13:20 ` Jean Delvare 2012-07-16 8:17 ` Felipe Balbi 2012-07-16 8:17 ` 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=1340967927-27354-3-git-send-email-shubhrajyoti@ti.com \ --to=shubhrajyoti@ti.com \ --cc=balbi@ti.com \ --cc=ben-linux@fluff.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-i2c@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=tony@atomide.com \ --cc=w.sang@pengutronix.de \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.