r2876 - in trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian: . patches patches/series

Andres Salomon dilinger@costa.debian.org
Sat, 02 Apr 2005 03:55:04 +0000


Author: dilinger
Date: 2005-04-02 03:55:03 +0000 (Sat, 02 Apr 2005)
New Revision: 2876

Added:
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-mt352-update.patch
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-pll-lib.patch
Modified:
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog
   trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-2
Log:
  * drivers-media-video-saa7134-update-2.patch,
    drivers-media-video-pll-lib.patch, drivers-media-video-mt352-update.patch:
    Additional saa7134 fixes; allow building as a non-module, add pll
    lib, etc (Andres Salomon).



Modified: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog	2005-04-02 03:12:08 UTC (rev 2875)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/changelog	2005-04-02 03:55:03 UTC (rev 2876)
@@ -65,8 +65,10 @@
      o Suspected information leak (mem pages) in ext2 [CAN-2005-0400]
    (Andres Salomon).
 
-  * drivers-media-video-saa7134-update-2.patch:
-    Additional saa7134 fix; build as a non-module (Andres Salomon).
+  * drivers-media-video-saa7134-update-2.patch,
+    drivers-media-video-pll-lib.patch, drivers-media-video-mt352-update.patch:
+    Additional saa7134 fixes; allow building as a non-module, add pll
+    lib, etc (Andres Salomon).
 
  -- Simon Horman <horms@debian.org>  Fri,  1 Apr 2005 18:05:25 +0900
 

