linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] [DVB] Kconfig and Makefile updates
@ 2003-07-29  9:30 Michael Hunold
  2003-07-29  9:30 ` [PATCH 2/6] [DVB] DVB core update Michael Hunold
  2003-07-29  9:58 ` [PATCH 1/6] [DVB] Kconfig and Makefile updates Roman Zippel
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

Hi all,

here comes a set of 6 small patches for the DVB subsystem against
2.6.0-test2, sized between 1kB and 6kB.

They fix various aspects in different parts of
the driver. Detailed descriptions are at the top of each patch.

Please apply. Thanks!

CU
Michael.

[V4L] - make sure saa7146 module gets build for Hexium drivers
[V4L] - make Hexium drivers depend on the i2c layer
[DVB] - fix typo which prevented the mt312 driver from being build (obi <=> obj)
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/common/Kconfig linux-2.6.0-test2.patch/drivers/media/common/Kconfig
--- linux-2.6.0-test2.work/drivers/media/common/Kconfig	2003-07-29 09:10:19.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/common/Kconfig	2003-07-17 11:03:08.000000000 +0200
@@ -1,8 +1,8 @@
 config VIDEO_SAA7146
         tristate
-        default y if DVB_AV7110=y || DVB_BUDGET=y || DVB_BUDGET_AV=y || VIDEO_MXB=y || VIDEO_DPC=y
-        default m if DVB_AV7110=m || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m || VIDEO_DPC=m
-        depends on VIDEO_DEV && PCI
+        default y if DVB_AV7110=y || DVB_BUDGET=y || DVB_BUDGET_AV=y || VIDEO_MXB=y || VIDEO_DPC=y || VIDEO_HEXIUM_ORION=y || VIDEO_HEXIUM_GEMINI=y
+        default m if DVB_AV7110=m || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m || VIDEO_DPC=m || VIDEO_HEXIUM_ORION=m || VIDEO_HEXIUM_GEMINI=m
+        depends on VIDEO_DEV && PCI && I2C
 
 config VIDEO_VIDEOBUF
         tristate
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/frontends/Makefile linux-2.6.0-test2.patch/drivers/media/dvb/frontends/Makefile
--- linux-2.6.0-test2.work/drivers/media/dvb/frontends/Makefile	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/frontends/Makefile	2003-07-29 09:17:53.000000000 +0200
@@ -12,6 +12,6 @@
 obj-$(CONFIG_DVB_CX24110) += cx24110.o
 obj-$(CONFIG_DVB_GRUNDIG_29504_491) += grundig_29504-491.o
 obj-$(CONFIG_DVB_GRUNDIG_29504_401) += grundig_29504-401.o
-obi-$(CONFIG_DVB_MT312) += mt312.o
+obj-$(CONFIG_DVB_MT312) += mt312.o
 obj-$(CONFIG_DVB_VES1820) += ves1820.o
 obj-$(CONFIG_DVB_TDA1004X) += tda1004x.o
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/video/Kconfig linux-2.6.0-test2.patch/drivers/media/video/Kconfig
--- linux-2.6.0-test2.work/drivers/media/video/Kconfig	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/video/Kconfig	2003-07-17 11:03:08.000000000 +0200
@@ -259,7 +259,7 @@
 
 config VIDEO_HEXIUM_ORION
 	tristate "Hexium HV-PCI6 and Orion frame grabber"
-	depends on VIDEO_DEV && PCI
+	depends on VIDEO_DEV && PCI && I2C
 	---help---
 	  This is a video4linux driver for the Hexium HV-PCI6 and
 	  Orion frame grabber cards by Hexium.
@@ -271,7 +271,7 @@
 
 config VIDEO_HEXIUM_GEMINI
 	tristate "Hexium Gemini frame grabber"
-	depends on VIDEO_DEV && PCI
+	depends on VIDEO_DEV && PCI && I2C
 	---help---
 	  This is a video4linux driver for the Hexium Gemini frame
 	  grabber card by Hexium. Please note that the Gemini Dual


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

* [PATCH 2/6] [DVB] DVB core update
  2003-07-29  9:30 [PATCH 1/6] [DVB] Kconfig and Makefile updates Michael Hunold
@ 2003-07-29  9:30 ` Michael Hunold
  2003-07-29  9:30   ` [PATCH 3/6] [DVB] mt312 DVB frontend update Michael Hunold
  2003-07-29  9:58 ` [PATCH 1/6] [DVB] Kconfig and Makefile updates Roman Zippel
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

[DVB] - if there are multiple adapters, bend the tuning frequency only if the adapters differ
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/dvb-core/dvb_frontend.c linux-2.6.0-test2.patch/drivers/media/dvb/dvb-core/dvb_frontend.c
--- linux-2.6.0-test2.work/drivers/media/dvb/dvb-core/dvb_frontend.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/dvb-core/dvb_frontend.c	2003-07-29 09:17:52.000000000 +0200
@@ -134,6 +134,7 @@
 {
 	struct list_head *entry;
 	int stepsize = this_fe->info->frequency_stepsize;
+	int this_fe_adap_num = this_fe->frontend.i2c->adapter->num;
 	int frequency;
 
 	if (!stepsize || recursive > 10) {
@@ -157,6 +158,9 @@
 
 		fe = list_entry (entry, struct dvb_frontend_data, list_head);
 
+		if (fe->frontend.i2c->adapter->num != this_fe_adap_num)
+			continue;
+
 		f = fe->parameters.frequency;
 		f += fe->lnb_drift;
 		f += fe->bending;


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

* [PATCH 4/6] [DVB] Update MAC handling for various DVB PCI cards
  2003-07-29  9:30   ` [PATCH 3/6] [DVB] mt312 DVB frontend update Michael Hunold
@ 2003-07-29  9:30     ` Michael Hunold
  2003-07-29  9:30       ` [PATCH 5/6] [DVB] TTUSB-DEC driver update Michael Hunold
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

[DVB] - correctly read MAC from eeprom on Technotrend and KNC1 cards
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/ttpci/ttpci-eeprom.c linux-2.6.0-test2.patch/drivers/media/dvb/ttpci/ttpci-eeprom.c
--- linux-2.6.0-test2.work/drivers/media/dvb/ttpci/ttpci-eeprom.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/ttpci/ttpci-eeprom.c	2003-07-21 18:15:47.000000000 +0200
@@ -3,9 +3,6 @@
     decode it and store it in the associated adapter struct for
     use by dvb_net.c
 
-    This code was tested on TT-Budget/WinTV-NOVA-CI PCI boards with
-    Atmel and ST Microelectronics EEPROMs.
-
     This card appear to have the 24C16 write protect held to ground,
     thus permitting normal read/write operation. Theoretically it
     would be possible to write routines to burn a different (encoded)
@@ -15,6 +12,9 @@
     Michael Glaum	KVH Industries
     Holger Waechtler	Convergence
 
+    Copyright (C) 2002-2003 Ralph Metzler <rjkm@metzlerbros.de>
+                            Metzler Brothers Systementwicklung GbR
+
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
@@ -40,23 +40,62 @@
 #include "dvb_functions.h"
 
 #if 1
-#define dprintk(x...) printk(x)
+#define dprintk(x...) do { printk(x); } while (0)
 #else
-#define dprintk(x...)
+#define dprintk(x...) do { } while (0)
 #endif
 
 
+static int check_mac_tt(u8 *buf)
+{
+        int i;
+        u16 tmp = 0xffff;
+
+        for (i = 0; i < 8; i++) {
+                tmp  = (tmp << 8) | ((tmp >> 8) ^ buf[i]);
+                tmp ^= (tmp >> 4) & 0x0f;
+                tmp ^= (tmp << 12) ^ ((tmp & 0xff) << 5);
+        }
+        tmp ^= 0xffff;
+        return (((tmp >> 8) ^ buf[8]) | ((tmp & 0xff) ^ buf[9]));
+}
+
+static int getmac_tt(u8 * decodedMAC, u8 * encodedMAC)
+{
+        u8 xor[20] = { 0x72, 0x23, 0x68, 0x19, 0x5c, 0xa8, 0x71, 0x2c,
+		       0x54, 0xd3, 0x7b, 0xf1, 0x9E, 0x23, 0x16, 0xf6,
+		       0x1d, 0x36, 0x64, 0x78};
+        u8 data[20];
+        int i;
+
+	/* In case there is a sig check failure have the orig contents available */
+	memcpy(data, encodedMAC, 20);
+
+	for (i = 0; i < 20; i++)
+                data[i] ^= xor[i];
+        for (i = 0; i < 10; i++)
+                data[i] = ((data[2 * i + 1] << 8) | data[2 * i])
+			>> ((data[2 * i + 1] >> 6) & 3);
+
+        if (check_mac_tt(data))
+                return -ENODEV;
+
+	decodedMAC[0] = data[2]; decodedMAC[1] = data[1]; decodedMAC[2] = data[0];
+	decodedMAC[3] = data[6]; decodedMAC[4] = data[5]; decodedMAC[5] = data[4];
+        return 0;
+}
+
 static int ttpci_eeprom_read_encodedMAC(struct dvb_i2c_bus *i2c, u8 * encodedMAC)
 {
 	int ret;
-	u8 b0[] = { 0xd4 };
+	u8 b0[] = { 0xcc };
 
 	struct i2c_msg msg[] = {
 		{.addr = 0x50,.flags = 0,.buf = b0,.len = 1},
-		{.addr = 0x50,.flags = I2C_M_RD,.buf = encodedMAC,.len = 6}
+		{ .addr = 0x50, .flags = I2C_M_RD, .buf = encodedMAC, .len = 20 }
 	};
 
-	dprintk("%s\n", __FUNCTION__);
+	/* dprintk("%s\n", __FUNCTION__); */
 
 	ret = i2c->xfer(i2c, msg, 2);
 
@@ -66,34 +105,11 @@
 	return 0;
 }
 
-static void decodeMAC(u8 * decodedMAC, const u8 * encodedMAC)
-{
-	u8 ormask0[3] = { 0x54, 0x7B, 0x9E };
-	u8 ormask1[3] = { 0xD3, 0xF1, 0x23 };
-	u8 low;
-	u8 high;
-	u8 shift;
-	int i;
-
-	decodedMAC[0] = 0x00;
-	decodedMAC[1] = 0xD0;
-	decodedMAC[2] = 0x5C;
-
-	for (i = 0; i < 3; i++) {
-		low = encodedMAC[2 * i] ^ ormask0[i];
-		high = encodedMAC[2 * i + 1] ^ ormask1[i];
-		shift = (high >> 6) & 0x3;
-
-		decodedMAC[5 - i] = ((high << 8) | low) >> shift;
-	}
-
-}
-
 
 int ttpci_eeprom_parse_mac(struct dvb_i2c_bus *i2c)
 {
-	int ret;
-	u8 encodedMAC[6];
+	int ret, i;
+	u8 encodedMAC[20];
 	u8 decodedMAC[6];
 
 	ret = ttpci_eeprom_read_encodedMAC(i2c, encodedMAC);
@@ -104,16 +120,24 @@
 		return ret;
 	}
 
-	decodeMAC(decodedMAC, encodedMAC);
-	memcpy(i2c->adapter->proposed_mac, decodedMAC, 6);
+	ret = getmac_tt(decodedMAC, encodedMAC);
+	if( ret != 0 ) {
+		dprintk("%s adapter %i failed MAC signature check\n",
+			i2c->adapter->name, i2c->adapter->num);
+		dprintk("encoded MAC from EEPROM was " );
+		for(i=0; i<19; i++) {
+			dprintk( "%.2x:", encodedMAC[i]);
+		}
+		dprintk("%.2x\n", encodedMAC[19]);
+		memset(i2c->adapter->proposed_mac, 0, 6);
+		return ret;
+	}
 
-	dprintk("%s adapter %i has MAC addr = %02x:%02x:%02x:%02x:%02x:%02x\n",
+	memcpy(i2c->adapter->proposed_mac, decodedMAC, 6);
+	dprintk("%s adapter %i has MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
 		i2c->adapter->name, i2c->adapter->num,
 		decodedMAC[0], decodedMAC[1], decodedMAC[2],
 		decodedMAC[3], decodedMAC[4], decodedMAC[5]);
-	dprintk("encoded MAC was %02x:%02x:%02x:%02x:%02x:%02x\n",
-		encodedMAC[0], encodedMAC[1], encodedMAC[2],
-		encodedMAC[3], encodedMAC[4], encodedMAC[5]);
 	return 0;
 }
 
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/ttpci/budget-av.c linux-2.6.0-test2.patch/drivers/media/dvb/ttpci/budget-av.c
--- linux-2.6.0-test2.work/drivers/media/dvb/ttpci/budget-av.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/ttpci/budget-av.c	2003-07-21 18:15:47.000000000 +0200
@@ -64,6 +64,19 @@
 	return mm2[0];
 }
 
+static int i2c_readregs(struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 *buf, u8 len)
+{
+        u8 mm1[] = { reg };
+        struct i2c_msg msgs[2] = {
+		{ addr: id/2, flags: 0, buf: mm1, len: 1 },
+		{ addr: id/2, flags: I2C_M_RD, buf: buf, len: len }
+	};
+
+        if (i2c->xfer(i2c, msgs, 2) != 2)
+		return -EIO;
+	return 0;
+}
+
 
 static int i2c_writereg (struct dvb_i2c_bus *i2c, u8 id, u8 reg, u8 val)
 {
@@ -177,6 +190,7 @@
 {
 	struct budget_av *budget_av;
 	struct budget_info *bi = info->ext_priv;
+	u8 *mac;
 	int err;
 
 	DEB_EE(("dev: %p\n",dev));
@@ -243,6 +257,16 @@
 	/* fixme: find some sane values here... */
 	saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
 
+	mac = budget_av->budget.dvb_adapter->proposed_mac;
+	if (i2c_readregs(budget_av->budget.i2c_bus, 0xa0, 0x30, mac, 6)) {
+		printk("KNC1-%d: Could not read MAC from KNC1 card\n",
+				budget_av->budget.dvb_adapter->num);
+		memset(mac, 0, 6);
+	}
+	else
+		printk("KNC1-%d: MAC addr = %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+				budget_av->budget.dvb_adapter->num,
+				mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
 	return 0;
 }
 


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

* [PATCH 3/6] [DVB] mt312 DVB frontend update
  2003-07-29  9:30 ` [PATCH 2/6] [DVB] DVB core update Michael Hunold
@ 2003-07-29  9:30   ` Michael Hunold
  2003-07-29  9:30     ` [PATCH 4/6] [DVB] Update MAC handling for various DVB PCI cards Michael Hunold
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

[DVB] - show i2c read errors only for registered frontends
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/frontends/mt312.c linux-2.6.0-test2.patch/drivers/media/dvb/frontends/mt312.c
--- linux-2.6.0-test2.work/drivers/media/dvb/frontends/mt312.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/frontends/mt312.c	2003-07-29 09:17:53.000000000 +0200
@@ -41,6 +41,9 @@
 #define MT312_SYS_CLK		90000000UL	/* 90 MHz */
 #define MT312_PLL_CLK		10000000UL	/* 10 MHz */
 
+/* number of active frontends */
+static int mt312_count = 0;
+
 static struct dvb_frontend_info mt312_info = {
 	.name = "Zarlink MT312",
 	.type = FE_QPSK,
@@ -78,7 +81,7 @@
 
 	ret = i2c->xfer(i2c, msg, 2);
 
-	if (ret != 2) {
+	if ((ret != 2) && (mt312_count != 0)) {
 		printk(KERN_ERR "%s: ret == %d\n", __FUNCTION__, ret);
 		return -EREMOTEIO;
 	}
@@ -722,13 +725,21 @@
 	if ((id != ID_VP310) && (id != ID_MT312))
 		return -ENODEV;
 
-	return dvb_register_frontend(mt312_ioctl, i2c, (void *) (long) id,
-				     &mt312_info);
+	if ((ret = dvb_register_frontend(mt312_ioctl, i2c,
+				(void *)(long)id, &mt312_info)) < 0)
+		return ret;
+
+	mt312_count++;
+
+	return 0;
 }
 
 static void mt312_detach(struct dvb_i2c_bus *i2c)
 {
 	dvb_unregister_frontend(mt312_ioctl, i2c);
+
+	if (mt312_count)
+		mt312_count--;
 }
 
 static int __init mt312_module_init(void)


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

* [PATCH 6/6] [DVB] Hexium saa7146 driver update
  2003-07-29  9:30       ` [PATCH 5/6] [DVB] TTUSB-DEC driver update Michael Hunold
@ 2003-07-29  9:30         ` Michael Hunold
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

[V4L] - set debug verbosity to 0 for both Hexium drivers
[V4L] - declare all local functions and variables static
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/video/hexium_gemini.c linux-2.6.0-test2.patch/drivers/media/video/hexium_gemini.c
--- linux-2.6.0-test2.work/drivers/media/video/hexium_gemini.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/video/hexium_gemini.c	2003-07-17 11:03:08.000000000 +0200
@@ -25,12 +25,12 @@
 
 #include <media/saa7146_vv.h>
 
-static int debug = 255;
+static int debug = 0;
 MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "debug verbosity");
 
 /* global variables */
-int hexium_num = 0;
+static int hexium_num = 0;
 
 #include "hexium_gemini.h"
 
@@ -388,7 +388,7 @@
 	.irq_func = NULL,
 };
 
-int __init hexium_init_module(void)
+static int __init hexium_init_module(void)
 {
 	if (0 != saa7146_register_extension(&hexium_extension)) {
 		DEB_S(("failed to register extension.\n"));
@@ -398,7 +398,7 @@
 	return 0;
 }
 
-void __exit hexium_cleanup_module(void)
+static void __exit hexium_cleanup_module(void)
 {
 	saa7146_unregister_extension(&hexium_extension);
 }
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/video/hexium_orion.c linux-2.6.0-test2.patch/drivers/media/video/hexium_orion.c
--- linux-2.6.0-test2.work/drivers/media/video/hexium_orion.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/video/hexium_orion.c	2003-07-17 11:03:08.000000000 +0200
@@ -25,7 +25,7 @@
 
 #include <media/saa7146_vv.h>
 
-static int debug = 255;
+static int debug = 0;
 MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "debug verbosity");
 


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

* [PATCH 5/6] [DVB] TTUSB-DEC driver update
  2003-07-29  9:30     ` [PATCH 4/6] [DVB] Update MAC handling for various DVB PCI cards Michael Hunold
@ 2003-07-29  9:30       ` Michael Hunold
  2003-07-29  9:30         ` [PATCH 6/6] [DVB] Hexium saa7146 " Michael Hunold
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Hunold @ 2003-07-29  9:30 UTC (permalink / raw)
  To: linux-kernel, alan, torvalds

[DVB] - Hand off all processing of urb data to a tasklet
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/ttusb-dec/ttusb_dec.c linux-2.6.0-test2.patch/drivers/media/dvb/ttusb-dec/ttusb_dec.c
--- linux-2.6.0-test2.work/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2003-07-21 13:42:42.000000000 +0200
@@ -124,14 +125,10 @@
 
 	ttusb_dec_send_command(dec, 0x50, sizeof(b), b, NULL, NULL);
 
-	if (!down_interruptible(&dec->pes2ts_sem)) {
 		dvb_filter_pes2ts_init(&dec->a_pes2ts, dec->pid[DMX_PES_AUDIO],
 				       ttusb_dec_av_pes2ts_cb, dec->demux.feed);
 		dvb_filter_pes2ts_init(&dec->v_pes2ts, dec->pid[DMX_PES_VIDEO],
 				       ttusb_dec_av_pes2ts_cb, dec->demux.feed);
-
-		up(&dec->pes2ts_sem);
-	}
 }
 
 static int ttusb_dec_i2c_master_xfer(struct dvb_i2c_bus *i2c,
@@ -196,14 +193,8 @@
 				memcpy(&dec->v_pes[dec->v_pes_length],
 				       &av_pes[12], prebytes);
 
-				if (!down_interruptible(&dec->pes2ts_sem)) {
-					dvb_filter_pes2ts(&dec->v_pes2ts,
-							  dec->v_pes,
-							  dec->v_pes_length +
-							  prebytes);
-
-					up(&dec->pes2ts_sem);
-				}
+				dvb_filter_pes2ts(&dec->v_pes2ts, dec->v_pes,
+						  dec->v_pes_length + prebytes);
 			}
 
 			if (av_pes[5] & 0x10) {
@@ -246,16 +237,10 @@
 						     postbytes);
 			memcpy(&dec->v_pes[4], &v_pes_payload_length, 2);
 
-			if (postbytes == 0) {
-				if (!down_interruptible(&dec->pes2ts_sem)) {
-					dvb_filter_pes2ts(&dec->v_pes2ts,
-							  dec->v_pes,
+			if (postbytes == 0)
+				dvb_filter_pes2ts(&dec->v_pes2ts, dec->v_pes,
 							  dec->v_pes_length);
 
-					up(&dec->pes2ts_sem);
-				}
-			}
-
 			break;
 		}
 
@@ -357,6 +342,31 @@
 	}
 }
 
+static void ttusb_dec_process_urb_frame_list(unsigned long data)
+{
+	struct ttusb_dec *dec = (struct ttusb_dec *)data;
+	struct list_head *item;
+	struct urb_frame *frame;
+	unsigned long flags;
+
+	while (1) {
+		spin_lock_irqsave(&dec->urb_frame_list_lock, flags);
+		if ((item = dec->urb_frame_list.next) != &dec->urb_frame_list) {
+			frame = list_entry(item, struct urb_frame,
+					   urb_frame_list);
+			list_del(&frame->urb_frame_list);
+		} else {
+			spin_unlock_irqrestore(&dec->urb_frame_list_lock,
+					       flags);
+			return;
+		}
+		spin_unlock_irqrestore(&dec->urb_frame_list_lock, flags);
+
+		ttusb_dec_process_urb_frame(dec, frame->data, frame->length);
+		kfree(frame);
+	}
+}
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 static void ttusb_dec_process_urb(struct urb *urb)
 #else
@@ -372,12 +382,28 @@
 			struct usb_iso_packet_descriptor *d;
 			u8 *b;
 			int length;
+			struct urb_frame *frame;
 
 			d = &urb->iso_frame_desc[i];
 			b = urb->transfer_buffer + d->offset;
 			length = d->actual_length;
 
-			ttusb_dec_process_urb_frame(dec, b, length);
+			if ((frame = kmalloc(sizeof(struct urb_frame),
+					     GFP_ATOMIC))) {
+				unsigned long flags;
+
+				memcpy(frame->data, b, length);
+				frame->length = length;
+
+				spin_lock_irqsave(&dec->urb_frame_list_lock,
+						     flags);
+				list_add_tail(&frame->urb_frame_list,
+					      &dec->urb_frame_list);
+				spin_unlock_irqrestore(&dec->urb_frame_list_lock,
+						       flags);
+
+				tasklet_schedule(&dec->urb_tasklet);
+			}
 		}
 	} else {
 		 /* -ENOENT is expected when unlinking urbs */
@@ -653,6 +679,14 @@
 	return 0;
 }
 
+static void ttusb_dec_init_tasklet(struct ttusb_dec *dec)
+{
+	dec->urb_frame_list_lock = SPIN_LOCK_UNLOCKED;
+	INIT_LIST_HEAD(&dec->urb_frame_list);
+	tasklet_init(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list,
+		     (unsigned long)dec);
+}
+
 static void ttusb_dec_init_v_pes(struct ttusb_dec *dec)
 {
 	dprintk("%s\n", __FUNCTION__);
@@ -834,8 +868,6 @@
 		return result;
 	}
 
-	sema_init(&dec->pes2ts_sem, 1);
-
 	dvb_net_init(dec->adapter, &dec->dvb_net, &dec->demux.dmx);
 
 	return 0;
@@ -868,6 +900,20 @@
 	ttusb_dec_free_iso_urbs(dec);
 }
 
+static void ttusb_dec_exit_tasklet(struct ttusb_dec *dec)
+{
+	struct list_head *item;
+	struct urb_frame *frame;
+
+	tasklet_kill(&dec->urb_tasklet);
+
+	while ((item = dec->urb_frame_list.next) != &dec->urb_frame_list) {
+		frame = list_entry(item, struct urb_frame, urb_frame_list);
+		list_del(&frame->urb_frame_list);
+		kfree(frame);
+	}
+}
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 static void *ttusb_dec_probe(struct usb_device *udev, unsigned int ifnum,
 			     const struct usb_device_id *id)
@@ -892,6 +938,7 @@
 	ttusb_dec_init_stb(dec);
 	ttusb_dec_init_dvb(dec);
 	ttusb_dec_init_v_pes(dec);
+	ttusb_dec_init_tasklet(dec);
 
 	return (void *)dec;
 }
@@ -919,6 +966,7 @@
 	ttusb_dec_init_stb(dec);
 	ttusb_dec_init_dvb(dec);
 	ttusb_dec_init_v_pes(dec);
+	ttusb_dec_init_tasklet(dec);
 
 	usb_set_intfdata(intf, (void *)dec);
 	ttusb_dec_set_streaming_interface(dec);
@@ -941,6 +989,7 @@
 
 	dprintk("%s\n", __FUNCTION__);
 
+	ttusb_dec_exit_tasklet(dec);
 	ttusb_dec_exit_usb(dec);
 	ttusb_dec_exit_dvb(dec);
 
diff -uNrwB --new-file linux-2.6.0-test2.work/drivers/media/dvb/ttusb-dec/ttusb_dec.h linux-2.6.0-test2.patch/drivers/media/dvb/ttusb-dec/ttusb_dec.h
--- linux-2.6.0-test2.work/drivers/media/dvb/ttusb-dec/ttusb_dec.h	2003-07-29 09:10:18.000000000 +0200
+++ linux-2.6.0-test2.patch/drivers/media/dvb/ttusb-dec/ttusb_dec.h	2003-07-21 13:42:42.000000000 +0200
@@ -22,7 +22,10 @@
 #ifndef _TTUSB_DEC_H
 #define _TTUSB_DEC_H
 
-#include "asm/semaphore.h"
+#include <asm/semaphore.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/spinlock.h>
 #include "dmxdev.h"
 #include "dvb_demux.h"
 #include "dvb_filter.h"
@@ -77,11 +80,20 @@
 
 	struct dvb_filter_pes2ts	a_pes2ts;
 	struct dvb_filter_pes2ts	v_pes2ts;
-	struct semaphore		pes2ts_sem;
 
 	u8			v_pes[16 + MAX_AV_PES_LENGTH];
 	int			v_pes_length;
 	int			v_pes_postbytes;
+
+	struct list_head	urb_frame_list;
+	struct tasklet_struct	urb_tasklet;
+	spinlock_t		urb_frame_list_lock;
+};
+
+struct urb_frame {
+	u8			data[ISO_FRAME_SIZE];
+	int			length;
+	struct list_head	urb_frame_list;
 };
 
 #endif


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

* Re: [PATCH 1/6] [DVB] Kconfig and Makefile updates
  2003-07-29  9:30 [PATCH 1/6] [DVB] Kconfig and Makefile updates Michael Hunold
  2003-07-29  9:30 ` [PATCH 2/6] [DVB] DVB core update Michael Hunold
@ 2003-07-29  9:58 ` Roman Zippel
  2003-07-29 10:02   ` Michael Hunold
  1 sibling, 1 reply; 8+ messages in thread
From: Roman Zippel @ 2003-07-29  9:58 UTC (permalink / raw)
  To: Michael Hunold; +Cc: linux-kernel, alan, torvalds

Hi,

On Tue, 29 Jul 2003, Michael Hunold wrote:

>  config VIDEO_SAA7146
>          tristate
> -        default y if DVB_AV7110=y || DVB_BUDGET=y || DVB_BUDGET_AV=y || VIDEO_MXB=y || VIDEO_DPC=y
> -        default m if DVB_AV7110=m || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m || VIDEO_DPC=m
> -        depends on VIDEO_DEV && PCI
> +        default y if DVB_AV7110=y || DVB_BUDGET=y || DVB_BUDGET_AV=y || VIDEO_MXB=y || VIDEO_DPC=y || VIDEO_HEXIUM_ORION=y || VIDEO_HEXIUM_GEMINI=y
> +        default m if DVB_AV7110=m || DVB_BUDGET=m || DVB_BUDGET_AV=m || VIDEO_MXB=m || VIDEO_DPC=m || VIDEO_HEXIUM_ORION=m || VIDEO_HEXIUM_GEMINI=m
> +        depends on VIDEO_DEV && PCI && I2C

You can change this also into:

config VIDEO_SAA7146
	def_tristate DVB_AV7110 || DVB_BUDGET || DVB_BUDGET_AV || \
		     VIDEO_MXB || VIDEO_DPC || VIDEO_HEXIUM_ORION || \
		     VIDEO_HEXIUM_GEMINI
	depends on VIDEO_DEV && PCI && I2C

bye, Roman


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

* Re: [PATCH 1/6] [DVB] Kconfig and Makefile updates
  2003-07-29  9:58 ` [PATCH 1/6] [DVB] Kconfig and Makefile updates Roman Zippel
@ 2003-07-29 10:02   ` Michael Hunold
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Hunold @ 2003-07-29 10:02 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel, alan, torvalds

Hello Roman,

> You can change this also into:
> 
> config VIDEO_SAA7146
> 	def_tristate DVB_AV7110 || DVB_BUDGET || DVB_BUDGET_AV || \
> 		     VIDEO_MXB || VIDEO_DPC || VIDEO_HEXIUM_ORION || \
> 		     VIDEO_HEXIUM_GEMINI
> 	depends on VIDEO_DEV && PCI && I2C

Thanks! I've submitted it to our CVS, it will be in the next patchset.

> bye, Roman

CU
Michael.


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

end of thread, other threads:[~2003-07-29 10:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29  9:30 [PATCH 1/6] [DVB] Kconfig and Makefile updates Michael Hunold
2003-07-29  9:30 ` [PATCH 2/6] [DVB] DVB core update Michael Hunold
2003-07-29  9:30   ` [PATCH 3/6] [DVB] mt312 DVB frontend update Michael Hunold
2003-07-29  9:30     ` [PATCH 4/6] [DVB] Update MAC handling for various DVB PCI cards Michael Hunold
2003-07-29  9:30       ` [PATCH 5/6] [DVB] TTUSB-DEC driver update Michael Hunold
2003-07-29  9:30         ` [PATCH 6/6] [DVB] Hexium saa7146 " Michael Hunold
2003-07-29  9:58 ` [PATCH 1/6] [DVB] Kconfig and Makefile updates Roman Zippel
2003-07-29 10:02   ` Michael Hunold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).