All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 10/12] tm6000: bugfix usb DVB transfer
@ 2010-02-05 23:06 stefan.ringel
  2010-02-05 23:06 ` [PATCH 11/12] tm6000: bugfix firmware xc3028L-v36.fw used with Zarlink and DTV78 or DTV8 no shift stefan.ringel
  0 siblings, 1 reply; 7+ messages in thread
From: stefan.ringel @ 2010-02-05 23:06 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel

From: Stefan Ringel <stefan.ringel@arcor.de>

Signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>
---
 drivers/staging/tm6000/tm6000-dvb.c |  125 ++++++++++++++++++++++-------------
 1 files changed, 79 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/tm6000/tm6000-dvb.c b/drivers/staging/tm6000/tm6000-dvb.c
index fdbee30..055a58f 100644
--- a/drivers/staging/tm6000/tm6000-dvb.c
+++ b/drivers/staging/tm6000/tm6000-dvb.c
@@ -17,7 +17,9 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/kernel.h>
 #include <linux/usb.h>
+#include <compat.h>
 
 #include "tm6000.h"
 #include "tm6000-regs.h"
@@ -30,13 +32,58 @@
 
 #include "tuner-xc2028.h"
 
+static void inline print_err_status (struct tm6000_core *dev,
+				     int packet, int status)
+{
+	char *errmsg = "Unknown";
+
+	switch(status) {
+	case -ENOENT:
+		errmsg = "unlinked synchronuously";
+		break;
+	case -ECONNRESET:
+		errmsg = "unlinked asynchronuously";
+		break;
+	case -ENOSR:
+		errmsg = "Buffer error (overrun)";
+		break;
+	case -EPIPE:
+		errmsg = "Stalled (device not responding)";
+		break;
+	case -EOVERFLOW:
+		errmsg = "Babble (bad cable?)";
+		break;
+	case -EPROTO:
+		errmsg = "Bit-stuff error (bad cable?)";
+		break;
+	case -EILSEQ:
+		errmsg = "CRC/Timeout (could be anything)";
+		break;
+	case -ETIME:
+		errmsg = "Device does not respond";
+		break;
+	}
+	if (packet<0) {
+		dprintk(dev, 1, "URB status %d [%s].\n",
+			status, errmsg);
+	} else {
+		dprintk(dev, 1, "URB packet %d, status %d [%s].\n",
+			packet, status, errmsg);
+	}
+}
+
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+static void tm6000_urb_received(struct urb *urb, struct pt_regs *ptregs)
+#else
 static void tm6000_urb_received(struct urb *urb)
+#endif
 {
 	int ret;
 	struct tm6000_core* dev = urb->context;
 
-	if(urb->status != 0){
-		printk(KERN_ERR "tm6000: status != 0\n");
+	if(urb->status != 0) {
+		print_err_status (dev,0,urb->status);
 	}
 	else if(urb->actual_length>0){
 		dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
@@ -56,49 +103,37 @@ static void tm6000_urb_received(struct urb *urb)
 int tm6000_start_stream(struct tm6000_core *dev)
 {
 	int ret;
-	unsigned int pipe, maxPaketSize;
+	unsigned int pipe, size;
 	struct tm6000_dvb *dvb = dev->dvb;
 
 	printk(KERN_INFO "tm6000: got start stream request %s\n",__FUNCTION__);
 
 	tm6000_init_digital_mode(dev);
 
-/*
-	ret = tm6000_set_led_status(tm6000_dev, 0x1);
-	if(ret < 0) {
-		return -1;
-	}
-*/
-
 	dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL);
 	if(dvb->bulk_urb == NULL) {
 		printk(KERN_ERR "tm6000: couldn't allocate urb\n");
 		return -ENOMEM;
 	}
 
-	maxPaketSize = dev->bulk_in->desc.wMaxPacketSize;
+	pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in->desc.bEndpointAddress
+							  & USB_ENDPOINT_NUMBER_MASK);
+							  
+	size = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe));
+	size = size * 15; /* 512 x 8 or 12 or 15 */
 
-	dvb->bulk_urb->transfer_buffer = kzalloc(maxPaketSize, GFP_KERNEL);
+	dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
 	if(dvb->bulk_urb->transfer_buffer == NULL) {
 		usb_free_urb(dvb->bulk_urb);
 		printk(KERN_ERR "tm6000: couldn't allocate transfer buffer!\n");
 		return -ENOMEM;
 	}
 
-	pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in->desc.bEndpointAddress
-							  & USB_ENDPOINT_NUMBER_MASK);
-
 	usb_fill_bulk_urb(dvb->bulk_urb, dev->udev, pipe,
 						 dvb->bulk_urb->transfer_buffer,
-						 maxPaketSize,
+						 size,
 						 tm6000_urb_received, dev);
 
-	ret = usb_set_interface(dev->udev, 0, 1);
-	if(ret < 0) {
-		printk(KERN_ERR "tm6000: error %i in %s during set interface\n", ret, __FUNCTION__);
-		return ret;
-	}
-
 	ret = usb_clear_halt(dev->udev, pipe);
 	if(ret < 0) {
 		printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",ret,__FUNCTION__);
@@ -108,14 +143,13 @@ int tm6000_start_stream(struct tm6000_core *dev)
 		printk(KERN_ERR "tm6000: pipe resetted\n");
 	}
 
-// 	mutex_lock(&tm6000_driver.open_close_mutex);
+/*	mutex_lock(&tm6000_driver.open_close_mutex); */
 	ret = usb_submit_urb(dvb->bulk_urb, GFP_KERNEL);
 
-
-// 	mutex_unlock(&tm6000_driver.open_close_mutex);
+/*	mutex_unlock(&tm6000_driver.open_close_mutex); */
 	if (ret) {
 		printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",ret);
-
+		
 		kfree(dvb->bulk_urb->transfer_buffer);
 		usb_free_urb(dvb->bulk_urb);
 		return ret;
@@ -126,18 +160,12 @@ int tm6000_start_stream(struct tm6000_core *dev)
 
 void tm6000_stop_stream(struct tm6000_core *dev)
 {
-	int ret;
 	struct tm6000_dvb *dvb = dev->dvb;
 
-// 	tm6000_set_led_status(tm6000_dev, 0x0);
-
-	ret = usb_set_interface(dev->udev, 0, 0);
-	if(ret < 0) {
-		printk(KERN_ERR "tm6000: error %i in %s during set interface\n",ret,__FUNCTION__);
-	}
-
 	if(dvb->bulk_urb) {
+		printk (KERN_INFO "urb killing\n");
 		usb_kill_urb(dvb->bulk_urb);
+		printk (KERN_INFO "urb buffer free\n");
 		kfree(dvb->bulk_urb->transfer_buffer);
 		usb_free_urb(dvb->bulk_urb);
 		dvb->bulk_urb = NULL;
@@ -154,7 +182,7 @@ int tm6000_start_feed(struct dvb_demux_feed *feed)
 	mutex_lock(&dvb->mutex);
 	if(dvb->streams == 0) {
 		dvb->streams = 1;
-// 		mutex_init(&tm6000_dev->streaming_mutex);
+/*		mutex_init(&tm6000_dev->streming_mutex); */
 		tm6000_start_stream(dev);
 	}
 	else {
@@ -173,14 +201,16 @@ int tm6000_stop_feed(struct dvb_demux_feed *feed) {
 	printk(KERN_INFO "tm6000: got stop feed request %s\n",__FUNCTION__);
 
 	mutex_lock(&dvb->mutex);
-	--dvb->streams;
 
-	if(0 == dvb->streams) {
+	printk (KERN_INFO "stream %#x\n", dvb->streams);
+	--(dvb->streams);
+	if(dvb->streams == 0) {
+		printk (KERN_INFO "stop stream\n");
 		tm6000_stop_stream(dev);
-// 		mutex_destroy(&tm6000_dev->streaming_mutex);
+/*		mutex_destroy(&tm6000_dev->streaming_mutex); */
 	}
 	mutex_unlock(&dvb->mutex);
-// 	mutex_destroy(&tm6000_dev->streaming_mutex);
+/*	mutex_destroy(&tm6000_dev->streaming_mutex); */
 
 	return 0;
 }
@@ -191,13 +221,16 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev)
 
 	if(dev->caps.has_zl10353) {
 		struct zl10353_config config =
-				    {.demod_address = dev->demod_addr >> 1,
+				    {.demod_address = dev->demod_addr,
 				     .no_tuner = 1,
-// 				     .input_frequency = 0x19e9,
-// 				     .r56_agc_targets =  0x1c,
+				     .parallel_ts = 1,
+				     .if2 = 45700,
+				     .disable_i2c_gate_ctrl = 1,
+				     .tm6000 = 1,
 				    };
 
 		dvb->frontend = pseudo_zl10353_attach(dev, &config,
+/*		dvb->frontend = dvb_attach (zl10353_attach, &config, */
 							   &dev->i2c_adap);
 	}
 	else {
@@ -259,8 +292,8 @@ int tm6000_dvb_register(struct tm6000_core *dev)
 	dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING
 							    | DMX_MEMORY_BASED_FILTERING;
 	dvb->demux.priv = dev;
-	dvb->demux.filternum = 256;
-	dvb->demux.feednum = 256;
+	dvb->demux.filternum = 5; /* 256; */
+	dvb->demux.feednum = 5; /* 256; */
 	dvb->demux.start_feed = tm6000_start_feed;
 	dvb->demux.stop_feed = tm6000_stop_feed;
 	dvb->demux.write_to_decoder = NULL;
@@ -308,7 +341,7 @@ void tm6000_dvb_unregister(struct tm6000_core *dev)
 		usb_free_urb(bulk_urb);
 	}
 
-// 	mutex_lock(&tm6000_driver.open_close_mutex);
+/*	mutex_lock(&tm6000_driver.open_close_mutex); */
 	if(dvb->frontend) {
 		dvb_frontend_detach(dvb->frontend);
 		dvb_unregister_frontend(dvb->frontend);
@@ -318,6 +351,6 @@ void tm6000_dvb_unregister(struct tm6000_core *dev)
 	dvb_dmx_release(&dvb->demux);
 	dvb_unregister_adapter(&dvb->adapter);
 	mutex_destroy(&dvb->mutex);
-// 	mutex_unlock(&tm6000_driver.open_close_mutex);
+/*	mutex_unlock(&tm6000_driver.open_close_mutex); */
 
 }
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 1/12] tm6000: add Terratec Cinergy Hybrid XE
@ 2010-02-05 22:48 stefan.ringel
  2010-02-05 22:48 ` [PATCH 2/12] tm6000: avoid unregister the driver after success at tm6000_init_dev stefan.ringel
  0 siblings, 1 reply; 7+ messages in thread
From: stefan.ringel @ 2010-02-05 22:48 UTC (permalink / raw)
  To: linux-media; +Cc: mchehab, dheitmueller, Stefan Ringel

From: Stefan Ringel <stefan.ringel@arcor.de>

---
 drivers/staging/tm6000/tm6000-cards.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index c4db903..7f594a2 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -44,6 +44,10 @@
 #define TM6000_BOARD_FREECOM_AND_SIMILAR	7
 #define TM6000_BOARD_ADSTECH_MINI_DUAL_TV	8
 #define TM6010_BOARD_HAUPPAUGE_900H		9
+#define TM6010_BOARD_BEHOLD_WANDER		10
+#define TM6010_BOARD_BEHOLD_VOYAGER		11
+#define TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE	12
+
 
 #define TM6000_MAXBOARDS        16
 static unsigned int card[]     = {[0 ... (TM6000_MAXBOARDS - 1)] = UNSET };
@@ -208,7 +212,21 @@ struct tm6000_board tm6000_boards[] = {
 		},
 		.gpio_addr_tun_reset = TM6000_GPIO_2,
 	},
-
+	[TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
+		.name         = "Terratec Cinergy Hybrid XE",
+		.tuner_type   = TUNER_XC2028, /* has a XC3028 */
+		.tuner_addr   = 0xc2 >> 1,
+		.demod_addr   = 0x1e >> 1,
+		.type         = TM6010,
+		.caps = {
+			.has_tuner    = 1,
+			.has_dvb      = 1,
+			.has_zl10353  = 1,
+			.has_eeprom   = 1,
+			.has_remote   = 1,
+		},
+		.gpio_addr_tun_reset = TM6010_GPIO_2,
+	}
 };
 
 /* table of devices that work with this driver */
@@ -221,6 +239,7 @@ struct usb_device_id tm6000_id_table [] = {
 	{ USB_DEVICE(0x2040, 0x6600), .driver_info = TM6010_BOARD_HAUPPAUGE_900H },
 	{ USB_DEVICE(0x6000, 0xdec0), .driver_info = TM6010_BOARD_BEHOLD_WANDER },
 	{ USB_DEVICE(0x6000, 0xdec1), .driver_info = TM6010_BOARD_BEHOLD_VOYAGER },
+	{ USB_DEVICE(0x0ccd, 0x0086), .driver_info = TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE },
 	{ },
 };
 
@@ -311,6 +330,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev)
 
 		switch(dev->model) {
 		case TM6010_BOARD_HAUPPAUGE_900H:
+		case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
 			ctl.fname = "xc3028L-v36.fw";
 			break;
 		default:
-- 
1.6.4.2


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

end of thread, other threads:[~2010-02-08 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-05 23:06 [PATCH 10/12] tm6000: bugfix usb DVB transfer stefan.ringel
2010-02-05 23:06 ` [PATCH 11/12] tm6000: bugfix firmware xc3028L-v36.fw used with Zarlink and DTV78 or DTV8 no shift stefan.ringel
2010-02-05 23:06   ` [PATCH 12/12] tm6000: add a different set param values stefan.ringel
2010-02-08 11:27   ` [PATCH 11/12] tm6000: bugfix firmware xc3028L-v36.fw used with Zarlink and DTV78 or DTV8 no shift Mauro Carvalho Chehab
2010-02-08 17:10     ` Stefan Ringel
2010-02-08 17:56       ` Mauro Carvalho Chehab
  -- strict thread matches above, loose matches on Subject: below --
2010-02-05 22:48 [PATCH 1/12] tm6000: add Terratec Cinergy Hybrid XE stefan.ringel
2010-02-05 22:48 ` [PATCH 2/12] tm6000: avoid unregister the driver after success at tm6000_init_dev stefan.ringel
2010-02-05 22:48   ` [PATCH 3/12] tm6000: clean the identifer string stefan.ringel
2010-02-05 22:48     ` [PATCH 4/12] tm6000: adding special usb request to quiting tuner transfer stefan.ringel
2010-02-05 22:48       ` [PATCH 5/12] tm6000: update init table and sequence for tm6010 stefan.ringel
2010-02-05 22:48         ` [PATCH 7/12] tm6000: add tuner callback for dvb frontend stefan.ringel
2010-02-05 22:48           ` [PATCH 8/12] tm6000: add tuner parameter stefan.ringel
2010-02-05 22:48             ` [PATCH 9/12] tm6000: remove unused function stefan.ringel
2010-02-05 22:48               ` [PATCH 10/12] tm6000: bugfix usb DVB transfer stefan.ringel
2010-02-05 22:48                 ` [PATCH 11/12] tm6000: bugfix firmware xc3028L-v36.fw used with Zarlink and DTV78 or DTV8 no shift stefan.ringel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.