On Fri, Mar 15, 2013 at 03:38:21PM +0000, Charles Keepax wrote:
Currently DAI playback and capture widgets are created during soc_probe_codec and soc_probe_platform using the device associated
Don't bury patches in the middle of threads, especially if it's several months after the fact - it just makes it more likely that the patch will be missed or ignored.
Anyway now I remember the full context...
with the platform/codec to locate the DAI upon which the widgets should be created. If a device registers both a CODEC and platform driver this leads the widgets created during CODEC probe being overwritten by the widgets created during the platform probe.
In general we want to retain the existing playback and capture widgets because routes may have already been added to them. This patch will check for existing widgets during snd_soc_dapm_new_dai_widgets and only create new widgets if none exist.
This still seems like it's bodging things in the wrong place. The issue is that we're trying to instantiate the DAI multiple times because we've not got a firm idea of the chip as a whole. Adding checks like this to the code is just going to make everything more and more complicated to understand over time without addressing the source of complexity.
This is especially true now that Morimoto-san has added component objects which exist to provide that sort of grouping, we should be addressing things like this by pulling them up to the component level so that we know we're only doing them once per chip. I think the first step here is to add the ability to create DAIs based on components, then to let components sit where CODECs sit in terms of setting up DAIs so we can start moving CODEC drivers over into components.