[alsa-devel] [RFC][ASoC] New device/driver arch
I'd like to gather some feedback on some changes I've been making to ASoC recently. The changes were made to fit in better with the PPC device tree and to help with easier porting to new platforms. They were also introduced to make dealing with device probe errors (e.g. I2C probe failure) a little easier.
The largest change is the introduction of an ASoC bus device. All component drivers (that is, codec, codec DAI, CPU DAI, and DMA PCM drivers) register with this bus. This should simplify device registration and hopefully better fit in with the PPC model. A component driver now typically consists of the standard driver ops and a set of ASoC/ALSA ops to configure audio.
The new soc.h shows this here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
Example component drivers are here :-
I2S
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
DMA
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
WM8753 Codec
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
Another major change is that there is no more snd_dai_link (structure that connected codec <--> CPU). This has been replaced by an ASoC PCM device that describes each PCM device in the machine. This new ASoC PCM device has it's own driver and registers with the bus (like the others). This allows an ASoC PCM driver to be defined like :-
static struct snd_soc_device_driver hifi_pcm_drv = { .type = SND_SOC_BUS_TYPE_PCM, .driver = { .name = "mainstone-hifi-pcm", .owner = THIS_MODULE, .probe = hifi_pcm_probe, .remove = hifi_pcm_remove, }, .components = { .cpu_dai = pxa2xx_i2s, .codec = wm8753_codec, .codec_dai = wm8753_hifi_dai, .platform = pxa2xx_pcm, }, };
This now shows each component within the driver structure.
The snd_soc_machine driver has changed and can now contain numerous ASoC PCM devices. It is now a platform driver.
Example machine driver for Mainstone with WM8753 is here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
The machine driver now also does the I2C/SPI probing (instead of the codec) and also does any codec IO (to better support multiple controllers).
Fwiw, I've not tested any of this code atm. I plan to start this tomorrow on pxa2xx and i.MX31 and would like to get some feedback before porting remaining platforms and codecs over.
Liam
Hi Liam,
Is it possible to have 2 physical I2S units (which are connected to the same codec) be repesented as a single ASoC device? (The SH7760 has 2 I2S units which are "halfduplex" (only transmit OR capture at a time). My dev platform simply uses the second unit for capture
I need a trigger callback in the machine driver to properly support multichannel I2S audio on Au1200 (the Au1200 can only do stereo; to get more channels we double/quadruple the I2S LRCLK coming from the codec; however the CPLD needs to be told when a new sample starts; although maybe that can be worked around in VHDL)
Thanks for the great work Manuel Lauss
On Thu, 2007-06-14 at 20:06 +0200, Manuel Lauss wrote:
Hi Liam,
Is it possible to have 2 physical I2S units (which are connected to the same codec) be repesented as a single ASoC device? (The SH7760 has 2 I2S units which are "halfduplex" (only transmit OR capture at a time). My dev platform simply uses the second unit for capture
Yes. I would create two struct snd_soc_device_drivers in your i2s.c file. The first would be the driver for the 2 halfduplex I2S units and the second would be a full duplex driver for a merged I2S controller (made up of the 2 halfduplex units). This way a device can either probe against the halfduplex or full duplex driver based on the driver ID.
I need a trigger callback in the machine driver to properly support multichannel I2S audio on Au1200 (the Au1200 can only do stereo; to get more channels we double/quadruple the I2S LRCLK coming from the codec; however the CPLD needs to be told when a new sample starts; although maybe that can be worked around in VHDL)
I'll add trigger. Probably easier to do this in C than VHDL ;)
Liam
So in this architecture we will have so many devices registered to the kernel?
On 6/15/07, Liam Girdwood lg@opensource.wolfsonmicro.com wrote:
On Thu, 2007-06-14 at 20:06 +0200, Manuel Lauss wrote:
Hi Liam,
Is it possible to have 2 physical I2S units (which are connected to the same codec) be repesented as a single ASoC device? (The SH7760 has 2 I2S units which are "halfduplex" (only transmit OR capture at a time). My dev platform simply uses the second unit for capture
Yes. I would create two struct snd_soc_device_drivers in your i2s.c file. The first would be the driver for the 2 halfduplex I2S units and the second would be a full duplex driver for a merged I2S controller (made up of the 2 halfduplex units). This way a device can either probe against the halfduplex or full duplex driver based on the driver ID.
I need a trigger callback in the machine driver to properly support multichannel I2S audio on Au1200 (the Au1200 can only do stereo; to get more channels we double/quadruple the I2S LRCLK coming from the codec; however the CPLD needs to be told when a new sample starts; although maybe that can be worked around in VHDL)
I'll add trigger. Probably easier to do this in C than VHDL ;)
Liam
Hi Liam,
On 6/14/07, Liam Girdwood lg@opensource.wolfsonmicro.com wrote:
Example machine driver for Mainstone with WM8753 is here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
The machine driver now also does the I2C/SPI probing (instead of the codec) and also does any codec IO (to better support multiple controllers).
The way in which the platform device is created in this file seems to have a problem. The mainstone_wm8753_probe() function (along everything else after that point) seems to expect that the platform device will be encapsulated in a struct snd_soc_machine, but this doesn't seem to be the case since you are instantiating the device with platform_driver_probe(). Am I missing something?
Cheers, Seth
On Fri, 2007-06-15 at 10:01 -0500, Seth Forshee wrote:
Hi Liam,
On 6/14/07, Liam Girdwood lg@opensource.wolfsonmicro.com wrote:
Example machine driver for Mainstone with WM8753 is here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
The machine driver now also does the I2C/SPI probing (instead of the codec) and also does any codec IO (to better support multiple controllers).
The way in which the platform device is created in this file seems to have a problem. The mainstone_wm8753_probe() function (along everything else after that point) seems to expect that the platform device will be encapsulated in a struct snd_soc_machine, but this doesn't seem to be the case since you are instantiating the device with platform_driver_probe(). Am I missing something?
Your right. This is a bug. Will fix.
Thanks
Liam
participants (4)
-
Liam Girdwood
-
Manuel Lauss
-
Nobin Mathew
-
Seth Forshee