Bug 109599

Summary: [sound] [patch] Cannot control treble/bass functions on YAMAHA YMF753 AC97 codec
Product: Base System Reporter: WATANABE Kazuhiro <CQG00620>
Component: kernAssignee: Ariff Abdullah <ariff>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.0-CURRENT   
Hardware: Any   
OS: Any   

Description WATANABE Kazuhiro 2007-02-27 13:10:05 UTC
I have a PC which uses SiS 7012 ICH controller with YAMAHA YMF753
AC'97 codec.  It works well with snd_ich driver, but cannot control
the treble/bass functions.

YAMAHA AC'97 codecs (YMF743/752/753) has treble/bass and 3D
enhancement functions.  YMF743 and YMF753 has both functions,
and YMF752 have only 3D control.

But these functions are not indicated in the Reset register (0x00).

 * AC'97 Component Specification Revision 2.2, p.50
   http://www.alsa-project.org/alsa/ftp/manuals/intel/ac97r22.pdf

 * YAMAHA YMF753 datasheet, p.6
   http://www.yamaha.co.jp/english/product/lsi/us/products/pdf/4MF753A20.pdf

Fix: This patch has tested on 7-current (and 6.2-RELEASE).



This code should be pushed out to a patch function (e.g. ymf_patch()).
But the patch function (codec_patch) is called after
ac97_fix_tone().  So it is a little difficult.

The similar code is also appeared in the ALSA driver.

http://alsa.cvs.sourceforge.net/alsa/alsa-kernel/pci/ac97/ac97_patch.c?r1=1.5&r2=1.6--Ny1fzBedNE0EFRDg7NOGffSqwwz8kXeCvh2As2GMRkkchrLB
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

Index: sys/dev/sound/pcm/ac97.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/ac97.c,v
retrieving revision 1.64
diff -u -r1.64 ac97.c
--- sys/dev/sound/pcm/ac97.c	26 Nov 2006 12:24:05 -0000	1.64
+++ sys/dev/sound/pcm/ac97.c	27 Feb 2007 08:24:36 -0000
@@ -538,6 +538,23 @@
 static void
 ac97_fix_tone(struct ac97_info *codec)
 {
+	/*
+	 * YMF chips does not indicate tone and 3D enhancement capability
+	 * in the AC97_REG_RESET register.
+	 */
+	switch (codec->id) {
+		case 0x594d4800:	/* YMF743 */
+		case 0x594d4803:	/* YMF753 */
+			codec->caps |= AC97_CAP_TONE;
+			codec->se |= 0x04;
+			break;
+		case 0x594d4802:	/* YMF752 */
+			codec->se |= 0x04;
+			break;
+		default:
+			break;
+	}
+
 	/* Hide treble and bass if they don't exist */
 	if ((codec->caps & AC97_CAP_TONE) == 0) {
 		bzero(&codec->mix[SOUND_MIXER_BASS],
How-To-Repeat:  * before applied the patch:

$ cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 32bit)
Installed devices:
pcm0: <SiS 7012> at io 0x1400, 0x1080 irq 18 bufsz 16384 kld snd_ich (1p/1r/1v c
hannels duplex default)
$ dmesg | grep ^pcm
pcm0: <SiS 7012> port 0x1400-0x14ff,0x1080-0x10ff irq 18 at device 2.7 on pci0
pcm0: Reserved 0x100 bytes for rid 0x10 type 4 at 0x1400
pcm0: Reserved 0x80 bytes for rid 0x14 type 4 at 0x1080
pcm0: [MPSAFE]
pcm0: [ITHREAD]
pcm0: <Yamaha YMF753 AC97 Codec (id = 0x594d4803)>
pcm0: Codec features 18 bit DAC, 5 bit master volume, no 3D Stereo Enhancement
pcm0: Primary codec extended features reserved 1, AMAP, reserved 4
pcm0: ac97 codec dac ready count: 0
pcm0: Mixer "vol":
pcm0: Mixer "pcm":
pcm0: Mixer "speaker":
pcm0: Mixer "line":
pcm0: Mixer "mic":
pcm0: Mixer "cd":
pcm0: Mixer "rec":
pcm0: Mixer "igain":
pcm0: Mixer "line1":
pcm0: Mixer "phin":
pcm0: Mixer "phout":
pcm0: Mixer "video":
pcm0: sndbuf_setmap e9f6000, 4000; 0xcbf08000 -> e9f6000
pcm0: sndbuf_setmap e9f2000, 4000; 0xcbf0c000 -> e9f2000
pcm0: measured ac97 link rate at 48021 Hz, will use 48000 Hz
$ mixer
Mixer vol      is currently set to  75:75
Mixer pcm      is currently set to  75:75
Mixer speaker  is currently set to  75:75
Mixer line     is currently set to  75:75
Mixer mic      is currently set to   0:0
Mixer cd       is currently set to  75:75
Mixer rec      is currently set to   0:0
Mixer igain    is currently set to   0:0
Mixer line1    is currently set to  75:75
Mixer phin     is currently set to   0:0
Mixer phout    is currently set to   0:0
Mixer video    is currently set to  75:75
Recording source: mic

 * after applied the patch:

$ dmesg | grep ^pcm
pcm0: <SiS 7012> port 0x1400-0x14ff,0x1080-0x10ff irq 18 at device 2.7 on pci0
pcm0: Reserved 0x100 bytes for rid 0x10 type 4 at 0x1400
pcm0: Reserved 0x80 bytes for rid 0x14 type 4 at 0x1080
pcm0: [MPSAFE]
pcm0: [ITHREAD]
pcm0: <Yamaha YMF753 AC97 Codec (id = 0x594d4803)>
pcm0: Codec features tone, 18 bit DAC, 5 bit master volume, Yamaha Ymersion
pcm0: Primary codec extended features reserved 1, AMAP, reserved 4
pcm0: ac97 codec dac ready count: 0
pcm0: Mixer "vol":
pcm0: Mixer "bass":
pcm0: Mixer "treble":
pcm0: Mixer "pcm":
pcm0: Mixer "speaker":
pcm0: Mixer "line":
pcm0: Mixer "mic":
pcm0: Mixer "cd":
pcm0: Mixer "rec":
pcm0: Mixer "igain":
pcm0: Mixer "line1":
pcm0: Mixer "phin":
pcm0: Mixer "phout":
pcm0: Mixer "video":
pcm0: sndbuf_setmap e9f6000, 4000; 0xcbf08000 -> e9f6000
pcm0: sndbuf_setmap e9f2000, 4000; 0xcbf0c000 -> e9f2000
pcm0: measured ac97 link rate at 48013 Hz, will use 48000 Hz
Comment 1 Remko Lodder freebsd_committer freebsd_triage 2007-02-27 13:17:09 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-multimedia

Reassign to multimedia team
Comment 2 Ariff Abdullah freebsd_committer freebsd_triage 2007-02-27 14:26:55 UTC
Responsible Changed
From-To: freebsd-multimedia->ariff

I'll handle this.
Comment 3 dfilter service freebsd_committer freebsd_triage 2007-03-06 02:37:00 UTC
ariff       2007-03-06 02:36:55 UTC

  FreeBSD src repository

  Modified files:
    sys/dev/sound/pcm    ac97.c 
  Log:
  Enable tone / 3D controls for YAMAHA YMF743, 753 and 752 (partially).
  
  PR:             kern/109599
  Submitted by:   Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
  
  Revision  Changes    Path
  1.65      +17 -0     src/sys/dev/sound/pcm/ac97.c
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 4 Ariff Abdullah freebsd_committer freebsd_triage 2007-03-06 02:37:15 UTC
State Changed
From-To: open->closed

Committed, Thanks!
Comment 5 dfilter service freebsd_committer freebsd_triage 2007-04-26 09:31:00 UTC
ariff       2007-04-26 08:30:52 UTC

  FreeBSD src repository

  Modified files:        (Branch: RELENG_6)
    sys/dev/sound/pcm    ac97.c ac97.h ac97_patch.c ac97_patch.h 
  Log:
  MFC:
  
  - Patch for AD1981B codec to enable (automuting) headphone jack sense.
  - Enable tone / 3D controls for YAMAHA YMF743, 753 and 752 (partially) [1]
  - AC97 quirk / patch cleanups. Most quirks doesn't work in general sense
    and should only be applied on certain specific card / vendor, hence the
    addition of ac97_getsubvendor(). [2]
  - Fix low volume issue on several MSI laptops through ALC655 quirk. [2]
  
  [1]
  
  PR:                     kern/109599
  Submitted by:           Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
  
  [2]
  
  Reported/Tested by:     Christian Mueller
                          <raptor-freebsd-multimedia@xpls.de>
  
  Revision  Changes    Path
  1.53.2.4  +31 -4     src/sys/dev/sound/pcm/ac97.c
  1.16.2.2  +1 -1      src/sys/dev/sound/pcm/ac97.h
  1.3.2.2   +43 -5     src/sys/dev/sound/pcm/ac97_patch.c
  1.3.2.2   +2 -0      src/sys/dev/sound/pcm/ac97_patch.h
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"