Added: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-mt352-update.patch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-mt352-update.patch	2005-04-02 03:12:08 UTC (rev 2875)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-mt352-update.patch	2005-04-02 03:55:03 UTC (rev 2876)
@@ -0,0 +1,384 @@
+# origin: kraxel@bytesex.org (BitKeeper)
+# cset: 423319b45APysujA6dNnGY0xxK9gJg
+# URL: http://linux.bkbits.net:8080/linux-2.6/cset@423319b45APysujA6dNnGY0xxK9gJg
+# inclusion: upstream (backport)
+# description: [PATCH] dvb: mt352 frontend driver update
+# revision date: 2005/03/12 08:32:52-08:00
+#
+diff -Naru a/drivers/media/dvb/frontends/mt352.c b/drivers/media/dvb/frontends/mt352.c
+--- a/drivers/media/dvb/frontends/mt352.c	2005-04-01 19:49:20 -08:00
++++ b/drivers/media/dvb/frontends/mt352.c	2005-04-01 19:49:20 -08:00
+@@ -41,13 +41,12 @@
+ #include "mt352.h"
+ 
+ struct mt352_state {
+-
+ 	struct i2c_adapter* i2c;
+-
+ 	struct dvb_frontend_ops ops;
+ 
+ 	/* configuration settings */
+ 	const struct mt352_config* config;
++	int s0,s1,s3;
+ 
+ 	struct dvb_frontend frontend;
+ };
+@@ -66,23 +65,23 @@
+ 			       .buf = buf, .len = 2 };
+ 	int err = i2c_transfer(state->i2c, &msg, 1);
+ 	if (err != 1) {
+-		dprintk("mt352_write() to reg %x failed (err = %d)!\n", reg, err);
++		printk("mt352_write() to reg %x failed (err = %d)!\n", reg, err);
+ 		return err;
+-}
+-	return 0; 
++	}
++	return 0;
+ }
+ 
+ int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen)
+ {
+ 	int err,i;
+ 	for (i=0; i < ilen-1; i++)
+-		if ((err = mt352_single_write(fe,ibuf[0]+i,ibuf[i+1]))) 
++		if ((err = mt352_single_write(fe,ibuf[0]+i,ibuf[i+1])))
+ 			return err;
+ 
+ 	return 0;
+ }
+ 
+-static u8 mt352_read_register(struct mt352_state* state, u8 reg)
++static int mt352_read_register(struct mt352_state* state, u8 reg)
+ {
+ 	int ret;
+ 	u8 b0 [] = { reg };
+@@ -96,41 +95,87 @@
+ 
+ 	ret = i2c_transfer(state->i2c, msg, 2);
+ 
+-	if (ret != 2)
+-		dprintk("%s: readreg error (ret == %i)\n", __FUNCTION__, ret);
++	if (ret != 2) {
++		printk("%s: readreg error (reg=%d, ret==%i)\n",
++		       __FUNCTION__, reg, ret);
++		return ret;
++	}
+ 
+ 	return b1[0];
+ }
+ 
+-u8 mt352_read(struct dvb_frontend *fe, u8 reg)
++int mt352_read(struct dvb_frontend *fe, u8 reg)
+ {
+ 	return mt352_read_register(fe->demodulator_priv,reg);
+ }
+ 
+-
+-
+-
+-
+-
+-
+-
+ static int mt352_sleep(struct dvb_frontend* fe)
+ {
+ 	static u8 mt352_softdown[] = { CLOCK_CTL, 0x20, 0x08 };
+ 
+ 	mt352_write(fe, mt352_softdown, sizeof(mt352_softdown));
+-
+ 	return 0;
+ }
+ 
++static void mt352_calc_nominal_rate(struct mt352_state* state,
++				    enum fe_bandwidth bandwidth,
++				    unsigned char *buf)
++{
++	u32 adc_clock = 20480; /* 20.340 MHz */
++	u32 bw,value;
++
++	switch (bandwidth) {
++	case BANDWIDTH_6_MHZ:
++		bw = 6;
++		break;
++	case BANDWIDTH_7_MHZ:
++		bw = 7;
++		break;
++	case BANDWIDTH_8_MHZ:
++	default:
++		bw = 8;
++		break;
++	}
++	if (state->config->adc_clock)
++		adc_clock = state->config->adc_clock;
++
++	value = 64 * bw * (1<<16) / (7 * 8);
++	value = value * 1000 / adc_clock;
++	dprintk("%s: bw %d, adc_clock %d => 0x%x\n",
++		__FUNCTION__, bw, adc_clock, value);
++	buf[0] = msb(value);
++	buf[1] = lsb(value);
++}
++
++static void mt352_calc_input_freq(struct mt352_state* state,
++				  unsigned char *buf)
++{
++	int adc_clock = 20480; /* 20.480000 MHz */
++	int if2       = 36167; /* 36.166667 MHz */
++	int ife,value;
++
++	if (state->config->adc_clock)
++		adc_clock = state->config->adc_clock;
++	if (state->config->if2)
++		if2 = state->config->if2;
++
++	ife = (2*adc_clock - if2);
++	value = -16374 * ife / adc_clock;
++	dprintk("%s: if2 %d, ife %d, adc_clock %d => %d / 0x%x\n",
++		__FUNCTION__, if2, ife, adc_clock, value, value & 0x3fff);
++	buf[0] = msb(value);
++	buf[1] = lsb(value);
++}
++
+ static int mt352_set_parameters(struct dvb_frontend* fe,
+ 				struct dvb_frontend_parameters *param)
+ {
+ 	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+-	unsigned char buf[14];
++	unsigned char buf[13];
++	static unsigned char tuner_go[] = { 0x5d, 0x01 };
++	static unsigned char fsm_go[]   = { 0x5e, 0x01 };
+ 	unsigned int tps = 0;
+ 	struct dvb_ofdm_parameters *op = &param->u.ofdm;
+-	int i;
+ 
+ 	switch (op->code_rate_HP) {
+ 		case FEC_2_3:
+@@ -241,39 +286,33 @@
+ 	buf[1] = msb(tps);      /* TPS_GIVEN_(1|0) */
+ 	buf[2] = lsb(tps);
+ 
+-	buf[3] = 0x50;
+-
+-	/**
+-	 *  these settings assume 20.48MHz f_ADC, for other tuners you might
+-	 *  need other values. See p. 33 in the MT352 Design Manual.
+-	 */
+-	if (op->bandwidth == BANDWIDTH_8_MHZ) {
+-		buf[4] = 0x72;  /* TRL_NOMINAL_RATE_(1|0) */
+-		buf[5] = 0x49;
+-	} else if (op->bandwidth == BANDWIDTH_7_MHZ) {
+-		buf[4] = 0x64;
+-		buf[5] = 0x00;
+-	} else {		/* 6MHz */
+-		buf[4] = 0x55;
+-		buf[5] = 0xb7;
+-	}
+-
+-	buf[6] = 0x31;  /* INPUT_FREQ_(1|0), 20.48MHz clock, 36.166667MHz IF */
+-	buf[7] = 0x05;  /* see MT352 Design Manual page 32 for details */
++	buf[3] = 0x50;  // old
++//	buf[3] = 0xf4;  // pinnacle
+ 
++	mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
++	mt352_calc_input_freq(state, buf+6);
+ 	state->config->pll_set(fe, param, buf+8);
+ 
+-	buf[13] = 0x01; /* TUNER_GO!! */
+-
++#if 0 /* FIXME: should be catched elsewhere ... */
+ 	/* Only send the tuning request if the tuner doesn't have the requested
+ 	 * parameters already set.  Enhances tuning time and prevents stream
+ 	 * breakup when retuning the same transponder. */
+ 	for (i = 1; i < 13; i++)
+-		if (buf[i] != mt352_read_register(state, i + 0x50)) {
+-			mt352_write(fe, buf, sizeof(buf));
++		if (buf[i] != mt352_read_register(state, i + 0x50))
+ 			break;
+-		}
+-
++	if (13 == i)
++		/* no changes */
++		return 0;
++#endif
++
++	mt352_write(fe, buf, sizeof(buf));
++	if (state->config->no_tuner) {
++		/* start decoding */
++		mt352_write(fe, fsm_go, 2);
++	} else {
++		/* start tuning */
++		mt352_write(fe, tuner_go, 2);
++	}
+ 	return 0;
+ }
+ 
+@@ -395,24 +434,39 @@
+ static int mt352_read_status(struct dvb_frontend* fe, fe_status_t* status)
+ {
+ 	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+-	u8 r;
++#if 1
++	int val;
+ 
+-		*status = 0;
+-	r = mt352_read_register (state, STATUS_0);
+-		if (r & (1 << 4))
+-			*status = FE_HAS_CARRIER;
+-		if (r & (1 << 1))
+-			*status |= FE_HAS_VITERBI;
+-		if (r & (1 << 5))
+-			*status |= FE_HAS_LOCK;
+-
+-	r = mt352_read_register (state, STATUS_1);
+-		if (r & (1 << 1))
+-			*status |= FE_HAS_SYNC;
+-
+-	r = mt352_read_register (state, STATUS_3);
+-		if (r & (1 << 6))
+-			*status |= FE_HAS_SIGNAL;
++	if (0 != mt352_read_register(state, INTERRUPT_0)) {
++		val = mt352_read_register(state, STATUS_0);
++		if (-1 != val)
++			state->s0 = val;
++		val = mt352_read_register(state, STATUS_1);
++		if (-1 != val)
++			state->s1 = val;
++		val = mt352_read_register(state, STATUS_3);
++		if (-1 != val)
++			state->s3 = val;
++	}
++#else
++	state->s0 = mt352_read_register(state, STATUS_0);
++	state->s1 = mt352_read_register(state, STATUS_1);
++	state->s3 = mt352_read_register(state, STATUS_3);
++	if (-1 == state->s0 || -1 == state->s1 || -1 == state->s3)
++		return -EIO;
++#endif
++
++	*status = 0;
++	if (state->s0 & (1 << 4))
++		*status |= FE_HAS_CARRIER;
++	if (state->s0 & (1 << 1))
++		*status |= FE_HAS_VITERBI;
++	if (state->s0 & (1 << 5))
++		*status |= FE_HAS_LOCK;
++	if (state->s1 & (1 << 1))
++		*status |= FE_HAS_SYNC;
++	if (state->s3 & (1 << 6))
++		*status |= FE_HAS_SIGNAL;
+ 
+ 	if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
+ 		      (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC))
+@@ -470,7 +524,7 @@
+ 	fe_tune_settings->max_drift = 0;
+ 
+ 	return 0;
+-	}
++}
+ 
+ static int mt352_init(struct dvb_frontend* fe)
+ {
+@@ -478,22 +532,24 @@
+ 
+ 	static u8 mt352_reset_attach [] = { RESET, 0xC0 };
+ 
++	dprintk("%s: hello\n",__FUNCTION__);
++
+ 	if ((mt352_read_register(state, CLOCK_CTL) & 0x10) == 0 ||
+ 	    (mt352_read_register(state, CONFIG) & 0x20) == 0) {
+ 
+-	/* Do a "hard" reset */
++		/* Do a "hard" reset */
+ 		mt352_write(fe, mt352_reset_attach, sizeof(mt352_reset_attach));
+ 		return state->config->demod_init(fe);
+ 	}
+ 
+ 	return 0;
+-	}
++}
+ 
+ static void mt352_release(struct dvb_frontend* fe)
+ {
+ 	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+-		kfree(state);
+-	}
++	kfree(state);
++}
+ 
+ static struct dvb_frontend_ops mt352_ops;
+ 
+@@ -505,6 +561,7 @@
+ 	/* allocate memory for the internal state */
+ 	state = (struct mt352_state*) kmalloc(sizeof(struct mt352_state), GFP_KERNEL);
+ 	if (state == NULL) goto error;
++	memset(state,0,sizeof(*state));
+ 
+ 	/* setup the state */
+ 	state->config = config;
+@@ -568,3 +625,9 @@
+ EXPORT_SYMBOL(mt352_attach);
+ EXPORT_SYMBOL(mt352_write);
+ EXPORT_SYMBOL(mt352_read);
++/*
++ * Local variables:
++ * c-basic-offset: 8
++ * compile-command: "make DVB=1"
++ * End:
++ */
+diff -Naru a/drivers/media/dvb/frontends/mt352.h b/drivers/media/dvb/frontends/mt352.h
+--- a/drivers/media/dvb/frontends/mt352.h	2005-04-01 19:49:20 -08:00
++++ b/drivers/media/dvb/frontends/mt352.h	2005-04-01 19:49:20 -08:00
+@@ -40,6 +40,13 @@
+ 	/* the demodulator's i2c address */
+ 	u8 demod_address;
+ 
++	/* frequencies in kHz */
++	int adc_clock;  // default: 20480
++	int if2;        // default: 36166
++
++	/* set if no pll is connected to the secondary i2c bus */
++	int no_tuner;
++
+ 	/* Initialise the demodulator and PLL. Cannot be NULL */
+ 	int (*demod_init)(struct dvb_frontend* fe);
+ 
+@@ -54,6 +61,12 @@
+ 					 struct i2c_adapter* i2c);
+ 
+ extern int mt352_write(struct dvb_frontend* fe, u8* ibuf, int ilen);
+-extern u8 mt352_read(struct dvb_frontend *fe, u8 reg);
++extern int mt352_read(struct dvb_frontend *fe, u8 reg);
+ 
+ #endif // MT352_H
++
++/*
++ * Local variables:
++ * c-basic-offset: 8
++ * End:
++ */
+# This is a BitKeeper generated diff -Nru style patch.
+#
+# ChangeSet
+#   2005/03/12 08:32:52-08:00 kraxel@bytesex.org 
+#   [PATCH] dvb: mt352 frontend driver update
+#   
+#   This patch updates the mt352 driver to make it work with the Pinnacle 300i
+#   card.  Some values are calculated at runtime now instead of having hard-coded
+#   defaults because the defaults don't fit for the Pinnacle, and some more small
+#   tweaks + fixes.
+#   
+#   This was also discussed + accepted on the dvb list, going to submit directly
+#   because the saa7134 driver update depends on this.
+#   
+#   Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
+#   Signed-off-by: Andrew Morton <akpm@osdl.org>
+#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+# 
+# drivers/media/dvb/frontends/mt352.c
+#   2005/03/11 12:32:22-08:00 kraxel@bytesex.org +130 -67
+#   dvb: mt352 frontend driver update
+# 
+# drivers/media/dvb/frontends/mt352.h
+#   2005/03/11 12:32:22-08:00 kraxel@bytesex.org +14 -1
+#   dvb: mt352 frontend driver update
+# 

