[PATCH] usbvision-0.3.3-test2, for saa7113

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



Here's the patch to get the SAA7113 chipset working with the usbvision 
drivers.

Most of it is modifications to the saa7113 setup registers.  However some 
minor changes were made to usbvision to setup the NT chips properly.  These 
changes have been placed inside conditionals which check the codec specified 
device structure so they should be safe to use with other codec types.


Changes:
usbvision.h -- fixed usbvision device data structure, incorrectly had (0x0573, 
0x4d21) for WinTV-USB II, should be 0x4d20.
               0x4d21 doesn't have an fm tuner.
            -- added real 0x4d21 entry
            -- Added USBVISION_8_422_SYNC


usbvision.c -- usbvision_power_on(), changed input format to be dependant on 
the decoder present.
            -- disabled multiple configurations test, to allow them to work.  
The default config should work.
            -- usbvision_set_input(), added setup for DVI_YUV order.  This 
value changes as we modify the fine control
               in the saa7113 driver.  Needs to be looked at further.


saa7113-new.c -- Tuned lots of setup registers.
                 0x06 & 0x07, changed hsync start/stop to recommend values in 
spec sheet, gives a better centered image.
                 0x0f, use automatic chromanance gain control, rather than 
fixed value.
                 0x10, fixed line length for 50Hz to 288.  Also includes fine 
control for hsync.
                 0x12, controls the output on RTS0 & RTS1 pins.  RTS0 must be 
an hsync mode and RTS1 must be a vsync.  don't
                       know exactly which one to use though.


Have fun,
	Cameron Maxwell

-- 
I don't want to sell you any death sticks...
I think I'll go home and rethink my life...
diff -urN usbvision-0.3.3-test2/src/saa7113-new.c patch/src/saa7113-new.c
--- usbvision-0.3.3-test2/src/saa7113-new.c	Sun Apr  7 07:11:23 2002
+++ patch/src/saa7113-new.c	Tue Jul 30 18:24:56 2002
@@ -156,8 +156,8 @@
         0x03, 0x23, 
         0x04, 0x00, 
         0x05, 0x00, 
-        0x06, 0xeb,
-        0x07, 0xe0,
+        0x06, 0xe9, /* Start of hsync */
+        0x07, 0x0d, /* End of hsync */
 
         0x08, 0x88, 
         0x09, 0x00, 
@@ -166,11 +166,11 @@
         0x0c, 0x40, 
         0x0d, 0x00,
         0x0e, 0x01, 
-        0x0f, 0xaa,
+        0x0f, 0x2a, /* Use automatic chromance gain */
         
-        0x10, 0x00, 
+        0x10, 0x28,
         0x11, 0x1C, 
-        0x12, 0x01, 
+        0x12, 0xc8, /* RTS0 -> programmable HS, RTS1 -> V123., don't know about RTS1 */
         0x13, 0x00,
         0x15, 0x00,
         0x16, 0x00, 
diff -urN usbvision-0.3.3-test2/src/usbvision.c patch/src/usbvision.c
--- usbvision-0.3.3-test2/src/usbvision.c	Sun Apr  7 23:42:22 2002
+++ patch/src/usbvision.c	Tue Jul 30 19:00:43 2002
@@ -82,6 +82,11 @@
  * Feb 10, 2002 
  *     - Added radio device
  *
+ * Jul 30, 2002
+ *     - Added entry for WinTV-USB II (0x0573. 0x4D21)
+ *     - Added NT100x setup options for the SAA7113.  Essentially uses 8-bit data
+ *       bus between decoder and NT100x chip rather than 16-bit.  Also uses different
+ *       YUV order.
  *            
  *            
  * TODO:
@@ -2390,8 +2395,16 @@
 		return rc;
 	}
 
-	/* U comes after V, Ya comes after U/V, Yb comes after Yb */
-	return (usbvision_write_reg(usbvision, USBVISION_DVI_YUV, 0x00));
+	if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113)
+        {
+        	/* This changes as the fine sync control changes. Further investigation necessary */
+		return (usbvision_write_reg(usbvision, USBVISION_DVI_YUV, 0x06));
+        }
+        else
+        {
+		/* U comes after V, Ya comes after U/V, Yb comes after Yb */
+		return (usbvision_write_reg(usbvision, USBVISION_DVI_YUV, 0x00));
+        }
 }
 
 /*
@@ -2482,10 +2495,19 @@
 	usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN);
 	usbvision_write_reg(usbvision, USBVISION_PWR_REG,
 			 USBVISION_SSPND_EN | USBVISION_RES2);
-	/* I'm sure only about d2-d0 [010] 16 bit 4:2:2 usin sync pulses 
-	 * as that is how saa7111 is configured */
-	usbvision_write_reg(usbvision, USBVISION_VIN_REG1, USBVISION_16_422_SYNC);
-	/* | USBVISION_VSNC_POL | USBVISION_VCLK_POL);*/
+        /* Set input format expected from decoder, should this be moved to usbvision_set_input() ?? */
+        if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113)
+        {
+		/* SAA7113 uses 8 bit output */
+		usbvision_write_reg(usbvision, USBVISION_VIN_REG1, USBVISION_8_422_SYNC);
+        }
+        else
+        {
+		/* I'm sure only about d2-d0 [010] 16 bit 4:2:2 usin sync pulses 
+		 * as that is how saa7111 is configured */
+		usbvision_write_reg(usbvision, USBVISION_VIN_REG1, USBVISION_16_422_SYNC);
+		/* | USBVISION_VSNC_POL | USBVISION_VCLK_POL);*/
+        }
 	usbvision_write_reg(usbvision, USBVISION_PWR_REG,
 			 USBVISION_SSPND_EN | USBVISION_PWR_VID);
 	printk(KERN_DEBUG "usbvision_power_on\n");
@@ -3948,8 +3970,10 @@
 		printk(KERN_DEBUG "usbvision_probe(%p,%u.)\n", dev, ifnum);
 
 	/* We don't handle multi-config */
+        /*
 	if (dev->descriptor.bNumConfigurations != 1)
 		return NULL;
+        */
 
 	/* Is it an USBVISION video dev? */
 	model = 0;
diff -urN usbvision-0.3.3-test2/src/usbvision.h patch/src/usbvision.h
--- usbvision-0.3.3-test2/src/usbvision.h	Wed Apr 10 22:53:49 2002
+++ patch/src/usbvision.h	Tue Jul 30 17:33:38 2002
@@ -44,6 +44,7 @@
 #define USBVISION_DRM_PRM7				0x19
 #define USBVISION_DRM_PRM8				0x1A
 #define USBVISION_VIN_REG1				0x1B
+	#define USBVISION_8_422_SYNC			0x00
 	#define USBVISION_16_422_SYNC			0x02
 	#define USBVISION_VSNC_POL			(1 << 3)
 	#define USBVISION_HSNC_POL			(1 << 4)
@@ -317,7 +318,8 @@
 	{0x0573, 0x4D03, 959, -1, CODEC_SAA7111, 3, VIDEO_MODE_SECAM, 1, 0, 1, 0, "HAUPPAUGE WINTV-USB France"},
 	{0x0573, 0x4D10, 959, -1, CODEC_SAA7111, 3, VIDEO_MODE_NTSC,  1, 0, 1, 0, "HAUPPAUGE WINTV-USB FM USA"},
 	{0x0573, 0x4D11, 959, -1, CODEC_SAA7111, 3, VIDEO_MODE_PAL,   1, 1, 1, TUNER_PHILIPS_PAL, "HAUPPAUGE WINTV-USB (PAL) FM"},
-	{0x0573, 0x4D21, 959,  0, CODEC_SAA7113, 3, VIDEO_MODE_PAL,   1, 1, 1, TUNER_PHILIPS_PAL, "HAUPPAUGE WINTV-USB II (PAL) FM"},
+	{0x0573, 0x4D20, 959,  0, CODEC_SAA7113, 3, VIDEO_MODE_PAL,   1, 1, 1, TUNER_PHILIPS_PAL, "HAUPPAUGE WINTV-USB II (PAL) FM"},
+	{0x0573, 0x4D21, 959,  0, CODEC_SAA7113, 3, VIDEO_MODE_PAL,   1, 0, 1, TUNER_PHILIPS_PAL, "HAUPPAUGE WINTV-USB II (PAL)"},
 	{0x2304, 0x0111, 959, -1, CODEC_SAA7111, 3, 0,                1, 0, 1, TUNER_PHILIPS_PAL, "Miro PCTV USB"},
 	{0x2304, 0x0210, 959, -1, CODEC_SAA7111, 3, VIDEO_MODE_PAL,   1, 0, 1, TUNER_PHILIPS_PAL, "Pinnacle Studio PCTV USB (PAL) FM"},
 	{0x2304, 0x0212, 959, -1, CODEC_SAA7113, 3, VIDEO_MODE_NTSC,  1, 0, 1, TUNER_TEMIC_4039FR5_NTSC, "Pinnacle Studio PCTV USB (NTSC)"},
@@ -338,6 +340,7 @@
 	{ USB_DEVICE(0x0573, 0x4d10) },  /* Hauppauge WINTV-USB with FM USA radio */
 	{ USB_DEVICE(0x0573, 0x4d11) },  /* Hauppauge WINTV-USB (PAL) with FM radio */
 	{ USB_DEVICE(0x0573, 0x4d20) },  /* Hauppauge WINTV-USB II (PAL) with FM radio */
+	{ USB_DEVICE(0x0573, 0x4d21) },  /* Hauppauge WINTV-USB II (PAL) */
 	{ USB_DEVICE(0x2304, 0x0111) },  /* Miro PCTV USB */
 	{ USB_DEVICE(0x2304, 0x0210) },  /* Pinnalce Studio PCTV USB (PAL) with FM radio*/
 	{ USB_DEVICE(0x2304, 0x0212) },  /* Pinnalce Studio PCTV USB (NTSC)*/

[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux