Commit ad90b6b0 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab

[media] saa7164: Improvements for I2C handling

Workaround oddball I2C issues caused by using newer
SILABS devices.
Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 8ed5e4e8
......@@ -1385,6 +1385,7 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg,
* 08... register address
*/
memset(buf, 0, sizeof(buf));
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment