Skip to contentSkip to conversation

ALSA SoC layer

RFC Liam Girdwood 3 participants 8 messages Nov 10, 2005 – Nov 17, 2005

lore
Share & tools
lore
#0 lore raw

I'd like to announce and gather some feedback from the community wrt a project that Richard Purdie and I have been working on lately.

The overall project goal of the ALSA System on Chip (ASoC) layer is to provide better ALSA support for embedded system on chip procesors (e.g. pxa2xx, au1x00, iMX, etc) and portable audio codecs. Currently there is some support in the kernel for SoC audio, however IMO it has some limitations:-

o Currently, codec drivers are often tightly coupled to the underlying
SoC cpu. This is not ideal and leads to code duplication i.e. Linux now has 4 different wm8731 drivers for 4 different SoC platforms.

o There is no standard method to signal user initiated audio events.
e.g. Headphone/Mic insertion, Headphone/Mic detection after an insertion event. These are quite common events on portable devices and often require machine specific code to re route audio, enable amps etc after such an event.

o Current drivers tend to power up the entire codec when playing (or
recording) audio. This is fine for a PC, but tends to waste a lot of power on portable devices. There is also no support for saving power via changing codec oversampling rates, bias currents, etc.

The ASoC layer is designed to address these issues and provide the following features :-

o Codec independence. Allows reuse of codec drivers on other platforms
and machines.

o Easy I2S/PCM audio interface setup between codec and SoC. Each SoC
interface and codec registers it's audio interface capabilities with the core and are subsequently matched and configured when the application hw params are known.

o Codec Dynamic Power Management (DPM). DPM automatically sets the
codec to it's minimum power state at all times. This includes powering up/down internal power blocks depending on the internal codec audio routing and any active streams.

o Pop and click reduction. Pops and clicks can be reduced by powering
the codec up/down in the correct sequence (including using digital mute). ASoC signals the codec when to change power states.

o Machine specific controls: Allow machines to add specific controls to
the sound card e.g. volume control for machine speaker amp.

To achieve all this, ASoC basically splits an embedded audio system into 3 components :-

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

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

o Machine driver: The machine driver handles any machine specific
controls and audio events. i.e. turning on an amp at start of playback.

ASoC is still very much work in progress and currently the only supported platform is the pxa2xx. Support for other platforms will follow soon with the iMX and au1x00 SoC's (as I have both boards).

Atm, codec drivers exist for:-

o WM8753
o WM8731
o WM8750
o WM8971
o WM9713 (voice interface)
o AC97 codec (supported via ac97_codec.c)

and in progress:-

o UDA1380
o WM8772

The current ASoC snapshot (version 0.6) is available at
http://rpsys.net/openzaurus/patches/alsa/alsa-soc-0.6.patch

New snapshots will be released weekly. The project will also shortly have an online git repository and web page for easier community collaboration.

Liam

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#1 lore raw

At Thu, 10 Nov 2005 10:29:27 +0000,

Quoted 20 lines · Liam Girdwood

I'd like to announce and gather some feedback from the community wrt a project that Richard Purdie and I have been working on lately.

The overall project goal of the ALSA System on Chip (ASoC) layer is to provide better ALSA support for embedded system on chip procesors (e.g. pxa2xx, au1x00, iMX, etc) and portable audio codecs. Currently there is some support in the kernel for SoC audio, however IMO it has some limitations:-

o Currently, codec drivers are often tightly coupled to the underlying
SoC cpu. This is not ideal and leads to code duplication i.e. Linux now has 4 different wm8731 drivers for 4 different SoC platforms.

o There is no standard method to signal user initiated audio events.
e.g. Headphone/Mic insertion, Headphone/Mic detection after an insertion event. These are quite common events on portable devices and often require machine specific code to re route audio, enable amps etc after such an event.

Quoted 4 lines

o Current drivers tend to power up the entire codec when playing (or
recording) audio. This is fine for a PC, but tends to waste a lot of power on portable devices. There is also no support for saving power via changing codec oversampling rates, bias currents, etc.

All agreed. The second and the thirt points are valid for the normal laptops, too. About the third point, I've been thinking of adding a switch (maybe via control API), to select the power-save behavior.

Quoted 35 lines

The ASoC layer is designed to address these issues and provide the following features :-

o Codec independence. Allows reuse of codec drivers on other platforms
and machines.

o Easy I2S/PCM audio interface setup between codec and SoC. Each SoC
interface and codec registers it's audio interface capabilities with the core and are subsequently matched and configured when the application hw params are known.

o Codec Dynamic Power Management (DPM). DPM automatically sets the
codec to it's minimum power state at all times. This includes powering up/down internal power blocks depending on the internal codec audio routing and any active streams.

o Pop and click reduction. Pops and clicks can be reduced by powering
the codec up/down in the correct sequence (including using digital mute). ASoC signals the codec when to change power states.

o Machine specific controls: Allow machines to add specific controls to
the sound card e.g. volume control for machine speaker amp.

To achieve all this, ASoC basically splits an embedded audio system into 3 components :-

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

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

Quoted 7 lines

o Machine driver: The machine driver handles any machine specific
controls and audio events. i.e. turning on an amp at start of playback.

ASoC is still very much work in progress and currently the only supported platform is the pxa2xx. Support for other platforms will follow soon with the iMX and au1x00 SoC's (as I have both boards).

SoC can superseed the existing drivers, right?

Quoted 14 lines

Atm, codec drivers exist for:-

o WM8753
o WM8731
o WM8750
o WM8971
o WM9713 (voice interface)
o AC97 codec (supported via ac97_codec.c)

and in progress:-

o UDA1380
o WM8772

Quoted 6 lines

The current ASoC snapshot (version 0.6) is available at
http://rpsys.net/openzaurus/patches/alsa/alsa-soc-0.6.patch

New snapshots will be released weekly. The project will also shortly have an online git repository and web page for easier community collaboration.

At a quick glance, the code looks promising.
Very minor nitpicks:

- case is usually not indented in switch() in kernel codes (althought not written explicitly in CodingStyle).

- *_add_widgets() can be optimized with an array.

- documentation is missing ;)

How is the planned schedule?
I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final. Although the backward compatibility will be kept mostly, the code rewriting (just running sed or whatever) will be done after that.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#2 lore raw
Quoted 3 lines · Takashi Iwai

SoC can superseed the existing drivers, right?

Yes, providing the platform/machine and codec is supported. They can also co-exist (as in my tree atm).

Quoted 9 lines

At a quick glance, the code looks promising.
Very minor nitpicks:

- case is usually not indented in switch() in kernel codes (althought not written explicitly in CodingStyle).

- *_add_widgets() can be optimized with an array.

I'll fix all this in 0.7 (snapshot next week)

Quoted 2 lines

- documentation is missing ;)

Apologies, I know. I'll try and get something together for the next release. Promise ;)

Quoted 2 lines

How is the planned schedule?

Now that the pxa2xx platform is stable, I still have the following core functionality to implement:-

o Machine codec pin connections (for dpm - only power up output if physically connected - machine specific)
o Some code clean up (including above)
o Machine specific kcontrols.
o Mic Bias

I'm hoping to have this done in the next 2 weeks. After this, I'll be adding other platforms. Hopefully, I'll have added iMX and some of au1x00 by xmas time. More codecs will also be added in this time.

After the iMX platform is added the API should be relatively stable. I'll be looking to submit patches to alsa-dev at this point.

Quoted 6 lines

I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final. Although the backward compatibility will be kept mostly, the code rewriting (just running sed or whatever) will be done after that.

ok, I'll wait until 1.0.10 and remove ASoC xxx_t. This will make ASoC 0.8 depend on 1.0.10 and above.

Cheers

Liam

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#3 lore raw

xxx_t replacement (was:ALSA SoC layer)

In reply to Takashi Iwai
Quoted 2 lines · On 10-Nov-2005 Takashi Iwai wrote:

I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final.

Please don't change all the xxxchip_t typedef's in the drivers. They help a lot keeping many lines short.

--
Giuliano.

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#4 lore raw

Re: xxx_t replacement (was:ALSA SoC layer)

At Fri, 11 Nov 2005 10:00:02 +0100 (CET),

Quoted 9 lines · Giuliano Pochini
Quoted 2 lines · On 10-Nov-2005 Takashi Iwai wrote:

I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final.

Please don't change all the xxxchip_t typedef's in the drivers. They help a lot keeping many lines short.

Shortening the line is not the purpose of xxx_t.
If necessary, you can shorten the struct name.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#5 lore raw

Re: Re: xxx_t replacement (was:ALSA SoC layer)

At Fri, 11 Nov 2005 11:59:08 +0100,

Quoted 7 lines · I wrote:

At Fri, 11 Nov 2005 10:00:02 +0100 (CET),

Quoted 4 lines · Giuliano Pochini

On 10-Nov-2005 Takashi Iwai wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final.

Please don't change all the xxxchip_t typedef's in the drivers. They help a lot keeping many lines short.

Shortening the line is not the purpose of xxx_t.
If necessary, you can shorten the struct name.

Well, my opinion above is meant _in general_. You have of course your choice.

I still didn't change all drivers. The core stuff and most of drivers are done. But echoaudio survives yet, so let's keep them :)

If anyone else insists on xxx_t, please let me know. I'll keep such drivers as they are.

Takashi

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php

#6 lore raw

Re: Re: xxx_t replacement (was:ALSA SoC layer)

At Fri, 11 Nov 2005 12:28:00 +0100,

Quoted 19 lines · I wrote:

At Fri, 11 Nov 2005 11:59:08 +0100,

Quoted 7 lines · I wrote:

At Fri, 11 Nov 2005 10:00:02 +0100 (CET),

Quoted 4 lines · Giuliano Pochini

On 10-Nov-2005 Takashi Iwai wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I'll merge my big patches to replace xxx_t with struct xxx likely in the next week just after releasing ALSA 1.0.10-final.

Please don't change all the xxxchip_t typedef's in the drivers. They help a lot keeping many lines short.

Shortening the line is not the purpose of xxx_t.
If necessary, you can shorten the struct name.

Quoted 8 lines

Well, my opinion above is meant _in general_. You have of course your choice.

I still didn't change all drivers. The core stuff and most of drivers are done. But echoaudio survives yet, so let's keep them :)

If anyone else insists on xxx_t, please let me know. I'll keep such drivers as they are.

I'll merge my big patches tomorrow. Please inform in time if you don't want it...

Takashi

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click

#7 lore raw

Re: Re: xxx_t replacement (was:ALSA SoC layer)

Quoted 2 lines · On 16-Nov-2005 Takashi Iwai wrote:

I'll merge my big patches tomorrow. Please inform in time if you don't want it...

Yes, please leave echoaudio as is. I have a patch pending already which I would like not to redo again. I'll send the xxx_t patch shortly after.

I'm only waiting for someone which can test these on a Layla 3G:

http://www.webalice.it/g_pochini/ead/alsa-driver-1.0.10.tar.bz2 [2.4MB]
http://www.webalice.it/g_pochini/ead/alsa-driver-1.0.10.tar.bz2.sig
* or *
http://www.webalice.it/g_pochini/ead/echo_new_fw.patch [10KB]
http://www.webalice.it/g_pochini/ead/echo_new_fw.patch.sig

and the new firmware:

http://www.webalice.it/g_pochini/ead/alsa-firmware.tar.bz2 [1.6MB]
http://www.webalice.it/g_pochini/ead/alsa-firmware.tar.bz2.sig

- New firmware fixes pops and clicks with simultaneous MIDI and audio I/O. There is now only one DSP firmware image for both Gina3G and Layla3G.

--
Giuliano.

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click