Hi Morimoto-san,
soc_pcm_open() operation order is not good. At first, soc_pcm_open() operation order is
- CPU DAI startup
- Component open
- Codec DAI startup
- rtd startup
But here, 2) will call try_module_get() if component has module_get_upon_open flags. This means 1) CPU DAI startup will be operated *before* its module was loaded. DAI should be called *after* Component.
Second, soc_pcm_close() operation order is
- CPU DAI shutdown
- Codec DAI shutdown
- rtd shutdown
- Component close
soc_pcm_open() and soc_pcm_close() are paired function, but, its operation order is unbalance. This patch tidyup soc_pcm_open() order to Component -> rtd -> DAI.
Maybe a red-herring but while reviewing the other soc-pcm changes I started wondering if this order change is actually valid for all platforms.
If you look at the soc-pcm code, all the way to 2011
ddee627cf6bb60 ('ASoC: core - Separate out PCM operations into new file')
you'll see that the intent was to - start the cpu_dai - open the platform driver to e.g handle DMAs - start the codec_dai.
The second step is not really needed for Intel but might be needed on others where the DMA is centrally handled (Omap, etc).
My concern is that we've modified the order to deal with module dependencies, without necessarily taking into account that DMA setup part
That said I don't understand the initial sequence for soc_pcm_close() so I am not advocating for a revert, but more a clarification of what those component open/close steps are supposed to do.
Thanks -Pierre