public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1
@ 2005-03-22  1:23 Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 01/48] clarify firmware upload messages Johannes Stezenbach
                   ` (47 more replies)
  0 siblings, 48 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hello Andrew,

as promised (or threatened ;-) here are my current
DVB patches for 2.6.12-rc1-mm1. Most patches were
in linuxtv.org CVS for over a month, except some
cleanups and small but important fixes.

I hope these patches will make it into 2.6.12.

Please Apply.

Thanks,
Johannes


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 01/48] clarify firmware upload messages
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 02/48] dibcom: frontend fixes Johannes Stezenbach
                   ` (46 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-fw-msg.patch --]
[-- Type: text/plain, Size: 3179 bytes --]

clarify firmware upload messages

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 nxt2002.c  |    3 ++-
 tda1004x.c |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt2002.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:14:18.000000000 +0100
@@ -520,7 +520,7 @@ static int nxt2002_init(struct dvb_front
 
 	if (!state->initialised) {
 		/* request the firmware, this will block until someone uploads it */
-		printk("nxt2002: Waiting for firmware upload...\n");
+		printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE);
 		ret = state->config->request_firmware(fe, &fw, NXT2002_DEFAULT_FIRMWARE);
 		printk("nxt2002: Waiting for firmware upload(2)...\n");
 		if (ret) {
@@ -534,6 +534,7 @@ static int nxt2002_init(struct dvb_front
 			release_firmware(fw);
 			return ret;
 		}
+		printk("nxt2002: firmware upload complete\n");
 
 		/* Put the micro into reset */
 		nxt2002_microcontroller_stop(state);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda1004x.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c	2005-03-22 00:14:18.000000000 +0100
@@ -353,7 +353,7 @@ static int tda10045_fwupload(struct dvb_
 	if (tda1004x_check_upload_ok(state, 0x2c) == 0) return 0;
 
 	/* request the firmware, this will block until someone uploads it */
-	printk("tda1004x: waiting for firmware upload...\n");
+	printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10045_DEFAULT_FIRMWARE);
 	ret = state->config->request_firmware(fe, &fw, TDA10045_DEFAULT_FIRMWARE);
 	if (ret) {
 		printk("tda1004x: no firmware upload (timeout or file not found?)\n");
@@ -372,6 +372,7 @@ static int tda10045_fwupload(struct dvb_
 	ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10045H_FWPAGE, TDA10045H_CODE_IN);
 	if (ret)
 		return ret;
+	printk("tda1004x: firmware upload complete\n");
 
 	/* wait for DSP to initialise */
 	/* DSPREADY doesn't seem to work on the TDA10045H */
@@ -396,7 +397,7 @@ static int tda10046_fwupload(struct dvb_
 	if (tda1004x_check_upload_ok(state, 0x20) == 0) return 0;
 
 	/* request the firmware, this will block until someone uploads it */
-	printk("tda1004x: waiting for firmware upload...\n");
+	printk("tda1004x: waiting for firmware upload (%s)...\n", TDA10046_DEFAULT_FIRMWARE);
 	ret = state->config->request_firmware(fe, &fw, TDA10046_DEFAULT_FIRMWARE);
 	if (ret) {
 		printk("tda1004x: no firmware upload (timeout or file not found?)\n");
@@ -414,6 +415,7 @@ static int tda10046_fwupload(struct dvb_
 	ret = tda1004x_do_upload(state, fw->data, fw->size, TDA10046H_CODE_CPT, TDA10046H_CODE_IN);
 	if (ret)
 		return ret;
+	printk("tda1004x: firmware upload complete\n");
 
 	/* wait for DSP to initialise */
 	timeout = jiffies + HZ;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 02/48] dibcom: frontend fixes
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 01/48] clarify firmware upload messages Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 03/48] dibusb: misc. fixes Johannes Stezenbach
                   ` (45 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-dib3000x.patch --]
[-- Type: text/plain, Size: 5780 bytes --]

o corrected the name in driver_desc
o removed debug messages and some comments (see dib3000-watch)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dib3000mb.c |   68 +++++++-----------------------------------------------------
 dib3000mc.c |    2 -
 2 files changed, 9 insertions(+), 61 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mb.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:14:30.000000000 +0100
@@ -35,7 +35,7 @@
 
 /* Version information */
 #define DRIVER_VERSION "0.1"
-#define DRIVER_DESC "DiBcom 3000-MB DVB-T demodulator driver"
+#define DRIVER_DESC "DiBcom 3000M-B DVB-T demodulator driver"
 #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
 
 #ifdef CONFIG_DVB_DIBCOM_DEBUG
@@ -297,7 +297,7 @@ static int dib3000mb_set_frontend(struct
 					rd(DIB3000MB_REG_LOCK2_VALUE))) < 0 && as_count++ < 100)
 			msleep(1);
 
-		deb_info("search_state after autosearch %d after %d checks\n",search_state,as_count);
+		deb_setf("search_state after autosearch %d after %d checks\n",search_state,as_count);
 
 		if (search_state == 1) {
 			struct dvb_frontend_parameters feps;
@@ -319,6 +319,7 @@ static int dib3000mb_fe_init(struct dvb_
 {
 	struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv;
 
+	deb_info("dib3000mb is getting up.\n");
 	wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_UP);
 
 	wr(DIB3000MB_REG_RESTART, DIB3000MB_RESTART_AGC);
@@ -574,16 +575,9 @@ static int dib3000mb_read_status(struct 
 	if (rd(DIB3000MB_REG_TS_SYNC_LOCK))
 		*stat |= (FE_HAS_SYNC | FE_HAS_LOCK);
 
-	deb_info("actual status is %2x\n",*stat);
+	deb_getf("actual status is %2x\n",*stat);
 
-	deb_getf("tps %x %x %x %x %x\n",
-			rd(DIB3000MB_REG_TPS_1),
-			rd(DIB3000MB_REG_TPS_2),
-			rd(DIB3000MB_REG_TPS_3),
-			rd(DIB3000MB_REG_TPS_4),
-			rd(DIB3000MB_REG_TPS_5));
-
-	deb_info("autoval: tps: %d, qam: %d, hrch: %d, alpha: %d, hp: %d, lp: %d, guard: %d, fft: %d cell: %d\n",
+	deb_getf("autoval: tps: %d, qam: %d, hrch: %d, alpha: %d, hp: %d, lp: %d, guard: %d, fft: %d cell: %d\n",
 			rd(DIB3000MB_REG_TPS_LOCK),
 			rd(DIB3000MB_REG_TPS_QAM),
 			rd(DIB3000MB_REG_TPS_HRCH),
@@ -605,68 +599,22 @@ static int dib3000mb_read_ber(struct dvb
 	*ber = ((rd(DIB3000MB_REG_BER_MSB) << 16) | rd(DIB3000MB_REG_BER_LSB));
 	return 0;
 }
-/*
- * Amaury:
- * signal strength is measured with dBm (power compared to mW)
- * the standard range is -90dBm(low power) to -10 dBm (strong power),
- * but the calibration is done for -100 dBm to 0dBm
- */
-
-#define DIB3000MB_AGC_REF_dBm		-14
-#define DIB3000MB_GAIN_SLOPE_dBm	100
-#define DIB3000MB_GAIN_DELTA_dBm	-2
+
+/* see dib3000-watch dvb-apps for exact calcuations of signal_strength and snr */
 static int dib3000mb_read_signal_strength(struct dvb_frontend* fe, u16 *strength)
 {
 	struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv;
 
-/* TODO log10
-	u16 sigpow = rd(DIB3000MB_REG_SIGNAL_POWER),
-		n_agc_power = rd(DIB3000MB_REG_AGC_POWER),
-		rf_power = rd(DIB3000MB_REG_RF_POWER);
-	double rf_power_dBm, ad_power_dBm, minar_power_dBm;
-
-	if (n_agc_power == 0 )
-		n_agc_power = 1 ;
-
-	ad_power_dBm    = 10 * log10 ( (float)n_agc_power / (float)(1<<16) );
-	minor_power_dBm = ad_power_dBm - DIB3000MB_AGC_REF_dBm;
-	rf_power_dBm = (-DIB3000MB_GAIN_SLOPE_dBm * (float)rf_power / (float)(1<<16) +
-			DIB3000MB_GAIN_DELTA_dBm) + minor_power_dBm;
-	// relative rf_power
-	*strength = (u16) ((rf_power_dBm + 100) / 100 * 0xffff);
-*/
 	*strength = rd(DIB3000MB_REG_SIGNAL_POWER) * 0xffff / 0x170;
 	return 0;
 }
 
-/*
- * Amaury:
- * snr is the signal quality measured in dB.
- * snr = 10*log10(signal power / noise power)
- * the best quality is near 35dB (cable transmission & good modulator)
- * the minimum without errors depend of transmission parameters
- * some indicative values are given in en300744 Annex A
- * ex : 16QAM 2/3 (Gaussian)  = 11.1 dB
- *
- * If SNR is above 20dB, BER should be always 0.
- * choose 0dB as the minimum
- */
 static int dib3000mb_read_snr(struct dvb_frontend* fe, u16 *snr)
 {
 	struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv;
 	short sigpow = rd(DIB3000MB_REG_SIGNAL_POWER);
 	int icipow = ((rd(DIB3000MB_REG_NOISE_POWER_MSB) & 0xff) << 16) |
 		rd(DIB3000MB_REG_NOISE_POWER_LSB);
-/*
-	float snr_dBm=0;
-
-	if (sigpow > 0 && icipow > 0)
-		snr_dBm = 10.0 * log10( (float) (sigpow<<8) / (float)icipow )  ;
-	else if (sigpow > 0)
-		snr_dBm = 35;
-
-	*snr = (u16) ((snr_dBm / 35) * 0xffff);
-*/
 	*snr = (sigpow << 8) / ((icipow > 0) ? icipow : 1);
 	return 0;
 }
@@ -682,7 +630,7 @@ static int dib3000mb_read_unc_blocks(str
 static int dib3000mb_sleep(struct dvb_frontend* fe)
 {
 	struct dib3000_state* state = (struct dib3000_state*) fe->demodulator_priv;
-
+	deb_info("dib3000mb is going to bed.\n");
 	wr(DIB3000MB_REG_POWER_CONTROL, DIB3000MB_POWER_DOWN);
 	return 0;
 }
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:14:30.000000000 +0100
@@ -34,7 +34,7 @@
 
 /* Version information */
 #define DRIVER_VERSION "0.1"
-#define DRIVER_DESC "DiBcom 3000-MC DVB-T demodulator driver"
+#define DRIVER_DESC "DiBcom 3000M-C DVB-T demodulator driver"
 #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
 
 #ifdef CONFIG_DVB_DIBCOM_DEBUG

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 03/48] dibusb: misc. fixes
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 01/48] clarify firmware upload messages Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 02/48] dibcom: frontend fixes Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 04/48] skystar2: remove duplicate pci_release_region() Johannes Stezenbach
                   ` (44 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb.patch --]
[-- Type: text/plain, Size: 7484 bytes --]

o worked around hw_sleep handling for usb1.1 devices
o fixed oops when no frontend was attached (because of usb1.1 timeouts in my
  debugging sessions)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-fe-i2c.c |    4 ++
 dvb-dibusb-usb.c    |   70 ++++++++++++++++++++++++++--------------------------
 2 files changed, 39 insertions(+), 35 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:14:35.000000000 +0100
@@ -178,6 +178,8 @@ int dibusb_fe_init(struct usb_dibusb* di
 				break;
 			}
 		}
+		/* if a frontend was found */
+		if (dib->fe != NULL) {
 			if (dib->fe->ops->sleep != NULL)
 				dib->fe_sleep = dib->fe->ops->sleep;
 			dib->fe->ops->sleep = dibusb_hw_sleep;
@@ -192,6 +194,7 @@ int dibusb_fe_init(struct usb_dibusb* di
 			/* check which tuner is mounted on this device, in case this is unsure */
 			dibusb_tuner_quirk(dib);
 		}
+	}
 	if (dib->fe == NULL) {
 		err("A frontend driver was not found for device '%s'.",
 		       dib->dibdev->name);
@@ -205,6 +208,7 @@ int dibusb_fe_init(struct usb_dibusb* di
 			return -ENODEV;
 		}
 	}
+
 	return 0;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:14:35.000000000 +0100
@@ -1,12 +1,12 @@
 /*
- * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices 
+ * dvb-dibusb-usb.c is part of the driver for mobile USB Budget DVB-T devices
  * based on reference design made by DiBcom (http://www.dibcom.fr/)
  *
  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
  *
  * see dvb-dibusb-core.c for more copyright details.
  *
- * This file contains functions for initializing and handling the 
+ * This file contains functions for initializing and handling the
  * usb specific stuff.
  */
 #include "dvb-dibusb.h"
@@ -25,18 +25,18 @@ int dibusb_readwrite_usb(struct usb_dibu
 	if ((ret = down_interruptible(&dib->usb_sem)))
 		return ret;
 
-	if (dib->feedcount && 
-		wbuf[0] == DIBUSB_REQ_I2C_WRITE && 
+	if (dib->feedcount &&
+		wbuf[0] == DIBUSB_REQ_I2C_WRITE &&
 		dib->dibdev->dev_cl->id == DIBUSB1_1)
 		deb_err("BUG: writing to i2c, while TS-streaming destroys the stream."
 				"(%x reg: %x %x)\n", wbuf[0],wbuf[2],wbuf[3]);
-			
+
 	debug_dump(wbuf,wlen);
 
 	ret = usb_bulk_msg(dib->udev,usb_sndbulkpipe(dib->udev,
 			dib->dibdev->dev_cl->pipe_cmd), wbuf,wlen,&actlen,
 			DIBUSB_I2C_TIMEOUT);
-		
+
 	if (ret)
 		err("bulk message failed: %d (%d/%d)",ret,wlen,actlen);
 	else
@@ -55,7 +55,7 @@ int dibusb_readwrite_usb(struct usb_dibu
 			debug_dump(rbuf,actlen);
 		}
 	}
-	
+
 	up(&dib->usb_sem);
 	return ret;
 }
@@ -63,15 +63,18 @@ int dibusb_readwrite_usb(struct usb_dibu
 /*
  * Cypress controls
  */
+static int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
+{
+	return dibusb_readwrite_usb(dib,buf,len,NULL,0);
+}
 
 #if 0
-/* 
- * #if 0'ing the following functions as they are not in use _now_, 
+/*
+ * #if 0'ing the following functions as they are not in use _now_,
  * but probably will be sometime.
  */
-
 /*
- * do not use this, just a workaround for a bug, 
+ * do not use this, just a workaround for a bug,
  * which will hopefully never occur :).
  */
 int dibusb_interrupt_read_loop(struct usb_dibusb *dib)
@@ -79,15 +82,10 @@ int dibusb_interrupt_read_loop(struct us
 	u8 b[1] = { DIBUSB_REQ_INTR_READ };
 	return dibusb_write_usb(dib,b,1);
 }
-
-#endif 
-static int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
-{
-	return dibusb_readwrite_usb(dib,buf,len,NULL,0);
-}
+#endif
 
 /*
- * ioctl for the firmware 
+ * ioctl for the firmware
  */
 static int dibusb_ioctl_cmd(struct usb_dibusb *dib, u8 cmd, u8 *param, int plen)
 {
@@ -112,10 +110,10 @@ int dibusb_hw_wakeup(struct dvb_frontend
 	u8 b[1] = { DIBUSB_IOCTL_POWER_WAKEUP };
 	deb_info("dibusb-device is getting up.\n");
 	dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
-	
+
 	if (dib->fe_init)
 		return dib->fe_init(fe);
-	
+
 	return 0;
 }
 
@@ -124,11 +122,13 @@ int dibusb_hw_sleep(struct dvb_frontend 
 	struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv;
 	u8 b[1] = { DIBUSB_IOCTL_POWER_SLEEP };
 	deb_info("dibusb-device is going to bed.\n");
-	dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
+	/* workaround, something is wrong, when dibusb 1.1 device are going to bed too late */
+	if (dib->dibdev->dev_cl->id != DIBUSB1_1)
+		dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
 
 	if (dib->fe_sleep)
 		return dib->fe_sleep(fe);
-	
+
 	return 0;
 }
 
@@ -147,7 +147,7 @@ int dibusb_streaming(struct usb_dibusb *
 			else
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_DISABLE_STREAM,NULL,0);
 			break;
-		case UMT2_0: 
+		case UMT2_0:
 			return dibusb_set_streaming_mode(dib,onoff);
 			break;
 		default:
@@ -159,9 +159,9 @@ int dibusb_streaming(struct usb_dibusb *
 int dibusb_urb_init(struct usb_dibusb *dib)
 {
 	int ret,i,bufsize,def_pid_parse = 1;
-	
+
 	/*
-	 * when reloading the driver w/o replugging the device 
+	 * when reloading the driver w/o replugging the device
 	 * a timeout occures, this helps
 	 */
 	usb_clear_halt(dib->udev,usb_sndbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_cmd));
@@ -175,7 +175,7 @@ int dibusb_urb_init(struct usb_dibusb *d
 	memset(dib->urb_list,0,dib->dibdev->dev_cl->urb_count*sizeof(struct urb *));
 
 	dib->init_state |= DIBUSB_STATE_URB_LIST;
-	
+
 	bufsize = dib->dibdev->dev_cl->urb_count*dib->dibdev->dev_cl->urb_buffer_size;
 	deb_info("allocate %d bytes as buffersize for all URBs\n",bufsize);
 	/* allocate the actual buffer for the URBs */
@@ -185,7 +185,7 @@ int dibusb_urb_init(struct usb_dibusb *d
 	}
 	deb_info("allocation complete\n");
 	memset(dib->buffer,0,bufsize);
-	
+
 	dib->init_state |= DIBUSB_STATE_URB_BUF;
 
 	/* allocate and submit the URBs */
@@ -194,13 +194,13 @@ int dibusb_urb_init(struct usb_dibusb *d
 			return -ENOMEM;
 		}
 		deb_info("submitting URB no. %d\n",i);
-		
-		usb_fill_bulk_urb( dib->urb_list[i], dib->udev, 
+
+		usb_fill_bulk_urb( dib->urb_list[i], dib->udev,
 				usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data),
-				&dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size], 
-				dib->dibdev->dev_cl->urb_buffer_size, 
+				&dib->buffer[i*dib->dibdev->dev_cl->urb_buffer_size],
+				dib->dibdev->dev_cl->urb_buffer_size,
 				dibusb_urb_complete, dib);
-		
+
 		dib->urb_list[i]->transfer_flags = 0;
 
 		if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) {
@@ -222,12 +222,12 @@ int dibusb_urb_init(struct usb_dibusb *d
 			} else
 				info("will use pid_parsing.");
 			break;
-		default: 
+		default:
 			break;
 	}
 	/* from here on it contains the device and user decision */
 	dib->pid_parse = def_pid_parse;
-	
+
 	return 0;
 }
 
@@ -241,7 +241,7 @@ int dibusb_urb_exit(struct usb_dibusb *d
 
 				/* stop the URBs */
 				usb_kill_urb(dib->urb_list[i]);
-				
+
 				deb_info("freeing URB no. %d.\n",i);
 				/* free the URBs */
 				usb_free_urb(dib->urb_list[i]);

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 04/48] skystar2: remove duplicate pci_release_region()
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (2 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 03/48] dibusb: misc. fixes Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 05/48] mt352: Pinnacle 300i comments Johannes Stezenbach
                   ` (43 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-skystar2-pci.patch --]
[-- Type: text/plain, Size: 774 bytes --]

remove duplicated pci_release_region() etc.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 skystar2.c |    4 ----
 1 files changed, 4 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/skystar2.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:14:40.000000000 +0100
@@ -1996,10 +1996,6 @@ static void driver_halt(struct pci_dev *
 	free_adapter_object(adapter);
 
 	pci_set_drvdata(pdev, NULL);
-
-	pci_disable_device(pdev);
-	pci_release_region(pdev, 1);
-	pci_release_region(pdev, 0);
 }
 
 static int dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed)

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 05/48] mt352: Pinnacle 300i comments
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (3 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 04/48] skystar2: remove duplicate pci_release_region() Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 06/48] support Activy Budget card Johannes Stezenbach
                   ` (42 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontends-mt352-comments.patch --]
[-- Type: text/plain, Size: 1263 bytes --]

Comment preliminary Pinnacle 300i changes to the mt352 driver.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 mt352.c |    4 ++++
 1 files changed, 4 insertions(+)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/mt352.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c	2005-03-22 00:14:46.000000000 +0100
@@ -294,6 +294,8 @@ static int mt352_set_parameters(struct d
 	state->config->pll_set(fe, param, buf+8);
 
 #if 0 /* FIXME: should be catched elsewhere ... */
+	/* this dubious code which helped on some cards does not work for
+	 * the pinnacle 300i */
 	/* 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. */
@@ -435,6 +437,8 @@ static int mt352_read_status(struct dvb_
 {
 	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
 #if 1
+	/* the pinnacle 300i loses lock if the STATUS_x registers
+	 * are polled too often... */
 	int val;
 
 	if (0 != mt352_read_register(state, INTERRUPT_0)) {

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 06/48] support Activy Budget card
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (4 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 05/48] mt352: Pinnacle 300i comments Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 07/48] skystar2: update email address Johannes Stezenbach
                   ` (41 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttpci-activy-budget.patch --]
[-- Type: text/plain, Size: 2328 bytes --]

support Activy Budget with ALPS BSRU6 tuner
submitted by Andreas 'randy' Weinberger.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 budget.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget.c	2005-03-22 00:14:50.000000000 +0100
@@ -444,9 +444,15 @@ static void frontend_init(struct budget 
 		if (budget->dvb_frontend) break;
 		break;
 
-	case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI (tda8083/Grundig 29504-451(tsa5522))
+	case 0x4f60: // Fujitsu Siemens Activy Budget-S PCI rev AL (stv0299/ALPS BSRU6(tsa5059))
+		budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap);
+		if (budget->dvb_frontend) {
+			budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage;
+			break;
+		}
+		break;
 
-		// grundig 29504-451
+	case 0x4f61: // Fujitsu Siemens Activy Budget-S PCI rev GR (tda8083/Grundig 29504-451(tsa5522))
 		budget->dvb_frontend = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap);
 		if (budget->dvb_frontend) {
 			budget->dvb_frontend->ops->set_voltage = siemens_budget_set_voltage;
@@ -518,14 +524,16 @@ MAKE_BUDGET_INFO(ttbs,	"TT-Budget/WinTV-
 MAKE_BUDGET_INFO(ttbc,	"TT-Budget/WinTV-NOVA-C  PCI",	BUDGET_TT);
 MAKE_BUDGET_INFO(ttbt,	"TT-Budget/WinTV-NOVA-T  PCI",	BUDGET_TT);
 MAKE_BUDGET_INFO(satel,	"SATELCO Multimedia PCI",	BUDGET_TT_HW_DISEQC);
-MAKE_BUDGET_INFO(fsacs, "Fujitsu Siemens Activy Budget-S PCI", BUDGET_FS_ACTIVY);
+MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S PCI (rev GR/grundig frontend)", BUDGET_FS_ACTIVY);
+MAKE_BUDGET_INFO(fsacs1, "Fujitsu Siemens Activy Budget-S PCI (rev AL/alps frontend)", BUDGET_FS_ACTIVY);
 
 static struct pci_device_id pci_tbl[] = {
 	MAKE_EXTENSION_PCI(ttbs,  0x13c2, 0x1003),
 	MAKE_EXTENSION_PCI(ttbc,  0x13c2, 0x1004),
 	MAKE_EXTENSION_PCI(ttbt,  0x13c2, 0x1005),
 	MAKE_EXTENSION_PCI(satel, 0x13c2, 0x1013),
-	MAKE_EXTENSION_PCI(fsacs, 0x1131, 0x4f61),
+	MAKE_EXTENSION_PCI(fsacs1,0x1131, 0x4f60),
+	MAKE_EXTENSION_PCI(fsacs0,0x1131, 0x4f61),
 	{
 		.vendor    = 0,
 	}

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 07/48] skystar2: update email address
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (5 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 06/48] support Activy Budget card Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 08/48] ves1x93: invert_pwm fix Johannes Stezenbach
                   ` (40 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-skystar2-email.patch --]
[-- Type: text/plain, Size: 1178 bytes --]

Updated email address.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 skystar2.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:14:40.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:14:55.000000000 +0100
@@ -5,14 +5,14 @@
  * Copyright (C) 2003  Vadim Catana, skystar@moldova.cc
  *
  * FIX: DISEQC Tone Burst in flexcop_diseqc_ioctl()
- * FIX: FULL soft DiSEqC for skystar2 (FlexCopII rev 130) VP310 equipped 
+ * FIX: FULL soft DiSEqC for skystar2 (FlexCopII rev 130) VP310 equipped
  *     Vincenzo Di Massa, hawk.it at tiscalinet.it
- * 	
+ *
  * Converted to Linux coding style
  * Misc reorganization, polishing, restyling
- *     Roberto Ragusa, r.ragusa at libero.it
- *       
- * Added hardware filtering support, 
+ *     Roberto Ragusa, skystar2-c5b8 at robertoragusa dot it
+ *
+ * Added hardware filtering support,
  *     Niklas Peinecke, peinecke at gdv.uni-hannover.de
  *
  *

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 08/48] ves1x93: invert_pwm fix
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (6 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 07/48] skystar2: update email address Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 09/48] dibusb readme update Johannes Stezenbach
                   ` (39 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontends-ves1x93-invert-pwm.patch --]
[-- Type: text/plain, Size: 1317 bytes --]

fix unhandled invert_pwm option (needed on dbox2 hardware)
submitted by Carsten Juttner

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 ves1x93.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/ves1x93.c	2005-03-21 23:27:59.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c	2005-03-22 00:15:00.000000000 +0100
@@ -175,7 +175,7 @@ static int ves1x93_set_symbolrate (struc
 {
 	u32 BDR;
 	u32 ratio;
-	u8  ADCONF, FCONF, FNR;
+	u8  ADCONF, FCONF, FNR, AGCR;
 	u32 BDRI;
 	u32 tmp;
 	u32 FIN;
@@ -243,10 +243,16 @@ static int ves1x93_set_symbolrate (struc
 	ves1x93_writereg (state, 0x20, ADCONF);
 	ves1x93_writereg (state, 0x21, FCONF);
 
+	AGCR = state->init_1x93_tab[0x05];
+	if (state->config->invert_pwm)
+		AGCR |= 0x20;
+
 	if (srate < 6000000)
-		ves1x93_writereg (state, 0x05, state->init_1x93_tab[0x05] | 0x80);
+		AGCR |= 0x80;
 	else
-		ves1x93_writereg (state, 0x05, state->init_1x93_tab[0x05] & 0x7f);
+		AGCR &= ~0x80;
+
+	ves1x93_writereg (state, 0x05, AGCR);
 
 	/* ves1993 hates this, will lose lock */
 	if (state->demod_type != DEMOD_VES1993)

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 09/48] dibusb readme update
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (7 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 08/48] ves1x93: invert_pwm fix Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 10/48] dibusb: support Hauppauge WinTV NOVA-T USB2 Johannes Stezenbach
                   ` (38 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-readme.patch --]
[-- Type: text/plain, Size: 6892 bytes --]

dibusb readme update (Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 README.dibusb |   57 +++++++++++++++++++++++++--------------------------------
 1 files changed, 25 insertions(+), 32 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/README.dibusb	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb	2005-03-22 00:15:04.000000000 +0100
@@ -1,7 +1,7 @@
 Documentation for dib3000mb frontend driver and dibusb device driver
 ====================================================================
 
-Copyright (C) 2004 Patrick Boettcher (patrick.boettcher@desy.de),
+Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de),
 
 dibusb and dib3000mb/mc drivers based on GPL code, which has
 
@@ -46,7 +46,7 @@ Produced and reselled by KWorld:
 
 Others:
 -------
-- Ultima Electronic/Artec T1 USB TVBOX (AN2135, AN2235, AN2235 with Panasonic Tuner) 
+- Ultima Electronic/Artec T1 USB TVBOX (AN2135, AN2235, AN2235 with Panasonic Tuner)
 	http://82.161.246.249/products-tvbox.html
 
 - Compro Videomate DVB-U2000 - DVB-T USB (2)
@@ -77,16 +77,17 @@ Supported devices USB2.0
 - DiBcom USB2.0 DVB-T reference device (non-public)
 
 1) It is working almost.
-2) No test reports received yet. 
+2) No test reports received yet.
 
 
 0. NEWS:
+  2004-01-31 - distorted streaming is finally gone for USB1.1 devices
   2004-01-13 - moved the mirrored pid_filter_table back to dvb-dibusb
              - first almost working version for HanfTek UMT-010
              - found out, that Yakumo/HAMA/Typhoon are predessors of the HanfTek
   2004-01-10 - refactoring completed, now everything is very delightful
              - tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
-               Panasonic Tuner assembled). Tunerprobing implemented. Thanks a lot to Gunnar Wittich. 
+               Panasonic Tuner assembled). Tunerprobing implemented. Thanks a lot to Gunnar Wittich.
   2004-12-29 - after several days of struggling around bug of no returning URBs fixed.
   2004-12-26 - refactored the dibusb-driver, splitted into separate files
              - i2c-probing enabled
@@ -106,7 +107,7 @@ Supported devices USB2.0
   2004-09-28 - added support for a new device (Unkown, vendor ID is Hyper-Paltek)
   2004-09-20 - added support for a new device (Compro DVB-U2000), thanks
                to Amaury Demol for reporting
-             - changed usb TS transfer method (several urbs, stopping transfer 
+             - changed usb TS transfer method (several urbs, stopping transfer
                before setting a new pid)
   2004-09-13 - added support for a new device (Artec T1 USB TVBOX), thanks
                to Christian Motschke for reporting
@@ -191,13 +192,13 @@ turned on.
 
 At this point you should be able to start a dvb-capable application. For myself
 I used mplayer, dvbscan, tzap and kaxtv, they are working. Using the device
-in vdr (at least the USB2.0 one) is working. 
+in vdr is working now also.
 
 2. Known problems and bugs
 
 - none this time
 
-2.1. Adding support for devices 
+2.1. Adding support for devices
 
 It is not possible to determine the range of devices based on the DiBcom
 reference designs. This is because the reference design of DiBcom can be sold
@@ -213,53 +214,45 @@ of the device. I will add it to this lis
 others.
 
 If you are familar with C you can also add the VID and PID of the device to
-the dvb-dibusb.h-file and create a patch and send it over to me or to 
+the dvb-dibusb-core.c-file and create a patch and send it over to me or to
 the linux-dvb mailing list, _after_ you have tried compiling and modprobing
 it.
 
 2.2. USB1.1 Bandwidth limitation
 
-Most of the current supported devices are USB1.1 and thus they have a
+Most of the currently supported devices are USB1.1 and thus they have a
 maximum bandwidth of about 5-6 MBit/s when connected to a USB2.0 hub.
 This is not enough for receiving the complete transport stream of a
 DVB-T channel (which can be about 16 MBit/s). Normally this is not a
 problem, if you only want to watch TV (this does not apply for HDTV),
-but watching a channel while recording another channel on the same 
-frequency simply does not work. This applies to all USB1.1 DVB-T 
-devices, not only dibusb)
-
-A special problem of the dibusb for the USB1.1 is, that the USB control
-IC has a problem with write accesses while having MPEG2-streaming
-enabled. When you set another pid while receiving MPEG2-TS it happens, that
-the stream is disturbed and probably data is lost (results in distortions of
-the video or strange beeps within the audio stream). DiBcom is preparing a
-firmware especially for Linux which perhaps solves the problem.
-
-Especially VDR users are victoms of this bug. VDR frequently requests new PIDs
-due the automatic scanning (introduced in 1.3.x, afaik) and epg-scan. Disabling
-these features is maybe a solution. Additionally this behaviour of VDR exceeds
-the USB1.1 bandwidth.
-
-Update:
-For the USB1.1 and VDR some work has been done (patches and comments are still 
-very welcome). Maybe the problem is solved in the meantime because I now use
-the dmx_sw_filter function instead of dmx_sw_filter_packet. I hope the
+but watching a channel while recording another channel on the same
+frequency simply does not work very well. This applies to all USB1.1
+DVB-T devices, not just dibusb)
+
+Update: For the USB1.1 and VDR some work has been done (patches and comments
+are still very welcome). Maybe the problem is solved in the meantime because I
+now use the dmx_sw_filter function instead of dmx_sw_filter_packet. I hope the
 linux-dvb software filter is able to get the best of the garbled TS.
 
+The bug, where the TS is distorted by a heavy usage of the device is gone
+definitely.  All dibusb-devices I was using (Twinhan, Kworld, DiBcom) are
+working like charm now with VDR. Sometimes I even was able to record a channel
+and watch another one.
+
 2.3. Comments
 
-Patches, comments and suggestions are very very welcome
+Patches, comments and suggestions are very very welcome.
 
 3. Acknowledgements
 	Amaury Demol (ademol@dibcom.fr) and Francois Kanounnikoff from DiBcom for
-    providing specs, code and help, on which the dvb-dibusb, dib3000mb and 
+    providing specs, code and help, on which the dvb-dibusb, dib3000mb and
     dib3000mc are based.
 
    David Matthews for identifying a new device type (Artec T1 with AN2235)
     and for extending dibusb with remote control event handling. Thank you.
 
    Alex Woods for frequently answering question about usb and dvb
-    stuff, a big thank you
+    stuff, a big thank you.
 
    Bernd Wagner for helping with huge bug reports and discussions.
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 10/48] dibusb: support Hauppauge WinTV NOVA-T USB2
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (8 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 09/48] dibusb readme update Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 11/48] nxt2002: QAM64/256 support Johannes Stezenbach
                   ` (37 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-nova-t-usb2.patch --]
[-- Type: text/plain, Size: 5638 bytes --]

o added support for Hauppauge WinTV NOVA-T USB2 (clone of MOD3000P by DiBcom)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 Documentation/dvb/README.dibusb            |    8 ++++++--
 drivers/media/dvb/dibusb/dvb-dibusb-core.c |   28 +++++++++++++++++++---------
 2 files changed, 25 insertions(+), 11 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/README.dibusb	2005-03-22 00:15:04.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb	2005-03-22 00:15:09.000000000 +0100
@@ -1,4 +1,4 @@
-Documentation for dib3000mb frontend driver and dibusb device driver
+Documentation for dib3000* frontend drivers and dibusb device driver
 ====================================================================
 
 Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de),
@@ -74,6 +74,9 @@ Supported devices USB2.0
 
 - Artec T1 USB TVBOX (FX2) (2)
 
+- Hauppauge WinTV NOVA-T USB2
+	http://www.hauppauge.com/
+
 - DiBcom USB2.0 DVB-T reference device (non-public)
 
 1) It is working almost.
@@ -81,10 +84,11 @@ Supported devices USB2.0
 
 
 0. NEWS:
+  2004-02-02 - added support for the Hauppauge Win-TV Nova-T USB2
   2004-01-31 - distorted streaming is finally gone for USB1.1 devices
   2004-01-13 - moved the mirrored pid_filter_table back to dvb-dibusb
              - first almost working version for HanfTek UMT-010
-             - found out, that Yakumo/HAMA/Typhoon are predessors of the HanfTek
+             - found out, that Yakumo/HAMA/Typhoon are predessors of the HanfTek UMT-010
   2004-01-10 - refactoring completed, now everything is very delightful
              - tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
                Panasonic Tuner assembled). Tunerprobing implemented. Thanks a lot to Gunnar Wittich.
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:15:09.000000000 +0100
@@ -55,8 +55,9 @@ MODULE_PARM_DESC(rc_query_interval, "int
 #define USB_VID_DIBCOM						0x10b8
 #define USB_VID_EMPIA						0xeb1a
 #define USB_VID_GRANDTEC					0x5032
-#define USB_VID_HYPER_PALTEK				0x1025
 #define USB_VID_HANFTEK						0x15f4
+#define USB_VID_HAUPPAUGE					0x2040
+#define USB_VID_HYPER_PALTEK				0x1025
 #define USB_VID_IMC_NETWORKS				0x13d3
 #define USB_VID_TWINHAN						0x1822
 #define USB_VID_ULTIMA_ELECTRONIC			0x05d8
@@ -93,6 +94,8 @@ MODULE_PARM_DESC(rc_query_interval, "int
 #define USB_PID_HANFTEK_UMT_010_WARM		0x0025
 #define USB_PID_YAKUMO_DTT200U_COLD			0x0201
 #define USB_PID_YAKUMO_DTT200U_WARM			0x0301
+#define USB_PID_WINTV_NOVA_T_USB2_COLD		0x9300
+#define USB_PID_WINTV_NOVA_T_USB2_WARM		0x9301
 
 /* USB Driver stuff
  * table of devices that this driver is working with
@@ -143,16 +146,18 @@ static struct usb_device_id dib_table []
 /* 28 */	{ USB_DEVICE(USB_VID_HANFTEK,		USB_PID_HANFTEK_UMT_010_COLD) },
 /* 29 */	{ USB_DEVICE(USB_VID_HANFTEK,		USB_PID_HANFTEK_UMT_010_WARM) },
 
+/* 30 */	{ USB_DEVICE(USB_VID_HAUPPAUGE,		USB_PID_WINTV_NOVA_T_USB2_COLD) },
+/* 31 */	{ USB_DEVICE(USB_VID_HAUPPAUGE,		USB_PID_WINTV_NOVA_T_USB2_WARM) },
 /* 
  * activate the following define when you have one of the devices and want to 
  * build it from build-2.6 in dvb-kernel
  */
 // #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES 
 #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
-/* 30 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
-/* 31 */	{ USB_DEVICE(USB_VID_CYPRESS,		USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
-/* 32 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
-/* 33 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_DIBCOM_ANCHOR_2135_COLD) },
+/* 32 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
+/* 33 */	{ USB_DEVICE(USB_VID_CYPRESS,		USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
+/* 34 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
+/* 35 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_DIBCOM_ANCHOR_2135_COLD) },
 #endif
 			{ }		/* Terminating entry */
 };
@@ -287,6 +292,11 @@ static struct dibusb_usb_device dibusb_d
 		{ &dib_table[27], NULL },
 		{ NULL },
 	},
+	{	"Hauppauge WinTV NOVA-T USB2",
+		&dibusb_device_classes[DIBUSB2_0],
+		{ &dib_table[30], NULL },
+		{ &dib_table[31], NULL },
+	},
 	{	"AVermedia/Yakumo/Hama/Typhoon DVB-T USB2.0",
 		&dibusb_device_classes[UMT2_0],
 		{ &dib_table[2], NULL },
@@ -300,17 +310,17 @@ static struct dibusb_usb_device dibusb_d
 #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 	{	"Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)",
 		&dibusb_device_classes[DIBUSB1_1_AN2235],
-		{ &dib_table[30], NULL },
+		{ &dib_table[32], NULL },
 		{ NULL },
 	},
 	{	"Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)",
 		&dibusb_device_classes[DIBUSB2_0],
-		{ &dib_table[31], NULL },
-		{ &dib_table[32], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */
+		{ &dib_table[33], NULL },
+		{ &dib_table[34], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */
 	},
 	{	"DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs",
 		&dibusb_device_classes[DIBUSB1_1],
-		{ &dib_table[33], NULL },
+		{ &dib_table[35], NULL },
 		{ NULL },
 	},
 #endif

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 11/48] nxt2002: QAM64/256 support
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (9 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 10/48] dibusb: support Hauppauge WinTV NOVA-T USB2 Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 12/48] get_dvb_firmware: new unshield version Johannes Stezenbach
                   ` (36 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-nxt2002-qam.patch --]
[-- Type: text/plain, Size: 2952 bytes --]

patch by Taylor Jacob: Add QAM64/256 Support

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 Kconfig   |    1 +
 nxt2002.c |   43 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:14:18.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:15:13.000000000 +0100
@@ -343,8 +343,21 @@ static int nxt2002_setup_frontend_parame
 	/* reset the agc now that tuning has been completed */
 	nxt2002_agc_reset(state);
 
+
+
 	/* set target power level */
+	switch (p->u.vsb.modulation) {
+		case QAM_64:
+		case QAM_256:
+				buf[0] = 0x74;
+				break;
+		case VSB_8:
 				buf[0] = 0x70;
+				break;
+		default:
+				return -EINVAL;
+				break;
+	}
 	i2c_writebytes(state,0x42,buf,1);
 
 	/* configure sdm */
@@ -357,7 +370,20 @@ static int nxt2002_setup_frontend_parame
 	nxt2002_writereg_multibyte(state,0x58,buf,2);
 
 	/* write sdmx input */
+	switch (p->u.vsb.modulation) {
+		case QAM_64:
+				buf[0] = 0x68;
+				break;
+		case QAM_256:
+				buf[0] = 0x64;
+				break;
+		case VSB_8:
 				buf[0] = 0x60;
+				break;
+		default:
+				return -EINVAL;
+				break;
+	}
 	buf[1] = 0x00;
 	nxt2002_writereg_multibyte(state,0x5C,buf,2);
 
@@ -387,7 +413,20 @@ static int nxt2002_setup_frontend_parame
 	i2c_writebytes(state,0x41,buf,1);
 
 	/* write agc ucgp0 */
+	switch (p->u.vsb.modulation) {
+		case QAM_64:
+				buf[0] = 0x02;
+				break;
+		case QAM_256:
+				buf[0] = 0x03;
+				break;
+		case VSB_8:
 				buf[0] = 0x00;
+				break;
+		default:
+				return -EINVAL;
+				break;
+	}
 	i2c_writebytes(state,0x30,buf,1);
 
 	/* write agc control reg */
@@ -632,12 +671,12 @@ static struct dvb_frontend_ops nxt2002_o
 		.name = "Nextwave nxt2002 VSB/QAM frontend",
 		.type = FE_ATSC,
 		.frequency_min =  54000000,
-		.frequency_max = 803000000,
+		.frequency_max = 806000000,
                 /* stepsize is just a guess */
 		.frequency_stepsize = 166666,
 		.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
 			FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
-			FE_CAN_8VSB
+			FE_CAN_8VSB | FE_CAN_QAM_64 | FE_CAN_QAM_256
 	},
 
 	.release = nxt2002_release,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/Kconfig	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig	2005-03-22 00:15:13.000000000 +0100
@@ -154,6 +154,7 @@ comment "ATSC (North American/Korean Ter
 config DVB_NXT2002
 	tristate "Nxt2002 based"
 	depends on DVB_CORE
+	select FW_LOADER
 	help
 	  An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 12/48] get_dvb_firmware: new unshield version
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (10 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 11/48] nxt2002: QAM64/256 support Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 13/48] dib3000: corrected device naming Johannes Stezenbach
                   ` (35 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-fwscript-newunshield.patch --]
[-- Type: text/plain, Size: 1297 bytes --]

patch by Mattias Holmlund: support new version of unshield for
sp887x firmware extraction (changed cmdline parameters)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 get_dvb_firmware |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/get_dvb_firmware	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware	2005-03-22 00:15:20.000000000 +0100
@@ -79,8 +79,8 @@ sub sp887x {
     wgetfile($sourcefile, $url);
     unzip($sourcefile, $tmpdir);
     unshield("$tmpdir/$cabfile", $tmpdir);
-    verify("$tmpdir/sc_main.mc", $hash);
-    copy("$tmpdir/sc_main.mc", $outfile);
+    verify("$tmpdir/ZEnglish/sc_main.mc", $hash);
+    copy("$tmpdir/ZEnglish/sc_main.mc", $outfile);
 
     $outfile;
 }
@@ -292,7 +292,7 @@ sub unzip {
 sub unshield {
     my ($sourcefile, $todir) = @_;
 
-    system("unshield -d \"$todir\" \"$sourcefile\" > /dev/null" ) and die ("unshield failed - unable to extract firmware");
+    system("unshield x -d \"$todir\" \"$sourcefile\" > /dev/null" ) and die ("unshield failed - unable to extract firmware");
 }
 
 sub verify {

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 13/48] dib3000: corrected device naming
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (11 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 12/48] get_dvb_firmware: new unshield version Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 14/48] dibusb: debug changes Johannes Stezenbach
                   ` (34 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibcom-dev-naming.patch --]
[-- Type: text/plain, Size: 7207 bytes --]

corrected device naming (Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 Kconfig          |    4 ++--
 dib3000-common.c |    2 +-
 dib3000-common.h |    8 ++++----
 dib3000.h        |    2 +-
 dib3000mb.c      |    6 +++---
 dib3000mc.c      |   10 +++++-----
 dib3000mc_priv.h |    2 +-
 7 files changed, 17 insertions(+), 17 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/Kconfig	2005-03-22 00:15:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig	2005-03-22 00:15:24.000000000 +0100
@@ -108,14 +108,14 @@ config DVB_MT352
 	  A DVB-T tuner module. Say Y when you want to support this frontend.
 
 config DVB_DIB3000MB
-	tristate "DiBcom 3000-MB"
+	tristate "DiBcom 3000M-B"
 	depends on DVB_CORE
 	help
 	  A DVB-T tuner module. Designed for mobile usage. Say Y when you want
 	  to support this frontend.
 
 config DVB_DIB3000MC
-	tristate "DiBcom 3000-MC/P"
+	tristate "DiBcom 3000P/M-C"
 	depends on DVB_CORE
 	help
 	  A DVB-T tuner module. Designed for mobile usage. Say Y when you want
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000-common.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.c	2005-03-22 00:15:24.000000000 +0100
@@ -73,7 +73,7 @@ u16 dib3000_seq[2][2][2] =     /* fft,gu
 	};
 
 MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de");
-MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb frontend drivers");
+MODULE_DESCRIPTION("Common functions for the dib3000mb/dib3000mc dvb-frontend drivers");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(dib3000_seq);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000-common.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.h	2005-03-22 00:15:24.000000000 +0100
@@ -1,6 +1,6 @@
 /*
  * .h-files for the common use of the frontend drivers made by DiBcom
- * DiBcom 3000-MB/MC/P
+ * DiBcom 3000M-B/C, 3000P
  *
  * DiBcom (http://www.dibcom.fr/)
  *
@@ -30,9 +30,9 @@
 #include "dib3000.h"
 
 /* info and err, taken from usb.h, if there is anything available like by default. */
-#define err(format, arg...) printk(KERN_ERR "dib3000mX: " format "\n" , ## arg)
-#define info(format, arg...) printk(KERN_INFO "dib3000mX: " format "\n" , ## arg)
-#define warn(format, arg...) printk(KERN_WARNING "dib3000mX: " format "\n" , ## arg)
+#define err(format, arg...)  printk(KERN_ERR     "dib3000: " format "\n" , ## arg)
+#define info(format, arg...) printk(KERN_INFO    "dib3000: " format "\n" , ## arg)
+#define warn(format, arg...) printk(KERN_WARNING "dib3000: " format "\n" , ## arg)
 
 /* frontend state */
 struct dib3000_state {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000.h	2005-03-22 00:15:24.000000000 +0100
@@ -1,6 +1,6 @@
 /*
  * public header file of the frontend drivers for mobile DVB-T demodulators
- * DiBcom 3000-MB and DiBcom 3000-MC/P (http://www.dibcom.fr/)
+ * DiBcom 3000M-B and DiBcom 3000P/M-C (http://www.dibcom.fr/)
  *
  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
  *
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:14:30.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:15:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Frontend driver for mobile DVB-T demodulator DiBcom 3000-MB
+ * Frontend driver for mobile DVB-T demodulator DiBcom 3000M-B
  * DiBcom (http://www.dibcom.fr/)
  *
  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
@@ -35,7 +35,7 @@
 
 /* Version information */
 #define DRIVER_VERSION "0.1"
-#define DRIVER_DESC "DiBcom 3000M-B DVB-T demodulator driver"
+#define DRIVER_DESC "DiBcom 3000M-B DVB-T demodulator"
 #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
 
 #ifdef CONFIG_DVB_DIBCOM_DEBUG
@@ -745,7 +745,7 @@ error:
 static struct dvb_frontend_ops dib3000mb_ops = {
 
 	.info = {
-		.name			= "DiBcom 3000-MB DVB-T",
+		.name			= "DiBcom 3000M-B DVB-T",
 		.type			= FE_OFDM,
 		.frequency_min		= 44250000,
 		.frequency_max		= 867250000,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:14:30.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:15:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * Frontend driver for mobile DVB-T demodulator DiBcom 3000-MC/P
+ * Frontend driver for mobile DVB-T demodulator DiBcom 3000P/M-C
  * DiBcom (http://www.dibcom.fr/)
  *
  * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
@@ -34,7 +34,7 @@
 
 /* Version information */
 #define DRIVER_VERSION "0.1"
-#define DRIVER_DESC "DiBcom 3000M-C DVB-T demodulator driver"
+#define DRIVER_DESC "DiBcom 3000M-C DVB-T demodulator"
 #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
 
 #ifdef CONFIG_DVB_DIBCOM_DEBUG
@@ -865,10 +865,10 @@ struct dvb_frontend* dib3000mc_attach(co
 
 	switch (devid) {
 		case DIB3000MC_DEVICE_ID:
-			info("Found a DiBcom 3000-MC, interesting...");
+			info("Found a DiBcom 3000M-C, interesting...");
 			break;
 		case DIB3000P_DEVICE_ID:
-			info("Found a DiBcom 3000-P.");
+			info("Found a DiBcom 3000P.");
 			break;
 	}
 
@@ -895,7 +895,7 @@ error:
 static struct dvb_frontend_ops dib3000mc_ops = {
 
 	.info = {
-		.name			= "DiBcom 3000-MC/P DVB-T",
+		.name			= "DiBcom 3000P/M-C DVB-T",
 		.type			= FE_OFDM,
 		.frequency_min		= 44250000,
 		.frequency_max		= 867250000,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc_priv.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc_priv.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc_priv.h	2005-03-22 00:15:24.000000000 +0100
@@ -320,7 +320,7 @@ static u16 dib3000mc_mobile_mode[][5] = 
  * pidfilter
  * it is not a hardware pidfilter but a filter which drops all pids
  * except the ones set. When connected to USB1.1 bandwidth this is important.
- * DiB3000-MC/P can filter up to 32 PIDs
+ * DiB3000P/M-C can filter up to 32 PIDs
  */
 #define DIB3000MC_REG_FIRST_PID			(   212)
 #define DIB3000MC_NUM_PIDS				(    32)

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 14/48] dibusb: debug changes
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (12 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 13/48] dib3000: corrected device naming Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 15/48] dibusb: increased the number of urbs for usb1.1 devices Johannes Stezenbach
                   ` (33 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibcom-debug.patch --]
[-- Type: text/plain, Size: 5157 bytes --]

o use own err,info,warn defines, driver description
o remove warning about firmware bug
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-dvb.c |   13 +++++--------
 dvb-dibusb-pid.c |    4 ++--
 dvb-dibusb-usb.c |    6 ------
 dvb-dibusb.h     |   11 +++++++----
 4 files changed, 14 insertions(+), 20 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:15:37.000000000 +0100
@@ -44,7 +44,7 @@ extern int dvb_dibusb_debug;
 
 /* Version information */
 #define DRIVER_VERSION "0.3"
-#define DRIVER_DESC "Driver for DiBcom based USB Budget DVB-T device"
+#define DRIVER_DESC "DiBcom based USB Budget DVB-T device"
 #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de"
 
 #define deb_info(args...) dprintk(0x01,args)
@@ -55,9 +55,12 @@ extern int dvb_dibusb_debug;
 #define deb_rc(args...)   dprintk(0x20,args)
 
 /* generic log methods - taken from usb.h */
-#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg)
-#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg)
-#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg)
+#undef err
+#define err(format, arg...)  printk(KERN_ERR     "dvb-dibusb: " format "\n" , ## arg)
+#undef info
+#define info(format, arg...) printk(KERN_INFO    "dvb-dibusb: " format "\n" , ## arg)
+#undef warn
+#define warn(format, arg...) printk(KERN_WARNING "dvb-dibusb: " format "\n" , ## arg)
 
 struct dibusb_usb_controller {
 	const char *name;       /* name of the usb controller */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-pid.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-pid.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-pid.c	2005-03-22 00:15:37.000000000 +0100
@@ -67,13 +67,13 @@ int dibusb_ctrl_pid(struct usb_dibusb *d
 		if (dib->xfer_ops.pid_ctrl != NULL) 
 			dib->xfer_ops.pid_ctrl(dib->fe,dpid->index,0,0);
 		
+		ret = dpid->index;
 		dpid->pid = 0;
 		dpid->active = 0;
-		ret = dpid->index;
 	}
 	
 	/* a free pid from the list */
-	deb_info("setting pid: %5d %04x at index %d '%s'\n",pid,pid,ret,onoff ? "on" : "off");
+	deb_xfer("setting pid: %5d %04x at index %d '%s'\n",pid,pid,ret,onoff ? "on" : "off");
 
 	return ret;
 }
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:14:35.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:15:37.000000000 +0100
@@ -25,12 +25,6 @@ int dibusb_readwrite_usb(struct usb_dibu
 	if ((ret = down_interruptible(&dib->usb_sem)))
 		return ret;
 
-	if (dib->feedcount &&
-		wbuf[0] == DIBUSB_REQ_I2C_WRITE &&
-		dib->dibdev->dev_cl->id == DIBUSB1_1)
-		deb_err("BUG: writing to i2c, while TS-streaming destroys the stream."
-				"(%x reg: %x %x)\n", wbuf[0],wbuf[2],wbuf[3]);
-
 	debug_dump(wbuf,wlen);
 
 	ret = usb_bulk_msg(dib->udev,usb_sndbulkpipe(dib->udev,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:15:37.000000000 +0100
@@ -28,7 +28,7 @@ void dibusb_urb_complete(struct urb *urb
 			urb->actual_length);
 
 	urb_compl_count++;
-	if (urb_compl_count % 500 == 0)
+	if (urb_compl_count % 1000 == 0)
 		deb_info("%d urbs completed so far.\n",urb_compl_count);
 
 	switch (urb->status) {
@@ -40,7 +40,8 @@ void dibusb_urb_complete(struct urb *urb
 		case -ESHUTDOWN:
 			return;
 		default:        /* error */
-			warn("urb completition error %d.", urb->status);
+			deb_ts("urb completition error %d.", urb->status);
+			break;
 	}
 
 	if (dib->feedcount > 0) {
@@ -77,7 +78,6 @@ static int dibusb_ctrl_feed(struct dvb_d
 	/* 
 	 * stop feed before setting a new pid if there will be no pid anymore 
 	 */
-//	if ((dib->dibdev->parm->firmware_bug && dib->feedcount) || 
 	if (newfeedcount == 0) {
 		deb_ts("stop feeding\n");
 		if (dib->xfer_ops.fifo_ctrl != NULL) {
@@ -97,12 +97,9 @@ static int dibusb_ctrl_feed(struct dvb_d
 		dibusb_ctrl_pid(dib,dvbdmxfeed,onoff);
 
 	/* 
-	 * start the feed, either if there is the firmware bug or 
-	 * if this was the first pid to set and there is still a pid for 
-	 * reception.
+	 * start the feed if this was the first pid to set and there is still a pid
+	 * for reception.
 	 */
-	
-//	if ((dib->dibdev->parm->firmware_bug)
 	if (dib->feedcount == onoff && dib->feedcount > 0) {
 
 		deb_ts("controlling pid parser\n");

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 15/48] dibusb: increased the number of urbs for usb1.1 devices
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (13 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 14/48] dibusb: debug changes Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 16/48] ttusb_dec: use alternative interface to save bandwidth Johannes Stezenbach
                   ` (32 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibcom-urbcount.patch --]
[-- Type: text/plain, Size: 1504 bytes --]

increased the number of urbs for usb1.1 devices (Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-core.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:15:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:15:45.000000000 +0100
@@ -204,7 +204,7 @@ static struct dibusb_device_class dibusb
 	{ .id = DIBUSB1_1, .usb_ctrl = &dibusb_usb_ctrl[0],
 	  .firmware = "dvb-dibusb-5.0.0.11.fw",
 	  .pipe_cmd = 0x01, .pipe_data = 0x02, 
-	  .urb_count = 3, .urb_buffer_size = 4096,
+	  .urb_count = 5, .urb_buffer_size = 4096,
 	  DIBUSB_RC_NEC_PROTOCOL,
 	  &dibusb_demod[DIBUSB_DIB3000MB],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
@@ -212,7 +212,7 @@ static struct dibusb_device_class dibusb
 	{ DIBUSB1_1_AN2235, &dibusb_usb_ctrl[1],
 	  "dvb-dibusb-an2235-1.fw",
 	  0x01, 0x02, 
-	  3, 4096,
+	  5, 4096,
 	  DIBUSB_RC_NEC_PROTOCOL,
 	  &dibusb_demod[DIBUSB_DIB3000MB],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
@@ -231,7 +231,6 @@ static struct dibusb_device_class dibusb
 	  15, 188*21,
 	  DIBUSB_RC_NO,
 	  &dibusb_demod[DIBUSB_MT352],
-//	  &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV77H11D5],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_LG_TDTP_E102P],
 	},
 };

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 16/48] ttusb_dec: use alternative interface to save bandwidth
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (14 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 15/48] dibusb: increased the number of urbs for usb1.1 devices Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 17/48] l64781: email address fix Johannes Stezenbach
                   ` (31 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttusbdec-ohci-compat.patch --]
[-- Type: text/plain, Size: 1122 bytes --]

Use alternative interface.  Asks for less bandwidth and therefore works with
OHCI as well as UHCI (Alex Woods)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 ttusb_dec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-22 00:15:50.000000000 +0100
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(output_pva, "Output PVA
 
 #define ISO_BUF_COUNT		0x04
 #define FRAMES_PER_ISO_BUF	0x04
-#define ISO_FRAME_SIZE		0x03FF
+#define ISO_FRAME_SIZE		0x0380
 
 #define	MAX_PVA_LENGTH		6144
 
@@ -781,7 +781,7 @@ static int ttusb_dec_set_interface(struc
 							b, NULL, NULL);
 			if (result)
 				return result;
-			result = usb_set_interface(dec->udev, 0, 7);
+			result = usb_set_interface(dec->udev, 0, 8);
 			break;
 		case TTUSB_DEC_INTERFACE_OUT:
 			result = usb_set_interface(dec->udev, 0, 1);

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 17/48] l64781: email address fix
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (15 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 16/48] ttusb_dec: use alternative interface to save bandwidth Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 18/48] skystar2: fix MAC address reading Johannes Stezenbach
                   ` (30 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-l64781-fix-email.patch --]
[-- Type: text/plain, Size: 1961 bytes --]

fix marko kohtala's mail address

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 l64781.c |    5 ++---
 l64781.h |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/l64781.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c	2005-03-22 00:15:55.000000000 +0100
@@ -1,9 +1,8 @@
 /*
     driver for LSI L64781 COFDM demodulator
 
-    Copyright (C) 2001 Holger Waechtler <holger@convergence.de>
-                       for Convergence Integrated Media GmbH
-                       Marko Kohtala <marko.kohtala@nokia.com>
+    Copyright (C) 2001 Holger Waechtler for Convergence Integrated Media GmbH
+                       Marko Kohtala <marko.kohtala@luukku.com>
 
     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
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/l64781.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.h	2005-03-22 00:15:55.000000000 +0100
@@ -1,9 +1,8 @@
 /*
     driver for LSI L64781 COFDM demodulator
 
-    Copyright (C) 2001 Holger Waechtler <holger@convergence.de>
-                       for Convergence Integrated Media GmbH
-                       Marko Kohtala <marko.kohtala@nokia.com>
+    Copyright (C) 2001 Holger Waechtler for Convergence Integrated Media GmbH
+                       Marko Kohtala <marko.kohtala@luukku.com>
 
     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

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 18/48] skystar2: fix MAC address reading
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (16 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 17/48] l64781: email address fix Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 19/48] support KWorld/ADSTech Instant DVB-T USB2.0 Johannes Stezenbach
                   ` (29 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-skystar2-mac.patch --]
[-- Type: text/plain, Size: 829 bytes --]

fixed MAC address reading (eeprom address to read, was not correctly set,
respectively overwritten)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 skystar2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:14:55.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:16:14.000000000 +0100
@@ -231,8 +231,8 @@ static void fixchipaddr(u32 device, u32 
 {
 	if (device == 0x20000000)
 		*ret = bus | ((addr >> 8) & 3);
-
-	*ret = bus;
+	else
+		*ret = bus;
 }
 
 static u32 flex_i2c_read(struct adapter *adapter, u32 device, u32 bus, u32 addr, u8 *buf, u32 len)

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 19/48] support KWorld/ADSTech Instant DVB-T USB2.0
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (17 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 18/48] skystar2: fix MAC address reading Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 20/48] cleanups, make stuff static Johannes Stezenbach
                   ` (28 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibcom-kworld-instant-dvb-t.patch --]
[-- Type: text/plain, Size: 13837 bytes --]

o added support for KWorld/ADSTech Instant DVB-T USB2.0 (DiB3000M-B)
o added deactivation option of the pid parser for the DiB3000M-B (since there
  are USB2.0 devices and which now have the ability to deliver the complete
  Transport Stream)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 Documentation/dvb/README.dibusb            |   14 +++--
 drivers/media/dvb/dibusb/Kconfig           |    3 -
 drivers/media/dvb/dibusb/dvb-dibusb-core.c |   78 +++++++++++++++++++++++------
 drivers/media/dvb/dibusb/dvb-dibusb-usb.c  |    4 +
 drivers/media/dvb/dibusb/dvb-dibusb.h      |    1 
 drivers/media/dvb/frontends/dib3000mb.c    |    5 +
 drivers/media/dvb/frontends/dib3000mc.c    |    2 
 7 files changed, 83 insertions(+), 24 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/README.dibusb	2005-03-22 00:15:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb	2005-03-22 00:16:19.000000000 +0100
@@ -77,6 +77,8 @@ Supported devices USB2.0
 - Hauppauge WinTV NOVA-T USB2
 	http://www.hauppauge.com/
 
+- KWorld/ADSTech Instant DVB-T USB2.0 (DiB3000M-B)
+
 - DiBcom USB2.0 DVB-T reference device (non-public)
 
 1) It is working almost.
@@ -84,12 +86,13 @@ Supported devices USB2.0
 
 
 0. NEWS:
-  2004-02-02 - added support for the Hauppauge Win-TV Nova-T USB2
-  2004-01-31 - distorted streaming is finally gone for USB1.1 devices
-  2004-01-13 - moved the mirrored pid_filter_table back to dvb-dibusb
+  2005-02-11 - added support for the KWorld/ADSTech Instant DVB-T USB2.0. Thanks a lot to Joachim von Caron
+  2005-02-02 - added support for the Hauppauge Win-TV Nova-T USB2
+  2005-01-31 - distorted streaming is finally gone for USB1.1 devices
+  2005-01-13 - moved the mirrored pid_filter_table back to dvb-dibusb
              - first almost working version for HanfTek UMT-010
              - found out, that Yakumo/HAMA/Typhoon are predessors of the HanfTek UMT-010
-  2004-01-10 - refactoring completed, now everything is very delightful
+  2005-01-10 - refactoring completed, now everything is very delightful
              - tuner quirks for some weird devices (Artec T1 AN2235 device has sometimes a
                Panasonic Tuner assembled). Tunerprobing implemented. Thanks a lot to Gunnar Wittich.
   2004-12-29 - after several days of struggling around bug of no returning URBs fixed.
@@ -260,6 +263,9 @@ Patches, comments and suggestions are ve
 
    Bernd Wagner for helping with huge bug reports and discussions.
 
+   Gunnar Wittich and Joachim von Caron for their trust for giving me
+    root-shells on their machines to implement support for new devices.
+
    Some guys on the linux-dvb mailing list for encouraging me
 
    Peter Schildmann >peter.schildmann-nospam-at-web.de< for his
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/Kconfig	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Kconfig	2005-03-22 00:16:19.000000000 +0100
@@ -13,7 +13,7 @@ config DVB_DIBUSB
 
 	    TwinhanDTV USB-Ter (VP7041)
 		TwinhanDTV Magic Box (VP7041e)
-	    KWorld V-Stream XPERT DTV - DVB-T USB
+	    KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0
 	    Hama DVB-T USB-Box
 	    DiBcom reference devices (non-public)
 	    Ultima Electronic/Artec T1 USB TVBOX
@@ -23,6 +23,7 @@ config DVB_DIBUSB
 	    Artec T1 USB1.1 and USB2.0 boxes
 	    Yakumo/Typhoon DVB-T USB2.0
 	    Hanftek UMT-010 USB2.0
+	    Hauppauge WinTV NOVA-T USB2
 
 	  The VP7041 seems to be identical to "CTS Portable" (Chinese
 	  Television System).
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:15:45.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:16:19.000000000 +0100
@@ -47,6 +47,7 @@ module_param(rc_query_interval, int, 064
 MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)");
 
 /* Vendor IDs */
+#define USB_VID_ADSTECH						0x06e1
 #define USB_VID_ANCHOR						0x0547
 #define USB_VID_AVERMEDIA					0x14aa
 #define USB_VID_COMPRO						0x185b
@@ -63,6 +64,8 @@ MODULE_PARM_DESC(rc_query_interval, "int
 #define USB_VID_ULTIMA_ELECTRONIC			0x05d8
 
 /* Product IDs */
+#define USB_PID_ADSTECH_USB2_COLD			0xa333
+#define USB_PID_ADSTECH_USB2_WARM			0xa334
 #define USB_PID_AVERMEDIA_DVBT_USB_COLD		0x0001
 #define USB_PID_AVERMEDIA_DVBT_USB_WARM		0x0002
 #define USB_PID_COMPRO_DVBU2000_COLD		0xd000
@@ -148,16 +151,18 @@ static struct usb_device_id dib_table []
 
 /* 30 */	{ USB_DEVICE(USB_VID_HAUPPAUGE,		USB_PID_WINTV_NOVA_T_USB2_COLD) },
 /* 31 */	{ USB_DEVICE(USB_VID_HAUPPAUGE,		USB_PID_WINTV_NOVA_T_USB2_WARM) },
+/* 32 */	{ USB_DEVICE(USB_VID_ADSTECH,		USB_PID_ADSTECH_USB2_COLD) },
+/* 33 */	{ USB_DEVICE(USB_VID_ADSTECH,		USB_PID_ADSTECH_USB2_WARM) },
 /* 
  * activate the following define when you have one of the devices and want to 
  * build it from build-2.6 in dvb-kernel
  */
 // #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES 
 #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
-/* 32 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
-/* 33 */	{ USB_DEVICE(USB_VID_CYPRESS,		USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
-/* 34 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
-/* 35 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_DIBCOM_ANCHOR_2135_COLD) },
+/* 34 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
+/* 35 */	{ USB_DEVICE(USB_VID_CYPRESS,		USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
+/* 36 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_USB2_FX_WARM) },
+/* 37 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_DIBCOM_ANCHOR_2135_COLD) },
 #endif
 			{ }		/* Terminating entry */
 };
@@ -204,7 +209,7 @@ static struct dibusb_device_class dibusb
 	{ .id = DIBUSB1_1, .usb_ctrl = &dibusb_usb_ctrl[0],
 	  .firmware = "dvb-dibusb-5.0.0.11.fw",
 	  .pipe_cmd = 0x01, .pipe_data = 0x02, 
-	  .urb_count = 5, .urb_buffer_size = 4096,
+	  .urb_count = 7, .urb_buffer_size = 4096,
 	  DIBUSB_RC_NEC_PROTOCOL,
 	  &dibusb_demod[DIBUSB_DIB3000MB],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
@@ -212,7 +217,7 @@ static struct dibusb_device_class dibusb
 	{ DIBUSB1_1_AN2235, &dibusb_usb_ctrl[1],
 	  "dvb-dibusb-an2235-1.fw",
 	  0x01, 0x02, 
-	  5, 4096,
+	  7, 4096,
 	  DIBUSB_RC_NEC_PROTOCOL,
 	  &dibusb_demod[DIBUSB_DIB3000MB],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
@@ -228,11 +233,19 @@ static struct dibusb_device_class dibusb
 	{ UMT2_0, &dibusb_usb_ctrl[2],
 	  "dvb-dibusb-umt-1.fw",
 	  0x01, 0x02, 
-	  15, 188*21,
+	  7, 188*21,
 	  DIBUSB_RC_NO,
 	  &dibusb_demod[DIBUSB_MT352],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_LG_TDTP_E102P],
 	},
+	{ DIBUSB2_0B,&dibusb_usb_ctrl[2],
+	  "dvb-dibusb-adstech-usb2-1.fw",
+	  0x01, 0x06,
+	  7, 4096,
+	  DIBUSB_RC_NEC_PROTOCOL,
+	  &dibusb_demod[DIBUSB_DIB3000MB],
+	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
+	},
 };
 
 static struct dibusb_usb_device dibusb_devices[] = {
@@ -306,20 +319,25 @@ static struct dibusb_usb_device dibusb_d
 		{ &dib_table[28], NULL },
 		{ &dib_table[29], NULL },
 	},	
+	{	"KWorld/ADSTech Instant DVB-T USB 2.0",
+		&dibusb_device_classes[DIBUSB2_0B],
+		{ &dib_table[32], NULL },
+		{ &dib_table[33], NULL }, /* device ID with default DIBUSB2_0-firmware */
+	},
 #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 	{	"Artec T1 USB1.1 TVBOX with AN2235 (misdesigned)",
 		&dibusb_device_classes[DIBUSB1_1_AN2235],
-		{ &dib_table[32], NULL },
+		{ &dib_table[34], NULL },
 		{ NULL },
 	},
 	{	"Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)",
 		&dibusb_device_classes[DIBUSB2_0],
-		{ &dib_table[33], NULL },
-		{ &dib_table[34], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */
+		{ &dib_table[35], NULL },
+		{ &dib_table[36], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */
 	},
 	{	"DiBcom USB1.1 DVB-T reference design (MOD3000) with AN2135 default IDs",
 		&dibusb_device_classes[DIBUSB1_1],
-		{ &dib_table[35], NULL },
+		{ &dib_table[37], NULL },
 		{ NULL },
 	},
 #endif
@@ -365,30 +383,62 @@ static int dibusb_init(struct usb_dibusb
 	return 0;
 }
 
+static struct dibusb_usb_device * dibusb_device_class_quirk(struct usb_device *udev, struct dibusb_usb_device *dev)
+{
+	int i;
+
+	/* Quirk for the Kworld/ADSTech Instant USB2.0 device. It has the same USB
+	 * IDs like the USB1.1 KWorld after loading the firmware. Which is a bad
+	 * idea and make this quirk necessary.
+	 */
+	if (dev->dev_cl->id == DIBUSB1_1 && udev->speed == USB_SPEED_HIGH) {
+		info("this seems to be the Kworld/ADSTech Instant USB2.0 device or equal.");
+		for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) {
+			if (dibusb_devices[i].dev_cl->id == DIBUSB2_0B) {
+				dev = &dibusb_devices[i];
+				break;
+			}
+		}
+	}
+
+	return dev;
+}
+
 static struct dibusb_usb_device * dibusb_find_device (struct usb_device *udev,int *cold)
 {
 	int i,j;
 	*cold = -1;
+	struct dibusb_usb_device *dev = NULL;
+
 	for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) {
 		for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] != NULL; j++) {
 			deb_info("check for cold %x %x\n",dibusb_devices[i].cold_ids[j]->idVendor, dibusb_devices[i].cold_ids[j]->idProduct);
 			if (dibusb_devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) &&
 				dibusb_devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) {
 				*cold = 1;
-				return &dibusb_devices[i];
+				dev = &dibusb_devices[i];
+				break;
 			}
 		}
 
+		if (dev != NULL)
+			break;
+
 		for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].warm_ids[j] != NULL; j++) {
 			deb_info("check for warm %x %x\n",dibusb_devices[i].warm_ids[j]->idVendor, dibusb_devices[i].warm_ids[j]->idProduct);
 			if (dibusb_devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) &&
 				dibusb_devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) {
 				*cold = 0;
-				return &dibusb_devices[i];
+				dev = &dibusb_devices[i];
+				break;
 			}
 		}
 	}
-	return NULL;
+
+	if (dev != NULL)
+		dev = dibusb_device_class_quirk(udev,dev);
+
+	return dev;
 }
 
 /*
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:15:37.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:16:19.000000000 +0100
@@ -136,6 +136,7 @@ int dibusb_streaming(struct usb_dibusb *
 {
 	switch (dib->dibdev->dev_cl->id) {
 		case DIBUSB2_0:
+		case DIBUSB2_0B:
 			if (onoff)
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_ENABLE_STREAM,NULL,0);
 			else
@@ -206,10 +207,11 @@ int dibusb_urb_init(struct usb_dibusb *d
 
 	/* dib->pid_parse here contains the value of the module parameter */
 	/* decide if pid parsing can be deactivated:
-	 * is possible (by speed) and wanted (by user)
+	 * is possible (by device type) and wanted (by user)
 	 */
 	switch (dib->dibdev->dev_cl->id) {
 		case DIBUSB2_0:
+		case DIBUSB2_0B:
 			if (dib->udev->speed == USB_SPEED_HIGH && !dib->pid_parse) {
 				def_pid_parse = 0;
 				info("running at HIGH speed, will deliver the complete TS.");
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:15:37.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:16:19.000000000 +0100
@@ -72,6 +72,7 @@ typedef enum {
 	DIBUSB1_1_AN2235,
 	DIBUSB2_0,
 	UMT2_0,
+	DIBUSB2_0B,
 } dibusb_class_t;
 
 typedef enum {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:15:24.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:16:19.000000000 +0100
@@ -684,8 +684,9 @@ static int dib3000mb_fifo_control(struct
 
 static int dib3000mb_pid_parse(struct dvb_frontend *fe, int onoff)
 {
-	//struct dib3000_state *state = fe->demodulator_priv;
-	/* switch it off and on */
+	struct dib3000_state *state = fe->demodulator_priv;
+	deb_xfer("%s pid parsing\n",onoff ? "enabling" : "disabling");
+	wr(DIB3000MB_REG_PID_PARSE,onoff);
 	return 0;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:15:24.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:16:19.000000000 +0100
@@ -794,10 +794,8 @@ static int dib3000mc_pid_parse(struct dv
 	deb_xfer("%s pid parsing\n",onoff ? "enabling" : "disabling");
 
 	if (onoff) {
-		deb_xfer("%d %x\n",tmp | DIB3000MC_SMO_MODE_PID_PARSE,tmp | DIB3000MC_SMO_MODE_PID_PARSE);
 		wr(DIB3000MC_REG_SMO_MODE,tmp | DIB3000MC_SMO_MODE_PID_PARSE);
 	} else {
-		deb_xfer("%d %x\n",tmp & DIB3000MC_SMO_MODE_NO_PID_PARSE,tmp & DIB3000MC_SMO_MODE_NO_PID_PARSE);
 		wr(DIB3000MC_REG_SMO_MODE,tmp & DIB3000MC_SMO_MODE_NO_PID_PARSE);
 	}
 	return 0;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 20/48] cleanups, make stuff static
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (18 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 19/48] support KWorld/ADSTech Instant DVB-T USB2.0 Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 21/48] refactor sw pid filter to drop redundant code Johannes Stezenbach
                   ` (27 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Adrian Bunk

[-- Attachment #1: dvb-cleanup-makestatic.patch --]
[-- Type: text/plain, Size: 14402 bytes --]

This patch contains the following possible cleanups:
o make needlessly global code static
o remove the following EXPORT_SYMBOL'ed but unused function:
  - bt8xx/bt878.c: bt878_find_by_i2c_adap
o remove the following unused global functions:
  - dvb-core/dvb_demux.c: dmx_get_demuxes
  - dvb-core/dvb_demux.c: dvb_set_crc32
o remove the following unneeded EXPORT_SYMBOL's:
  - dvb-core/dvb_demux.c: dvb_dmx_swfilter_packet
  - dvb-core/dvb_demux.c: dvbdmx_connect_frontend
  - dvb-core/dvb_demux.c: dvbdmx_disconnect_frontend
  - dvb-core/dvbdev.c: dvb_class

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 b2c2/b2c2-common.c         |    2 +-
 b2c2/skystar2.c            |    2 +-
 bt8xx/bt878.c              |   15 ---------------
 bt8xx/dst_priv.h           |    1 -
 dibusb/dvb-dibusb-core.c   |    2 +-
 dibusb/dvb-dibusb-fe-i2c.c |    2 +-
 dibusb/dvb-dibusb.h        |    2 --
 dvb-core/demux.h           |    4 ----
 dvb-core/dvb_demux.c       |   36 ++++++------------------------------
 dvb-core/dvb_demux.h       |    4 ----
 dvb-core/dvb_net.c         |    4 ++--
 dvb-core/dvbdev.c          |    3 +--
 frontends/tda10021.c       |    2 +-
 ttpci/budget-av.c          |    4 ++--
 ttpci/budget-patch.c       |    2 +-
 15 files changed, 17 insertions(+), 68 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/b2c2-common.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/b2c2-common.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/b2c2-common.c	2005-03-22 00:16:28.000000000 +0100
@@ -158,7 +158,7 @@ static int samsung_tdtc9251dh0_demod_ini
 	return 0;
 }
 
-int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
+static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
 {
 	u32 div;
 	unsigned char bs = 0;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:16:14.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:16:28.000000000 +0100
@@ -2352,7 +2352,7 @@ static int samsung_tdtc9251dh0_demod_ini
 	return 0;
 }
 
-int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
+static int samsung_tdtc9251dh0_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u8* pllbuf)
 {
 	u32 div;
 	unsigned char bs = 0;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/bt878.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c	2005-03-22 00:16:28.000000000 +0100
@@ -381,21 +381,6 @@ bt878_device_control(struct bt878 *bt, u
 
 EXPORT_SYMBOL(bt878_device_control);
 
-struct bt878 *bt878_find_by_i2c_adap(struct i2c_adapter *adapter)
-{
-	unsigned int card_nr;
-	
-	printk("bt878 find by dvb adap: checking \"%s\"\n",adapter->name);
-	for (card_nr = 0; card_nr < bt878_num; card_nr++) {
-		if (bt878[card_nr].adapter == adapter)
-			return &bt878[card_nr];
-	}
-	printk("bt878 find by dvb adap: NOT found \"%s\"\n",adapter->name);
-	return NULL;
-}
-
-EXPORT_SYMBOL(bt878_find_by_i2c_adap);
-
 /***********************/
 /* PCI device handling */
 /***********************/
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst_priv.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/dst_priv.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst_priv.h	2005-03-22 00:16:28.000000000 +0100
@@ -34,4 +34,3 @@ struct bt878;
 
 int bt878_device_control(struct bt878 *bt, unsigned int cmd, union dst_gpio_packet *mp);
 
-struct bt878 *bt878_find_by_i2c_adap(struct i2c_adapter *adap);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:16:28.000000000 +0100
@@ -505,7 +505,7 @@ static void dibusb_disconnect(struct usb
 }
 
 /* usb specific object needed to register this driver with the usb subsystem */
-struct usb_driver dibusb_driver = {
+static struct usb_driver dibusb_driver = {
 	.owner		= THIS_MODULE,
 	.name		= DRIVER_DESC,
 	.probe 		= dibusb_probe,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:14:35.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:16:28.000000000 +0100
@@ -14,7 +14,7 @@
 
 #include <linux/usb.h>
 
-int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr,
+static int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr,
 			  u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen)
 {
 	u8 sndbuf[wlen+4]; /* lead(1) devaddr,direction(1) addr(2) data(wlen) (len(2) (when reading)) */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:16:28.000000000 +0100
@@ -210,8 +210,6 @@ int dibusb_remote_exit(struct usb_dibusb
 int dibusb_remote_init(struct usb_dibusb *dib);
 
 /* dvb-dibusb-fe-i2c.c */
-int dibusb_i2c_msg(struct usb_dibusb *dib, u8 addr,
-		u8 *wbuf, u16 wlen, u8 *rbuf, u16 rlen);
 int dibusb_fe_init(struct usb_dibusb* dib);
 int dibusb_fe_exit(struct usb_dibusb *dib);
 int dibusb_i2c_init(struct usb_dibusb *dib);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/demux.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/demux.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/demux.h	2005-03-22 00:16:28.000000000 +0100
@@ -298,8 +298,4 @@ struct dmx_demux {
 
 #define DMX_DIR_ENTRY(list) list_entry(list, struct dmx_demux, reg_list)
 
-int dmx_register_demux (struct dmx_demux* demux);
-int dmx_unregister_demux (struct dmx_demux* demux);
-struct list_head* dmx_get_demuxes (void);
-
 #endif /* #ifndef __DEMUX_H */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_demux.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c	2005-03-22 00:16:28.000000000 +0100
@@ -39,17 +39,17 @@
 // #define DVB_DEMUX_SECTION_LOSS_LOG
 
 
-LIST_HEAD(dmx_muxs);
+static LIST_HEAD(dmx_muxs);
 
 
-int dmx_register_demux(struct dmx_demux *demux) 
+static int dmx_register_demux(struct dmx_demux *demux)
 {
 	demux->users = 0;
 	list_add(&demux->reg_list, &dmx_muxs);
 	return 0;
 }
 
-int dmx_unregister_demux(struct dmx_demux* demux)
+static int dmx_unregister_demux(struct dmx_demux* demux)
 {
 	struct list_head *pos, *n, *head=&dmx_muxs;
 
@@ -66,14 +66,6 @@ int dmx_unregister_demux(struct dmx_demu
 }
 
 
-struct list_head *dmx_get_demuxes(void)
-{
-	if (list_empty(&dmx_muxs))
-		return NULL;
-
-	return &dmx_muxs;
-}
-
 /******************************************************************************
  * static inlined helper functions
  ******************************************************************************/
@@ -105,19 +97,6 @@ static inline u8 payload(const u8 *tsp)
 }
 
 
-void dvb_set_crc32(u8 *data, int length)
-{
-	u32 crc;
-
-	crc = crc32_be(~0, data, length);
-
-	data[length]   = (crc >> 24) & 0xff;
-	data[length+1] = (crc >> 16) & 0xff;
-	data[length+2] = (crc >>  8) & 0xff;
-	data[length+3] = (crc)       & 0xff;
-}
-
-
 static u32 dvb_dmx_crc32 (struct dvb_demux_feed *f, const u8 *src, size_t len)
 {
 	return (f->feed.sec.crc_val = crc32_be (f->feed.sec.crc_val, src, len));
@@ -424,7 +403,7 @@ static inline void dvb_dmx_swfilter_pack
 	((f)->feed.ts.is_filtering) &&					\
 	(((f)->ts_type & (TS_PACKET|TS_PAYLOAD_ONLY)) == TS_PACKET))
 
-void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
+static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
 {
 	struct dvb_demux_feed *feed;
 	struct list_head *pos, *head=&demux->feed_list;
@@ -452,7 +431,6 @@ void dvb_dmx_swfilter_packet(struct dvb_
 			feed->cb.ts(buf, 188, NULL, 0, &feed->feed.ts, DMX_OK);
 	}
 }
-EXPORT_SYMBOL(dvb_dmx_swfilter_packet);
 
 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
@@ -1190,7 +1168,7 @@ static struct list_head * dvbdmx_get_fro
 }
 
 
-int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend)
+static int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend)
 {
 	struct dvb_demux *dvbdemux = (struct dvb_demux *) demux;
 
@@ -1204,10 +1182,9 @@ int dvbdmx_connect_frontend(struct dmx_d
 	up(&dvbdemux->mutex);
 	return 0;
 }
-EXPORT_SYMBOL(dvbdmx_connect_frontend);
 
 
-int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
+static int dvbdmx_disconnect_frontend(struct dmx_demux *demux)
 {
 	struct dvb_demux *dvbdemux = (struct dvb_demux *) demux;
 
@@ -1218,7 +1195,6 @@ int dvbdmx_disconnect_frontend(struct dm
 	up(&dvbdemux->mutex);
 	return 0;
 }
-EXPORT_SYMBOL(dvbdmx_disconnect_frontend);
 
 
 static int dvbdmx_get_pes_pids(struct dmx_demux *demux, u16 *pids)
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_demux.h	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h	2005-03-22 00:16:28.000000000 +0100
@@ -138,12 +138,8 @@ struct dvb_demux {
 
 int dvb_dmx_init(struct dvb_demux *dvbdemux);
 int dvb_dmx_release(struct dvb_demux *dvbdemux);
-void dvb_dmx_swfilter_packet(struct dvb_demux *dvbdmx, const u8 *buf);
 void dvb_dmx_swfilter_packets(struct dvb_demux *dvbdmx, const u8 *buf, size_t count);
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count);
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count);
 
-int dvbdmx_connect_frontend(struct dmx_demux *demux, struct dmx_frontend *frontend);
-int dvbdmx_disconnect_frontend(struct dmx_demux *demux);
-
 #endif /* _DVB_DEMUX_H_ */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_net.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_net.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_net.c	2005-03-22 00:16:28.000000000 +0100
@@ -217,12 +217,12 @@ static unsigned short dvb_net_eth_type_t
 #define ULE_TEST	0
 #define ULE_BRIDGED	1
 
-int ule_test_sndu( struct dvb_net_priv *p )
+static int ule_test_sndu( struct dvb_net_priv *p )
 {
 	return -1;
 }
 
-int ule_bridged_sndu( struct dvb_net_priv *p )
+static int ule_bridged_sndu( struct dvb_net_priv *p )
 {
 	/* BRIDGE SNDU handling sucks in draft-ietf-ipdvb-ule-03.txt.
 	 * This has to be the last extension header, otherwise it won't work.
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-22 00:16:28.000000000 +0100
@@ -55,8 +55,7 @@ static const char * const dnames[] = {
 #define nums2minor(num,type,id)  ((num << 6) | (id << 4) | type)
 #define MAX_DVB_MINORS           (DVB_MAX_IDS*64)
 
-struct class_simple *dvb_class;
-EXPORT_SYMBOL(dvb_class);
+static struct class_simple *dvb_class;
 
 static struct dvb_device* dvbdev_find_device (int minor)
 {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda10021.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c	2005-03-22 00:16:28.000000000 +0100
@@ -61,7 +61,7 @@ static int verbose;
 
 #define FIN (XIN >> 4)
 
-int tda10021_inittab_size = 0x40;
+static int tda10021_inittab_size = 0x40;
 static u8 tda10021_inittab[0x40]=
 {
 	0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-av.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c	2005-03-22 00:16:28.000000000 +0100
@@ -59,7 +59,7 @@ struct budget_av {
 	struct dvb_ca_en50221 ca;
 };
 
-int enable_ci = 0;
+static int enable_ci = 0;
 
 
 /****************************************************************************
@@ -658,7 +658,7 @@ static int philips_tu1216_request_firmwa
 	return request_firmware(fw, name, &budget->dev->pci->dev);
 }
 
-struct tda1004x_config philips_tu1216_config = {
+static struct tda1004x_config philips_tu1216_config = {
 
 	.demod_address = 0x8,
 	.invert = 1,
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-patch.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-patch.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-patch.c	2005-03-22 00:16:28.000000000 +0100
@@ -406,7 +406,7 @@ static int grundig_29504_451_pll_set(str
 	return 0;
 }
 
-struct tda8083_config grundig_29504_451_config = {
+static struct tda8083_config grundig_29504_451_config = {
 	.demod_address = 0x68,
 	.pll_set = grundig_29504_451_pll_set,
 };

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 21/48] refactor sw pid filter to drop redundant code
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (19 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 20/48] cleanups, make stuff static Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 22/48] nxt2002: fix max frequency Johannes Stezenbach
                   ` (26 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-swpidfilter-refactor.patch --]
[-- Type: text/plain, Size: 15312 bytes --]

o added index field to struct dvb_demux_feed for having a unique feed id, which
  can be used for hardware pid filter tables
o dibusb: adding the index to struct dvb_demux_feed makes dibusb-pid-filtering redundant
o ttusb-budget: struct channel removed in favour of dvbdmxfeed->index
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 drivers/media/dvb/dibusb/dvb-dibusb-pid.c                              |   80 ---------
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile                 |    3 
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c        |    2 
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c         |   24 --
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h             |   10 -
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c            |    4 
 linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h            |    1 
 linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c |   86 +---------
 8 files changed, 24 insertions(+), 186 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/Makefile	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile	2005-03-22 00:17:09.000000000 +0100
@@ -3,8 +3,7 @@ dvb-dibusb-objs = dvb-dibusb-core.o \
 	dvb-dibusb-fe-i2c.o \
 	dvb-dibusb-firmware.o \
 	dvb-dibusb-remote.o \
-	dvb-dibusb-usb.o \
-	dvb-dibusb-pid.o
+	dvb-dibusb-usb.o
 
 obj-$(CONFIG_DVB_DIBUSB) += dvb-dibusb.o
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:17:09.000000000 +0100
@@ -349,7 +349,6 @@ static int dibusb_exit(struct usb_dibusb
 	dibusb_remote_exit(dib);
 	dibusb_fe_exit(dib);
 	dibusb_i2c_exit(dib);
-	dibusb_pid_list_exit(dib);
 	dibusb_dvb_exit(dib);
 	dibusb_urb_exit(dib);
 	deb_info("init_state should be zero now: %x\n",dib->init_state);
@@ -368,7 +367,6 @@ static int dibusb_init(struct usb_dibusb
 	
 	if ((ret = dibusb_urb_init(dib)) ||
 		(ret = dibusb_dvb_init(dib)) || 
-		(ret = dibusb_pid_list_init(dib)) ||
 		(ret = dibusb_i2c_init(dib))) {
 		dibusb_exit(dib);
 		return ret;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:15:37.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:17:09.000000000 +0100
@@ -22,7 +22,6 @@ static u32 urb_compl_count;
 void dibusb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
 {
 	struct usb_dibusb *dib = urb->context;
-	int ret;
 
 	deb_ts("urb complete feedcount: %d, status: %d, length: %d\n",dib->feedcount,urb->status,
 			urb->actual_length);
@@ -45,24 +44,12 @@ void dibusb_urb_complete(struct urb *urb
 	}
 
 	if (dib->feedcount > 0) {
-		deb_ts("URB return len: %d\n",urb->actual_length);
-		if (urb->actual_length % 188) 
-			deb_ts("TS Packets: %d, %d\n", urb->actual_length/188,urb->actual_length % 188);
-
-		/* Francois recommends to drop not full-filled packets, even if they may 
-		 * contain valid TS packets, at least for USB1.1
-		 *
-		 * if (urb->actual_length == dib->dibdev->parm->default_size && dib->dvb_is_ready) */
 		if (dib->init_state & DIBUSB_STATE_DVB)
 			dvb_dmx_swfilter(&dib->demux, (u8*) urb->transfer_buffer,urb->actual_length);
-		else
-			deb_ts("URB dropped because of the " 
-					"actual_length or !dvb_is_ready (%d).\n",dib->init_state & DIBUSB_STATE_DVB);
 	} else 
 		deb_ts("URB dropped because of feedcount.\n");
 
-	ret = usb_submit_urb(urb,GFP_ATOMIC);
-	deb_ts("urb resubmitted, (%d)\n",ret);
+	usb_submit_urb(urb,GFP_ATOMIC);
 }
 
 static int dibusb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) 
@@ -90,11 +77,10 @@ static int dibusb_ctrl_feed(struct dvb_d
 	
 	dib->feedcount = newfeedcount;
 
-	/* get a free pid from the list and activate it on the device
-	 * specific pid_filter
-	 */
-	if (dib->pid_parse)
-		dibusb_ctrl_pid(dib,dvbdmxfeed,onoff);
+	/* activate the pid on the device specific pid_filter */
+	deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off");
+	if (dib->pid_parse && dib->xfer_ops.pid_ctrl != NULL)
+		dib->xfer_ops.pid_ctrl(dib->fe,dvbdmxfeed->index,dvbdmxfeed->pid,onoff);
 
 	/* 
 	 * start the feed if this was the first pid to set and there is still a pid
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-pid.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-pid.c	2005-03-22 00:15:37.000000000 +0100
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,80 +0,0 @@
-/*
- * dvb-dibusb-pid.c is part of the driver for mobile USB Budget DVB-T devices 
- * based on reference design made by DiBcom (http://www.dibcom.fr/)
- *
- * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de)
- *
- * see dvb-dibusb-core.c for more copyright details.
- *
- * This file contains functions for initializing and handling the internal
- * pid-list. This pid-list mirrors the information currently stored in the
- * devices pid-list.
- */
-#include "dvb-dibusb.h"
-
-int dibusb_pid_list_init(struct usb_dibusb *dib)
-{
-	int i;
-	dib->pid_list = kmalloc(sizeof(struct dibusb_pid) * dib->dibdev->dev_cl->demod->pid_filter_count,GFP_KERNEL);
-	if (dib->pid_list == NULL)
-		return -ENOMEM;
-
-	deb_xfer("initializing %d pids for the pid_list.\n",dib->dibdev->dev_cl->demod->pid_filter_count);
-	
-	dib->pid_list_lock = SPIN_LOCK_UNLOCKED;
-	memset(dib->pid_list,0,dib->dibdev->dev_cl->demod->pid_filter_count*(sizeof(struct dibusb_pid)));
-	for (i=0; i < dib->dibdev->dev_cl->demod->pid_filter_count; i++) {
-		dib->pid_list[i].index = i;
-		dib->pid_list[i].pid = 0;
-		dib->pid_list[i].active = 0;
-	}
-
-	dib->init_state |= DIBUSB_STATE_PIDLIST;
-	return 0;
-}
-
-void dibusb_pid_list_exit(struct usb_dibusb *dib)
-{
-	if (dib->init_state & DIBUSB_STATE_PIDLIST)
-		kfree(dib->pid_list);
-	dib->init_state &= ~DIBUSB_STATE_PIDLIST;
-}
-
-/* fetch a pid from pid_list and set it on or off */
-int dibusb_ctrl_pid(struct usb_dibusb *dib, struct dvb_demux_feed *dvbdmxfeed , int onoff)
-{
-	int i,ret = -1;
-	unsigned long flags;
-	u16 pid = dvbdmxfeed->pid;
-
-	if (onoff) {
-		spin_lock_irqsave(&dib->pid_list_lock,flags);
-		for (i=0; i < dib->dibdev->dev_cl->demod->pid_filter_count; i++)
-			if (!dib->pid_list[i].active) {
-				dib->pid_list[i].pid = pid;
-				dib->pid_list[i].active = 1;
-				ret = i;
-				break;
-			}
-		dvbdmxfeed->priv = &dib->pid_list[ret];
-		spin_unlock_irqrestore(&dib->pid_list_lock,flags);
-		
-		if (dib->xfer_ops.pid_ctrl != NULL) 
-			dib->xfer_ops.pid_ctrl(dib->fe,dib->pid_list[ret].index,dib->pid_list[ret].pid,1);
-	} else {
-		struct dibusb_pid *dpid = dvbdmxfeed->priv;
-		
-		if (dib->xfer_ops.pid_ctrl != NULL) 
-			dib->xfer_ops.pid_ctrl(dib->fe,dpid->index,0,0);
-		
-		ret = dpid->index;
-		dpid->pid = 0;
-		dpid->active = 0;
-	}
-	
-	/* a free pid from the list */
-	deb_xfer("setting pid: %5d %04x at index %d '%s'\n",pid,pid,ret,onoff ? "on" : "off");
-
-	return ret;
-}
-
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:17:09.000000000 +0100
@@ -157,7 +157,6 @@ struct usb_dibusb {
 #define DIBUSB_STATE_DVB        0x008
 #define DIBUSB_STATE_I2C        0x010
 #define DIBUSB_STATE_REMOTE		0x020
-#define DIBUSB_STATE_PIDLIST    0x040
 	int init_state;
 
 	int feedcount;
@@ -176,10 +175,6 @@ struct usb_dibusb {
 	struct semaphore usb_sem;
 	struct semaphore i2c_sem;
 
-	/* pid filtering */
-	spinlock_t pid_list_lock;
-	struct dibusb_pid *pid_list;
-
 	/* dvb */
 	struct dvb_adapter *adapter;
 	struct dmxdev dmxdev;
@@ -232,11 +227,6 @@ int dibusb_streaming(struct usb_dibusb *
 int dibusb_urb_init(struct usb_dibusb *);
 int dibusb_urb_exit(struct usb_dibusb *);
 
-/* dvb-dibusb-pid.c */
-int dibusb_pid_list_init(struct usb_dibusb *dib);
-void dibusb_pid_list_exit(struct usb_dibusb *dib);
-int dibusb_ctrl_pid(struct usb_dibusb *dib, struct dvb_demux_feed *dvbdmxfeed , int onoff);
-
 /* i2c and transfer stuff */
 #define DIBUSB_I2C_TIMEOUT				5000
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_demux.h	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h	2005-03-22 00:17:09.000000000 +0100
@@ -98,6 +98,7 @@ struct dvb_demux_feed {
         u16 peslen;
 
 	struct list_head list_head;
+		int index; /* a unique index for each feed (can be used as hardware pid filter index) */
 };
 
 struct dvb_demux {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_demux.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c	2005-03-22 00:17:09.000000000 +0100
@@ -1226,8 +1226,10 @@ int dvb_dmx_init(struct dvb_demux *dvbde
 		dvbdemux->filter[i].state = DMX_STATE_FREE;
 		dvbdemux->filter[i].index = i;
 	}
-	for (i=0; i<dvbdemux->feednum; i++)
+	for (i=0; i<dvbdemux->feednum; i++) {
 		dvbdemux->feed[i].state = DMX_STATE_FREE;
+		dvbdemux->feed[i].index = i;
+	}
 	dvbdemux->frontend_list.next=
 	  dvbdemux->frontend_list.prev=
 	    &dvbdemux->frontend_list;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-21 23:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-22 00:17:09.000000000 +0100
@@ -79,9 +79,8 @@ struct ttusb {
 	struct dmxdev dmxdev;
 	struct dvb_net dvbnet;
 
-	/* our semaphore, for channel allocation/deallocation */
-	struct semaphore sem;
 	/* and one for USB access. */
+	struct semaphore semi2c;
 	struct semaphore semusb;
 
 	struct dvb_adapter *adapter;
@@ -121,18 +120,6 @@ struct ttusb {
 
 	u8 last_result[32];
 
-	struct ttusb_channel {
-		struct ttusb *ttusb;
-		struct dvb_demux_feed *dvbdmxfeed;
-
-		int active;
-		int id;
-		int pid;
-		int type;	/* 1 - TS, 2 - Filter */
-#ifdef TTUSB_HWSECTIONS
-		int filterstate[TTUSB_MAXFILTER];	/* 0: not busy, 1: busy */
-#endif
-	} channel[TTUSB_MAXCHANNEL];
 #if 0
 	devfs_handle_t stc_devfs_handle;
 #endif
@@ -258,7 +245,7 @@ static int master_xfer(struct i2c_adapte
 	int i = 0;
 	int inc;
 
-	if (down_interruptible(&ttusb->sem) < 0)
+	if (down_interruptible(&ttusb->semi2c) < 0)
 		return -EAGAIN;
 
 	while (i < num) {
@@ -292,7 +279,7 @@ static int master_xfer(struct i2c_adapte
 		i += inc;
 	}
 
-	up(&ttusb->sem);
+	up(&ttusb->semi2c);
 	return i;
 }
 
@@ -888,15 +875,13 @@ static int ttusb_start_iso_xfer(struct t
 }
 
 #ifdef TTUSB_HWSECTIONS
-static void ttusb_handle_ts_data(struct ttusb_channel *channel, const u8 * data,
+static void ttusb_handle_ts_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
 			  int len)
 {
-	struct dvb_demux_feed *dvbdmxfeed = channel->dvbdmxfeed;
-
 	dvbdmxfeed->cb.ts(data, len, 0, 0, &dvbdmxfeed->feed.ts, 0);
 }
 
-static void ttusb_handle_sec_data(struct ttusb_channel *channel, const u8 * data,
+static void ttusb_handle_sec_data(struct dvb_demux_feed *dvbdmxfeed, const u8 * data,
 			   int len)
 {
 //      struct dvb_demux_feed *dvbdmxfeed = channel->dvbdmxfeed;
@@ -905,31 +890,10 @@ static void ttusb_handle_sec_data(struct
 }
 #endif
 
-static struct ttusb_channel *ttusb_channel_allocate(struct ttusb *ttusb)
-{
-	int i;
-
-	if (down_interruptible(&ttusb->sem))
-		return NULL;
-
-	/* lock! */
-	for (i = 0; i < TTUSB_MAXCHANNEL; ++i) {
-		if (!ttusb->channel[i].active) {
-			ttusb->channel[i].active = 1;
-			up(&ttusb->sem);
-			return ttusb->channel + i;
-		}
-	}
-
-	up(&ttusb->sem);
-
-	return NULL;
-}
-
 static int ttusb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
 {
 	struct ttusb *ttusb = (struct ttusb *) dvbdmxfeed->demux;
-	struct ttusb_channel *channel;
+	int feed_type = 1;
 
 	dprintk("ttusb_start_feed\n");
 
@@ -949,35 +913,22 @@ static int ttusb_start_feed(struct dvb_d
 		case DMX_TS_PES_TELETEXT:
 		case DMX_TS_PES_PCR:
 		case DMX_TS_PES_OTHER:
-			channel = ttusb_channel_allocate(ttusb);
 			break;
 		default:
 			return -EINVAL;
 		}
-	} else {
-		channel = ttusb_channel_allocate(ttusb);
 	}
 
-	if (!channel)
-		return -EBUSY;
-
-	dvbdmxfeed->priv = channel;
-	channel->dvbdmxfeed = dvbdmxfeed;
-
-	channel->pid = dvbdmxfeed->pid;
-
 #ifdef TTUSB_HWSECTIONS
+#error TODO: allocate filters
 	if (dvbdmxfeed->type == DMX_TYPE_TS) {
-		channel->type = 1;
+		feed_type = 1;
 	} else if (dvbdmxfeed->type == DMX_TYPE_SEC) {
-		channel->type = 2;
-#error TODO: allocate filters
+		feed_type = 2;
 	}
-#else
-	channel->type = 1;
 #endif
 
-	ttusb_set_channel(ttusb, channel->id, channel->type, channel->pid);
+	ttusb_set_channel(ttusb, dvbdmxfeed->index, feed_type, dvbdmxfeed->pid);
 
 	if (0 == ttusb->running_feed_count++)
 		ttusb_start_iso_xfer(ttusb);
@@ -987,17 +938,13 @@ static int ttusb_start_feed(struct dvb_d
 
 static int ttusb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
 {
-	struct ttusb_channel *channel =
-	    (struct ttusb_channel *) dvbdmxfeed->priv;
 	struct ttusb *ttusb = (struct ttusb *) dvbdmxfeed->demux;
 
-	ttusb_del_channel(channel->ttusb, channel->id);
+	ttusb_del_channel(ttusb, dvbdmxfeed->index);
 
 	if (--ttusb->running_feed_count == 0)
 		ttusb_stop_iso_xfer(ttusb);
 
-	channel->active = 0;
-
 	return 0;
 }
 
@@ -1406,7 +1353,7 @@ static int ttusb_probe(struct usb_interf
 {
 	struct usb_device *udev;
 	struct ttusb *ttusb;
-	int result, channel;
+	int result;
 
 	dprintk("%s: TTUSB DVB connected\n", __FUNCTION__);
 
@@ -1419,15 +1366,10 @@ static int ttusb_probe(struct usb_interf
 
 	memset(ttusb, 0, sizeof(struct ttusb));
 
-	for (channel = 0; channel < TTUSB_MAXCHANNEL; ++channel) {
-		ttusb->channel[channel].id = channel;
-		ttusb->channel[channel].ttusb = ttusb;
-	}
-
 	ttusb->dev = udev;
 	ttusb->c = 0;
 	ttusb->mux_state = 0;
-	sema_init(&ttusb->sem, 0);
+	sema_init(&ttusb->semi2c, 0);
 	sema_init(&ttusb->semusb, 1);
 
 	ttusb_setup_interfaces(ttusb);
@@ -1436,7 +1378,7 @@ static int ttusb_probe(struct usb_interf
 	if (ttusb_init_controller(ttusb))
 		printk("ttusb_init_controller: error\n");
 
-	up(&ttusb->sem);
+	up(&ttusb->semi2c);
 
 	dvb_register_adapter(&ttusb->adapter, "Technotrend/Hauppauge Nova-USB", THIS_MODULE);
 	ttusb->adapter->priv = ttusb;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 22/48] nxt2002: fix max frequency
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (20 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 21/48] refactor sw pid filter to drop redundant code Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  2:43   ` Gene Heskett
  2005-03-22  1:23 ` [DVB patch 23/48] ttusb-budget: s/usb_unlink_urb/usb_kill_urb/ Johannes Stezenbach
                   ` (25 subsequent siblings)
  47 siblings, 1 reply; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-nxt2002-fix.patch --]
[-- Type: text/plain, Size: 990 bytes --]

Patch by Taylor Jacob and Tom Dombrosky: There was a typo in the BBTI/B2C2
specs that stated the upper frequency of the air2pc/nxt2002 was 806Mhz, not
860Mhz.

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 nxt2002.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:15:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:17:45.000000000 +0100
@@ -671,7 +671,7 @@ static struct dvb_frontend_ops nxt2002_o
 		.name = "Nextwave nxt2002 VSB/QAM frontend",
 		.type = FE_ATSC,
 		.frequency_min =  54000000,
-		.frequency_max = 806000000,
+		.frequency_max = 860000000,
                 /* stepsize is just a guess */
 		.frequency_stepsize = 166666,
 		.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 23/48] ttusb-budget: s/usb_unlink_urb/usb_kill_urb/
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (21 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 22/48] nxt2002: fix max frequency Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 24/48] av7110: fix Oops when av7110_ir_init() failed Johannes Stezenbach
                   ` (24 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttusb-kill_urb.patch --]
[-- Type: text/plain, Size: 783 bytes --]

patch by Colin Western: s/usb_unlink_urb/usb_kill_urb/

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-ttusb-budget.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-22 00:17:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-22 00:17:50.000000000 +0100
@@ -818,7 +818,7 @@ static void ttusb_stop_iso_xfer(struct t
 	int i;
 
 	for (i = 0; i < ISO_BUF_COUNT; i++)
-		usb_unlink_urb(ttusb->iso_urb[i]);
+		usb_kill_urb(ttusb->iso_urb[i]);
 
 	ttusb->iso_streaming = 0;
 }

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 24/48] av7110: fix Oops when av7110_ir_init() failed
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (22 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 23/48] ttusb-budget: s/usb_unlink_urb/usb_kill_urb/ Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 25/48] saa7146: static initialization Johannes Stezenbach
                   ` (23 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-av7110-ir-fix-oops.patch --]
[-- Type: text/plain, Size: 2657 bytes --]

o don't call av7110_ir_init() if driver initialization failed already
  due to previous errors (resulted in Oops in out-of-memory conditions) (me)
o don't do av7110_ir_exit if init was not done (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 av7110.c    |   15 +++------------
 av7110_ir.c |    8 ++++++++
 2 files changed, 11 insertions(+), 12 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c	2005-03-22 00:17:56.000000000 +0100
@@ -2453,6 +2453,9 @@ err_no_mem:
 	av7110->dvb_adapter->priv = av7110;
 	frontend_init(av7110);
 
+#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
+	av7110_ir_init();
+#endif
 	printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num);
 	av7110->device_initialized = 1;
 	av7110_num++;
@@ -2640,18 +2643,6 @@ static int __init av7110_init(void)
 {
 	int retval;
 	retval = saa7146_register_extension(&av7110_extension);
-#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
-	if (retval)
-		goto failed_saa7146_register;
-
-	retval = av7110_ir_init();
-	if (retval)
-		goto failed_av7110_ir_init;
-	return 0;
-failed_av7110_ir_init:
-	saa7146_unregister_extension(&av7110_extension);
-failed_saa7146_register:
-#endif
 	return retval;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_ir.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c	2005-03-22 00:17:56.000000000 +0100
@@ -12,6 +12,7 @@
 
 /* enable ir debugging by or'ing av7110_debug with 16 */
 
+static int ir_initialized;
 static struct input_dev input_dev;
 
 static u32 ir_config;
@@ -160,6 +161,9 @@ static int av7110_ir_write_proc(struct f
 
 int __init av7110_ir_init(void)
 {
+	if (ir_initialized)
+		return 0;
+
 	static struct proc_dir_entry *e;
 
 	init_timer(&keyup_timer);
@@ -187,16 +191,20 @@ int __init av7110_ir_init(void)
 		e->size = 4 + 256 * sizeof(u16);
 	}
 
+	ir_initialized = 1;
 	return 0;
 }
 
 
 void __exit av7110_ir_exit(void)
 {
+	if (ir_initialized == 0)
+		return;
 	del_timer_sync(&keyup_timer);
 	remove_proc_entry("av7110_ir", NULL);
 	av7110_unregister_irc_handler(av7110_emit_key);
 	input_unregister_device(&input_dev);
+	ir_initialized = 0;
 }
 
 //MODULE_AUTHOR("Holger Waechtler <holger@convergence.de>");

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 25/48] saa7146: static initialization
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (23 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 24/48] av7110: fix Oops when av7110_ir_init() failed Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:23 ` [DVB patch 26/48] av7110: error handling during attach Johannes Stezenbach
                   ` (22 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Francois Romieu

[-- Attachment #1: dvb-saa7146-static-init.patch --]
[-- Type: text/plain, Size: 1720 bytes --]

Static initialization.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 saa7146_core.c |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/common/saa7146_core.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c	2005-03-22 00:18:04.000000000 +0100
@@ -20,11 +20,9 @@
 
 #include <media/saa7146.h>
 
-/* global variables */
-struct list_head saa7146_devices;
-struct semaphore saa7146_devices_lock;
+LIST_HEAD(saa7146_devices);
+DECLARE_MUTEX(saa7146_devices_lock);
 
-static int initialized = 0;
 static int saa7146_num = 0;
 
 unsigned int saa7146_debug = 0;
@@ -527,12 +525,6 @@ int saa7146_register_extension(struct sa
 {
 	DEB_EE(("ext:%p\n",ext));
 
-	if( 0 == initialized ) {
-		INIT_LIST_HEAD(&saa7146_devices);
-		init_MUTEX(&saa7146_devices_lock);
-		initialized = 1;
-	}
-
 	ext->driver.name = ext->name;
 	ext->driver.id_table = ext->pci_tbl;
 	ext->driver.probe = saa7146_init_one;
@@ -550,23 +542,6 @@ int saa7146_unregister_extension(struct 
 	return 0;
 }
 
-static int __init saa7146_init_module(void)
-{
-	if( 0 == initialized ) {
-		INIT_LIST_HEAD(&saa7146_devices);
-		init_MUTEX(&saa7146_devices_lock);
-		initialized = 1;
-	}
-	return 0;
-}
-
-static void __exit saa7146_cleanup_module(void)
-{
-}
-
-module_init(saa7146_init_module);
-module_exit(saa7146_cleanup_module);
-
 EXPORT_SYMBOL_GPL(saa7146_register_extension);
 EXPORT_SYMBOL_GPL(saa7146_unregister_extension);
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 26/48] av7110: error handling during attach
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (24 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 25/48] saa7146: static initialization Johannes Stezenbach
@ 2005-03-22  1:23 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 27/48] corrected links to firmware files Johannes Stezenbach
                   ` (21 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Francois Romieu

[-- Attachment #1: dvb-av7110-janitor.patch --]
[-- Type: text/plain, Size: 15912 bytes --]

Janitoring - error handling during attach
o av7110_arm_sync(): small helper to factor out some code;
o av7110_attach() does not check the status code returned by all the
  functions is uses;
o balance the error path in av7110_attach and have it easy to check.
  Please check it;
o if everything is correctly balanced, device_initialized is not needed
  anymore in struct av7110;
o av7110_detach(): no need to cast a void * pointer;
o av7110_detach(): die #ifdef, die !
o change the returned value of av7110_av_exit() as it can't fail;
o change the returned value of av7110_ca_init() as it can fail. Removed
  extraneous casts while are it;
o check for failure of vmalloc() in ci_ll_init().
o vfree(NULL) is safe.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 av7110.c       |  194 ++++++++++++++++++++++++++++++++-------------------------
 av7110.h       |    2 
 av7110_av.c    |   25 ++++---
 av7110_av.h    |    2 
 av7110_ca.c    |   20 ++++-
 av7110_ca.h    |    2 
 av7110_ipack.c |    1 
 7 files changed, 147 insertions(+), 99 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110.c	2005-03-22 00:17:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c	2005-03-22 00:18:08.000000000 +0100
@@ -188,6 +188,15 @@ static void arm_error(struct av7110 *av7
 	recover_arm(av7110);
 }
 
+static void av7110_arm_sync(struct av7110 *av7110)
+{
+	av7110->arm_rmmod = 1;
+	wake_up_interruptible(&av7110->arm_wait);
+
+	while (av7110->arm_thread)
+		msleep(1);
+}
+
 static int arm_thread(void *data)
 {
 	struct av7110 *av7110 = data;
@@ -1461,6 +1470,11 @@ static int check_firmware(struct av7110*
 
 #ifdef CONFIG_DVB_AV7110_FIRMWARE_FILE
 #include "av7110_firm.h"
+static void put_firmware(struct av7110* av7110)
+{
+	av7110->bin_fw = NULL;
+}
+
 static inline int get_firmware(struct av7110* av7110)
 {
 	av7110->bin_fw = dvb_ttpci_fw;
@@ -1468,6 +1482,11 @@ static inline int get_firmware(struct av
 	return check_firmware(av7110);
 }
 #else
+static void put_firmware(struct av7110* av7110)
+{
+	vfree(av7110->bin_fw);
+}
+
 static int get_firmware(struct av7110* av7110)
 {
 	int ret;
@@ -1960,8 +1979,10 @@ static u8 read_pwm(struct av7110* av7110
 	return pwm;
 }
 
-static void frontend_init(struct av7110 *av7110)
+static int frontend_init(struct av7110 *av7110)
 {
+	int ret;
+
 	if (av7110->dev->pci->subsystem_vendor == 0x110a) {
 		switch(av7110->dev->pci->subsystem_device) {
 		case 0x0000: // Fujitsu/Siemens DVB-Cable (ves1820/Philips CD1516(??))
@@ -2054,7 +2075,9 @@ static void frontend_init(struct av7110 
 		}
 	}
 
-	if (av7110->fe == NULL) {
+	if (!av7110->fe) {
+		/* FIXME: propagate the failure code from the lower layers */
+		ret = -ENOMEM;
 		printk("dvb-ttpci: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n",
 		       av7110->dev->pci->vendor,
 		       av7110->dev->pci->device,
@@ -2071,13 +2094,15 @@ static void frontend_init(struct av7110 
 		FE_FUNC_OVERRIDE(av7110->fe->ops->dishnetwork_send_legacy_command, av7110->fe_dishnetwork_send_legacy_command, av7110_fe_dishnetwork_send_legacy_command);
 		FE_FUNC_OVERRIDE(av7110->fe->ops->set_frontend, av7110->fe_set_frontend, av7110_fe_set_frontend);
 
-		if (dvb_register_frontend(av7110->dvb_adapter, av7110->fe)) {
+		ret = dvb_register_frontend(av7110->dvb_adapter, av7110->fe);
+		if (ret < 0) {
 			printk("av7110: Frontend registration failed!\n");
 			if (av7110->fe->ops->release)
 				av7110->fe->ops->release(av7110->fe);
 			av7110->fe = NULL;
 		}
 	}
+	return ret;
 }
 
 /* Budgetpatch note:
@@ -2147,10 +2172,10 @@ static void frontend_init(struct av7110 
  */
 static int av7110_attach(struct saa7146_dev* dev, struct saa7146_pci_extension_data *pci_ext)
 {
-	struct av7110 *av7110 = NULL;
-	int length = TS_WIDTH * TS_HEIGHT;
-	int ret = 0;
-	int count = 0;
+	const int length = TS_WIDTH * TS_HEIGHT;
+	struct pci_dev *pdev = dev->pci;
+	struct av7110 *av7110;
+	int ret, count = 0;
 
 	dprintk(4, "dev: %p\n", dev);
 
@@ -2244,7 +2269,8 @@ static int av7110_attach(struct saa7146_
 	}
 
 	/* prepare the av7110 device struct */
-	if (!(av7110 = kmalloc (sizeof (struct av7110), GFP_KERNEL))) {
+	av7110 = kmalloc(sizeof(struct av7110), GFP_KERNEL);
+	if (!av7110) {
 		dprintk(1, "out of memory\n");
 		return -ENOMEM;
 	}
@@ -2255,12 +2281,14 @@ static int av7110_attach(struct saa7146_
 	av7110->dev = dev;
 	dev->ext_priv = av7110;
 
-	if ((ret = get_firmware(av7110))) {
-		kfree(av7110);
-		return ret;
-	}
+	ret = get_firmware(av7110);
+	if (ret < 0)
+		goto err_kfree_0;
 
-	dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name, THIS_MODULE);
+	ret = dvb_register_adapter(&av7110->dvb_adapter, av7110->card_name,
+				   THIS_MODULE);
+	if (ret < 0)
+		goto err_put_firmware_1;
 
 	/* the Siemens DVB needs this if you want to have the i2c chips
 	   get recognized before the main driver is fully loaded */
@@ -2275,21 +2303,21 @@ static int av7110_attach(struct saa7146_
 
 	saa7146_i2c_adapter_prepare(dev, &av7110->i2c_adap, SAA7146_I2C_BUS_BIT_RATE_120); /* 275 kHz */
 
-	if (i2c_add_adapter(&av7110->i2c_adap) < 0) {
-err_no_mem:
-		dvb_unregister_adapter (av7110->dvb_adapter);
-		kfree(av7110);
-		return -ENOMEM;
-	}
+	ret = i2c_add_adapter(&av7110->i2c_adap);
+	if (ret < 0)
+		goto err_dvb_unregister_adapter_2;
 
-	ttpci_eeprom_parse_mac(&av7110->i2c_adap, av7110->dvb_adapter->proposed_mac);
+	ttpci_eeprom_parse_mac(&av7110->i2c_adap,
+			       av7110->dvb_adapter->proposed_mac);
+	ret = -ENOMEM;
 
 	if (budgetpatch) {
 		spin_lock_init(&av7110->feedlock1);
-		av7110->grabbing = saa7146_vmalloc_build_pgtable(
-					 dev->pci, length, &av7110->pt);
+		av7110->grabbing = saa7146_vmalloc_build_pgtable(pdev, length,
+								 &av7110->pt);
 		if (!av7110->grabbing)
-			goto err_no_mem;
+			goto err_i2c_del_3;
+
 		saa7146_write(dev, PCI_BT_V1, 0x1c1f101f);
 		saa7146_write(dev, BCS_CTRL, 0x80400040);
 		/* set dd1 stream a & b */
@@ -2396,43 +2424,43 @@ err_no_mem:
 	av7110->arm_thread = NULL;
 
 	/* allocate and init buffers */
-        av7110->debi_virt = pci_alloc_consistent(dev->pci, 8192,
-						 &av7110->debi_bus);
-	if (!av7110->debi_virt) {
-		ret = -ENOMEM;
-                goto err;
-	}
+	av7110->debi_virt = pci_alloc_consistent(pdev, 8192, &av7110->debi_bus);
+	if (!av7110->debi_virt)
+		goto err_saa71466_vfree_4;
+
 
 	av7110->iobuf = vmalloc(AVOUTLEN+AOUTLEN+BMPLEN+4*IPACKS);
-	if (!av7110->iobuf) {
-		ret = -ENOMEM;
-                goto err;
-	}
+	if (!av7110->iobuf)
+		goto err_pci_free_5;
 
-	av7110_av_init(av7110);
+	ret = av7110_av_init(av7110);
+	if (ret < 0)
+		goto err_iobuf_vfree_6;
 
 	/* init BMP buffer */
 	av7110->bmpbuf = av7110->iobuf+AVOUTLEN+AOUTLEN;
 	init_waitqueue_head(&av7110->bmpq);
 
-	av7110_ca_init(av7110);
+	ret = av7110_ca_init(av7110);
+	if (ret < 0)
+		goto err_av7110_av_exit_7;
 
 	/* load firmware into AV7110 cards */
-	av7110_bootarm(av7110);
-	if (av7110_firmversion(av7110)) {
-		ret = -EIO;
-		goto err2;
-	}
+	ret = av7110_bootarm(av7110);
+	if (ret < 0)
+		goto err_av7110_ca_exit_8;
+
+	ret = av7110_firmversion(av7110);
+	if (ret < 0)
+		goto err_stop_arm_9;
 
 	if (FW_VERSION(av7110->arm_app)<0x2501)
 		printk ("dvb-ttpci: Warning, firmware version 0x%04x is too old. "
 			"System might be unstable!\n", FW_VERSION(av7110->arm_app));
 
-	if (kernel_thread(arm_thread, (void *) av7110, 0) < 0) {
-		printk("dvb-ttpci: failed to start arm_mon kernel thread @ card %d\n",
-		       av7110->dvb_adapter->num);
-		goto err2;
-	}
+	ret = kernel_thread(arm_thread, (void *) av7110, 0);
+	if (ret < 0)
+		goto err_stop_arm_9;
 
 	/* set initial volume in mixer struct */
 	av7110->mixer.volume_left  = volume;
@@ -2440,59 +2468,65 @@ err_no_mem:
 
 	init_av7110_av(av7110);
 
-	av7110_register(av7110);
+	ret = av7110_register(av7110);
+	if (ret < 0)
+		goto err_arm_thread_stop_10;
 
 	/* special case DVB-C: these cards have an analog tuner
 	   plus need some special handling, so we have separate
 	   saa7146_ext_vv data for these... */
 	ret = av7110_init_v4l(av7110);
-
-	if (ret)
-		goto err3;
+	if (ret < 0)
+		goto err_av7110_unregister_11;
 
 	av7110->dvb_adapter->priv = av7110;
-	frontend_init(av7110);
+	ret = frontend_init(av7110);
+	if (ret < 0)
+		goto err_av7110_exit_v4l_12;
 
 #if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
 	av7110_ir_init();
 #endif
 	printk(KERN_INFO "dvb-ttpci: found av7110-%d.\n", av7110_num);
-	av7110->device_initialized = 1;
 	av7110_num++;
-        return 0;
+out:
+	return ret;
 
-err3:
-	av7110->arm_rmmod = 1;
-	wake_up_interruptible(&av7110->arm_wait);
-	while (av7110->arm_thread)
-		msleep(1);
-err2:
+err_av7110_exit_v4l_12:
+	av7110_exit_v4l(av7110);
+err_av7110_unregister_11:
+	dvb_unregister(av7110);
+err_arm_thread_stop_10:
+	av7110_arm_sync(av7110);
+err_stop_arm_9:
+	/* Nothing to do. Rejoice. */
+err_av7110_ca_exit_8:
 	av7110_ca_exit(av7110);
+err_av7110_av_exit_7:
 	av7110_av_exit(av7110);
-err:
+err_iobuf_vfree_6:
+	vfree(av7110->iobuf);
+err_pci_free_5:
+	pci_free_consistent(pdev, 8192, av7110->debi_virt, av7110->debi_bus);
+err_saa71466_vfree_4:
+	if (!av7110->grabbing)
+		saa7146_pgtable_free(pdev, &av7110->pt);
+err_i2c_del_3:
 	i2c_del_adapter(&av7110->i2c_adap);
-
+err_dvb_unregister_adapter_2:
 	dvb_unregister_adapter(av7110->dvb_adapter);
-
-	if (NULL != av7110->debi_virt)
-		pci_free_consistent(dev->pci, 8192, av7110->debi_virt, av7110->debi_bus);
-	if (NULL != av7110->iobuf)
-		vfree(av7110->iobuf);
-	if (NULL != av7110 ) {
+err_put_firmware_1:
+	put_firmware(av7110);
+err_kfree_0:
 	kfree(av7110);
-	}
-
-	return ret;
+	goto out;
 }
 
 static int av7110_detach(struct saa7146_dev* saa)
 {
-	struct av7110 *av7110 = (struct av7110*)saa->ext_priv;
+	struct av7110 *av7110 = saa->ext_priv;
 	dprintk(4, "%p\n", av7110);
 
-	if (!av7110->device_initialized )
-		return 0;
-
 	if (budgetpatch) {
 		/* Disable RPS1 */
 		saa7146_write(saa, MC1, MASK_29);
@@ -2507,11 +2541,7 @@ static int av7110_detach(struct saa7146_
 	}
 	av7110_exit_v4l(av7110);
 
-	av7110->arm_rmmod=1;
-	wake_up_interruptible(&av7110->arm_wait);
-
-	while (av7110->arm_thread)
-		msleep(1);
+	av7110_arm_sync(av7110);
 
 	tasklet_kill(&av7110->debi_tasklet);
 	tasklet_kill(&av7110->gpio_tasklet);
@@ -2533,11 +2563,11 @@ static int av7110_detach(struct saa7146_
 	dvb_unregister_adapter (av7110->dvb_adapter);
 
 	av7110_num--;
-#ifndef CONFIG_DVB_AV7110_FIRMWARE_FILE
-	if (av7110->bin_fw)
-		vfree(av7110->bin_fw);
-#endif
+
+	put_firmware(av7110);
+
 	kfree(av7110);
+
 	saa->ext_priv = NULL;
 
 	return 0;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110.h	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h	2005-03-22 00:18:08.000000000 +0100
@@ -231,8 +231,6 @@ struct av7110 {
 	u32		    ir_config;
 
 	/* firmware stuff */
-	unsigned int device_initialized;
-
 	unsigned char *bin_fw;
 	unsigned long size_fw;
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_av.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.c	2005-03-22 00:18:08.000000000 +0100
@@ -1426,25 +1426,34 @@ void av7110_av_unregister(struct av7110 
 
 int av7110_av_init(struct av7110 *av7110)
 {
+	void (*play[])(u8 *, int, void *) = { play_audio_cb, play_video_cb };
+	int i, ret;
+
 	av7110->vidmode = VIDEO_MODE_PAL;
 
-	av7110_ipack_init(&av7110->ipack[0], IPACKS, play_audio_cb);
-	av7110->ipack[0].data = (void *) av7110;
-	av7110_ipack_init(&av7110->ipack[1], IPACKS, play_video_cb);
-	av7110->ipack[1].data = (void *) av7110;
+	for (i = 0; i < 2; i++) {
+		struct ipack *ipack = av7110->ipack + i;
+
+		ret = av7110_ipack_init(ipack, IPACKS, play[i]);
+		if (ret < 0) {
+			if (i)
+				av7110_ipack_free(--ipack);
+			goto out;
+		}
+		ipack->data = av7110;
+	}
 
 	dvb_ringbuffer_init(&av7110->avout, av7110->iobuf, AVOUTLEN);
 	dvb_ringbuffer_init(&av7110->aout, av7110->iobuf + AVOUTLEN, AOUTLEN);
 
 	av7110->kbuf[0] = (u8 *)(av7110->iobuf + AVOUTLEN + AOUTLEN + BMPLEN);
 	av7110->kbuf[1] = av7110->kbuf[0] + 2 * IPACKS;
-
-	return 0;
+out:
+	return ret;
 }
 
-int av7110_av_exit(struct av7110 *av7110)
+void av7110_av_exit(struct av7110 *av7110)
 {
 	av7110_ipack_free(&av7110->ipack[0]);
 	av7110_ipack_free(&av7110->ipack[1]);
-	return 0;
 }
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_av.h	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.h	2005-03-22 00:18:08.000000000 +0100
@@ -23,7 +23,7 @@ extern void av7110_p2t_write(u8 const *b
 extern int av7110_av_register(struct av7110 *av7110);
 extern void av7110_av_unregister(struct av7110 *av7110);
 extern int av7110_av_init(struct av7110 *av7110);
-extern int av7110_av_exit(struct av7110 *av7110);
+extern void av7110_av_exit(struct av7110 *av7110);
 
 
 #endif /* _AV7110_AV_H_ */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_ca.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.c	2005-03-22 00:18:08.000000000 +0100
@@ -91,8 +91,20 @@ void ci_get_data(struct dvb_ringbuffer *
 
 static int ci_ll_init(struct dvb_ringbuffer *cirbuf, struct dvb_ringbuffer *ciwbuf, int size)
 {
-	dvb_ringbuffer_init(cirbuf, vmalloc(size), size);
-	dvb_ringbuffer_init(ciwbuf, vmalloc(size), size);
+	struct dvb_ringbuffer *tab[] = { cirbuf, ciwbuf, NULL }, **p;
+	void *data;
+
+	for (p = tab; *p; p++) {
+		data = vmalloc(size);
+		if (!data) {
+			while (p-- != tab) {
+				vfree(p[0]->data);
+				p[0]->data = NULL;
+			}
+			return -ENOMEM;
+		}
+		dvb_ringbuffer_init(*p, data, size);
+	}
 	return 0;
 }
 
@@ -367,9 +379,9 @@ void av7110_ca_unregister(struct av7110 
 	dvb_unregister_device(av7110->ca_dev);
 }
 
-void av7110_ca_init(struct av7110* av7110)
+int av7110_ca_init(struct av7110* av7110)
 {
-	ci_ll_init(&av7110->ci_rbuffer, &av7110->ci_wbuffer, 8192);
+	return ci_ll_init(&av7110->ci_rbuffer, &av7110->ci_wbuffer, 8192);
 }
 
 void av7110_ca_exit(struct av7110* av7110)
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_ca.h	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.h	2005-03-22 00:18:08.000000000 +0100
@@ -8,7 +8,7 @@ extern void ci_get_data(struct dvb_ringb
 
 extern int av7110_ca_register(struct av7110 *av7110);
 extern void av7110_ca_unregister(struct av7110 *av7110);
-extern void av7110_ca_init(struct av7110* av7110);
+extern int av7110_ca_init(struct av7110* av7110);
 extern void av7110_ca_exit(struct av7110* av7110);
 
 #endif /* _AV7110_CA_H_ */
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ipack.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_ipack.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ipack.c	2005-03-22 00:18:08.000000000 +0100
@@ -37,7 +37,6 @@ int av7110_ipack_init(struct ipack *p, i
 
 void av7110_ipack_free(struct ipack *p)
 {
-	if (p->buf)
 	vfree(p->buf);
 }
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 27/48] corrected links to firmware files
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (25 preceding siblings ...)
  2005-03-22  1:23 ` [DVB patch 26/48] av7110: error handling during attach Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 28/48] support pcHDTV HD2000 Johannes Stezenbach
                   ` (20 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibcom-readme.patch --]
[-- Type: text/plain, Size: 2902 bytes --]

corrected links to firmware files (reported by Stefan Frings)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 README.dibusb    |   19 +++++++++++++------
 get_dvb_firmware |    2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/README.dibusb	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb	2005-03-22 00:18:18.000000000 +0100
@@ -157,13 +157,20 @@ You can either use "get_dvb_firmware dib
 can get it directly via
 
 for USB1.1 (AN2135)
-http://linuxtv.org/cgi-bin/cvsweb.cgi/dvb-kernel/firmware/dvb-dibusb-5.0.0.11.fw?rev=1.1&content-type=text/plain
+http://www.linuxtv.org/downloads/firmware/dvb-dibusb-5.0.0.11.fw
 
 for USB1.1 (AN2235) (a few Artec T1 devices)
-http://linuxtv.org/cgi-bin/cvsweb.cgi/dvb-kernel/firmware/dvb-dibusb-an2235-1.fw?rev=1.1&content-type=text/plain
+http://www.linuxtv.org/downloads/firmware/dvb-dibusb-an2235-1.fw
+
+for USB2.0 (FX2) Hauppauge, DiBcom
+http://www.linuxtv.org/downloads/firmware/dvb-dibusb-6.0.0.5.fw
+
+for USB2.0 ADSTech/Kworld USB2.0
+http://www.linuxtv.org/downloads/firmware/dvb-dibusb-adstech-usb2-1.fw
+
+for USB2.0 HanfTek
+http://www.linuxtv.org/downloads/firmware/dvb-dibusb-an2235-1.fw
 
-for USB2.0 (FX2)
-http://linuxtv.org/cgi-bin/cvsweb.cgi/dvb-kernel/firmware/dvb-dibusb-6.0.0.5.fw?rev=1.1&content-type=text/plain
 
 1.2. Compiling
 
@@ -203,7 +210,7 @@ in vdr is working now also.
 
 2. Known problems and bugs
 
-- none this time
+- Don't remove the USB device while running an DVB application, your system will die.
 
 2.1. Adding support for devices
 
@@ -242,7 +249,7 @@ now use the dmx_sw_filter function inste
 linux-dvb software filter is able to get the best of the garbled TS.
 
 The bug, where the TS is distorted by a heavy usage of the device is gone
-definitely.  All dibusb-devices I was using (Twinhan, Kworld, DiBcom) are
+definitely. All dibusb-devices I was using (Twinhan, Kworld, DiBcom) are
 working like charm now with VDR. Sometimes I even was able to record a channel
 and watch another one.
 
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/get_dvb_firmware	2005-03-22 00:15:20.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware	2005-03-22 00:18:18.000000000 +0100
@@ -222,7 +222,7 @@ sub vp7041 {
 }
 
 sub dibusb {
-	my $url = "http://linuxtv.org/cgi-bin/cvsweb.cgi/dvb-kernel/firmware/dvb-dibusb-5.0.0.11.fw?rev=1.1&content-type=text/plain";
+	my $url = "http://www.linuxtv.org/downloads/firmware/dvb-dibusb-5.0.0.11.fw";
 	my $outfile = "dvb-dibusb-5.0.0.11.fw";
 	my $hash = "fa490295a527360ca16dcdf3224ca243";
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 28/48] support pcHDTV HD2000
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (26 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 27/48] corrected links to firmware files Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 29/48] dibusb: support nova-t usb ir Johannes Stezenbach
                   ` (19 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-pchdtv-hd2000.patch --]
[-- Type: text/plain, Size: 27327 bytes --]

o DVB support for the pcHDTV HD2000 card, submitted by Rusty Scott
o remove bttv dependency from frontend (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 bt8xx/Kconfig       |    4 
 bt8xx/dvb-bt8xx.c   |   72 +++++
 bt8xx/dvb-bt8xx.h   |    1 
 frontends/Kconfig   |    7 
 frontends/Makefile  |    1 
 frontends/or51132.c |    6 
 frontends/or51211.c |  631 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 frontends/or51211.h |   44 +++
 8 files changed, 761 insertions(+), 5 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/Kconfig	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/Kconfig	2005-03-22 00:18:23.000000000 +0100
@@ -5,9 +5,11 @@ config DVB_BT8XX
 	select DVB_SP887X
 	select DVB_NXT6000
 	select DVB_CX24110
+	select DVB_OR51211
 	help
 	  Support for PCI cards based on the Bt8xx PCI bridge. Examples are
-	  the Nebula cards, the Pinnacle PCTV cards and Twinhan DST cards.
+	  the Nebula cards, the Pinnacle PCTV cards, the Twinhan DST cards and
+	  pcHDTV HD2000 cards.
 
           Since these cards have no MPEG decoder onboard, they transmit
 	  only compressed MPEG data over the PCI bus, so you need
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dvb-bt8xx.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dvb-bt8xx.c	2005-03-22 00:18:23.000000000 +0100
@@ -133,7 +133,7 @@ static int thomson_dtt7579_demod_init(st
 	static u8 mt352_reset [] = { 0x50, 0x80 };
 	static u8 mt352_adc_ctl_1_cfg [] = { 0x8E, 0x40 };
 	static u8 mt352_agc_cfg [] = { 0x67, 0x28, 0x20 };
-	static u8 mt352_gpp_ctl_cfg [] = { 0x75, 0x33 };
+	static u8 mt352_gpp_ctl_cfg [] = { 0x8C, 0x33 };
 	static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
 
 	mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
@@ -369,6 +369,63 @@ static struct dst_config dst_config = {
 };
 
 
+static int or51211_request_firmware(struct dvb_frontend* fe, const struct firmware **fw, char* name)
+{
+	struct dvb_bt8xx_card* bt = (struct dvb_bt8xx_card*) fe->dvb->priv;
+
+	return request_firmware(fw, name, &bt->bt->dev->dev);
+}
+
+static void or51211_setmode(struct dvb_frontend * fe, int mode)
+{
+	struct dvb_bt8xx_card *bt = fe->dvb->priv;
+	bttv_write_gpio(bt->bttv_nr, 0x0002, mode);   /* Reset */
+	msleep(20);
+}
+
+static void or51211_reset(struct dvb_frontend * fe)
+{
+	struct dvb_bt8xx_card *bt = fe->dvb->priv;
+
+	/* RESET DEVICE
+	 * reset is controled by GPIO-0
+	 * when set to 0 causes reset and when to 1 for normal op
+	 * must remain reset for 128 clock cycles on a 50Mhz clock
+	 * also PRM1 PRM2 & PRM4 are controled by GPIO-1,GPIO-2 & GPIO-4
+	 * We assume that the reset has be held low long enough or we
+	 * have been reset by a power on.  When the driver is unloaded
+	 * reset set to 0 so if reloaded we have been reset.
+	 */
+	/* reset & PRM1,2&4 are outputs */
+	int ret = bttv_gpio_enable(bt->bttv_nr, 0x001F, 0x001F);
+	if (ret != 0) {
+		printk(KERN_WARNING "or51211: Init Error - Can't Reset DVR "
+		       "(%i)\n", ret);
+	}
+	bttv_write_gpio(bt->bttv_nr, 0x001F, 0x0000);   /* Reset */
+	msleep(20);
+	/* Now set for normal operation */
+	bttv_write_gpio(bt->bttv_nr, 0x0001F, 0x0001);
+	/* wait for operation to begin */
+	msleep(500);
+}
+
+static void or51211_sleep(struct dvb_frontend * fe)
+{
+	struct dvb_bt8xx_card *bt = fe->dvb->priv;
+	bttv_write_gpio(bt->bttv_nr, 0x0001, 0x0000);
+}
+
+static struct or51211_config or51211_config = {
+
+	.demod_address = 0x15,
+	.request_firmware = or51211_request_firmware,
+	.setmode = or51211_setmode,
+	.reset = or51211_reset,
+	.sleep = or51211_sleep,
+};
+
+
 static int vp3021_alps_tded4_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
 	struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *) fe->dvb->priv;
@@ -458,6 +515,13 @@ static void frontend_init(struct dvb_bt8
 			break;
 		}
 		break;
+
+	case BTTV_PC_HDTV:
+		card->fe = or51211_attach(&or51211_config, card->i2c_adapter);
+		if (card->fe != NULL) {
+			break;
+		}
+		break;
 	}
 
 	if (card->fe == NULL) {
@@ -637,6 +701,12 @@ static int dvb_bt8xx_probe(struct device
 		 * RISC+FIFO ENABLE */
 		break;
 
+	case BTTV_PC_HDTV:
+		card->gpio_mode = 0x0100EC7B;
+		card->op_sync_orin = 0;
+		card->irq_err_ignore = 0;
+		break;
+
 	default:
 		printk(KERN_WARNING "dvb_bt8xx: Unknown bttv card type: %d.\n",
 				sub->core->type);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dvb-bt8xx.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/dvb-bt8xx.h	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dvb-bt8xx.h	2005-03-22 00:18:23.000000000 +0100
@@ -34,6 +34,7 @@
 #include "dst.h"
 #include "nxt6000.h"
 #include "cx24110.h"
+#include "or51211.h"
 
 struct dvb_bt8xx_card {
 	struct semaphore lock;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/Kconfig	2005-03-22 00:15:24.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig	2005-03-22 00:18:23.000000000 +0100
@@ -162,4 +162,11 @@ config DVB_OR51132
 	tristate "OR51132 based (pcHDTV)"
 	depends on DVB_CORE
 
+config DVB_OR51211
+	tristate "or51211 based (pcHDTV HD2000 card)"
+	depends on DVB_CORE
+	select FW_LOADER
+	help
+	  An ATSC 8VSB tuner module. Say Y when you want to support this frontend.
+
 endmenu
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Makefile
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/Makefile	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Makefile	2005-03-22 00:18:23.000000000 +0100
@@ -26,4 +26,5 @@ obj-$(CONFIG_DVB_TDA80XX) += tda80xx.o
 obj-$(CONFIG_DVB_TDA10021) += tda10021.o
 obj-$(CONFIG_DVB_STV0297) += stv0297.o
 obj-$(CONFIG_DVB_NXT2002) += nxt2002.o
+obj-$(CONFIG_DVB_OR51211) += or51211.o
 obj-$(CONFIG_DVB_OR51132) += or51132.o
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.c	2005-03-22 00:18:23.000000000 +0100
@@ -0,0 +1,631 @@
+/*
+ *    Support for OR51211 (pcHDTV HD-2000) - VSB
+ *
+ *    Copyright (C) 2005 Kirk Lapray <kirk_lapray@bigfoot.com>
+ *
+ *    Based on code from Jack Kelliher (kelliher@xmission.com)
+ *                           Copyright (C) 2002 & pcHDTV, inc.
+ *
+ *    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.
+ *
+*/
+
+/*
+ * This driver needs external firmware. Please use the command
+ * "<kerneldir>/Documentation/dvb/get_dvb_firmware or51211" to
+ * download/extract it, and then copy it to /usr/lib/hotplug/firmware.
+ */
+#define OR51211_DEFAULT_FIRMWARE "dvb-fe-or51211.fw"
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/device.h>
+#include <linux/firmware.h>
+#include <asm/byteorder.h>
+
+#include "dvb_frontend.h"
+#include "or51211.h"
+
+static int debug;
+#define dprintk(args...) \
+	do { \
+		if (debug) printk(KERN_DEBUG "or51211: " args); \
+	} while (0)
+
+static u8 run_buf[] = {0x7f,0x01};
+static u8 cmd_buf[] = {0x04,0x01,0x50,0x80,0x06}; // ATSC
+
+struct or51211_state {
+
+	struct i2c_adapter* i2c;
+	struct dvb_frontend_ops ops;
+
+	/* Configuration settings */
+	const struct or51211_config* config;
+
+	struct dvb_frontend frontend;
+	struct bt878* bt;
+
+	/* Demodulator private data */
+	u8 initialized:1;
+
+	/* Tuner private data */
+	u32 current_frequency;
+};
+
+static int i2c_writebytes (struct or51211_state* state, u8 reg, u8 *buf,
+			   int len)
+{
+	int err;
+	struct i2c_msg msg;
+	msg.addr	= reg;
+	msg.flags	= 0;
+	msg.len		= len;
+	msg.buf		= buf;
+
+	if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
+		printk(KERN_WARNING "or51211: i2c_writebytes error "
+		       "(addr %02x, err == %i)\n", reg, err);
+		return -EREMOTEIO;
+	}
+
+	return 0;
+}
+
+static u8 i2c_readbytes (struct or51211_state* state, u8 reg, u8* buf, int len)
+{
+	int err;
+	struct i2c_msg msg;
+	msg.addr	= reg;
+	msg.flags	= I2C_M_RD;
+	msg.len		= len;
+	msg.buf		= buf;
+
+	if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
+		printk(KERN_WARNING "or51211: i2c_readbytes error "
+		       "(addr %02x, err == %i)\n", reg, err);
+		return -EREMOTEIO;
+	}
+
+	return 0;
+}
+
+static int or51211_load_firmware (struct dvb_frontend* fe,
+				  const struct firmware *fw)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u8 tudata[585];
+	int i;
+
+	dprintk("Firmware is %d bytes\n",fw->size);
+
+	/* Get eprom data */
+	tudata[0] = 17;
+	if (i2c_writebytes(state,0x50,tudata,1)) {
+		printk(KERN_WARNING "or51211:load_firmware error eprom addr\n");
+		return -1;
+	}
+	if (i2c_readbytes(state,0x50,&tudata[145],192)) {
+		printk(KERN_WARNING "or51211: load_firmware error eprom\n");
+		return -1;
+	}
+
+	/* Create firmware buffer */
+	for (i = 0; i < 145; i++)
+		tudata[i] = fw->data[i];
+
+	for (i = 0; i < 248; i++)
+		tudata[i+337] = fw->data[145+i];
+
+	state->config->reset(fe);
+
+	if (i2c_writebytes(state,state->config->demod_address,tudata,585)) {
+		printk(KERN_WARNING "or51211: load_firmware error 1\n");
+		return -1;
+	}
+	msleep(1);
+
+	if (i2c_writebytes(state,state->config->demod_address,
+			   &fw->data[393],8125)) {
+		printk(KERN_WARNING "or51211: load_firmware error 2\n");
+		return -1;
+	}
+	msleep(1);
+
+	if (i2c_writebytes(state,state->config->demod_address,run_buf,2)) {
+		printk(KERN_WARNING "or51211: load_firmware error 3\n");
+		return -1;
+	}
+
+	/* Wait at least 5 msec */
+	msleep(10);
+	if (i2c_writebytes(state,state->config->demod_address,run_buf,2)) {
+		printk(KERN_WARNING "or51211: load_firmware error 4\n");
+		return -1;
+	}
+	msleep(10);
+
+	printk("or51211: Done.\n");
+	return 0;
+};
+
+static int or51211_setmode(struct dvb_frontend* fe, int mode)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u8 rec_buf[14];
+
+	state->config->setmode(fe, mode);
+
+	if (i2c_writebytes(state,state->config->demod_address,run_buf,2)) {
+		printk(KERN_WARNING "or51211: setmode error 1\n");
+		return -1;
+	}
+
+	/* Wait at least 5 msec */
+	msleep(10);
+	if (i2c_writebytes(state,state->config->demod_address,run_buf,2)) {
+		printk(KERN_WARNING "or51211: setmode error 2\n");
+		return -1;
+	}
+
+	msleep(10);
+
+	/* Set operation mode in Receiver 1 register;
+	 * type 1:
+	 * data 0x50h  Automatic sets receiver channel conditions
+	 *             Automatic NTSC rejection filter
+	 *             Enable  MPEG serial data output
+	 *             MPEG2tr
+	 *             High tuner phase noise
+	 *             normal +/-150kHz Carrier acquisition range
+	 */
+	if (i2c_writebytes(state,state->config->demod_address,cmd_buf,3)) {
+		printk(KERN_WARNING "or51211: setmode error 3\n");
+		return -1;
+	}
+
+	rec_buf[0] = 0x04;
+	rec_buf[1] = 0x00;
+	rec_buf[2] = 0x03;
+	rec_buf[3] = 0x00;
+	msleep(20);
+	if (i2c_writebytes(state,state->config->demod_address,rec_buf,3)) {
+		printk(KERN_WARNING "or51211: setmode error 5\n");
+	}
+	msleep(3);
+	if (i2c_readbytes(state,state->config->demod_address,&rec_buf[10],2)) {
+		printk(KERN_WARNING "or51211: setmode error 6");
+		return -1;
+	}
+	dprintk("setmode rec status %02x %02x\n",rec_buf[10],rec_buf[11]);
+
+	return 0;
+}
+
+static int or51211_set_parameters(struct dvb_frontend* fe,
+				  struct dvb_frontend_parameters *param)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u32 freq = 0;
+	u16 tunerfreq = 0;
+	u8 buf[4];
+
+	/* Change only if we are actually changing the channel */
+	if (state->current_frequency != param->frequency) {
+		freq = 44000 + (param->frequency/1000);
+		tunerfreq = freq * 16/1000;
+
+		dprintk("set_parameters frequency = %d (tunerfreq = %d)\n",
+			param->frequency,tunerfreq);
+
+		buf[0] = (tunerfreq >> 8) & 0x7F;
+		buf[1] = (tunerfreq & 0xFF);
+		buf[2] = 0x8E;
+
+		if (param->frequency < 157250000) {
+			buf[3] = 0xA0;
+			dprintk("set_parameters VHF low range\n");
+		} else if (param->frequency < 454000000) {
+			buf[3] = 0x90;
+			dprintk("set_parameters VHF high range\n");
+		} else {
+			buf[3] = 0x30;
+			dprintk("set_parameters UHF range\n");
+		}
+		dprintk("set_parameters tuner bytes: 0x%02x 0x%02x "
+			"0x%02x 0x%02x\n",buf[0],buf[1],buf[2],buf[3]);
+
+		if (i2c_writebytes(state,0xC2>>1,buf,4))
+			printk(KERN_WARNING "or51211:set_parameters error "
+			       "writing to tuner\n");
+
+		/* Set to ATSC mode */
+		or51211_setmode(fe,0);
+
+		/* Update current frequency */
+		state->current_frequency = param->frequency;
+	}
+	return 0;
+}
+
+static int or51211_read_status(struct dvb_frontend* fe, fe_status_t* status)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	unsigned char rec_buf[2];
+	unsigned char snd_buf[] = {0x04,0x00,0x03,0x00};
+	*status = 0;
+
+	/* Receiver Status */
+	if (i2c_writebytes(state,state->config->demod_address,snd_buf,3)) {
+		printk(KERN_WARNING "or51132: read_status write error\n");
+		return -1;
+	}
+	msleep(3);
+	if (i2c_readbytes(state,state->config->demod_address,rec_buf,2)) {
+		printk(KERN_WARNING "or51132: read_status read error\n");
+		return -1;
+	}
+	dprintk("read_status %x %x\n",rec_buf[0],rec_buf[1]);
+
+	if (rec_buf[0] &  0x01) { /* Receiver Lock */
+		*status |= FE_HAS_SIGNAL;
+		*status |= FE_HAS_CARRIER;
+		*status |= FE_HAS_VITERBI;
+		*status |= FE_HAS_SYNC;
+		*status |= FE_HAS_LOCK;
+	}
+	return 0;
+}
+
+/* log10-1 table at .5 increments from 1 to 100.5 */
+static unsigned int i100x20log10[] = {
+		0,  352,  602,  795,  954, 1088, 1204, 1306, 1397, 1480,
+	 1556, 1625, 1690, 1750, 1806, 1858, 1908, 1955, 2000, 2042,
+	 2082, 2121, 2158, 2193, 2227, 2260, 2292, 2322, 2352, 2380,
+	 2408, 2434, 2460, 2486, 2510, 2534, 2557, 2580, 2602, 2623,
+	 2644, 2664, 2684, 2704, 2723, 2742, 2760, 2778, 2795, 2813,
+	 2829, 2846, 2862, 2878, 2894, 2909, 2924, 2939, 2954, 2968,
+	 2982, 2996, 3010, 3023, 3037, 3050, 3062, 3075, 3088, 3100,
+	 3112, 3124, 3136, 3148, 3159, 3170, 3182, 3193, 3204, 3214,
+	 3225, 3236, 3246, 3256, 3266, 3276, 3286, 3296, 3306, 3316,
+	 3325, 3334, 3344, 3353, 3362, 3371, 3380, 3389, 3397, 3406,
+	 3415, 3423, 3432, 3440, 3448, 3456, 3464, 3472, 3480, 3488,
+	 3496, 3504, 3511, 3519, 3526, 3534, 3541, 3549, 3556, 3563,
+	 3570, 3577, 3584, 3591, 3598, 3605, 3612, 3619, 3625, 3632,
+	 3639, 3645, 3652, 3658, 3665, 3671, 3677, 3683, 3690, 3696,
+	 3702, 3708, 3714, 3720, 3726, 3732, 3738, 3744, 3750, 3755,
+	 3761, 3767, 3772, 3778, 3784, 3789, 3795, 3800, 3806, 3811,
+	 3816, 3822, 3827, 3832, 3838, 3843, 3848, 3853, 3858, 3863,
+	 3868, 3874, 3879, 3884, 3888, 3893, 3898, 3903, 3908, 3913,
+	 3918, 3922, 3927, 3932, 3936, 3941, 3946, 3950, 3955, 3960,
+	 3964, 3969, 3973, 3978, 3982, 3986, 3991, 3995, 4000, 4004,
+};
+
+static unsigned int denom[] = {1,1,100,1000,10000,100000,1000000,10000000,100000000};
+
+static unsigned int i20Log10(unsigned short val)
+{
+	unsigned int rntval = 100;
+	unsigned int tmp = val;
+	unsigned int exp = 1;
+
+	while(tmp > 100) {tmp /= 100; exp++;}
+
+	val = (2 * val)/denom[exp];
+	if (exp > 1) rntval = 2000*exp;
+
+	rntval += i100x20log10[val];
+	return rntval;
+}
+
+static int or51211_read_signal_strength(struct dvb_frontend* fe, u16* strength)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u8 rec_buf[2];
+	u8 snd_buf[4];
+	u8 snr_equ;
+
+	/* SNR after Equalizer */
+	snd_buf[0] = 0x04;
+	snd_buf[1] = 0x00;
+	snd_buf[2] = 0x04;
+	snd_buf[3] = 0x00;
+
+	if (i2c_writebytes(state,state->config->demod_address,snd_buf,3)) {
+		printk(KERN_WARNING "or51211: read_status write error\n");
+		return -1;
+	}
+	msleep(3);
+	if (i2c_readbytes(state,state->config->demod_address,rec_buf,2)) {
+		printk(KERN_WARNING "or51211: read_status read error\n");
+		return -1;
+	}
+	snr_equ = rec_buf[0] & 0xff;
+
+	/* The value reported back from the frontend will be FFFF=100% 0000=0% */
+	*strength = (((5334 - i20Log10(snr_equ))/3+5)*65535)/1000;
+
+	dprintk("read_signal_strength %i\n",*strength);
+
+	return 0;
+}
+
+static int or51211_read_snr(struct dvb_frontend* fe, u16* snr)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	u8 rec_buf[2];
+	u8 snd_buf[4];
+
+	/* SNR after Equalizer */
+	snd_buf[0] = 0x04;
+	snd_buf[1] = 0x00;
+	snd_buf[2] = 0x04;
+	snd_buf[3] = 0x00;
+
+	if (i2c_writebytes(state,state->config->demod_address,snd_buf,3)) {
+		printk(KERN_WARNING "or51211: read_status write error\n");
+		return -1;
+	}
+	msleep(3);
+	if (i2c_readbytes(state,state->config->demod_address,rec_buf,2)) {
+		printk(KERN_WARNING "or51211: read_status read error\n");
+		return -1;
+	}
+	*snr = rec_buf[0] & 0xff;
+
+	dprintk("read_snr %i\n",*snr);
+
+	return 0;
+}
+
+static int or51211_read_ber(struct dvb_frontend* fe, u32* ber)
+{
+	*ber = -ENOSYS;
+	return 0;
+}
+
+static int or51211_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
+{
+	*ucblocks = -ENOSYS;
+	return 0;
+}
+
+static int or51211_sleep(struct dvb_frontend* fe)
+{
+	return 0;
+}
+
+static int or51211_init(struct dvb_frontend* fe)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	const struct or51211_config* config = state->config;
+	const struct firmware* fw;
+	unsigned char get_ver_buf[] = {0x04,0x00,0x30,0x00,0x00};
+	unsigned char rec_buf[14];
+	int ret,i;
+
+	if (!state->initialized) {
+		/* Request the firmware, this will block until it uploads */
+		printk(KERN_INFO "or51211: Waiting for firmware upload "
+		       "(%s)...\n", OR51211_DEFAULT_FIRMWARE);
+		ret = config->request_firmware(fe, &fw,
+					       OR51211_DEFAULT_FIRMWARE);
+		printk(KERN_INFO "or51211:Got Hotplug firmware\n");
+		if (ret) {
+			printk(KERN_WARNING "or51211: No firmware uploaded "
+			       "(timeout or file not found?)\n");
+			return ret;
+		}
+
+		ret = or51211_load_firmware(fe, fw);
+		if (ret) {
+			printk(KERN_WARNING "or51211: Writing firmware to "
+			       "device failed!\n");
+			release_firmware(fw);
+			return ret;
+		}
+		printk(KERN_INFO "or51211: Firmware upload complete.\n");
+
+		/* Set operation mode in Receiver 1 register;
+		 * type 1:
+		 * data 0x50h  Automatic sets receiver channel conditions
+		 *             Automatic NTSC rejection filter
+		 *             Enable  MPEG serial data output
+		 *             MPEG2tr
+		 *             High tuner phase noise
+		 *             normal +/-150kHz Carrier acquisition range
+		 */
+		if (i2c_writebytes(state,state->config->demod_address,
+				   cmd_buf,3)) {
+			printk(KERN_WARNING "or51211: Load DVR Error 5\n");
+			return -1;
+		}
+
+		/* Read back ucode version to besure we loaded correctly */
+		/* and are really up and running */
+		rec_buf[0] = 0x04;
+		rec_buf[1] = 0x00;
+		rec_buf[2] = 0x03;
+		rec_buf[3] = 0x00;
+		msleep(30);
+		if (i2c_writebytes(state,state->config->demod_address,
+				   rec_buf,3)) {
+			printk(KERN_WARNING "or51211: Load DVR Error A\n");
+			return -1;
+		}
+		msleep(3);
+		if (i2c_readbytes(state,state->config->demod_address,
+				  &rec_buf[10],2)) {
+			printk(KERN_WARNING "or51211: Load DVR Error B\n");
+			return -1;
+		}
+
+		rec_buf[0] = 0x04;
+		rec_buf[1] = 0x00;
+		rec_buf[2] = 0x01;
+		rec_buf[3] = 0x00;
+		msleep(20);
+		if (i2c_writebytes(state,state->config->demod_address,
+				   rec_buf,3)) {
+			printk(KERN_WARNING "or51211: Load DVR Error C\n");
+			return -1;
+		}
+		msleep(3);
+		if (i2c_readbytes(state,state->config->demod_address,
+				  &rec_buf[12],2)) {
+			printk(KERN_WARNING "or51211: Load DVR Error D\n");
+			return -1;
+		}
+
+		for (i = 0; i < 8; i++)
+			rec_buf[i]=0xed;
+
+		for (i = 0; i < 5; i++) {
+			msleep(30);
+			get_ver_buf[4] = i+1;
+			if (i2c_writebytes(state,state->config->demod_address,
+					   get_ver_buf,5)) {
+				printk(KERN_WARNING "or51211:Load DVR Error 6"
+				       " - %d\n",i);
+				return -1;
+			}
+			msleep(3);
+
+			if (i2c_readbytes(state,state->config->demod_address,
+					  &rec_buf[i*2],2)) {
+				printk(KERN_WARNING "or51211:Load DVR Error 7"
+				       " - %d\n",i);
+				return -1;
+			}
+			/* If we didn't receive the right index, try again */
+			if ((int)rec_buf[i*2+1]!=i+1){
+			  i--;
+			}
+		}
+		dprintk("read_fwbits %x %x %x %x %x %x %x %x %x %x\n",
+			rec_buf[0], rec_buf[1], rec_buf[2], rec_buf[3],
+			rec_buf[4], rec_buf[5], rec_buf[6], rec_buf[7],
+			rec_buf[8], rec_buf[9]);
+
+		printk(KERN_INFO "or51211: ver TU%02x%02x%02x VSB mode %02x"
+		       " Status %02x\n",
+		       rec_buf[2], rec_buf[4],rec_buf[6],
+		       rec_buf[12],rec_buf[10]);
+
+		rec_buf[0] = 0x04;
+		rec_buf[1] = 0x00;
+		rec_buf[2] = 0x03;
+		rec_buf[3] = 0x00;
+		msleep(20);
+		if (i2c_writebytes(state,state->config->demod_address,
+				   rec_buf,3)) {
+			printk(KERN_WARNING "or51211: Load DVR Error 8\n");
+			return -1;
+		}
+		msleep(20);
+		if (i2c_readbytes(state,state->config->demod_address,
+				  &rec_buf[8],2)) {
+			printk(KERN_WARNING "or51211: Load DVR Error 9\n");
+			return -1;
+		}
+		state->initialized = 1;
+	}
+
+	return 0;
+}
+
+static int or51211_get_tune_settings(struct dvb_frontend* fe,
+				     struct dvb_frontend_tune_settings* fesettings)
+{
+	fesettings->min_delay_ms = 500;
+	fesettings->step_size = 0;
+	fesettings->max_drift = 0;
+	return 0;
+}
+
+static void or51211_release(struct dvb_frontend* fe)
+{
+	struct or51211_state* state = fe->demodulator_priv;
+	state->config->sleep(fe);
+	kfree(state);
+}
+
+static struct dvb_frontend_ops or51211_ops;
+
+struct dvb_frontend* or51211_attach(const struct or51211_config* config,
+				    struct i2c_adapter* i2c)
+{
+	struct or51211_state* state = NULL;
+
+	/* Allocate memory for the internal state */
+	state = kmalloc(sizeof(struct or51211_state), GFP_KERNEL);
+	if (state == NULL)
+		goto error;
+
+	/* Setup the state */
+	state->config = config;
+	state->i2c = i2c;
+	memcpy(&state->ops, &or51211_ops, sizeof(struct dvb_frontend_ops));
+	state->initialized = 0;
+	state->current_frequency = 0;
+
+	/* Create dvb_frontend */
+	state->frontend.ops = &state->ops;
+	state->frontend.demodulator_priv = state;
+	return &state->frontend;
+
+error:
+	if (state) kfree(state);
+	return NULL;
+}
+
+static struct dvb_frontend_ops or51211_ops = {
+
+	.info = {
+		.name               = "Oren OR51211 VSB Frontend",
+		.type               = FE_ATSC,
+		.frequency_min      = 44000000,
+		.frequency_max      = 958000000,
+		.frequency_stepsize = 166666,
+		.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
+			FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
+			FE_CAN_8VSB
+	},
+
+	.release = or51211_release,
+
+	.init = or51211_init,
+	.sleep = or51211_sleep,
+
+	.set_frontend = or51211_set_parameters,
+	.get_tune_settings = or51211_get_tune_settings,
+
+	.read_status = or51211_read_status,
+	.read_ber = or51211_read_ber,
+	.read_signal_strength = or51211_read_signal_strength,
+	.read_snr = or51211_read_snr,
+	.read_ucblocks = or51211_read_ucblocks,
+};
+
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
+
+MODULE_DESCRIPTION("Oren OR51211 VSB [pcHDTV HD-2000] Demodulator Driver");
+MODULE_AUTHOR("Kirk Lapray");
+MODULE_LICENSE("GPL");
+
+EXPORT_SYMBOL(or51211_attach);
+
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.h	2005-03-22 00:18:23.000000000 +0100
@@ -0,0 +1,44 @@
+/*
+ *    Support for OR51211 (pcHDTV HD-2000) - VSB
+ *
+ *    Copyright (C) 2005 Kirk Lapray <kirk_lapray@bigfoot.com>
+ *
+ *    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.
+ *
+*/
+
+#ifndef OR51211_H
+#define OR51211_H
+
+#include <linux/dvb/frontend.h>
+#include <linux/firmware.h>
+
+struct or51211_config
+{
+	/* The demodulator's i2c address */
+	u8 demod_address;
+
+	/* Request firmware for device */
+	int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name);
+	void (*setmode)(struct dvb_frontend * fe, int mode);
+	void (*reset)(struct dvb_frontend * fe);
+	void (*sleep)(struct dvb_frontend * fe);
+};
+
+extern struct dvb_frontend* or51211_attach(const struct or51211_config* config,
+					   struct i2c_adapter* i2c);
+
+#endif // OR51211_H
+
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51132.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/or51132.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51132.c	2005-03-22 00:18:23.000000000 +0100
@@ -422,7 +422,7 @@ static int or51132_read_status(struct dv
 }
 
 /* log10-1 table at .5 increments from 1 to 100.5 */
-unsigned int i100x20log10[] = {
+static unsigned int i100x20log10[] = {
      0,  352,  602,  795,  954, 1088, 1204, 1306, 1397, 1480,
   1556, 1625, 1690, 1750, 1806, 1858, 1908, 1955, 2000, 2042,
   2082, 2121, 2158, 2193, 2227, 2260, 2292, 2322, 2352, 2380,
@@ -445,9 +445,9 @@ unsigned int i100x20log10[] = {
   3964, 3969, 3973, 3978, 3982, 3986, 3991, 3995, 4000, 4004,
 };
 
-unsigned int denom[] = {1,1,100,1000,10000,100000,1000000,10000000,100000000};
+static unsigned int denom[] = {1,1,100,1000,10000,100000,1000000,10000000,100000000};
 
-unsigned int i20Log10(unsigned short val)
+static unsigned int i20Log10(unsigned short val)
 {
 	unsigned int rntval = 100;
 	unsigned int tmp = val;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 29/48] dibusb: support nova-t usb ir
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (27 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 28/48] support pcHDTV HD2000 Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 30/48] OREN or51211, or51132_qam and or51132_vsb firmware download info Johannes Stezenbach
                   ` (18 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-nova-t-ir.patch --]
[-- Type: text/plain, Size: 12900 bytes --]

o added native nova-t support, since only the nova-t firmware works with the
  nova-t remote control
o added keys statically (maybe we should find something to sort this out...
  cinergyt2 is doing the same)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-core.c     |   19 ++++-
 dvb-dibusb-firmware.c |    4 -
 dvb-dibusb-remote.c   |  177 +++++++++++++++++++++++++++++++++++++++++---------
 dvb-dibusb-usb.c      |   12 ++-
 dvb-dibusb.h          |   13 +++
 5 files changed, 187 insertions(+), 38 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:17:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:18:30.000000000 +0100
@@ -42,10 +42,14 @@ static int pid_parse;
 module_param(pid_parse, int, 0644);
 MODULE_PARM_DESC(pid_parse, "enable pid parsing (filtering) when running at USB2.0");
 
-static int rc_query_interval;
+static int rc_query_interval = 100;
 module_param(rc_query_interval, int, 0644);
 MODULE_PARM_DESC(rc_query_interval, "interval in msecs for remote control query (default: 100; min: 40)");
 
+static int rc_key_repeat_count = 2;
+module_param(rc_key_repeat_count, int, 0644);
+MODULE_PARM_DESC(rc_key_repeat_count, "how many key repeats will be dropped before passing the key event again (default: 2)");
+
 /* Vendor IDs */
 #define USB_VID_ADSTECH						0x06e1
 #define USB_VID_ANCHOR						0x0547
@@ -225,7 +229,7 @@ static struct dibusb_device_class dibusb
 	{ DIBUSB2_0,&dibusb_usb_ctrl[2],
 	  "dvb-dibusb-6.0.0.5.fw",
 	  0x01, 0x06, 
-	  3, 188*210,
+	  7, 4096,
 	  DIBUSB_RC_NEC_PROTOCOL,
 	  &dibusb_demod[DIBUSB_DIB3000MC],
 	  &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5],
@@ -246,6 +250,14 @@ static struct dibusb_device_class dibusb
 	  &dibusb_demod[DIBUSB_DIB3000MB],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_THOMSON],
 	},
+	{ NOVAT_USB2,&dibusb_usb_ctrl[2],
+	  "dvb-dibusb-nova-t-1.fw",
+	  0x01, 0x06,
+	  7, 4096,
+	  DIBUSB_RC_HAUPPAUGE_PROTO,
+	  &dibusb_demod[DIBUSB_DIB3000MC],
+	  &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5],
+	},
 };
 
 static struct dibusb_usb_device dibusb_devices[] = {
@@ -305,7 +317,7 @@ static struct dibusb_usb_device dibusb_d
 		{ NULL },
 	},
 	{	"Hauppauge WinTV NOVA-T USB2",
-		&dibusb_device_classes[DIBUSB2_0],
+		&dibusb_device_classes[NOVAT_USB2],
 		{ &dib_table[30], NULL },
 		{ &dib_table[31], NULL },
 	},
@@ -475,6 +487,7 @@ static int dibusb_probe(struct usb_inter
 		/* store parameters to structures */
 		dib->rc_query_interval = rc_query_interval;
 		dib->pid_parse = pid_parse;
+		dib->rc_key_repeat_count = rc_key_repeat_count;
 
 		usb_set_intfdata(intf, dib);
 		
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c	2005-03-22 00:18:30.000000000 +0100
@@ -30,11 +30,13 @@ int dibusb_loadfirmware(struct usb_devic
 	int ret = 0,i;
 	
 	if ((ret = request_firmware(&fw, dibdev->dev_cl->firmware, &udev->dev)) != 0) {
-		err("did not find a valid firmware file. (%s) "
+		err("did not find the firmware file. (%s) "
 			"Please see linux/Documentation/dvb/ for more details on firmware-problems.",
 			dibdev->dev_cl->firmware);
 		return ret;
 	}
+
+	info("downloading firmware from file '%s'.",dibdev->dev_cl->firmware);
 	
 	p = kmalloc(fw->size,GFP_KERNEL);	
 	if (p != NULL) {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-remote.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-remote.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-remote.c	2005-03-22 00:18:30.000000000 +0100
@@ -13,7 +13,7 @@
 
 /* Table to map raw key codes to key events.  This should not be hard-wired
    into the kernel.  */
-static const struct { u8 c0, c1, c2; uint32_t key; } rc_keys [] =
+static const struct { u8 c0, c1, c2; uint32_t key; } nec_rc_keys [] =
 {
 	/* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */
 	{ 0x00, 0xff, 0x16, KEY_POWER },
@@ -83,18 +83,58 @@ static const struct { u8 c0, c1, c2; uin
 	{ 0x86, 0x6b, 0x1b, KEY_RIGHT },
 };
 
-/*
- * Read the remote control and feed the appropriate event.
- * NEC protocol is used for remote controls
- */
-static int dibusb_read_remote_control(struct usb_dibusb *dib)
+/* Hauppauge NOVA-T USB2 keys */
+static const struct { u16 raw; uint32_t key; } haupp_rc_keys [] = {
+	{ 0xddf, KEY_GOTO },
+	{ 0xdef, KEY_POWER },
+	{ 0xce7, KEY_TV },
+	{ 0xcc7, KEY_VIDEO },
+	{ 0xccf, KEY_AUDIO },
+	{ 0xcd7, KEY_MEDIA },
+	{ 0xcdf, KEY_EPG },
+	{ 0xca7, KEY_UP },
+	{ 0xc67, KEY_RADIO },
+	{ 0xcb7, KEY_LEFT },
+	{ 0xd2f, KEY_OK },
+	{ 0xcbf, KEY_RIGHT },
+	{ 0xcff, KEY_BACK },
+	{ 0xcaf, KEY_DOWN },
+	{ 0xc6f, KEY_MENU },
+	{ 0xc87, KEY_VOLUMEUP },
+	{ 0xc8f, KEY_VOLUMEDOWN },
+	{ 0xc97, KEY_CHANNEL },
+	{ 0xc7f, KEY_MUTE },
+	{ 0xd07, KEY_CHANNELUP },
+	{ 0xd0f, KEY_CHANNELDOWN },
+	{ 0xdbf, KEY_RECORD },
+	{ 0xdb7, KEY_STOP },
+	{ 0xd97, KEY_REWIND },
+	{ 0xdaf, KEY_PLAY },
+	{ 0xda7, KEY_FASTFORWARD },
+	{ 0xd27, KEY_LAST }, /* Skip backwards */
+	{ 0xd87, KEY_PAUSE },
+	{ 0xcf7, KEY_NEXT },
+	{ 0xc07, KEY_0 },
+	{ 0xc0f, KEY_1 },
+	{ 0xc17, KEY_2 },
+	{ 0xc1f, KEY_3 },
+	{ 0xc27, KEY_4 },
+	{ 0xc2f, KEY_5 },
+	{ 0xc37, KEY_6 },
+	{ 0xc3f, KEY_7 },
+	{ 0xc47, KEY_8 },
+	{ 0xc4f, KEY_9 },
+	{ 0xc57, KEY_KPASTERISK },
+	{ 0xc77, KEY_GRAVE }, /* # */
+	{ 0xc5f, KEY_RED },
+	{ 0xd77, KEY_GREEN },
+	{ 0xdc7, KEY_YELLOW },
+	{ 0xd4f, KEY_BLUE},
+};
+
+static int dibusb_key2event_nec(struct usb_dibusb *dib,u8 rb[5])
 {
-	u8 b[1] = { DIBUSB_REQ_POLL_REMOTE }, rb[5];
-	int ret;
 	int i;
-	if ((ret = dibusb_readwrite_usb(dib,b,1,rb,5)))
-		return ret;
-
 	switch (rb[0]) {
 		case DIBUSB_RC_NEC_KEY_PRESSED:
 			/* rb[1-3] is the actual key, rb[4] is a checksum */
@@ -107,30 +147,100 @@ static int dibusb_read_remote_control(st
 			}
 
 			/* See if we can match the raw key code. */
-			for (i = 0; i < sizeof(rc_keys)/sizeof(rc_keys[0]); i++) {
-				if (rc_keys[i].c0 == rb[1] &&
-					rc_keys[i].c1 == rb[2] &&
-				    rc_keys[i].c2 == rb[3]) {
-					dib->rc_input_event = rc_keys[i].key;
-					deb_rc("Translated key 0x%04x\n", dib->rc_input_event);
-					/* Signal down and up events for this key. */
-					input_report_key(&dib->rc_input_dev, dib->rc_input_event, 1);
-					input_report_key(&dib->rc_input_dev, dib->rc_input_event, 0);
-					input_sync(&dib->rc_input_dev);
-					break;
+			for (i = 0; i < sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++) {
+				if (nec_rc_keys[i].c0 == rb[1] &&
+					nec_rc_keys[i].c1 == rb[2] &&
+					nec_rc_keys[i].c2 == rb[3]) {
+
+					dib->last_event = nec_rc_keys[i].key;
+					return 1;
 				}
 			}
 			break;
-		case DIBUSB_RC_NEC_EMPTY: /* No (more) remote control keys. */
-			break;
 		case DIBUSB_RC_NEC_KEY_REPEATED:
 			/* rb[1]..rb[4] are always zero.*/
 			/* Repeats often seem to occur so for the moment just ignore this. */
-			deb_rc("Key repeat\n");
+			return 0;
+		case DIBUSB_RC_NEC_EMPTY: /* No (more) remote control keys. */
+		default:
+			break;
+	}
+	return -1;
+}
+
+static int dibusb_key2event_hauppauge(struct usb_dibusb *dib,u8 rb[4])
+{
+	u16 raw;
+	int i,state;
+	switch (rb[0]) {
+		case DIBUSB_RC_HAUPPAUGE_KEY_PRESSED:
+			raw = ((rb[1] & 0x0f) << 8) | rb[2];
+
+			state = !!(rb[1] & 0x40);
+
+			deb_rc("raw key code 0x%02x, 0x%02x, 0x%02x to %04x state: %d\n",rb[1],rb[2],rb[3],raw,state);
+			for (i = 0; i < sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++) {
+				if (haupp_rc_keys[i].raw == raw) {
+					if (dib->last_event == haupp_rc_keys[i].key &&
+						dib->last_state == state) {
+						deb_rc("key repeat\n");
+						return 0;
+					} else {
+						dib->last_event = haupp_rc_keys[i].key;
+						dib->last_state = state;
+						return 1;
+					}
+				}
+			}
+
 			break;
+		case DIBUSB_RC_HAUPPAUGE_KEY_EMPTY:
 		default:
 			break;
 	}
+	return -1;
+}
+
+/*
+ * Read the remote control and feed the appropriate event.
+ * NEC protocol is used for remote controls
+ */
+static int dibusb_read_remote_control(struct usb_dibusb *dib)
+{
+	u8 b[1] = { DIBUSB_REQ_POLL_REMOTE }, rb[5];
+	int ret,event = 0;
+
+	if ((ret = dibusb_readwrite_usb(dib,b,1,rb,5)))
+		return ret;
+
+	switch (dib->dibdev->dev_cl->remote_type) {
+		case DIBUSB_RC_NEC_PROTOCOL:
+			event = dibusb_key2event_nec(dib,rb);
+			break;
+		case DIBUSB_RC_HAUPPAUGE_PROTO:
+			event = dibusb_key2event_hauppauge(dib,rb);
+		default:
+			break;
+	}
+
+	/* key repeat */
+	if (event == 0)
+		if (++dib->repeat_key_count < dib->rc_key_repeat_count) {
+			deb_rc("key repeat dropped. (%d)\n",dib->repeat_key_count);
+			event = -1; /* skip this key repeat */
+		}
+
+	if (event == 1 || event == 0) {
+		deb_rc("Translated key 0x%04x\n",event);
+
+		/* Signal down and up events for this key. */
+		input_report_key(&dib->rc_input_dev, dib->last_event, 1);
+		input_report_key(&dib->rc_input_dev, dib->last_event, 0);
+		input_sync(&dib->rc_input_dev);
+
+		if (event == 1)
+			dib->repeat_key_count = 0;
+	}
 	return 0;
 }
 
@@ -161,12 +271,21 @@ int dibusb_remote_init(struct usb_dibusb
 	dib->rc_input_dev.keycodemax = KEY_MAX;
 	dib->rc_input_dev.name = DRIVER_DESC " remote control";
 
-	for (i=0; i<sizeof(rc_keys)/sizeof(rc_keys[0]); i++)
-		set_bit(rc_keys[i].key, dib->rc_input_dev.keybit);
+	switch (dib->dibdev->dev_cl->remote_type) {
+		case DIBUSB_RC_NEC_PROTOCOL:
+			for (i=0; i<sizeof(nec_rc_keys)/sizeof(nec_rc_keys[0]); i++)
+				set_bit(nec_rc_keys[i].key, dib->rc_input_dev.keybit);
+			break;
+		case DIBUSB_RC_HAUPPAUGE_PROTO:
+			for (i=0; i<sizeof(haupp_rc_keys)/sizeof(haupp_rc_keys[0]); i++)
+				set_bit(haupp_rc_keys[i].key, dib->rc_input_dev.keybit);
+			break;
+		default:
+			break;
+	}
 
-	input_register_device(&dib->rc_input_dev);
 
-	dib->rc_input_event = KEY_MAX;
+	input_register_device(&dib->rc_input_dev);
 
 	INIT_WORK(&dib->rc_query_work, dibusb_remote_query, dib);
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:18:30.000000000 +0100
@@ -117,9 +117,14 @@ int dibusb_hw_sleep(struct dvb_frontend 
 	u8 b[1] = { DIBUSB_IOCTL_POWER_SLEEP };
 	deb_info("dibusb-device is going to bed.\n");
 	/* workaround, something is wrong, when dibusb 1.1 device are going to bed too late */
-	if (dib->dibdev->dev_cl->id != DIBUSB1_1)
-		dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
-
+	switch (dib->dibdev->dev_cl->id) {
+		case DIBUSB1_1:
+		case NOVAT_USB2:
+			break;
+		default:
+			dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
+			break;
+	}
 	if (dib->fe_sleep)
 		return dib->fe_sleep(fe);
 
@@ -137,6 +142,7 @@ int dibusb_streaming(struct usb_dibusb *
 	switch (dib->dibdev->dev_cl->id) {
 		case DIBUSB2_0:
 		case DIBUSB2_0B:
+		case NOVAT_USB2:
 			if (onoff)
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_ENABLE_STREAM,NULL,0);
 			else
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:17:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:18:30.000000000 +0100
@@ -73,6 +73,7 @@ typedef enum {
 	DIBUSB2_0,
 	UMT2_0,
 	DIBUSB2_0B,
+	NOVAT_USB2,
 } dibusb_class_t;
 
 typedef enum {
@@ -90,7 +91,8 @@ typedef enum {
 
 typedef enum {
 	DIBUSB_RC_NO = 0,
-	DIBUSB_RC_NEC_PROTOCOL = 1,
+	DIBUSB_RC_NEC_PROTOCOL,
+	DIBUSB_RC_HAUPPAUGE_PROTO,
 } dibusb_remote_t;
 
 struct dibusb_tuner {
@@ -188,7 +190,10 @@ struct usb_dibusb {
 	/* remote control */
 	struct input_dev rc_input_dev;
 	struct work_struct rc_query_work;
-	int rc_input_event;
+	int last_event;
+	int last_state; /* for Hauppauge RC protocol */
+	int repeat_key_count;
+	int rc_key_repeat_count; /* module parameter */
 
 	/* module parameters */
 	int pid_parse;
@@ -270,6 +275,10 @@ int dibusb_urb_exit(struct usb_dibusb *)
 #define DIBUSB_RC_NEC_KEY_PRESSED		0x01
 #define DIBUSB_RC_NEC_KEY_REPEATED		0x02
 
+/* additional status values for Hauppauge Remote Control Protocol */
+#define DIBUSB_RC_HAUPPAUGE_KEY_PRESSED	0x01
+#define DIBUSB_RC_HAUPPAUGE_KEY_EMPTY	0x03
+
 /* streaming mode:
  * bulk write: 0x05 mode_byte
  *

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 30/48] OREN or51211, or51132_qam and or51132_vsb firmware download info
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (28 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 29/48] dibusb: support nova-t usb ir Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 31/48] ttusb_dec: IR support Johannes Stezenbach
                   ` (17 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: dvb-doc-oren-firmware.patch --]
[-- Type: text/plain, Size: 4360 bytes --]

o add OREN or51211, or51132_qam and or51132_vsb firmware
o correct some links

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 contributors.txt |    3 +++
 get_dvb_firmware |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 readme.txt       |    7 ++++---
 3 files changed, 52 insertions(+), 8 deletions(-)

Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/get_dvb_firmware	2005-03-22 00:18:18.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware	2005-03-22 00:18:42.000000000 +0100
@@ -22,14 +22,15 @@ use File::Temp qw/ tempdir /;
 use IO::Handle;
 
 @components = ( "sp8870", "sp887x", "tda10045", "tda10046", "av7110", "dec2000t",
-		"dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002" );
+		"dec2540t", "dec3000s", "vp7041", "dibusb", "nxt2002",
+		"or51211", "or51132_qam", "or51132_vsb");
 
 # Check args
 syntax() if (scalar(@ARGV) != 1);
 $cid = $ARGV[0];
 
 # Do it!
-for($i=0; $i < scalar(@components); $i++) {
+for ($i=0; $i < scalar(@components); $i++) {
     if ($cid eq $components[$i]) {
 	$outfile = eval($cid);
 	die $@ if $@;
@@ -122,9 +123,9 @@ sub tda10046 {
 }
 
 sub av7110 {
-    my $sourcefile = "dvb-ttpci-01.fw-261c";
-    my $url = "http://www.linuxtv.org/download/dvb/firmware/$sourcefile";
-    my $hash = "7b263de6b0b92d2347319c65adc7d4fb";
+    my $sourcefile = "dvb-ttpci-01.fw-261d";
+    my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile";
+    my $hash = "603431b6259715a8e88f376a53b64e2f";
     my $outfile = "dvb-ttpci-01.fw";
 
     checkstandard();
@@ -251,6 +252,45 @@ sub nxt2002 {
     $outfile;
 }
 
+sub or51211 {
+    my $fwfile = "dvb-fe-or51211.fw";
+    my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
+    my $hash = "d830949c771a289505bf9eafc225d491";
+
+    checkstandard();
+
+    wgetfile($fwfile, $url);
+    verify($fwfile, $hash);
+
+    $fwfile;
+}
+
+sub or51132_qam {
+    my $fwfile = "dvb-fe-or51132-qam.fw";
+    my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
+    my $hash = "7702e8938612de46ccadfe9b413cb3b5";
+
+    checkstandard();
+
+    wgetfile($fwfile, $url);
+    verify($fwfile, $hash);
+
+    $fwfile;
+}
+
+sub or51132_vsb {
+    my $fwfile = "dvb-fe-or51132-vsb.fw";
+    my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
+    my $hash = "c16208e02f36fc439a557ad4c613364a";
+
+    checkstandard();
+
+    wgetfile($fwfile, $url);
+    verify($fwfile, $hash);
+
+    $fwfile;
+}
+
 # ---------------------------------------------------------------
 # Utilities
 
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/contributors.txt
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/contributors.txt	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/contributors.txt	2005-03-22 00:18:42.000000000 +0100
@@ -72,5 +72,8 @@ Kenneth Aafløy <ke-aa@frisurf.no>
 Ernst Peinlich <e.peinlich@inode.at>
   for tuning/DiSEqC support for the DEC 3000-s
 
+Peter Beutner <p.beutner@gmx.net>
+  for the IR code for the ttusb-dec driver
+
 (If you think you should be in this list, but you are not, drop a
  line to the DVB mailing list)
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/readme.txt
===================================================================
--- linux-2.6.12-rc1-mm1.orig/Documentation/dvb/readme.txt	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/Documentation/dvb/readme.txt	2005-03-22 00:18:42.000000000 +0100
@@ -5,8 +5,9 @@ The main development site and CVS reposi
 drivers is http://linuxtv.org/.
 
 The developer mailing list linux-dvb is also hosted there,
-see http://linuxtv.org/mailinglists.xml. Please check
-the archive http://linuxtv.org/mailinglists/linux-dvb/
+see http://linuxtv.org/lists.php. Please check
+the archive http://linuxtv.org/pipermail/linux-dvb/
+and the Wiki http://linuxtv.org/wiki/
 before asking newbie questions on the list.
 
 API documentation, utilities and test/example programs
@@ -15,7 +16,7 @@ are available as part of the old driver 
 We plan to split this into separate packages, but it's not
 been done yet.
 
-http://linuxtv.org/download/dvb/
+http://linuxtv.org/downloads/
 
 What's inside this directory:
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 31/48] ttusb_dec: IR support
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (29 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 30/48] OREN or51211, or51132_qam and or51132_vsb firmware download info Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 32/48] dibusb: pll fix Johannes Stezenbach
                   ` (16 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttusb-dec-ir.patch --]
[-- Type: text/plain, Size: 7568 bytes --]

Add IR support added by Peter Beutner

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 ttusb_dec.c |  153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 150 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-22 00:15:50.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-22 00:18:46.000000000 +0100
@@ -2,6 +2,7 @@
  * TTUSB DEC Driver
  *
  * Copyright (C) 2003-2004 Alex Woods <linux-dvb@giblets.org>
+ * IR support by Peter Beutner <p.beutner@gmx.net>
  *
  * 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
@@ -32,6 +33,7 @@
 #include <linux/firmware.h>
 #include <linux/crc32.h>
 #include <linux/init.h>
+#include <linux/input.h>
 
 #include "dmxdev.h"
 #include "dvb_demux.h"
@@ -42,11 +44,14 @@
 
 static int debug;
 static int output_pva;
+static int enable_rc;
 
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
 module_param(output_pva, int, 0444);
 MODULE_PARM_DESC(output_pva, "Output PVA from dvr device (default:off)");
+module_param(enable_rc, int, 0644);
+MODULE_PARM_DESC(enable_rc, "Turn on/off IR remote control(default: off)");
 
 #define dprintk	if (debug) printk
 
@@ -56,9 +61,11 @@ MODULE_PARM_DESC(output_pva, "Output PVA
 #define RESULT_PIPE		0x84
 #define IN_PIPE			0x88
 #define OUT_PIPE		0x07
+#define IRQ_PIPE		0x8A
 
 #define COMMAND_PACKET_SIZE	0x3c
 #define ARM_PACKET_SIZE		0x1000
+#define IRQ_PACKET_SIZE		0x8
 
 #define ISO_BUF_COUNT		0x04
 #define FRAMES_PER_ISO_BUF	0x04
@@ -107,9 +114,13 @@ struct ttusb_dec {
 	unsigned int			result_pipe;
 	unsigned int			in_pipe;
 	unsigned int			out_pipe;
+	unsigned int			irq_pipe;
 	enum ttusb_dec_interface	interface;
 	struct semaphore		usb_sem;
 
+	void			*irq_buffer;
+	struct urb		*irq_urb;
+	dma_addr_t		irq_dma_handle;
 	void			*iso_buffer;
 	dma_addr_t		iso_dma_handle;
 	struct urb		*iso_urb[ISO_BUF_COUNT];
@@ -142,6 +153,8 @@ struct ttusb_dec {
 	struct list_head	filter_info_list;
 	spinlock_t		filter_info_list_lock;
 
+	struct input_dev	rc_input_dev;
+
 	int			active; /* Loaded successfully */
 };
 
@@ -157,9 +170,83 @@ struct filter_info {
 	struct list_head	filter_info_list;
 };
 
+const uint16_t  rc_keys[] = {
+	KEY_POWER,
+	KEY_MUTE,
+	KEY_1,
+	KEY_2,
+	KEY_3,
+	KEY_4,
+	KEY_5,
+	KEY_6,
+	KEY_7,
+	KEY_8,
+	KEY_9,
+	KEY_0,
+	KEY_CHANNELUP,
+	KEY_VOLUMEDOWN,
+	KEY_OK,
+	KEY_VOLUMEUP,
+	KEY_CHANNELDOWN,
+	KEY_PREVIOUS,
+	KEY_ESC,
+	KEY_RED,
+	KEY_GREEN,
+	KEY_YELLOW,
+	KEY_BLUE,
+	KEY_OPTION,
+	KEY_M,
+	KEY_RADIO
+};
+
 static void ttusb_dec_set_model(struct ttusb_dec *dec,
 				enum ttusb_dec_model model);
 
+static void ttusb_dec_handle_irq( struct urb *urb, struct pt_regs *regs)
+{
+	struct ttusb_dec * dec = urb->context;
+	char *buffer = dec->irq_buffer;
+	int retval;
+
+	switch(urb->status) {
+		case 0: /*success*/
+			break;
+		case -ECONNRESET:
+		case -ENOENT:
+		case -ESHUTDOWN:
+		case -ETIMEDOUT:
+			/* this urb is dead, cleanup */
+			dprintk("%s:urb shutting down with status: %d\n",
+					__FUNCTION__, urb->status);
+			return;
+		default:
+			dprintk("%s:nonzero status received: %d\n",
+					__FUNCTION__,urb->status);
+			goto exit;
+	}
+
+	if( (buffer[0] == 0x1) && (buffer[2] == 0x15) )  {
+		/* IR - Event */
+		/* this is an fact a bit too simple implementation;
+		 * the box also reports a keyrepeat signal
+		 * (with buffer[3] == 0x40) in an intervall of ~100ms.
+		 * But to handle this correctly we had to imlemenent some
+		 * kind of timer which signals a 'key up' event if no
+		 * keyrepeat signal is recieved for lets say 200ms.
+		 * this should/could be added later ...
+		 * for now lets report each signal as a key down and up*/
+		dprintk("%s:rc signal:%d\n", __FUNCTION__, buffer[4]);
+		input_report_key(&dec->rc_input_dev,rc_keys[buffer[4]-1],1);
+		input_report_key(&dec->rc_input_dev,rc_keys[buffer[4]-1],0);
+		input_sync(&dec->rc_input_dev);
+	}
+
+exit:	retval = usb_submit_urb(urb, GFP_ATOMIC);
+	if(retval)
+		printk("%s - usb_commit_urb failed with result: %d\n",
+			__FUNCTION__, retval);
+}
+
 static u16 crc16(u16 crc, const u8 *buf, size_t len)
 {
 	u16 tmp;
@@ -1095,6 +1182,30 @@ static void ttusb_dec_init_tasklet(struc
 		     (unsigned long)dec);
 }
 
+static void ttusb_init_rc( struct ttusb_dec *dec)
+{
+	u8 b[] = { 0x00, 0x01 };
+	int i;
+
+	init_input_dev(&dec->rc_input_dev);
+
+	dec->rc_input_dev.name = "ttusb_dec remote control";
+	dec->rc_input_dev.evbit[0] = BIT(EV_KEY);
+	dec->rc_input_dev.keycodesize = sizeof(unsigned char);
+	dec->rc_input_dev.keycodemax = KEY_MAX;
+
+	 for (i = 0; i < sizeof(rc_keys)/sizeof(rc_keys[0]); i++)
+                set_bit(rc_keys[i], dec->rc_input_dev.keybit);
+
+	input_register_device(&dec->rc_input_dev);
+
+	if(usb_submit_urb(dec->irq_urb,GFP_KERNEL)) {
+		printk("%s: usb_submit_urb failed\n",__FUNCTION__);
+	}
+	/* enable irq pipe */
+	ttusb_dec_send_command(dec,0xb0,sizeof(b),b,NULL,NULL);
+}
+
 static void ttusb_dec_init_v_pes(struct ttusb_dec *dec)
 {
 	dprintk("%s\n", __FUNCTION__);
@@ -1105,7 +1216,7 @@ static void ttusb_dec_init_v_pes(struct 
 	dec->v_pes[3] = 0xe0;
 }
 
-static void ttusb_dec_init_usb(struct ttusb_dec *dec)
+static int ttusb_dec_init_usb(struct ttusb_dec *dec)
 {
 	dprintk("%s\n", __FUNCTION__);
 
@@ -1116,8 +1227,26 @@ static void ttusb_dec_init_usb(struct tt
 	dec->result_pipe = usb_rcvbulkpipe(dec->udev, RESULT_PIPE);
 	dec->in_pipe = usb_rcvisocpipe(dec->udev, IN_PIPE);
 	dec->out_pipe = usb_sndisocpipe(dec->udev, OUT_PIPE);
+	dec->irq_pipe = usb_rcvintpipe(dec->udev, IRQ_PIPE);
+
+	if(enable_rc) {
+		dec->irq_urb = usb_alloc_urb(0, GFP_KERNEL);
+		if(!dec->irq_urb) {
+			return -ENOMEM;
+		}
+		dec->irq_buffer = usb_buffer_alloc(dec->udev,IRQ_PACKET_SIZE,
+					SLAB_ATOMIC, &dec->irq_dma_handle);
+		if(!dec->irq_buffer) {
+			return -ENOMEM;
+		}
+		usb_fill_int_urb(dec->irq_urb, dec->udev,dec->irq_pipe,
+				 dec->irq_buffer, IRQ_PACKET_SIZE,
+				 ttusb_dec_handle_irq, dec, 1);
+		dec->irq_urb->transfer_dma = dec->irq_dma_handle;
+		dec->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+	}
 
-	ttusb_dec_alloc_iso_urbs(dec);
+	return ttusb_dec_alloc_iso_urbs(dec);
 }
 
 static int ttusb_dec_boot_dsp(struct ttusb_dec *dec)
@@ -1381,6 +1510,20 @@ static void ttusb_dec_exit_usb(struct tt
 		usb_kill_urb(dec->iso_urb[i]);
 
 	ttusb_dec_free_iso_urbs(dec);
+
+	if(enable_rc) {
+		/* we have to check whether the irq URB is already submitted.
+		 * As the irq is submitted after the interface is changed,
+		 * this is the best method i figured out.
+		 * Any other possibilities?*/
+		if(dec->interface == TTUSB_DEC_INTERFACE_IN)
+			usb_kill_urb(dec->irq_urb);
+
+		usb_free_urb(dec->irq_urb);
+
+		usb_buffer_free(dec->udev,IRQ_PACKET_SIZE,
+					dec->irq_buffer, dec->irq_dma_handle);
+	}
 }
 
 static void ttusb_dec_exit_tasklet(struct ttusb_dec *dec)
@@ -1462,7 +1605,8 @@ static int ttusb_dec_probe(struct usb_in
 
 	dec->udev = udev;
 
-	ttusb_dec_init_usb(dec);
+	if (ttusb_dec_init_usb(dec))
+		return 0;
 	if (ttusb_dec_init_stb(dec)) {
 		ttusb_dec_exit_usb(dec);
 		return 0;
@@ -1502,6 +1646,9 @@ static int ttusb_dec_probe(struct usb_in
 
 	ttusb_dec_set_interface(dec, TTUSB_DEC_INTERFACE_IN);
 
+	if(enable_rc)
+		ttusb_init_rc(dec);
+
 	return 0;
 }
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 32/48] dibusb: pll fix
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (30 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 31/48] ttusb_dec: IR support Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 33/48] tda10021: fix continuity errors Johannes Stezenbach
                   ` (15 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-pll-fix.patch --]
[-- Type: text/plain, Size: 1935 bytes --]

o fixed pll frequency calculation for channels > 700 MHz.  (Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-fe-i2c.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:18:55.000000000 +0100
@@ -278,10 +278,10 @@ static int thomson_cable_eu_pll_set(stru
 
 static int panasonic_cofdm_env57h1xd5_pll_set(struct dvb_frontend_parameters *fep, u8 pllbuf[4])
 {
-	u32 freq = fep->frequency;
-	u32 tfreq = ((freq + 36125000)*6 + 500000) / 1000000;
+	u32 freq_khz = fep->frequency / 1000;
+	u32 tfreq = ((freq_khz + 36125)*6 + 500) / 1000;
 	u8 TA, T210, R210, ctrl1, cp210, p4321;
-	if (freq > 858000000) {
+	if (freq_khz > 858000) {
 		err("frequency cannot be larger than 858 MHz.");
 		return -EINVAL;
 	}
@@ -293,17 +293,17 @@ static int panasonic_cofdm_env57h1xd5_pl
 	ctrl1 = (1 << 7) | (TA << 6) | (T210 << 3) | R210;
 
 // ********    CHARGE PUMP CONFIG vs RF FREQUENCIES     *****************
-	if (freq < 470000000)
+	if (freq_khz < 470000)
 		cp210 = 2;  // VHF Low and High band ch E12 to E4 to E12
-	else if (freq < 526000000)
+	else if (freq_khz < 526000)
 		cp210 = 4;  // UHF band Ch E21 to E27
 	else // if (freq < 862000000)
 		cp210 = 5;  // UHF band ch E28 to E69
 
 //*********************    BW select  *******************************
-	if (freq < 153000000)
+	if (freq_khz < 153000)
 		p4321  = 1; // BW selected for VHF low
-	else if (freq < 470000000)
+	else if (freq_khz < 470000)
 		p4321  = 2; // BW selected for VHF high E5 to E12
 	else // if (freq < 862000000)
 		p4321  = 4; // BW selection for UHF E21 to E69

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 33/48] tda10021: fix continuity errors
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (31 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 32/48] dibusb: pll fix Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 34/48] saa7146: remove duplicate setgpio Johannes Stezenbach
                   ` (14 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-tda10021-cc-err-fix.patch --]
[-- Type: text/plain, Size: 943 bytes --]

Fix Continuity Errors with tda10021 (slickhenry, Robert Schlabbach)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 tda10021.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda10021.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c	2005-03-22 00:23:32.000000000 +0100
@@ -66,7 +66,7 @@ static u8 tda10021_inittab[0x40]=
 {
 	0x73, 0x6a, 0x23, 0x0a, 0x02, 0x37, 0x77, 0x1a,
 	0x37, 0x6a, 0x17, 0x8a, 0x1e, 0x86, 0x43, 0x40,
-	0xb8, 0x3f, 0xa1, 0x00, 0xcd, 0x01, 0x00, 0xff,
+	0xb8, 0x3f, 0xa0, 0x00, 0xcd, 0x01, 0x00, 0xff,
 	0x11, 0x00, 0x7c, 0x31, 0x30, 0x20, 0x00, 0x00,
 	0x02, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00,
 	0x07, 0x00, 0x33, 0x11, 0x0d, 0x95, 0x08, 0x58,

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 34/48] saa7146: remove duplicate setgpio
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (32 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 33/48] tda10021: fix continuity errors Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 35/48] fix CAMs on Typhoon DVB-S Johannes Stezenbach
                   ` (13 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-saa7146-cleanup.patch --]
[-- Type: text/plain, Size: 1893 bytes --]

Remove duplicate setgpio (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 saa7146_core.c |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/common/saa7146_core.c	2005-03-22 00:18:04.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c	2005-03-22 00:23:38.000000000 +0100
@@ -46,21 +46,15 @@ static void dump_registers(struct saa714
  * gpio and debi helper functions
  ****************************************************************************/
 
-/* write "data" to the gpio-pin "pin" -- unused */
-void saa7146_set_gpio(struct saa7146_dev *dev, u8 pin, u8 data)
+void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
 {
 	u32 value = 0;
 
-	/* sanity check */
-	if(pin > 3)
-		return;
-
-	/* read old register contents */
-	value = saa7146_read(dev, GPIO_CTRL );
-
-	value &= ~(0xff << (8*pin));
-	value |= (data << (8*pin));
+	BUG_ON(port > 3);
 
+	value = saa7146_read(dev, GPIO_CTRL);
+	value &= ~(0xff << (8*port));
+	value |= (data << (8*port));
 	saa7146_write(dev, GPIO_CTRL, value);
 }
 
@@ -236,19 +230,6 @@ int saa7146_pgtable_build_single(struct 
 }
 
 /********************************************************************************/
-/* gpio functions */
-
-void saa7146_setgpio(struct saa7146_dev *dev, int port, u32 data)
-{
-	u32 val = 0;
-
-        val=saa7146_read(dev,GPIO_CTRL);
-        val&=~(0xff << (8*(port)));
-        val|=(data)<<(8*(port));
-        saa7146_write(dev, GPIO_CTRL, val);
-}
-
-/********************************************************************************/
 /* interrupt handler */
 static irqreturn_t interrupt_hw(int irq, void *dev_id, struct pt_regs *regs)
 {

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 35/48] fix CAMs on Typhoon DVB-S
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (33 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 34/48] saa7146: remove duplicate setgpio Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 36/48] frontends: kfree() cleanup Johannes Stezenbach
                   ` (12 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttpcibudget-typhoon-cam.patch --]
[-- Type: text/plain, Size: 2821 bytes --]

Fix for CAMs on Typhoon DVB-S, where it would constantly reset itself.
(Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-core/dvb_ca_en50221.c |    2 +-
 ttpci/budget-av.c         |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-21 23:27:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:23:49.000000000 +0100
@@ -974,7 +974,7 @@ static void dvb_ca_en50221_thread_update
 			if (ca->open) {
 				if ((!ca->slot_info[slot].da_irq_supported) ||
 				    (!(ca->flags & DVB_CA_EN50221_FLAG_IRQ_DA))) {
-					delay = HZ / 100;
+					delay = HZ / 10;
 				}
 			}
 			break;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-av.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c	2005-03-22 00:23:49.000000000 +0100
@@ -121,6 +121,8 @@ static int ciintf_read_attribute_mem(str
 		return -EINVAL;
 
 	saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI);
+	udelay(1);
+
 	result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 0xfff, 1, 0, 0);
 
 	if (result == -ETIMEDOUT)
@@ -137,6 +139,8 @@ static int ciintf_write_attribute_mem(st
 		return -EINVAL;
 
 	saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTHI);
+	udelay(1);
+
 	result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 0xfff, 1, value, 0, 0);
 
 	if (result == -ETIMEDOUT)
@@ -153,6 +157,8 @@ static int ciintf_read_cam_control(struc
 		return -EINVAL;
 
 	saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO);
+	udelay(1);
+
 	result = ttpci_budget_debiread(&budget_av->budget, DEBICICAM, address & 3, 1, 0, 0);
 
 	if (result == -ETIMEDOUT)
@@ -169,6 +175,8 @@ static int ciintf_write_cam_control(stru
 		return -EINVAL;
 
 	saa7146_setgpio(budget_av->budget.dev, 1, SAA7146_GPIO_OUTLO);
+	udelay(1);
+
 	result = ttpci_budget_debiwrite(&budget_av->budget, DEBICICAM, address & 3, 1, value, 0, 0);
 
 	if (result == -ETIMEDOUT)
@@ -190,7 +198,10 @@ static int ciintf_slot_reset(struct dvb_
 	saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTHI);
 	msleep(100);
 	saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTLO);
-	msleep(2000);		/* horrendous I know, but its the only way to be absolutely sure without an IRQ line! */
+
+	int max = 20;
+	while (--max > 0 && ciintf_read_attribute_mem(ca, slot, 0) != 0x1d)
+		msleep(100);
 
 	ttpci_budget_set_video_port(saa, BUDGET_VIDEO_PORTB);
 	return 0;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 36/48] frontends: kfree() cleanup
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (34 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 35/48] fix CAMs on Typhoon DVB-S Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 37/48] clear up confusion between ids and adapters Johannes Stezenbach
                   ` (11 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-kfree-null.patch --]
[-- Type: text/plain, Size: 15648 bytes --]

kfree(NULL) is safe (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 bt8xx/dst.c               |    2 +-
 dvb-core/dvb_ca_en50221.c |    3 +--
 dvb-core/dvb_frontend.c   |    3 +--
 dvb-core/dvbdev.c         |    4 +---
 frontends/at76c651.c      |    2 +-
 frontends/cx22700.c       |    2 +-
 frontends/cx22702.c       |    2 +-
 frontends/cx24110.c       |    2 +-
 frontends/dib3000mb.c     |    3 +--
 frontends/dib3000mc.c     |    3 +--
 frontends/dvb_dummy_fe.c  |    2 +-
 frontends/l64781.c        |    2 +-
 frontends/mt312.c         |    3 +--
 frontends/mt352.c         |    2 +-
 frontends/nxt2002.c       |    2 +-
 frontends/nxt6000.c       |    2 +-
 frontends/or51211.c       |    2 +-
 frontends/sp8870.c        |    2 +-
 frontends/sp887x.c        |    2 +-
 frontends/stv0297.c       |    3 +--
 frontends/stv0299.c       |    2 +-
 frontends/tda10021.c      |    2 +-
 frontends/tda1004x.c      |    2 +-
 frontends/tda8083.c       |    2 +-
 frontends/tda80xx.c       |    2 +-
 frontends/ves1820.c       |    2 +-
 frontends/ves1x93.c       |    2 +-
 ttusb-dec/ttusbdecfe.c    |    4 ++--
 28 files changed, 29 insertions(+), 37 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/dst.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst.c	2005-03-22 00:27:13.000000000 +0100
@@ -998,7 +998,7 @@ struct dvb_frontend* dst_attach(const st
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:23:49.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:27:13.000000000 +0100
@@ -1733,8 +1733,7 @@ int dvb_ca_en50221_init(struct dvb_adapt
 	if (ca != NULL) {
 		if (ca->dvbdev != NULL)
 			dvb_unregister_device(ca->dvbdev);
-		if (ca->slot_info != NULL)
-			kfree(ca->slot_info);
+		kfree(ca->slot_info);
 		kfree(ca);
 	}
 	pubca->private = NULL;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_frontend.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_frontend.c	2005-03-22 00:27:13.000000000 +0100
@@ -908,8 +908,7 @@ int dvb_unregister_frontend(struct dvb_f
 	else
 		printk("dvb_frontend: Demodulator (%s) does not have a release callback!\n", fe->ops->info.name);
 	/* fe is invalid now */
-	if (fepriv)
-		kfree(fepriv);
+	kfree(fepriv);
 	up (&frontend_mutex);
 	return 0;
 }
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-22 00:27:13.000000000 +0100
@@ -395,9 +395,7 @@ int dvb_usercopy(struct inode *inode, st
         }
 
 out:
-        if (mbuf)
-                kfree(mbuf);
-
+        kfree(mbuf);
         return err;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/at76c651.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/at76c651.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/at76c651.c	2005-03-22 00:27:13.000000000 +0100
@@ -402,7 +402,7 @@ struct dvb_frontend* at76c651_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22700.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/cx22700.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22700.c	2005-03-22 00:27:13.000000000 +0100
@@ -392,7 +392,7 @@ struct dvb_frontend* cx22700_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22702.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/cx22702.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22702.c	2005-03-22 00:27:13.000000000 +0100
@@ -476,7 +476,7 @@ struct dvb_frontend* cx22702_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx24110.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/cx24110.c	2005-03-22 00:22:33.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx24110.c	2005-03-22 00:27:13.000000000 +0100
@@ -608,7 +608,7 @@ struct dvb_frontend* cx24110_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:27:13.000000000 +0100
@@ -738,8 +738,7 @@ struct dvb_frontend* dib3000mb_attach(co
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:16:19.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:27:13.000000000 +0100
@@ -885,8 +885,7 @@ struct dvb_frontend* dib3000mc_attach(co
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dvb_dummy_fe.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dvb_dummy_fe.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dvb_dummy_fe.c	2005-03-22 00:27:13.000000000 +0100
@@ -123,7 +123,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_a
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/l64781.c	2005-03-22 00:15:55.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c	2005-03-22 00:27:13.000000000 +0100
@@ -559,7 +559,7 @@ struct dvb_frontend* l64781_attach(const
 
 error:
 	if (reg0x3e >= 0) l64781_writereg (state, 0x3e, reg0x3e);  /* restore reg 0x3e */
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt312.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/mt312.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt312.c	2005-03-22 00:27:13.000000000 +0100
@@ -641,8 +641,7 @@ struct dvb_frontend* vp310_attach(const 
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/mt352.c	2005-03-22 00:14:46.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c	2005-03-22 00:27:13.000000000 +0100
@@ -581,7 +581,7 @@ struct dvb_frontend* mt352_attach(const 
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:17:45.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c	2005-03-22 00:27:13.000000000 +0100
@@ -661,7 +661,7 @@ struct dvb_frontend* nxt2002_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt6000.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt6000.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt6000.c	2005-03-22 00:27:13.000000000 +0100
@@ -511,7 +511,7 @@ struct dvb_frontend* nxt6000_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/or51211.c	2005-03-22 00:18:23.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.c	2005-03-22 00:27:13.000000000 +0100
@@ -588,7 +588,7 @@ struct dvb_frontend* or51211_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp8870.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/sp8870.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp8870.c	2005-03-22 00:27:13.000000000 +0100
@@ -570,7 +570,7 @@ struct dvb_frontend* sp8870_attach(const
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp887x.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/sp887x.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp887x.c	2005-03-22 00:27:13.000000000 +0100
@@ -564,7 +564,7 @@ struct dvb_frontend* sp887x_attach(const
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0297.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/stv0297.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0297.c	2005-03-22 00:27:13.000000000 +0100
@@ -758,8 +758,7 @@ struct dvb_frontend *stv0297_attach(cons
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0299.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/stv0299.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0299.c	2005-03-22 00:27:13.000000000 +0100
@@ -675,7 +675,7 @@ struct dvb_frontend* stv0299_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda10021.c	2005-03-22 00:23:32.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c	2005-03-22 00:27:13.000000000 +0100
@@ -420,7 +420,7 @@ struct dvb_frontend* tda10021_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda1004x.c	2005-03-22 00:14:18.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c	2005-03-22 00:27:13.000000000 +0100
@@ -1097,7 +1097,7 @@ struct dvb_frontend* tda10045_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda8083.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda8083.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda8083.c	2005-03-22 00:27:13.000000000 +0100
@@ -405,7 +405,7 @@ struct dvb_frontend* tda8083_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda80xx.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/tda80xx.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda80xx.c	2005-03-22 00:27:13.000000000 +0100
@@ -683,7 +683,7 @@ struct dvb_frontend* tda80xx_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1820.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/ves1820.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1820.c	2005-03-22 00:27:13.000000000 +0100
@@ -404,7 +404,7 @@ struct dvb_frontend* ves1820_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/ves1x93.c	2005-03-22 00:15:00.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c	2005-03-22 00:27:13.000000000 +0100
@@ -497,7 +497,7 @@ struct dvb_frontend* ves1x93_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-dec/ttusbdecfe.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusbdecfe.c	2005-03-22 00:27:13.000000000 +0100
@@ -169,7 +169,7 @@ struct dvb_frontend* ttusbdecfe_dvbt_att
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
@@ -195,7 +195,7 @@ struct dvb_frontend* ttusbdecfe_dvbs_att
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 37/48] clear up confusion between ids and adapters
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (35 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 36/48] frontends: kfree() cleanup Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 38/48] dibusb: remove useless ifdef Johannes Stezenbach
                   ` (10 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-core-cleanup.patch --]
[-- Type: text/plain, Size: 1203 bytes --]

clear up confusion between ids and adapters (Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvbdev.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c	2005-03-22 00:27:34.000000000 +0100
@@ -51,9 +51,10 @@ static const char * const dnames[] = {
 	"net", "osd"
 };
 
-#define DVB_MAX_IDS              6
-#define nums2minor(num,type,id)  ((num << 6) | (id << 4) | type)
-#define MAX_DVB_MINORS           (DVB_MAX_IDS*64)
+#define DVB_MAX_ADAPTERS	8
+#define DVB_MAX_IDS		4
+#define nums2minor(num,type,id)	((num << 6) | (id << 4) | type)
+#define MAX_DVB_MINORS		(DVB_MAX_ADAPTERS*64)
 
 static struct class_simple *dvb_class;
 
@@ -267,7 +268,7 @@ static int dvbdev_get_free_adapter_num (
 {
 	int num = 0;
 
-	while (1) {
+	while (num < DVB_MAX_ADAPTERS) {
 		struct list_head *entry;
 		list_for_each (entry, &dvb_adapter_list) {
 			struct dvb_adapter *adap;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 38/48] dibusb: remove useless ifdef
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (36 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 37/48] clear up confusion between ids and adapters Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 39/48] support for Technotrend PCI DVB-T Johannes Stezenbach
                   ` (9 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-cleanup.patch --]
[-- Type: text/plain, Size: 1050 bytes --]

removed useless ifdef: dvb_register_adapter always takes 3 parameters in this tree
(Andreas Oberritter)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-dvb.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:17:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:27:41.000000000 +0100
@@ -125,12 +125,8 @@ int dibusb_dvb_init(struct usb_dibusb *d
 
 	urb_compl_count = 0;
 
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,4)
-    if ((ret = dvb_register_adapter(&dib->adapter, DRIVER_DESC)) < 0) {
-#else
-    if ((ret = dvb_register_adapter(&dib->adapter, DRIVER_DESC , 
+	if ((ret = dvb_register_adapter(&dib->adapter, DRIVER_DESC,
 			THIS_MODULE)) < 0) {
-#endif
 		deb_info("dvb_register_adapter failed: error %d", ret);
 		goto err;
 	}

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 39/48] support for Technotrend PCI DVB-T
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (37 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 38/48] dibusb: remove useless ifdef Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 40/48] dibusb: HanfTek UMT-010 fixes Johannes Stezenbach
                   ` (8 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttpci-tt-dvb-t.patch --]
[-- Type: text/plain, Size: 4456 bytes --]

patch by Anssi Hannula: add support for Technotrend PCI DVB-T
(0x13c2,0x0008, Grundig 29504-401 (LSI L64781 Based) frontend)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 Kconfig  |    1 +
 av7110.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 av7110.h |    1 +
 3 files changed, 48 insertions(+), 1 deletion(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/Kconfig
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/Kconfig	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/Kconfig	2005-03-22 00:27:46.000000000 +0100
@@ -10,6 +10,7 @@ config DVB_AV7110
 	select DVB_TDA8083
 	select DVB_SP8870
 	select DVB_STV0297
+	select DVB_L64781
 	help
 	  Support for SAA7146 and AV7110 based DVB cards as produced 
 	  by Fujitsu-Siemens, Technotrend, Hauppauge and others.
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110.c	2005-03-22 00:18:08.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c	2005-03-22 00:27:46.000000000 +0100
@@ -1853,6 +1853,45 @@ static struct stv0297_config nexusca_stv
 };
 
 
+
+static int grundig_29504_401_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+{
+	struct av7110* av7110 = (struct av7110*) fe->dvb->priv;
+	u32 div;
+	u8 cfg, cpump, band_select;
+	u8 data[4];
+	struct i2c_msg msg = { .addr = 0x61, .flags = 0, .buf = data, .len = sizeof(data) };
+
+	div = (36125000 + params->frequency) / 166666;
+
+	cfg = 0x88;
+
+	if (params->frequency < 175000000) cpump = 2;
+	else if (params->frequency < 390000000) cpump = 1;
+	else if (params->frequency < 470000000) cpump = 2;
+	else if (params->frequency < 750000000) cpump = 1;
+	else cpump = 3;
+
+	if (params->frequency < 175000000) band_select = 0x0e;
+	else if (params->frequency < 470000000) band_select = 0x05;
+	else band_select = 0x03;
+
+	data[0] = (div >> 8) & 0x7f;
+	data[1] = div & 0xff;
+	data[2] = ((div >> 10) & 0x60) | cfg;
+	data[3] = (cpump << 6) | band_select;
+
+	if (i2c_transfer (&av7110->i2c_adap, &msg, 1) != 1) return -EIO;
+	return 0;
+}
+
+static struct l64781_config grundig_29504_401_config = {
+	.demod_address = 0x55,
+	.pll_set = grundig_29504_401_pll_set,
+};
+
+
+
 static void av7110_fe_lock_fix(struct av7110* av7110, fe_status_t status)
 {
 	int synced = (status & FE_HAS_LOCK) ? 1 : 0;
@@ -2060,6 +2099,11 @@ static int frontend_init(struct av7110 *
 			}
 			break;
 
+		case 0x0008: // Hauppauge/TT DVB-T
+
+			av7110->fe = l64781_attach(&grundig_29504_401_config, &av7110->i2c_adap);
+			break;
+
 		case 0x000A: // Hauppauge/TT Nexus-CA rev1.X
 
 			av7110->fe = stv0297_attach(&nexusca_stv0297_config, &av7110->i2c_adap, 0x7b);
@@ -2629,6 +2673,7 @@ MAKE_AV7110_INFO(ttc_1_X,    "Technotren
 MAKE_AV7110_INFO(ttc_2_X,    "Technotrend/Hauppauge WinTV DVB-C rev2.X");
 MAKE_AV7110_INFO(tts_2_X,    "Technotrend/Hauppauge WinTV Nexus-S rev2.X");
 MAKE_AV7110_INFO(tts_1_3se,  "Technotrend/Hauppauge WinTV DVB-S rev1.3 SE");
+MAKE_AV7110_INFO(ttt,        "Technotrend/Hauppauge DVB-T");
 MAKE_AV7110_INFO(fsc,        "Fujitsu Siemens DVB-C");
 MAKE_AV7110_INFO(fss,        "Fujitsu Siemens DVB-S rev1.6");
 
@@ -2641,10 +2686,10 @@ static struct pci_device_id pci_tbl[] = 
 	MAKE_EXTENSION_PCI(fsc,       0x110a, 0x0000),
 	MAKE_EXTENSION_PCI(ttc_1_X,   0x13c2, 0x000a),
 	MAKE_EXTENSION_PCI(fss,       0x13c2, 0x0006),
+	MAKE_EXTENSION_PCI(ttt,       0x13c2, 0x0008),
 
 /*	MAKE_EXTENSION_PCI(???, 0x13c2, 0x0004), UNDEFINED CARD */ // Galaxis DVB PC-Sat-Carte
 /*	MAKE_EXTENSION_PCI(???, 0x13c2, 0x0005), UNDEFINED CARD */ // Technisat SkyStar1
-/*	MAKE_EXTENSION_PCI(???, 0x13c2, 0x0008), UNDEFINED CARD */ // TT/Hauppauge WinTV DVB-T v????
 /*	MAKE_EXTENSION_PCI(???, 0x13c2, 0x0009), UNDEFINED CARD */ // TT/Hauppauge WinTV Nexus-CA v????
 
 	{
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110.h	2005-03-22 00:18:08.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h	2005-03-22 00:27:46.000000000 +0100
@@ -31,6 +31,7 @@
 #include "tda8083.h"
 #include "sp8870.h"
 #include "stv0297.h"
+#include "l64781.h"
 
 #include <media/saa7146_vv.h>
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 40/48] dibusb: HanfTek UMT-010 fixes
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (38 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 39/48] support for Technotrend PCI DVB-T Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 41/48] vfree() checking cleanups Johannes Stezenbach
                   ` (7 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-hanftek-umt-010.patch --]
[-- Type: text/plain, Size: 6026 bytes --]

HanfTek UMT-010: adapted the pll-programming, the usb-ids and the firmware name
to the new firmware (thanks to Sunny Liu from HanfTek)
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-dibusb-core.c   |    8 ++++----
 dvb-dibusb-fe-i2c.c |   49 +++++++++++++++++++++++--------------------------
 dvb-dibusb-usb.c    |    4 +---
 3 files changed, 28 insertions(+), 33 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:18:30.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:27:58.000000000 +0100
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(rc_key_repeat_count, "h
 #define USB_PID_UNK_HYPER_PALTEK_COLD		0x005e
 #define USB_PID_UNK_HYPER_PALTEK_WARM		0x005f
 #define USB_PID_HANFTEK_UMT_010_COLD		0x0001
-#define USB_PID_HANFTEK_UMT_010_WARM		0x0025
+#define USB_PID_HANFTEK_UMT_010_WARM		0x0015
 #define USB_PID_YAKUMO_DTT200U_COLD			0x0201
 #define USB_PID_YAKUMO_DTT200U_WARM			0x0301
 #define USB_PID_WINTV_NOVA_T_USB2_COLD		0x9300
@@ -235,9 +235,9 @@ static struct dibusb_device_class dibusb
 	  &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5],
 	},
 	{ UMT2_0, &dibusb_usb_ctrl[2],
-	  "dvb-dibusb-umt-1.fw",
-	  0x01, 0x02, 
-	  7, 188*21,
+	  "dvb-dibusb-umt-2.fw",
+	  0x01, 0x06,
+	  20, 512,
 	  DIBUSB_RC_NO,
 	  &dibusb_demod[DIBUSB_MT352],
 	  &dibusb_tuner[DIBUSB_TUNER_CABLE_LG_TDTP_E102P],
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:18:55.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:27:58.000000000 +0100
@@ -345,8 +345,6 @@ static int panasonic_cofdm_env57h1xd5_pl
  *             BSn = 0 corresponding port is off, high-impedance state (at power-on)
  *             BSn = 1 corresponding port is on
  */
-
-
 static int panasonic_cofdm_env77h11d5_tda6650_init(struct dvb_frontend *fe, u8 pllbuf[4])
 {
 	pllbuf[0] = 0x0b;
@@ -441,55 +439,54 @@ static int panasonic_cofdm_env77h11d5_td
  *          0	1	c2 (always valid)
  *          1	0	c4
  *          1	1	c6
- *
- *
- *
  */
-
 static int lg_tdtp_e102p_tua6034(struct dvb_frontend_parameters* fep, u8 pllbuf[4])
 {
 	u32 div;
-	u8 p3210, p4;
+	u8 p210, p3;
 
 #define TUNER_MUL 62500
 
 	div = (fep->frequency + 36125000 + TUNER_MUL / 2) / TUNER_MUL;
+//	div = ((fep->frequency/1000 + 36166) * 6) / 1000;
 
 	if (fep->frequency < 174500000)
-		p3210 = 1; // not supported by the tdtp_e102p
+		p210 = 1; // not supported by the tdtp_e102p
 	else if (fep->frequency < 230000000) // VHF
-		p3210 = 2;
+		p210 = 2;
 	else
-		p3210 = 4;
+		p210 = 4;
 
 	if (fep->u.ofdm.bandwidth == BANDWIDTH_7_MHZ)
-		p4 = 0;
+		p3 = 0;
 	else
-		p4 = 1;
+		p3 = 1;
 
 	pllbuf[0] = (div >> 8) & 0x7f;
 	pllbuf[1] = div & 0xff;
 	pllbuf[2] = 0xce;
-	pllbuf[3] = (p4 << 4) | p3210;
+//	pllbuf[2] = 0xcc;
+	pllbuf[3] = (p3 << 3) | p210;
 
 	return 0;
 }
 
 static int lg_tdtp_e102p_mt352_demod_init(struct dvb_frontend *fe)
 {
-	static u8 mt352_clock_config[] = { 0x89, 0xb0, 0x2d };
+	static u8 mt352_clock_config[] = { 0x89, 0xb8, 0x2d };
 	static u8 mt352_reset[] = { 0x50, 0x80 };
 	static u8 mt352_mclk_ratio[] = { 0x8b, 0x00 };
 	static u8 mt352_adc_ctl_1_cfg[] = { 0x8E, 0x40 };
-	static u8 mt352_agc_cfg[] = { 0x67, 0x14, 0x22 };
-	static u8 mt352_sec_agc_cfg[] = { 0x69, 0x00, 0xff, 0xff, 0x00, 0xff, 0x00, 0x40, 0x40 };
-
-	static u8 mt352_unk [] = { 0xb5, 0x7a };
+	static u8 mt352_agc_cfg[] = { 0x67, 0x10, 0xa0 };
 
-	static u8 mt352_acq_ctl[] = { 0x53, 0x5f };
-	static u8 mt352_input_freq_1[] = { 0x56, 0xf1, 0x05 };
+	static u8 mt352_sec_agc_cfg1[] = { 0x6a, 0xff };
+	static u8 mt352_sec_agc_cfg2[] = { 0x6d, 0xff };
+	static u8 mt352_sec_agc_cfg3[] = { 0x70, 0x40 };
+	static u8 mt352_sec_agc_cfg4[] = { 0x7b, 0x03 };
+	static u8 mt352_sec_agc_cfg5[] = { 0x7d, 0x0f };
 
-//	static u8 mt352_capt_range_cfg[] = { 0x75, 0x32 };
+	static u8 mt352_acq_ctl[] = { 0x53, 0x50 };
+	static u8 mt352_input_freq_1[] = { 0x56, 0x31, 0x06 };
 
 	mt352_write(fe, mt352_clock_config, sizeof(mt352_clock_config));
 	udelay(2000);
@@ -499,15 +496,15 @@ static int lg_tdtp_e102p_mt352_demod_ini
 	mt352_write(fe, mt352_adc_ctl_1_cfg, sizeof(mt352_adc_ctl_1_cfg));
 	mt352_write(fe, mt352_agc_cfg, sizeof(mt352_agc_cfg));
 
-	mt352_write(fe, mt352_sec_agc_cfg, sizeof(mt352_sec_agc_cfg));
-
-	mt352_write(fe, mt352_unk, sizeof(mt352_unk));
+	mt352_write(fe, mt352_sec_agc_cfg1, sizeof(mt352_sec_agc_cfg1));
+	mt352_write(fe, mt352_sec_agc_cfg2, sizeof(mt352_sec_agc_cfg2));
+	mt352_write(fe, mt352_sec_agc_cfg3, sizeof(mt352_sec_agc_cfg3));
+	mt352_write(fe, mt352_sec_agc_cfg4, sizeof(mt352_sec_agc_cfg4));
+	mt352_write(fe, mt352_sec_agc_cfg5, sizeof(mt352_sec_agc_cfg5));
 
 	mt352_write(fe, mt352_acq_ctl, sizeof(mt352_acq_ctl));
 	mt352_write(fe, mt352_input_freq_1, sizeof(mt352_input_freq_1));
 
-//	mt352_write(fe, mt352_capt_range_cfg, sizeof(mt352_capt_range_cfg));
-
 	return 0;
 }
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:18:30.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:27:58.000000000 +0100
@@ -143,14 +143,12 @@ int dibusb_streaming(struct usb_dibusb *
 		case DIBUSB2_0:
 		case DIBUSB2_0B:
 		case NOVAT_USB2:
+		case UMT2_0:
 			if (onoff)
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_ENABLE_STREAM,NULL,0);
 			else
 				return dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_DISABLE_STREAM,NULL,0);
 			break;
-		case UMT2_0:
-			return dibusb_set_streaming_mode(dib,onoff);
-			break;
 		default:
 			break;
 	}

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 41/48] vfree() checking cleanups
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (39 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 40/48] dibusb: HanfTek UMT-010 fixes Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 42/48] convert from pci_module_init to pci_register_driver Johannes Stezenbach
                   ` (6 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Domen Puncer

[-- Attachment #1: dvb-janitor-vfree.patch --]
[-- Type: text/plain, Size: 2768 bytes --]

vfree() checking cleanups.

Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-core/dmxdev.c         |   16 +++++-----------
 dvb-core/dvb_ca_en50221.c |    3 +--
 ttpci/budget-core.c       |    3 +--
 3 files changed, 7 insertions(+), 15 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dmxdev.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dmxdev.c	2005-03-22 00:28:04.000000000 +0100
@@ -304,8 +304,7 @@ static int dvb_dmxdev_set_buffer_size(st
 	buf->size=size;
 	buf->pwrite=buf->pread=0;
 	spin_unlock_irq(&dmxdevfilter->dev->lock);
-	if (mem)
-		vfree(mem);
+	vfree(mem);
 
 	if (buf->size) {
 		mem=vmalloc(dmxdevfilter->buffer.size);
@@ -1129,15 +1128,10 @@ dvb_dmxdev_release(struct dmxdev *dmxdev
 	dvb_unregister_device(dmxdev->dvbdev);
 	dvb_unregister_device(dmxdev->dvr_dvbdev);
 
-	if (dmxdev->filter) {
-		vfree(dmxdev->filter);
-		dmxdev->filter=NULL;
-	}
-
-	if (dmxdev->dvr) {
-		vfree(dmxdev->dvr);
-		dmxdev->dvr=NULL;
-	}
+	vfree(dmxdev->filter);
+	dmxdev->filter=NULL;
+	vfree(dmxdev->dvr);
+	dmxdev->dvr=NULL;
 	dmxdev->demux->close(dmxdev->demux);
 }
 EXPORT_SYMBOL(dvb_dmxdev_release);
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-core.c	2005-03-21 23:27:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-core.c	2005-03-22 00:28:04.000000000 +0100
@@ -415,8 +415,7 @@ int ttpci_budget_init(struct budget *bud
 err:
 	i2c_del_adapter(&budget->i2c_adap);
 
-	if (budget->grabbing)
-		vfree(budget->grabbing);
+	vfree(budget->grabbing);
 
 	dvb_unregister_adapter(budget->dvb_adapter);
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:28:04.000000000 +0100
@@ -804,8 +804,7 @@ static int dvb_ca_en50221_slot_shutdown(
 	down_write(&ca->slot_info[slot].sem);
 	ca->pub->slot_shutdown(ca->pub, slot);
 	ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE;
-	if (ca->slot_info[slot].rx_buffer.data)
-		vfree(ca->slot_info[slot].rx_buffer.data);
+	vfree(ca->slot_info[slot].rx_buffer.data);
 	ca->slot_info[slot].rx_buffer.data = NULL;
 	up_write(&ca->slot_info[slot].sem);
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 42/48] convert from pci_module_init to pci_register_driver
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (40 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 41/48] vfree() checking cleanups Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 43/48] dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device Johannes Stezenbach
                   ` (5 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Christophe Lucas, Domen Puncer

[-- Attachment #1: dvb-janitor-pci-init.patch --]
[-- Type: text/plain, Size: 1582 bytes --]

>From : http://kerneljanitors.org/TODO
o convert from pci_module_init to pci_register_driver

Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 b2c2/skystar2.c |    2 +-
 bt8xx/bt878.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c	2005-03-22 00:28:10.000000000 +0100
@@ -2629,7 +2629,7 @@ static struct pci_driver skystar2_pci_dr
 
 static int skystar2_init(void)
 {
-	return pci_module_init(&skystar2_pci_driver);
+	return pci_register_driver(&skystar2_pci_driver);
 }
 
 static void skystar2_cleanup(void)
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/bt8xx/bt878.c	2005-03-22 00:16:28.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c	2005-03-22 00:28:10.000000000 +0100
@@ -563,7 +563,7 @@ static int bt878_init_module(void)
 	/* later we register inside of bt878_find_audio_dma()
 	 * because we may want to ignore certain cards */
 	bt878_pci_driver_registered = 1;
-	return pci_module_init(&bt878_pci_driver);
+	return pci_register_driver(&bt878_pci_driver);
 }
 
 static void bt878_cleanup_module(void)

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 43/48] dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (41 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 42/48] convert from pci_module_init to pci_register_driver Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 44/48] sparse warnings on one-bit bitfields Johannes Stezenbach
                   ` (4 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-dibusb-dtt200u.patch --]
[-- Type: text/plain, Size: 22275 bytes --]

o added native support for the dtt200u (Yakumo/Typhoon/Hama) USB2.0 device
o URBs are now submitted, when the actual transfer began, not right from the
  device plugin (solves a lot of problems)
o minor fixes in the dib3000-frontends
(Patrick Boettcher)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dibusb/Makefile            |    3 
 dibusb/dvb-dibusb-core.c   |   26 ++--
 dibusb/dvb-dibusb-dvb.c    |    5 
 dibusb/dvb-dibusb-fe-i2c.c |   27 ----
 dibusb/dvb-dibusb-usb.c    |   70 +++++++++---
 dibusb/dvb-dibusb.h        |    9 +
 dibusb/dvb-fe-dtt200u.c    |  258 +++++++++++++++++++++++++++++++++++++++++++++
 frontends/dib3000mb.c      |    1 
 frontends/dib3000mc.c      |    1 
 9 files changed, 350 insertions(+), 50 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/Makefile	2005-03-22 00:17:09.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile	2005-03-22 00:28:15.000000000 +0100
@@ -3,7 +3,8 @@ dvb-dibusb-objs = dvb-dibusb-core.o \
 	dvb-dibusb-fe-i2c.o \
 	dvb-dibusb-firmware.o \
 	dvb-dibusb-remote.o \
-	dvb-dibusb-usb.o
+	dvb-dibusb-usb.o \
+	dvb-fe-dtt200u.o
 
 obj-$(CONFIG_DVB_DIBUSB) += dvb-dibusb.o
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:28:15.000000000 +0100
@@ -119,10 +119,6 @@ static struct usb_device_id dib_table []
 /* 00 */	{ USB_DEVICE(USB_VID_AVERMEDIA,		USB_PID_AVERMEDIA_DVBT_USB_COLD)},
 /* 01 */	{ USB_DEVICE(USB_VID_AVERMEDIA,		USB_PID_AVERMEDIA_DVBT_USB_WARM)},
 /* 02 */	{ USB_DEVICE(USB_VID_AVERMEDIA,		USB_PID_YAKUMO_DTT200U_COLD) },
-
-/* the following device is actually not supported, but when loading the 
- * correct firmware (ie. its usb ids will change) everything works fine then 
- */
 /* 03 */	{ USB_DEVICE(USB_VID_AVERMEDIA,		USB_PID_YAKUMO_DTT200U_WARM) },
 
 /* 04 */	{ USB_DEVICE(USB_VID_COMPRO,		USB_PID_COMPRO_DVBU2000_COLD) },
@@ -161,7 +157,7 @@ static struct usb_device_id dib_table []
  * activate the following define when you have one of the devices and want to 
  * build it from build-2.6 in dvb-kernel
  */
-// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES 
+// #define CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 #ifdef CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES
 /* 34 */	{ USB_DEVICE(USB_VID_ANCHOR,		USB_PID_ULTIMA_TVBOX_ANCHOR_COLD) },
 /* 35 */	{ USB_DEVICE(USB_VID_CYPRESS,		USB_PID_ULTIMA_TVBOX_USB2_FX_COLD) },
@@ -207,6 +203,10 @@ static struct dibusb_demod dibusb_demod[
 	  254,
 	  { 0xf, 0 }, 
 	},
+	{ DTT200U_FE,
+	  8,
+	  { 0xff,0 }, /* there is no i2c bus in this device */
+	}
 };
 
 static struct dibusb_device_class dibusb_device_classes[] = {
@@ -258,6 +258,14 @@ static struct dibusb_device_class dibusb
 	  &dibusb_demod[DIBUSB_DIB3000MC],
 	  &dibusb_tuner[DIBUSB_TUNER_COFDM_PANASONIC_ENV57H1XD5],
 	},
+	{ DTT200U,&dibusb_usb_ctrl[2],
+	  "dvb-dtt200u-1.fw",
+	  0x01, 0x02,
+	  7, 4096,
+	  DIBUSB_RC_NO,
+	  &dibusb_demod[DTT200U_FE],
+	  NULL, /* no explicit tuner/pll-programming necessary (it has the ENV57H1XD5) */
+	},
 };
 
 static struct dibusb_usb_device dibusb_devices[] = {
@@ -321,10 +329,10 @@ static struct dibusb_usb_device dibusb_d
 		{ &dib_table[30], NULL },
 		{ &dib_table[31], NULL },
 	},
-	{	"AVermedia/Yakumo/Hama/Typhoon DVB-T USB2.0",
-		&dibusb_device_classes[UMT2_0],
+	{	"DTT200U (Yakumo/Hama/Typhoon) DVB-T USB2.0",
+		&dibusb_device_classes[DTT200U],
 		{ &dib_table[2], NULL },
-		{ NULL },
+		{ &dib_table[3], NULL },
 	},	
 	{	"Hanftek UMT-010 DVB-T USB2.0",
 		&dibusb_device_classes[UMT2_0],
@@ -343,7 +351,7 @@ static struct dibusb_usb_device dibusb_d
 		{ NULL },
 	},
 	{	"Artec T1 USB2.0 TVBOX with FX2 IDs (misdesigned, please report the warm ID)",
-		&dibusb_device_classes[DIBUSB2_0],
+		&dibusb_device_classes[DTT200U],
 		{ &dib_table[35], NULL },
 		{ &dib_table[36], NULL }, /* undefined, it could be that the device will get another USB ID in warm state */
 	},
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:27:41.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c	2005-03-22 00:28:15.000000000 +0100
@@ -34,7 +34,7 @@ void dibusb_urb_complete(struct urb *urb
 		case 0:         /* success */
 		case -ETIMEDOUT:    /* NAK */
 			break;
-		case -ECONNRESET:   /* unlink */
+		case -ECONNRESET:   /* kill */
 		case -ENOENT:
 		case -ESHUTDOWN:
 			return;
@@ -43,7 +43,7 @@ void dibusb_urb_complete(struct urb *urb
 			break;
 	}
 
-	if (dib->feedcount > 0) {
+	if (dib->feedcount > 0 && urb->actual_length > 0) {
 		if (dib->init_state & DIBUSB_STATE_DVB)
 			dvb_dmx_swfilter(&dib->demux, (u8*) urb->transfer_buffer,urb->actual_length);
 	} else 
@@ -73,6 +73,7 @@ static int dibusb_ctrl_feed(struct dvb_d
 				return -ENODEV;
 			}
 		}
+		dibusb_streaming(dib,0);
 	}
 	
 	dib->feedcount = newfeedcount;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c	2005-03-22 00:28:15.000000000 +0100
@@ -125,27 +125,6 @@ static int dibusb_tuner_quirk(struct usb
 	return 0;
 }
 
-/* there is a ugly pid_filter in the firmware of the umt devices, it is accessible
- * by i2c address 0x8. Don't know how to deactivate it and how many rows it has.
- */
-static int dibusb_umt_pid_control(struct dvb_frontend *fe, int index, int pid, int onoff)
-{
-	struct usb_dibusb *dib = fe->dvb->priv;
-	u8 b[3];
-	b[0] = index;
-	if (onoff) {
-		b[1] = (pid >> 8) & 0xff;
-		b[2] = pid & 0xff;
-	} else {
-		b[1] = 0;
-		b[2] = 0;
-	}
-	dibusb_i2c_msg(dib, 0x8, b, 3, NULL,0);
-	dibusb_set_streaming_mode(dib,0);
-	dibusb_set_streaming_mode(dib,1);
-	return 0;
-}
-
 int dibusb_fe_init(struct usb_dibusb* dib)
 {
 	struct dib3000_config demod_cfg;
@@ -160,6 +139,8 @@ int dibusb_fe_init(struct usb_dibusb* di
 			demod_cfg.pll_set = dibusb_general_pll_set;
 			demod_cfg.pll_init = dibusb_general_pll_init;
 
+			deb_info("demod id: %d %d\n",dib->dibdev->dev_cl->demod->id,DTT200U_FE);
+
 			switch (dib->dibdev->dev_cl->demod->id) {
 				case DIBUSB_DIB3000MB:
 					dib->fe = dib3000mb_attach(&demod_cfg,&dib->i2c_adap,&dib->xfer_ops);
@@ -170,7 +151,9 @@ int dibusb_fe_init(struct usb_dibusb* di
 				case DIBUSB_MT352:
 					mt352_hanftek_umt_010_config.demod_address = dib->dibdev->dev_cl->demod->i2c_addrs[i];
 					dib->fe = mt352_attach(&mt352_hanftek_umt_010_config, &dib->i2c_adap);
-					dib->xfer_ops.pid_ctrl = dibusb_umt_pid_control;
+				break;
+				case DTT200U_FE:
+					dib->fe = dtt200u_fe_attach(dib,&dib->xfer_ops);
 				break;
 			}
 			if (dib->fe != NULL) {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:27:58.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c	2005-03-22 00:28:15.000000000 +0100
@@ -57,7 +57,7 @@ int dibusb_readwrite_usb(struct usb_dibu
 /*
  * Cypress controls
  */
-static int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
+int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len)
 {
 	return dibusb_readwrite_usb(dib,buf,len,NULL,0);
 }
@@ -103,7 +103,14 @@ int dibusb_hw_wakeup(struct dvb_frontend
 	struct usb_dibusb *dib = (struct usb_dibusb *) fe->dvb->priv;
 	u8 b[1] = { DIBUSB_IOCTL_POWER_WAKEUP };
 	deb_info("dibusb-device is getting up.\n");
-	dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
+
+	switch (dib->dibdev->dev_cl->id) {
+		case DTT200U:
+			break;
+		default:
+			dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
+			break;
+	}
 
 	if (dib->fe_init)
 		return dib->fe_init(fe);
@@ -120,6 +127,7 @@ int dibusb_hw_sleep(struct dvb_frontend 
 	switch (dib->dibdev->dev_cl->id) {
 		case DIBUSB1_1:
 		case NOVAT_USB2:
+		case DTT200U:
 			break;
 		default:
 			dibusb_ioctl_cmd(dib,DIBUSB_IOCTL_CMD_POWER_MODE, b,1);
@@ -137,8 +145,47 @@ int dibusb_set_streaming_mode(struct usb
 	return dibusb_readwrite_usb(dib,b,2,NULL,0);
 }
 
+static int dibusb_urb_kill(struct usb_dibusb *dib)
+{
+	int i;
+deb_info("trying to kill urbs\n");
+	if (dib->init_state & DIBUSB_STATE_URB_SUBMIT) {
+		for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) {
+			deb_info("killing URB no. %d.\n",i);
+
+			/* stop the URB */
+			usb_kill_urb(dib->urb_list[i]);
+		}
+	} else
+	deb_info(" URBs not killed.\n");
+	dib->init_state &= ~DIBUSB_STATE_URB_SUBMIT;
+	return 0;
+}
+
+static int dibusb_urb_submit(struct usb_dibusb *dib)
+{
+	int i,ret;
+	if (dib->init_state & DIBUSB_STATE_URB_INIT) {
+		for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) {
+			deb_info("submitting URB no. %d\n",i);
+			if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) {
+				err("could not submit buffer urb no. %d - get them all back\n",i);
+				dibusb_urb_kill(dib);
+				return ret;
+			}
+			dib->init_state |= DIBUSB_STATE_URB_SUBMIT;
+		}
+	}
+	return 0;
+}
+
 int dibusb_streaming(struct usb_dibusb *dib,int onoff)
 {
+	if (onoff)
+		dibusb_urb_submit(dib);
+	else
+		dibusb_urb_kill(dib);
+
 	switch (dib->dibdev->dev_cl->id) {
 		case DIBUSB2_0:
 		case DIBUSB2_0B:
@@ -157,7 +204,7 @@ int dibusb_streaming(struct usb_dibusb *
 
 int dibusb_urb_init(struct usb_dibusb *dib)
 {
-	int ret,i,bufsize,def_pid_parse = 1;
+	int i,bufsize,def_pid_parse = 1;
 
 	/*
 	 * when reloading the driver w/o replugging the device
@@ -192,7 +239,6 @@ int dibusb_urb_init(struct usb_dibusb *d
 		if (!(dib->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) {
 			return -ENOMEM;
 		}
-		deb_info("submitting URB no. %d\n",i);
 
 		usb_fill_bulk_urb( dib->urb_list[i], dib->udev,
 				usb_rcvbulkpipe(dib->udev,dib->dibdev->dev_cl->pipe_data),
@@ -202,11 +248,7 @@ int dibusb_urb_init(struct usb_dibusb *d
 
 		dib->urb_list[i]->transfer_flags = 0;
 
-		if ((ret = usb_submit_urb(dib->urb_list[i],GFP_ATOMIC))) {
-			err("could not submit buffer urb no. %d\n",i);
-			return ret;
-		}
-		dib->init_state |= DIBUSB_STATE_URB_SUBMIT;
+		dib->init_state |= DIBUSB_STATE_URB_INIT;
 	}
 
 	/* dib->pid_parse here contains the value of the module parameter */
@@ -234,14 +276,12 @@ int dibusb_urb_init(struct usb_dibusb *d
 int dibusb_urb_exit(struct usb_dibusb *dib)
 {
 	int i;
+
+	dibusb_urb_kill(dib);
+
 	if (dib->init_state & DIBUSB_STATE_URB_LIST) {
 		for (i = 0; i < dib->dibdev->dev_cl->urb_count; i++) {
 			if (dib->urb_list[i] != NULL) {
-				deb_info("killing URB no. %d.\n",i);
-
-				/* stop the URBs */
-				usb_kill_urb(dib->urb_list[i]);
-
 				deb_info("freeing URB no. %d.\n",i);
 				/* free the URBs */
 				usb_free_urb(dib->urb_list[i]);
@@ -249,7 +289,6 @@ int dibusb_urb_exit(struct usb_dibusb *d
 		}
 		/* free the urb array */
 		kfree(dib->urb_list);
-		dib->init_state &= ~DIBUSB_STATE_URB_SUBMIT;
 		dib->init_state &= ~DIBUSB_STATE_URB_LIST;
 	}
 
@@ -259,5 +298,6 @@ int dibusb_urb_exit(struct usb_dibusb *d
 			dib->buffer,dib->dma_handle);
 
 	dib->init_state &= ~DIBUSB_STATE_URB_BUF;
+	dib->init_state &= ~DIBUSB_STATE_URB_INIT;
 	return 0;
 }
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:18:30.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h	2005-03-22 00:28:15.000000000 +0100
@@ -74,6 +74,7 @@ typedef enum {
 	UMT2_0,
 	DIBUSB2_0B,
 	NOVAT_USB2,
+	DTT200U,
 } dibusb_class_t;
 
 typedef enum {
@@ -87,6 +88,7 @@ typedef enum {
 	DIBUSB_DIB3000MB = 0,
 	DIBUSB_DIB3000MC,
 	DIBUSB_MT352,
+	DTT200U_FE,
 } dibusb_demodulator_t;
 
 typedef enum {
@@ -155,10 +157,11 @@ struct usb_dibusb {
 #define DIBUSB_STATE_INIT       0x000
 #define DIBUSB_STATE_URB_LIST   0x001
 #define DIBUSB_STATE_URB_BUF    0x002
-#define DIBUSB_STATE_URB_SUBMIT 0x004
+#define DIBUSB_STATE_URB_INIT	0x004
 #define DIBUSB_STATE_DVB        0x008
 #define DIBUSB_STATE_I2C        0x010
 #define DIBUSB_STATE_REMOTE		0x020
+#define DIBUSB_STATE_URB_SUBMIT 0x040
 	int init_state;
 
 	int feedcount;
@@ -223,6 +226,7 @@ int dibusb_dvb_exit(struct usb_dibusb *d
 /* dvb-dibusb-usb.c */
 int dibusb_readwrite_usb(struct usb_dibusb *dib, u8 *wbuf, u16 wlen, u8 *rbuf,
 	u16 rlen);
+int dibusb_write_usb(struct usb_dibusb *dib, u8 *buf, u16 len);
 
 int dibusb_hw_wakeup(struct dvb_frontend *);
 int dibusb_hw_sleep(struct dvb_frontend *);
@@ -232,6 +236,9 @@ int dibusb_streaming(struct usb_dibusb *
 int dibusb_urb_init(struct usb_dibusb *);
 int dibusb_urb_exit(struct usb_dibusb *);
 
+/* dvb-fe-dtt200u.c */
+struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *,struct dib_fe_xfer_ops *);
+
 /* i2c and transfer stuff */
 #define DIBUSB_I2C_TIMEOUT				5000
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c	2005-03-22 00:28:15.000000000 +0100
@@ -0,0 +1,258 @@
+/*
+ * dvb-dtt200u-fe.c is a driver which implements the frontend-part of the
+ * Yakumo/Typhoon/Hama USB2.0 boxes. It is hard-wired to the dibusb-driver as
+ * it uses the usb-transfer functions directly (maybe creating a
+ * generic-dvb-usb-lib for all usb-drivers will be reduce some more code.)
+ *
+ * Copyright (C) 2005 Patrick Boettcher <patrick.boettcher@desy.de>
+ *
+ * see dvb-dibusb-core.c for copyright details.
+ */
+
+/* guessed protocol description (reverse engineered):
+ * read
+ *  00 - USB type 0x02 for usb2.0, 0x01 for usb1.1
+ *  81 - <TS_LOCK> <current frequency divided by 250000>
+ *  82 - crash - do not touch
+ *  83 - crash - do not touch
+ *  84 - remote control
+ *  85 - crash - do not touch (OK, stop testing here)
+ *  88 - locking 2 bytes (0x80 0x40 == no signal, 0x89 0x20 == nice signal)
+ *  89 - noise-to-signal
+ *	8a - unkown 1 byte - signal_strength
+ *  8c - ber ???
+ *  8d - ber
+ *  8e - unc
+ *
+ * write
+ *  02 - bandwidth
+ *  03 - frequency (divided by 250000)
+ *  04 - pid table (index pid(7:0) pid(12:8))
+ *  05 - reset the pid table
+ *  08 - demod transfer enabled or not (FX2 transfer is enabled by default)
+ */
+
+#include "dvb-dibusb.h"
+#include "dvb_frontend.h"
+
+struct dtt200u_fe_state {
+	struct usb_dibusb *dib;
+
+	struct dvb_frontend_parameters fep;
+	struct dvb_frontend frontend;
+};
+
+#define moan(which,what) info("unexpected value in '%s' for cmd '%02x' - please report to linux-dvb@linuxtv.org",which,what)
+
+static int dtt200u_fe_read_status(struct dvb_frontend* fe, fe_status_t *stat)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 bw[1] = { 0x81 };
+	u8 br[3] = { 0 };
+//	u8 bdeb[5] = { 0 };
+
+	dibusb_readwrite_usb(state->dib,bw,1,br,3);
+	switch (br[0]) {
+		case 0x01:
+			*stat = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC | FE_HAS_LOCK;
+			break;
+		case 0x00:
+			*stat = 0;
+			break;
+		default:
+			moan("br[0]",0x81);
+			break;
+	}
+
+//	bw[0] = 0x88;
+//	dibusb_readwrite_usb(state->dib,bw,1,bdeb,5);
+
+//	deb_info("%02x: %02x %02x %02x %02x %02x\n",bw[0],bdeb[0],bdeb[1],bdeb[2],bdeb[3],bdeb[4]);
+
+	return 0;
+}
+static int dtt200u_fe_read_ber(struct dvb_frontend* fe, u32 *ber)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 bw[1] = { 0x8d };
+	*ber = 0;
+	dibusb_readwrite_usb(state->dib,bw,1,(u8*) ber, 3);
+	return 0;
+}
+
+static int dtt200u_fe_read_unc_blocks(struct dvb_frontend* fe, u32 *unc)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 bw[1] = { 0x8c };
+	*unc = 0;
+	dibusb_readwrite_usb(state->dib,bw,1,(u8*) unc, 3);
+	return 0;
+}
+
+static int dtt200u_fe_read_signal_strength(struct dvb_frontend* fe, u16 *strength)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 bw[1] = { 0x8a };
+	u8 b;
+	dibusb_readwrite_usb(state->dib,bw,1,&b, 1);
+	*strength = (b << 8) | b;
+	return 0;
+}
+
+static int dtt200u_fe_read_snr(struct dvb_frontend* fe, u16 *snr)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 bw[1] = { 0x89 };
+	u8 br[1] = { 0 };
+	dibusb_readwrite_usb(state->dib,bw,1,br,1);
+	*snr = ((0xff - br[0]) << 8) | (0xff - br[0]);
+	return 0;
+}
+
+static int dtt200u_fe_init(struct dvb_frontend* fe)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u8 b[] = { 0x01 };
+	return dibusb_write_usb(state->dib,b,1);
+}
+
+static int dtt200u_fe_sleep(struct dvb_frontend* fe)
+{
+	return dtt200u_fe_init(fe);
+}
+
+static int dtt200u_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings *tune)
+{
+	tune->min_delay_ms = 1500;
+	tune->step_size = 166667;
+	tune->max_drift = 166667 * 2;
+	return 0;
+}
+
+static int dtt200u_fe_set_frontend(struct dvb_frontend* fe,
+				  struct dvb_frontend_parameters *fep)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	u16 freq = fep->frequency / 250000;
+	u8 bw,bwbuf[2] = { 0x03, 0 }, freqbuf[3] = { 0x02, 0, 0 };
+
+	switch (fep->u.ofdm.bandwidth) {
+		case BANDWIDTH_8_MHZ: bw = 8; break;
+		case BANDWIDTH_7_MHZ: bw = 7; break;
+		case BANDWIDTH_6_MHZ: bw = 6; break;
+		case BANDWIDTH_AUTO: return -EOPNOTSUPP;
+		default:
+			return -EINVAL;
+	}
+	deb_info("set_frontend\n");
+
+	bwbuf[1] = bw;
+	dibusb_write_usb(state->dib,bwbuf,2);
+
+	freqbuf[1] = freq & 0xff;
+	freqbuf[2] = (freq >> 8) & 0xff;
+	dibusb_write_usb(state->dib,freqbuf,3);
+
+	memcpy(&state->fep,fep,sizeof(struct dvb_frontend_parameters));
+
+	return 0;
+}
+
+static int dtt200u_fe_get_frontend(struct dvb_frontend* fe,
+				  struct dvb_frontend_parameters *fep)
+{
+	struct dtt200u_fe_state *state = fe->demodulator_priv;
+	memcpy(fep,&state->fep,sizeof(struct dvb_frontend_parameters));
+	return 0;
+}
+
+static void dtt200u_fe_release(struct dvb_frontend* fe)
+{
+	struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv;
+	kfree(state);
+}
+
+static int dtt200u_pid_control(struct dvb_frontend *fe,int index, int pid,int onoff)
+{
+	struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv;
+	pid = onoff ? pid : 0;
+	u8 b_pid[4] = { 0x04, index, pid & 0xff, (pid >> 8) & 0xff };
+
+	dibusb_write_usb(state->dib,b_pid,4);
+	return 0;
+}
+
+static int dtt200u_fifo_control(struct dvb_frontend *fe, int onoff)
+{
+	struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv;
+	u8 b_streaming[2] = { 0x08, onoff };
+	u8 b_rst_pid[1] = { 0x05 };
+
+	dibusb_write_usb(state->dib,b_streaming,2);
+
+	if (!onoff)
+		dibusb_write_usb(state->dib,b_rst_pid,1);
+	return 0;
+}
+
+static struct dvb_frontend_ops dtt200u_fe_ops;
+
+struct dvb_frontend* dtt200u_fe_attach(struct usb_dibusb *dib, struct dib_fe_xfer_ops *xfer_ops)
+{
+	struct dtt200u_fe_state* state = NULL;
+
+	/* allocate memory for the internal state */
+	state = (struct dtt200u_fe_state*) kmalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL);
+	if (state == NULL)
+		goto error;
+	memset(state,0,sizeof(struct dtt200u_fe_state));
+
+	deb_info("attaching frontend dtt200u\n");
+
+	state->dib = dib;
+
+	state->frontend.ops = &dtt200u_fe_ops;
+	state->frontend.demodulator_priv = state;
+
+	xfer_ops->fifo_ctrl = dtt200u_fifo_control;
+	xfer_ops->pid_ctrl = dtt200u_pid_control;
+
+	goto success;
+error:
+	return NULL;
+success:
+	return &state->frontend;
+}
+
+static struct dvb_frontend_ops dtt200u_fe_ops = {
+	.info = {
+		.name			= "DTT200U (Yakumo/Typhoon/Hama) DVB-T",
+		.type			= FE_OFDM,
+		.frequency_min		= 44250000,
+		.frequency_max		= 867250000,
+		.frequency_stepsize	= 250000,
+		.caps = FE_CAN_INVERSION_AUTO |
+				FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
+				FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
+				FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_QAM_64 | FE_CAN_QAM_AUTO |
+				FE_CAN_TRANSMISSION_MODE_AUTO |
+				FE_CAN_GUARD_INTERVAL_AUTO |
+				FE_CAN_RECOVER |
+				FE_CAN_HIERARCHY_AUTO,
+	},
+
+	.release = dtt200u_fe_release,
+
+	.init = dtt200u_fe_init,
+	.sleep = dtt200u_fe_sleep,
+
+	.set_frontend = dtt200u_fe_set_frontend,
+	.get_frontend = dtt200u_fe_get_frontend,
+	.get_tune_settings = dtt200u_fe_get_tune_settings,
+
+	.read_status = dtt200u_fe_read_status,
+	.read_ber = dtt200u_fe_read_ber,
+	.read_signal_strength = dtt200u_fe_read_signal_strength,
+	.read_snr = dtt200u_fe_read_snr,
+	.read_ucblocks = dtt200u_fe_read_unc_blocks,
+};
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c	2005-03-22 00:28:15.000000000 +0100
@@ -712,6 +712,7 @@ struct dvb_frontend* dib3000mb_attach(co
 	state = (struct dib3000_state*) kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);
 	if (state == NULL)
 		goto error;
+	memset(state,0,sizeof(struct dib3000_state));
 
 	/* setup the state */
 	state->i2c = i2c;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c	2005-03-22 00:28:15.000000000 +0100
@@ -847,6 +847,7 @@ struct dvb_frontend* dib3000mc_attach(co
 	state = (struct dib3000_state*) kmalloc(sizeof(struct dib3000_state), GFP_KERNEL);
 	if (state == NULL)
 		goto error;
+	memset(state,0,sizeof(struct dib3000_state));
 
 	/* setup the state */
 	state->i2c = i2c;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 44/48] sparse warnings on one-bit bitfields
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (42 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 43/48] dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 45/48] support Nova-S rev 2.2 Johannes Stezenbach
                   ` (3 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Peter Hagervall

[-- Attachment #1: dvb-sparse-cleanup.patch --]
[-- Type: text/plain, Size: 1014 bytes --]

Remove some sparse warnings on one-bit bitfields.

Signed-off-by: Peter Hagervall <hager@cs.umu.se>
Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb_ca_en50221.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:28:04.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	2005-03-22 00:28:26.000000000 +0100
@@ -148,13 +148,13 @@ struct dvb_ca_private {
 	wait_queue_head_t thread_queue;
 
 	/* Flag indicating when thread should exit */
-	int exit:1;
+	unsigned int exit:1;
 
 	/* Flag indicating if the CA device is open */
-	int open:1;
+	unsigned int open:1;
 
 	/* Flag indicating the thread should wake up now */
-	int wakeup:1;
+	unsigned int wakeup:1;
 
 	/* Delay the main thread should use */
 	unsigned long delay;

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 45/48] support Nova-S rev 2.2
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (43 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 44/48] sparse warnings on one-bit bitfields Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 46/48] ttusb_dec: cleanup Johannes Stezenbach
                   ` (2 subsequent siblings)
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttusb-budget-novas22.patch --]
[-- Type: text/plain, Size: 7173 bytes --]

Support for Nova-S rev 2.2 (Gregor Kroesen)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dvb-ttusb-budget.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 94 insertions(+), 13 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-22 00:17:50.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	2005-03-22 00:28:34.000000000 +0100
@@ -68,6 +68,7 @@ MODULE_PARM_DESC(debug, "Turn on/off deb
 #define TTUSB_MAXFILTER    16	/* ??? */
 #endif
 
+#define TTUSB_REV_2_2	0x22
 #define TTUSB_BUDGET_NAME "ttusb_stc_fw"
 
 /**
@@ -120,6 +121,8 @@ struct ttusb {
 
 	u8 last_result[32];
 
+	int revision;
+
 #if 0
 	devfs_handle_t stc_devfs_handle;
 #endif
@@ -432,13 +435,17 @@ static int ttusb_init_controller(struct 
 
 	if (memcmp(get_version + 4, "V 0.0", 5) &&
 	    memcmp(get_version + 4, "V 1.1", 5) &&
-	    memcmp(get_version + 4, "V 2.1", 5)) {
+	    memcmp(get_version + 4, "V 2.1", 5) &&
+	    memcmp(get_version + 4, "V 2.2", 5)) {
 		printk
 		    ("%s: unknown STC version %c%c%c%c%c, please report!\n",
 		     __FUNCTION__, get_version[4], get_version[5],
 		     get_version[6], get_version[7], get_version[8]);
 	}
 
+	ttusb->revision = ((get_version[6] - '0') << 4) |
+			   (get_version[8] - '0');
+
 	err =
 	    ttusb_cmd(ttusb, get_dsp_version, sizeof(get_dsp_version), 1);
 	if (err)
@@ -478,6 +485,31 @@ static int ttusb_send_diseqc(struct dvb_
 }
 #endif
 
+static int lnbp21_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage)
+{
+        struct  ttusb* ttusb = (struct ttusb*)  fe->dvb->priv;
+        int ret;
+        u8 data[1];
+        struct i2c_msg msg = { .addr = 0x08, .flags = 0, .buf = data, .len = sizeof(data) };
+
+        switch(voltage) {
+        case SEC_VOLTAGE_OFF:
+                data[0] = 0x00;
+                break;
+        case SEC_VOLTAGE_13:
+                data[0] = 0x44;
+                break;
+        case SEC_VOLTAGE_18:
+                data[0] = 0x4c;
+                break;
+        default:
+                return -EINVAL;
+        };
+
+        ret = i2c_transfer(&ttusb->i2c_adap, &msg, 1);
+        return (ret != 1) ? -EIO : 0;
+}
+
 static int ttusb_update_lnb(struct ttusb *ttusb)
 {
 	u8 b[] = { 0xaa, ++ttusb->c, 0x16, 5, /*power: */ 1,
@@ -1148,10 +1180,51 @@ static struct tda1004x_config philips_td
 	.request_firmware = philips_tdm1316l_request_firmware,
 };
 
+static u8 alps_bsbe1_inittab[] = {
+        0x01, 0x15,
+        0x02, 0x30,
+        0x03, 0x00,
+        0x04, 0x7d,             /* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
+        0x05, 0x35,             /* I2CT = 0, SCLT = 1, SDAT = 1 */
+        0x06, 0x40,             /* DAC not used, set to high impendance mode */
+        0x07, 0x00,             /* DAC LSB */
+        0x08, 0x40,             /* DiSEqC off, LNB power on OP2/LOCK pin on */
+        0x09, 0x00,             /* FIFO */
+        0x0c, 0x51,             /* OP1 ctl = Normal, OP1 val = 1 (LNB Power ON) */
+        0x0d, 0x82,             /* DC offset compensation = ON, beta_agc1 = 2 */
+        0x0e, 0x23,             /* alpha_tmg = 2, beta_tmg = 3 */
+        0x10, 0x3f,             // AGC2  0x3d
+        0x11, 0x84,
+        0x12, 0xb5,             // Lock detect: -64  Carrier freq detect:on
+        0x15, 0xc9,             // lock detector threshold
+        0x16, 0x00,
+        0x17, 0x00,
+        0x18, 0x00,
+        0x19, 0x00,
+        0x1a, 0x00,
+        0x1f, 0x50,
+        0x20, 0x00,
+        0x21, 0x00,
+        0x22, 0x00,
+        0x23, 0x00,
+        0x28, 0x00,             // out imp: normal  out type: parallel FEC mode:0
+        0x29, 0x1e,             // 1/2 threshold
+        0x2a, 0x14,             // 2/3 threshold
+        0x2b, 0x0f,             // 3/4 threshold
+        0x2c, 0x09,             // 5/6 threshold
+        0x2d, 0x05,             // 7/8 threshold
+        0x2e, 0x01,
+        0x31, 0x1f,             // test all FECs
+        0x32, 0x19,             // viterbi and synchro search
+        0x33, 0xfc,             // rs control
+        0x34, 0x93,             // error control
+        0x0f, 0x92,
+        0xff, 0xff
+};
 
 static u8 alps_bsru6_inittab[] = {
 	0x01, 0x15,
-	0x02, 0x00,
+	0x02, 0x30,
 	0x03, 0x00,
 	0x04, 0x7d,		/* F22FR = 0x7d, F22 = f_VCO / 128 / 0x7d = 22 kHz */
 	0x05, 0x35,		/* I2CT = 0, SCLT = 1, SDAT = 1 */
@@ -1191,7 +1264,7 @@ static u8 alps_bsru6_inittab[] = {
 	0xff, 0xff
 };
 
-static int alps_bsru6_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
+static int alps_stv0299_set_symbol_rate(struct dvb_frontend *fe, u32 srate, u32 ratio)
 {
 	u8 aclk = 0;
 	u8 bclk = 0;
@@ -1225,7 +1298,7 @@ static int alps_bsru6_set_symbol_rate(st
 	return 0;
 }
 
-static int alps_bsru6_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+static int philips_tsa5059_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
 {
 	struct ttusb* ttusb = (struct ttusb*) fe->dvb->priv;
 	u8 buf[4];
@@ -1242,7 +1315,11 @@ static int alps_bsru6_pll_set(struct dvb
 	buf[3] = 0xC4;
 
 	if (params->frequency > 1530000)
-		buf[3] = 0xc0;
+		buf[3] = 0xC0;
+
+	/* BSBE1 wants XCE bit set */
+	if (ttusb->revision == TTUSB_REV_2_2)
+		buf[3] |= 0x20;
 
 	if (i2c_transfer(&ttusb->i2c_adap, &msg, 1) != 1)
 		return -EIO;
@@ -1250,8 +1327,7 @@ static int alps_bsru6_pll_set(struct dvb
 	return 0;
 }
 
-static struct stv0299_config alps_bsru6_config = {
-
+static struct stv0299_config alps_stv0299_config = {
 	.demod_address = 0x68,
 	.inittab = alps_bsru6_inittab,
 	.mclk = 88000000UL,
@@ -1261,8 +1337,8 @@ static struct stv0299_config alps_bsru6_
 	.lock_output = STV0229_LOCKOUTPUT_1,
 	.volt13_op0_op1 = STV0299_VOLT13_OP1,
 	.min_delay_ms = 100,
-	.set_symbol_rate = alps_bsru6_set_symbol_rate,
-	.pll_set = alps_bsru6_pll_set,
+	.set_symbol_rate = alps_stv0299_set_symbol_rate,
+	.pll_set = philips_tsa5059_pll_set,
 };
 
 static int ttusb_novas_grundig_29504_491_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
@@ -1296,11 +1372,16 @@ static struct tda8083_config ttusb_novas
 static void frontend_init(struct ttusb* ttusb)
 {
 	switch(le16_to_cpu(ttusb->dev->descriptor.idProduct)) {
-	case 0x1003: // Hauppauge/TT Nova-USB-S budget (stv0299/ALPS BSRU6(tsa5059)
-		// try the ALPS BSRU6 first
-		ttusb->fe = stv0299_attach(&alps_bsru6_config, &ttusb->i2c_adap);
+	case 0x1003: // Hauppauge/TT Nova-USB-S budget (stv0299/ALPS BSRU6|BSBE1(tsa5059))
+		// try the stv0299 based first
+		ttusb->fe = stv0299_attach(&alps_stv0299_config, &ttusb->i2c_adap);
 		if (ttusb->fe != NULL) {
-			ttusb->fe->ops->set_voltage = ttusb_set_voltage;
+			if(ttusb->revision == TTUSB_REV_2_2) { // ALPS BSBE1
+				alps_stv0299_config.inittab = alps_bsbe1_inittab;
+				ttusb->fe->ops->set_voltage = lnbp21_set_voltage;
+			} else { // ALPS BSRU6
+				ttusb->fe->ops->set_voltage = ttusb_set_voltage;
+			}
 			break;
 		}
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 46/48] ttusb_dec: cleanup
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (44 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 45/48] support Nova-S rev 2.2 Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 47/48] gcc 2.95 compile fixes Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 48/48] mt352: cleanups Johannes Stezenbach
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-ttusb-dec-cleanup.patch --]
[-- Type: text/plain, Size: 3593 bytes --]

Cleanup patch from Peter Beutner:

o unregister the input device on disconnect
  and move cleanup stuff of the RC to own function
o keymap should be static not const
o set up keymap correctly and completly for input device
  plus a more cosmetic one:
o usb endpoints are only 4bit numbers[0...15], the 8th bit
  only specifies the direction and is set by the snd/rcvxxxpipe() macro

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 ttusb_dec.c |   49 +++++++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 20 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-22 00:18:46.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2005-03-22 00:29:05.000000000 +0100
@@ -58,10 +58,10 @@ MODULE_PARM_DESC(enable_rc, "Turn on/off
 #define DRIVER_NAME		"TechnoTrend/Hauppauge DEC USB"
 
 #define COMMAND_PIPE		0x03
-#define RESULT_PIPE		0x84
-#define IN_PIPE			0x88
+#define RESULT_PIPE		0x04
+#define IN_PIPE			0x08
 #define OUT_PIPE		0x07
-#define IRQ_PIPE		0x8A
+#define IRQ_PIPE		0x0A
 
 #define COMMAND_PACKET_SIZE	0x3c
 #define ARM_PACKET_SIZE		0x1000
@@ -170,7 +170,7 @@ struct filter_info {
 	struct list_head	filter_info_list;
 };
 
-const uint16_t  rc_keys[] = {
+static u16 rc_keys[] = {
 	KEY_POWER,
 	KEY_MUTE,
 	KEY_1,
@@ -1191,8 +1191,9 @@ static void ttusb_init_rc( struct ttusb_
 
 	dec->rc_input_dev.name = "ttusb_dec remote control";
 	dec->rc_input_dev.evbit[0] = BIT(EV_KEY);
-	dec->rc_input_dev.keycodesize = sizeof(unsigned char);
-	dec->rc_input_dev.keycodemax = KEY_MAX;
+	dec->rc_input_dev.keycodesize = sizeof(u16);
+	dec->rc_input_dev.keycodemax = 0x1a;
+	dec->rc_input_dev.keycode = rc_keys;
 
 	 for (i = 0; i < sizeof(rc_keys)/sizeof(rc_keys[0]); i++)
                 set_bit(rc_keys[i], dec->rc_input_dev.keybit);
@@ -1498,6 +1499,26 @@ static void ttusb_dec_exit_dvb(struct tt
 	dvb_unregister_adapter(dec->adapter);
 }
 
+static void ttusb_dec_exit_rc(struct ttusb_dec *dec)
+{
+
+	dprintk("%s\n", __FUNCTION__);
+	/* we have to check whether the irq URB is already submitted.
+	  * As the irq is submitted after the interface is changed,
+	  * this is the best method i figured out.
+	  * Any others?*/
+	if(dec->interface == TTUSB_DEC_INTERFACE_IN)
+		usb_kill_urb(dec->irq_urb);
+
+	usb_free_urb(dec->irq_urb);
+
+	usb_buffer_free(dec->udev,IRQ_PACKET_SIZE,
+		           dec->irq_buffer, dec->irq_dma_handle);
+
+	input_unregister_device(&dec->rc_input_dev);
+}
+
+
 static void ttusb_dec_exit_usb(struct ttusb_dec *dec)
 {
 	int i;
@@ -1510,20 +1531,6 @@ static void ttusb_dec_exit_usb(struct tt
 		usb_kill_urb(dec->iso_urb[i]);
 
 	ttusb_dec_free_iso_urbs(dec);
-
-	if(enable_rc) {
-		/* we have to check whether the irq URB is already submitted.
-		 * As the irq is submitted after the interface is changed,
-		 * this is the best method i figured out.
-		 * Any other possibilities?*/
-		if(dec->interface == TTUSB_DEC_INTERFACE_IN)
-			usb_kill_urb(dec->irq_urb);
-
-		usb_free_urb(dec->irq_urb);
-
-		usb_buffer_free(dec->udev,IRQ_PACKET_SIZE,
-					dec->irq_buffer, dec->irq_dma_handle);
-	}
 }
 
 static void ttusb_dec_exit_tasklet(struct ttusb_dec *dec)
@@ -1663,6 +1670,8 @@ static void ttusb_dec_disconnect(struct 
 	if (dec->active) {
 		ttusb_dec_exit_tasklet(dec);
 		ttusb_dec_exit_filters(dec);
+		if(enable_rc)
+			ttusb_dec_exit_rc(dec);
 		ttusb_dec_exit_usb(dec);
 		ttusb_dec_exit_dvb(dec);
 	}

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 47/48] gcc 2.95 compile fixes
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (45 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 46/48] ttusb_dec: cleanup Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  2005-03-22  1:24 ` [DVB patch 48/48] mt352: cleanups Johannes Stezenbach
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-gcc-295-fixes.patch --]
[-- Type: text/plain, Size: 3289 bytes --]

Patch by Olaf Titz: gcc 2.95 compile fixes

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 dibusb/dvb-dibusb-core.c |    2 +-
 dibusb/dvb-fe-dtt200u.c  |    7 ++++++-
 ttpci/av7110_ir.c        |    4 ++--
 ttpci/budget-av.c        |    2 +-
 4 files changed, 10 insertions(+), 5 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:28:15.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c	2005-03-22 00:30:44.000000000 +0100
@@ -425,8 +425,8 @@ static struct dibusb_usb_device * dibusb
 static struct dibusb_usb_device * dibusb_find_device (struct usb_device *udev,int *cold)
 {
 	int i,j;
-	*cold = -1;
 	struct dibusb_usb_device *dev = NULL;
+	*cold = -1;
 
 	for (i = 0; i < sizeof(dibusb_devices)/sizeof(struct dibusb_usb_device); i++) {
 		for (j = 0; j < DIBUSB_ID_MAX_NUM && dibusb_devices[i].cold_ids[j] != NULL; j++) {
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c	2005-03-22 00:28:15.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c	2005-03-22 00:30:44.000000000 +0100
@@ -175,8 +175,13 @@ static void dtt200u_fe_release(struct dv
 static int dtt200u_pid_control(struct dvb_frontend *fe,int index, int pid,int onoff)
 {
 	struct dtt200u_fe_state *state = (struct dtt200u_fe_state*) fe->demodulator_priv;
+	u8 b_pid[4];
 	pid = onoff ? pid : 0;
-	u8 b_pid[4] = { 0x04, index, pid & 0xff, (pid >> 8) & 0xff };
+
+	b_pid[0] = 0x04;
+	b_pid[1] = index;
+	b_pid[2] = pid & 0xff;
+	b_pid[3] = (pid >> 8) & 0xff;
 
 	dibusb_write_usb(state->dib,b_pid,4);
 	return 0;
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/av7110_ir.c	2005-03-22 00:17:56.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c	2005-03-22 00:30:44.000000000 +0100
@@ -161,11 +161,11 @@ static int av7110_ir_write_proc(struct f
 
 int __init av7110_ir_init(void)
 {
+	static struct proc_dir_entry *e;
+
 	if (ir_initialized)
 		return 0;
 
-	static struct proc_dir_entry *e;
-
 	init_timer(&keyup_timer);
 	keyup_timer.data = 0;
 
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/ttpci/budget-av.c	2005-03-22 00:23:49.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c	2005-03-22 00:30:44.000000000 +0100
@@ -188,6 +188,7 @@ static int ciintf_slot_reset(struct dvb_
 {
 	struct budget_av *budget_av = (struct budget_av *) ca->data;
 	struct saa7146_dev *saa = budget_av->budget.dev;
+	int max = 20;
 
 	if (slot != 0)
 		return -EINVAL;
@@ -199,7 +200,6 @@ static int ciintf_slot_reset(struct dvb_
 	msleep(100);
 	saa7146_setgpio(saa, 0, SAA7146_GPIO_OUTLO);
 
-	int max = 20;
 	while (--max > 0 && ciintf_read_attribute_mem(ca, slot, 0) != 0x1d)
 		msleep(100);
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* [DVB patch 48/48] mt352: cleanups
  2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
                   ` (46 preceding siblings ...)
  2005-03-22  1:24 ` [DVB patch 47/48] gcc 2.95 compile fixes Johannes Stezenbach
@ 2005-03-22  1:24 ` Johannes Stezenbach
  47 siblings, 0 replies; 50+ messages in thread
From: Johannes Stezenbach @ 2005-03-22  1:24 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: dvb-frontend-mt352-cleanup.patch --]
[-- Type: text/plain, Size: 8289 bytes --]

o remove s* from state, they are only used in read_status
o remove casting of void*
o remove FIXME in set_parameters, should be handled by dvb-core state machine
o remove some unnecessary braces
o remove #if 1 in read_status, and add note from Zarlink design manual
o change read_signal_strength to read total AGC_GAIN in case
  some adapter turns on the RF_AGC loop.
(Kenneth Aafloy)

Signed-off-by: Johannes Stezenbach <js@linuxtv.org>

 mt352.c |  105 +++++++++++++++++++++++-----------------------------------------
 1 files changed, 39 insertions(+), 66 deletions(-)

Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
--- linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/mt352.c	2005-03-22 00:27:13.000000000 +0100
+++ linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c	2005-03-22 00:30:54.000000000 +0100
@@ -42,13 +42,11 @@
 
 struct mt352_state {
 	struct i2c_adapter* i2c;
+	struct dvb_frontend frontend;
 	struct dvb_frontend_ops ops;
 
 	/* configuration settings */
 	const struct mt352_config* config;
-	int s0,s1,s3;
-
-	struct dvb_frontend frontend;
 };
 
 static int debug;
@@ -59,7 +57,7 @@ static int debug;
 
 static int mt352_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 	u8 buf[2] = { reg, val };
 	struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0,
 			       .buf = buf, .len = 2 };
@@ -170,7 +168,7 @@ static void mt352_calc_input_freq(struct
 static int mt352_set_parameters(struct dvb_frontend* fe,
 				struct dvb_frontend_parameters *param)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 	unsigned char buf[13];
 	static unsigned char tuner_go[] = { 0x5d, 0x01 };
 	static unsigned char fsm_go[]   = { 0x5e, 0x01 };
@@ -293,20 +291,6 @@ static int mt352_set_parameters(struct d
 	mt352_calc_input_freq(state, buf+6);
 	state->config->pll_set(fe, param, buf+8);
 
-#if 0 /* FIXME: should be catched elsewhere ... */
-	/* this dubious code which helped on some cards does not work for
-	 * the pinnacle 300i */
-	/* 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))
-			break;
-	if (13 == i)
-		/* no changes */
-		return 0;
-#endif
-
 	mt352_write(fe, buf, sizeof(buf));
 	if (state->config->no_tuner) {
 		/* start decoding */
@@ -321,7 +305,7 @@ static int mt352_set_parameters(struct d
 static int mt352_get_parameters(struct dvb_frontend* fe,
 				struct dvb_frontend_parameters *param)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 	u16 tps;
 	u16 div;
 	u8 trl;
@@ -339,9 +323,7 @@ static int mt352_get_parameters(struct d
 	};
 
 	if ( (mt352_read_register(state,0x00) & 0xC0) != 0xC0 )
-	{
 		return -EINVAL;
-	}
 
 	/* Use TPS_RECEIVED-registers, not the TPS_CURRENT-registers because
 	 * the mt352 sometimes works with the wrong parameters
@@ -412,17 +394,11 @@ static int mt352_get_parameters(struct d
 	param->frequency = ( 500 * (div - IF_FREQUENCYx6) ) / 3 * 1000;
 
 	if (trl == 0x72)
-	{
 		op->bandwidth = BANDWIDTH_8_MHZ;
-	}
 	else if (trl == 0x64)
-	{
 		op->bandwidth = BANDWIDTH_7_MHZ;
-	}
 	else
-	{
 		op->bandwidth = BANDWIDTH_6_MHZ;
-	}
 
 
 	if (mt352_read_register(state, STATUS_2) & 0x02)
@@ -435,41 +411,38 @@ static int mt352_get_parameters(struct d
 
 static int mt352_read_status(struct dvb_frontend* fe, fe_status_t* status)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
-#if 1
-	/* the pinnacle 300i loses lock if the STATUS_x registers
-	 * are polled too often... */
-	int val;
-
-	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
+	struct mt352_state* state = fe->demodulator_priv;
+	int s0, s1, s3;
+
+	/* FIXME:
+	 *
+	 * The MT352 design manual from Zarlink states (page 46-47):
+	 *
+	 * Notes about the TUNER_GO register:
+	 *
+	 * If the Read_Tuner_Byte (bit-1) is activated, then the tuner status
+	 * byte is copied from the tuner to the STATUS_3 register and
+	 * completion of the read operation is indicated by bit-5 of the
+	 * INTERRUPT_3 register.
+	 */
+
+	if ((s0 = mt352_read_register(state, STATUS_0)) < 0)
+		return -EREMOTEIO;
+	if ((s1 = mt352_read_register(state, STATUS_1)) < 0)
+		return -EREMOTEIO;
+	if ((s3 = mt352_read_register(state, STATUS_3)) < 0)
+		return -EREMOTEIO;
 
 	*status = 0;
-	if (state->s0 & (1 << 4))
+	if (s0 & (1 << 4))
 		*status |= FE_HAS_CARRIER;
-	if (state->s0 & (1 << 1))
+	if (s0 & (1 << 1))
 		*status |= FE_HAS_VITERBI;
-	if (state->s0 & (1 << 5))
+	if (s0 & (1 << 5))
 		*status |= FE_HAS_LOCK;
-	if (state->s1 & (1 << 1))
+	if (s1 & (1 << 1))
 		*status |= FE_HAS_SYNC;
-	if (state->s3 & (1 << 6))
+	if (s3 & (1 << 6))
 		*status |= FE_HAS_SIGNAL;
 
 	if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
@@ -481,7 +454,7 @@ static int mt352_read_status(struct dvb_
 
 static int mt352_read_ber(struct dvb_frontend* fe, u32* ber)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 
 	*ber = (mt352_read_register (state, RS_ERR_CNT_2) << 16) |
 	       (mt352_read_register (state, RS_ERR_CNT_1) << 8) |
@@ -492,10 +465,10 @@ static int mt352_read_ber(struct dvb_fro
 
 static int mt352_read_signal_strength(struct dvb_frontend* fe, u16* strength)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 
-	u16 signal = (mt352_read_register (state, AGC_GAIN_3) << 8) |
-		     (mt352_read_register (state, AGC_GAIN_2));
+	u16 signal = ((mt352_read_register(state, AGC_GAIN_1) << 8) & 0x0f) |
+		      (mt352_read_register(state, AGC_GAIN_0));
 
 	*strength = ~signal;
 	return 0;
@@ -503,7 +476,7 @@ static int mt352_read_signal_strength(st
 
 static int mt352_read_snr(struct dvb_frontend* fe, u16* snr)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 
 	u8 _snr = mt352_read_register (state, SNR);
 	*snr = (_snr << 8) | _snr;
@@ -513,7 +486,7 @@ static int mt352_read_snr(struct dvb_fro
 
 static int mt352_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 
 	*ucblocks = (mt352_read_register (state,  RS_UBC_1) << 8) |
 		    (mt352_read_register (state,  RS_UBC_0));
@@ -532,7 +505,7 @@ static int mt352_get_tune_settings(struc
 
 static int mt352_init(struct dvb_frontend* fe)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 
 	static u8 mt352_reset_attach [] = { RESET, 0xC0 };
 
@@ -551,7 +524,7 @@ static int mt352_init(struct dvb_fronten
 
 static void mt352_release(struct dvb_frontend* fe)
 {
-	struct mt352_state* state = (struct mt352_state*) fe->demodulator_priv;
+	struct mt352_state* state = fe->demodulator_priv;
 	kfree(state);
 }
 
@@ -563,7 +536,7 @@ struct dvb_frontend* mt352_attach(const 
 	struct mt352_state* state = NULL;
 
 	/* allocate memory for the internal state */
-	state = (struct mt352_state*) kmalloc(sizeof(struct mt352_state), GFP_KERNEL);
+	state = kmalloc(sizeof(struct mt352_state), GFP_KERNEL);
 	if (state == NULL) goto error;
 	memset(state,0,sizeof(*state));
 

--


^ permalink raw reply	[flat|nested] 50+ messages in thread

* Re: [DVB patch 22/48] nxt2002: fix max frequency
  2005-03-22  1:23 ` [DVB patch 22/48] nxt2002: fix max frequency Johannes Stezenbach
@ 2005-03-22  2:43   ` Gene Heskett
  0 siblings, 0 replies; 50+ messages in thread
From: Gene Heskett @ 2005-03-22  2:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Johannes Stezenbach, Andrew Morton

On Monday 21 March 2005 20:23, Johannes Stezenbach wrote:
>Patch by Taylor Jacob and Tom Dombrosky: There was a typo in the
> BBTI/B2C2 specs that stated the upper frequency of the
> air2pc/nxt2002 was 806Mhz, not 860Mhz.
>
Thanks, although I hadn't discovered it yet, waiting for market 166 to 
go live sometime this year I hope.

>Signed-off-by: Johannes Stezenbach <js@linuxtv.org>
>
> nxt2002.c |    2 +-
> 1 files changed, 1 insertion(+), 1 deletion(-)
>
>Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
>===================================================================
>---
> linux-2.6.12-rc1-mm1.orig/drivers/media/dvb/frontends/nxt2002.c 200
>5-03-22 00:15:13.000000000 +0100 +++
> linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c	2005-03-
>22 00:17:45.000000000 +0100 @@ -671,7 +671,7 @@ static struct
> dvb_frontend_ops nxt2002_o .name = "Nextwave nxt2002 VSB/QAM
> frontend",
> 		.type = FE_ATSC,
> 		.frequency_min =  54000000,
>-		.frequency_max = 806000000,
>+		.frequency_max = 860000000,
>                 /* stepsize is just a guess */
> 		.frequency_stepsize = 166666,
> 		.caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
>
>--
>
>-
>To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.34% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2005 by Maurice Eugene Heskett, all rights reserved.

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2005-03-22  6:41 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22  1:23 [DVB patch 00/48] DVB updates for 2.6.12-rc1-mm1 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 01/48] clarify firmware upload messages Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 02/48] dibcom: frontend fixes Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 03/48] dibusb: misc. fixes Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 04/48] skystar2: remove duplicate pci_release_region() Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 05/48] mt352: Pinnacle 300i comments Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 06/48] support Activy Budget card Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 07/48] skystar2: update email address Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 08/48] ves1x93: invert_pwm fix Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 09/48] dibusb readme update Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 10/48] dibusb: support Hauppauge WinTV NOVA-T USB2 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 11/48] nxt2002: QAM64/256 support Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 12/48] get_dvb_firmware: new unshield version Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 13/48] dib3000: corrected device naming Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 14/48] dibusb: debug changes Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 15/48] dibusb: increased the number of urbs for usb1.1 devices Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 16/48] ttusb_dec: use alternative interface to save bandwidth Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 17/48] l64781: email address fix Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 18/48] skystar2: fix MAC address reading Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 19/48] support KWorld/ADSTech Instant DVB-T USB2.0 Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 20/48] cleanups, make stuff static Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 21/48] refactor sw pid filter to drop redundant code Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 22/48] nxt2002: fix max frequency Johannes Stezenbach
2005-03-22  2:43   ` Gene Heskett
2005-03-22  1:23 ` [DVB patch 23/48] ttusb-budget: s/usb_unlink_urb/usb_kill_urb/ Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 24/48] av7110: fix Oops when av7110_ir_init() failed Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 25/48] saa7146: static initialization Johannes Stezenbach
2005-03-22  1:23 ` [DVB patch 26/48] av7110: error handling during attach Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 27/48] corrected links to firmware files Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 28/48] support pcHDTV HD2000 Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 29/48] dibusb: support nova-t usb ir Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 30/48] OREN or51211, or51132_qam and or51132_vsb firmware download info Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 31/48] ttusb_dec: IR support Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 32/48] dibusb: pll fix Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 33/48] tda10021: fix continuity errors Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 34/48] saa7146: remove duplicate setgpio Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 35/48] fix CAMs on Typhoon DVB-S Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 36/48] frontends: kfree() cleanup Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 37/48] clear up confusion between ids and adapters Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 38/48] dibusb: remove useless ifdef Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 39/48] support for Technotrend PCI DVB-T Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 40/48] dibusb: HanfTek UMT-010 fixes Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 41/48] vfree() checking cleanups Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 42/48] convert from pci_module_init to pci_register_driver Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 43/48] dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 44/48] sparse warnings on one-bit bitfields Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 45/48] support Nova-S rev 2.2 Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 46/48] ttusb_dec: cleanup Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 47/48] gcc 2.95 compile fixes Johannes Stezenbach
2005-03-22  1:24 ` [DVB patch 48/48] mt352: cleanups Johannes Stezenbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox