ASoC: Is this bug ? DAPM source vs sink
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
#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) + snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_OUT, 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) + snd_soc_dapm_widget_for_each_path(w, SND_SOC_DAPM_DIR_IN, p)
I'm happy to create patch if I could get your ack.
Thank you for your help !!
Best regards --- Kuninori Morimoto
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]`
On Tue, Jul 19, 2022 at 10:50:57AM +0200, Lars-Peter Clausen wrote:
On 7/19/22 08:19, Kuninori Morimoto wrote:
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]`
I think this is just one of those perspective things, OUT -> audio comes out of the node ie. is a source. IN -> audio goes into the node, ie. is a sink.
Thanks, Charles
Hi Lars-Peter, Charles
Thank you for your feedback
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]`
I think this is just one of those perspective things, OUT -> audio comes out of the node ie. is a source. IN -> audio goes into the node, ie. is a sink.
Thank you for your explanation, and sorry for my noise.
Thank you for your help !!
Best regards --- Kuninori Morimoto
participants (3)
-
Charles Keepax
-
Kuninori Morimoto
-
Lars-Peter Clausen