linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai
@ 2018-06-27  9:48 Jerome Brunet
  2018-06-28 10:15 ` Mark Brown
  2018-06-28 10:20 ` Applied "ASoC: dpcm: extend channel merging to the backend cpu dai" to the asoc tree Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Jerome Brunet @ 2018-06-27  9:48 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown
  Cc: Jerome Brunet, alsa-devel, linux-kernel, Jiada Wang

Extend dpcm_merge_chan to also check backend cpu dai channels
capabilities. Apply the same policy as soc_pcm_init_runtime_hw() for
multicodec links and only check cpu dai in this case.

Cc: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---

 Hi Mark,

 As you've probably noticed, this patch applies on top Jiada's patch
 pf4c277b817cc ("ASoC: soc-pcm: DPCM cares BE channel constraint")

 Regards.
 Jerome

 sound/soc/soc-pcm.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index b82d9ff1f47e..5141409ccaed 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1728,12 +1728,26 @@ static void dpcm_runtime_base_chan(struct snd_pcm_substream *substream,
 
 	list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) {
 		struct snd_soc_pcm_runtime *be = dpcm->be;
+		struct snd_soc_dai_driver *cpu_dai_drv =  be->cpu_dai->driver;
 		struct snd_soc_dai_driver *codec_dai_drv;
 		struct snd_soc_pcm_stream *codec_stream;
-		int i;
+		struct snd_soc_pcm_stream *cpu_stream;
+
+		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+			cpu_stream = &cpu_dai_drv->playback;
+		else
+			cpu_stream = &cpu_dai_drv->capture;
+
+		*channels_min = max(*channels_min, cpu_stream->channels_min);
+		*channels_max = min(*channels_max, cpu_stream->channels_max);
+
+		/*
+		 * chan min/max cannot be enforced if there are multiple CODEC
+		 * DAIs connected to a single CPU DAI, use CPU DAI's directly
+		 */
+		if (be->num_codecs == 1) {
+			codec_dai_drv = be->codec_dais[0]->driver;
 
-		for (i = 0; i < be->num_codecs; i++) {
-			codec_dai_drv = be->codec_dais[i]->driver;
 			if (stream == SNDRV_PCM_STREAM_PLAYBACK)
 				codec_stream = &codec_dai_drv->playback;
 			else
-- 
2.14.4


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

* Re: [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai
  2018-06-27  9:48 [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai Jerome Brunet
@ 2018-06-28 10:15 ` Mark Brown
  2018-06-28 13:08   ` Jerome Brunet
  2018-06-28 10:20 ` Applied "ASoC: dpcm: extend channel merging to the backend cpu dai" to the asoc tree Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2018-06-28 10:15 UTC (permalink / raw)
  To: Jerome Brunet; +Cc: Liam Girdwood, alsa-devel, linux-kernel, Jiada Wang

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

On Wed, Jun 27, 2018 at 11:48:18AM +0200, Jerome Brunet wrote:

>  As you've probably noticed, this patch applies on top Jiada's patch
>  pf4c277b817cc ("ASoC: soc-pcm: DPCM cares BE channel constraint")

That isn't a valid hash...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "ASoC: dpcm: extend channel merging to the backend cpu dai" to the asoc tree
  2018-06-27  9:48 [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai Jerome Brunet
  2018-06-28 10:15 ` Mark Brown
@ 2018-06-28 10:20 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-06-28 10:20 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: Jiada Wang, Mark Brown, Liam Girdwood, Mark Brown, Jiada Wang,
	alsa-devel, linux-kernel, alsa-devel

The patch

   ASoC: dpcm: extend channel merging to the backend cpu dai

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 4f2bd18b191a10660782f2f1ccc989b000b2be63 Mon Sep 17 00:00:00 2001
From: Jerome Brunet <jbrunet@baylibre.com>
Date: Wed, 27 Jun 2018 11:48:18 +0200
Subject: [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai

Extend dpcm_merge_chan to also check backend cpu dai channels
capabilities. Apply the same policy as soc_pcm_init_runtime_hw() for
multicodec links and only check cpu dai in this case.

Cc: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/soc-pcm.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 63f96cde046a..6ee4131941df 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1736,12 +1736,26 @@ static void dpcm_runtime_base_chan(struct snd_pcm_substream *substream,
 
 	list_for_each_entry(dpcm, &fe->dpcm[stream].be_clients, list_be) {
 		struct snd_soc_pcm_runtime *be = dpcm->be;
+		struct snd_soc_dai_driver *cpu_dai_drv =  be->cpu_dai->driver;
 		struct snd_soc_dai_driver *codec_dai_drv;
 		struct snd_soc_pcm_stream *codec_stream;
-		int i;
+		struct snd_soc_pcm_stream *cpu_stream;
+
+		if (stream == SNDRV_PCM_STREAM_PLAYBACK)
+			cpu_stream = &cpu_dai_drv->playback;
+		else
+			cpu_stream = &cpu_dai_drv->capture;
+
+		*channels_min = max(*channels_min, cpu_stream->channels_min);
+		*channels_max = min(*channels_max, cpu_stream->channels_max);
+
+		/*
+		 * chan min/max cannot be enforced if there are multiple CODEC
+		 * DAIs connected to a single CPU DAI, use CPU DAI's directly
+		 */
+		if (be->num_codecs == 1) {
+			codec_dai_drv = be->codec_dais[0]->driver;
 
-		for (i = 0; i < be->num_codecs; i++) {
-			codec_dai_drv = be->codec_dais[i]->driver;
 			if (stream == SNDRV_PCM_STREAM_PLAYBACK)
 				codec_stream = &codec_dai_drv->playback;
 			else
-- 
2.18.0.rc2


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

* Re: [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai
  2018-06-28 10:15 ` Mark Brown
@ 2018-06-28 13:08   ` Jerome Brunet
  0 siblings, 0 replies; 4+ messages in thread
From: Jerome Brunet @ 2018-06-28 13:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Liam Girdwood, alsa-devel, linux-kernel, Jiada Wang

On Thu, 2018-06-28 at 11:15 +0100, Mark Brown wrote:
> On Wed, Jun 27, 2018 at 11:48:18AM +0200, Jerome Brunet wrote:
> 
> >  As you've probably noticed, this patch applies on top Jiada's patch
> >  pf4c277b817cc ("ASoC: soc-pcm: DPCM cares BE channel constraint")
> 
> That isn't a valid hash...

Indeed :) Sorry about that, it was f4c277b817cc (drop the p)

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

end of thread, other threads:[~2018-06-28 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-27  9:48 [PATCH] ASoC: dpcm: extend channel merging to the backend cpu dai Jerome Brunet
2018-06-28 10:15 ` Mark Brown
2018-06-28 13:08   ` Jerome Brunet
2018-06-28 10:20 ` Applied "ASoC: dpcm: extend channel merging to the backend cpu dai" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).