Skip to content

Commit bebe1e7

Browse files
povikmarcan
authored andcommitted
ASoC: macaudio: Improve message on opening of unrouted PCM devices
Signed-off-by: Martin Povišer <[email protected]>
1 parent d3d8f0a commit bebe1e7

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

sound/soc/apple/macaudio.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,29 @@ static int macaudio_dpcm_hw_params(struct snd_pcm_substream *substream,
455455
return 0;
456456
}
457457

458+
static int macaudio_fe_hw_params(struct snd_pcm_substream *substream,
459+
struct snd_pcm_hw_params *params)
460+
{
461+
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
462+
struct snd_soc_pcm_runtime *be;
463+
struct snd_soc_dpcm *dpcm;
464+
465+
be = NULL;
466+
for_each_dpcm_be(rtd, substream->stream, dpcm) {
467+
be = dpcm->be;
468+
break;
469+
}
470+
471+
if (!be) {
472+
dev_err(rtd->dev, "opening PCM device '%s' with no audio route configured (bad settings applied to the sound card)\n",
473+
rtd->dai_link->name);
474+
return -EINVAL;
475+
}
476+
477+
return macaudio_dpcm_hw_params(substream, params);
478+
}
479+
480+
458481
static void macaudio_dpcm_shutdown(struct snd_pcm_substream *substream)
459482
{
460483
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
@@ -473,7 +496,7 @@ static void macaudio_dpcm_shutdown(struct snd_pcm_substream *substream)
473496

474497
static const struct snd_soc_ops macaudio_fe_ops = {
475498
.shutdown = macaudio_dpcm_shutdown,
476-
.hw_params = macaudio_dpcm_hw_params,
499+
.hw_params = macaudio_fe_hw_params,
477500
};
478501

479502
static const struct snd_soc_ops macaudio_be_ops = {

0 commit comments

Comments
 (0)