[alsa-devel] Dynamically registering a codec

Jon Smirl jonsmirl at gmail.com
Thu May 14 18:43:19 CEST 2009

On Thu, May 14, 2009 at 12:15 PM, Mark Brown
<broonie at opensource.wolfsonmicro.com> wrote:
> On Thu, 2009-05-14 at 11:44 -0400, Jon Smirl wrote:
>> Can we stick with the modifications to of_simple I just posted for
>> 2.6.31 and then try to get the core fixed in 2.6.32 so that of_simple
>> can be removed? I have no love for of_simple, I will immediately
>> remove it in favor of core support. Removing it has no impact on user
>> space.
> My main objection is to your abuse of platform devices here - there is
> no need for this on non-PowerPC platforms and a platform device affects
> everyone. So long as you come up with a solution that does not impact
> other platforms I'm less worried.

This is the part you don't like?
+static void __init efika_declare_platform_devices(void)
+	mpc52xx_declare_of_platform_devices();
+	platform_device_register_simple("efika-audio-fabric", 0, NULL, 0);

I can remove that by making the Efika fabric driver always load and
then check if it is on an Efika in it's probe function. If it is not
on an Efika it can exit. There were multiple discussions about this on
the ppc list. The conclusion was that the mess of wires on the
mainboard implementing audio really was a platform device.

There is a general kernel design problem in that there is no automated
way to load something like an audio fabric driver. The Efika fabric
driver is just example code, my Digispeaker hardware requires a board
specific fabric driver since it has an external audio clock chip.
Digispeaker drivers will come later after we decide on the final
hardware design.

The problem with fabric drivers is that they are optional and ALSA
drivers can load in any order. That requires a mechanism to say
registration time is now closed, proceed without waiting for a fabric
driver. The core could be changed to remove this requirement by
imposing ordering constraints on driver registration.

That's what this snippet is doing:
 static int __init alsa_sound_last_init(void)
 	int idx, ok = 0;
+	of_snd_soc_register_default_fabric();

>> of_simple handles both i2s and ac97. There's no probing mechanism for
>> i2s so we will have to keep device tree support that attaches i2s
>> codecs. There's also the problem of platform data for the ac97 codec
>> contained in the of node.
> Like I said, Linux does not support platform data for AC97 devices.

Jon Smirl
jonsmirl at gmail.com

More information about the Alsa-devel mailing list