[ivtv-users] cx18 Have 2 installed HVR-1600s, 1 never records audio

Andy Walls awalls at radix.net
Thu Jan 22 02:34:21 CET 2009


On Wed, 2009-01-21 at 06:52 +0100, . . wrote:
> I was able to compile ~awalls/v4l-dvb/ revision 10252 and the same issue is occurring again. Thanks!
> 


Try this patch.

Regards,
Andy



diff -r db4a95792cf6 linux/drivers/media/video/cx18/cx18-audio.c
--- a/linux/drivers/media/video/cx18/cx18-audio.c	Mon Jan 19 16:31:22 2009 -0500
+++ b/linux/drivers/media/video/cx18/cx18-audio.c	Wed Jan 21 20:32:53 2009 -0500
@@ -64,8 +64,7 @@
 	val = cx18_read_reg(cx, CX18_AUDIO_ENABLE) & ~0x30;
 	val |= (audio_input > CX18_AV_AUDIO_SERIAL2) ? 0x20 :
 					(audio_input << 4);
-	cx18_write_reg(cx, val | 0xb00, CX18_AUDIO_ENABLE);
-	cx18_vapi(cx, CX18_APU_RESETAI, 1, 0);
+	cx18_write_reg_expect(cx, val | 0xb00, CX18_AUDIO_ENABLE, val, 0x30);
 	return 0;
 }
 
diff -r db4a95792cf6 linux/drivers/media/video/cx18/cx18-av-firmware.c
--- a/linux/drivers/media/video/cx18/cx18-av-firmware.c	Mon Jan 19 16:31:22 2009 -0500
+++ b/linux/drivers/media/video/cx18/cx18-av-firmware.c	Wed Jan 21 20:32:53 2009 -0500
@@ -131,7 +131,8 @@
 	v = cx18_read_reg(cx, CX18_AUDIO_ENABLE);
 	/* If bit 11 is 1, clear bit 10 */
 	if (v & 0x800)
-		cx18_write_reg(cx, v & 0xFFFFFBFF, CX18_AUDIO_ENABLE);
+		cx18_write_reg_expect(cx, v & 0xFFFFFBFF, CX18_AUDIO_ENABLE,
+				      0, 0x400);
 
 	/* Enable WW auto audio standard detection */
 	v = cx18_av_read4(cx, CXADEC_STD_DET_CTL);
diff -r db4a95792cf6 linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c	Mon Jan 19 16:31:22 2009 -0500
+++ b/linux/drivers/media/video/cx18/cx18-driver.c	Wed Jan 21 20:32:53 2009 -0500
@@ -1058,19 +1058,7 @@
 	/*
 	 * Init the firmware twice to work around a silicon bug
 	 * with the digital TS.
-	 *
-	 * The second firmware load requires us to normalize the APU state,
-	 * or the audio for the first analog capture will be badly incorrect.
-	 *
-	 * I can't seem to call APU_RESETAI and have it succeed without the
-	 * APU capturing audio, so we start and stop it here to do the reset
 	 */
-
-	/* MPEG Encoding, 224 kbps, MPEG Layer II, 48 ksps */
-	cx18_vapi(cx, CX18_APU_START, 2, CX18_APU_ENCODING_METHOD_MPEG|0xb9, 0);
-	cx18_vapi(cx, CX18_APU_RESETAI, 0);
-	cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
-
 	fw_retry_count = 3;
 	while (--fw_retry_count > 0) {
 		/* load firmware */
@@ -1084,6 +1072,19 @@
 		set_bit(CX18_F_I_FAILED, &cx->i_flags);
 		return -ENXIO;
 	}
+
+	/*
+	 * The second firmware load requires us to normalize the APU state,
+	 * or the audio for the first analog capture will be badly incorrect.
+	 *
+	 * I can't seem to call APU_RESETAI and have it succeed without the
+	 * APU capturing audio, so we start and stop it here to do the reset
+	 */
+
+	/* MPEG Encoding, 224 kbps, MPEG Layer II, 48 ksps */
+	cx18_vapi(cx, CX18_APU_START, 2, CX18_APU_ENCODING_METHOD_MPEG|0xb9, 0);
+	cx18_vapi(cx, CX18_APU_RESETAI, 0);
+	cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
 
 	vf.tuner = 0;
 	vf.type = V4L2_TUNER_ANALOG_TV;





More information about the ivtv-users mailing list