Commit 02512fe3 authored by Stefan Ringel's avatar Stefan Ringel Committed by Mauro Carvalho Chehab

V4L/DVB: tm6000: bugfix reading problems with demodulator zl10353

Reading from zl10353 with tm6000 has a bug. For example:

regs  w/o patch  with patch

0x06     0x00        0x7f
0x07     0x33        0x30
0x08     0x00        0x00
0x09     0x58        0x50
0x0f     0x31        0x28
0x10     0x00        0x84

This patch provides the workaround for the bug

[mchehab@redhat.com: Fix merge conflict and add a comment at the workaround]
Signed-off-by: default avatarStefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 4e11502d
...@@ -56,9 +56,23 @@ static int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr, ...@@ -56,9 +56,23 @@ static int tm6000_i2c_recv_regs(struct tm6000_core *dev, unsigned char addr,
__u8 reg, char *buf, int len) __u8 reg, char *buf, int len)
{ {
int rc; int rc;
u8 b[2];
if ((dev->caps.has_zl10353) && (dev->demod_addr << 1 == addr) && (reg % 2 == 0)) {
/*
* Workaround an I2C bug when reading from zl10353
*/
reg -= 1;
len += 1;
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, b, len);
*buf = b[1];
} else {
rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, rc = tm6000_read_write_usb(dev, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len); REQ_16_SET_GET_I2C_WR1_RDN, addr | reg << 8, 0, buf, len);
}
return rc; return rc;
} }
......
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