diff options
author | Holger Waechtler <devnull@localhost> | 2003-01-21 19:22:41 +0000 |
---|---|---|
committer | Holger Waechtler <devnull@localhost> | 2003-01-21 19:22:41 +0000 |
commit | 3a660a9f0cb5503d51be7280634ea51f650ec6ca (patch) | |
tree | 79a6ace7a68be34c6ade6b2a5191b633c2475586 /linux/drivers/media/dvb | |
parent | cb58485c17a50b5a5d53779e39ed74531952ca45 (diff) | |
download | mediapointer-dvb-s2-3a660a9f0cb5503d51be7280634ea51f650ec6ca.tar.gz mediapointer-dvb-s2-3a660a9f0cb5503d51be7280634ea51f650ec6ca.tar.bz2 |
get in sync w/ DVB/
Diffstat (limited to 'linux/drivers/media/dvb')
-rw-r--r-- | linux/drivers/media/dvb/frontends/stv0299.c | 78 |
1 files changed, 66 insertions, 12 deletions
diff --git a/linux/drivers/media/dvb/frontends/stv0299.c b/linux/drivers/media/dvb/frontends/stv0299.c index 34f48ec38..1f34155ec 100644 --- a/linux/drivers/media/dvb/frontends/stv0299.c +++ b/linux/drivers/media/dvb/frontends/stv0299.c @@ -1,5 +1,5 @@ /* - Universal driver for STV0299/TDA5059 based + Universal driver for STV0299/TDA5059/SL1935 based DVB QPSK frontends Alps BSRU6, LG TDQB-S00x @@ -14,6 +14,11 @@ Copyright (C) 2002 by Peter Schildmann <peter.schildmann@web.de> + LG TDQF-S001F + + Copyright (C) 2002 Felix Domke <tmbinc@elitedvb.net> + & Andreas Oberritter <andreas@oberritter.de> + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -42,13 +47,14 @@ static int debug = 0; #define UNKNOWN_FRONTEND -1 #define PHILIPS_SU1278SH 0 #define ALPS_BSRU6 1 +#define LG_TDQF_S001F 2 /* Master Clock = 88 MHz */ #define M_CLK (88000000UL) static struct dvb_frontend_info uni0299_info = { - name: "STV0299/TSA5059 based", + name: "STV0299/TSA5059/SL1935 based", type: FE_QPSK, frequency_min: 950000, frequency_max: 2150000, @@ -232,7 +238,7 @@ int stv0299_readregs (struct dvb_i2c_bus *i2c, u8 reg1, u8 *b, u8 len) static -int tsa5059_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype) +int pll_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype) { int ret; u8 rpt1 [] = { 0x05, 0xb5 }; /* enable i2c repeater on stv0299 */ @@ -243,7 +249,13 @@ int tsa5059_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype) dprintk ("%s\n", __FUNCTION__); - ret = i2c->xfer (i2c, msg, 2); + if (ftype == LG_TDQF_S001F) { + ret = i2c->xfer (i2c, &msg[0], 1); + ret += i2c->xfer (i2c, &msg[1], 1); + } + else { + ret = i2c->xfer (i2c, msg, 2); + } if (ret != 2) dprintk("%s: i/o error (ret == %i)\n", __FUNCTION__, ret); @@ -252,6 +264,33 @@ int tsa5059_write (struct dvb_i2c_bus *i2c, u8 data [4], int ftype) } +static +int sl1935_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype) +{ + u8 buf[4]; + u32 div; + + u32 ratios[] = { 2000, 1000, 500, 250, 125 }; + u8 ratio; + + for (ratio = 4; ratio > 0; ratio--) + if ((freq / ratios[ratio]) <= 0x3fff) + break; + + div = freq / ratios[ratio]; + + buf[0] = (freq >> 8) & 0x7f; + buf[1] = freq & 0xff; + buf[2] = 0x80 | ratio; + + if (freq < 1531000) + buf[3] = 0x10; + else + buf[3] = 0x00; + + return pll_write (i2c, buf, ftype); +} + /** * set up the downconverter frequency divisor for a * reference clock comparision frequency of 125 kHz. @@ -272,9 +311,17 @@ int tsa5059_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype) dprintk ("%s\n", __FUNCTION__); - return tsa5059_write (i2c, buf, ftype); + return pll_write (i2c, buf, ftype); } +static +int pll_set_tv_freq (struct dvb_i2c_bus *i2c, u32 freq, int ftype) +{ + if (ftype == LG_TDQF_S001F) + return sl1935_set_tv_freq(i2c, freq, ftype); + else + return tsa5059_set_tv_freq(i2c, freq, ftype); +} #if 0 static @@ -669,11 +716,11 @@ int uni0299_ioctl (struct dvb_frontend *fe, unsigned int cmd, void *arg) { struct dvb_frontend_parameters *p = arg; - tsa5059_set_tv_freq (i2c, p->frequency, tuner_type); + pll_set_tv_freq (i2c, p->frequency, tuner_type); stv0299_set_FEC (i2c, p->u.qpsk.fec_inner); stv0299_set_symbolrate (i2c, p->u.qpsk.symbol_rate); stv0299_check_inversion (i2c); - /* tsa5059_set_tv_freq (i2c, p->frequency); */ + /* pll_set_tv_freq (i2c, p->frequency, tuner_type); */ stv0299_writereg (i2c, 0x22, 0x00); stv0299_writereg (i2c, 0x23, 0x00); stv0299_readreg (i2c, 0x23); @@ -754,8 +801,14 @@ int probe_tuner (struct dvb_i2c_bus *i2c) type = PHILIPS_SU1278SH; printk ("%s: setup for tuner SU1278/SH\n", __FILE__); } else if (i2c->xfer(i2c, msg2, 2) == 2) { - type = ALPS_BSRU6; - printk ("%s: setup for tuner BSRU6, TDQB-S00x\n", __FILE__); +if (0) { // if ((stat[0] & 0x3f) == 0) { + type = LG_TDQF_S001F; + printk ("%s: setup for tuner TDQF-S001F\n", __FILE__); + } + else { + type = ALPS_BSRU6; + printk ("%s: setup for tuner BSRU6, TDQB-S00x\n", __FILE__); + } } else { type = UNKNOWN_FRONTEND; printk ("%s: unknown PLL synthesizer, " @@ -765,6 +818,7 @@ int probe_tuner (struct dvb_i2c_bus *i2c) return type; } + static int uni0299_attach (struct dvb_i2c_bus *i2c) { @@ -775,7 +829,7 @@ int uni0299_attach (struct dvb_i2c_bus *i2c) /* register 0x00 contains 0xa1 for STV0299 and STV0299B */ /* register 0x00 might contain 0x80 when returning from standby */ - if (id != 0xa1) + if (id != 0xa1 && id != 0x80) return -ENODEV; if ((tuner_type = probe_tuner(i2c)) < 0) @@ -820,7 +874,7 @@ module_exit (exit_uni0299); MODULE_PARM(debug,"i"); MODULE_PARM_DESC(debug, "enable verbose debug messages"); -MODULE_DESCRIPTION("Universal STV0299/TSA5059 DVB Frontend driver"); -MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann"); +MODULE_DESCRIPTION("Universal STV0299/TSA5059/SL1935 DVB Frontend driver"); +MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, Andreas Oberritter"); MODULE_LICENSE("GPL"); |