MLK-18076-2: ASoC: fsl_asrc: support S8 format for p2p
authorShengjiu Wang <shengjiu.wang@nxp.com>
Fri, 14 Dec 2018 03:12:19 +0000 (11:12 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Thu, 2 May 2019 08:35:28 +0000 (11:35 +0300)
support S8 format for p2p

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
Signed-off-by: Shrikant Bobade <Shrikant_Bobade@mentor.com>
(cherry picked from commit 52ec854864d4841d8f6798cfdf9cce8cf7ad4758)

sound/soc/fsl/fsl_asrc.c

index 25667cd..7b8240c 100644 (file)
@@ -629,7 +629,9 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
        pair->pair_streams |= BIT(substream->stream);
        pair->config = &config;
 
-       if (width == 16)
+       if (width == 8)
+               width = ASRC_WIDTH_8_BIT;
+       else if (width == 16)
                width = ASRC_WIDTH_16_BIT;
        else
                width = ASRC_WIDTH_24_BIT;
@@ -764,9 +766,13 @@ static int fsl_asrc_dai_probe(struct snd_soc_dai *dai)
 }
 
 #define FSL_ASRC_RATES          SNDRV_PCM_RATE_8000_192000
-#define FSL_ASRC_FORMATS       (SNDRV_PCM_FMTBIT_S24_LE | \
+#define FSL_ASRC_FORMATS_RX    (SNDRV_PCM_FMTBIT_S24_LE | \
                                 SNDRV_PCM_FMTBIT_S16_LE | \
                                 SNDRV_PCM_FMTBIT_S24_3LE)
+#define FSL_ASRC_FORMATS_TX    (SNDRV_PCM_FMTBIT_S24_LE | \
+                                SNDRV_PCM_FMTBIT_S16_LE | \
+                                SNDRV_PCM_FMTBIT_S8 | \
+                                SNDRV_PCM_FMTBIT_S24_3LE)
 
 static struct snd_soc_dai_driver fsl_asrc_dai = {
        .probe = fsl_asrc_dai_probe,
@@ -777,7 +783,7 @@ static struct snd_soc_dai_driver fsl_asrc_dai = {
                .rate_min = 5512,
                .rate_max = 192000,
                .rates = SNDRV_PCM_RATE_KNOT,
-               .formats = FSL_ASRC_FORMATS,
+               .formats = FSL_ASRC_FORMATS_TX,
        },
        .capture = {
                .stream_name = "ASRC-Capture",
@@ -786,7 +792,7 @@ static struct snd_soc_dai_driver fsl_asrc_dai = {
                .rate_min = 5512,
                .rate_max = 192000,
                .rates = SNDRV_PCM_RATE_KNOT,
-               .formats = FSL_ASRC_FORMATS,
+               .formats = FSL_ASRC_FORMATS_RX,
        },
        .ops = &fsl_asrc_dai_ops,
 };