alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: more fixes for dpcm checks
@ 2020-07-07 21:04 Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper Pierre-Louis Bossart
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-07 21:04 UTC (permalink / raw)
  To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart, Kuninori Morimoto

This is hopefully the last set of fixes to avoid probe errors due to
stricter checks of DAI capabilities introduced late in the 5.8 cycle.

Daniel Baluta (1):
  ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M

Pierre-Louis Bossart (2):
  ASoC: soc-dai: set dai_link dpcm_ flags with a helper
  ASoC: Intel: bdw-rt5677: fix non BE conversion

 include/sound/soc-dai.h              |  1 +
 sound/soc/generic/audio-graph-card.c |  4 +--
 sound/soc/generic/simple-card.c      |  4 +--
 sound/soc/intel/boards/bdw-rt5677.c  |  1 +
 sound/soc/soc-dai.c                  | 38 ++++++++++++++++++++++++++++
 sound/soc/sof/imx/imx8.c             |  8 ++++++
 sound/soc/sof/imx/imx8m.c            |  8 ++++++
 7 files changed, 60 insertions(+), 4 deletions(-)


base-commit: a5911ac5790acaf98c929b826b3f7b4a438f9759
-- 
2.25.1


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

* [PATCH 1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper
  2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
@ 2020-07-07 21:04 ` Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 2/3] ASoC: Intel: bdw-rt5677: fix non BE conversion Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-07 21:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: Guennadi Liakhovetski, Kuninori Morimoto, Kai Vehmanen, tiwai,
	Pierre-Louis Bossart, broonie

Add a helper to walk through all the DAIs and set dpcm_playback and
dpcm_capture flags based on the DAIs capabilities, and use this helper
to avoid setting these flags arbitrarily in generic cards.

The commit referenced in the Fixes tag did not introduce the
configuration issue but will prevent the card from probing when
detecting invalid configurations.

Fixes: b73287f0b0745 ('ASoC: soc-pcm: dpcm: fix playback/capture checks')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
---
 include/sound/soc-dai.h              |  1 +
 sound/soc/generic/audio-graph-card.c |  4 +--
 sound/soc/generic/simple-card.c      |  4 +--
 sound/soc/soc-dai.c                  | 38 ++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 212257e84fac..71e178c89793 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -161,6 +161,7 @@ void snd_soc_dai_resume(struct snd_soc_dai *dai);
 int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
 			     struct snd_soc_pcm_runtime *rtd, int num);
 bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream);
+void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link);
 void snd_soc_dai_action(struct snd_soc_dai *dai,
 			int stream, int action);
 static inline void snd_soc_dai_activate(struct snd_soc_dai *dai,
diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c
index 9ad35d9940fe..97b4f5480a31 100644
--- a/sound/soc/generic/audio-graph-card.c
+++ b/sound/soc/generic/audio-graph-card.c
@@ -317,8 +317,8 @@ static int graph_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto out_put_node;
 
-	dai_link->dpcm_playback		= 1;
-	dai_link->dpcm_capture		= 1;
+	snd_soc_dai_link_set_capabilities(dai_link);
+
 	dai_link->ops			= &graph_ops;
 	dai_link->init			= asoc_simple_dai_init;
 
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 55e9f8800b3e..04d4d28ed511 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -231,8 +231,8 @@ static int simple_dai_link_of_dpcm(struct asoc_simple_priv *priv,
 	if (ret < 0)
 		goto out_put_node;
 
-	dai_link->dpcm_playback		= 1;
-	dai_link->dpcm_capture		= 1;
+	snd_soc_dai_link_set_capabilities(dai_link);
+
 	dai_link->ops			= &simple_ops;
 	dai_link->init			= asoc_simple_dai_init;
 
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index b05e18b63a1c..457159975b01 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -391,6 +391,44 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir)
 	return stream->channels_min;
 }
 
+/*
+ * snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs
+ */
+void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link)
+{
+	struct snd_soc_dai_link_component *cpu;
+	struct snd_soc_dai_link_component *codec;
+	struct snd_soc_dai *dai;
+	bool supported[SNDRV_PCM_STREAM_LAST + 1];
+	int direction;
+	int i;
+
+	for_each_pcm_streams(direction) {
+		supported[direction] = true;
+
+		for_each_link_cpus(dai_link, i, cpu) {
+			dai = snd_soc_find_dai(cpu);
+			if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {
+				supported[direction] = false;
+				break;
+			}
+		}
+		if (!supported[direction])
+			continue;
+		for_each_link_codecs(dai_link, i, codec) {
+			dai = snd_soc_find_dai(codec);
+			if (!dai || !snd_soc_dai_stream_valid(dai, direction)) {
+				supported[direction] = false;
+				break;
+			}
+		}
+	}
+
+	dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK];
+	dai_link->dpcm_capture  = supported[SNDRV_PCM_STREAM_CAPTURE];
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities);
+
 void snd_soc_dai_action(struct snd_soc_dai *dai,
 			int stream, int action)
 {
-- 
2.25.1


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

* [PATCH 2/3] ASoC: Intel: bdw-rt5677: fix non BE conversion
  2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper Pierre-Louis Bossart
@ 2020-07-07 21:04 ` Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 3/3] ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-07 21:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: Guennadi Liakhovetski, Kuninori Morimoto, tiwai,
	Pierre-Louis Bossart, Curtis Malainey, broonie

When SOF is used, the normal links are converted into DPCM ones. This
generates an error

[ 58.276668] bdw-rt5677 bdw-rt5677: CPU DAI spi-RT5677AA:00 for rtd
Wake on Voice does not support playback
[ 58.276676] bdw-rt5677 bdw-rt5677: ASoC: can't create pcm Wake on
Voice :-22

Fix by forcing the capture direction.

Fixes: b73287f0b0745 ('ASoC: soc-pcm: dpcm: fix playback/capture checks')
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Curtis Malainey <curtis@malainey.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bdw-rt5677.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c
index c9da91147770..725304779426 100644
--- a/sound/soc/intel/boards/bdw-rt5677.c
+++ b/sound/soc/intel/boards/bdw-rt5677.c
@@ -367,6 +367,7 @@ static struct snd_soc_dai_link bdw_rt5677_dais[] = {
 	{
 		.name = "Codec DSP",
 		.stream_name = "Wake on Voice",
+		.capture_only = 1,
 		.ops = &bdw_rt5677_dsp_ops,
 		SND_SOC_DAILINK_REG(dsp),
 	},
-- 
2.25.1


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

* [PATCH 3/3] ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M
  2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper Pierre-Louis Bossart
  2020-07-07 21:04 ` [PATCH 2/3] ASoC: Intel: bdw-rt5677: fix non BE conversion Pierre-Louis Bossart
@ 2020-07-07 21:04 ` Pierre-Louis Bossart
  2020-07-08 11:53 ` [PATCH 0/3] ASoC: more fixes for dpcm checks Mark Brown
  2020-07-08 16:59 ` Mark Brown
  4 siblings, 0 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-07 21:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: Kuninori Morimoto, tiwai, Ranjani Sridharan,
	Pierre-Louis Bossart, broonie, Daniel Baluta

From: Daniel Baluta <daniel.baluta@nxp.com>

This is identical with change for Intel platforms done with
commit 8c05246c0b58 ("ASoC: SOF: Intel: add min/max channels for SSP on Baytrail/Broadwell")
and fixes a regression on i.MX8/i.MX8M:

[   25.705750]  esai-Codec: ASoC: no backend playback stream
[   27.923378]  esai-Codec: ASoC: no users playback at close - state

This is root-caused to the introduction of the DAI capability checks
with snd_soc_dai_stream_valid(). Its use in soc-pcm.c makes it a
requirement for all DAIs to report at least a non-zero min_channels
field.

Fixes: 9b5db059366ae2 ("ASoC: soc-pcm: dpcm: Only allow playback/capture if supported")
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/sof/imx/imx8.c  | 8 ++++++++
 sound/soc/sof/imx/imx8m.c | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index 63f9c20a1bac..a4fa8451d8cb 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -375,6 +375,14 @@ static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev,
 static struct snd_soc_dai_driver imx8_dai[] = {
 {
 	.name = "esai-port",
+	.playback = {
+		.channels_min = 1,
+		.channels_max = 8,
+	},
+	.capture = {
+		.channels_min = 1,
+		.channels_max = 8,
+	},
 },
 };
 
diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c
index fa86a9e2990f..287114a37688 100644
--- a/sound/soc/sof/imx/imx8m.c
+++ b/sound/soc/sof/imx/imx8m.c
@@ -240,6 +240,14 @@ static int imx8m_ipc_pcm_params(struct snd_sof_dev *sdev,
 static struct snd_soc_dai_driver imx8m_dai[] = {
 {
 	.name = "sai-port",
+	.playback = {
+		.channels_min = 1,
+		.channels_max = 32,
+	},
+	.capture = {
+		.channels_min = 1,
+		.channels_max = 32,
+	},
 },
 };
 
-- 
2.25.1


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

* Re: [PATCH 0/3] ASoC: more fixes for dpcm checks
  2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2020-07-07 21:04 ` [PATCH 3/3] ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M Pierre-Louis Bossart
@ 2020-07-08 11:53 ` Mark Brown
  2020-07-08 12:49   ` Pierre-Louis Bossart
  2020-07-08 16:59 ` Mark Brown
  4 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2020-07-08 11:53 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, Kuninori Morimoto

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

On Tue, Jul 07, 2020 at 04:04:36PM -0500, Pierre-Louis Bossart wrote:

> base-commit: a5911ac5790acaf98c929b826b3f7b4a438f9759

These are fixes but you're basing them off for-5.9.

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

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

* Re: [PATCH 0/3] ASoC: more fixes for dpcm checks
  2020-07-08 11:53 ` [PATCH 0/3] ASoC: more fixes for dpcm checks Mark Brown
@ 2020-07-08 12:49   ` Pierre-Louis Bossart
  2020-07-08 15:53     ` Mark Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-08 12:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: tiwai, alsa-devel, Kuninori Morimoto



On 7/8/20 6:53 AM, Mark Brown wrote:
> On Tue, Jul 07, 2020 at 04:04:36PM -0500, Pierre-Louis Bossart wrote:
> 
>> base-commit: a5911ac5790acaf98c929b826b3f7b4a438f9759
> 
> These are fixes but you're basing them off for-5.9.

I wasn't sure which branch to use to be honest. It's late in the cycle 
for 5.8, the addition of the helper is new. I am happy to resubmit for 
5.8 if you prefer it this way.

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

* Re: [PATCH 0/3] ASoC: more fixes for dpcm checks
  2020-07-08 12:49   ` Pierre-Louis Bossart
@ 2020-07-08 15:53     ` Mark Brown
  2020-07-08 16:59       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2020-07-08 15:53 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: tiwai, alsa-devel, Kuninori Morimoto

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

On Wed, Jul 08, 2020 at 07:49:58AM -0500, Pierre-Louis Bossart wrote:

> I wasn't sure which branch to use to be honest. It's late in the cycle for
> 5.8, the addition of the helper is new. I am happy to resubmit for 5.8 if
> you prefer it this way.

They applied fine as-is so it's fine.

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

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

* Re: [PATCH 0/3] ASoC: more fixes for dpcm checks
  2020-07-08 15:53     ` Mark Brown
@ 2020-07-08 16:59       ` Pierre-Louis Bossart
  0 siblings, 0 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2020-07-08 16:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: tiwai, alsa-devel, Kuninori Morimoto



On 7/8/20 10:53 AM, Mark Brown wrote:
> On Wed, Jul 08, 2020 at 07:49:58AM -0500, Pierre-Louis Bossart wrote:
> 
>> I wasn't sure which branch to use to be honest. It's late in the cycle for
>> 5.8, the addition of the helper is new. I am happy to resubmit for 5.8 if
>> you prefer it this way.
> 
> They applied fine as-is so it's fine.

Great, thanks!

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

* Re: [PATCH 0/3] ASoC: more fixes for dpcm checks
  2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2020-07-08 11:53 ` [PATCH 0/3] ASoC: more fixes for dpcm checks Mark Brown
@ 2020-07-08 16:59 ` Mark Brown
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2020-07-08 16:59 UTC (permalink / raw)
  To: alsa-devel, Pierre-Louis Bossart; +Cc: tiwai, Kuninori Morimoto

On Tue, 7 Jul 2020 16:04:36 -0500, Pierre-Louis Bossart wrote:
> This is hopefully the last set of fixes to avoid probe errors due to
> stricter checks of DAI capabilities introduced late in the 5.8 cycle.
> 
> Daniel Baluta (1):
>   ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M
> 
> Pierre-Louis Bossart (2):
>   ASoC: soc-dai: set dai_link dpcm_ flags with a helper
>   ASoC: Intel: bdw-rt5677: fix non BE conversion
> 
> [...]

Applied to

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

Thanks!

[1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper
      commit: 25612477d20b522a3203707ff23575b99f639fff
[2/3] ASoC: Intel: bdw-rt5677: fix non BE conversion
      commit: fffebe8a8339c7e56db4126653a3bc0c0c5592cf
[3/3] ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M
      commit: 4e7f8cac1171ba369a9209a8d949732a4d3b939a

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

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

end of thread, other threads:[~2020-07-08 17:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07 21:04 [PATCH 0/3] ASoC: more fixes for dpcm checks Pierre-Louis Bossart
2020-07-07 21:04 ` [PATCH 1/3] ASoC: soc-dai: set dai_link dpcm_ flags with a helper Pierre-Louis Bossart
2020-07-07 21:04 ` [PATCH 2/3] ASoC: Intel: bdw-rt5677: fix non BE conversion Pierre-Louis Bossart
2020-07-07 21:04 ` [PATCH 3/3] ASoC: SOF: imx: add min/max channels for SAI/ESAI on i.MX8/i.MX8M Pierre-Louis Bossart
2020-07-08 11:53 ` [PATCH 0/3] ASoC: more fixes for dpcm checks Mark Brown
2020-07-08 12:49   ` Pierre-Louis Bossart
2020-07-08 15:53     ` Mark Brown
2020-07-08 16:59       ` Pierre-Louis Bossart
2020-07-08 16:59 ` 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).