Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2003 17:31:35 +0100 (CET)
From:      Ulrich Spoerlein <q@uni.de>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/46872: Make sound work on TV-cards with MSDP3415D-B3 chip
Message-ID:  <200301081631.h08GVZY2053340@coyote.dnsalias.net>

next in thread | raw e-mail | index | archive | help

>Number:         46872
>Category:       kern
>Synopsis:       Make sound work on TV-cards with MSDP3415D-B3 chip
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 08 08:40:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Ulrich Spoerlein
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
>Environment:
System: FreeBSD coyote.dnsalias.net 4.7-STABLE FreeBSD 4.7-STABLE #1: Mon Nov 18 09:46:38 CET 2002 root@coyote.dnsalias.net:/usr/obj/usr/src/sys/COYOTE i386

% dmesg|grep bktr
bktr0: <BrookTree 878> mem 0xd7000000-0xd7000fff irq 7 at device 11.0 on pci0
bktr0: Hauppauge Model 44354 C221
bktr0: Detected a MSP3415D-B3 at 0x80
bktr0: Hauppauge WinCast/TV, Philips FR1216 PAL FM tuner, msp3400c stereo, remote control.

>Description:
Ok, this problem is a bit more complex. The above is a WinTV Stereo FM card purchased in Germany. It has the MSP34154D-B3 chip, responsible for Stereo sound on FM-Radio and TV. But sadly, nearly all TV applications are unable to initialize the sound-chip (fxtv works, when 'internal audio' is selected), although the initialization looks right (i triple-checked with the documentation available on that chip).

There is one work-around for getting sound: Start a radio application (xmradio), then start for example xawtv and switch the channel. Voila, sound. The ugly thing is, this won't work if you're trying to capture with ffmpeg or mencoder.

After trying nearly all ways of initializing this chip, i just copied the initialization from the FM Tuner to the TV Tuner part and ... it works every time.

	
>How-To-Repeat:
Buy one of these cards (i think the german cards are special) and try for yourself :)
	
>Fix:
Ok, this Fix is not very nice. I abused slow_msp_audio, but i didn't want to add another field to the bktr struct.
I changed the auto_detect value, because the specs say: Results exceeding 0x07ff indicate an active autodetect
	

--- bktr.patch begins here ---
--- sys/dev/bktr/bktr_audio.c	1 Nov 2000 09:36:14 -0000	1.2.2.4
+++ sys/dev/bktr/bktr_audio.c	10 Dec 2002 12:48:35 -0000
@@ -482,7 +482,7 @@
 
     msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0030,0x2003);/* Enable Auto format detection */
     msp_dpl_write(bktr, bktr->msp_addr, 0x10, 0x0020,0x0020);/* Standard Select Reg. = BTSC-Stereo*/
-    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000E,0x2403);/* darned if I know */
+    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000e,0x2403);/* FM prescale */
     msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008,0x0320);/* Source select = (St or A) */
 					                     /* & Ch. Matrix = St */
     msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000,0x7300);/* Set volume to 0db gain */
@@ -500,8 +500,15 @@
     msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */
     msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0100); /* DSP In = MONO IN */
   }
-
-
+  /* MSP3415D-B3 SPECIAL CASE  Use same calls as setting up the FM Tuner */
+  /* (for Hauppauge 44xxx card with Tuner Type 0x15) */
+  else if( bktr->slow_msp_audio == 3){
+    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0000, 0x7300); /* 0 db volume */
+    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x000d, 0x7f00); /* scart prescale */
+    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0008, 0x0220); /* SCART | STEREO */
+    msp_dpl_write(bktr, bktr->msp_addr, 0x12, 0x0013, 0x0200); /* DSP In = SC2_IN_L/R */
+  }
+	
   /* MSP3410/MSP3415 - countries with mono, stereo using 2 FM channels and NICAM */
   /* FAST sound scheme */
   else if (bktr->slow_msp_audio == 0) {
@@ -524,7 +531,7 @@
       DELAY(100000);
       auto_detect = msp_dpl_read(bktr, bktr->msp_addr, 0x10, 0x007e);
       loops++;
-    } while (auto_detect > 0xff && loops < 50);
+    } while (auto_detect > 0x07ff && loops < 500);
     if (bootverbose)printf ("%s: Result of autodetect after %dms: %d\n",
 			    bktr_name(bktr), loops*10, auto_detect);
 
--- sys/dev/bktr/bktr_card.c	1 Nov 2000 09:36:14 -0000	1.9.2.4
+++ sys/dev/bktr/bktr_card.c	10 Dec 2002 12:48:36 -0000
@@ -995,11 +995,12 @@
 
                   case 0x15:
 		    select_tuner( bktr, PHILIPS_FR1216_PAL );
+		    bktr->slow_msp_audio = 3;
 		    goto checkDBX;
 
                   case 0x2a:
-		    bktr->msp_use_mono_source = 1;
 		    select_tuner( bktr, PHILIPS_FR1216_PAL );
+		    bktr->msp_use_mono_source = 1;
 		    goto checkDBX;
 
 	          default :
--- bktr.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301081631.h08GVZY2053340>