diff options
author | Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com> | 2018-01-30 11:42:02 +0200 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:50:31 +0800 |
commit | 9e64d031865ae791cc11de4427d623841735307c (patch) | |
tree | 6c11da0f6aaa46bfe448c8d20d378a50db5a6477 /sound/soc/fsl/imx-ak4458.c | |
parent | 681e50e56cea183233a7ef3626403dd9777fb6bf (diff) |
MLK-15033: ASoC: fsl: Change constraints for AK4458
Add 384KHz and 768KHz as supported rates and add
different constraints for number of channels when
in tdm mode.
Signed-off-by: Cosmin-Gabriel Samoila <cosmin.samoila@nxp.com>
Reviewed-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound/soc/fsl/imx-ak4458.c')
-rw-r--r-- | sound/soc/fsl/imx-ak4458.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/soc/fsl/imx-ak4458.c b/sound/soc/fsl/imx-ak4458.c index e52b84c6417e..30b649c36461 100644 --- a/sound/soc/fsl/imx-ak4458.c +++ b/sound/soc/fsl/imx-ak4458.c @@ -35,12 +35,17 @@ static struct snd_soc_dapm_widget imx_ak4458_dapm_widgets[] = { static const u32 ak4458_rates[] = { 8000, 16000, 32000, 48000, 96000, 192000, + 384000, 768000, }; static const u32 ak4458_channels[] = { 1, 2, 4, 6, 8, 10, 12, 14, 16, }; +static const u32 ak4458_channels_tdm[] = { + 1, 2, 3, 4, 5, 6, 7, 8, +}; + static int imx_aif_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -110,6 +115,9 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream, static int imx_aif_startup(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct imx_ak4458_data *data = snd_soc_card_get_drvdata(card); static struct snd_pcm_hw_constraint_list constraint_rates; static struct snd_pcm_hw_constraint_list constraint_channels; int ret; @@ -122,8 +130,14 @@ static int imx_aif_startup(struct snd_pcm_substream *substream) if (ret) return ret; - constraint_channels.list = ak4458_channels; - constraint_channels.count = ARRAY_SIZE(ak4458_channels); + + if (data->tdm_mode) { + constraint_channels.list = ak4458_channels_tdm; + constraint_channels.count = ARRAY_SIZE(ak4458_channels_tdm); + } else { + constraint_channels.list = ak4458_channels; + constraint_channels.count = ARRAY_SIZE(ak4458_channels); + } ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &constraint_channels); |