cx88: HVR-1300 / blackbird audio fixes
authordarron@kewl.org
Wed, 19 Nov 2008 15:39:21 +0000
changeset 9662 5788dc77158c
parent 9661 b9c802efb7ae
child 9663 c1d603af3bef
cx88: HVR-1300 / blackbird audio fixes

From: Darron Broad <darron@kewl.org>

This fix backs out an elderly hack (always_analog) changes
the init for blackbird audio I2S output and also modifies
the newly added I2S-ADC init method all in one fell swoop.

this solves audio out in analog mode without the ugly hack
with blackbird cards and generally cleans things up.

The same init vars are preserved yet it it's not certain
that either the INPUT/OUTPUT CNTL bits are really valid
0 and 0 also work, but they're insignificant unless
I2S audio is enabled which has been tested on both
a blackbird and non-blackbird card successfully with
newly added support of I2SADC FM radios.

Priority: normal

Signed-off-by: Darron Broad <darron@kewl.org>
linux/drivers/media/video/cx88/cx88-tvaudio.c
linux/drivers/media/video/cx88/cx88-video.c
--- a/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Nov 19 15:38:48 2008 +0000
+++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c	Wed Nov 19 15:39:21 2008 +0000
@@ -61,10 +61,6 @@
 module_param(audio_debug, int, 0644);
 MODULE_PARM_DESC(audio_debug, "enable debug messages [audio]");
 
-static unsigned int always_analog;
-module_param(always_analog,int,0644);
-MODULE_PARM_DESC(always_analog,"force analog audio out");
-
 static unsigned int radio_deemphasis;
 module_param(radio_deemphasis,int,0644);
 MODULE_PARM_DESC(radio_deemphasis, "Radio deemphasis time constant, "
@@ -147,19 +143,21 @@
 	cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
 	cx88_start_audio_dma(core);
 
-	if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
-		cx_write(AUD_I2SINPUTCNTL, 4);
-		cx_write(AUD_BAUDRATE, 1);
-		/* 'pass-thru mode': this enables the i2s output to the mpeg encoder */
-		cx_set(AUD_CTL, EN_I2SOUT_ENABLE);
-		cx_write(AUD_I2SOUTPUTCNTL, 1);
-		cx_write(AUD_I2SCNTL, 0);
-		/* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
-	}
-	if ((always_analog) || (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))) {
-		ctl |= EN_DAC_ENABLE;
-		cx_write(AUD_CTL, ctl);
-	}
+	cx_write(AUD_I2SINPUTCNTL, 4);
+	cx_write(AUD_I2SOUTPUTCNTL, 1);
+
+	if (ctl & EN_I2SIN_ENABLE)
+		/* "I2S ADC mode" */
+	        cx_write(AUD_I2SCNTL, 0x01);
+	else
+		/* "Normal mode" */
+		cx_write(AUD_I2SCNTL, 0x00);
+
+	if (core->board.mpeg & CX88_MPEG_BLACKBIRD)
+		ctl |= EN_I2SOUT_ENABLE;
+
+	ctl |= EN_DAC_ENABLE;
+	cx_write(AUD_CTL, ctl);
 
 	/* finish programming */
 	cx_write(AUD_SOFT_RESET, 0x0000);
@@ -773,10 +771,6 @@
 		break;
 	case WW_I2SADC:
 		set_audio_start(core, 0x01);
-		/* Slave/Philips/Autobaud */
-		cx_write(AUD_I2SINPUTCNTL, 0);
-		/* Switch to "I2S ADC mode" */
-		cx_write(AUD_I2SCNTL, 0x1);
 		set_audio_finish(core, EN_I2SIN_ENABLE);
 		break;
 	case WW_NONE:
--- a/linux/drivers/media/video/cx88/cx88-video.c	Wed Nov 19 15:38:48 2008 +0000
+++ b/linux/drivers/media/video/cx88/cx88-video.c	Wed Nov 19 15:39:21 2008 +0000
@@ -446,10 +446,6 @@
 			/* "I2S ADC mode" */
 			core->tvaudio = WW_I2SADC;
 			cx88_set_tvaudio(core);
-		} else {
-			/* Normal mode */
-			cx_write(AUD_I2SCNTL, 0x0);
-			cx_clear(AUD_CTL, EN_I2SIN_ENABLE);
 		}
 	}