[pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

Colin Guthrie gmane at colin.guthr.ie
Mon May 23 11:18:12 PDT 2011


'Twas brillig, and Andrew Lutomirski at 23/05/11 18:59 did gyre and gimble:
> On Mon, May 23, 2011 at 1:50 PM, Colin Guthrie <gmane at colin.guthr.ie> wrote:
>> 'Twas brillig, and Andrew Lutomirski at 23/05/11 18:21 did gyre and gimble:
>>> What is the kernel supposed to do to get PulseAudio to DTRT?  On some,
>>> but not (I think) all, models, we can disable hardware mixer control
>>> and make all of the buttons act like ordinary buttons, but that will
>>> cause the light (if present) to malfunction, and I don't know if all
>>> models can do this.  So as it stands, PulseAudio would have to
>>> understand that the mixer is special and watch for ALSA change
>>> notifications.
>>>
>>> I'm willing to change the thinkpad-acpi driver to make it work better,
>>> but I know nothing at all about PulseAudio internals.  What should I
>>> do?
>>
>> Can you give some more details?
>>
>> e.g. does it show up under the same alsa card as the HDA or is it separate?
>>
>> amixer -c0 (or appropriate number) would be useful to begin with :)
> 
> It's separate.  I can send details when I get home, but from memory:
> 
> alsamixer -c1 sees the HDA mixers.
> alsamixer -c29 sees the thinkpad-acpi mixer.
> 
> On recent thinkpads with my pending thinkpad-acpi changes, alsamixer
> -c29 will update itself when the hardware buttons change the mixer
> state.  Without my patches, alsamixer won't notice.

Ahh, tricky!

In an ideal world, it would be super awesome if the alsa user-space lib
could configure the additional controls within the same card (in much
the same way that it sometimes configures a PCM control for the softvol
plugin), thus solving the problem below PA. If that was possible,
supporting this would be rather trivial in PA.

But if not, I think the solution could be related to some support that
is proposed to help a different, but related problem.

To give some background on that problem:

When you plug a USB device in that is e.g. a headset, but also contains
some volume buttons to adjust the vol. Now these buttons appear under
/dev/input.... but in a way that doesn't really tie in to the actual
sound card, so when the user presses these buttons, we don't have any
way to adjust the correct sound card. At present, pressing such buttons
changes the volume of the current default card, not the one it's
actually physically connected to (unless it happens to be the default).

So, the idea was to attach some kind of "originating device" property
via udev to both the sound card and the input device. This would allow
us to pair them with each other and thus the desktop environment could
ultimately adjust the correct volume when it handles the volume key
press events.

I suspect a similar thing could be done here... i.e. somehow pair the
two controls. That way we can enumerate the controls as a single entity.


> The magic hardware mixer is a created by the thinkpad-acpi driver
> without any attempt to associate it with any other ALSA device on the
> system.  I suspect that the driver should be doing something different
> (and again, I'm willing to make and submit changes, but I don't know
> what it should do to make PulseAudio happy).

The changes needed here are rather extensive so I wouldn't expect it to
happen overnight sadly. There could be some kind of hacks introduced in
the mean time, but I'm not really in a position to guess at this. David
and Tanu are probably in a better position, but David is on leave for a
couple weeks so likely won't read this for a while....


The code in PA is quite flexible but it's ultimately rather complex. We
have a whole bunch of mixer profiles that ultimately work out what the
card is capable of. It's quite focused on applying ot a single control
interface just now, and I can't think of a clean way of the top of my
head to extend that, but then I don't know that code, so this is, in
itself, not overly surprising :)

Please do post the additional mixer details when you have them.





-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]




More information about the pulseaudio-discuss mailing list