drivers: mtk: get memif format from config of DAI component

MTK memif(DMA) can support different format from BE dai, so we don't
need to rely on the transformation of SOF DAI. After the patch, the
format of memif follows DAI component, so the format can be kept the
same in the pipeline and do format transformation via AFE if
necessary.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
This commit is contained in:
Trevor Wu 2023-05-19 11:43:40 +08:00 committed by Kai Vehmanen
parent 734dbd38f0
commit 70c257f9ae
1 changed files with 14 additions and 0 deletions

View File

@ -294,6 +294,20 @@ static int memif_set_config(struct dma_chan_data *channel, struct dma_sg_config
ret = afe_dai_get_config(memif->afe, dai_id, &memif->channel, &memif->rate, &memif->format);
if (ret < 0)
return ret;
/* memif format should follow DAI component, not dai hw configuration */
switch (config->src_width) {
case 2:
memif->format = SOF_IPC_FRAME_S16_LE;
break;
case 4:
memif->format = SOF_IPC_FRAME_S32_LE;
break;
default:
tr_err(&memif_tr, "afe-memif: not support bitwidth %u!", config->src_width);
return -ENOTSUP;
}
/* set the afe memif parameters */
ret = afe_memif_set_params(memif->afe, memif->memif_id, memif->channel, memif->rate,
memif->format);