File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
458481static 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
474497static 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
479502static const struct snd_soc_ops macaudio_be_ops = {
You can’t perform that action at this time.
0 commit comments