Skip to contentSkip to conversation

ASoC: meson: cards: deal dpcm flag change

PATCH Applied Jerome Brunet 4 participants 6 messages Jul 31, 2020 – Aug 27, 2020

Subsystems (4)
lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

PATCH 1/1 ASoC: meson: cards: deal dpcm flag change

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

While I'm still confused as to how this change is an improvement, those cards can't remain broken forever. Hopefully, next time an API change is done like that, all the users will be updated as part of the change, and not left to fend for themselves.

Fixes b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")

---

Hi,

For the cards be actually fixed, change 'ASoC: core: use less strict tests for dailink capabilities' will need to merged as well. snd_soc_dai_link_set_capabilities() as
implemented in 25612477d20b5 ('ASoC: soc-dai: set dai_link dpcm_ flags with a helper') does not support link with multiple codec with different direction
capabilities. This quite a common case on these cards.

 sound/soc/meson/axg-card.c         | 18 ++++++++++--------
 sound/soc/meson/gx-card.c          | 18 +++++++++---------
 sound/soc/meson/meson-card-utils.c |  4 ----
 3 files changed, 19 insertions(+), 21 deletions(-)
sound/soc/meson/axg-card.c +10 -8
index 5176be165210..2b77010c2c5c 100644
@@ -327,20 +327,22 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
 		return ret;
 
 	if (axg_card_cpu_is_playback_fe(dai_link->cpus->of_node))
-		ret = meson_card_set_fe_link(card, dai_link, np, true);
+		return meson_card_set_fe_link(card, dai_link, np, true);
 	else if (axg_card_cpu_is_capture_fe(dai_link->cpus->of_node))
-		ret = meson_card_set_fe_link(card, dai_link, np, false);
-	else
-		ret = meson_card_set_be_link(card, dai_link, np);
+		return meson_card_set_fe_link(card, dai_link, np, false);
 
+
+	ret = meson_card_set_be_link(card, dai_link, np);
 	if (ret)
 		return ret;
 
-	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)) {
+	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 */
+	} else {
+		dai_link->no_pcm = 1;
+		snd_soc_dai_link_set_capabilities(dai_link);
+		if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node))
+			ret = axg_card_parse_tdm(card, np, index);
 	}
 
 	return ret;
sound/soc/meson/gx-card.c +9 -9
index 6da8535f4dd2..5119434a81c4 100644
@@ -96,21 +96,21 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np,
 		return ret;
 
 	if (gx_card_cpu_identify(dai_link->cpus, "FIFO"))
-		ret = meson_card_set_fe_link(card, dai_link, np, true);
-	else
-		ret = meson_card_set_be_link(card, dai_link, np);
+		return  meson_card_set_fe_link(card, dai_link, np, true);
 
+	ret = meson_card_set_be_link(card, dai_link, np);
 	if (ret)
 		return ret;
 
-	/* Check if the cpu is the i2s encoder and parse i2s data */
-	if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder"))
-		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")) {
+	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 */
+	} else {
+		dai_link->no_pcm = 1;
+		snd_soc_dai_link_set_capabilities(dai_link);
+		/* Check if the cpu is the i2s encoder and parse i2s data */
+		if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder"))
+			ret = gx_card_parse_i2s(card, np, index);
 	}
 
 	return ret;
sound/soc/meson/meson-card-utils.c +0 -4
index f9ce03f3921f..6a64ac01b5ca 100644
@@ -147,10 +147,6 @@ int meson_card_set_be_link(struct snd_soc_card *card,
 	struct device_node *np;
 	int ret, num_codecs;
 
-	link->no_pcm = 1;
-	link->dpcm_playback = 1;
-	link->dpcm_capture = 1;
-
 	num_codecs = of_get_child_count(node);
 	if (!num_codecs) {
 		dev_err(card->dev, "be link %s has no codec\n",
Signature · 1 line
2.25.4
maintainer
#1 lore raw
Quoted 8 lines · Jerome Brunet

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

[...]

Applied to

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

Thanks!

[1/1] ASoC: meson: cards: deal dpcm flag change

      commit: da3f23fde9d7b4a7e0ca9a9a096cec3104df1b82

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

#2 lore raw
In reply to Jerome Brunet
This patch was applied to khilman/linux-amlogic.git (refs/heads/for-next).

Hello:

This patch was applied to khilman/linux-amlogic.git (refs/heads/for-next).

Quoted 8 lines · On Fri, 31 Jul 2020 14:06:03 +0200 you wrote:

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

[...]

Here is a summary with links:
- ASoC: meson: cards: deal dpcm flag change

    https://git.kernel.org/khilman/linux-amlogic/c/da3f23fde9d7b4a7e0ca9a9a096cec3104df1b82

You are awesome, thank you!

Signature · 7 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/pwbot

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#3 lore raw
In reply to Jerome Brunet

Hi Jerome,

Quoted 7 lines · Jerome Brunet

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

Quoted 7 lines

While I'm still confused as to how this change is an improvement, those cards can't remain broken forever. Hopefully, next time an API change is done like that, all the users will be updated as part of the change, and not left to fend for themselves.

Fixes b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")

This patch landed finally in v5.9-rc1. I've noticed it causes a following warning on Hardkernel's Odroid N2 board (arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtb):

meson-drm ff900000.vpu: [drm] fb0: mesondrmfb frame buffer device

------------[ cut here ]------------
WARNING: CPU: 3 PID: 66 at sound/soc/soc-core.c:817 
snd_soc_find_dai+0xe4/0xf0
Modules linked in: dw_hdmi_i2s_audio dw_hdmi_cec meson_gxl realtek 

dwmac_generic crct10dif_ce snd_soc_meson_axg_sound_card snd_soc_meson_card_utils rc_odroid pwm_meson meson_ir snd_soc_meson_g12a_toacodec snd_soc_meson_axg_tdmout rtc_meson_vrtc snd_soc_meson_g12a_tohdmitx snd_soc_meson_codec_glue mdio_mux_meson_g12a snd_soc_meson_axg_tdmin dwmac_meson8b stmmac_platform reset_meson_audio_arb snd_soc_meson_axg_frddr axg_audio snd_soc_meson_axg_toddr sclk_div clk_phase meson_rng stmmac rng_core meson_dw_hdmi snd_soc_meson_axg_fifo meson_drm meson_canvas mdio_xpcs dw_hdmi snd_soc_meson_t9015 display_connector nvmem_meson_efuse snd_soc_meson_axg_tdm_interface snd_soc_meson_axg_tdm_formatter snd_soc_simple_amplifier

CPU: 3 PID: 66 Comm: kworker/3:1 Not tainted 5.9.0-rc1 #1527
Hardware name: Hardkernel ODROID-N2 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
pc : snd_soc_find_dai+0xe4/0xf0
lr : snd_soc_find_dai+0xe0/0xf0
...
Call trace:
  snd_soc_find_dai+0xe4/0xf0
  snd_soc_dai_link_set_capabilities+0x68/0x160
  axg_card_add_link+0x188/0x5c4 [snd_soc_meson_axg_sound_card]
  meson_card_probe+0x1e0/0x960 [snd_soc_meson_card_utils]
  platform_drv_probe+0x50/0xa8
  really_probe+0x110/0x400
  driver_probe_device+0x54/0xb8
  __device_attach_driver+0x90/0xc0
  bus_for_each_drv+0x70/0xc8
  __device_attach+0xec/0x150
  device_initial_probe+0x10/0x18
  bus_probe_device+0x94/0xa0
  deferred_probe_work_func+0x70/0xa8
  process_one_work+0x2a8/0x718
  worker_thread+0x48/0x460
  kthread+0x134/0x160
  ret_from_fork+0x10/0x1c
irq event stamp: 269690
hardirqs last  enabled at (269689): [<ffff800010f6048c>] 
_raw_spin_unlock_irqrestore+0x7c/0x98
hardirqs last disabled at (269690): [<ffff800010025a68>] 
do_debug_exception+0x140/0x26c
softirqs last  enabled at (269318): [<ffff800010001654>] 
efi_header_end+0x654/0x6d4
softirqs last disabled at (269313): [<ffff80001008929c>] 
irq_exit+0x16c/0x178
---[ end trace 56a3ea4fa00c37c8 ]---

...
axg-sound-card sound: ASoC: no DMI vendor name!

The warning is repeated 10 times.

The bisect between v5.8-rc1 and v5.9-rc1 points to the commit c8f7dbdbaa15 ("Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus"), which introduced a branch with this patch.

The commit with this patch is applied on the earlier kernel release (da3f23fde9d7 "ASoC: meson: cards: deal dpcm flag change" on top of v5.7-rc1) worked fine, so it looks that there is an interference with something merged later.

If I revert this patch on top of v5.9-rc1 or current linux-next, the warning is gone. Let me know how I can help debugging this issue.

Best regards

Signature · 8 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
author maintainer
#4 lore raw
Quoted 15 lines · Marek Szyprowski

Hi Jerome,

Quoted 12 lines · Jerome Brunet

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

While I'm still confused as to how this change is an improvement, those cards can't remain broken forever. Hopefully, next time an API change is done like that, all the users will be updated as part of the change, and not left to fend for themselves.

Quoted 6 lines
Quoted 2 lines
Fixes b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")

This patch landed finally in v5.9-rc1. I've noticed it causes a following warning on Hardkernel's Odroid N2 board (arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtb):

Looks like the after match of the flag change again ...

Quoted 4 lines

meson-drm ff900000.vpu: [drm] fb0: mesondrmfb frame buffer device

------------[ cut here ]------------
WARNING: CPU: 3 PID: 66 at sound/soc/soc-core.c:817

Marek, is it possible that you have CONFIG_LOCKDEP enabled in your configuration ?

snd_soc_find_dai() is called by snd_soc_dai_link_set_capabilities(). Indeed, the client_mutex will not be help by any of the user of snd_soc_dai_link_set_capabilities() when called.

So I believe simple card and qcom will be impacted as well.

Quoted 48 lines
snd_soc_find_dai+0xe4/0xf0
Modules linked in: dw_hdmi_i2s_audio dw_hdmi_cec meson_gxl realtek 

dwmac_generic crct10dif_ce snd_soc_meson_axg_sound_card snd_soc_meson_card_utils rc_odroid pwm_meson meson_ir snd_soc_meson_g12a_toacodec snd_soc_meson_axg_tdmout rtc_meson_vrtc snd_soc_meson_g12a_tohdmitx snd_soc_meson_codec_glue mdio_mux_meson_g12a snd_soc_meson_axg_tdmin dwmac_meson8b stmmac_platform reset_meson_audio_arb snd_soc_meson_axg_frddr axg_audio snd_soc_meson_axg_toddr sclk_div clk_phase meson_rng stmmac rng_core meson_dw_hdmi snd_soc_meson_axg_fifo meson_drm meson_canvas mdio_xpcs dw_hdmi snd_soc_meson_t9015 display_connector nvmem_meson_efuse snd_soc_meson_axg_tdm_interface snd_soc_meson_axg_tdm_formatter snd_soc_simple_amplifier

CPU: 3 PID: 66 Comm: kworker/3:1 Not tainted 5.9.0-rc1 #1527
Hardware name: Hardkernel ODROID-N2 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
pc : snd_soc_find_dai+0xe4/0xf0
lr : snd_soc_find_dai+0xe0/0xf0
...
Call trace:
  snd_soc_find_dai+0xe4/0xf0
  snd_soc_dai_link_set_capabilities+0x68/0x160
  axg_card_add_link+0x188/0x5c4 [snd_soc_meson_axg_sound_card]
  meson_card_probe+0x1e0/0x960 [snd_soc_meson_card_utils]
  platform_drv_probe+0x50/0xa8
  really_probe+0x110/0x400
  driver_probe_device+0x54/0xb8
  __device_attach_driver+0x90/0xc0
  bus_for_each_drv+0x70/0xc8
  __device_attach+0xec/0x150
  device_initial_probe+0x10/0x18
  bus_probe_device+0x94/0xa0
  deferred_probe_work_func+0x70/0xa8
  process_one_work+0x2a8/0x718
  worker_thread+0x48/0x460
  kthread+0x134/0x160
  ret_from_fork+0x10/0x1c
irq event stamp: 269690
hardirqs last  enabled at (269689): [<ffff800010f6048c>] 
_raw_spin_unlock_irqrestore+0x7c/0x98
hardirqs last disabled at (269690): [<ffff800010025a68>] 
do_debug_exception+0x140/0x26c
softirqs last  enabled at (269318): [<ffff800010001654>] 
efi_header_end+0x654/0x6d4
softirqs last disabled at (269313): [<ffff80001008929c>] 
irq_exit+0x16c/0x178
---[ end trace 56a3ea4fa00c37c8 ]---
Quoted 4 lines

...
axg-sound-card sound: ASoC: no DMI vendor name!

The warning is repeated 10 times.

That's the probe defferal mechanism causing the repeat

Quoted 5 lines

The bisect between v5.8-rc1 and v5.9-rc1 points to the commit c8f7dbdbaa15 ("Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus"), which introduced a branch with this patch.

Quoted 7 lines

The commit with this patch is applied on the earlier kernel release (da3f23fde9d7 "ASoC: meson: cards: deal dpcm flag change" on top of v5.7-rc1) worked fine, so it looks that there is an interference with something merged later.

If I revert this patch on top of v5.9-rc1 or current linux-next, the warning is gone.

... but any aml platform with uni-directional backend (not the N2, lucky you) would be broken.

Quoted 1 line

Let me know how I can help debugging this issue.

If you have CONFIG_LOCKDEP enabled, try disabling see how it goes and report. It is not a fix but at least you'll be unblocked.

Quoted 2 lines

Best regards

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#5 lore raw

Hi

Quoted 19 lines · Jerome Brunet
Quoted 13 lines · Marek Szyprowski
Quoted 12 lines · Jerome Brunet

Commit b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks") changed the meaning of dpcm_playback/dpcm_capture and now requires the CPU DAI BE to aligned with those flags.

This broke all Amlogic cards with uni-directional backends (All gx and most axg cards).

While I'm still confused as to how this change is an improvement, those cards can't remain broken forever. Hopefully, next time an API change is done like that, all the users will be updated as part of the change, and not left to fend for themselves.

Quoted 5 lines
Quoted 2 lines
Fixes b73287f0b074 ("ASoC: soc-pcm: dpcm: fix playback/capture checks")

This patch landed finally in v5.9-rc1. I've noticed it causes a following warning on Hardkernel's Odroid N2 board (arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtb):

Quoted 7 lines

Looks like the after match of the flag change again ...

Quoted 3 lines

meson-drm ff900000.vpu: [drm] fb0: mesondrmfb frame buffer device

------------[ cut here ]------------
WARNING: CPU: 3 PID: 66 at sound/soc/soc-core.c:817

Marek, is it possible that you have CONFIG_LOCKDEP enabled in your configuration ?

Right, I have CONFIG_PROVE_LOCKING and CONFIG_LOCKDEP enabled.

Quoted 69 lines

snd_soc_find_dai() is called by snd_soc_dai_link_set_capabilities(). Indeed, the client_mutex will not be help by any of the user of snd_soc_dai_link_set_capabilities() when called.

So I believe simple card and qcom will be impacted as well.

Quoted 48 lines
snd_soc_find_dai+0xe4/0xf0
Modules linked in: dw_hdmi_i2s_audio dw_hdmi_cec meson_gxl realtek

dwmac_generic crct10dif_ce snd_soc_meson_axg_sound_card snd_soc_meson_card_utils rc_odroid pwm_meson meson_ir snd_soc_meson_g12a_toacodec snd_soc_meson_axg_tdmout rtc_meson_vrtc snd_soc_meson_g12a_tohdmitx snd_soc_meson_codec_glue mdio_mux_meson_g12a snd_soc_meson_axg_tdmin dwmac_meson8b stmmac_platform reset_meson_audio_arb snd_soc_meson_axg_frddr axg_audio snd_soc_meson_axg_toddr sclk_div clk_phase meson_rng stmmac rng_core meson_dw_hdmi snd_soc_meson_axg_fifo meson_drm meson_canvas mdio_xpcs dw_hdmi snd_soc_meson_t9015 display_connector nvmem_meson_efuse snd_soc_meson_axg_tdm_interface snd_soc_meson_axg_tdm_formatter snd_soc_simple_amplifier

CPU: 3 PID: 66 Comm: kworker/3:1 Not tainted 5.9.0-rc1 #1527
Hardware name: Hardkernel ODROID-N2 (DT)
Workqueue: events deferred_probe_work_func
pstate: 60000005 (nZCv daif -PAN -UAO BTYPE=--)
pc : snd_soc_find_dai+0xe4/0xf0
lr : snd_soc_find_dai+0xe0/0xf0
...
Call trace:
   snd_soc_find_dai+0xe4/0xf0
   snd_soc_dai_link_set_capabilities+0x68/0x160
   axg_card_add_link+0x188/0x5c4 [snd_soc_meson_axg_sound_card]
   meson_card_probe+0x1e0/0x960 [snd_soc_meson_card_utils]
   platform_drv_probe+0x50/0xa8
   really_probe+0x110/0x400
   driver_probe_device+0x54/0xb8
   __device_attach_driver+0x90/0xc0
   bus_for_each_drv+0x70/0xc8
   __device_attach+0xec/0x150
   device_initial_probe+0x10/0x18
   bus_probe_device+0x94/0xa0
   deferred_probe_work_func+0x70/0xa8
   process_one_work+0x2a8/0x718
   worker_thread+0x48/0x460
   kthread+0x134/0x160
   ret_from_fork+0x10/0x1c
irq event stamp: 269690
hardirqs last  enabled at (269689): [<ffff800010f6048c>]
_raw_spin_unlock_irqrestore+0x7c/0x98
hardirqs last disabled at (269690): [<ffff800010025a68>]
do_debug_exception+0x140/0x26c
softirqs last  enabled at (269318): [<ffff800010001654>]
efi_header_end+0x654/0x6d4
softirqs last disabled at (269313): [<ffff80001008929c>]
irq_exit+0x16c/0x178
---[ end trace 56a3ea4fa00c37c8 ]---
Quoted 4 lines

...
axg-sound-card sound: ASoC: no DMI vendor name!

The warning is repeated 10 times.

That's the probe defferal mechanism causing the repeat

Quoted 9 lines

The bisect between v5.8-rc1 and v5.9-rc1 points to the commit c8f7dbdbaa15 ("Merge remote-tracking branch 'asoc/for-5.8' into asoc-linus"), which introduced a branch with this patch.

The commit with this patch is applied on the earlier kernel release (da3f23fde9d7 "ASoC: meson: cards: deal dpcm flag change" on top of v5.7-rc1) worked fine, so it looks that there is an interference with something merged later.

Quoted 8 lines
Quoted 2 lines

If I revert this patch on top of v5.9-rc1 or current linux-next, the warning is gone.

... but any aml platform with uni-directional backend (not the N2, lucky you) would be broken.

Quoted 1 line

Let me know how I can help debugging this issue.

If you have CONFIG_LOCKDEP enabled, try disabling see how it goes and report. It is not a fix but at least you'll be unblocked.

Right, disabling LOCKDEP hides it. The issue is not a problem for me. I've just added OdroidN2 to my test machines and wanted to report what I found and help fixing it.

Best regards

Signature · 8 lines
Marek Szyprowski, PhD
Samsung R&D Institute Poland


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic