Skip to contentSkip to conversation

DVB updates for 2.6.12-rc1-mm1

PATCH In review Johannes Stezenbach 2 participants 50 messages Mar 22, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover DVB updates for 2.6.12-rc1-mm1

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

#1 lore raw

PATCH 1/48 clarify firmware upload messages

clarify firmware upload messages

 nxt2002.c  |    3 ++-
 tda1004x.c |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb/frontends/nxt2002.c +2 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
@@ -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);
drivers/media/dvb/frontends/tda1004x.c +4 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c
===================================================================
@@ -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;

--

#2 lore raw

PATCH 2/48 dibcom: frontend fixes

In reply to Johannes Stezenbach

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

 dib3000mb.c |   68 +++++++-----------------------------------------------------
 dib3000mc.c |    2 -
 2 files changed, 9 insertions(+), 61 deletions(-)
drivers/media/dvb/frontends/dib3000mb.c +8 -60
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
@@ -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, [email protected]"
 
 #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;
 }
drivers/media/dvb/frontends/dib3000mc.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
@@ -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, [email protected]"
 
 #ifdef CONFIG_DVB_DIBCOM_DEBUG

--

#3 lore raw

PATCH 3/48 dibusb: misc. fixes

In reply to Johannes Stezenbach

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)

 dvb-dibusb-fe-i2c.c |    4 ++
 dvb-dibusb-usb.c    |   70 ++++++++++++++++++++++++++--------------------------
 2 files changed, 39 insertions(+), 35 deletions(-)
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +4 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
@@ -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;
 }
 
drivers/media/dvb/dibusb/dvb-dibusb-usb.c +35 -35

185 lines not on this page · raw message

--

#4 lore raw

PATCH 4/48 skystar2: remove duplicate pci_release_region()

In reply to Johannes Stezenbach

remove duplicated pci_release_region() etc.

 skystar2.c |    4 ----
 1 files changed, 4 deletions(-)
drivers/media/dvb/b2c2/skystar2.c +0 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
@@ -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)

--

#5 lore raw

PATCH 5/48 mt352: Pinnacle 300i comments

In reply to Johannes Stezenbach

Comment preliminary Pinnacle 300i changes to the mt352 driver.

 mt352.c |    4 ++++
 1 files changed, 4 insertions(+)
drivers/media/dvb/frontends/mt352.c +4 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
@@ -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)) {

--

#6 lore raw

PATCH 6/48 support Activy Budget card

In reply to Johannes Stezenbach

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

 budget.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/media/dvb/ttpci/budget.c +12 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget.c
===================================================================
@@ -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,
 	}

--

#7 lore raw

PATCH 7/48 skystar2: update email address

In reply to Johannes Stezenbach

Updated email address.

 skystar2.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/media/dvb/b2c2/skystar2.c +5 -5
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
@@ -5,14 +5,14 @@
  * Copyright (C) 2003  Vadim Catana, [email protected]
  *
  * 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
  *
  *

--

#8 lore raw

PATCH 8/48 ves1x93: invert_pwm fix

In reply to Johannes Stezenbach

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

 ves1x93.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/media/dvb/frontends/ves1x93.c +9 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c
===================================================================
@@ -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)

--

#9 lore raw

PATCH 9/48 dibusb readme update

In reply to Johannes Stezenbach

dibusb readme update (Patrick Boettcher)

 README.dibusb |   57 +++++++++++++++++++++++++--------------------------------
 1 files changed, 25 insertions(+), 32 deletions(-)
Documentation/dvb/README.dibusb +25 -32
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
@@ -1,7 +1,7 @@
 Documentation for dib3000mb frontend driver and dibusb device driver
 ====================================================================
 
-Copyright (C) 2004 Patrick Boettcher ([email protected]),
+Copyright (C) 2004-5 Patrick Boettcher ([email protected]),
 
 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 ([email protected]) 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.
 

--

#10 lore raw

PATCH 10/48 dibusb: support Hauppauge WinTV NOVA-T USB2

In reply to Johannes Stezenbach

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

 Documentation/dvb/README.dibusb            |    8 ++++++--
 drivers/media/dvb/dibusb/dvb-dibusb-core.c |   28 +++++++++++++++++++---------
 2 files changed, 25 insertions(+), 11 deletions(-)
Documentation/dvb/README.dibusb +6 -2
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
@@ -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 ([email protected]),
@@ -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.
drivers/media/dvb/dibusb/dvb-dibusb-core.c +19 -9
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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

--

#11 lore raw

PATCH 11/48 nxt2002: QAM64/256 support

In reply to Johannes Stezenbach

patch by Taylor Jacob: Add QAM64/256 Support

 Kconfig   |    1 +
 nxt2002.c |   43 +++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)
drivers/media/dvb/frontends/nxt2002.c +41 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
@@ -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,
drivers/media/dvb/frontends/Kconfig +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
@@ -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.
 

--

#12 lore raw

PATCH 12/48 get_dvb_firmware: new unshield version

In reply to Johannes Stezenbach

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

 get_dvb_firmware |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Documentation/dvb/get_dvb_firmware +3 -3
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
@@ -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 {

--

#13 lore raw

PATCH 13/48 dib3000: corrected device naming

In reply to Johannes Stezenbach

corrected device naming (Patrick Boettcher)

 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(-)
drivers/media/dvb/frontends/Kconfig +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
@@ -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
drivers/media/dvb/frontends/dib3000-common.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.c
===================================================================
@@ -73,7 +73,7 @@ u16 dib3000_seq[2][2][2] =     /* fft,gu
 	};
 
 MODULE_AUTHOR("Patrick Boettcher <[email protected]");
-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);
drivers/media/dvb/frontends/dib3000-common.h +4 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000-common.h
===================================================================
@@ -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 {
drivers/media/dvb/frontends/dib3000.h +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000.h
===================================================================
@@ -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 ([email protected])
  *
drivers/media/dvb/frontends/dib3000mb.c +3 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
@@ -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 ([email protected])
@@ -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, [email protected]"
 
 #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,
drivers/media/dvb/frontends/dib3000mc.c +5 -5
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
@@ -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 ([email protected])
@@ -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, [email protected]"
 
 #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,
drivers/media/dvb/frontends/dib3000mc_priv.h +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc_priv.h
===================================================================
@@ -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)

--

#14 lore raw

PATCH 14/48 dibusb: debug changes

In reply to Johannes Stezenbach

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

 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(-)
drivers/media/dvb/dibusb/dvb-dibusb.h +7 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -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, [email protected]"
 
 #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 */
drivers/media/dvb/dibusb/dvb-dibusb-pid.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-pid.c
===================================================================
@@ -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;
 }
drivers/media/dvb/dibusb/dvb-dibusb-usb.c +0 -6
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
@@ -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,
drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +5 -8
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
@@ -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");

--

#15 lore raw

PATCH 15/48 dibusb: increased the number of urbs for usb1.1 devices

In reply to Johannes Stezenbach

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

 dvb-dibusb-core.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/media/dvb/dibusb/dvb-dibusb-core.c +2 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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],
 	},
 };

--

#16 lore raw

PATCH 16/48 ttusb_dec: use alternative interface to save bandwidth

In reply to Johannes Stezenbach

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

 ttusb_dec.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb/ttusb-dec/ttusb_dec.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
@@ -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);

--

#17 lore raw

PATCH 17/48 l64781: email address fix

In reply to Johannes Stezenbach

fix marko kohtala's mail address

 l64781.c |    5 ++---
 l64781.h |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/media/dvb/frontends/l64781.c +2 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c
===================================================================
@@ -1,9 +1,8 @@
 /*
     driver for LSI L64781 COFDM demodulator
 
-    Copyright (C) 2001 Holger Waechtler <[email protected]>
-                       for Convergence Integrated Media GmbH
-                       Marko Kohtala <[email protected]>
+    Copyright (C) 2001 Holger Waechtler for Convergence Integrated Media GmbH
+                       Marko Kohtala <[email protected]>
 
     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
drivers/media/dvb/frontends/l64781.h +2 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.h
===================================================================
@@ -1,9 +1,8 @@
 /*
     driver for LSI L64781 COFDM demodulator
 
-    Copyright (C) 2001 Holger Waechtler <[email protected]>
-                       for Convergence Integrated Media GmbH
-                       Marko Kohtala <[email protected]>
+    Copyright (C) 2001 Holger Waechtler for Convergence Integrated Media GmbH
+                       Marko Kohtala <[email protected]>
 
     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

--

#18 lore raw

PATCH 18/48 skystar2: fix MAC address reading

In reply to Johannes Stezenbach

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

 skystar2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb/b2c2/skystar2.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
@@ -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)

--

#19 lore raw

PATCH 19/48 support KWorld/ADSTech Instant DVB-T USB2.0

In reply to Johannes Stezenbach

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)

 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(-)
Documentation/dvb/README.dibusb +10 -4
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
@@ -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
drivers/media/dvb/dibusb/Kconfig +2 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Kconfig
===================================================================
@@ -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).
drivers/media/dvb/dibusb/dvb-dibusb-core.c +64 -14

167 lines not on this page · raw message

drivers/media/dvb/dibusb/dvb-dibusb-usb.c +3 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
@@ -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.");
drivers/media/dvb/dibusb/dvb-dibusb.h +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -72,6 +72,7 @@ typedef enum {
 	DIBUSB1_1_AN2235,
 	DIBUSB2_0,
 	UMT2_0,
+	DIBUSB2_0B,
 } dibusb_class_t;
 
 typedef enum {
drivers/media/dvb/frontends/dib3000mb.c +3 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
@@ -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;
 }
 
drivers/media/dvb/frontends/dib3000mc.c +0 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
@@ -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;

--

#20 lore raw

PATCH 20/48 cleanups, make stuff static

In reply to Johannes Stezenbach

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

 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(-)
drivers/media/dvb/b2c2/b2c2-common.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/b2c2-common.c
===================================================================
@@ -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;
drivers/media/dvb/b2c2/skystar2.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
@@ -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;
drivers/media/dvb/bt8xx/bt878.c +0 -15
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c
===================================================================
@@ -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 */
 /***********************/
drivers/media/dvb/bt8xx/dst_priv.h +0 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst_priv.h
===================================================================
@@ -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);
drivers/media/dvb/dibusb/dvb-dibusb-core.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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,
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
@@ -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)) */
drivers/media/dvb/dibusb/dvb-dibusb.h +0 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -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);
drivers/media/dvb/dvb-core/demux.h +0 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/demux.h
===================================================================
@@ -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 */
drivers/media/dvb/dvb-core/dvb_demux.c +6 -30
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
@@ -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)
drivers/media/dvb/dvb-core/dvb_demux.h +0 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h
===================================================================
@@ -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_ */
drivers/media/dvb/dvb-core/dvb_net.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_net.c
===================================================================
@@ -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.
drivers/media/dvb/dvb-core/dvbdev.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
@@ -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)
 {
drivers/media/dvb/frontends/tda10021.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
@@ -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,
drivers/media/dvb/ttpci/budget-av.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
@@ -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,
drivers/media/dvb/ttpci/budget-patch.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-patch.c
===================================================================
@@ -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,
 };

--

#21 lore raw

PATCH 21/48 refactor sw pid filter to drop redundant code

In reply to Johannes Stezenbach

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)

 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(-)
drivers/media/dvb/dibusb/Makefile +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile
===================================================================
@@ -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
 
drivers/media/dvb/dibusb/dvb-dibusb-core.c +0 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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;
drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +5 -19
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
@@ -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
drivers/media/dvb/dibusb/dvb-dibusb-pid.c deleted +0 -80

80 lines not on this page · raw message

drivers/media/dvb/dibusb/dvb-dibusb.h +0 -10
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -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
 
drivers/media/dvb/dvb-core/dvb_demux.h +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.h
===================================================================
@@ -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 {
drivers/media/dvb/dvb-core/dvb_demux.c +3 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_demux.c
===================================================================
@@ -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;
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +14 -72

182 lines not on this page · raw message

--

#22 lore raw

PATCH 22/48 nxt2002: fix max frequency

In reply to Johannes Stezenbach

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.

 nxt2002.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb/frontends/nxt2002.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
@@ -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 |

--

#23 lore raw

Re: [DVB patch 22/48] nxt2002: fix max frequency

Quoted 4 lines · Johannes Stezenbach

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.

Quoted 29 lines

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,
drivers/media/dvb/frontends/nxt2002.c +1 -1
-		.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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 8 lines
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.
#24 lore raw

PATCH 23/48 ttusb-budget: s/usb_unlink_urb/usb_kill_urb/

In reply to Johannes Stezenbach

patch by Colin Western: s/usb_unlink_urb/usb_kill_urb/

 dvb-ttusb-budget.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
@@ -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;
 }

--

#25 lore raw

PATCH 24/48 av7110: fix Oops when av7110_ir_init() failed

In reply to Johannes Stezenbach

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)

 av7110.c    |   15 +++------------
 av7110_ir.c |    8 ++++++++
 2 files changed, 11 insertions(+), 12 deletions(-)
drivers/media/dvb/ttpci/av7110.c +3 -12
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c
===================================================================
@@ -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;
 }
 
drivers/media/dvb/ttpci/av7110_ir.c +8 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c
===================================================================
@@ -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 <[email protected]>");

--

#26 lore raw

PATCH 25/48 saa7146: static initialization

In reply to Johannes Stezenbach

Static initialization.

 saa7146_core.c |   29 ++---------------------------
 1 files changed, 2 insertions(+), 27 deletions(-)
drivers/media/common/saa7146_core.c +2 -27
Index: linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c
===================================================================
@@ -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);
 

--

#27 lore raw

PATCH 26/48 av7110: error handling during attach

In reply to Johannes Stezenbach

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.

 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(-)
drivers/media/dvb/ttpci/av7110.c +112 -82
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.c
===================================================================
@@ -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;
drivers/media/dvb/ttpci/av7110.h +0 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h
===================================================================
@@ -231,8 +231,6 @@ struct av7110 {
 	u32		    ir_config;
 
 	/* firmware stuff */
-	unsigned int device_initialized;
-
 	unsigned char *bin_fw;
 	unsigned long size_fw;
 
drivers/media/dvb/ttpci/av7110_av.c +17 -8
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.c
===================================================================
@@ -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;
 }
drivers/media/dvb/ttpci/av7110_av.h +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_av.h
===================================================================
@@ -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_ */
drivers/media/dvb/ttpci/av7110_ca.c +16 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.c
===================================================================
@@ -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)
drivers/media/dvb/ttpci/av7110_ca.h +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ca.h
===================================================================
@@ -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_ */
drivers/media/dvb/ttpci/av7110_ipack.c +0 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ipack.c
===================================================================
@@ -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);
 }
 

--

#28 lore raw

PATCH 27/48 corrected links to firmware files

In reply to Johannes Stezenbach

corrected links to firmware files (reported by Stefan Frings)

 README.dibusb    |   19 +++++++++++++------
 get_dvb_firmware |    2 +-
 2 files changed, 14 insertions(+), 7 deletions(-)
Documentation/dvb/README.dibusb +13 -6
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/README.dibusb
===================================================================
@@ -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.
 
Documentation/dvb/get_dvb_firmware +1 -1
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
@@ -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";
 

--

#29 lore raw

PATCH 28/48 support pcHDTV HD2000

In reply to Johannes Stezenbach

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

 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(-)
drivers/media/dvb/bt8xx/Kconfig +3 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/Kconfig
===================================================================
@@ -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
drivers/media/dvb/bt8xx/dvb-bt8xx.c +71 -1

96 lines not on this page · raw message

drivers/media/dvb/bt8xx/dvb-bt8xx.h +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dvb-bt8xx.h
===================================================================
@@ -34,6 +34,7 @@
 #include "dst.h"
 #include "nxt6000.h"
 #include "cx24110.h"
+#include "or51211.h"
 
 struct dvb_bt8xx_card {
 	struct semaphore lock;
drivers/media/dvb/frontends/Kconfig +7 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Kconfig
===================================================================
@@ -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
drivers/media/dvb/frontends/Makefile +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/Makefile
===================================================================
@@ -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
drivers/media/dvb/frontends/or51211.c new file +631 -0

631 lines not on this page · raw message

drivers/media/dvb/frontends/or51211.h new file +44 -0

44 lines not on this page · raw message

drivers/media/dvb/frontends/or51132.c +3 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51132.c
===================================================================
@@ -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;

--

#30 lore raw

PATCH 29/48 dibusb: support nova-t usb ir

In reply to Johannes Stezenbach

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)

 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(-)
drivers/media/dvb/dibusb/dvb-dibusb-core.c +16 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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);
 		
drivers/media/dvb/dibusb/dvb-dibusb-firmware.c +3 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-firmware.c
===================================================================
@@ -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) {
drivers/media/dvb/dibusb/dvb-dibusb-remote.c +148 -29

215 lines not on this page · raw message

drivers/media/dvb/dibusb/dvb-dibusb-usb.c +9 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
@@ -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
drivers/media/dvb/dibusb/dvb-dibusb.h +11 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -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
  *

--

#31 lore raw

PATCH 30/48 OREN or51211, or51132_qam and or51132_vsb firmware download info

In reply to Johannes Stezenbach

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

 contributors.txt |    3 +++
 get_dvb_firmware |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 readme.txt       |    7 ++++---
 3 files changed, 52 insertions(+), 8 deletions(-)
Documentation/dvb/get_dvb_firmware +45 -5
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/get_dvb_firmware
===================================================================
@@ -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
 
Documentation/dvb/contributors.txt +3 -0
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/contributors.txt
===================================================================
@@ -72,5 +72,8 @@ Kenneth Aafl�y <[email protected]>
 Ernst Peinlich <[email protected]>
   for tuning/DiSEqC support for the DEC 3000-s
 
+Peter Beutner <[email protected]>
+  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)
Documentation/dvb/readme.txt +4 -3
Index: linux-2.6.12-rc1-mm1/Documentation/dvb/readme.txt
===================================================================
@@ -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:
 

--

#32 lore raw

PATCH 31/48 ttusb_dec: IR support

In reply to Johannes Stezenbach

Add IR support added by Peter Beutner

 ttusb_dec.c |  153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 150 insertions(+), 3 deletions(-)
drivers/media/dvb/ttusb-dec/ttusb_dec.c +150 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
@@ -2,6 +2,7 @@
  * TTUSB DEC Driver
  *
  * Copyright (C) 2003-2004 Alex Woods <[email protected]>
+ * IR support by Peter Beutner <[email protected]>
  *
  * 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;
 }
 

--

#33 lore raw

PATCH 32/48 dibusb: pll fix

In reply to Johannes Stezenbach

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

 dvb-dibusb-fe-i2c.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +7 -7
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
@@ -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

--

#34 lore raw

PATCH 33/48 tda10021: fix continuity errors

In reply to Johannes Stezenbach

Fix Continuity Errors with tda10021 (slickhenry, Robert Schlabbach)

 tda10021.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/media/dvb/frontends/tda10021.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
@@ -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,

--

#35 lore raw

PATCH 34/48 saa7146: remove duplicate setgpio

In reply to Johannes Stezenbach

Remove duplicate setgpio (Kenneth Aafloy)

 saa7146_core.c |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)
drivers/media/common/saa7146_core.c +5 -24
Index: linux-2.6.12-rc1-mm1/drivers/media/common/saa7146_core.c
===================================================================
@@ -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)
 {

--

#36 lore raw

PATCH 35/48 fix CAMs on Typhoon DVB-S

In reply to Johannes Stezenbach

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

 dvb-core/dvb_ca_en50221.c |    2 +-
 ttpci/budget-av.c         |   13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
@@ -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;
drivers/media/dvb/ttpci/budget-av.c +12 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
@@ -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;

--

#37 lore raw

PATCH 36/48 frontends: kfree() cleanup

In reply to Johannes Stezenbach

kfree(NULL) is safe (Kenneth Aafloy)

 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(-)
drivers/media/dvb/bt8xx/dst.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/dst.c
===================================================================
@@ -998,7 +998,7 @@ struct dvb_frontend* dst_attach(const st
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
@@ -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;
drivers/media/dvb/dvb-core/dvb_frontend.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_frontend.c
===================================================================
@@ -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;
 }
drivers/media/dvb/dvb-core/dvbdev.c +1 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
@@ -395,9 +395,7 @@ int dvb_usercopy(struct inode *inode, st
         }
 
 out:
-        if (mbuf)
-                kfree(mbuf);
-
+        kfree(mbuf);
         return err;
 }
 
drivers/media/dvb/frontends/at76c651.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/at76c651.c
===================================================================
@@ -402,7 +402,7 @@ struct dvb_frontend* at76c651_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/cx22700.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22700.c
===================================================================
@@ -392,7 +392,7 @@ struct dvb_frontend* cx22700_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/cx22702.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx22702.c
===================================================================
@@ -476,7 +476,7 @@ struct dvb_frontend* cx22702_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/cx24110.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/cx24110.c
===================================================================
@@ -608,7 +608,7 @@ struct dvb_frontend* cx24110_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/dib3000mb.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
@@ -738,8 +738,7 @@ struct dvb_frontend* dib3000mb_attach(co
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/dib3000mc.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
@@ -885,8 +885,7 @@ struct dvb_frontend* dib3000mc_attach(co
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/dvb_dummy_fe.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dvb_dummy_fe.c
===================================================================
@@ -123,7 +123,7 @@ struct dvb_frontend* dvb_dummy_fe_ofdm_a
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/l64781.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/l64781.c
===================================================================
@@ -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;
 }
 
drivers/media/dvb/frontends/mt312.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt312.c
===================================================================
@@ -641,8 +641,7 @@ struct dvb_frontend* vp310_attach(const 
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/mt352.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
@@ -581,7 +581,7 @@ struct dvb_frontend* mt352_attach(const 
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/nxt2002.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt2002.c
===================================================================
@@ -661,7 +661,7 @@ struct dvb_frontend* nxt2002_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/nxt6000.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/nxt6000.c
===================================================================
@@ -511,7 +511,7 @@ struct dvb_frontend* nxt6000_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/or51211.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/or51211.c
===================================================================
@@ -588,7 +588,7 @@ struct dvb_frontend* or51211_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/sp8870.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp8870.c
===================================================================
@@ -570,7 +570,7 @@ struct dvb_frontend* sp8870_attach(const
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/sp887x.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/sp887x.c
===================================================================
@@ -564,7 +564,7 @@ struct dvb_frontend* sp887x_attach(const
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/stv0297.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0297.c
===================================================================
@@ -758,8 +758,7 @@ struct dvb_frontend *stv0297_attach(cons
 	return &state->frontend;
 
 error:
-	if (state)
-		kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/stv0299.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/stv0299.c
===================================================================
@@ -675,7 +675,7 @@ struct dvb_frontend* stv0299_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/tda10021.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda10021.c
===================================================================
@@ -420,7 +420,7 @@ struct dvb_frontend* tda10021_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/tda1004x.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda1004x.c
===================================================================
@@ -1097,7 +1097,7 @@ struct dvb_frontend* tda10045_attach(con
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/tda8083.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda8083.c
===================================================================
@@ -405,7 +405,7 @@ struct dvb_frontend* tda8083_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/tda80xx.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/tda80xx.c
===================================================================
@@ -683,7 +683,7 @@ struct dvb_frontend* tda80xx_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/ves1820.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1820.c
===================================================================
@@ -404,7 +404,7 @@ struct dvb_frontend* ves1820_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/frontends/ves1x93.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/ves1x93.c
===================================================================
@@ -497,7 +497,7 @@ struct dvb_frontend* ves1x93_attach(cons
 	return &state->frontend;
 
 error:
-	if (state) kfree(state);
+	kfree(state);
 	return NULL;
 }
 
drivers/media/dvb/ttusb-dec/ttusbdecfe.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusbdecfe.c
===================================================================
@@ -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;
 }
 

--

#38 lore raw

PATCH 37/48 clear up confusion between ids and adapters

In reply to Johannes Stezenbach

clear up confusion between ids and adapters (Kenneth Aafloy)

 dvbdev.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/media/dvb/dvb-core/dvbdev.c +5 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvbdev.c
===================================================================
@@ -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;

--

#39 lore raw

PATCH 38/48 dibusb: remove useless ifdef

In reply to Johannes Stezenbach

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

 dvb-dibusb-dvb.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)
drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +1 -5
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
@@ -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;
 	}

--

#40 lore raw

PATCH 39/48 support for Technotrend PCI DVB-T

In reply to Johannes Stezenbach

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

 Kconfig  |    1 +
 av7110.c |   47 ++++++++++++++++++++++++++++++++++++++++++++++-
 av7110.h |    1 +
 3 files changed, 48 insertions(+), 1 deletion(-)
drivers/media/dvb/ttpci/Kconfig +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/Kconfig
===================================================================
@@ -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.
drivers/media/dvb/ttpci/av7110.c +46 -1

74 lines not on this page · raw message

drivers/media/dvb/ttpci/av7110.h +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110.h
===================================================================
@@ -31,6 +31,7 @@
 #include "tda8083.h"
 #include "sp8870.h"
 #include "stv0297.h"
+#include "l64781.h"
 
 #include <media/saa7146_vv.h>
 

--

#41 lore raw

PATCH 40/48 dibusb: HanfTek UMT-010 fixes

In reply to Johannes Stezenbach

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)

 dvb-dibusb-core.c   |    8 ++++----
 dvb-dibusb-fe-i2c.c |   49 +++++++++++++++++++++++--------------------------
 dvb-dibusb-usb.c    |    4 +---
 3 files changed, 28 insertions(+), 33 deletions(-)
drivers/media/dvb/dibusb/dvb-dibusb-core.c +4 -4
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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],
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +23 -26

101 lines not on this page · raw message

drivers/media/dvb/dibusb/dvb-dibusb-usb.c +1 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-usb.c
===================================================================
@@ -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;
 	}

--

#42 lore raw

PATCH 41/48 vfree() checking cleanups

In reply to Johannes Stezenbach

vfree() checking cleanups.

Signed-off by: James Lamanna <[email protected]>

 dvb-core/dmxdev.c         |   16 +++++-----------
 dvb-core/dvb_ca_en50221.c |    3 +--
 ttpci/budget-core.c       |    3 +--
 3 files changed, 7 insertions(+), 15 deletions(-)
drivers/media/dvb/dvb-core/dmxdev.c +5 -11
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dmxdev.c
===================================================================
@@ -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);
drivers/media/dvb/ttpci/budget-core.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-core.c
===================================================================
@@ -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);
 
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +1 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
@@ -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);
 

--

#43 lore raw

PATCH 42/48 convert from pci_module_init to pci_register_driver

In reply to Johannes Stezenbach
Quoted 1 line

From : http://kerneljanitors.org/TODO

o convert from pci_module_init to pci_register_driver

 b2c2/skystar2.c |    2 +-
 bt8xx/bt878.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb/b2c2/skystar2.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/b2c2/skystar2.c
===================================================================
@@ -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)
drivers/media/dvb/bt8xx/bt878.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/bt8xx/bt878.c
===================================================================
@@ -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)

--

#44 lore raw

PATCH 43/48 dibusb: support dtt200u (Yakumo/Typhoon/Hama) USB2.0 device

In reply to Johannes Stezenbach

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)

 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(-)
drivers/media/dvb/dibusb/Makefile +2 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/Makefile
===================================================================
@@ -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
 
drivers/media/dvb/dibusb/dvb-dibusb-core.c +17 -9
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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 */
 	},
drivers/media/dvb/dibusb/dvb-dibusb-dvb.c +3 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-dvb.c
===================================================================
@@ -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;
drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c +5 -22
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-fe-i2c.c
===================================================================
@@ -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) {
drivers/media/dvb/dibusb/dvb-dibusb-usb.c +55 -15

134 lines not on this page · raw message

drivers/media/dvb/dibusb/dvb-dibusb.h +8 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb.h
===================================================================
@@ -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
 
drivers/media/dvb/dibusb/dvb-fe-dtt200u.c new file +258 -0

258 lines not on this page · raw message

drivers/media/dvb/frontends/dib3000mb.c +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mb.c
===================================================================
@@ -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;
drivers/media/dvb/frontends/dib3000mc.c +1 -0
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/dib3000mc.c
===================================================================
@@ -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;

--

#45 lore raw

PATCH 44/48 sparse warnings on one-bit bitfields

In reply to Johannes Stezenbach

Remove some sparse warnings on one-bit bitfields.

 dvb_ca_en50221.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/media/dvb/dvb-core/dvb_ca_en50221.c +3 -3
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
===================================================================
@@ -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;

--

#46 lore raw

PATCH 45/48 support Nova-S rev 2.2

In reply to Johannes Stezenbach

Support for Nova-S rev 2.2 (Gregor Kroesen)

 dvb-ttusb-budget.c |  107 ++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 94 insertions(+), 13 deletions(-)
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +94 -13
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
@@ -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;
 		}
 

--

#47 lore raw

PATCH 46/48 ttusb_dec: cleanup

In reply to Johannes Stezenbach

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

 ttusb_dec.c |   49 +++++++++++++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 20 deletions(-)
drivers/media/dvb/ttusb-dec/ttusb_dec.c +29 -20
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttusb-dec/ttusb_dec.c
===================================================================
@@ -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);
 	}

--

#48 lore raw

PATCH 47/48 gcc 2.95 compile fixes

In reply to Johannes Stezenbach

Patch by Olaf Titz: gcc 2.95 compile fixes

 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(-)
drivers/media/dvb/dibusb/dvb-dibusb-core.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-dibusb-core.c
===================================================================
@@ -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++) {
drivers/media/dvb/dibusb/dvb-fe-dtt200u.c +6 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/dibusb/dvb-fe-dtt200u.c
===================================================================
@@ -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;
drivers/media/dvb/ttpci/av7110_ir.c +2 -2
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/av7110_ir.c
===================================================================
@@ -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;
 
drivers/media/dvb/ttpci/budget-av.c +1 -1
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/ttpci/budget-av.c
===================================================================
@@ -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);
 

--

#49 lore raw

PATCH 48/48 mt352: cleanups

In reply to Johannes Stezenbach

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)

 mt352.c |  105 +++++++++++++++++++++++-----------------------------------------
 1 files changed, 39 insertions(+), 66 deletions(-)
drivers/media/dvb/frontends/mt352.c +39 -66
Index: linux-2.6.12-rc1-mm1/drivers/media/dvb/frontends/mt352.c
===================================================================
@@ -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));
 

--