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
Quoted 28 lines · Kuninori Morimoto
Hi ASoC
Cc Lars-PeterI have noticed that DAPM source vs sink are strange.
ASoC had used source/sink or input/output before,
but it was exchanged by this patcha3423b02cf745c1418f1f199646c450d6fc9ca4e ("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 <=> OUTBut, its
for_eachare 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_eachis for special handling,
but, the original was sink is for sink, source is for source after all.
Quoted 10 lines
#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_eachis 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]
Quoted 9 lines · Lars-Peter Clausen
Quoted 3 lines · Kuninori Morimoto
So, I guess current
for_eachis wrong, but I'm not 100% sureI don't think DAPM would work if this was wrong. If you look at that patch it consistently converted
sourcestoedges[SND_SOC_DAPM_DIR_OUT]andsinkstoedges[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
Quoted 9 lines
Quoted 5 lines
I don't think DAPM would work if this was wrong. If you look at that patch it consistently converted
sourcestoedges[SND_SOC_DAPM_DIR_OUT]andsinkstoedges[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