Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-24 Thread Tom Gundersen
I don't know much about this, but since there might be differences
between different models, I'll add my two cents. I have a ThinkPad
X60.

On Tue, May 24, 2011 at 7:39 AM, David Henningsson
david.hennings...@canonical.com wrote:
 On 2011-05-23 19:21, Andrew Lutomirski wrote:
 Most ThinkPad laptops have an extra mixer that has nothing to do with
 the HDA audio hardware.  The kernel can talk to it through the
 embedded controller and, if it's muted, then there's no sound even if
 the normal controls are all set on.

 Does this concern the internal speaker only, or headphones / line out as
 well? Or can that differ between models? I'm assuming it doesn't mute e g
 USB headset or audio out over HDMI.

The buttons affect both the speakers and headset. When the headest is
connected the speaker is muted (I don't know if this is done in
software or in hardware, but I always assumed it was done in hardware
as it always worked this way). I never tried usb headset, and don't
have HDMI.

 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.

 So, what can the thinkpad-acpi driver do here? Can it e g control the
 hardware mute status at all, or can that only be done by pressing the keys?

At least on my laptop alsamixer can not set the volume/mute of -c29,
this can only be done by the buttons.

Cheers,

Tom
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-24 Thread Andrew Lutomirski
On Tue, May 24, 2011 at 10:13 AM, Tom Gundersen t...@jklm.no wrote:
 I don't know much about this, but since there might be differences
 between different models, I'll add my two cents. I have a ThinkPad
 X60.

 On Tue, May 24, 2011 at 7:39 AM, David Henningsson
 david.hennings...@canonical.com wrote:
 On 2011-05-23 19:21, Andrew Lutomirski wrote:
 Most ThinkPad laptops have an extra mixer that has nothing to do with
 the HDA audio hardware.  The kernel can talk to it through the
 embedded controller and, if it's muted, then there's no sound even if
 the normal controls are all set on.

 Does this concern the internal speaker only, or headphones / line out as
 well? Or can that differ between models? I'm assuming it doesn't mute e g
 USB headset or audio out over HDMI.

 The buttons affect both the speakers and headset. When the headest is
 connected the speaker is muted (I don't know if this is done in
 software or in hardware, but I always assumed it was done in hardware
 as it always worked this way). I never tried usb headset, and don't
 have HDMI.

 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.

 So, what can the thinkpad-acpi driver do here? Can it e g control the
 hardware mute status at all, or can that only be done by pressing the keys?

 At least on my laptop alsamixer can not set the volume/mute of -c29,
 this can only be done by the buttons.

thinkpad_acpi.volume_control=1 will enable it.  I don't know why the
default is the way it is.

If you run my patch, then you'll have a file
/sys/devices/platform/thinkpad_acpi/volume_autocontrol that configures
whether the mute button just mutes the mixer (latch), toggles the
mixer state (toggle), or sends KEY_MUTE (none).  Without the
patch, depending on your model and your acpi_osi parameter, you might
have the button mute the mixer *and* send KEY_MUTE or just send
KEY_MUTE.  The former behavior is not so nice.  (My patch also
prevents typematic repeat of the mute button, which is just silly.)

http://permalink.gmane.org/gmane.linux.drivers.platform.x86.devel/1941

--Andy


 Cheers,

 Tom
 ___
 pulseaudio-discuss mailing list
 pulseaudio-discuss@mail.0pointer.de
 https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-23 Thread Colin Guthrie
'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 :)

Thanks

Col


-- 

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/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-23 Thread Tom Gundersen
On Mon, May 23, 2011 at 7:50 PM, Colin Guthrie gm...@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 :)

I have a ThinkPad X60 which I think is one of the relevant models. I
have a mute botton and two volume buttons, but no light. Pressing vol
up/down unmutes and changes the volume.

As explained by Andy,
alsamixer -c29
shows the thinkpad mixer and it works as expected (read-only).

Below are the outputs of amixer for my system (running 2.6.39 fwiw).
I'd be happy to try patches or help in any other way to make this work
nicely with PA.

Cheers,

Tom

teg@x60 ~ % amixer -c29
Simple mixer control 'Console',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 14
  Mono: Playback 10 [71%] [off]



teg@x60 ~ % amixer -c0
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch penum
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 61 [97%] [0.00dB] [on]
  Front Right: Playback 61 [97%] [0.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch penum
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 23 [74%] [0.00dB] [on]
  Front Right: Playback 23 [74%] [0.00dB] [on]
Simple mixer control 'CD',0
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive penum
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Mono
  Limits: Playback 0 - 31
  Mono: Capture [off]
  Front Left: Playback 23 [74%] [0.00dB] [on]
  Front Right: Playback 23 [74%] [0.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive penum
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Mono
  Limits: Playback 0 - 31
  Mono: Capture [on]
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Mic Boost',0
  Capabilities: volume penum
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 1 [33%] [10.00dB]
  Front Right: 1 [33%] [10.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined penum
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958 Playback Source',0
  Capabilities: enum
  Items: 'PCM' 'ADC'
  Item0: 'PCM'
Simple mixer control 'Beep',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 15
  Mono: Playback 0 [0%] [-45.00dB] [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch penum
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 15
  Front Left: Capture 15 [100%] [22.50dB] [on]
  Front Right: Capture 15 [100%] [22.50dB] [on]
Simple mixer control 'Mix',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive penum
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [off]
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-23 Thread Andrew Lutomirski
On Mon, May 23, 2011 at 4:00 PM, Tom Gundersen t...@jklm.no wrote:
 On Mon, May 23, 2011 at 7:50 PM, Colin Guthrie gm...@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 :)

 I have a ThinkPad X60 which I think is one of the relevant models. I
 have a mute botton and two volume buttons, but no light. Pressing vol
 up/down unmutes and changes the volume.

 As explained by Andy,
 alsamixer -c29
 shows the thinkpad mixer and it works as expected (read-only).

 Below are the outputs of amixer for my system (running 2.6.39 fwiw).
 I'd be happy to try patches or help in any other way to make this work
 nicely with PA.

My laptop will behave identically as far as ALSA is concerned.

Tom, if you apply this patch:

http://www.mail-archive.com/platform-driver-x86@vger.kernel.org/msg01884.html

then you may find that some bugs are fixed.  For example, right now I
suspect that hitting mute repeatedly will make PA toggle the software
mute on and off but will leave the mixer muted, leading to confusion
as to why there's no sound.  I also suspect that alsamixer does not
update itself when you press mute (but that if you quit and reload it
you'll see the new state).

If you're using acpi_osi=Linux then you'll see something different.

With that patch, pressing mute will not make PA do anything, which is
better than the current behavior of doing the wrong thing.  alsamixer
should also update itself automatically.  And you can play with
/sys/devices/platform/thinkpad_acpi/volume_autocontrol to change how
the button works.

I want to make PA play well with that patch or a modified version of it.

---Andy
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


Re: [pulseaudio-discuss] Dealing with the ThinkPad hardware mixer

2011-05-23 Thread David Henningsson
Hi Andrew and thanks for dealing with this issue! I'm sometimes working 
with certifying Lenovo for Canonical/Ubuntu, so this definitely concerns 
me. However I know very little about the thinkpad-acpi driver and would 
like to know more about how it works, and especially the mixer part.


On 2011-05-23 19:21, Andrew Lutomirski wrote:

Most ThinkPad laptops have an extra mixer that has nothing to do with
the HDA audio hardware.  The kernel can talk to it through the
embedded controller and, if it's muted, then there's no sound even if
the normal controls are all set on.


Does this concern the internal speaker only, or headphones / line out as 
well? Or can that differ between models? I'm assuming it doesn't mute e 
g USB headset or audio out over HDMI.



These laptops have three special buttons.  The mute button either
mutes the mixer or toggles the mute state.  The volume up button
unmutes the mixer (if muted) and sends KEY_VOLUMEUP.  The volume down
button unmutes the mixer and sends KEY_VOLUMEDOWN.

On very new models, there's a hardware mute light that indicates the
status of the hardware mute.

The thinkpad-acpi driver currently exposes an ALSA mixer and the
alsamixer utility can talk to it.  But PulseAudio ignores it
completely.

What is the kernel supposed to do to get PulseAudio to DTRT?


Seen from my perspective, and maybe along the lines of Colin's reply, I 
think the best would be to try to integrate the hw mute in the HDA card 
at the kernel level (and thus skip card 29 entirely).



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.


So, what can the thinkpad-acpi driver do here? Can it e g control the 
hardware mute status at all, or can that only be done by pressing the keys?



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?

(There's an added complexity.  Really old models have mute and volume.
  I don't own one, so I don't know much about how they work.)


As a maybe unrelated issue, many of these thinkpads also have a 
microphone mute hotkey I was hoping to be able to get to work at some 
point. Assuming we add a new key to linux/input.h, would it be easy for 
you to fix that in the thinkpad-acpi driver? I think it currently 
triggers KEY_UNKNOWN.



--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss