0% found this document useful (0 votes)
88 views10 pages

Linux Sound Drivers Framework: Barry Song (宋宝华)

This document provides an overview of Linux sound driver frameworks, including OSS, ALSA, and ASoC (ALSA on SoC). It describes the data flow and key components of each framework. For ALSA, it explains the snd_pcm_ops functions and data flow using callbacks. For ASoC, it outlines how components are split into a codec driver, platform driver, and machine driver. It also provides examples of implementing an AD1938 codec driver using the ASoC framework on a Blackfin SoC.

Uploaded by

PostxyPostxz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views10 pages

Linux Sound Drivers Framework: Barry Song (宋宝华)

This document provides an overview of Linux sound driver frameworks, including OSS, ALSA, and ASoC (ALSA on SoC). It describes the data flow and key components of each framework. For ALSA, it explains the snd_pcm_ops functions and data flow using callbacks. For ASoC, it outlines how components are split into a codec driver, platform driver, and machine driver. It also provides examples of implementing an AD1938 codec driver using the ASoC framework on a Blackfin SoC.

Uploaded by

PostxyPostxz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

The World Leader in High Performance Signal Processing Solutions

Linux Sound Drivers Framework


Barry Song( 宋宝华 )

June 19, 2009


Contents

OSS Framework and Dataflow

ALSA Framework and Dataflow

ASoC (ALSA on SoC) Framework and SoC Core

AD1938 ASoC Drivers


OSS Framework
Two char devices: dsp and mixer

OSS

dsp mixer
file_operations file_operations

write read ioctl ioctl


Start-up Wake-up SOUND_MIXER_VOLUME

SOUND_MIXER_MIC
DMA transmit …
DMA interrupt
Typical OSS Read/Write Flow

Wake-up

Audio interrupt
ALSA Framework
ALSA Dataflow
snd_pcm_ops functions
static struct snd_pcm_ops snd_ad1938_playback_ops = {
.open = snd_ad1938_playback_open,
.close = snd_ad1938_playback_close,
.ioctl = snd_pcm_lib_ioctl, sound core return frames
.hw_params = snd_ad1938_hw_params,
.hw_free = snd_ad1938_hw_free, START/STOP..
.prepare = snd_ad1938_playback_prepare,
.trigger = snd_ad1938_playback_trigger,
.pointer = snd_ad1938_playback_pointer,
trigger pointer
.copy = snd_ad1938_playback_copy,
.silence = snd_ad1938_playback_silence, snd_pcm_period_elapsed
};

DMA transmit DMA interrupt

Not like OSS, ALSA sound core will manage flow control with the help of low
level driver callbacks.
ASoC: ALSA on SoC
ASoC splits an embedded audio system into 3 components :-

* Codec driver: The codec driver is platform independent and contains audio
controls, audio interface capabilities, codec DAPM definition and codec IO
functions.

* Platform driver: The platform driver contains the audio DMA engine and audio
interface drivers (e.g. I2S, AC97, PCM) for that platform.

* Machine driver: The machine driver handles any machine specific controls an
d audio events (e.g. turning on an amp at start of playback).

SoC Core:
Traditional ALSA Driver

machine platform Codec


Typical SoC Core Methods
Call corresponding functions of every spitted component
static int soc_pcm_prepare(struct snd_pcm_substream *substream)
{
if (machine->ops && machine->ops->prepare) {
ret = machine->ops->prepare(substream);
}

if (platform->pcm_ops->prepare) {
ret = platform->pcm_ops->prepare(substream);
}

if (codec_dai->ops->prepare) {
ret = codec_dai->ops->prepare(substream, codec_dai);
}

if (cpu_dai->ops->prepare) {
ret = cpu_dai->ops->prepare(substream, cpu_dai);
}
...
}

Except that, maintain issues like dynamic power management ,


pops elimination and so on with the help of low level driver callba
cks.
AD1938 with ASoC
AD1938 codec driver:
sound/soc/codecs/ad1938.h Codec
sound/soc/codecs/ad1938.c

TDM DAI driver:


sound/soc/blackfin/bf5xx-tdm.h
sound/soc/blackfin/bf5xx-tdm.c

TDM PCM (DMA) driver:


sound/soc/blackfin/bf5xx-tdm-pcm.h Platform
sound/soc/blackfin/bf5xx-tdm-pcm.c

SPORT interface driver:


sound/soc/blackfin/bf5xx-sport.h
sound/soc/blackfin/bf5xx-sport.c

Machine (Board) driver:


sound/soc/blackfin/bf5xx-ad1938.c
Board
SPI board info:
Add related information to arch/blackfin/mach-xxx/boards/xxx.c
Thank You!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy