diff options
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/frontends/ves1820.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/linux/drivers/media/dvb/frontends/ves1820.c b/linux/drivers/media/dvb/frontends/ves1820.c index f9f1ced87..0deae0727 100644 --- a/linux/drivers/media/dvb/frontends/ves1820.c +++ b/linux/drivers/media/dvb/frontends/ves1820.c @@ -409,15 +409,29 @@ int ves1820_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) return ves1820_set_parameters (fe, arg); case FE_GET_FRONTEND: - /* XXX FIXME: implement! */ -/* - struct frontend *front = (struct frontend *)arg; - - front->afc=(int)((char)(readreg(client,0x19))); - front->afc=(front->afc*(int)(front->param.u.qam.SymbolRate/8))/128; -*/ - break; + { + struct dvb_frontend_parameters *p = (struct dvb_frontend_parameters *)arg; + u8 reg0 = GET_REG0(fe->data); + int sync; + s8 afc = 0; + + sync = ves1820_readreg (fe, 0x11); + if (sync & 2) + /* AFC only valid when carrier has been recovered */ + afc = ves1820_readreg(fe, 0x19); + printk ("VES1820: AFC %d\n", afc); + + p->inversion = reg0 & 0x20 ? INVERSION_OFF : INVERSION_ON; + 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. + p->frequency -= (s32)(p->u.qam.symbol_rate >> 3) * afc >> 7; + break; + } case FE_SLEEP: ves1820_writereg (fe, 0x1b, 0x02); /* pdown ADC */ ves1820_writereg (fe, 0x00, 0x80); /* standby */ |