[alsa-devel] Thoughts on ASOC v2 driver architecture

Jon Smirl jonsmirl at gmail.com
Mon Jun 16 18:23:18 CEST 2008


On 6/16/08, Timur Tabi <timur at freescale.com> wrote:
> Jon Smirl wrote:
>
>  > The drivers are creating their own platform devices. Constructing them
>  > in the driver builds in the assumption that if the driver is loaded,
>  > then the devices are present.  But that's not right in my case, I have
>  > four fabric drivers built in and I only want one of them active.
>
>
> You have two choices:
>
>  1) Load all drivers.  In each driver's __init section, let it determine whether
>  it should load or not.  If not, it can fail silently.  Off the top of my head, I
>  don't remember how to do that.
>
>  2) Use the Kernel Module Loader to dynamically load the module you want.  I
>  don't know how this works either.
>
>
>  > The devices are being created in the wrong place. So instead of my
>  > proposal of reading the platform name out of the device tree and
>  > loading the driver from fsl_ssi,  in Timur's case the fabric device
>  > should be created in arch/powerpc/platforms/86xx/mpc8610_hpcd.c.
>  > PowerPC is already capable of making the codec device from the device
>  > tree.
>
>
> True, but I chose to keep it in sound/soc/fsl so that I wouldn't have to push 3
>  drivers to alsa-devel and one driver to linuxppc-dev.

The driver stays in sound/soc/fsl. It's only the creation of the
device that moves. You just need to add this to
arch/powerpc/platforms/86xx/mpc8610_hpcd.c and remove it from
mpc8610_hpcd.c. Adding this to
arch/powerpc/platforms/86xx/mpc8610_hpcd.c will have no effect if the
mpc8610_hpcd.c driver is not to be found.

You've complicated it by creating two fabric devices but I believe
your code could be changed to only make one.

static struct platform_device alsa_fabric = {
	.name		= "MPC8610HPCD",
	.id		= -1,
};

static struct platform_device *devices[] = {
	&alsa_fabric,
};

platform_add_devices(&devices[0], ARRAY_SIZE(devices));


I'd rename the driver to something less generic.
	.name		= "MPC8610HPCD-fabric",



>
>
>  --
>  Timur Tabi
>  Linux kernel developer at Freescale
>


-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list