Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio...

16
Audio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

Transcript of Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio...

Page 1: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

Audio debugging techniquesDecember 8th 2011

David Henningsson

Audio Hardware Enablement Engineer

Page 2: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

2 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Contents

● Audio stack overview

● Mixer problems

● Streaming problems

● Jack sensing

● Handing over

● What's happening upstream?

Page 3: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

3 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Audio stack overview

HDA codec driver

HDA controller driver

HDA controller(southbridge)

HDA codecchip

ALSA kernel core

ALSA library

PulseAudio

VOIP(Skype)

GStreamerlibrary

Media player

User space Kernel space

HDA bus

Hardware

Page 4: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

4 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Audio stack overview – the codec

● Use the “codecgraph” utility to make graphs such as the above

Page 5: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

5 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Pin Configuration Default

● Is filled in by firmware (BIOS/UEFI) at boot

● Tells which codec pins are connected to what

● For new computers we rely on this field heavily

● Problems in released hardware? We create a “driver quirk”.

● Problems in pre-release hardware? We feed this information back to firmware developers for correction.

● Hda-jack-retask demo!

Page 6: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

6 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Mixer problems

● Typical symptoms:

● One output or input works but not the other, e g external mic works but not internal mic

● Changing volume/gain has no effect, or only has effect for parts of the slider

● Initial check:

● Have you plugged the mic/headphones in? :-)

● Check mute, volume and connector in PulseAudio

● Check mutes and volumes in alsamixer

Page 7: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

7 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Mixer control names

● The HDA Codec driver creates mixer controls

● PulseAudio abstracts several mixer controls to one master control

● For PulseAudio to know, these mixer controls must have specific names

● Information at the codec level:

● /proc/asound/<card name>/codec#<address> will tell the mapping between HDA nodes and mixer controls

● Information at userspace level:

● /usr/share/pulseaudio/alsa-mixer/paths/* will tell how the different mixer controls are used in different scenarios

Page 8: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

8 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

PCM / Streaming problems

● Typical symptom:

● Audio breaks up, glitches or crackles

● These are typically non-trivial to resolve

● A PulseAudio verbose log can help with initial analysis

● Possible causes:

● Broken application (does not submit data to PulseAudio in time)

● Problem with position reports from the hardware

● Other bugs in PulseAudio or HDA controller driver

Page 9: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

9 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Jack sensing

● What happens when you plug something in?

● For headphones: Auto-mute of speakers is done in the kernel

● For microphones: Auto-switch of mic sometimes done in the kernel

● Notification is sent to userspace

● PulseAudio picks notification up

● Information is used to select correct port for volume control

● Userspace notification/handling

● ...is new in Ubuntu 11.10

● ...will be improved in Ubuntu 12.04

● Hda-jack-sense-test demo!

Page 10: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

10 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

HDMI/DisplayPort audio

● Nvidia usually has four output pins, Intel often has three

● Problem: which one is the right one?

● Best if firmware sets the Pin Configuration Default

● If not, we have to rely on jack sensing (work in progress)

● Note: Nvidia and ATI/AMD both require proprietary drivers for HDMI audio to work

Page 11: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

11 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Handing over - ALSA

● Is the bug resolved upstream?

● https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS

● Reporting a bug in Ubuntu:

● ubuntu-bug audio

● Making an alsa-info report:

● https://wiki.ubuntu.com/Audio/AlsaInfo

● Note: If you're dealing with pre-release hardware, be cautious not to submit confidential information!

● Primary upstream contact: [email protected] public mailing list

● Avoid ALSA's bug tracker

● Canonical can help out with upstream contacts

Page 12: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

12 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Handing over - PulseAudio

● Reporting a bug in Ubuntu:

● ubuntu-bug audio

● Making an PulseAudio verbose log:

● https://wiki.ubuntu.com/PulseAudio/Log

● Note: If you're dealing with pre-release hardware, be cautious not to submit confidential information!

● Primary upstream contact: [email protected] public mailing list

● Canonical can help out with upstream contacts

Page 13: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

13 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

What's happening upstream - ALSA

● A slowly progressing, but ongoing effort, to consolidate the codec parsers

● Machine quirks are inserted and removed regularly

● A new interface for jack sensing

Page 14: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

14 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

What's happening upstream - PulseAudio

● Passthrough support

● Jask sensing

● UCM

● Routing infrastructure

Page 15: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

15 Canonical Confidential Ubuntu Hardware Summit. December 8th 2011

Update and Links

● You can download presentation and notes from my blog:

http://voices.canonical.com/david.henningsson/

Page 16: Audio debugging techniques - Ubuntuodm.ubuntu.com/uhs/2011/Audio Debugging Techniques.pdfAudio debugging techniques December 8th 2011 David Henningsson Audio Hardware Enablement Engineer

Thank you

Questions ?