alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup
@ 2020-04-20 11:45 Jerome Brunet
  2020-04-20 11:45 ` [PATCH 1/2] ASoC: meson: axg-card: " Jerome Brunet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jerome Brunet @ 2020-04-20 11:45 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Kevin Hilman, linux-kernel,
	linux-amlogic, Jerome Brunet

This patchset fixes the problem reported by Marc in this thread [0]
The problem was due to an error in the meson card drivers which had
the "no_pcm" dai_link property set on codec-to-codec links

[0]: https://lore.kernel.org/r/20200417122732.GC5315@sirena.org.uk

Jerome Brunet (2):
  ASoC: meson: axg-card: fix codec-to-codec link setup
  ASoC: meson: gx-card: fix codec-to-codec link setup

 sound/soc/meson/axg-card.c | 4 +++-
 sound/soc/meson/gx-card.c  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.25.2


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

* [PATCH 1/2] ASoC: meson: axg-card: fix codec-to-codec link setup
  2020-04-20 11:45 [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup Jerome Brunet
@ 2020-04-20 11:45 ` Jerome Brunet
  2020-04-20 11:45 ` [PATCH 2/2] ASoC: meson: gx-card: " Jerome Brunet
  2020-04-20 13:36 ` [PATCH 0/2] ASoC: meson: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jerome Brunet @ 2020-04-20 11:45 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Kevin Hilman, linux-kernel,
	linux-amlogic, Jerome Brunet

Since the addition of commit 9b5db059366a ("ASoC: soc-pcm: dpcm: Only allow
playback/capture if supported"), meson-axg cards which have codec-to-codec
links fail to init and Oops:

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000128
  Internal error: Oops: 96000044 [#1] PREEMPT SMP
  CPU: 3 PID: 1582 Comm: arecord Not tainted 5.7.0-rc1
  pc : invalidate_paths_ep+0x30/0xe0
  lr : snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
  Call trace:
   invalidate_paths_ep+0x30/0xe0
   snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
   dpcm_path_get+0x38/0xd0
   dpcm_fe_dai_open+0x70/0x920
   snd_pcm_open_substream+0x564/0x840
   snd_pcm_open+0xfc/0x228
   snd_pcm_capture_open+0x4c/0x78
   snd_open+0xac/0x1a8
   ...

While initiliazing the links, ASoC treats the codec-to-codec links of this
card type as a DPCM backend. This error eventually leads to the Oops.

Most of the card driver code is shared between DPCM backends and
codec-to-codec links. The property "no_pcm" marking DCPM BE was left set on
codec-to-codec links, leading to this problem. This commit fixes that.

Fixes: 0a8f1117a680 ("ASoC: meson: axg-card: add basic codec-to-codec link support")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/axg-card.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c
index af46845f4ef2..89f7f64747cd 100644
--- a/sound/soc/meson/axg-card.c
+++ b/sound/soc/meson/axg-card.c
@@ -338,8 +338,10 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
 
 	if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node))
 		ret = axg_card_parse_tdm(card, np, index);
-	else if (axg_card_cpu_is_codec(dai_link->cpus->of_node))
+	else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) {
 		dai_link->params = &codec_params;
+		dai_link->no_pcm = 0; /* link is not a DPCM BE */
+	}
 
 	return ret;
 }
-- 
2.25.2


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

* [PATCH 2/2] ASoC: meson: gx-card: fix codec-to-codec link setup
  2020-04-20 11:45 [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup Jerome Brunet
  2020-04-20 11:45 ` [PATCH 1/2] ASoC: meson: axg-card: " Jerome Brunet
@ 2020-04-20 11:45 ` Jerome Brunet
  2020-04-20 13:36 ` [PATCH 0/2] ASoC: meson: " Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Jerome Brunet @ 2020-04-20 11:45 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: devicetree, alsa-devel, Kevin Hilman, linux-kernel,
	linux-amlogic, Jerome Brunet

Since the addition of commit 9b5db059366a ("ASoC: soc-pcm: dpcm: Only allow
playback/capture if supported"), meson-axg cards which have codec-to-codec
links fail to init and Oops.

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000128
  Internal error: Oops: 96000044 [#1] PREEMPT SMP
  CPU: 3 PID: 1582 Comm: arecord Not tainted 5.7.0-rc1
  pc : invalidate_paths_ep+0x30/0xe0
  lr : snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
  Call trace:
   invalidate_paths_ep+0x30/0xe0
   snd_soc_dapm_dai_get_connected_widgets+0x170/0x1a8
   dpcm_path_get+0x38/0xd0
   dpcm_fe_dai_open+0x70/0x920
   snd_pcm_open_substream+0x564/0x840
   snd_pcm_open+0xfc/0x228
   snd_pcm_capture_open+0x4c/0x78
   snd_open+0xac/0x1a8
   ...

While this error was initially reported the axg-card type, it also applies
to the gx-card type.

While initiliazing the links, ASoC treats the codec-to-codec links of this
card type as a DPCM backend. This error eventually leads to the Oops.

Most of the card driver code is shared between DPCM backends and
codec-to-codec links. The property "no_pcm" marking DCPM BE was left set on
codec-to-codec links, leading to this problem. This commit fixes that.

Fixes: e37a0c313a0f ("ASoC: meson: gx: add sound card support")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 sound/soc/meson/gx-card.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c
index 7b01dcb73e5e..4abf7efb7eac 100644
--- a/sound/soc/meson/gx-card.c
+++ b/sound/soc/meson/gx-card.c
@@ -108,8 +108,10 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np,
 		ret = gx_card_parse_i2s(card, np, index);
 
 	/* Or apply codec to codec params if necessary */
-	else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL"))
+	else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) {
 		dai_link->params = &codec_params;
+		dai_link->no_pcm = 0; /* link is not a DPCM BE */
+	}
 
 	return ret;
 }
-- 
2.25.2


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

* Re: [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup
  2020-04-20 11:45 [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup Jerome Brunet
  2020-04-20 11:45 ` [PATCH 1/2] ASoC: meson: axg-card: " Jerome Brunet
  2020-04-20 11:45 ` [PATCH 2/2] ASoC: meson: gx-card: " Jerome Brunet
@ 2020-04-20 13:36 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-04-20 13:36 UTC (permalink / raw)
  To: Liam Girdwood, Jerome Brunet
  Cc: linux-amlogic, devicetree, linux-kernel, alsa-devel, Kevin Hilman

On Mon, 20 Apr 2020 13:45:09 +0200, Jerome Brunet wrote:
> This patchset fixes the problem reported by Marc in this thread [0]
> The problem was due to an error in the meson card drivers which had
> the "no_pcm" dai_link property set on codec-to-codec links
> 
> [0]: https://lore.kernel.org/r/20200417122732.GC5315@sirena.org.uk
> 
> Jerome Brunet (2):
>   ASoC: meson: axg-card: fix codec-to-codec link setup
>   ASoC: meson: gx-card: fix codec-to-codec link setup
> 
> [...]

Applied to

	broonie/sound.git for-5.7

Thanks!

[1/2] ASoC: meson: axg-card: fix codec-to-codec link setup
      commit: 1164284270779e1865cc2046a2a01b58a1e858a9
[2/2] ASoC: meson: gx-card: fix codec-to-codec link setup
      commit: de911b4e683f9c28a063bb62991f2db206c38ba4

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] 4+ messages in thread

end of thread, other threads:[~2020-04-20 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 11:45 [PATCH 0/2] ASoC: meson: fix codec-to-codec link setup Jerome Brunet
2020-04-20 11:45 ` [PATCH 1/2] ASoC: meson: axg-card: " Jerome Brunet
2020-04-20 11:45 ` [PATCH 2/2] ASoC: meson: gx-card: " Jerome Brunet
2020-04-20 13:36 ` [PATCH 0/2] ASoC: meson: " 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).