From: Hans de Goede <hdegoede@redhat.com>
To: alsa-devel@alsa-project.org
Subject: Re: [PATCH 4/4] snd-maestro3: Make hardware volume buttons an input device
Date: Thu, 22 Apr 2010 09:57:42 +0200 [thread overview]
Message-ID: <4BD00176.3000904@redhat.com> (raw)
In-Reply-To: <20100421160551.GB6861@sci.fi>
Hi,
On 04/21/2010 06:05 PM, Ville Syrjälä wrote:
> On Wed, Apr 21, 2010 at 11:04:09AM -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 it. The maestro2 code is nearly identical. Any chance you'd
> give it the same treatment?
Yes, I already noticed it was nearly identical, but I didn't work
on it as I have no hardware to test any changes ...
> I should be able to dig up a few laptops to
> test both drivers if necessary.
I'll do an identical patch for the meastro2, if you could test that that would
be great.
>
> <snip>
>> @@ -2524,6 +2494,42 @@ static int m3_resume(struct pci_dev *pci)
>> }
>> #endif /* CONFIG_PM */
>>
>> +#ifdef CONFIG_INPUT
>> +static int __devinit snd_m3_input_register(struct snd_m3 *chip)
>> +{
>> + struct input_dev *input_dev;
>> + int err;
>> +
>> + input_dev = input_allocate_device();
>> + if (!input_dev)
>> + return -ENOMEM;
>> +
>> + snprintf(chip->phys, sizeof(chip->phys), "pci-%s/input0",
>> + pci_name(chip->pci));
>
> What's the proper format of phys? I see gameport stuff uses
> pci%s/gameport0, ir stuff uses pci-%s/ir0. I can't immediately find any
> other pci input things.
>
I've no idea, I took the pci-%s/ part from other pci drivers registering
input devices and the input0 part is based on doing:
cat /sys/class/input/input?/phys
On my system which yields a string ending in input0 for almost all
input devices.
>> +
>> + input_dev->name = chip->card->driver;
>> + input_dev->phys = chip->phys;
>> + input_dev->id.bustype = BUS_PCI;
>> + input_dev->id.vendor = chip->pci->vendor;
>> + input_dev->id.product = chip->pci->device;
>> + input_dev->dev.parent =&chip->pci->dev;
>> +
>> + input_dev->evbit[0] = BIT_MASK(EV_KEY);
>> + input_dev->keybit[BIT_WORD(KEY_MUTE)] |= BIT_MASK(KEY_MUTE);
>> + input_dev->keybit[BIT_WORD(KEY_VOLUMEDOWN)] |= BIT_MASK(KEY_VOLUMEDOWN);
>> + input_dev->keybit[BIT_WORD(KEY_VOLUMEUP)] |= BIT_MASK(KEY_VOLUMEUP);
>
> __set_bit() perhaps
Ah yes, good one.
>
>> +
>> + err = input_register_device(input_dev);
>> + if (err) {
>> + input_dev->dev.parent = NULL;
>
> Is this nullification needed?
>
I copy pasted this from gspca's input handling code, as I'm
familiar with the gspca code, but looking at what
input_free_device actually does: no.
I'll respin the patch with these 2 issues fixed and repost it
+ an identical one for the es1968 driver.
>> + input_free_device(input_dev);
>> + } else {
>> + chip->input_dev = input_dev;
>> + }
>> +
>> + return err;
>> +}
>> +#endif /* CONFIG_INPUT */
>>
>> /*
>> */
>
Regards,
Hans
next prev parent reply other threads:[~2010-04-22 7:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-21 15:04 [PATCH 1/4] snd-meastro3: Add amp_gpio quirk for Compaq EVO N600C Hans de Goede
2010-04-21 15:04 ` [PATCH 2/4] snd-meastro3: Document hardware volume control a bit Hans de Goede
2010-04-21 15:04 ` [PATCH 3/4] snd-meastro3: Ignore spurious HV interrupts during suspend / resume Hans de Goede
2010-04-21 15:04 ` [PATCH 4/4] snd-maestro3: Make hardware volume buttons an input device Hans de Goede
2010-04-21 16:05 ` Ville Syrjälä
2010-04-22 7:57 ` Hans de Goede [this message]
2010-04-22 15:11 ` Ville Syrjälä
2010-04-22 16:59 ` [alsa-devel] " Dmitry Torokhov
2010-04-22 17:54 ` Ville Syrjälä
2010-04-22 14:55 ` [PATCH 1/4] snd-meastro3: Add amp_gpio quirk for Compaq EVO N600C Takashi Iwai
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=4BD00176.3000904@redhat.com \
--to=hdegoede@redhat.com \
--cc=alsa-devel@alsa-project.org \
/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 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.