All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
@ 2013-06-01 22:16 Mark Brown
  2013-06-01 23:01 ` Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mark Brown @ 2013-06-01 22:16 UTC (permalink / raw)
  To: Marek Vasut, Fabio Estevam, Liam Girdwood
  Cc: alsa-devel, Mark Brown, Mark Brown

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;
 	}
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
  2013-06-01 22:16 [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps Mark Brown
@ 2013-06-01 23:01 ` Fabio Estevam
  2013-06-02 14:45 ` Fabio Estevam
  2013-06-03  8:47 ` Liam Girdwood
  2 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2013-06-01 23:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: Marek Vasut, alsa-devel, Mark Brown, Liam Girdwood

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;
-- 
1.8.1.2

,but this did not work either.

I will have to debug more.

Thanks,

Fabio Estevam

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
  2013-06-01 22:16 [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps Mark Brown
  2013-06-01 23:01 ` Fabio Estevam
@ 2013-06-02 14:45 ` Fabio Estevam
  2013-06-03  8:56   ` Mark Brown
  2013-06-03  8:47 ` Liam Girdwood
  2 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2013-06-02 14:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Marek Vasut, alsa-devel, Mark Brown, Liam Girdwood

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
  2013-06-01 22:16 [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps Mark Brown
  2013-06-01 23:01 ` Fabio Estevam
  2013-06-02 14:45 ` Fabio Estevam
@ 2013-06-03  8:47 ` Liam Girdwood
  2 siblings, 0 replies; 5+ messages in thread
From: Liam Girdwood @ 2013-06-03  8:47 UTC (permalink / raw)
  To: Mark Brown
  Cc: Marek Vasut, alsa-devel, Mark Brown, Fabio Estevam, Liam Girdwood

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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps
  2013-06-02 14:45 ` Fabio Estevam
@ 2013-06-03  8:56   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2013-06-03  8:56 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: Marek Vasut, alsa-devel, Liam Girdwood, Mark Brown


[-- Attachment #1.1: Type: text/plain, Size: 207 bytes --]

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!

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-03  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-01 22:16 [PATCH] ASoC: pcm: Require both CODEC and CPU support when declaring stream caps Mark Brown
2013-06-01 23:01 ` Fabio Estevam
2013-06-02 14:45 ` Fabio Estevam
2013-06-03  8:56   ` Mark Brown
2013-06-03  8:47 ` Liam Girdwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.