From: Shengjiu Wang <[email protected]>

The i.MX EASRC hardware supports four independent conversion contexts
(A, B, C, D). The driver previously registered a single DAI with generic
stream names "ASRC-Playback" and "ASRC-Capture", which prevents
individual contexts from being routed to separate audio paths
simultaneously.

Replace the single fsl_easrc_dai instance with an array of four DAI
drivers, one per context:

  ctxa -- ASRC-Playback / ASRC-Capture (backward compatible)
  ctxb -- ASRCB-Playback / ASRCB-Capture
  ctxc -- ASRCC-Playback / ASRCC-Capture
  ctxd -- ASRCD-Playback / ASRCD-Capture

Context A retains the original generic stream names to preserve backward
compatibility with existing machine drivers and board configurations.
Each DAI retains the same channel, rate and format capabilities as the
original, including IEC958 subframe support on the capture side. Update
the devm_snd_soc_register_component() call to register all four DAIs.

Signed-off-by: Shengjiu Wang <[email protected]>
---
 sound/soc/fsl/fsl_easrc.c | 112 +++++++++++++++++++++++++++++++-------
 1 file changed, 92 insertions(+), 20 deletions(-)

diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index edfd943197a0..3c5303d9b9cf 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -1600,27 +1600,99 @@ static const struct snd_soc_dai_ops fsl_easrc_dai_ops = 
{
        .hw_free        = fsl_easrc_hw_free,
 };
 
-static struct snd_soc_dai_driver fsl_easrc_dai = {
-       .playback = {
-               .stream_name = "ASRC-Playback",
-               .channels_min = 1,
-               .channels_max = 32,
-               .rate_min = 8000,
-               .rate_max = 768000,
-               .rates = SNDRV_PCM_RATE_KNOT,
-               .formats = FSL_EASRC_FORMATS,
+static struct snd_soc_dai_driver fsl_easrc_dai[] = {
+       {
+               .name = "ctxa",
+               .playback = {
+                       .stream_name = "ASRC-Playback",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS,
+               },
+               .capture = {
+                       .stream_name = "ASRC-Capture",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS |
+                                  SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+               },
+               .ops = &fsl_easrc_dai_ops,
        },
-       .capture = {
-               .stream_name = "ASRC-Capture",
-               .channels_min = 1,
-               .channels_max = 32,
-               .rate_min = 8000,
-               .rate_max = 768000,
-               .rates = SNDRV_PCM_RATE_KNOT,
-               .formats = FSL_EASRC_FORMATS |
-                          SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+       {
+               .name = "ctxb",
+               .playback = {
+                       .stream_name = "ASRCB-Playback",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS,
+               },
+               .capture = {
+                       .stream_name = "ASRCB-Capture",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS |
+                                  SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+               },
+               .ops = &fsl_easrc_dai_ops,
+       },
+       {
+               .name = "ctxc",
+               .playback = {
+                       .stream_name = "ASRCC-Playback",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS,
+               },
+               .capture = {
+                       .stream_name = "ASRCC-Capture",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS |
+                                  SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+               },
+               .ops = &fsl_easrc_dai_ops,
+       },
+       {
+               .name = "ctxd",
+               .playback = {
+                       .stream_name = "ASRCD-Playback",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS,
+               },
+               .capture = {
+                       .stream_name = "ASRCD-Capture",
+                       .channels_min = 1,
+                       .channels_max = 32,
+                       .rate_min = 8000,
+                       .rate_max = 768000,
+                       .rates = SNDRV_PCM_RATE_KNOT,
+                       .formats = FSL_EASRC_FORMATS |
+                                  SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE,
+               },
+               .ops = &fsl_easrc_dai_ops,
        },
-       .ops = &fsl_easrc_dai_ops,
 };
 
 static const struct snd_soc_component_driver fsl_easrc_component = {
@@ -2245,7 +2317,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
        regcache_cache_only(easrc->regmap, true);
 
        ret = devm_snd_soc_register_component(dev, &fsl_easrc_component,
-                                             &fsl_easrc_dai, 1);
+                                             fsl_easrc_dai, 
ARRAY_SIZE(fsl_easrc_dai));
        if (ret) {
                dev_err(dev, "failed to register ASoC DAI\n");
                goto err_pm_disable;
-- 
2.34.1


Reply via email to