[PATCH] [UBUNTU:sound/pci/] Fix maestro2 hardware volume control
crimsun at fungus.sh.nu
crimsun at fungus.sh.nu
Sat Sep 9 20:28:58 UTC 2006
From 66b98feefd7b35e8fceb50c3379508f91c3cc55a Mon Sep 17 00:00:00 2001
From: Daniel T. Chen <crimsun at garnish.localdomain>
Date: Wed, 6 Sep 2006 15:46:39 -0400
Subject: [PATCH] [UBUNTU:sound/pci/] Fix maestro2 hardware volume control
UpstreamStatus: Added in upstream alsa-kernel hg changeset:
a4d363dd2dc2 [http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=a4d363dd2dc2122d8a772bcf4bab9a4bb14cf441;style=raw]
This patch fixes the maestro2 hardware volume control and is
confirmed working on a Dell Inspiron 7000.
Signed-off-by: Ville Syrjala <syrjala at sci.fi>
Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>
---
sound/pci/es1968.c | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 50079dc..cb98c6e 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1906,7 +1906,7 @@ static void es1968_update_hw_volume(unsi
/* Figure out which volume control button was pushed,
based on differences from the default register
values. */
- x = inb(chip->io_port + 0x1c);
+ x = inb(chip->io_port + 0x1c) & 0xee;
/* Reset the volume control registers. */
outb(0x88, chip->io_port + 0x1c);
outb(0x88, chip->io_port + 0x1d);
@@ -1922,7 +1922,8 @@ static void es1968_update_hw_volume(unsi
/* FIXME: we can't call snd_ac97_* functions since here is in tasklet. */
spin_lock_irqsave(&chip->ac97_lock, flags);
val = chip->ac97->regs[AC97_MASTER];
- if (x & 1) {
+ switch (x) {
+ case 0x88:
/* mute */
val ^= 0x8000;
chip->ac97->regs[AC97_MASTER] = val;
@@ -1930,26 +1931,31 @@ static void es1968_update_hw_volume(unsi
outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX);
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&chip->master_switch->id);
- } else {
- val &= 0x7fff;
- if (((x>>1) & 7) > 4) {
- /* volume up */
- if ((val & 0xff) > 0)
- val--;
- if ((val & 0xff00) > 0)
- val -= 0x0100;
- } else {
- /* volume down */
- if ((val & 0xff) < 0x1f)
- val++;
- if ((val & 0xff00) < 0x1f00)
- val += 0x0100;
- }
+ break;
+ case 0xaa:
+ /* volume up */
+ if ((val & 0x7f) > 0)
+ val--;
+ if ((val & 0x7f00) > 0)
+ val -= 0x0100;
+ chip->ac97->regs[AC97_MASTER] = val;
+ outw(val, chip->io_port + ESM_AC97_DATA);
+ outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX);
+ snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
+ &chip->master_volume->id);
+ break;
+ case 0x66:
+ /* volume down */
+ if ((val & 0x7f) < 0x1f)
+ val++;
+ if ((val & 0x7f00) < 0x1f00)
+ val += 0x0100;
chip->ac97->regs[AC97_MASTER] = val;
outw(val, chip->io_port + ESM_AC97_DATA);
outb(AC97_MASTER, chip->io_port + ESM_AC97_INDEX);
snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
&chip->master_volume->id);
+ break;
}
spin_unlock_irqrestore(&chip->ac97_lock, flags);
}
--
1.4.1
--
Daniel T. Chen crimsun at ubuntu.com
GPG key: 0xC88ABDA3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060909/688a597e/attachment.sig>
More information about the kernel-team
mailing list