Preview only show first 10 pages with watermark. For full document please download

Linux Audio For Smartphones

   EMBED


Share

Transcript

Linux Audio for Smartphones System integration basics 1 © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Overview • • • • • • • 2 Android audio stack overview Modern smartphone audio subsystems Traditional solutions ASoC – the Linux solution • • Design overview Brief introduction to chip drivers Walk through of system audio driver construction Debugging tips Future directions © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Android audio stack Applications MediaPlayer MediaRecorder AudioFlinger libaudio 3 © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Modern smartphone audio subsystems HDMI CPU Earpiece Speaker Headset Dock Mixing DSP Cellular modem 4 © 2011 Wolfson Microelectronics plc Bluetooth April 2011 www.wolfsonmicro.com Flexibility and complexity 5 © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Traditional driver model Memory 6 © 2011 Wolfson Microelectronics plc Processing Analogue April 2011 www.wolfsonmicro.com Traditional driver model • • • 7 Monolithic driver for each card • • No structure for managing off-CPU hardware Very little reuse Tight coupling between application and kernel code • • Per-use case register settings Detailed register level knowledge of components Time consuming © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com The Linux solution • • • • • • 8 ASoC embedded audio framework • • Merged since 2.6.21, April 2007 Provides standard ALSA interface to applications Reusable drivers for each chip Minimal per-system drivers Use case configuration done by userspace Automatic and transparent power management More reuse, less coupling © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Dynamic Audio Power Management • • • Looks for audio paths connecting inputs to outputs Powers only components in an active path Automatically activates DACs and ADCs DAC Speaker Mixer FM radio 9 © 2011 Wolfson Microelectronics plc Headset April 2011 www.wolfsonmicro.com ASoC CODEC drivers • • 10 Four classes of control • • • • Audio processing controls (eg, volume, effects) Audio routing controls (DAPM controls and routes) Power controls (DAPM widgets, bias) Stream control (Digital audio streaming) Mostly direct mapping into register map • SOC_DOUBLE_R_TLV("DAC1 Volume", WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_RIGHT_VOLUME, 1, 96, 0, digital_tlv), © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Driver integration walkthrough “Baseband” Headset Speaker S3C6410/ WM0010 WM8915 CODEC Mics WM9081 Amplifier Subwoofer http://opensource.wolfsonmicro.com/content/speyside-audio 11 © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Application layer • • • 12 AudioPolicyManager and AudioHardware • • platform/hardware/alsa_sound – Generic ALSA, asound.conf, LGPL devices/samsung/crespo – Nexus S, hard coded, Apache licensed Getting use cases • • Devices specified when streams are opened setMode() Applying use cases • • • • • Run external utilities Use asound.conf Call raw ALSA control APIs Apply settings with ALSA UCM Using common base use cases helps © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Debugging tips - DAPM • • • • Data in debugfs • • CONFIG_DEBUG_FS mount –t debugfs /dev/null /debug codec_reg – Register map dapm_pop_time – log sequences dapm directory SPKL: Off in 0 out 1 in "DAC2L" "DAC2L" out "static" "SPKL PGA" • 13 Tools: • git://git.opensource.wolfsonmicro.com/asoc-tools.git © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Debugging tips - general • • • • • • • 14 Audio stuck – check clocking Silent audio – check volumes and mutes Use bypass paths to bisect Turn volumes up to maximum Make sure machine drivers check error codes Check kernel logs for errors 2.6.38 and later support trace points • http://www.sirena.org.uk/log/2011/01/22/tracing-asoc-with-trace-points/ © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com Future work • • • • • • 15 Nicer handling of digital basebands Resolve headset detection API compatibility Greater use of DSP • • Enhanced features – ambient noise cancellation, beam forming, offloaded decompression, speaker compensation Even more dynamic reconfiguration of the audio subsystem Coefficient management and in-system calibration Use case development and management • • Media controller API User interfaces for configuration development ASoC conference, 4th-5th May • http://www.slimlogic.co.uk/?p=268 © 2011 Wolfson Microelectronics plc April 2011 www.wolfsonmicro.com