diff options
-rw-r--r-- | linux/drivers/media/dvb/frontends/ves1820.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index 3471e0a08..9a7651bfb 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -19,6 +19,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <linux/config.h> +#include <linux/delay.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/kernel.h> @@ -70,7 +72,18 @@ static int verbose; #define GET_TUNER(data) ((u8) (((long) data >> 16) & 0xff)) #define GET_DEMOD_ADDR(data) ((u8) (((long) data >> 24) & 0xff)) +#if defined(CONFIG_DBOX2) +#define XIN 69600000UL +#define DISABLE_INVERSION(reg0) do { reg0 &= ~0x20; } while (0) +#define ENABLE_INVERSION(reg0) do { reg0 |= 0x20; } while (0) +#define HAS_INVERSION(reg0) (reg0 & 0x20) +#else /* PCI cards */ #define XIN 57840000UL +#define DISABLE_INVERSION(reg0) do { reg0 |= 0x20; } while (0) +#define ENABLE_INVERSION(reg0) do { reg0 &= ~0x20; } while (0) +#define HAS_INVERSION(reg0) (!(reg0 & 0x20)) +#endif + #define FIN (XIN >> 4) @@ -209,9 +222,9 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0, reg0 |= GET_REG0(fe->data) & 0x62; if (INVERSION_ON == inversion) - reg0 &= ~0x20; + ENABLE_INVERSION(reg0); else if (INVERSION_OFF == inversion) - reg0 |= 0x20; + DISABLE_INVERSION(reg0); ves1820_writereg (fe, 0x00, reg0 & 0xfe); ves1820_writereg (fe, 0x00, reg0 | 0x01); @@ -220,7 +233,7 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0, * check lock and toggle inversion bit if required... */ if (INVERSION_AUTO == inversion && !(ves1820_readreg (fe, 0x11) & 0x08)) { - dvb_delay(10); + mdelay(30); if (!(ves1820_readreg (fe, 0x11) & 0x08)) { reg0 ^= 0x20; ves1820_writereg (fe, 0x00, reg0 & 0xfe); @@ -242,6 +255,10 @@ static int ves1820_init (struct dvb_frontend *fe) ves1820_writereg (fe, 0, 0); +#if defined(CONFIG_DBOX2) + ves1820_inittab[2] &= ~0x08; +#endif + for (i=0; i<53; i++) ves1820_writereg (fe, i, ves1820_inittab[i]); @@ -330,6 +347,10 @@ static int ves1820_set_parameters (struct dvb_frontend *fe, ves1820_setup_reg0 (fe, reg0x00[real_qam], p->inversion); + /* yes, this speeds things up: userspace reports lock in about 8 ms + instead of 500 to 1200 ms after calling FE_SET_FRONTEND. */ + mdelay(30); + return 0; } @@ -419,14 +440,14 @@ static int ves1820_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) fe->i2c->adapter->num, afc, -((s32)(p->u.qam.symbol_rate >> 3) * afc >> 7)); - p->inversion = reg0 & 0x20 ? INVERSION_OFF : INVERSION_ON; + p->inversion = HAS_INVERSION(reg0) ? INVERSION_ON : INVERSION_OFF; p->u.qam.modulation = ((reg0 >> 2) & 7) + QAM_16; p->u.qam.fec_inner = FEC_NONE; p->frequency = ((p->frequency + 31250) / 62500) * 62500; - // To prevent overflow, shift symbol rate first a - // couple of bits. + /* To prevent overflow, shift symbol rate first a + couple of bits. */ p->frequency -= (s32)(p->u.qam.symbol_rate >> 3) * afc >> 7; break; } |