diff options
author | Shengjiu Wang <shengjiu.wang@nxp.com> | 2018-09-14 13:15:27 +0800 |
---|---|---|
committer | Dong Aisheng <aisheng.dong@nxp.com> | 2019-11-25 15:53:09 +0800 |
commit | ace16c55c8bfeb4ca6f1f1164e48ae3b4d82ea46 (patch) | |
tree | 022842d80779f3be7dd8205d50e78b6b3de1f903 | |
parent | 1744cad4ec1d9ca6a0da2fcfa8dbb23d3f43c430 (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)
-rw-r--r-- | sound/soc/fsl/fsl_rpmsg_i2s.c | 44 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_rpmsg_i2s.h | 6 |
2 files changed, 42 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; diff --git a/sound/soc/fsl/fsl_rpmsg_i2s.h b/sound/soc/fsl/fsl_rpmsg_i2s.h index e52c861c4d43..36d6c5f51360 100644 --- a/sound/soc/fsl/fsl_rpmsg_i2s.h +++ b/sound/soc/fsl/fsl_rpmsg_i2s.h @@ -330,6 +330,9 @@ #define RPMSG_S16_LE 0x0 #define RPMSG_S24_LE 0x1 #define RPMSG_S32_LE 0x2 +#define RPMSG_DSD_U16_LE 0x3 +#define RPMSG_DSD_U24_LE 0x4 +#define RPMSG_DSD_U32_LE 0x5 #define RPMSG_CH_LEFT 0x0 #define RPMSG_CH_RIGHT 0x1 @@ -410,8 +413,10 @@ struct fsl_rpmsg_i2s { struct platform_device *pdev; struct i2s_info i2s_info; struct pm_qos_request pm_qos_req; + int codec_dummy; int codec_wm8960; int codec_cs42888; + int codec_ak4497; int force_lpa; int version; int rates; @@ -421,6 +426,7 @@ struct fsl_rpmsg_i2s { #define RPMSG_CODEC_DRV_NAME_WM8960 "rpmsg-audio-codec-wm8960" #define RPMSG_CODEC_DRV_NAME_CS42888 "rpmsg-audio-codec-cs42888" +#define RPMSG_CODEC_DRV_NAME_AK4497 "rpmsg-audio-codec-ak4497" struct fsl_rpmsg_codec { int audioindex; |