diff options
author | Alessandro Radicati <alessandro@radicati.net> | 2016-04-06 01:23:43 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-06-09 14:44:54 +0300 |
commit | 57f1c0533850c0d68d114353b3b3a61148498698 (patch) | |
tree | 5ba9b2b20afd78b016e3827e49a38e6482421504 /drivers | |
parent | 9f5a802b1d51dc80a27d828a5f7dcc8ec4a72f03 (diff) | |
download | linux-57f1c0533850c0d68d114353b3b3a61148498698.tar.xz |
[media] af9035: I2C combined write + read transaction fix
This patch will modify the af9035 driver to use the register address
fields of the I2C read command for the combined write/read transaction
case. Without this change, the firmware issues just a I2C read
transaction without the preceding write transaction to select the
register.
Signed-off-by: Alessandro Radicati <alessandro@radicati.net>
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/af9035.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 2638e3251f2a..09a549b49400 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -367,10 +367,25 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, memcpy(&buf[3], msg[0].buf, msg[0].len); } else { buf[1] = msg[0].addr << 1; - buf[2] = 0x00; /* reg addr len */ buf[3] = 0x00; /* reg addr MSB */ buf[4] = 0x00; /* reg addr LSB */ - memcpy(&buf[5], msg[0].buf, msg[0].len); + + /* Keep prev behavior for write req len > 2*/ + if (msg[0].len > 2) { + buf[2] = 0x00; /* reg addr len */ + memcpy(&buf[5], msg[0].buf, msg[0].len); + + /* Use reg addr fields if write req len <= 2 */ + } else { + req.wlen = 5; + buf[2] = msg[0].len; + if (msg[0].len == 2) { + buf[3] = msg[0].buf[0]; + buf[4] = msg[0].buf[1]; + } else if (msg[0].len == 1) { + buf[4] = msg[0].buf[0]; + } + } } ret = af9035_ctrl_msg(d, &req); } |