diff options
Diffstat (limited to 'linux/drivers/media/dvb/frontends')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0299.c | 75 |
1 files changed, 50 insertions, 25 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 0e36585c8..6d7ae9517 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -57,6 +57,11 @@ #define dprintk(x...) #endif +static int stv0299_status = 0; + +#define STATUS_BER 0 +#define STATUS_UCBLOCKS 1 + /* frontend types */ #define UNKNOWN_FRONTEND -1 @@ -498,8 +503,8 @@ static int stv0299_init (struct dvb_i2c_bus *i2c, int ftype) dprintk("stv0299: init chip\n"); - if(ftype == SAMSUNG_TBMU24112IMB) - { + switch(ftype) { + case SAMSUNG_TBMU24112IMB: dprintk("%s: init stv0299 chip for Samsung TBMU24112IMB\n", __FUNCTION__); for (i=0; i<sizeof(init_tab_samsung); i+=2) @@ -508,26 +513,35 @@ static int stv0299_init (struct dvb_i2c_bus *i2c, int ftype) stv0299_writereg (i2c, init_tab_samsung[i], init_tab_samsung[i+1]); } + break; - return 0; + default: + stv0299_writereg (i2c, 0x01, 0x15); + stv0299_writereg (i2c, 0x02, ftype == PHILIPS_SU1278 ? 0x00 : 0x30); + stv0299_writereg (i2c, 0x03, 0x00); + + for (i=0; i<sizeof(init_tab); i+=2) + stv0299_writereg (i2c, init_tab[i], init_tab[i+1]); + + /* AGC1 reference register setup */ + if (ftype == PHILIPS_SU1278SH) + stv0299_writereg (i2c, 0x0f, 0x92); /* Iagc = Inverse, m1 = 18 */ + else if (ftype == PHILIPS_SU1278) + stv0299_writereg (i2c, 0x0f, 0x94); /* Iagc = Inverse, m1 = 20 */ + else + stv0299_writereg (i2c, 0x0f, 0x52); /* Iagc = Normal, m1 = 18 */ + break; + } + + switch(stv0299_status) { + case STATUS_BER: + stv0299_writereg(i2c, 0x34, 0x93); + break; + + case STATUS_UCBLOCKS: + stv0299_writereg(i2c, 0x34, 0xB3); + break; } - - stv0299_writereg (i2c, 0x01, 0x15); - stv0299_writereg (i2c, 0x02, ftype == PHILIPS_SU1278 ? 0x00 : 0x30); - stv0299_writereg (i2c, 0x03, 0x00); - - for (i=0; i<sizeof(init_tab); i+=2) - stv0299_writereg (i2c, init_tab[i], init_tab[i+1]); - - /* AGC1 reference register setup */ - if (ftype == PHILIPS_SU1278SH) - stv0299_writereg (i2c, 0x0f, 0x92); /* Iagc = Inverse, m1 = 18 */ - else if (ftype == PHILIPS_SU1278) - stv0299_writereg (i2c, 0x0f, 0x94); /* Iagc = Inverse, m1 = 20 */ - else - stv0299_writereg (i2c, 0x0f, 0x52); /* Iagc = Normal, m1 = 18 */ - - return 0; } @@ -906,9 +920,13 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) break; } - case FE_READ_BER: - *((u32*) arg) = (stv0299_readreg (i2c, 0x1d) << 8) - | stv0299_readreg (i2c, 0x1e); + case FE_READ_BER: + if (stv0299_status == STATUS_BER) { + *((u32*) arg) = (stv0299_readreg (i2c, 0x1d) << 8) + | stv0299_readreg (i2c, 0x1e); + } else { + *((u32*) arg) = 0; + } break; case FE_READ_SIGNAL_STRENGTH: @@ -935,8 +953,13 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) break; } case FE_READ_UNCORRECTED_BLOCKS: - *((u32*) arg) = 0; /* the stv0299 can't measure BER and */ - return -EOPNOTSUPP; /* errors at the same time.... */ + if (stv0299_status == STATUS_UCBLOCKS) { + *((u32*) arg) = (stv0299_readreg (i2c, 0x1d) << 8) + | stv0299_readreg (i2c, 0x1e); + } else { + *((u32*) arg) = 0; + } + break; case FE_SET_FRONTEND: { @@ -1123,3 +1146,5 @@ MODULE_DESCRIPTION("Universal STV0299/TSA5059/SL1935 DVB Frontend driver"); MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, Andreas Oberritter"); MODULE_LICENSE("GPL"); +MODULE_PARM(stv0299_status, "i"); +MODULE_PARM_DESC(stv0299_status, "Which status value to support (0: BER, 1: UCBLOCKS)"); |