@@ -464,6 +464,28 @@ static int mca_configure_serdes(struct mca_cluster *cl, int serdes_unit,
464464 return - EINVAL ;
465465}
466466
467+ static int mca_fe_startup (struct snd_pcm_substream * substream ,
468+ struct snd_soc_dai * dai )
469+ {
470+ struct mca_cluster * cl = mca_dai_to_cluster (dai );
471+ unsigned int mask , nchannels ;
472+
473+ if (cl -> tdm_slots ) {
474+ if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK )
475+ mask = cl -> tdm_tx_mask ;
476+ else
477+ mask = cl -> tdm_rx_mask ;
478+
479+ nchannels = hweight32 (mask );
480+ } else {
481+ nchannels = 2 ;
482+ }
483+
484+ return snd_pcm_hw_constraint_minmax (substream -> runtime ,
485+ SNDRV_PCM_HW_PARAM_CHANNELS ,
486+ 1 , nchannels );
487+ }
488+
467489static int mca_fe_set_tdm_slot (struct snd_soc_dai * dai , unsigned int tx_mask ,
468490 unsigned int rx_mask , int slots , int slot_width )
469491{
@@ -680,6 +702,7 @@ static int mca_fe_hw_params(struct snd_pcm_substream *substream,
680702}
681703
682704static const struct snd_soc_dai_ops mca_fe_ops = {
705+ .startup = mca_fe_startup ,
683706 .set_fmt = mca_fe_set_fmt ,
684707 .set_bclk_ratio = mca_set_bclk_ratio ,
685708 .set_tdm_slot = mca_fe_set_tdm_slot ,
0 commit comments