diff options
author | Steven Toth <stoth@kernellabs.com> | 2015-03-23 21:42:53 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-05-01 13:20:28 +0300 |
commit | ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7 (patch) | |
tree | 593558cc23940d5b892abf847bba7c154d8819d9 | |
parent | 8ed5e4e89c321cd7eab936517dc7e3a249299e24 (diff) | |
download | linux-ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7.tar.xz |
[media] saa7164: Improvements for I2C handling
Workaround oddball I2C issues caused by using newer
SILABS devices.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/pci/saa7164/saa7164-api.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/media/pci/saa7164/saa7164-api.c b/drivers/media/pci/saa7164/saa7164-api.c index 97bbd0a13d62..d9e21e736d1f 100644 --- a/drivers/media/pci/saa7164/saa7164-api.c +++ b/drivers/media/pci/saa7164/saa7164-api.c @@ -1385,7 +1385,8 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg, * 08... register address */ memset(buf, 0, sizeof(buf)); - memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen); + if (reg) + memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen); *((u32 *)(buf + 0 * sizeof(u32))) = reglen; *((u32 *)(buf + 1 * sizeof(u32))) = datalen; @@ -1473,6 +1474,14 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 addr, u32 datalen, * 04-07 dest bytes to write * 08... register address */ + if (datalen == 1) { + /* Workaround for issues with i2c components + * that issue writes with no data. IE: SI2168/2157 + * Increase reglen by 1, strobe out an additional byte, + * ignored by SI2168/2157. + */ + datalen++; + } *((u32 *)(buf + 0 * sizeof(u32))) = reglen; *((u32 *)(buf + 1 * sizeof(u32))) = datalen - reglen; memcpy((buf + 2 * sizeof(u32)), data, datalen); |