summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Alonso <adrian.alonso@nxp.com>2020-06-03 13:03:34 -0500
committerAdrian Alonso <adrian.alonso@nxp.com>2020-06-05 10:22:19 -0500
commit4169c352d3ec9c5b82376f6928203b043db512ed (patch)
treea6d79dc450fd1d676e4294842eeb9f3e3949a8a6
parent8504adc81ae7947f1e9142e9ccd79947820f5d6d (diff)
MLK-24230: sound: soc fsl: imx pdm add dsd format constraints
Add DSD_U8, DSD_U16_LE and DSD_U32_LE format constrains in order to use SAI DSD settings for handling multi channel capture streams. One channel per dataline. Signed-off-by: Adrian Alonso <adrian.alonso@nxp.com> Reviewed-by: Viorel Suman <viorel.suman@nxp.com>
-rw-r--r--sound/soc/fsl/imx-pdm.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/soc/fsl/imx-pdm.c b/sound/soc/fsl/imx-pdm.c
index 3cca30131981..3fdbc00a7279 100644
--- a/sound/soc/fsl/imx-pdm.c
+++ b/sound/soc/fsl/imx-pdm.c
@@ -17,6 +17,10 @@
#include "fsl_sai.h"
+#define IMX_PDM_FORMATS (SNDRV_PCM_FMTBIT_DSD_U8 | \
+ SNDRV_PCM_FMTBIT_DSD_U16_LE | \
+ SNDRV_PCM_FMTBIT_DSD_U32_LE)
+
struct imx_pdm_data {
struct snd_soc_dai_link dai;
struct snd_soc_card card;
@@ -57,7 +61,15 @@ static int imx_pdm_mic_startup(struct snd_pcm_substream *substream)
SNDRV_PCM_HW_PARAM_CHANNELS, &imx_pdm_mic_channels_constrains);
if (ret) {
dev_err(card->dev,
- "fail to set pcm hw channels constrains: %d", ret);
+ "fail to set pcm hw channels constrains: %d\n", ret);
+ return ret;
+ }
+
+ ret = snd_pcm_hw_constraint_mask64(runtime,
+ SNDRV_PCM_HW_PARAM_FORMAT, IMX_PDM_FORMATS);
+ if (ret) {
+ dev_err(card->dev,
+ "fail to set pcm hw format constrains: %d\n", ret);
return ret;
}