public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Samu Onkalo <samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
To: khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 1/2] drivers: i2c-core: Add a flag to allow short timeout
Date: Wed, 13 Oct 2010 16:45:09 +0300	[thread overview]
Message-ID: <1286977510-16702-2-git-send-email-samu.p.onkalo@nokia.com> (raw)
In-Reply-To: <1286977510-16702-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>

A flag for i2c-messages to allow short time out. Some chips causes
time out always with certain kind of operations (like sw-reset commands).
There is no point of waiting full timeout in that case.
When I2C message is send with I2C_M_SHORT_TIME out flag, adapter is allowed
to use shorter timeout and release the bus faster.

Signed-off-by: Samu Onkalo <samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/i2c-core.c |    2 +-
 include/linux/i2c.h    |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 6649176..8c0e443 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -2077,7 +2077,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags,
 	int try;
 	s32 res;
 
-	flags &= I2C_M_TEN | I2C_CLIENT_PEC;
+	flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_M_SHORT_TIMEOUT;
 
 	if (adapter->algo->smbus_xfer) {
 		i2c_lock_adapter(adapter);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 4bae0b7..5fc016a 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -514,6 +514,7 @@ struct i2c_msg {
 #define I2C_M_IGNORE_NAK	0x1000	/* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_NO_RD_ACK		0x0800	/* if I2C_FUNC_PROTOCOL_MANGLING */
 #define I2C_M_RECV_LEN		0x0400	/* length will be first received byte */
+#define I2C_M_SHORT_TIMEOUT	0x0200	/* Use with known timeout cases */
 	__u16 len;		/* msg length				*/
 	__u8 *buf;		/* pointer to msg data			*/
 };
-- 
1.6.0.4

  parent reply	other threads:[~2010-10-13 13:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-13 13:45 [PATCH 0/2] Short timeout for I2C transfers Samu Onkalo
     [not found] ` <1286977510-16702-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-10-13 13:45   ` Samu Onkalo [this message]
2010-10-13 13:45   ` [PATCH 2/2] drivers: i2c-omap: Add support for shorten I2C timeout Samu Onkalo
2010-10-15 12:51   ` [PATCH 0/2] Short timeout for I2C transfers Jean Delvare
     [not found]     ` <20101015145149.2f688c9d-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-10-18  8:48       ` samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w
     [not found]         ` <62697B07E9803846BC582181BD6FB6B835EFD27C35-xJW1crHCIS+8kqYwC468Frtp2NbXvJi8gfoxzgwHRXE@public.gmane.org>
2010-10-18  9:38           ` samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w

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=1286977510-16702-2-git-send-email-samu.p.onkalo@nokia.com \
    --to=samu.p.onkalo-xnzwkgviw5gavxtiumwx3w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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