When using table based DAPM setup there is no need to register DAPM elements for
different sub-components separately. The widgets will be registered before the
first sub-component is initialized, the routes are only added after the last
sub-component has been initialized, meaning everything will be available when it
is needed.
The reason why we add the DMIC routes in the way we do is that not all boards
have DMIC in use. PandaBoards does not have DMIC while SDP/Blaze have. On
PandaBoard we do not register the dmic dai link so the widgets are not going
to be added and also the dmic DAI and codec will be not loaded on PandaBoards.
I think this will cause some warning because of missing "DMic" widget?
--
Péter
> Signed-off-by: Lars-Peter Clausen
lars@metafoo.de
> ---
> sound/soc/omap/omap-abe-twl6040.c | 19 ++++---------------
> 1 file changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
> index ebb1390..5011bfa 100644
> --- a/sound/soc/omap/omap-abe-twl6040.c
> +++ b/sound/soc/omap/omap-abe-twl6040.c
> @@ -163,6 +163,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
>
> {"AFML", NULL, "Line In"},
> {"AFMR", NULL, "Line In"},
> +
> + /* DMIC routing */
> + {"DMic", NULL, "Digital Mic"},
> + {"Digital Mic", NULL, "Digital Mic1 Bias"},
> };
>
> static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
> @@ -196,20 +200,6 @@ static int omap_abe_twl6040_init(struct snd_soc_pcm_runtime *rtd)
> return ret;
> }
>
> -static const struct snd_soc_dapm_route dmic_audio_map[] = {
> - {"DMic", NULL, "Digital Mic"},
> - {"Digital Mic", NULL, "Digital Mic1 Bias"},
> -};
> -
> -static int omap_abe_dmic_init(struct snd_soc_pcm_runtime *rtd)
> -{
> - struct snd_soc_codec *codec = rtd->codec;
> - struct snd_soc_dapm_context *dapm = &codec->dapm;
> -
> - return snd_soc_dapm_add_routes(dapm, dmic_audio_map,
> - ARRAY_SIZE(dmic_audio_map));
> -}
> -
> /* Digital audio interface glue - connects codec <--> CPU */
> static struct snd_soc_dai_link abe_twl6040_dai_links[] = {
> {
> @@ -229,7 +219,6 @@ static struct snd_soc_dai_link abe_twl6040_dai_links[] = {
> .codec_dai_name = "dmic-hifi",
> .platform_name = "omap-pcm-audio",
> .codec_name = "dmic-codec",
> - .init = omap_abe_dmic_init,
> .ops = &omap_abe_dmic_ops,
> },
> };
>