Subject: Re: [alsa-devel] [PATCH 1/2] powerpc: add platform registration for ALSA SoC drivers

From: Timur Tabi <[email-masked]>
Date: Wed, 28 Apr 2010 12:27:13 -0500

Grant Likely wrote:

> Didn't you just finish saying that you cannot see any situation where
> you would want the SSI devices linked into a single audio device?  So
> then if both SSIs are being used for audio, then do you not need a
> machine driver for each ssi?

That's right.  But in order for my fabric/machine driver to be called at all, I thought I needed to make it a platform driver and use platform_device_register_simple() and platform_driver_register().

>> Are you saying that I should call platform_device_register_simple()
>> from the SSI's driver initialization function, fsl_ssi_init()?
> 
> No, I'm saying call it from the probe hook.

But then platform_device_register_simple() will be called twice, and it should be called only once. 

I must be missing something here.

> However, you should probably do a two stage platform_device_alloc() /
> platform_device_add() so you can add data (node pointer) to the
> platform device before it gets probed by the machine driver.

Don't you mean platform_device_add_resources() instead of platform_device_add()?  That is, use platform_device_add_resources() too add information about each SSI that gets probed, and then after all of the SSIs are probed, then call platform_device_add().

If that's what you mean, then where do I call platform_device_add()?

> I'm not talking about platform_data or about the ssi driver decoding
> things that the machine driver needs.  I'm talking about giving the
> machine driver a pointer to the ssi device tree node so you don't need
> to go through weird gymnastics to find the correct node again.

The only gymnastics I need to go through is this:

while ((np = of_find_compatible_node(np, NULL, "fsl,mpc8610-ssi"))) {

This finds every SSI node.  I then extract the information from the SSI nodes and all the other nodes, and then register it with ASoC. 

-- 
Timur Tabi
Linux kernel developer at Freescale