[alsa-devel] Exposing the ThinkPad HW mute switch to ALSA?

Andy Lutomirski luto at amacapital.net
Wed Oct 8 02:43:11 CEST 2014


On Tue, Oct 7, 2014 at 7:50 AM, Takashi Iwai <tiwai at suse.de> wrote:
> At Tue, 7 Oct 2014 07:44:35 -0700,
> Andy Lutomirski wrote:
>>
>> On Oct 7, 2014 6:20 AM, "Henrique de Moraes Holschuh" <hmh at hmh.eng.br> wrote:
>> >
>> > On Tue, 07 Oct 2014, Takashi Iwai wrote:
>> > > At Tue, 7 Oct 2014 17:25:13 +1100,
>> > > Grant Diffey wrote:
>> > > > so I have a really dumb question.
>> > > >
>> > > > Why can't the controls be mapped as HCI rather than a soundcard? given
>> > > > there's no audio production capability here only a control capability.
>> > > >
>> > > > Also this seems to be how they end up functioning on a modern system they
>> > > > get bound to pulse which remaps them to whatever's 'active'
>> > > >
>> > > > Why does everyone say that this is a soundcard when it's really a keyboard
>> > > > (from my pov)
>> > >
>> > > thinkpad_acpi actually mutes the sound on some models, at least the
>> > > old ones, independently from the sound chip mute state.  That's why it
>> > > was implemented as the sound card object initially.
>> >
>> > That's how the hardware works, really.  One AC97 audio channel is routed to
>> > a digital volume chip, and from there to the console headphone jack, and to
>> > the built-in speakers.  line-out is not routed through this chip, and AFAIK
>> > MIC/line-in is not routed through either this chip _or_ a separate mute
>> > gate, either.
>> >
>> > The EC controls this digital volume chip directly, it is independent from
>> > the AC97 mixer.  The default behaviour cannot be changed in earlier
>> > thinkpads, and trying to change it in later thinkpads (they're supposed to
>> > have a legacy mode that is the same as the older models) doesn't work very
>> > well.
>> >
>> > Line-out and MIC are controlled only by the AC97 mixer in the older models
>> > with digital volume control.
>> >
>> > In newer-but-not-newest thinkpads, there are two mute gates, one for MIC,
>> > and another for the speakers/headphones.  The EC controls those.  All volume
>> > control is in the HDA mixer.
>> >
>> > In the newest thinkpads, I think there's only a MIC mute gate controlled by
>> > the EC, and everything else is in the HDA mixer.
>> >
>> > And depeding on the EC operating mode and thinkpad model, the volume hotkeys
>> > might interact with the mute state (unmuting on first press when it is
>> > mute).
>> >
>>
>> On newish thinkpads (at least X60-X220, and I think this works on the
>> latest models as well), we can disable all of this and make the mute
>> button be a regular button if we want.  Getting the mute LED to DTRT
>> might be tricky, but modern userspace can probably do it.
>>
>> This is almost certainly the approach that does something sensible
>> with the least code written.  We would just check for HAUM/SAUM on
>> startup and, if available, set SAUM to "software control only",
>> force-unmute the mute circuit, force the volume to full, and disable
>> the fake soundcard.
>
> That sounds sensible.  But, we'll still need to handle the mute LED,
> like we do for the mic-mute LED now?

Already done, I think:

        if (led_set_func(TPACPI_LED_MUTE, false) >= 0) {
            old_vmaster_hook = spec->vmaster_mute.hook;
            spec->vmaster_mute.hook = update_tpacpi_mute_led;
            removefunc = false;
        }

Admittedly, I see some value in having the mute button mute things
regardless of what userspace is doing, but I don't see *much* value in
it.  And, arguably, if that behavior is actually desirable, it should
be available on all laptops, not just ThinkPads.

--Andy


More information about the Alsa-devel mailing list