This is a patch to bring the pg600 up to speed for the ntsc tuner input.
I still cannot get any audio (more on that in a second.) I have added a
module param for cx25840 called no_black_magic (default is off) because
the write to 0x43 seems to wreak havoc on my card, forcing me to turn
the machine off entirely to get the tuner back. So, for anyone who is
having pvr150 tuner problems (e.g. static when you think it should work)
try passing no_black_magic=1 to cx25840 (after a cold boot, of course).

I have a question specifically for those working with the pvr150/500
patches: the problems I have faced in getting the card up and running
have so far been a matter of mismatched inputs. On the pvr150 the tuner
input appears to be 6, whereas on my card it is 1. I think that my audio
has the same problem, but for the life of me I cannot figure out the
correct registers to set to get the card to bring up the correct audio
input (which for the pg600 should be input 3.) Any assistance would be
greatly appreciated.

Thanks to everyone who has contributed to the ivtv and v4l projects!
Jeff
diff -urb ivtv-0.3.2d/driver/cx25840-driver.c ivtv-0.3.2d-hack/driver/cx25840-driver.c
--- ivtv-0.3.2d/driver/cx25840-driver.c	2005-02-02 10:08:48.000000000 -0600
+++ ivtv-0.3.2d-hack/driver/cx25840-driver.c	2005-02-02 22:47:34.146673280 -0600
@@ -66,6 +66,10 @@
 MODULE_PARM(i2c_enable, "1-" __stringify(IVTV_MAX_CARDS) "i");
 MODULE_PARM_DESC(i2c_enable, "which 150/350 cards to activate the cx25840, conflicts with saa7127 or pvr350");
 
+static int no_black_magic = 0;
+MODULE_PARM(no_black_magic, "i");
+MODULE_PARM_DESC(no_black_magic, "Don't poke bits at 0x43 to power up tuner. Use for PG600!");
+
 #define MOD_NAME "cx25840"
 
 #define ERR(fmt, args...)  printk(KERN_ERR  MOD_NAME ": " fmt "\n" ,##args)
@@ -1095,6 +1099,7 @@
 	  setting_sequencer(client, seq);
 	  break;
       }
+      case 1:
       case 6: {
 	u8 seq[]={
 	  CX25840_TAG('T','u','n','n','e','r',' ','1','5','0'),
@@ -1107,7 +1112,7 @@
 	  CX25840_SET_CH_SEL_ADC2(0x0001),
 	    CX25840_SET_DUAL_MODE_ADC2(0x0000),
 	    CX25840_SET_CHIP_ACFG_DIS(0x0000),
-	    CX25840_SET_CH_1__SOURCE(0x0006),
+	    CX25840_SET_CH_1__SOURCE(state->input == 1 ? 0x0001:0x0006),
 	    CX25840_SET_CH_2__SOURCE(0x0000),
 	  CX25840_SET_CH_3__SOURCE(0x0001), // 1 for 150, 0 for 500
 	    CX25840_SET_AUX_PLL_POST(0x0020),
@@ -1169,6 +1174,7 @@
     state->enable = enable;
       
     if (state->enable) {
+	if (no_black_magic == 0) {	
       u8 seq[]={
 	CX25840_TAG('E','n','a','b','l','e'), //   Modified regs delta
 	
@@ -1184,8 +1191,26 @@
 	CX25840_EXECUTE,
 	
 	CX25840_END};
+      setting_sequencer(client, seq);
+	} else { 
+         u8 seq[]={
+	    CX25840_TAG('E','n','a','b','l','e'), //   Modified regs delta
+		
+	    //CX25840_SET_START_MICROCNTL(0x0000), // FW stop.
+	    CX25840_SET_SOFT_RESET(0x0001),      // Soft reset assert.
+	    CX25840_SET_VD_SOFT_RST(0x0001),     // Video assert
+                // 01063 time 3:37.684
+
+	    CX25840_EXECUTE,
+	
+	    //CX25840_SET_START_MICROCNTL(0x0001), // FW Start
+	    CX25840_SET_SOFT_RESET(0x0000),      // Deassert soft reset
+	    CX25840_SET_VD_SOFT_RST(0x0000),     // Deassert video reset
+	    CX25840_EXECUTE,
       
+	    CX25840_END};
       setting_sequencer(client, seq);
+     }
     } else {
  
     }
diff -urb ivtv-0.3.2d/driver/ivtv-cards.c ivtv-0.3.2d-hack/driver/ivtv-cards.c
--- ivtv-0.3.2d/driver/ivtv-cards.c	2005-02-02 10:09:33.000000000 -0600
+++ ivtv-0.3.2d-hack/driver/ivtv-cards.c	2005-02-02 21:35:42.318334856 -0600
@@ -415,7 +415,7 @@
 #define IVTV_MPG600_TUNER_I2C_ADDR 	0x60
 #define IVTV_MPG160_TUNER_I2C_ADDR 	0x60
 #define IVTV_M179_TUNER_I2C_ADDR 	0x60
-#define IVTV_PG600_TUNER_I2C_ADDR 	0xC0
+#define IVTV_PG600_TUNER_I2C_ADDR 	0x61
 
 static const struct ivtv_card_pci_info ivtv_pci_pvr150[] = {
 	{ PCI_DEVICE_ID_IVTV16, IVTV_PCI_ID_HAUPPAUGE, 0x8801 },
diff -urb ivtv-0.3.2d/driver/ivtv-driver.c ivtv-0.3.2d-hack/driver/ivtv-driver.c
--- ivtv-0.3.2d/driver/ivtv-driver.c	2005-02-02 10:09:33.000000000 -0600
+++ ivtv-0.3.2d-hack/driver/ivtv-driver.c	2005-02-02 21:35:42.319334704 -0600
@@ -453,12 +453,12 @@
 	itv->DMA_slock = SPIN_LOCK_UNLOCKED;
 
 #ifdef LINUX26
-	itv->vbi_work_queues = create_workqueue("ivtv_vbi");
+	itv->vbi_work_queues = create_workqueue("ivtv_vbi", PF_NOFREEZE);
 	if (itv->vbi_work_queues == NULL) {
 		IVTV_KERN_ERR("Could not create VBI workqueue\n");
 		return -1;
 	}
-	itv->fw_work_queues = create_workqueue("ivtv_fw");
+	itv->fw_work_queues = create_workqueue("ivtv_fw", PF_NOFREEZE);
 	if (itv->fw_work_queues == NULL) {
 		IVTV_KERN_ERR("Could not create FW workqueue\n");
 		return -1;
diff -urb ivtv-0.3.2d/driver/ivtv-fileops.c ivtv-0.3.2d-hack/driver/ivtv-fileops.c
--- ivtv-0.3.2d/driver/ivtv-fileops.c	2004-12-05 18:26:56.000000000 -0600
+++ ivtv-0.3.2d-hack/driver/ivtv-fileops.c	2005-02-02 21:35:42.322334248 -0600
@@ -79,7 +79,8 @@
 
 	IVTV_DEBUG(IVTV_DEBUG_INFO, "Checking digitizer\n");
 
-        if (itv->card->type == IVTV_CARD_PVR_150)
+        if ((itv->card->type == IVTV_CARD_PVR_150) || 
+        	(itv->card->type == IVTV_CARD_PG600))
                 ret = ivtv_cx25840(itv, DECODER_GET_STATUS, &sig);
         else
 		ret = ivtv_saa7115(itv, DECODER_GET_STATUS, &sig);
@@ -104,7 +105,8 @@
 
         /* x is just a placeholder. It's unused */
         /* this just resets the scaler.. shouldn't need to re-do any settings */
-        if (itv->card->type == IVTV_CARD_PVR_150)
+        if ((itv->card->type == IVTV_CARD_PVR_150) ||
+        	(itv->card->type == IVTV_CARD_PG600))
                 ret = ivtv_cx25840(itv, DECODER_RESET, &x);
         else
         	ret = ivtv_saa7115(itv, DECODER_RESET, &x);
@@ -1349,7 +1351,8 @@
 
        	IVTV_DEBUG(IVTV_DEBUG_INFO, "Disabling digitizer\n");
        	dig = 0;
-        if (itv->card->type == IVTV_CARD_PVR_150)
+        if ((itv->card->type == IVTV_CARD_PVR_150) ||
+        	(itv->card->type == IVTV_CARD_PG600))
                 ivtv_cx25840(itv, DECODER_ENABLE_OUTPUT, &dig);
         else
 		ivtv_saa7115(itv, DECODER_ENABLE_OUTPUT, &dig);
@@ -1368,7 +1371,8 @@
 
 	IVTV_DEBUG(IVTV_DEBUG_INFO, "Enabling digitizer\n");
        	dig = 1;
-        if (itv->card->type == IVTV_CARD_PVR_150)
+        if ((itv->card->type == IVTV_CARD_PVR_150) ||
+        	(itv->card->type == IVTV_CARD_PG600))
                 ivtv_cx25840(itv, DECODER_ENABLE_OUTPUT, &dig);
         else
        		ivtv_saa7115(itv, DECODER_ENABLE_OUTPUT, &dig);

Reply via email to