snd-maestro3: Make hardware volume buttons an input device (rev2)
PATCH 1/2 snd-maestro3: Make hardware volume buttons an input device (rev2)
While working on the sound suspend / resume problems with my laptop I noticed that the hardware volume handling code in essence just detects key presses, and then does some hardcoded modification of the master volume based on which key is pressed.
This made me think that clearly the right thing to do here is just report these keypresses to userspace and let userspace decide what to with them.
This patch adds a Kconfig option which when enabled reports the volume buttons as keypresses using an input device. When enabled this option also gets rid of the ugly direct ac97 writes from the tasklet, the ac97lock and the need for using a tasklet in general.
As an added bonus the keys now work identical to volume keys on a (usb) keyboard with multimedia keys, providing visual feedback of the volume level change, and a better range of the volume control (with a properly configured desktop environment).
--- sound/pci/Kconfig | 10 ++++ sound/pci/maestro3.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 124 insertions(+), 2 deletions(-)
sound/pci/Kconfig +10 -0
@@ -655,6 +655,16 @@ config SND_MAESTRO3 To compile this driver as a module, choose M here: the module will be called snd-maestro3. +config SND_MAESTRO3_INPUT + bool "Enable input device for maestro3 volume buttons" + depends on SND_MAESTRO3 + depends on INPUT=y || INPUT=SND_MAESTRO3 + help + If you say Y here, you will get an input device which reports + keypresses for the volume buttons connected to the maestro3 chip. + If you say N the buttons will directly control the master volume. + It is recommended to say Y. + config SND_MIXART tristate "Digigram miXart" select SND_HWDEP
sound/pci/maestro3.c +114 -2
241 lines not on this page · raw message
Signature · 1 line
1.7.0.1
PATCH 2/2 snd-es1968: Make hardware volume buttons an input device (rev2)
The hardware volume handling code in essence just detects key presses, and then does some hardcoded modification of the master volume based on which key is pressed.
Clearly the right thing to do here is just report these keypresses to userspace and let userspace decide what to with them.
This patch adds a Kconfig option which when enabled reports the volume buttons as keypresses using an input device. When enabled this option also gets rid of the ugly direct ac97 writes from the tasklet, the ac97lock and the need for using a tasklet in general.
--- sound/pci/Kconfig | 10 ++++ sound/pci/es1968.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 128 insertions(+), 10 deletions(-)
sound/pci/Kconfig +10 -0
@@ -501,6 +501,16 @@ config SND_ES1968 To compile this driver as a module, choose M here: the module will be called snd-es1968. +config SND_ES1968_INPUT + bool "Enable input device for es1968 volume buttons" + depends on SND_ES1968 + depends on INPUT=y || INPUT=SND_ES1968 + help + If you say Y here, you will get an input device which reports + keypresses for the volume buttons connected to the es1968 chip. + If you say N the buttons will directly control the master volume. + It is recommended to say Y. + config SND_FM801 tristate "ForteMedia FM801" select SND_OPL3_LIB
sound/pci/es1968.c +118 -10
261 lines not on this page · raw message
Signature · 1 line
1.7.0.1
Re: [PATCH 2/2] snd-es1968: Make hardware volume buttons an input device (rev2)
Quoted 7 lines · Hans de Goede
The hardware volume handling code in essence just detects key presses, and then does some hardcoded modification of the master volume based on which key is pressed.
Clearly the right thing to do here is just report these keypresses to userspace and let userspace decide what to with them.
Quoted 6 lines
This patch adds a
Kconfigoption which when enabled reports the volume buttons as keypresses using an input device. When enabled this option also gets rid of the ugly direct ac97 writes from the tasklet, the ac97lock and the need for using a tasklet in general.Signed-off-by Hans de Goede <[email protected]>
Both SND_ES1968_INPUT=y and SND_ES1968_INPUT=n work fine on my Dell Inspiron 7000.
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/
Quoted 13 lines · Hans de Goede
While working on the sound suspend / resume problems with my laptop I noticed that the hardware volume handling code in essence just detects key presses, and then does some hardcoded modification of the master volume based on which key is pressed.
This made me think that clearly the right thing to do here is just report these keypresses to userspace and let userspace decide what to with them.
This patch adds a
Kconfigoption which when enabled reports the volume buttons as keypresses using an input device. When enabled this option also gets rid of the ugly direct ac97 writes from the tasklet, the ac97lock and the need for using a tasklet in general.
Quoted 6 lines
As an added bonus the keys now work identical to volume keys on a (usb) keyboard with multimedia keys, providing visual feedback of the volume level change, and a better range of the volume control (with a properly configured desktop environment).
Signed-off-by Hans de Goede <[email protected]>
Both SND_MAESTRO3_INPUT=y and SND_MAESTRO3_INPUT=n work fine on my HP OmniBook 500.
There is one small issue though. I get a spurious key event when I load the driver. Probably the omnibook GPIO magic causes a spurious event which then causes the interrupt since the driver doesn't clear the interrupts before enabling them. I'll send a patch for that.
Signature · 3 lines
Ville Syrjälä [email protected] http://www.sci.fi/~syrjala/