From owner-freebsd-bugs@FreeBSD.ORG Tue Feb 27 13:10:06 2007 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E5D6B16A400 for ; Tue, 27 Feb 2007 13:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id B8CAD13C4B6 for ; Tue, 27 Feb 2007 13:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l1RDA6ep010013 for ; Tue, 27 Feb 2007 13:10:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l1RDA6nh010012; Tue, 27 Feb 2007 13:10:06 GMT (envelope-from gnats) Resent-Date: Tue, 27 Feb 2007 13:10:06 GMT Resent-Message-Id: <200702271310.l1RDA6nh010012@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Watanabe Kazuhiro Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 07F4E16A401 for ; Tue, 27 Feb 2007 13:02:47 +0000 (UTC) (envelope-from CQG00620@nifty.ne.jp) Received: from mail.asahi-net.or.jp (mail1.asahi-net.or.jp [202.224.39.197]) by mx1.freebsd.org (Postfix) with ESMTP id 3C29D13C471 for ; Tue, 27 Feb 2007 13:02:46 +0000 (UTC) (envelope-from CQG00620@nifty.ne.jp) Received: from asahi-net.jp (h205095.ppp.asahi-net.or.jp [61.114.205.95]) by mail.asahi-net.or.jp (Postfix) with ESMTP id 1269A2EBBC for ; Tue, 27 Feb 2007 21:44:38 +0900 (JST) Message-Id: <20070227124438.1269A2EBBC@mail.asahi-net.or.jp> Date: Tue, 27 Feb 2007 21:44:33 +0900 From: Watanabe Kazuhiro To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: kern/109599: [patch] Cannot control treble/bass functions on YAMAHA YMF753 AC97 codec X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Watanabe Kazuhiro List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Feb 2007 13:10:07 -0000 >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@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: at io 0x1400, 0x1080 irq 18 bufsz 16384 kld snd_ich (1p/1r/1v c hannels duplex default) $ dmesg | grep ^pcm pcm0: 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: 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: 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: 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: