Skip to content

Commit b165457

Browse files
committed
Merge series "ASoC: dapm/pins: handle component prefix" from Pierre-Louis Bossart <[email protected]>:
SoundWire machine drivers make a heavy use of component prefixes to uniquify control names. This however results in errors when looking for widgets or pins. This patchset suggests two solutions but feedback or suggestions on how to take the prefix into account would be welcome. Bard Liao (1): ASoC: Intel: boards: max98373: get dapm from cpu_dai Shuming Fan (1): ASoC: dapm: use component prefix when checking widget names sound/soc/intel/boards/sof_maxim_common.c | 5 +++-- sound/soc/soc-dapm.c | 13 ++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) -- 2.25.1
2 parents 4fc320d + 1183c35 commit b165457

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

sound/soc/intel/boards/sof_maxim_common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,18 @@ int max98373_trigger(struct snd_pcm_substream *substream, int cmd)
6363
{
6464
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
6565
struct snd_soc_dai *codec_dai;
66+
struct snd_soc_dai *cpu_dai;
6667
int j;
6768
int ret = 0;
6869

6970
/* set spk pin by playback only */
7071
if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
7172
return 0;
7273

74+
cpu_dai = asoc_rtd_to_cpu(rtd, 0);
7375
for_each_rtd_codec_dais(rtd, j, codec_dai) {
74-
struct snd_soc_component *component = codec_dai->component;
7576
struct snd_soc_dapm_context *dapm =
76-
snd_soc_component_get_dapm(component);
77+
snd_soc_component_get_dapm(cpu_dai->component);
7778
char pin_name[MAX_98373_PIN_NAME];
7879

7980
snprintf(pin_name, ARRAY_SIZE(pin_name), "%s Spk",

sound/soc/soc-dapm.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2528,9 +2528,20 @@ static struct snd_soc_dapm_widget *dapm_find_widget(
25282528
{
25292529
struct snd_soc_dapm_widget *w;
25302530
struct snd_soc_dapm_widget *fallback = NULL;
2531+
char prefixed_pin[80];
2532+
const char *pin_name;
2533+
const char *prefix = soc_dapm_prefix(dapm);
2534+
2535+
if (prefix) {
2536+
snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s",
2537+
prefix, pin);
2538+
pin_name = prefixed_pin;
2539+
} else {
2540+
pin_name = pin;
2541+
}
25312542

25322543
for_each_card_widgets(dapm->card, w) {
2533-
if (!strcmp(w->name, pin)) {
2544+
if (!strcmp(w->name, pin_name)) {
25342545
if (w->dapm == dapm)
25352546
return w;
25362547
else

0 commit comments

Comments
 (0)