On Wed, 23 Feb 2005 23:16:20 -0500, Tyler Trafford <[EMAIL PROTECTED]> wrote:
> If the above does make tuner audio work for your card, then here is a
> patch that has a real fix (salvaged from a John Eckart patch); if not
> disregard.
> 
> It should be applied after the one I began this thread with- so undo
> the above change before applying.

Argh, forgot the attachment.
-- 
Tyler Trafford
--- ivtv-0.3.2e/driver/cx25840-driver.c.orig	2005-02-22 13:58:14.000000000 -0500
+++ ivtv-0.3.2e/driver/cx25840-driver.c	2005-02-23 21:11:49.656312687 -0500
@@ -757,6 +757,29 @@
 
 /* ============ SAA7715 AUDIO settings (end) ============= */
 
+static int cx25840_get_vid_fmt ( struct i2c_client *client )
+{
+  int i = VIDEO_MODE_AUTO;
+  switch (read_setting(client, AFD_FMT_STAT)) {
+    case 0x0001: // NTSC-M
+    case 0x0008: // NTSC-J
+    case 0x0009: // NTSC-4.43
+      i = VIDEO_MODE_NTSC; break;
+    case 0x0040: // PAL-BDGHI
+    case 0x0041: // PAL-M
+    case 0x0048: // PAL-N
+    case 0x0049: // PAL-NC
+    case 0x03e8: // PAL-60
+      i = VIDEO_MODE_PAL; break;
+    case 0x044c: // SECAM
+      i = VIDEO_MODE_SECAM; break;
+    default:
+      i = -1;
+      break;
+  }
+  return i;
+}
+
 static int cx25840_command (struct i2c_client *client, unsigned int cmd, void *arg) {
   struct cx25840_state *state = i2c_get_clientdata(client);
   
@@ -1107,7 +1130,7 @@
 	  CX25840_SET_AUD_MODE_AUD_SYSTEM(0x000F), // Force auto-detect of audio
 	  CX25840_SET_PREF_MODE(0x0004),           // Preferred audio mode is stereo
 	  CX25840_SET_MUTE_NO_PREF_MODE(0x0000),   // Don't mute if preferred output unavailable
-	  CX25840_SET_PATH1_SEL_CTL(state->norm!=VIDEO_MODE_NTSC||cardtype==2?0x0000:0x0002),       // Set the audio source
+	  CX25840_SET_PATH1_SEL_CTL(cx25840_get_vid_fmt(client)!=VIDEO_MODE_NTSC||cardtype==2?0x0000:0x0002),       // Set the audio source
 	  CX25840_SET_SRC3_PHASE_INC(41942880/freq_out),
 	  CX25840_SET_SOFT1_MUTE_EN(0x0001),
 	  CX25840_SET_SRC1_MUTE_EN(0x0000),

Reply via email to