[RFC] Change dvb-pll handling of IF frequency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The basic frequency calculation done in dvb-pll is to take the desired
frequency, add the IF frequency, and then divide by the reference
frequency.

When dvb-pll does the division, it just rounds the result down.  It would
make more sense to round to the nearest integer, which is done by adding
1/2 the divisor (the reference frequency) before dividing.

Some PLL definitions already do this, by adding one half the reference
frequency to the IF frequency.  The effect is the same, except one looking
at the code doesn't know if they are seeing the IF frequency, or the IF
frequency plus 1/2 the reference frequency.  Of course some PLL defintions
do it one way and some do it the other and there is no record of which is
which.

I think it makes a lot more sense put just the IF frequency in the PLL
definition, and take care of rounding properly in the dvb-pll code.  So I
have attached a patch which does this.  In order to do this, I had to guess
which PLLs had stepsize/2 added to the offset and which didn't.

The second patch moves the IF frequency out of the per-band data.  There is
no reason for the IF to change from one band to another, and in all of the
PLLs defined the IF is constant across bands.

As far as which PLLs had offsets with stepsize/2 added and which didn't,
I've made a list of all the IF frequencies defined in dvb-pll:

dvb_pll_thomson_dtt7610         44
dvb_pll_microtune_4042          44
dvb_pll_thomson_dtt761x         44
dvb_pll_lg_tdvs_h06xf           44
dvb_pll_tdhu2                   44
dvb_pll_tuv1236d                44
dvb_pll_samsung_tbmv            44
dvb_pll_tua6010xs               36 1/8
dvb_pll_thomson_dtt7579         36 1/6
dvb_pll_tded4                   36 1/6
dvb_pll_tua6034                 36 1/6
dvb_pll_unknown_1               36 1/6
dvb_pll_thomson_dtt759x         36 1/6
dvb_pll_lg_z201                 36 1/6
dvb_pll_philips_td1316          36 1/6 (rounded to nearest kHz)
dvb_pll_tda665x                 36 1/6 (rounded to nearest kHz) + step/2
dvb_pll_fmd1216me               36 1/8 (rounded to two decimals) + step/2
dvb_pll_thomson_fe6600          36 1/8 (rounded to two decimals) + step/2
dvb_pll_env57h1xd5              36 1/8 + step
dvb_pll_philips_sd1878_tda8261  499

Anyway, from this list I think it's clear that the PLLs with a pre-adjusted
offset are dvb_pll_tda665x, dvb_pll_fmd1216me, dvb_pll_thomson_fe6600, and
dvb_pll_env57h1xd5.

dvb_pll_philips_sd1878_tda8261 is an odd one, as it's the only satellite
PLL with zero-IF output in the list.  It uses an offset of 499 with a
stepsize of 500 kHz so that it rounds _up_.  I've left this PLL rounding
up, assuming there is a reason it was this way.

Also, dvb_pll_env57h1xd5 is not 36 1/8 + step/2, but 36 1/8 + step.  I
think this is a bug.  If you go back to patch 1740 which created the
dvb-pll definition, you'll see it was taken from the dibusb driver.  The
original code for this pll was:

	u32 freq_khz = fep->frequency / 1000;
	u32 tfreq = ((freq_khz + 36125)*6 + 500) / 1000;

If you multiple that out and reduce it, you get:
   tfreq = (fep->frequency + 36125000 + 166667/2) / 166667;

But the dvb-pll definition is using 36125000 + 166667.
# Added/removed/changed files:
# linux/drivers/media/dvb/frontends/dvb-pll.c |  148 ++++++++++++++--------------
# 1 files changed, 75 insertions(+), 73 deletions(-)
#
# For better log display, please keep a blank line after subject, after from,
# and before signed-off-by.
# First line should be the subject, without Subject:
#
dvb-pll: Adjust rounding to be consistent

# Now, patch author (just the main one), on a From: field
# Please change below if the committer is not the patch author.
#
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

# Then a detailed description:
Some PLLs had one half the step size added to the offset, so that the
divisor would be rounded to the nearest integer.  Some didn't and so
would always be rounded down.

This makes dvb-pll round to the nearest when calculating the divisor,
without the offset needing to be fudged.  PLLs that had a fudged offset
have the offset changed to be just the IF frequency.  

The satellite PLL dvb_pll_philips_sd1878_tda8261 was rounding up for some
reason, and I've kept it that way.

In addition, frequencies that were rounded to the nearest kHz are
extended to full Hz resolution.  One sixth MHz step sizes that were
listed as 166,666 Hz are changed to 166,667 Hz, which is slightly closer.

PLLs that were already rounding:
dvb_pll_tda665x, offset was 36 1/6 (to nearest kHz) + step/2
dvb_pll_fmd1216me, offset was 36 1/8 (to two digits) + step/2
dvb_pll_thomson_fe6600, offset was 36 1/8 (to two digits) + step/2
dvb_pll_env57h1xd5, offset was 36 1/8 + step

Note that the last PLL, dvb_pll_env57h1xd5, appears to have had a bug in
the offset.  Rather than adding stepsize/2, it was adding a full
stepsize.  The PLL definition originally came from the dibusb driver,
which used 36 1/8 + step/2.  The change to 36 1/8 + step was probably a
mistake added when the tuner was converted to dvb-pll.

# At the end Signed-off-by: fields by patch author and committer, at least.
#
Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c
--- a/linux/drivers/media/dvb/frontends/dvb-pll.c
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.c
@@ -44,11 +44,11 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.max   = 858000000,
 	.count = 5,
 	.entries = {
-		{          0, 36166667, 166666, 0xb4, 0x03 }, /* go sleep */
-		{  443250000, 36166667, 166666, 0xb4, 0x02 },
-		{  542000000, 36166667, 166666, 0xb4, 0x08 },
-		{  771000000, 36166667, 166666, 0xbc, 0x08 },
-		{  999999999, 36166667, 166666, 0xf4, 0x08 },
+		{          0, 36166667, 166667, 0xb4, 0x03 }, /* go sleep */
+		{  443250000, 36166667, 166667, 0xb4, 0x02 },
+		{  542000000, 36166667, 166667, 0xb4, 0x08 },
+		{  771000000, 36166667, 166667, 0xbc, 0x08 },
+		{  999999999, 36166667, 166667, 0xf4, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
@@ -79,12 +79,12 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.setbw = thomson_dtt759x_bw,
 	.count = 6,
 	.entries = {
-		{          0, 36166667, 166666, 0x84, 0x03 },
-		{  264000000, 36166667, 166666, 0xb4, 0x02 },
-		{  470000000, 36166667, 166666, 0xbc, 0x02 },
-		{  735000000, 36166667, 166666, 0xbc, 0x08 },
-		{  835000000, 36166667, 166666, 0xf4, 0x08 },
-		{  999999999, 36166667, 166666, 0xfc, 0x08 },
+		{          0, 36166667, 166667, 0x84, 0x03 },
+		{  264000000, 36166667, 166667, 0xb4, 0x02 },
+		{  470000000, 36166667, 166667, 0xbc, 0x02 },
+		{  735000000, 36166667, 166667, 0xbc, 0x08 },
+		{  835000000, 36166667, 166667, 0xf4, 0x08 },
+		{  999999999, 36166667, 166667, 0xfc, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
@@ -95,12 +95,12 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
 	.max   = 862000000,
 	.count = 6,
 	.entries = {
-		{          0, 36166667, 166666, 0xbc, 0x03 },
-		{  157500000, 36166667, 166666, 0xbc, 0x01 },
-		{  443250000, 36166667, 166666, 0xbc, 0x02 },
-		{  542000000, 36166667, 166666, 0xbc, 0x04 },
-		{  830000000, 36166667, 166666, 0xf4, 0x04 },
-		{  999999999, 36166667, 166666, 0xfc, 0x04 },
+		{          0, 36166667, 166667, 0xbc, 0x03 },
+		{  157500000, 36166667, 166667, 0xbc, 0x01 },
+		{  443250000, 36166667, 166667, 0xbc, 0x02 },
+		{  542000000, 36166667, 166667, 0xbc, 0x04 },
+		{  830000000, 36166667, 166667, 0xf4, 0x04 },
+		{  999999999, 36166667, 166667, 0xfc, 0x04 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_lg_z201);
@@ -139,15 +139,15 @@ struct dvb_pll_desc dvb_pll_unknown_1 = 
 	.max   = 862000000,
 	.count = 9,
 	.entries = {
-		{  150000000, 36166667, 166666, 0xb4, 0x01 },
-		{  173000000, 36166667, 166666, 0xbc, 0x01 },
-		{  250000000, 36166667, 166666, 0xb4, 0x02 },
-		{  400000000, 36166667, 166666, 0xbc, 0x02 },
-		{  420000000, 36166667, 166666, 0xf4, 0x02 },
-		{  470000000, 36166667, 166666, 0xfc, 0x02 },
-		{  600000000, 36166667, 166666, 0xbc, 0x08 },
-		{  730000000, 36166667, 166666, 0xf4, 0x08 },
-		{  999999999, 36166667, 166666, 0xfc, 0x08 },
+		{  150000000, 36166667, 166667, 0xb4, 0x01 },
+		{  173000000, 36166667, 166667, 0xbc, 0x01 },
+		{  250000000, 36166667, 166667, 0xb4, 0x02 },
+		{  400000000, 36166667, 166667, 0xbc, 0x02 },
+		{  420000000, 36166667, 166667, 0xf4, 0x02 },
+		{  470000000, 36166667, 166667, 0xfc, 0x02 },
+		{  600000000, 36166667, 166667, 0xbc, 0x08 },
+		{  730000000, 36166667, 166667, 0xf4, 0x08 },
+		{  999999999, 36166667, 166667, 0xfc, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_unknown_1);
@@ -175,10 +175,10 @@ struct dvb_pll_desc dvb_pll_env57h1xd5 =
 	.max   = 858000000,
 	.count = 4,
 	.entries = {
-		{  153000000, 36291666, 166666, 0xc2, 0x41 },
-		{  470000000, 36291666, 166666, 0xc2, 0x42 },
-		{  526000000, 36291666, 166666, 0xc2, 0x84 },
-		{  999999999, 36291666, 166666, 0xc2, 0xa4 },
+		{  153000000, 36125000, 166667, 0xc2, 0x41 },
+		{  470000000, 36125000, 166667, 0xc2, 0x42 },
+		{  526000000, 36125000, 166667, 0xc2, 0x84 },
+		{  999999999, 36125000, 166667, 0xc2, 0xa4 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_env57h1xd5);
@@ -199,18 +199,18 @@ struct dvb_pll_desc dvb_pll_tda665x = {
 	.setbw = tda665x_bw,
 	.count = 12,
 	.entries = {
-		{   93834000, 36249333, 166667, 0xca, 0x61 /* 011 0 0 0  01 */ },
-		{  123834000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
-		{  161000000, 36249333, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
-		{  163834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
-		{  253834000, 36249333, 166667, 0xca, 0x62 /* 011 0 0 0  10 */ },
-		{  383834000, 36249333, 166667, 0xca, 0xa2 /* 101 0 0 0  10 */ },
-		{  443834000, 36249333, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
-		{  444000000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
-		{  583834000, 36249333, 166667, 0xca, 0x64 /* 011 0 0 1  00 */ },
-		{  793834000, 36249333, 166667, 0xca, 0xa4 /* 101 0 0 1  00 */ },
-		{  444834000, 36249333, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
-		{  861000000, 36249333, 166667, 0xca, 0xe4 /* 111 0 0 1  00 */ },
+		{   93834000, 36166667, 166667, 0xca, 0x61 /* 011 0 0 0  01 */ },
+		{  123834000, 36166667, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
+		{  161000000, 36166667, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
+		{  163834000, 36166667, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
+		{  253834000, 36166667, 166667, 0xca, 0x62 /* 011 0 0 0  10 */ },
+		{  383834000, 36166667, 166667, 0xca, 0xa2 /* 101 0 0 0  10 */ },
+		{  443834000, 36166667, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
+		{  444000000, 36166667, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
+		{  583834000, 36166667, 166667, 0xca, 0x64 /* 011 0 0 1  00 */ },
+		{  793834000, 36166667, 166667, 0xca, 0xa4 /* 101 0 0 1  00 */ },
+		{  444834000, 36166667, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
+		{  861000000, 36166667, 166667, 0xca, 0xe4 /* 111 0 0 1  00 */ },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_tda665x);
@@ -271,13 +271,13 @@ struct dvb_pll_desc dvb_pll_fmd1216me = 
 	.setbw = fmd1216me_bw,
 	.count = 7,
 	.entries = {
-		{ 143870000, 36213333, 166667, 0xbc, 0x41 },
-		{ 158870000, 36213333, 166667, 0xf4, 0x41 },
-		{ 329870000, 36213333, 166667, 0xbc, 0x42 },
-		{ 441870000, 36213333, 166667, 0xf4, 0x42 },
-		{ 625870000, 36213333, 166667, 0xbc, 0x44 },
-		{ 803870000, 36213333, 166667, 0xf4, 0x44 },
-		{ 999999999, 36213333, 166667, 0xfc, 0x44 },
+		{ 143870000, 36125000, 166667, 0xbc, 0x41 },
+		{ 158870000, 36125000, 166667, 0xf4, 0x41 },
+		{ 329870000, 36125000, 166667, 0xbc, 0x42 },
+		{ 441870000, 36125000, 166667, 0xf4, 0x42 },
+		{ 625870000, 36125000, 166667, 0xbc, 0x44 },
+		{ 803870000, 36125000, 166667, 0xf4, 0x44 },
+		{ 999999999, 36125000, 166667, 0xfc, 0x44 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_fmd1216me);
@@ -348,12 +348,12 @@ struct dvb_pll_desc dvb_pll_samsung_tbmv
 	.max = 860000000,
 	.count = 6,
 	.entries = {
-		{ 172000000, 44000000, 166666, 0xb4, 0x01 },
-		{ 214000000, 44000000, 166666, 0xb4, 0x02 },
-		{ 467000000, 44000000, 166666, 0xbc, 0x02 },
-		{ 721000000, 44000000, 166666, 0xbc, 0x08 },
-		{ 841000000, 44000000, 166666, 0xf4, 0x08 },
-		{ 999999999, 44000000, 166666, 0xfc, 0x02 },
+		{ 172000000, 44000000, 166667, 0xb4, 0x01 },
+		{ 214000000, 44000000, 166667, 0xb4, 0x02 },
+		{ 467000000, 44000000, 166667, 0xbc, 0x02 },
+		{ 721000000, 44000000, 166667, 0xbc, 0x08 },
+		{ 841000000, 44000000, 166667, 0xf4, 0x08 },
+		{ 999999999, 44000000, 166667, 0xfc, 0x02 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_samsung_tbmv);
@@ -367,10 +367,11 @@ struct dvb_pll_desc dvb_pll_philips_sd18
 	.max   = 2150000,
 	.count = 4,
 	.entries = {
-		{ 1250000, 499, 500, 0xc4, 0x00},
-		{ 1550000, 499, 500, 0xc4, 0x40},
-		{ 2050000, 499, 500, 0xc4, 0x80},
-		{ 2150000, 499, 500, 0xc4, 0xc0},
+		/* zero-IF, offset 249 is to round up */
+		{ 1250000, 249, 500, 0xc4, 0x00},
+		{ 1550000, 249, 500, 0xc4, 0x40},
+		{ 2050000, 249, 500, 0xc4, 0x80},
+		{ 2150000, 249, 500, 0xc4, 0xc0},
 	},
 };
 EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
@@ -404,15 +405,15 @@ struct dvb_pll_desc dvb_pll_philips_td13
 	.setbw = td1316_bw,
 	.count = 9,
 	.entries = {
-		{  93834000, 36166000, 166666, 0xca, 0x60},
-		{ 123834000, 36166000, 166666, 0xca, 0xa0},
-		{ 163834000, 36166000, 166666, 0xca, 0xc0},
-		{ 253834000, 36166000, 166666, 0xca, 0x60},
-		{ 383834000, 36166000, 166666, 0xca, 0xa0},
-		{ 443834000, 36166000, 166666, 0xca, 0xc0},
-		{ 583834000, 36166000, 166666, 0xca, 0x60},
-		{ 793834000, 36166000, 166666, 0xca, 0xa0},
-		{ 858834000, 36166000, 166666, 0xca, 0xe0},
+		{  93834000, 36166667, 166667, 0xca, 0x60},
+		{ 123834000, 36166667, 166667, 0xca, 0xa0},
+		{ 163834000, 36166667, 166667, 0xca, 0xc0},
+		{ 253834000, 36166667, 166667, 0xca, 0x60},
+		{ 383834000, 36166667, 166667, 0xca, 0xa0},
+		{ 443834000, 36166667, 166667, 0xca, 0xc0},
+		{ 583834000, 36166667, 166667, 0xca, 0x60},
+		{ 793834000, 36166667, 166667, 0xca, 0xa0},
+		{ 858834000, 36166667, 166667, 0xca, 0xe0},
 	},
 };
 EXPORT_SYMBOL(dvb_pll_philips_td1316);
@@ -424,10 +425,10 @@ struct dvb_pll_desc dvb_pll_thomson_fe66
 	.max = 858000000,
 	.count = 4,
 	.entries = {
-		{ 250000000, 36213333, 166667, 0xb4, 0x12 },
-		{ 455000000, 36213333, 166667, 0xfe, 0x11 },
-		{ 775500000, 36213333, 166667, 0xbc, 0x18 },
-		{ 999999999, 36213333, 166667, 0xf4, 0x18 },
+		{ 250000000, 36125000, 166667, 0xb4, 0x12 },
+		{ 455000000, 36125000, 166667, 0xfe, 0x11 },
+		{ 775500000, 36125000, 166667, 0xbc, 0x18 },
+		{ 999999999, 36125000, 166667, 0xf4, 0x18 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_thomson_fe6600);
@@ -472,7 +473,8 @@ int dvb_pll_configure(struct dvb_pll_des
 	if (i == desc->count)
 		return -EINVAL;
 
-	div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize;
+	div = (freq + desc->entries[i].offset + desc->entries[i].stepsize/2) /
+	      desc->entries[i].stepsize;
 	buf[0] = div >> 8;
 	buf[1] = div & 0xff;
 	buf[2] = desc->entries[i].config;
# Added/removed/changed files:
# linux/drivers/media/dvb/frontends/dvb-pll.c |  227 +++++++++++++++-------------
# linux/drivers/media/dvb/frontends/dvb-pll.h |    2
# 2 files changed, 124 insertions(+), 105 deletions(-)
#
# For better log display, please keep a blank line after subject, after from,
# and before signed-off-by.
# First line should be the subject, without Subject:
#
dvb-pll: Move IF frequency from per-band data to per-tuner data

# Now, patch author (just the main one), on a From: field
# Please change below if the committer is not the patch author.
#
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

# Then a detailed description:
The IF frequency was specifed for each band, but it's not something that
changes from band to band.  None of the tuner definitions had a different
IF frequency (called offset) from one band to another.

# At the end Signed-off-by: fields by patch author and committer, at least.
#
Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r f7284400aa9e linux/drivers/media/dvb/frontends/dvb-pll.c
--- a/linux/drivers/media/dvb/frontends/dvb-pll.c	Mon Mar 12 14:59:09 2007 -0700
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.c	Mon Mar 12 15:10:52 2007 -0700
@@ -42,13 +42,14 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.name  = "Thomson dtt7579",
 	.min   = 177000000,
 	.max   = 858000000,
+	.iffreq= 36166667,
 	.count = 5,
 	.entries = {
-		{          0, 36166667, 166667, 0xb4, 0x03 }, /* go sleep */
-		{  443250000, 36166667, 166667, 0xb4, 0x02 },
-		{  542000000, 36166667, 166667, 0xb4, 0x08 },
-		{  771000000, 36166667, 166667, 0xbc, 0x08 },
-		{  999999999, 36166667, 166667, 0xf4, 0x08 },
+		{          0, 166667, 0xb4, 0x03 }, /* go sleep */
+		{  443250000, 166667, 0xb4, 0x02 },
+		{  542000000, 166667, 0xb4, 0x08 },
+		{  771000000, 166667, 0xbc, 0x08 },
+		{  999999999, 166667, 0xf4, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
@@ -57,11 +58,12 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.name  = "Thomson dtt7610",
 	.min   =  44000000,
 	.max   = 958000000,
+	.iffreq= 44000000,
 	.count = 3,
 	.entries = {
-		{ 157250000, 44000000, 62500, 0x8e, 0x39 },
-		{ 454000000, 44000000, 62500, 0x8e, 0x3a },
-		{ 999999999, 44000000, 62500, 0x8e, 0x3c },
+		{ 157250000, 62500, 0x8e, 0x39 },
+		{ 454000000, 62500, 0x8e, 0x3a },
+		{ 999999999, 62500, 0x8e, 0x3c },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt7610);
@@ -77,14 +79,15 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.min   = 177000000,
 	.max   = 896000000,
 	.setbw = thomson_dtt759x_bw,
+	.iffreq= 36166667,
 	.count = 6,
 	.entries = {
-		{          0, 36166667, 166667, 0x84, 0x03 },
-		{  264000000, 36166667, 166667, 0xb4, 0x02 },
-		{  470000000, 36166667, 166667, 0xbc, 0x02 },
-		{  735000000, 36166667, 166667, 0xbc, 0x08 },
-		{  835000000, 36166667, 166667, 0xf4, 0x08 },
-		{  999999999, 36166667, 166667, 0xfc, 0x08 },
+		{          0, 166667, 0x84, 0x03 },
+		{  264000000, 166667, 0xb4, 0x02 },
+		{  470000000, 166667, 0xbc, 0x02 },
+		{  735000000, 166667, 0xbc, 0x08 },
+		{  835000000, 166667, 0xf4, 0x08 },
+		{  999999999, 166667, 0xfc, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
@@ -93,14 +96,15 @@ struct dvb_pll_desc dvb_pll_lg_z201 = {
 	.name  = "LG z201",
 	.min   = 174000000,
 	.max   = 862000000,
+	.iffreq= 36166667,
 	.count = 6,
 	.entries = {
-		{          0, 36166667, 166667, 0xbc, 0x03 },
-		{  157500000, 36166667, 166667, 0xbc, 0x01 },
-		{  443250000, 36166667, 166667, 0xbc, 0x02 },
-		{  542000000, 36166667, 166667, 0xbc, 0x04 },
-		{  830000000, 36166667, 166667, 0xf4, 0x04 },
-		{  999999999, 36166667, 166667, 0xfc, 0x04 },
+		{          0, 166667, 0xbc, 0x03 },
+		{  157500000, 166667, 0xbc, 0x01 },
+		{  443250000, 166667, 0xbc, 0x02 },
+		{  542000000, 166667, 0xbc, 0x04 },
+		{  830000000, 166667, 0xf4, 0x04 },
+		{  999999999, 166667, 0xfc, 0x04 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_lg_z201);
@@ -109,11 +113,12 @@ struct dvb_pll_desc dvb_pll_microtune_40
 	.name  = "Microtune 4042 FI5",
 	.min   =  57000000,
 	.max   = 858000000,
+	.iffreq= 44000000,
 	.count = 3,
 	.entries = {
-		{ 162000000, 44000000, 62500, 0x8e, 0xa1 },
-		{ 457000000, 44000000, 62500, 0x8e, 0x91 },
-		{ 999999999, 44000000, 62500, 0x8e, 0x31 },
+		{ 162000000, 62500, 0x8e, 0xa1 },
+		{ 457000000, 62500, 0x8e, 0x91 },
+		{ 999999999, 62500, 0x8e, 0x31 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_microtune_4042);
@@ -123,12 +128,13 @@ struct dvb_pll_desc dvb_pll_thomson_dtt7
 	.name  = "Thomson dtt761x",
 	.min   =  57000000,
 	.max   = 863000000,
+	.iffreq= 44000000,
 	.count = 3,
 	.initdata = tua603x_agc103,
 	.entries = {
-		{ 147000000, 44000000, 62500, 0x8e, 0x39 },
-		{ 417000000, 44000000, 62500, 0x8e, 0x3a },
-		{ 999999999, 44000000, 62500, 0x8e, 0x3c },
+		{ 147000000, 62500, 0x8e, 0x39 },
+		{ 417000000, 62500, 0x8e, 0x3a },
+		{ 999999999, 62500, 0x8e, 0x3c },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_thomson_dtt761x);
@@ -137,17 +143,18 @@ struct dvb_pll_desc dvb_pll_unknown_1 = 
 	.name  = "unknown 1", /* used by dntv live dvb-t */
 	.min   = 174000000,
 	.max   = 862000000,
+	.iffreq= 36166667,
 	.count = 9,
 	.entries = {
-		{  150000000, 36166667, 166667, 0xb4, 0x01 },
-		{  173000000, 36166667, 166667, 0xbc, 0x01 },
-		{  250000000, 36166667, 166667, 0xb4, 0x02 },
-		{  400000000, 36166667, 166667, 0xbc, 0x02 },
-		{  420000000, 36166667, 166667, 0xf4, 0x02 },
-		{  470000000, 36166667, 166667, 0xfc, 0x02 },
-		{  600000000, 36166667, 166667, 0xbc, 0x08 },
-		{  730000000, 36166667, 166667, 0xf4, 0x08 },
-		{  999999999, 36166667, 166667, 0xfc, 0x08 },
+		{  150000000, 166667, 0xb4, 0x01 },
+		{  173000000, 166667, 0xbc, 0x01 },
+		{  250000000, 166667, 0xb4, 0x02 },
+		{  400000000, 166667, 0xbc, 0x02 },
+		{  420000000, 166667, 0xf4, 0x02 },
+		{  470000000, 166667, 0xfc, 0x02 },
+		{  600000000, 166667, 0xbc, 0x08 },
+		{  730000000, 166667, 0xf4, 0x08 },
+		{  999999999, 166667, 0xfc, 0x08 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_unknown_1);
@@ -159,11 +166,12 @@ struct dvb_pll_desc dvb_pll_tua6010xs = 
 	.name  = "Infineon TUA6010XS",
 	.min   =  44250000,
 	.max   = 858000000,
+	.iffreq= 36125000,
 	.count = 3,
 	.entries = {
-		{  115750000, 36125000, 62500, 0x8e, 0x03 },
-		{  403250000, 36125000, 62500, 0x8e, 0x06 },
-		{  999999999, 36125000, 62500, 0x8e, 0x85 },
+		{  115750000, 62500, 0x8e, 0x03 },
+		{  403250000, 62500, 0x8e, 0x06 },
+		{  999999999, 62500, 0x8e, 0x85 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_tua6010xs);
@@ -173,12 +181,13 @@ struct dvb_pll_desc dvb_pll_env57h1xd5 =
 	.name  = "Panasonic ENV57H1XD5",
 	.min   =  44250000,
 	.max   = 858000000,
+	.iffreq= 36125000,
 	.count = 4,
 	.entries = {
-		{  153000000, 36125000, 166667, 0xc2, 0x41 },
-		{  470000000, 36125000, 166667, 0xc2, 0x42 },
-		{  526000000, 36125000, 166667, 0xc2, 0x84 },
-		{  999999999, 36125000, 166667, 0xc2, 0xa4 },
+		{  153000000, 166667, 0xc2, 0x41 },
+		{  470000000, 166667, 0xc2, 0x42 },
+		{  526000000, 166667, 0xc2, 0x84 },
+		{  999999999, 166667, 0xc2, 0xa4 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_env57h1xd5);
@@ -197,20 +206,21 @@ struct dvb_pll_desc dvb_pll_tda665x = {
 	.min   =  44250000,
 	.max   = 858000000,
 	.setbw = tda665x_bw,
+	.iffreq= 36166667,
 	.count = 12,
 	.entries = {
-		{   93834000, 36166667, 166667, 0xca, 0x61 /* 011 0 0 0  01 */ },
-		{  123834000, 36166667, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
-		{  161000000, 36166667, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
-		{  163834000, 36166667, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
-		{  253834000, 36166667, 166667, 0xca, 0x62 /* 011 0 0 0  10 */ },
-		{  383834000, 36166667, 166667, 0xca, 0xa2 /* 101 0 0 0  10 */ },
-		{  443834000, 36166667, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
-		{  444000000, 36166667, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
-		{  583834000, 36166667, 166667, 0xca, 0x64 /* 011 0 0 1  00 */ },
-		{  793834000, 36166667, 166667, 0xca, 0xa4 /* 101 0 0 1  00 */ },
-		{  444834000, 36166667, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
-		{  861000000, 36166667, 166667, 0xca, 0xe4 /* 111 0 0 1  00 */ },
+		{   93834000, 166667, 0xca, 0x61 /* 011 0 0 0  01 */ },
+		{  123834000, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
+		{  161000000, 166667, 0xca, 0xa1 /* 101 0 0 0  01 */ },
+		{  163834000, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
+		{  253834000, 166667, 0xca, 0x62 /* 011 0 0 0  10 */ },
+		{  383834000, 166667, 0xca, 0xa2 /* 101 0 0 0  10 */ },
+		{  443834000, 166667, 0xca, 0xc2 /* 110 0 0 0  10 */ },
+		{  444000000, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
+		{  583834000, 166667, 0xca, 0x64 /* 011 0 0 1  00 */ },
+		{  793834000, 166667, 0xca, 0xa4 /* 101 0 0 1  00 */ },
+		{  444834000, 166667, 0xca, 0xc4 /* 110 0 0 1  00 */ },
+		{  861000000, 166667, 0xca, 0xe4 /* 111 0 0 1  00 */ },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_tda665x);
@@ -228,12 +238,13 @@ struct dvb_pll_desc dvb_pll_tua6034 = {
 	.name  = "Infineon TUA6034",
 	.min   =  44250000,
 	.max   = 858000000,
+	.iffreq= 36166667,
 	.count = 3,
 	.setbw = tua6034_bw,
 	.entries = {
-		{  174500000, 36166667, 62500, 0xce, 0x01 },
-		{  230000000, 36166667, 62500, 0xce, 0x02 },
-		{  999999999, 36166667, 62500, 0xce, 0x04 },
+		{  174500000, 62500, 0xce, 0x01 },
+		{  230000000, 62500, 0xce, 0x02 },
+		{  999999999, 62500, 0xce, 0x04 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_tua6034);
@@ -245,12 +256,13 @@ struct dvb_pll_desc dvb_pll_lg_tdvs_h06x
 	.name  = "LG TDVS-H06xF",
 	.min   =  54000000,
 	.max   = 863000000,
+	.iffreq= 44000000,
 	.initdata = tua603x_agc103,
 	.count = 3,
 	.entries = {
-		{  165000000, 44000000, 62500, 0xce, 0x01 },
-		{  450000000, 44000000, 62500, 0xce, 0x02 },
-		{  999999999, 44000000, 62500, 0xce, 0x04 },
+		{  165000000, 62500, 0xce, 0x01 },
+		{  450000000, 62500, 0xce, 0x02 },
+		{  999999999, 62500, 0xce, 0x04 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_lg_tdvs_h06xf);
@@ -268,16 +280,17 @@ struct dvb_pll_desc dvb_pll_fmd1216me = 
 	.name = "Philips FMD1216ME",
 	.min = 50870000,
 	.max = 858000000,
+	.iffreq= 36125000,
 	.setbw = fmd1216me_bw,
 	.count = 7,
 	.entries = {
-		{ 143870000, 36125000, 166667, 0xbc, 0x41 },
-		{ 158870000, 36125000, 166667, 0xf4, 0x41 },
-		{ 329870000, 36125000, 166667, 0xbc, 0x42 },
-		{ 441870000, 36125000, 166667, 0xf4, 0x42 },
-		{ 625870000, 36125000, 166667, 0xbc, 0x44 },
-		{ 803870000, 36125000, 166667, 0xf4, 0x44 },
-		{ 999999999, 36125000, 166667, 0xfc, 0x44 },
+		{ 143870000, 166667, 0xbc, 0x41 },
+		{ 158870000, 166667, 0xf4, 0x41 },
+		{ 329870000, 166667, 0xbc, 0x42 },
+		{ 441870000, 166667, 0xf4, 0x42 },
+		{ 625870000, 166667, 0xbc, 0x44 },
+		{ 803870000, 166667, 0xf4, 0x44 },
+		{ 999999999, 166667, 0xfc, 0x44 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_fmd1216me);
@@ -295,13 +308,14 @@ struct dvb_pll_desc dvb_pll_tded4 = {
 	.name = "ALPS TDED4",
 	.min = 47000000,
 	.max = 863000000,
+	.iffreq= 36166667,
 	.setbw = tded4_bw,
 	.count = 4,
 	.entries = {
-		{ 153000000, 36166667, 166667, 0x85, 0x01 },
-		{ 470000000, 36166667, 166667, 0x85, 0x02 },
-		{ 823000000, 36166667, 166667, 0x85, 0x08 },
-		{ 999999999, 36166667, 166667, 0x85, 0x88 },
+		{ 153000000, 166667, 0x85, 0x01 },
+		{ 470000000, 166667, 0x85, 0x02 },
+		{ 823000000, 166667, 0x85, 0x08 },
+		{ 999999999, 166667, 0x85, 0x88 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_tded4);
@@ -313,12 +327,13 @@ struct dvb_pll_desc dvb_pll_tdhu2 = {
 	.name = "ALPS TDHU2",
 	.min = 54000000,
 	.max = 864000000,
+	.iffreq= 44000000,
 	.count = 4,
 	.entries = {
-		{ 162000000, 44000000, 62500, 0x85, 0x01 },
-		{ 426000000, 44000000, 62500, 0x85, 0x02 },
-		{ 782000000, 44000000, 62500, 0x85, 0x08 },
-		{ 999999999, 44000000, 62500, 0x85, 0x88 },
+		{ 162000000, 62500, 0x85, 0x01 },
+		{ 426000000, 62500, 0x85, 0x02 },
+		{ 782000000, 62500, 0x85, 0x08 },
+		{ 999999999, 62500, 0x85, 0x88 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_tdhu2);
@@ -330,11 +345,12 @@ struct dvb_pll_desc dvb_pll_tuv1236d = {
 	.name  = "Philips TUV1236D",
 	.min   =  54000000,
 	.max   = 864000000,
+	.iffreq= 44000000,
 	.count = 3,
 	.entries = {
-		{ 157250000, 44000000, 62500, 0xc6, 0x41 },
-		{ 454000000, 44000000, 62500, 0xc6, 0x42 },
-		{ 999999999, 44000000, 62500, 0xc6, 0x44 },
+		{ 157250000, 62500, 0xc6, 0x41 },
+		{ 454000000, 62500, 0xc6, 0x42 },
+		{ 999999999, 62500, 0xc6, 0x44 },
 	},
 };
 EXPORT_SYMBOL(dvb_pll_tuv1236d);
@@ -346,14 +362,15 @@ struct dvb_pll_desc dvb_pll_samsung_tbmv
 	.name = "Samsung TBMV30111IN / TBMV30712IN1",
 	.min = 54000000,
 	.max = 860000000,
+	.iffreq= 44000000,
 	.count = 6,
 	.entries = {
-		{ 172000000, 44000000, 166667, 0xb4, 0x01 },
-		{ 214000000, 44000000, 166667, 0xb4, 0x02 },
-		{ 467000000, 44000000, 166667, 0xbc, 0x02 },
-		{ 721000000, 44000000, 166667, 0xbc, 0x08 },
-		{ 841000000, 44000000, 166667, 0xf4, 0x08 },
-		{ 999999999, 44000000, 166667, 0xfc, 0x02 },
+		{ 172000000, 166667, 0xb4, 0x01 },
+		{ 214000000, 166667, 0xb4, 0x02 },
+		{ 467000000, 166667, 0xbc, 0x02 },
+		{ 721000000, 166667, 0xbc, 0x08 },
+		{ 841000000, 166667, 0xf4, 0x08 },
+		{ 999999999, 166667, 0xfc, 0x02 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_samsung_tbmv);
@@ -365,13 +382,13 @@ struct dvb_pll_desc dvb_pll_philips_sd18
 	.name  = "Philips SD1878",
 	.min   =  950000,
 	.max   = 2150000,
+	.iffreq= 249, /* zero-IF, offset 249 is to round up */
 	.count = 4,
 	.entries = {
-		/* zero-IF, offset 249 is to round up */
-		{ 1250000, 249, 500, 0xc4, 0x00},
-		{ 1550000, 249, 500, 0xc4, 0x40},
-		{ 2050000, 249, 500, 0xc4, 0x80},
-		{ 2150000, 249, 500, 0xc4, 0xc0},
+		{ 1250000, 500, 0xc4, 0x00},
+		{ 1550000, 500, 0xc4, 0x40},
+		{ 2050000, 500, 0xc4, 0x80},
+		{ 2150000, 500, 0xc4, 0xc0},
 	},
 };
 EXPORT_SYMBOL(dvb_pll_philips_sd1878_tda8261);
@@ -402,18 +419,19 @@ struct dvb_pll_desc dvb_pll_philips_td13
 	.name  = "Philips TD1316",
 	.min   =  87000000,
 	.max   = 895000000,
+	.iffreq= 36166667,
 	.setbw = td1316_bw,
 	.count = 9,
 	.entries = {
-		{  93834000, 36166667, 166667, 0xca, 0x60},
-		{ 123834000, 36166667, 166667, 0xca, 0xa0},
-		{ 163834000, 36166667, 166667, 0xca, 0xc0},
-		{ 253834000, 36166667, 166667, 0xca, 0x60},
-		{ 383834000, 36166667, 166667, 0xca, 0xa0},
-		{ 443834000, 36166667, 166667, 0xca, 0xc0},
-		{ 583834000, 36166667, 166667, 0xca, 0x60},
-		{ 793834000, 36166667, 166667, 0xca, 0xa0},
-		{ 858834000, 36166667, 166667, 0xca, 0xe0},
+		{  93834000, 166667, 0xca, 0x60},
+		{ 123834000, 166667, 0xca, 0xa0},
+		{ 163834000, 166667, 0xca, 0xc0},
+		{ 253834000, 166667, 0xca, 0x60},
+		{ 383834000, 166667, 0xca, 0xa0},
+		{ 443834000, 166667, 0xca, 0xc0},
+		{ 583834000, 166667, 0xca, 0x60},
+		{ 793834000, 166667, 0xca, 0xa0},
+		{ 858834000, 166667, 0xca, 0xe0},
 	},
 };
 EXPORT_SYMBOL(dvb_pll_philips_td1316);
@@ -423,12 +441,13 @@ struct dvb_pll_desc dvb_pll_thomson_fe66
 	.name = "Thomson FE6600",
 	.min =  44250000,
 	.max = 858000000,
+	.iffreq= 36125000,
 	.count = 4,
 	.entries = {
-		{ 250000000, 36125000, 166667, 0xb4, 0x12 },
-		{ 455000000, 36125000, 166667, 0xfe, 0x11 },
-		{ 775500000, 36125000, 166667, 0xbc, 0x18 },
-		{ 999999999, 36125000, 166667, 0xf4, 0x18 },
+		{ 250000000, 166667, 0xb4, 0x12 },
+		{ 455000000, 166667, 0xfe, 0x11 },
+		{ 775500000, 166667, 0xbc, 0x18 },
+		{ 999999999, 166667, 0xf4, 0x18 },
 	}
 };
 EXPORT_SYMBOL(dvb_pll_thomson_fe6600);
@@ -473,7 +492,7 @@ int dvb_pll_configure(struct dvb_pll_des
 	if (i == desc->count)
 		return -EINVAL;
 
-	div = (freq + desc->entries[i].offset + desc->entries[i].stepsize/2) /
+	div = (freq + desc->iffreq + desc->entries[i].stepsize/2) /
 	      desc->entries[i].stepsize;
 	buf[0] = div >> 8;
 	buf[1] = div & 0xff;
@@ -488,7 +507,7 @@ int dvb_pll_configure(struct dvb_pll_des
 		       desc->name, div, buf[0], buf[1], buf[2], buf[3]);
 
 	// calculate the frequency we set it to
-	return (div * desc->entries[i].stepsize) - desc->entries[i].offset;
+	return (div * desc->entries[i].stepsize) - desc->iffreq;
 }
 EXPORT_SYMBOL(dvb_pll_configure);
 
diff -r f7284400aa9e linux/drivers/media/dvb/frontends/dvb-pll.h
--- a/linux/drivers/media/dvb/frontends/dvb-pll.h	Mon Mar 12 14:59:09 2007 -0700
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.h	Mon Mar 12 15:08:51 2007 -0700
@@ -12,12 +12,12 @@ struct dvb_pll_desc {
 	char *name;
 	u32  min;
 	u32  max;
+	u32  iffreq;
 	void (*setbw)(u8 *buf, u32 freq, int bandwidth);
 	u8   *initdata;
 	int  count;
 	struct {
 		u32 limit;
-		u32 offset;
 		u32 stepsize;
 		u8  config;
 		u8  cb;
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux