Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] Re: patch to nxt6000.c for Comtech DVBT-6k07
On Tue, 2003-06-17 at 22:34, Johannes Stezenbach wrote:
> Hi Paul,
>
> Paul Andreassen wrote:
> > This is a patch for the Comtech DVBT-6k07 tuner which is based on the
> > NXT6000 chip and has a BT878A backend.
>
> Looks good, except that sp5730_set_tv_freq() is unused.
> I guess you already have a patch that actually calls it from FE_SET_FRONTEND?
Oops, my mistake. Try this one.
Paul
Index: linux/drivers/media/dvb/frontends/nxt6000.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/nxt6000.c,v
retrieving revision 1.7
diff -p -u -r1.7 nxt6000.c
--- linux/drivers/media/dvb/frontends/nxt6000.c 27 May 2003 11:06:47 -0000 1.7
+++ linux/drivers/media/dvb/frontends/nxt6000.c 17 Jun 2003 11:48:53 -0000
@@ -6,8 +6,10 @@
Alps TDME7 (Tuner: MITEL SP5659)
Alps TDED4 (Tuner: TI ALP510, external Nxt6000)
+ Comtech DVBT-6k07 (PLL IC: SP5730)
Copyright (C) 2002-2003 Florian Schirmer <schirmer@taytron.net>
+ Copyright (C) 2003 Paul Andreassen <paul@andreassen.com.au>
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
@@ -78,6 +80,7 @@ struct nxt6000_config {
#define TUNER_TYPE_ALP510 0
#define TUNER_TYPE_SP5659 1
+#define TUNER_TYPE_SP5730 2
#define FE2NXT(fe) ((struct nxt6000_config *)&(fe->data))
#define FREQ2DIV(freq) ((freq + 36166667) / 166667)
@@ -212,6 +215,39 @@ static int alp510_set_tv_freq(struct dvb
}
+static int sp5730_set_tv_freq(struct dvb_frontend *fe, u32 freq)
+{
+
+ u8 buf[4];
+ struct nxt6000_config *nxt = FE2NXT(fe);
+
+ buf[0] = (FREQ2DIV(freq) >> 8) & 0x7F;
+ buf[1] = FREQ2DIV(freq) & 0xFF;
+ buf[2] = 0x93;
+
+ if ((freq >= 51000000) && (freq < 132100000))
+ buf[3] = 0x05;
+ else if ((freq >= 132100000) && (freq < 143000000))
+ buf[3] = 0x45;
+ else if ((freq >= 146000000) && (freq < 349100000))
+ buf[3] = 0x06;
+ else if ((freq >= 349100000) && (freq < 397100000))
+ buf[3] = 0x46;
+ else if ((freq >= 397100000) && (freq < 426000000))
+ buf[3] = 0x86;
+ else if ((freq >= 430000000) && (freq < 659100000))
+ buf[3] = 0x03;
+ else if ((freq >= 659100000) && (freq < 759100000))
+ buf[3] = 0x43;
+ else if ((freq >= 759100000) && (freq < 858000000))
+ buf[3] = 0x83;
+ else
+ return -EINVAL;
+
+ return pll_write(fe->i2c, nxt->demod_addr, nxt->tuner_addr, buf, 4);
+
+}
+
static void nxt6000_reset(struct dvb_frontend *fe)
{
@@ -756,6 +792,13 @@ static int nxt6000_ioctl(struct dvb_fron
break;
+ case TUNER_TYPE_SP5730:
+
+ if ((result = sp5730_set_tv_freq(fe, param->frequency)) < 0)
+ return result;
+
+ break;
+
default:
return -EFAULT;
@@ -815,6 +858,14 @@ static int nxt6000_attach(struct dvb_i2c
nxt.clock_inversion = 0;
dprintk("nxt6000: detected MITEL SP5659 tuner at 0x%02X\n", nxt.tuner_addr);
+
+ } else if (pll_write(i2c, demod_addr_tbl[addr_nr], 0xC0, NULL, 0) == 0) {
+
+ nxt.tuner_addr = 0xC0;
+ nxt.tuner_type = TUNER_TYPE_SP5730;
+ nxt.clock_inversion = 0;
+
+ dprintk("nxt6000: detected SP5730 tuner at 0x%02X\n", nxt.tuner_addr);
} else {
Home |
Main Index |
Thread Index