diff --git a/sound/soc/amlogic/auge/tdm.c b/sound/soc/amlogic/auge/tdm.c index 826165d38..5df9107b9 100644 --- a/sound/soc/amlogic/auge/tdm.c +++ b/sound/soc/amlogic/auge/tdm.c @@ -1789,7 +1789,8 @@ static int aml_dai_tdm_prepare(struct snd_pcm_substream *substream, bit_depth, substream->stream, p_tdm->id, - fifo_id); + fifo_id, + p_tdm->chipinfo->gain_ver); switch (p_tdm->id) { case 0: diff --git a/sound/soc/amlogic/auge/tdm_hw.c b/sound/soc/amlogic/auge/tdm_hw.c index d75e5f302..064b288e5 100644 --- a/sound/soc/amlogic/auge/tdm_hw.c +++ b/sound/soc/amlogic/auge/tdm_hw.c @@ -221,10 +221,11 @@ int tdmout_get_frddr_type(int bitwidth) void aml_tdm_fifo_ctrl(struct aml_audio_controller *actrl, int bitwidth, int stream, - int index, unsigned int fifo_id) + int index, unsigned int fifo_id, int gain_ver) { unsigned int frddr_type = tdmout_get_frddr_type(bitwidth); unsigned int reg, offset; + int frddr_sel_mask = 0x7; if (stream == SNDRV_PCM_STREAM_PLAYBACK) { pr_debug("tdm prepare----playback\n"); @@ -238,8 +239,15 @@ void aml_tdm_fifo_ctrl(struct aml_audio_controller *actrl, } else { reg = EE_AUDIO_TDMOUT_A_CTRL1; } + /* from sm1, the frddr select mask is bit 24-26, + * before sm1, the frddr select mask is bit 24-25, + * the bit 26 is for gain control. + */ + if (gain_ver == GAIN_VER1) + frddr_sel_mask = 0x3; + aml_audiobus_update_bits(actrl, reg, - 0x3 << 24 | 0x1f << 8 | 0x7 << 4, + frddr_sel_mask << 24 | 0x1f << 8 | 0x7 << 4, fifo_id << 24 | (bitwidth - 1) << 8 | frddr_type << 4); } else { pr_debug("tdm prepare----capture\n"); diff --git a/sound/soc/amlogic/auge/tdm_hw.h b/sound/soc/amlogic/auge/tdm_hw.h index d093325cc..1ccd4da79 100644 --- a/sound/soc/amlogic/auge/tdm_hw.h +++ b/sound/soc/amlogic/auge/tdm_hw.h @@ -74,7 +74,7 @@ int tdmout_get_frddr_type(int bitwidth); void aml_tdm_fifo_ctrl(struct aml_audio_controller *actrl, int bitwidth, int stream, - int index, unsigned int fifo_id); + int index, unsigned int fifo_id, int gain_ver); void aml_tdm_set_format(struct aml_audio_controller *actrl, struct pcm_setting *p_config,