Added: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-pll-lib.patch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-pll-lib.patch	2005-04-02 03:12:08 UTC (rev 2875)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/drivers-media-video-pll-lib.patch	2005-04-02 03:55:03 UTC (rev 2876)
@@ -0,0 +1,267 @@
+# origin: kraxel@bytesex.org (BitKeeper)
+# cset: 423319a36q-_c0uFUy7yn7K9DzXlzw
+# URL: http://linux.bkbits.net:8080/linux-2.6/cset@423319a36q-_c0uFUy7yn7K9DzXlzw
+# inclusion: upstream (backport)
+# description: [PATCH] dvb: add pll lib
+# revision date: 2005/03/12 08:32:35-08:00
+#
+diff -Naru a/drivers/media/dvb/frontends/Makefile b/drivers/media/dvb/frontends/Makefile
+--- a/drivers/media/dvb/frontends/Makefile	2005-04-01 19:38:38 -08:00
++++ b/drivers/media/dvb/frontends/Makefile	2005-04-01 19:38:38 -08:00
+@@ -4,6 +4,7 @@
+ 
+ EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/
+ 
++obj-$(CONFIG_DVB_CORE) += dvb-pll.o
+ obj-$(CONFIG_DVB_STV0299) += stv0299.o
+ obj-$(CONFIG_DVB_SP8870) += sp8870.o
+ obj-$(CONFIG_DVB_CX22700) += cx22700.o
+diff -Naru a/drivers/media/dvb/frontends/dvb-pll.c b/drivers/media/dvb/frontends/dvb-pll.c
+--- a/drivers/media/dvb/frontends/dvb-pll.c	1969-12-31 16:00:00 -08:00
++++ b/drivers/media/dvb/frontends/dvb-pll.c	2005-04-01 19:38:38 -08:00
+@@ -0,0 +1,168 @@
++/*
++ * $Id: dvb-pll.c,v 1.7 2005/02/10 11:52:02 kraxel Exp $
++ *
++ * descriptions + helper functions for simple dvb plls.
++ *
++ * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
++ *
++ *  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
++ *  (at your option) any later version.
++ *
++ *  This program is distributed in the hope that it will be useful,
++ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
++ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ *  GNU General Public License for more details.
++ *
++ *  You should have received a copy of the GNU General Public License
++ *  along with this program; if not, write to the Free Software
++ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++ */
++
++#include <linux/module.h>
++#include <linux/dvb/frontend.h>
++#include <asm/types.h>
++
++#include "dvb-pll.h"
++
++/* ----------------------------------------------------------- */
++/* descriptions                                                */
++
++struct dvb_pll_desc dvb_pll_thomson_dtt7579 = {
++	.name  = "Thomson dtt7579",
++	.min   = 177000000,
++	.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 },
++	},
++};
++EXPORT_SYMBOL(dvb_pll_thomson_dtt7579);
++
++struct dvb_pll_desc dvb_pll_thomson_dtt7610 = {
++	.name  = "Thomson dtt7610",
++	.min   =  44000000,
++	.max   = 958000000,
++	.count = 3,
++	.entries = {
++		{ 157250000, 44000000, 62500, 0x8e, 0x39 },
++		{ 454000000, 44000000, 62500, 0x8e, 0x3a },
++		{ 999999999, 44000000, 62500, 0x8e, 0x3c },
++	},
++};
++EXPORT_SYMBOL(dvb_pll_thomson_dtt7610);
++
++static void thomson_dtt759x_bw(u8 *buf, int bandwidth)
++{
++	if (BANDWIDTH_7_MHZ == bandwidth)
++		buf[3] |= 0x10;
++}
++
++struct dvb_pll_desc dvb_pll_thomson_dtt759x = {
++	.name  = "Thomson dtt759x",
++	.min   = 177000000,
++	.max   = 896000000,
++	.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 },
++	},
++};
++EXPORT_SYMBOL(dvb_pll_thomson_dtt759x);
++
++struct dvb_pll_desc dvb_pll_lg_z201 = {
++	.name  = "LG z201",
++	.min   = 174000000,
++	.max   = 862000000,
++	.count = 5,
++	.entries = {
++		{          0, 36166667, 166666, 0xbc, 0x03 },
++		{  443250000, 36166667, 166666, 0xbc, 0x01 },
++		{  542000000, 36166667, 166666, 0xbc, 0x02 },
++		{  830000000, 36166667, 166666, 0xf4, 0x02 },
++		{  999999999, 36166667, 166666, 0xfc, 0x02 },
++	},
++};
++EXPORT_SYMBOL(dvb_pll_lg_z201);
++
++struct dvb_pll_desc dvb_pll_unknown_1 = {
++	.name  = "unknown 1", /* used by dntv live dvb-t */
++	.min   = 174000000,
++	.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 },
++	},
++};
++EXPORT_SYMBOL(dvb_pll_unknown_1);
++
++/* ----------------------------------------------------------- */
++/* code                                                        */
++
++static int debug = 0;
++module_param(debug, int, 0644);
++MODULE_PARM_DESC(debug, "enable verbose debug messages");
++
++int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
++		      u32 freq, int bandwidth)
++{
++	u32 div;
++	int i;
++
++	if (freq != 0 && (freq < desc->min || freq > desc->max))
++	    return -EINVAL;
++
++	for (i = 0; i < desc->count; i++) {
++		if (freq > desc->entries[i].limit)
++			continue;
++		break;
++	}
++	if (debug)
++		printk("pll: %s: freq=%d bw=%d | i=%d/%d\n",
++		       desc->name, freq, bandwidth, i, desc->count);
++	BUG_ON(i == desc->count);
++
++	div = (freq + desc->entries[i].offset) / desc->entries[i].stepsize;
++	buf[0] = div >> 8;
++	buf[1] = div & 0xff;
++	buf[2] = desc->entries[i].cb1;
++	buf[3] = desc->entries[i].cb2;
++
++	if (desc->setbw)
++		desc->setbw(buf, bandwidth);
++
++	if (debug)
++		printk("pll: %s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
++		       desc->name, div, buf[0], buf[1], buf[2], buf[3]);
++
++	return 0;
++}
++EXPORT_SYMBOL(dvb_pll_configure);
++
++MODULE_DESCRIPTION("dvb pll library");
++MODULE_AUTHOR("Gerd Knorr");
++MODULE_LICENSE("GPL");
++
++/*
++ * Local variables:
++ * c-basic-offset: 8
++ * End:
++ */
+diff -Naru a/drivers/media/dvb/frontends/dvb-pll.h b/drivers/media/dvb/frontends/dvb-pll.h
+--- a/drivers/media/dvb/frontends/dvb-pll.h	1969-12-31 16:00:00 -08:00
++++ b/drivers/media/dvb/frontends/dvb-pll.h	2005-04-01 19:38:38 -08:00
+@@ -0,0 +1,34 @@
++/*
++ * $Id: dvb-pll.h,v 1.2 2005/02/10 11:43:41 kraxel Exp $
++ */
++
++struct dvb_pll_desc {
++	char *name;
++	u32  min;
++	u32  max;
++	void (*setbw)(u8 *buf, int bandwidth);
++	int  count;
++	struct {
++		u32 limit;
++		u32 offset;
++		u32 stepsize;
++		u8  cb1;
++		u8  cb2;
++	} entries[0];
++};
++
++extern struct dvb_pll_desc dvb_pll_thomson_dtt7579;
++extern struct dvb_pll_desc dvb_pll_thomson_dtt759x;
++extern struct dvb_pll_desc dvb_pll_thomson_dtt7610;
++extern struct dvb_pll_desc dvb_pll_lg_z201;
++extern struct dvb_pll_desc dvb_pll_unknown_1;
++
++int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf,
++		      u32 freq, int bandwidth);
++
++/*
++ * Local variables:
++ * c-basic-offset: 8
++ * compile-command: "make DVB=1"
++ * End:
++ */
+# This is a BitKeeper generated diff -Nru style patch.
+#
+# ChangeSet
+#   2005/03/12 08:32:35-08:00 kraxel@bytesex.org 
+#   [PATCH] dvb: add pll lib
+#   
+#   This adds some helper code to handle tuning for dvb cards, with a struct
+#   describing the pll and a function calculating the command sequence needed to
+#   program it.
+#   
+#   This one was discussed + accepted on the linuxtv list and also is in the
+#   linuxtv cvs.  As the the cx88 driver update I want finally get out of the door
+#   depends on this one I'll go submit it myself instead of waiting for the dvb
+#   guys doing it.
+#   
+#   Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
+#   Signed-off-by: Andrew Morton <akpm@osdl.org>
+#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+# 
+# drivers/media/dvb/frontends/Makefile
+#   2005/03/11 12:32:21-08:00 kraxel@bytesex.org +1 -0
+#   dvb: add pll lib
+# 
+# drivers/media/dvb/frontends/dvb-pll.c
+#   2005/03/11 12:32:21-08:00 kraxel@bytesex.org +0 -0
+#   BitKeeper file /home/torvalds/v2.6/linux/drivers/media/dvb/frontends/dvb-pll.c
+# 
+# drivers/media/dvb/frontends/dvb-pll.c
+#   2005/03/11 12:32:21-08:00 kraxel@bytesex.org +168 -0
+#   dvb: add pll lib
+# 
+# drivers/media/dvb/frontends/dvb-pll.h
+#   2005/03/11 12:32:21-08:00 kraxel@bytesex.org +0 -0
+#   BitKeeper file /home/torvalds/v2.6/linux/drivers/media/dvb/frontends/dvb-pll.h
+# 
+# drivers/media/dvb/frontends/dvb-pll.h
+#   2005/03/11 12:32:21-08:00 kraxel@bytesex.org +34 -0
+#   dvb: add pll lib
+# 

Modified: trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-2
===================================================================
--- trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-2	2005-04-02 03:12:08 UTC (rev 2875)
+++ trunk/kernel/source/kernel-source-2.6.11-2.6.11/debian/patches/series/2.6.11-2	2005-04-02 03:55:03 UTC (rev 2876)
@@ -13,3 +13,5 @@
 - patch-2.6.11.5.patch
 + patch-2.6.11.6.patch
 + drivers-media-video-saa7134-update-2.patch
++ drivers-media-video-pll-lib.patch
++ drivers-media-video-mt352-update.patch