ASoC: Is this bug ? DAPM source vs sink
Lars-Peter Clausen
lars at metafoo.de
Tue Jul 19 10:50:57 CEST 2022
On 7/19/22 08:19, Kuninori Morimoto wrote:
> Hi ASoC
> Cc Lars-Peter
>
> I have noticed that DAPM source vs sink are strange.
>
> ASoC had used source/sink or input/output before,
> but it was exchanged by this patch
>
> a3423b02cf745c1418f1f199646c450d6fc9ca4e
> ("ASoC: dapm: Consolidate input and output path handling")
>
> I think source/sink pair are converted to SND_SOC_DAPM_DIR_IN/OUT
> by this patch.
>
> source <=> IN
> sink <=> OUT
>
> But, its for_each are inverted
>
> #define snd_soc_dapm_widget_for_each_sink_path(w, p) \
> snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p)
>
> #define snd_soc_dapm_widget_for_each_source_path(w, p) \
> snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, p)
>
> I have thought this for_each is for special handling,
> but, the original was sink is for sink, source is for source after all.
>
> #define snd_soc_dapm_widget_for_each_sink_path(w, p) \
> list_for_each_entry(p, &w->sinks, list_source)
>
> #define snd_soc_dapm_widget_for_each_source_path(w, p) \
> list_for_each_entry(p, &w->sources, list_sink)
>
>
> So, I guess current for_each is wrong, but I'm not 100% sure
>
>
I don't think DAPM would work if this was wrong. If you look at that
patch it consistently converted
`sources` to `edges[SND_SOC_DAPM_DIR_OUT]` and `sinks` to
`edges[SND_SOC_DAPM_DIR_IN]`
More information about the Alsa-devel
mailing list