diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-11-04 09:03:22 -0500 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2007-11-04 09:03:22 -0500 |
commit | 09569d7cdf845441f5d37be1a42c1ef0fe84a61d (patch) | |
tree | 8a5d13a0e0458ca54e26e63e3b3cf495cf8be345 /linux/drivers | |
parent | 779c7c3abb145a410c6fa1daeee272ca752e160c (diff) | |
download | mediapointer-dvb-s2-09569d7cdf845441f5d37be1a42c1ef0fe84a61d.tar.gz mediapointer-dvb-s2-09569d7cdf845441f5d37be1a42c1ef0fe84a61d.tar.bz2 |
tda8290: rule out tda988x before detecting tda8290/tda8295
From: Michael Krufky <mkrufky@linuxtv.org>
To ensure prevention of detecting a tda9885/6/7 as a tda8290 or tda8295, we
will rule out the tda988x before testing the tda8290 / tda8295 id registers.
We read 8 bytes from the chip. If they are all equal, then it is not a
tda829x, or some other error has occurred.
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/tda8290.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/linux/drivers/media/video/tda8290.c b/linux/drivers/media/video/tda8290.c index e9928d82b..1754f572c 100644 --- a/linux/drivers/media/video/tda8290.c +++ b/linux/drivers/media/video/tda8290.c @@ -777,6 +777,22 @@ int tda829x_probe(struct tuner *t) unsigned char restore_9886[] = { 0x00, 0xd6, 0x30 }; unsigned char addr_dto_lsb = 0x07; unsigned char data; +#define PROBE_BUFFER_SIZE 8 + unsigned char buf[PROBE_BUFFER_SIZE]; + int i; + + /* rule out tda9887, which would return the same byte repeatedly */ + tuner_i2c_xfer_send(&i2c_props, soft_reset, 1); + tuner_i2c_xfer_recv(&i2c_props, buf, PROBE_BUFFER_SIZE); + for (i = 1; i < PROBE_BUFFER_SIZE; i++) { + if (buf[i] == buf[0]) + continue; + break; + } + + /* all bytes are equal, not a tda829x - probably a tda9887 */ + if (i == PROBE_BUFFER_SIZE) + return -ENODEV; if ((tda8290_probe(&i2c_props) == 0) || (tda8295_probe(&i2c_props) == 0)) |