[alsa-devel] platform driver clarification in twl6040 codec driver

preetam preetamsashankreddy at gmail.com
Thu May 5 07:58:27 CEST 2011


Hai,

I am building an ALSA ASoC driver based on the original twl6040 driver 
on omap 4 panda board. I notice that there is a platform_device being 
created in the machine driver which is getting bound to the 
platform_driver created by the alsa soc core. i.e  "soc-audio".

sound/soc/omap/sd4430.c
================
     sdp4430_snd_device = platform_device_alloc("soc-audio", -1);
     if (!sdp4430_snd_device) {
         printk(KERN_ERR "Platform device allocation failed\n");
         return -ENOMEM;
     }

     snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai));

     platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430);

     ret = platform_device_add(sdp4430_snd_device);

soc-core.c
======
     static struct platform_driver soc_driver = {
         .driver        = {
             .name        = "soc-audio",
             .owner        = THIS_MODULE,
             .pm        = &soc_pm_ops,
         },
         .probe        = soc_probe,
         .remove        = soc_remove,
     };

However, I fail to understand, how the platform_driver in the twl6040.c 
file gets bound and who calls its probe.
sound/soc/codecs/twl6040.c
=================
     static struct platform_driver twl6040_codec_driver = {
         .driver = {
             .name = "twl6040-codec",
             .owner = THIS_MODULE,
         },
         .probe = twl6040_codec_probe,
         .remove = __devexit_p(twl6040_codec_remove),
     };

I have used the same model for my codec device driver and the probe 
function in the codec driver under platform_driver never gets invoked.

Can anyone give me a clarification on this?

Regards,
Preetam



More information about the Alsa-devel mailing list