File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4545 SND_SOC_DAIFMT_IB_IF)
4646#define MACAUDIO_JACK_MASK (SND_JACK_HEADSET | SND_JACK_HEADPHONE)
4747#define MACAUDIO_SLOTWIDTH 32
48+ /*
49+ * Maximum BCLK frequency
50+ *
51+ * Codec maximums:
52+ * CS42L42 26.0 MHz
53+ * TAS2770 27.1 MHz
54+ * TAS2764 24.576 MHz
55+ */
56+ #define MACAUDIO_MAX_BCLK_FREQ 24576000
4857
4958struct macaudio_snd_data {
5059 struct snd_soc_card card ;
@@ -500,19 +509,23 @@ static int macaudio_fe_startup(struct snd_pcm_substream *substream)
500509 struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
501510 struct macaudio_snd_data * ma = snd_soc_card_get_drvdata (rtd -> card );
502511 struct macaudio_link_props * props = & ma -> link_props [rtd -> dai_link -> id ];
503- int ret ;
512+ int max_rate , ret ;
504513
505514 if (props -> is_sense )
506515 return 0 ;
507516
508- /* The FEs must never have more channels than the hardware */
509517 ret = snd_pcm_hw_constraint_minmax (substream -> runtime ,
510- SNDRV_PCM_HW_PARAM_CHANNELS , 0 , ma -> max_channels );
518+ SNDRV_PCM_HW_PARAM_CHANNELS ,
519+ 0 , ma -> max_channels );
520+ if (ret < 0 )
521+ return ret ;
511522
512- if (ret < 0 ) {
513- dev_err (rtd -> dev , "Failed to constrain FE %d! %d" , rtd -> dai_link -> id , ret );
523+ max_rate = MACAUDIO_MAX_BCLK_FREQ / props -> bclk_ratio ;
524+ ret = snd_pcm_hw_constraint_minmax (substream -> runtime ,
525+ SNDRV_PCM_HW_PARAM_RATE ,
526+ 0 , max_rate );
527+ if (ret < 0 )
514528 return ret ;
515- }
516529
517530 return 0 ;
518531}
You can’t perform that action at this time.
0 commit comments