Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Hans de Goede <hdegoede@redhat.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 1/2] snd-maestro3: Make hardware volume buttons	an input device
Date: Thu, 22 Apr 2010 17:02:12 +0200	[thread overview]
Message-ID: <s5h4oj3edjf.wl%tiwai@suse.de> (raw)
In-Reply-To: <1271925425-26615-1-git-send-email-hdegoede@redhat.com>

At Thu, 22 Apr 2010 04:37:04 -0400,
Hans de Goede wrote:
> 
> 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 as keypresses using an input device and let
> userspace decide what to with them.
> 
> This patch does this, getting 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).

I like the basic idea.  However, two points to be fixed:

 - We need a kconfig to keep the old behavior.  We are not allowed to
   give any regression in general.

 - CONFIG_INPUT is tristate.  It can be a module, thus the dependency
   is a bit messy.  Imagine you want to build snd-maestro3 into kernel
   while CONFIG_INPUT=m is given.
   
A hack to avoid to avoid the dependency is to create a bool Kconfig to
specify whether input feature is added or not; this is anyway needed
for the first reason above.  Suppose it CONFIG_SND_MAESTRO3_INPUT.

Then it looks like:

config SND_MAESTRO3_INPUT
	bool "enable input device for maestro3 volume switches"
	depends on SND_MAESTRO3
	depends on INPUT=y || INPUT=SND_MAESTRO3
	help
	  ....

Then you can use "#ifdef CONFIG_SND_MAESTRO3_INPUT" to determine
compile condition.  If this isn't defined, keep the old behavior,
i.e. controlling ac97 registers directly.


thanks,

Takashi

  parent reply	other threads:[~2010-04-22 15:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22  8:37 [PATCH 1/2] snd-maestro3: Make hardware volume buttons an input device Hans de Goede
2010-04-22  8:37 ` [PATCH 2/2] snd-es1968: " Hans de Goede
2010-04-22 15:02 ` Takashi Iwai [this message]
2010-04-22 15:47   ` [PATCH 1/2] snd-maestro3: " Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h4oj3edjf.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=hdegoede@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox