aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2012-07-24 08:13:59 -0400
committerJean Delvare <khali@endymion.delvare>2012-07-24 08:13:59 -0400
commitd47726c52122d64253ae56e0fafdb7d0b954e97c (patch)
treedef321285e0ef7f45772348fe7054942abfc81c8
parent68a7602f098c30cc27fbc336db575af63f1be07b (diff)
i2c: Add SCCB support
SCCB is a serial communication bus developed by Omnivision. Its 2-wire mode is very similar to SMBus byte data transactions, but requires the controller to ignore the ACK bit and to insert a stop condition after each message. Add a device SCCB flag and a message stop flag to be passed to controller drivers. [JD: Kill rogue definition in go7007 driver.] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r--drivers/i2c/i2c-core.c2
-rw-r--r--drivers/staging/media/go7007/wis-i2c.h5
-rw-r--r--include/linux/i2c.h3
3 files changed, 4 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a6ad32bc0a96..361978a8485a 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -2122,7 +2122,7 @@ s32 i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, unsigned short flags,
2122 int try; 2122 int try;
2123 s32 res; 2123 s32 res;
2124 2124
2125 flags &= I2C_M_TEN | I2C_CLIENT_PEC; 2125 flags &= I2C_M_TEN | I2C_CLIENT_PEC | I2C_CLIENT_SCCB;
2126 2126
2127 if (adapter->algo->smbus_xfer) { 2127 if (adapter->algo->smbus_xfer) {
2128 i2c_lock_adapter(adapter); 2128 i2c_lock_adapter(adapter);
diff --git a/drivers/staging/media/go7007/wis-i2c.h b/drivers/staging/media/go7007/wis-i2c.h
index 3c2b9be455df..6d09c06c8560 100644
--- a/drivers/staging/media/go7007/wis-i2c.h
+++ b/drivers/staging/media/go7007/wis-i2c.h
@@ -25,11 +25,6 @@
25#define I2C_DRIVERID_WIS_TW2804 0xf0f6 25#define I2C_DRIVERID_WIS_TW2804 0xf0f6
26#define I2C_DRIVERID_S2250 0xf0f7 26#define I2C_DRIVERID_S2250 0xf0f7
27 27
28/* Flag to indicate that the client needs to be accessed with SCCB semantics */
29/* We re-use the I2C_M_TEN value so the flag passes through the masks in the
30 * core I2C code. Major kludge, but the I2C layer ain't exactly flexible. */
31#define I2C_CLIENT_SCCB 0x10
32
33/* Definitions for new video decoder commands */ 28/* Definitions for new video decoder commands */
34 29
35struct video_decoder_resolution { 30struct video_decoder_resolution {
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index ddfa04108baf..1d0fe4877b1f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -425,6 +425,8 @@ void i2c_unlock_adapter(struct i2c_adapter *);
425#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ 425#define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */
426 /* Must equal I2C_M_TEN below */ 426 /* Must equal I2C_M_TEN below */
427#define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */ 427#define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */
428#define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */
429 /* Must match I2C_M_STOP|IGNORE_NAK */
428 430
429/* i2c adapter classes (bitmask) */ 431/* i2c adapter classes (bitmask) */
430#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */ 432#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
@@ -541,6 +543,7 @@ struct i2c_msg {
541 __u16 flags; 543 __u16 flags;
542#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */ 544#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
543#define I2C_M_RD 0x0001 /* read data, from slave to master */ 545#define I2C_M_RD 0x0001 /* read data, from slave to master */
546#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
544#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */ 547#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
545#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */ 548#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
546#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */ 549#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */