kern/109599: [patch] Cannot control treble/bass functions on YAMAHA
YMF753 AC97 codec
Watanabe Kazuhiro
CQG00620 at nifty.ne.jp
Tue Feb 27 13:10:07 UTC 2007
>Number: 109599
>Category: kern
>Synopsis: [patch] Cannot control treble/bass functions on YAMAHA YMF753 AC97 codec
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Feb 27 13:10:05 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator: Watanabe Kazuhiro
>Release: FreeBSD 7.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD capricorn.sign.local 7.0-CURRENT FreeBSD 7.0-CURRENT #3: Mon Feb 26 16:31:22 JST 2007 nabe at capricorn:/FreeBSD/obj/FreeBSD/HEAD/src/sys/GENERIC i386
Sound: SiS 7012 ICH controller with YAMAHA YMF753 AC97 codec
>Description:
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
>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
>Fix:
This patch has tested on 7-current (and 6.2-RELEASE).
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],
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
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list