audio: add 16K mic aux and 32bit feature
authorbin pang <bin.pang@amlogic.com>
Mon, 14 May 2018 09:37:57 +0000 (17:37 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Tue, 15 May 2018 07:58:54 +0000 (00:58 -0700)
PD#164543: audio: 16K mic aux and 32bit support[2/2]

Change-Id: I7e19374cae45821c6189c60eff4b1e2d872ba4c6
Signed-off-by: bin pang <bin.pang@amlogic.com>
sound/soc/amlogic/meson/i2s2_dai.c
sound/soc/amlogic/meson/spdif_dai.c

index ee6a913..59f6afd 100644 (file)
@@ -47,6 +47,7 @@
 #include "i2s.h"
 #include "audio_hw.h"
 
+#if 0
 static int aml_i2s2in_clk_support(struct aml_i2s2 *i2s2)
 {
        int ret = 0;
@@ -60,6 +61,7 @@ static int aml_i2s2in_clk_support(struct aml_i2s2 *i2s2)
 
        return ret;
 }
+#endif
 
 static int aml_i2s2in_set_clks(struct aml_i2s2 *i2s2, unsigned int rate)
 {
@@ -161,7 +163,7 @@ static int aml_dai_i2s2_prepare(struct snd_pcm_substream *substream,
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct aml_runtime_data *prtd = runtime->private_data;
        struct audio_stream *s = &prtd->s;
-       struct aml_i2s2 *i2s2 = snd_soc_dai_get_drvdata(dai);
+       // struct aml_i2s2 *i2s2 = snd_soc_dai_get_drvdata(dai);
 
        if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
                /* dev_info(substream->pcm->card->dev,
@@ -189,7 +191,7 @@ static int aml_dai_i2s2_prepare(struct snd_pcm_substream *substream,
                }
 
                /* i2s in module clk */
-               if (aml_i2s2in_clk_support(i2s2))
+               if (0/* aml_i2s2in_clk_support(i2s2) */)
                        audio_in_clk_sel();
        } else {
                dev_info(substream->pcm->card->dev,
index 074ac14..4a2eec6 100644 (file)
@@ -508,9 +508,17 @@ static int aml_dai_spdif_prepare(struct snd_pcm_substream *substream,
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
                aml_hw_iec958_init(substream, 0);
        } else {
-               audio_in_spdif_set_buf(runtime->dma_addr,
+               if (runtime->format == SNDRV_PCM_FORMAT_S16_LE) {
+                       audio_in_spdif_set_buf(runtime->dma_addr,
                                       runtime->dma_bytes * 2, spdif_p->src);
-               memset((void *)runtime->dma_area, 0, runtime->dma_bytes * 2);
+                       memset((void *)runtime->dma_area,
+                               0, runtime->dma_bytes * 2);
+               } else {
+                       audio_in_spdif_set_buf(runtime->dma_addr,
+                                      runtime->dma_bytes, spdif_p->src);
+                       memset((void *)runtime->dma_area,
+                               0, runtime->dma_bytes);
+               }
        }
 
        return 0;
@@ -623,7 +631,8 @@ static struct snd_soc_dai_driver aml_spdif_dai[] = {
                        SNDRV_PCM_RATE_44100 |
                        SNDRV_PCM_RATE_48000 |
                        SNDRV_PCM_RATE_96000),
-                       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+                       .formats = SNDRV_PCM_FMTBIT_S16_LE |
+                               SNDRV_PCM_FMTBIT_S32_LE,
                },
                .ops = &spdif_dai_ops,
                .suspend = aml_dai_spdif_suspend,