From owner-freebsd-multimedia@FreeBSD.ORG Fri May 27 06:23:15 2005 Return-Path: X-Original-To: freebsd-multimedia@freebsd.org Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D5FDE16A41C for ; Fri, 27 May 2005 06:23:15 +0000 (GMT) (envelope-from yongari@rndsoft.co.kr) Received: from rndsoft.co.kr (michelle.rndsoft.co.kr [211.32.202.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id 566D343D4C for ; Fri, 27 May 2005 06:23:15 +0000 (GMT) (envelope-from yongari@rndsoft.co.kr) Received: by simscan 1.1.0 ppid: 27080, pid: 27081, t: 1.6068s scanners:none Received: from unknown (HELO michelle.rndsoft.co.kr) (192.168.5.90) by 0 with SMTP; 27 May 2005 06:19:56 +0900 Received: from michelle.rndsoft.co.kr (localhost.rndsoft.co.kr [127.0.0.1]) by michelle.rndsoft.co.kr (8.13.1/8.13.1) with ESMTP id j4R6M0Jr018843 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 27 May 2005 15:22:00 +0900 (KST) (envelope-from yongari@rndsoft.co.kr) Received: (from yongari@localhost) by michelle.rndsoft.co.kr (8.13.1/8.13.1/Submit) id j4R6M0FK018842 for freebsd-multimedia@freebsd.org; Fri, 27 May 2005 15:22:00 +0900 (KST) (envelope-from yongari@rndsoft.co.kr) Date: Fri, 27 May 2005 15:22:00 +0900 From: Pyun YongHyeon To: freebsd-multimedia@freebsd.org Message-ID: <20050527062200.GA17663@rndsoft.co.kr> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Spam-Checker-Version: SpamDetector 1.00 (2004-01-11) on Subject: maestro3 hardware volume control X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: yongari@rndsoft.co.kr List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2005 06:23:16 -0000 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I noticed hardware volume control of maestro3 didn't work. With small patch it worked on my system(Gateway Solo 5300). Hardware volume control of maestro3 can be configured with two different control pins. Unfortunately it seems that it's hard to know which control pin was wired to control the volume. At present maestro3 provides a way via hint file to select one of the two configurations. hint.pcm.0.hwvol_config="0" : select GD(game port interface) pin 6, 7 hint.pcm.0.hwvol_config="1" : select GPIO pin 4,5 If there is no hint the driver select GD pin 6, 7. In my system selecting GD pins didn't work and a comment at the beginning of the driver source indicates it didn't ever work. So I'd like to change to select GPIO pins as a default hardware volume control. For users needs to select GD pins it could be easily done with hint.pcm.0.hwvol_config="0" in /boot/device.hints file. But I think there are no such users since device.hints file had no such entry. -- Regards, Pyun YongHyeon http://www.kr.freebsd.org/~yongari | yongari@freebsd.org --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="maestro3.hwvol.patch" --- sys/dev/sound/pci/maestro3.c.orig Mon May 23 15:27:07 2005 +++ sys/dev/sound/pci/maestro3.c Fri May 27 14:49:56 2005 @@ -34,7 +34,7 @@ * (+) /dev/mixer sets left/right volumes. * (+) /dev/dsp recording works. Tested successfully with the cdrom channel * (+) apm suspend/resume works, and works properly!. - * (-) hardware volme controls don't work =-( + * (+) hardware volme controls works. * (-) setblocksize() does nothing. * * The real credit goes to: @@ -93,6 +93,12 @@ #define M3_RCHANS 1 #define M3_MAXADDR ((1 << 27) - 1) +#define M3_HW_VOL_UP 0xaa +#define M3_HW_VOL_DOWN 0x66 +#define M3_HW_VOL_MUTE 0x99 +#define M3_HW_VOL_NOP 0x88 +#define M3_HW_VOL_ACPI_STOP 0xff + struct sc_info; struct sc_pchinfo { @@ -998,21 +1004,24 @@ event = m3_rd_1(sc, HW_VOL_COUNTER_MASTER); switch (event) { - case 0x99: + case M3_HW_VOL_MUTE: mixer_hwvol_mute(sc->dev); break; - case 0xaa: + case M3_HW_VOL_UP: mixer_hwvol_step(sc->dev, 1, 1); break; - case 0x66: + case M3_HW_VOL_DOWN: mixer_hwvol_step(sc->dev, -1, -1); break; - case 0x88: + case M3_HW_VOL_NOP: + case M3_HW_VOL_ACPI_STOP: break; default: - device_printf(sc->dev, "Unknown HWVOL event\n"); + device_printf(sc->dev, "unknown HWVOL event 0x%x\n", + event); + break; } - m3_wr_1(sc, HW_VOL_COUNTER_MASTER, 0x88); + m3_wr_1(sc, HW_VOL_COUNTER_MASTER, M3_HW_VOL_NOP); } @@ -1512,7 +1521,8 @@ "hwvol_config", &hint) == 0) hv_cfg = (hint > 0) ? HV_BUTTON_FROM_GD : 0; else - hv_cfg = HV_BUTTON_FROM_GD; + /* no hint, select GPIO[5:4] as h/w volume controls */ + hv_cfg = 0; data = pci_read_config(sc->dev, PCI_ALLEGRO_CONFIG, 4); data &= ~HV_BUTTON_FROM_GD; --3V7upXqbjpZ4EhLz--