diff options
author | Johannes Stezenbach <devnull@localhost> | 2004-03-19 17:13:54 +0000 |
---|---|---|
committer | Johannes Stezenbach <devnull@localhost> | 2004-03-19 17:13:54 +0000 |
commit | 7d9a2810f1565116411b198b0e6087f3b1e6090f (patch) | |
tree | 7d4c733d653a095bb1502918b4ff3bb2f4c33d73 /linux/drivers/media/dvb/frontends/stv0299.c | |
parent | 5e5a147d453e63c0592b18c3ab4bc6e39bcc8e5f (diff) | |
download | mediapointer-dvb-s2-7d9a2810f1565116411b198b0e6087f3b1e6090f.tar.gz mediapointer-dvb-s2-7d9a2810f1565116411b198b0e6087f3b1e6090f.tar.bz2 |
patch by Kenneth Aafløy to add support for Typhoon DVB-S budget card
Diffstat (limited to 'linux/drivers/media/dvb/frontends/stv0299.c')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0299.c | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 90b214964..42452b239 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -62,6 +62,7 @@ #endif static int stv0299_status = 0; +static int disable_typhoon = 0; #define STATUS_BER 0 #define STATUS_UCBLOCKS 1 @@ -75,6 +76,7 @@ static int stv0299_status = 0; #define PHILIPS_SU1278_TUA 3 // SU1278 with TUA6100 synth #define SAMSUNG_TBMU24112IMB 4 #define PHILIPS_SU1278_TSA_TT 5 // SU1278 with TSA5059 synth and TechnoTrend settings +#define PHILIPS_SU1278_TSA_TY 6 // SU1278 with TUA5059 synth and Typhoon wiring /* Master Clock = 88 MHz */ #define M_CLK (88000000UL) @@ -386,7 +388,12 @@ static int tsa5059_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype, in switch(ftype) { case PHILIPS_SU1278_TSA: case PHILIPS_SU1278_TSA_TT: - addr = 0x60; + case PHILIPS_SU1278_TSA_TY: + if (ftype == PHILIPS_SU1278_TSA_TY) + addr = 0x61; + else + addr = 0x60; + buf[3] |= 0x20; if (srate < 4000000) buf[3] |= 1; @@ -609,7 +616,7 @@ static int stv0299_init (struct dvb_i2c_bus *i2c, int ftype) stv0299_writereg (i2c, init_tab[i], init_tab[i+1]); /* AGC1 reference register setup */ - if (ftype == PHILIPS_SU1278_TSA) + if (ftype == PHILIPS_SU1278_TSA || ftype == PHILIPS_SU1278_TSA_TY) stv0299_writereg (i2c, 0x0f, 0x92); /* Iagc = Inverse, m1 = 18 */ else if (ftype == PHILIPS_SU1278_TUA) stv0299_writereg (i2c, 0x0f, 0x94); /* Iagc = Inverse, m1 = 20 */ @@ -821,7 +828,8 @@ static int stv0299_set_tone (struct dvb_i2c_bus *i2c, fe_sec_tone_mode_t tone) } -static int stv0299_set_voltage (struct dvb_i2c_bus *i2c, fe_sec_voltage_t voltage) +static int stv0299_set_voltage (struct dvb_i2c_bus *i2c, fe_sec_voltage_t voltage, + int tuner_type) { u8 reg0x08; u8 reg0x0c; @@ -832,28 +840,32 @@ static int stv0299_set_voltage (struct dvb_i2c_bus *i2c, fe_sec_voltage_t voltag reg0x08 = stv0299_readreg (i2c, 0x08); reg0x0c = stv0299_readreg (i2c, 0x0c); - + /** * H/V switching over OP0, OP1 and OP2 are LNB power enable bits */ reg0x0c &= 0x0f; if (voltage == SEC_VOLTAGE_OFF) { - stv0299_writereg (i2c, 0x08, reg0x08 & ~0x40); - return stv0299_writereg (i2c, 0x0c, reg0x0c & ~0x40); - } else { - stv0299_writereg (i2c, 0x08, reg0x08 | 0x40); - reg0x0c |= 0x40; /* LNB power on */ + stv0299_writereg (i2c, 0x0c, 0x00); /* LNB power off! */ + return stv0299_writereg (i2c, 0x08, 0x00); /* LNB power off! */ + } + + stv0299_writereg (i2c, 0x08, reg0x08 | 0x40); - switch (voltage) { - case SEC_VOLTAGE_13: - return stv0299_writereg (i2c, 0x0c, reg0x0c); - case SEC_VOLTAGE_18: + switch (voltage) { + case SEC_VOLTAGE_13: + if (tuner_type == PHILIPS_SU1278_TSA_TY) return stv0299_writereg (i2c, 0x0c, reg0x0c | 0x10); - default: - return -EINVAL; - }; - } + else + return stv0299_writereg (i2c, 0x0c, reg0x0c | 0x40); + + case SEC_VOLTAGE_18: + return stv0299_writereg (i2c, 0x0c, reg0x0c | 0x50); + + default: + return -EINVAL; + }; } @@ -908,6 +920,7 @@ static int stv0299_set_symbolrate (struct dvb_i2c_bus *i2c, u32 srate, int tuner stv0299_writereg (i2c, 0x21, (ratio ) & 0xf0); break; + case PHILIPS_SU1278_TSA_TY: case PHILIPS_SU1278_TSA: aclk = 0xb5; if (srate < 2000000) bclk = 0x86; @@ -1196,7 +1209,8 @@ static int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) return stv0299_set_tone (i2c, (fe_sec_tone_mode_t) arg); case FE_SET_VOLTAGE: - return stv0299_set_voltage (i2c, (fe_sec_voltage_t) arg); + return stv0299_set_voltage (i2c, (fe_sec_voltage_t) arg, + state->tuner_type); case FE_GET_TUNE_SETTINGS: { @@ -1269,18 +1283,28 @@ static long probe_tuner (struct dvb_i2c_bus *i2c) if ((ret = i2c->xfer(i2c, msg1, 2)) == 2) { if ( strcmp(adapter->name, "TT-Budget/WinTV-NOVA-CI PCI") == 0 ) { // technotrend cards require non-datasheet settings - printk ("%s: setup for tuner SU1278 (TSA5059 synth) on TechnoTrend hardware\n", __FILE__); + printk ("%s: setup for tuner SU1278 (TSA5059 synth) on" + " TechnoTrend hardware\n", __FILE__); return PHILIPS_SU1278_TSA_TT; } else { // fall back to datasheet-recommended settings - printk ("%s: setup for tuner SU1278 (TSA5059 synth)\n", __FILE__); + printk ("%s: setup for tuner SU1278 (TSA5059 synth)\n", + __FILE__); return PHILIPS_SU1278_TSA; } } if ((ret = i2c->xfer(i2c, msg2, 2)) == 2) { - //if ((stat[0] & 0x3f) == 0) { - if (0) { + if ( strcmp(adapter->name, "KNC1 DVB-S") == 0 && + !disable_typhoon ) + { + // Typhoon cards have unusual wiring. + printk ("%s: setup for tuner SU1278 (TSA5059 synth) on" + " Typhoon hardware\n", __FILE__); + return PHILIPS_SU1278_TSA_TY; + } + //else if ((stat[0] & 0x3f) == 0) { + else if (0) { printk ("%s: setup for tuner TDQF-S001F\n", __FILE__); return LG_TDQF_S001F; } else { @@ -1296,7 +1320,8 @@ static long probe_tuner (struct dvb_i2c_bus *i2c) stv0299_writereg (i2c, 0x02, 0x00); if ((ret = i2c->xfer(i2c, msg3, 2)) == 2) { - printk ("%s: setup for tuner Philips SU1278 (TUA6100 synth)\n", __FILE__); + printk ("%s: setup for tuner Philips SU1278 (TUA6100 synth)\n", + __FILE__); return PHILIPS_SU1278_TUA; } @@ -1314,7 +1339,8 @@ static int uni0299_attach (struct dvb_i2c_bus *i2c, void **data) int tuner_type; u8 id; - stv0299_writereg (i2c, 0x02, 0x00); /* standby off */ + stv0299_writereg (i2c, 0x02, 0x34); /* standby off */ + dvb_delay(200); id = stv0299_readreg (i2c, 0x00); dprintk ("%s: id == 0x%02x\n", __FUNCTION__, id); @@ -1330,7 +1356,7 @@ static int uni0299_attach (struct dvb_i2c_bus *i2c, void **data) if ((state = kmalloc(sizeof(struct stv0299_state), GFP_KERNEL)) == NULL) { return -ENOMEM; } - + *data = state; state->tuner_type = tuner_type; state->tuner_frequency = 0; @@ -1370,3 +1396,6 @@ MODULE_LICENSE("GPL"); MODULE_PARM(stv0299_status, "i"); MODULE_PARM_DESC(stv0299_status, "Which status value to support (0: BER, 1: UCBLOCKS)"); + +MODULE_PARM(disable_typhoon, "i"); +MODULE_PARM_DESC(disable_typhoon, "Disable support for Philips SU1278 on Typhoon hardware."); |