Re: [ibm-acpi-devel] [PATCH] thinkpad-acpi: disable alsa volume mixerfor SL410/SL510

From: Keng-YÃ Lin
Date: Wed Oct 05 2011 - 23:51:32 EST


On Thu, Mar 17, 2011 at 2:57 AM, Henrique de Moraes Holschuh
<hmh@xxxxxxxxxx> wrote:
> On Tue, 15 Mar 2011, Keng-Yu Lin wrote:
>> The mute key on SL410/SL510 only works when the alsa volume mixer
>> is not enabled. This patch makes the alsa volume mixer disabled
>> on the matched SL410/SL510 EC versions.
>
> I'd like more data on this. ÂIs this some sort of weird interaction with
> userspace, or does the firmware actually changes behaviour when we
> enable the MUTE HKEY event in the event mask?
>

The firmware does not change its behaviour with the key enabled in the keymask.
The mute key (and the LED on it) of the two models works good without
thinkpad_acpi loaded. So in the patch I like to exclude the volume
control part for the two models.

>> Â#define TPACPI_VOL_Q_MUTEONLY Â Â Â Â0x0001 Â/* Mute-only control available */
>> Â#define TPACPI_VOL_Q_LEVEL Â 0x0002 Â/* Volume control available */
>> +#define TPACPI_VOL_Q_IGNORE Â0x0003 Â/* No Volume control available */
>
> Change the comment to /* Blacklist volume control */, please. And name
> it TPACPI_VOL_Q_BLACKLIST.
>
>> @@ -6921,20 +6924,21 @@ static int __init volume_init(struct ibm_init_struct *iibm)
>> Â Â Â if (volume_capabilities >= TPACPI_VOL_CAP_MAX)
>> Â Â Â Â Â Â Â return -EINVAL;
>>
>> + Â Â quirks = tpacpi_check_quirks(volume_quirk_table,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂARRAY_SIZE(volume_quirk_table));
>> +
>> Â Â Â /*
>> Â Â Â Â* The ALSA mixer is our primary interface.
>> Â Â Â Â* When disabled, don't install the subdriver at all
>> Â Â Â Â*/
>> - Â Â if (!alsa_enable) {
>> + Â Â if (!alsa_enable || quirks & TPACPI_VOL_Q_IGNORE) {
>> Â Â Â Â Â Â Â vdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_MIXER,
>> Â Â Â Â Â Â Â Â Â Â Â Â Â "ALSA mixer disabled by parameter, "
>> Â Â Â Â Â Â Â Â Â Â Â Â Â "not loading volume subdriver...\n");
>> + Â Â Â Â Â Â alsa_enable = 0; /* reflect the quirk status in sysfs */
>> Â Â Â Â Â Â Â return 1;
>> Â Â Â }
>>
>> - Â Â quirks = tpacpi_check_quirks(volume_quirk_table,
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂARRAY_SIZE(volume_quirk_table));
>> -
>> Â Â Â switch (volume_capabilities) {
>> Â Â Â case TPACPI_VOL_CAP_AUTO:
>> Â Â Â Â Â Â Â if (quirks & TPACPI_VOL_Q_MUTEONLY)
>
> Do not overload error messages like that. ÂIt will now spill an
> incorrect message when the quirk list blacklists the volume control.
>
> Unfortunately, we're constrained by the unextensible alsa module command
> line ABI, so something more sensible (implementing "auto") is not
> available.
>
> Instead, please do it like this:
>
> 1. ÂDo not move the quirks test or error message up.
>
> 2. ÂAfter the quirk check, do this:
>
> if (quirks & TPACPI_VOL_Q_IGNORE) {
> Â Â Â Âdbg_printk(TPACPI_DBG_INIT | TPACPI_DBG_MIXER,
> Â Â Â Â Â Â Â Â Â "ALSA mixer blacklisted for this model, not loading
> volume subdriver...\n");
> Â Â Â Âreturn 1;
> }
>
> Note that it is a "dbg_printk", and NOT a "vdbg_printk".
>
> I'd much rather have something that allows the user to override the
> blacklisting, though. ÂBut it cannot be done through alsa_enable. ÂMaybe
> you could be persuaded to add support for a "force_volume" parameter?
>
> If you do add support for "force_volume", please make it an unsigned int
> (not bool), use 0 for no, and 1 for yes, and leave the other values
> undefined. ÂAnd add it to the documentation in
> Documentation/laptops/thinkpad-acpi.txt.
>

Thanks for the suggestion. I will be sending a new version of patches.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/