Commit 0e209294 authored by Maso Huang's avatar Maso Huang Committed by Mark Brown

ASoC: mediatek: mt7986: add sample rate checker

mt7986 only supports 8/12/16/24/32/48/96/192 kHz
Signed-off-by: default avatarMaso Huang <maso.huang@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20231024035019.11732-4-maso.huang@mediatek.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0f10adb0
...@@ -237,12 +237,27 @@ static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream, ...@@ -237,12 +237,27 @@ static int mtk_dai_etdm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
unsigned int rate = params_rate(params);
struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai); struct mtk_base_afe *afe = snd_soc_dai_get_drvdata(dai);
mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK); switch (rate) {
mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE); case 8000:
case 12000:
return 0; case 16000:
case 24000:
case 32000:
case 48000:
case 96000:
case 192000:
mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_PLAYBACK);
mtk_dai_etdm_config(afe, params, dai, SNDRV_PCM_STREAM_CAPTURE);
return 0;
default:
dev_err(afe->dev,
"Sample rate %d invalid. Supported rates: 8/12/16/24/32/48/96/192 kHz\n",
rate);
return -EINVAL;
}
} }
static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd, static int mtk_dai_etdm_trigger(struct snd_pcm_substream *substream, int cmd,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment