From 5b954474ac80c8dfa27aada3353bd871d93226e6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 12 Sep 2004 14:50:42 +0000 Subject: Fixed dropouts on older DVB cards --- linux/drivers/media/dvb/frontends/ves1x93.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'linux') diff --git a/linux/drivers/media/dvb/frontends/ves1x93.c b/linux/drivers/media/dvb/frontends/ves1x93.c index 35d0019b4..6e74b25c8 100644 --- a/linux/drivers/media/dvb/frontends/ves1x93.c +++ b/linux/drivers/media/dvb/frontends/ves1x93.c @@ -453,6 +453,21 @@ static int ves1x93_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) fe_status_t *status = arg; u8 sync = ves1x93_readreg (i2c, 0x0e); + /* + * The ves1893 sometimes returns sync values that make no sense, + * because, e.g., the SIGNAL bit is 0, while some of the higher + * bits are 1 (and how can there be a CARRIER w/o a SIGNAL?). + * Tests showed that the the VITERBI and SYNC bits are returned + * reliably, while the SIGNAL and CARRIER bits ar sometimes wrong. + * If such a case occurs, we read the value again, until we get a + * valid value. + */ + int maxtry = 10; /* just for safety - let's not get stuck here */ + while ((sync & 0x03) != 0x03 && (sync & 0x0c) && maxtry--) { + msleep(10); + sync = ves1x93_readreg (i2c, 0x0e); + } + *status = 0; if (sync & 1) -- cgit v1.2.3