Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Typhoon/budget*



Hi!

I've done some testing on my new typhoon (knc rip off) budget card. First off, 
if i use the budget-av driver, which is the only budget driver to recognize 
the card without modification, I get an oops because of the fact that the 
card does not have the av saa7146 extension. The attached patch named 
typhoon.diff fixes this problem, but i'm unsure if i've if'ed out too much or 
too little of the code if the av extension is not found.

With this patch the card gets detected by the budget-av module, but the 
frontend gets detected as a BSRU6 variation, but it's actually a SA7812. This 
problem is also actowledged by this post:
http://www.linuxtv.org/mailinglists/linux-dvb/2004/01-2004/msg00663.html

However, he did a modification to his card, and I don't really like that idea, 
so the attached patch (typhoon-stv0299.patch) does this in the driver. The 
problem is that with this mod, other stv0299 based frontends will fail to 
detect, so my question is: how can I detect if there is a bsru6 or sa1278 on 
the i2c address x?

When i have both patches in my tree the card and frontend get's detected just 
fine, but I can only get horizontal channels. I've done some debugging, and 
once in a great while, when switching to 13v the stv0299_set_voltage call 
returns -5?? Any ideas here? Want more info?

I've downloaded the saa7146 datasheet from Philips, but where can i get the 
frontend (stv0299 based primarily) datasheets?

Btw, I've also tested the budget-ci driver, and that is also doing the job 
fine..if the pci ids is added that is. Could not these budget drivers be 
combined?

Kenneth
Index: stv0299.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/stv0299.c,v
retrieving revision 1.40
diff -u -r1.40 stv0299.c
--- stv0299.c	14 Mar 2004 13:48:32 -0000	1.40
+++ stv0299.c	16 Mar 2004 23:31:41 -0000
@@ -386,7 +386,7 @@
 	switch(ftype) {
 	case PHILIPS_SU1278_TSA:
 	case PHILIPS_SU1278_TSA_TT:
-		addr = 0x60;
+		addr = 0x61;
 		buf[3] |= 0x20;
 
 		if (srate < 4000000) buf[3] |= 1;
@@ -1246,7 +1246,7 @@
 	u8 tda6100_buf [] = { 0, 0 };
 	int ret;
 	struct i2c_msg msg1 [] = {{ .addr = 0x68, .flags = 0, .buf = rpt,  len: 2 },
-			   { .addr = 0x60, .flags = I2C_M_RD, .buf = stat, .len = 1 }};
+			   { .addr = 0x61, .flags = I2C_M_RD, .buf = stat, .len = 1 }};
 	struct i2c_msg msg2 [] = {{ .addr = 0x68, .flags = 0, .buf = rpt,  len: 2 },
 			   { .addr = 0x61, .flags = I2C_M_RD, .buf = stat, .len = 1 }};
 	struct i2c_msg msg3 [] = {{ .addr = 0x68, .flags = 0, .buf = rpt,  len: 2 },
Index: budget-av.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttpci/budget-av.c,v
retrieving revision 1.17
diff -u -r1.17 budget-av.c
--- budget-av.c	15 Mar 2004 19:38:15 -0000	1.17
+++ budget-av.c	16 Mar 2004 23:19:41 -0000
@@ -39,6 +39,7 @@
 	struct budget budget;
 	struct video_device vd;
 	int cur_input;
+	int has_saa7113;
 };
 
 /****************************************************************************
@@ -149,6 +150,9 @@
 {
 	struct budget *budget = &budget_av->budget;
 
+	if ( 1 != budget_av->has_saa7113 )
+		return -ENODEV;
+
 	if (input == 1) {
 		i2c_writereg(budget->i2c_bus, 0x4a, 0x02, 0xc7);
 		i2c_writereg(budget->i2c_bus, 0x4a, 0x09, 0x80);
@@ -170,11 +174,13 @@
 
 	DEB_EE(("dev: %p\n",dev));
 
-	saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
+	if ( 1 == budget_av->has_saa7113 ) {
+		saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
 
-	dvb_delay(200);
+		dvb_delay(200);
 
-	saa7146_unregister_device (&budget_av->vd, dev);
+		saa7146_unregister_device (&budget_av->vd, dev);
+	}
 
 	err = ttpci_budget_deinit (&budget_av->budget);
 
@@ -221,39 +227,34 @@
 	saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTHI);
 	dvb_delay(500);
 
-	if ((err = saa7113_init (budget_av))) {
-		/* fixme: proper cleanup here */
-		ERR(("cannot init saa7113.\n"));
-		return err;
-	}
-
-	if ( 0 != saa7146_vv_init(dev,&vv_data)) {
-		/* fixme: proper cleanup here */
-		ERR(("cannot init vv subsystem.\n"));
-		return err;
-	}
-	
-	if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1",
-					   VFL_TYPE_GRABBER)))
-	{
-		/* fixme: proper cleanup here */
-		ERR(("cannot register capture v4l2 device.\n"));
-		return err;
+	if ( 0 == saa7113_init(budget_av) ) {
+		budget_av->has_saa7113 = 1;
+		
+		if ( 0 != saa7146_vv_init(dev,&vv_data)) {
+			/* fixme: proper cleanup here */
+			ERR(("cannot init vv subsystem.\n"));
+			return err;
+		}
+		
+		if ((err = saa7146_register_device(&budget_av->vd, dev, "knc1",
+						   VFL_TYPE_GRABBER)))
+		{
+			/* fixme: proper cleanup here */
+			ERR(("cannot register capture v4l2 device.\n"));
+			return err;
+		}
+		
+		/* beware: this modifies dev->vv ... */
+		saa7146_set_hps_source_and_sync(dev, SAA7146_HPS_SOURCE_PORT_A,
+						SAA7146_HPS_SYNC_PORT_A);
+		
+		saa7113_setinput (budget_av, 0);
+	} else {
+		budget_av->has_saa7113 = 0;
+		
+		saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
 	}
 
-	/* beware: this modifies dev->vv ... */
-	saa7146_set_hps_source_and_sync(dev, SAA7146_HPS_SOURCE_PORT_A,
-					SAA7146_HPS_SYNC_PORT_A);
-
-	saa7113_setinput (budget_av, 0);
-
-	/* what is this? since we don't support open()/close()
-	   notifications, we simply put this into the release handler... */
-/*
-	saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTLO);
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout (20);
-*/
 	/* fixme: find some sane values here... */
 	saa7146_write(dev, PCI_BT_V1, 0x1c00101f);
 

Home | Main Index | Thread Index