summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl_rpmsg_i2s.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2018-09-14 13:15:27 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:53:09 +0800
commitace16c55c8bfeb4ca6f1f1164e48ae3b4d82ea46 (patch)
tree022842d80779f3be7dd8205d50e78b6b3de1f903 /sound/soc/fsl/fsl_rpmsg_i2s.c
parent1744cad4ec1d9ca6a0da2fcfa8dbb23d3f43c430 (diff)
MLK-19581-3: ASoC: fsl_rpmsg_i2s: support multipul rate and DSD format
The Ak4497 support large range rate and DSD format, so increase the supported scope of cpu dai. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com> (cherry picked from commit 29155a9161bfb9985918ed9130aebafc2293c734)
Diffstat (limited to 'sound/soc/fsl/fsl_rpmsg_i2s.c')
-rw-r--r--sound/soc/fsl/fsl_rpmsg_i2s.c44
1 files changed, 36 insertions, 8 deletions
diff --git a/sound/soc/fsl/fsl_rpmsg_i2s.c b/sound/soc/fsl/fsl_rpmsg_i2s.c
index 2d45f513ee3f..901e35c52b17 100644
--- a/sound/soc/fsl/fsl_rpmsg_i2s.c
+++ b/sound/soc/fsl/fsl_rpmsg_i2s.c
@@ -80,24 +80,50 @@ static int i2s_send_message(struct i2s_rpmsg *msg,
return 0;
}
+static const unsigned int fsl_rpmsg_rates[] = {
+ 32000, 48000, 96000, 88200, 176400, 192000,
+ 352800, 384000, 705600, 768000, 1411200, 2822400,
+};
+
+static const struct snd_pcm_hw_constraint_list fsl_rpmsg_rate_constraints = {
+ .count = ARRAY_SIZE(fsl_rpmsg_rates),
+ .list = fsl_rpmsg_rates,
+};
+
+static int fsl_rpmsg_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *cpu_dai)
+{
+ int ret;
+
+ ret = snd_pcm_hw_constraint_list(substream->runtime, 0,
+ SNDRV_PCM_HW_PARAM_RATE, &fsl_rpmsg_rate_constraints);
+
+ return ret;
+}
+
+static const struct snd_soc_dai_ops fsl_rpmsg_dai_ops = {
+ .startup = fsl_rpmsg_startup,
+};
+
static struct snd_soc_dai_driver fsl_rpmsg_i2s_dai = {
.playback = {
.stream_name = "CPU-Playback",
.channels_min = 2,
.channels_max = 2,
- .rates = FSL_RPMSG_I2S_RATES,
+ .rates = SNDRV_PCM_RATE_KNOT,
.formats = FSL_RPMSG_I2S_FORMATS,
},
.capture = {
.stream_name = "CPU-Capture",
.channels_min = 2,
.channels_max = 2,
- .rates = FSL_RPMSG_I2S_RATES,
+ .rates = SNDRV_PCM_RATE_KNOT,
.formats = FSL_RPMSG_I2S_FORMATS,
},
.symmetric_rates = 1,
.symmetric_channels = 1,
.symmetric_samplebits = 1,
+ .ops = &fsl_rpmsg_dai_ops,
};
static const struct snd_soc_component_driver fsl_component = {
@@ -200,15 +226,17 @@ static int fsl_rpmsg_i2s_probe(struct platform_device *pdev)
if (of_device_is_compatible(pdev->dev.of_node,
"fsl,imx8mq-rpmsg-i2s")) {
- rpmsg_i2s->codec_wm8960 = 0;
+ rpmsg_i2s->codec_dummy = 0;
+ rpmsg_i2s->codec_ak4497 = 1;
rpmsg_i2s->version = 2;
- rpmsg_i2s->rates = SNDRV_PCM_RATE_32000 |
- SNDRV_PCM_RATE_48000 |
- SNDRV_PCM_RATE_96000 |
- SNDRV_PCM_RATE_192000;
+ rpmsg_i2s->rates = SNDRV_PCM_RATE_KNOT;
rpmsg_i2s->formats = SNDRV_PCM_FMTBIT_S16_LE |
SNDRV_PCM_FMTBIT_S24_LE |
- SNDRV_PCM_FMTBIT_S32_LE;
+ SNDRV_PCM_FMTBIT_S32_LE |
+ SNDRV_PCM_FMTBIT_DSD_U8 |
+ SNDRV_PCM_FMTBIT_DSD_U16_LE |
+ SNDRV_PCM_FMTBIT_DSD_U32_LE;
+
fsl_rpmsg_i2s_dai.playback.rates = rpmsg_i2s->rates;
fsl_rpmsg_i2s_dai.playback.formats = rpmsg_i2s->formats;
fsl_rpmsg_i2s_dai.capture.rates = rpmsg_i2s->rates;