Bug 26854

Summary: [sound] [patch] Better fix for ESS Technology Maestro-2E hardware mute
Product: Base System Reporter: david
Component: kernAssignee: freebsd-multimedia (Nobody) <multimedia>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.3-STABLE   
Hardware: Any   
OS: Any   

Description david 2001-04-25 20:50:00 UTC
Without the (below) patch, hitting a "mute" chord generates the message:

Mar 26 18:50:21 localhost /kernel: pcm0: pcm0: unknown HWVOL event 0x77

and the attempt to modify the mute setting fails.

(Please see
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=52506+0+archive/2001/freebsd-mobile/20010401.freebsd-mobile
and its follow-on messages for additional details and context.)

Fix: (The below patch may also be found in
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=60957+0+archive/2001/freebsd-mobile/20010401.freebsd-mobile.
Please note jhb's comment on the patch in
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=82193+0+/usr/local/www/db/text/2001/freebsd-mobile/20010401.freebsd-mobile,
as well as the one in
http://docs.freebsd.org/cgi/getmsg.cgi?fetch=91616+0+archive/2001/freebsd-mobile/20010401.freebsd-mobile.)

From taku@cent.saitama-u.ac.jp Mon Mar 26 23:53:10 2001
Return-Path: <taku@cent.saitama-u.ac.jp>
Received: from janus.catwhisker.org (janus.catwhisker.org [172.16.8.1])
	by bunrab.catwhisker.org (8.10.0/8.10.0) with ESMTP id f2R7r9x14088
	for <david@mail.catwhisker.org>; Mon, 26 Mar 2001 23:53:09 -0800 (PST)
Received: from maestro (dhcp-1.cent.saitama-u.ac.jp [133.38.4.27])
	by janus.catwhisker.org (8.10.0/8.10.0) with ESMTP id f2R7r1B82859
	for <david@catwhisker.org>; Mon, 26 Mar 2001 23:53:03 -0800 (PST)
Received: from dhcp-1.cent.saitama-u.ac.jp (localhost [127.0.0.1])
	by maestro (8.11.3/8.11.2) with ESMTP id f2R7qX758863;
	Tue, 27 Mar 2001 16:52:41 +0900 (JST)
	(envelope-from taku@cent.saitama-u.ac.jp)
Date: Tue, 27 Mar 2001 16:52:31 +0900
Message-ID: <rtg1yrjvebk.wl@dhcp-1.cent.saitama-u.ac.jp>
From: Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>
To: David Wolfskill <david@catwhisker.org>
Cc: mobile@freebsd.org
Subject: Re: Reality check on ESS Technology Maestro-2E h/w "mute" function?
In-Reply-To: <200103270658.f2R6w2c13898@bunrab.catwhisker.org>
References: <200103270658.f2R6w2c13898@bunrab.catwhisker.org>
User-Agent: Wanderlust/2.4.0 (Rio) WEMI/1.13.7 (Shimada) FLIM/1.13.2 (Kasanui) MULE XEmacs/21.1 (patch 12) (Channel Islands) (i386--freebsd)
Organization: Advanced Computer and Communication Enginerring Studies Society
MIME-Version: 1.0 (generated by WEMI 1.13.7 - "Shimada")
Content-Type: multipart/mixed;
 boundary="Multipart_Tue_Mar_27_16:52:31_2001-1"
Status: RO

--Multipart_Tue_Mar_27_16:52:31_2001-1
Content-Type: text/plain; charset=US-ASCII

According to datasheets, HWVOL_MUTE (== 0x99) came from HWVOL_NOP | 0x11,
where 0x11 means "mute button pressed".

But, since mute button is actually choded into UP-and-DOWN simultaneously,
it may happen to misunderstand MUTE button as if an independent
UP/DOWN event came first. (It is nothing more than my imagination, though.)

So, perhaps 0x77 came from HWVOL_DOWN | 0x11, I imagine.
Attached diff will make both 0x77 and 0x99 to be recognized as MUTE.
(And, hopefully, 0xbb --- HWVOL_UP | 0x11 --- , too)

-- 
YAMAMOTO, Taku <taku@cent.saitama-u.ac.jp>
Member of Advanced Computer and Communication Studies Society
(ACCESS for short), Information Processing Center, Saitama Univ.

--Multipart_Tue_Mar_27_16:52:31_2001-1
Content-Type: text/plain; type=patch; charset=US-ASCII
Content-Disposition: attachment; filename="hwvol.diff"
Content-Transfer-Encoding: 7bit



--Multipart_Tue_Mar_27_16:52:31_2001-1----wieDyApFSlKOMQLLdt3wvwyEnXNEZHqxmem7mLqZykPATiir
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- sys/dev/sound/pci/maestro.c.orig	Mon Mar 26 02:29:35 2001
+++ sys/dev/sound/pci/maestro.c	Tue Mar 27 16:28:06 2001
@@ -850,9 +850,6 @@
 
 		event = bus_space_read_1(ess->st, ess->sh, PORT_HWVOL_MASTER);
 		switch (event) {
-		case HWVOL_MUTE:
-			mixer_hwvol_mute(ess->dev);
-			break;
 		case HWVOL_UP:
 			mixer_hwvol_step(ess->dev, 1, 1);
 			break;
@@ -862,6 +859,10 @@
 		case HWVOL_NOP:
 			break;
 		default:
+			if (event & HWVOL_MUTE) {
+				mixer_hwvol_mute(ess->dev);
+				break;
+			}
 			device_printf(ess->dev, "%s: unknown HWVOL event 0x%x\n",
 			    device_get_nameunit(ess->dev), event);
 		}
--- sys/dev/sound/pci/maestro_reg.h.orig	Wed Jan  3 10:32:57 2001
+++ sys/dev/sound/pci/maestro_reg.h	Tue Mar 27 16:28:29 2001
@@ -140,7 +140,7 @@
 #define PORT_HWVOL_MASTER_SHADOW 0x1e	/* BYTE RW */
 #define PORT_HWVOL_MASTER	0x1f	/* BYTE RW */
 #define HWVOL_NOP		0x88
-#define HWVOL_MUTE		0x99
+#define HWVOL_MUTE		0x11
 #define HWVOL_UP		0xaa
 #define HWVOL_DOWN		0x66
 
How-To-Repeat: 
	Get one of these laptops (more on the laptop is at
	http://www.catwhisker.org/~david/FreeBSD/laptop.html).  Install
	FreeBSD on it.  Try hitting a "mute" chord.
Comment 1 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2002-04-07 16:16:01 UTC
State Changed
From-To: open->feedback

David, did this actually work for you?
Comment 2 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2002-04-07 17:29:20 UTC
State Changed
From-To: feedback->analyzed

Problem and fix identified. 


Comment 3 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2002-04-07 17:29:20 UTC
Responsible Changed
From-To: freebsd-bugs->sounds

Talked with Cameron Grant, he has changes for the sound system which 
include this fix. 

Change to sound@ as a reminder.
Comment 4 Jeroen Ruigrok van der Werven freebsd_committer freebsd_triage 2002-04-07 17:30:53 UTC
Responsible Changed
From-To: sounds->sound

Spell sound correctly.
Comment 5 Alexander Leidinger freebsd_committer freebsd_triage 2005-09-11 13:42:50 UTC
State Changed
From-To: analyzed->closed

This seems to be in the current sound code.