[alsa-devel] [PATCH] ASoC: imx-spdif: Use module_init() to handle platform_device_register()

Nicolin Chen Guangyu.Chen at freescale.com
Tue Dec 17 04:05:09 CET 2013

On Mon, Dec 16, 2013 at 10:17:10PM +0000, Mark Brown wrote:
> On Mon, Dec 16, 2013 at 09:19:58PM +0000, Russell King - ARM Linux wrote:
> > On Mon, Dec 16, 2013 at 07:47:17PM +0000, Mark Brown wrote:
> > > What should work right now is for the module to ensure that the S/PDIF
> > > CODEC drivers are loaded before it is by linking to some symbol from
> > > there.  This is a total hack though.  Nicer would be for the machine
> > > driver to either directly register S/PDIF DAIs (rather than devices that
> > > then register the DAIs) or to create a card subdevice in parallel with
> > > the S/PDIF ones and hook the card registration off that.
> > That creates much more complexity though, and adds yet more possibility
> > for unreliability into this.  "Keep it simple" is well worth following.
> I don't see registering the DAIs directly as adding complexity here;
> it's essentially what the current code is trying to do and doesn't
> change the normal device registration flow at all.  I do agree that the
> card subdevice is more complex, I don't particularly like that idea
> myself. 

Thank you for the detailed advices. I'll first try to register the CODEC
DAI directly.

> > The simple thing here is to declare the codec device in the module init,
> > before registering the card driver, and cleaning it up at the appropriate
> > moment.  That way, the card platform driver gets registered and it can
> It's certainly simple and it's definitely what I'd recommend for non-DT
> systems.  For DT systems it'll cause issues if two drivers both try to
> register the same device on module load and the second one to get loaded
> checks for errors.  Another way is just to do that in the core so we

And this might be another topic that we wouldn't have this problem if we
could use DT nodes for the S/PDIF CODEC driver as well. Since we are now
using DT systems, mixing up a non-DT way might have this kinda unexpected
result, although I admit this should be the responsibility driver owners
and here is mine. But I'm still wondering is there any possibility for us
to find a balanced way to enroll the S/PDIF CODEC driver in DT?

Thank you,
Nicolin Chen

More information about the Alsa-devel mailing list