Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a818e1c8f7fcb42866a8630c508caddaa8edb331
Commit:     a818e1c8f7fcb42866a8630c508caddaa8edb331
Parent:     1f3a4e328549cb85aa032c4ee5dfda7886754154
Author:     Michael Krufky <[EMAIL PROTECTED]>
AuthorDate: Sun Nov 4 11:03:22 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:01:58 2008 -0200

    V4L/DVB (6551): tda8290: rule out tda988x before detecting tda8290/tda8295
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/tda8290.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index 18e6a09..f0191ba 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -746,6 +746,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))
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to