[alsa-devel] [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
When declaring playback and capture capabilities check for both CODEC side and CPU side support rather than only checking for CODEC side support. While it is unusual some CPUs do have unidirectional DAIs.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 73bb8ee..a9fddf0 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2011,9 +2011,11 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) if (cpu_dai->driver->capture.channels_min) capture = 1; } else { - if (codec_dai->driver->playback.channels_min) + if (codec_dai->driver->playback.channels_min && + cpu_dai->driver->playback.channels_min) playback = 1; - if (codec_dai->driver->capture.channels_min) + if (codec_dai->driver->capture.channels_min && + cpu_dai->driver->capture.channels_min) capture = 1; }
Hi Mark,
On Sat, Jun 1, 2013 at 7:16 PM, Mark Brown broonie@linaro.org wrote:
When declaring playback and capture capabilities check for both CODEC side and CPU side support rather than only checking for CODEC side support. While it is unusual some CPUs do have unidirectional DAIs.
Signed-off-by: Mark Brown broonie@kernel.org
Thanks for the patch, but I still got the same output:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: mxssgtl5000 [mxs_sgtl5000], device 0: HiFi Playback sgtl5000-0 [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: mxssgtl5000 [mxs_sgtl5000], device 1: HiFi Capture sgtl5000-1 [] Subdevices: 1/1 Subdevice #0: subdevice #0
I also tried:
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index 365d9d2..b4a527d 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c @@ -601,24 +601,21 @@ static const struct snd_soc_dai_ops mxs_saif_dai_ops = { .set_fmt = mxs_saif_set_dai_fmt, };
-static int mxs_saif_dai_probe(struct snd_soc_dai *dai) +static struct snd_soc_dai_driver mxs_saif_dai[] = { { - struct mxs_saif *saif = dev_get_drvdata(dai->dev); - - snd_soc_dai_set_drvdata(dai, saif); - - return 0; -} - -static struct snd_soc_dai_driver mxs_saif_dai = { - .name = "mxs-saif", - .probe = mxs_saif_dai_probe, + .name = "saif0", + .id = 0, .playback = { .channels_min = 2, .channels_max = 2, .rates = MXS_SAIF_RATES, .formats = MXS_SAIF_FORMATS, }, + .ops = &mxs_saif_dai_ops, +}, +{ + .name = "saif1", + .id = 1, .capture = { .channels_min = 2, .channels_max = 2, @@ -626,6 +623,7 @@ static struct snd_soc_dai_driver mxs_saif_dai = { .formats = MXS_SAIF_FORMATS, }, .ops = &mxs_saif_dai_ops, +}, };
static irqreturn_t mxs_saif_irq(int irq, void *dev_id) @@ -772,7 +770,8 @@ static int mxs_saif_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, saif);
- ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai); + ret = snd_soc_register_dais(&pdev->dev, mxs_saif_dai, + ARRAY_SIZE(mxs_saif_dai)); if (ret) { dev_err(&pdev->dev, "register DAI failed\n"); return ret;
Hi Mark,
On Sat, Jun 1, 2013 at 7:16 PM, Mark Brown broonie@linaro.org wrote:
When declaring playback and capture capabilities check for both CODEC side and CPU side support rather than only checking for CODEC side support. While it is unusual some CPUs do have unidirectional DAIs.
Signed-off-by: Mark Brown broonie@kernel.org
Now I got it working and your patch does fix the "aplay -l/arecord -l" issue that I reported earlier:
Tested-by: Fabio Estevam fabio.estevam@freescale.com
I also need to patch sound/soc/mxs/mxs-saif.c and will send a separate patch for this.
Thanks a lot, really appreaciated!
Fabio Estevam
On Sun, Jun 02, 2013 at 11:45:46AM -0300, Fabio Estevam wrote:
Now I got it working and your patch does fix the "aplay -l/arecord -l" issue that I reported earlier:
Ah, excellent - thanks for testing!
On Sat, 2013-06-01 at 23:16 +0100, Mark Brown wrote:
When declaring playback and capture capabilities check for both CODEC side and CPU side support rather than only checking for CODEC side support. While it is unusual some CPUs do have unidirectional DAIs.
Signed-off-by: Mark Brown broonie@kernel.org
Acked-by: Liam Girdwood liam.r.girdwood@linux.intel.com
participants (4)
-
Fabio Estevam
-
Liam Girdwood
-
Mark Brown
-
Mark Brown