All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Maestro2 hw volume fix
@ 2004-02-17  6:20 Ville Syrjälä
  2004-02-17 15:38 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2004-02-17  6:20 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

The attached patch fixes hardware volume buttons on my Dell Inspiron 7000 
laptop. The chip is ESS Maestro2 (0x125d:0x1968).

I have no idea if this will break things for someone else. Since the 
datasheet didn't help me understand the registers involved I just printed 
their contents and came up with the used bits.

All registers had the following values in my tests:
mute:     0x99
vol down: 0x77
vol up:   0xBB

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/

[-- Attachment #2: maestro_hwvol.patch --]
[-- Type: text/plain, Size: 617 bytes --]

--- alsa-driver-0.9.8/alsa-kernel/pci/es1968.c.orig	2003-10-14 16:59:20.000000000 +0300
+++ alsa-driver-0.9.8/alsa-kernel/pci/es1968.c	2004-02-17 08:06:22.000000000 +0200
@@ -1967,14 +1967,14 @@
 
 	/* FIXME: more clean up is needed.. */
 	val = chip->ac97->regs[AC97_MASTER];
-	if (x & 1) {
+	if (!(x & 2)) {
 		/* mute */
 		snd_ac97_write_cache(chip->ac97, AC97_MASTER, val ^ 0x8000);
 		snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
 			       &chip->master_switch->id);
 	} else {
 		val &= 0x7fff;
-		if (((x>>1) & 7) > 4) {
+		if (!(x & 4)) {
 			/* volume up */
 			if ((val & 0xff) > 0)
 				val--;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Maestro2 hw volume fix
  2004-02-17  6:20 [PATCH] Maestro2 hw volume fix Ville Syrjälä
@ 2004-02-17 15:38 ` Takashi Iwai
  2004-02-17 16:51   ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2004-02-17 15:38 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: alsa-devel

At Tue, 17 Feb 2004 08:20:41 +0200,
Ville Syrjälä wrote:
> 
> [1  <text/plain; iso-8859-1 (quoted-printable)>]
> The attached patch fixes hardware volume buttons on my Dell Inspiron 7000 
> laptop. The chip is ESS Maestro2 (0x125d:0x1968).
> 
> I have no idea if this will break things for someone else. Since the 
> datasheet didn't help me understand the registers involved I just printed 
> their contents and came up with the used bits.
> 
> All registers had the following values in my tests:
> mute:     0x99
> vol down: 0x77
> vol up:   0xBB

these values (9, 7, b) are consistent always?
i'm also not sure whether it's hardware specific...


Takashi

> -- 
> Ville Syrjälä
> syrjala@sci.fi
> http://www.sci.fi/~syrjala/
> [2 maestro_hwvol.patch <text/plain; us-ascii (7bit)>]
> --- alsa-driver-0.9.8/alsa-kernel/pci/es1968.c.orig	2003-10-14 16:59:20.000000000 +0300
> +++ alsa-driver-0.9.8/alsa-kernel/pci/es1968.c	2004-02-17 08:06:22.000000000 +0200
> @@ -1967,14 +1967,14 @@
>  
>  	/* FIXME: more clean up is needed.. */
>  	val = chip->ac97->regs[AC97_MASTER];
> -	if (x & 1) {
> +	if (!(x & 2)) {
>  		/* mute */
>  		snd_ac97_write_cache(chip->ac97, AC97_MASTER, val ^ 0x8000);
>  		snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
>  			       &chip->master_switch->id);
>  	} else {
>  		val &= 0x7fff;
> -		if (((x>>1) & 7) > 4) {
> +		if (!(x & 4)) {
>  			/* volume up */
>  			if ((val & 0xff) > 0)
>  				val--;


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Maestro2 hw volume fix
  2004-02-17 15:38 ` Takashi Iwai
@ 2004-02-17 16:51   ` Ville Syrjälä
  0 siblings, 0 replies; 3+ messages in thread
From: Ville Syrjälä @ 2004-02-17 16:51 UTC (permalink / raw)
  To: alsa-devel

On Tue, Feb 17, 2004 at 04:38:12PM +0100, Takashi Iwai wrote:
> At Tue, 17 Feb 2004 08:20:41 +0200,
> Ville Syrjälä wrote:
> > 
> > [1  <text/plain; iso-8859-1 (quoted-printable)>]
> > The attached patch fixes hardware volume buttons on my Dell Inspiron 7000 
> > laptop. The chip is ESS Maestro2 (0x125d:0x1968).
> > 
> > I have no idea if this will break things for someone else. Since the 
> > datasheet didn't help me understand the registers involved I just printed 
> > their contents and came up with the used bits.
> > 
> > All registers had the following values in my tests:
> > mute:     0x99
> > vol down: 0x77
> > vol up:   0xBB
> 
> these values (9, 7, b) are consistent always?

So it would appear. I've tried hitting the buttons in various combinations 
and the values have been consistent.

The only thing that is a bit odd is that after hitting the mute button the 
next vol up/down doesn't generate an interrupt at all. Only the next press 
after that actually works. But that is a hardware issue.

> i'm also not sure whether it's hardware specific...

The device has a subsystem id 0x1028:0x0085 should there be a need to add 
hw specific stuff.



The code in maestro.tar.gz uses GPIO data register 0x60 to check for mute 
button press. That would actually work on my system but I don't see much 
point in checking another register when 0x1C is enough.

The vol up/down test in that code checks for difference between 0x1E and 
0x1F. That would not work on my system because all registers 0x1C-0x1F 
have identical values.

-- 
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-17 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-17  6:20 [PATCH] Maestro2 hw volume fix Ville Syrjälä
2004-02-17 15:38 ` Takashi Iwai
2004-02-17 16:51   ` Ville Syrjälä

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.