Skip to contentSkip to conversation

ASoC: msm8916-wcd-digital: Reset RX interpolation path after use

PATCH In review Stephan Gerhold 3 participants 5 messages Jan 5, 2020 – Jan 14, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: msm8916-wcd-digital: Reset RX interpolation path after use

For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc Srinivas Kandagatla <[email protected]>

---
Tested on msm8916-samsung-a5u:
- qdsp6 does no longer stop working after playing audio a few times
- lpass-cpu is still working fine (no difference)

---
 sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/soc/codecs/msm8916-wcd-digital.c +6 -0
index 58b2468fb2a7..09fccacadd6b 100644
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
 		snd_soc_component_write(component, rx_gain_reg[w->shift],
 			      snd_soc_component_read32(component, rx_gain_reg[w->shift]));
 		break;
+	case SND_SOC_DAPM_POST_PMD:
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 1 << w->shift);
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 0x0);
+		break;
 	}
 	return 0;
 }
Signature · 6 lines
2.24.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw
Quoted 14 lines · Stephan Gerhold

For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.

Quoted 6 lines

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc Srinivas Kandagatla <[email protected]>

Thanks for the patch and testing it with QDSP6.

Quoted 13 lines

---
Tested on msm8916-samsung-a5u:
- qdsp6 does no longer stop working after playing audio a few times
- lpass-cpu is still working fine (no difference)

---
  sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++
  1 file changed, 6 insertions(+)
sound/soc/codecs/msm8916-wcd-digital.c +0 -0
index 58b2468fb2a7..09fccacadd6b 100644

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_enable_interpolator( · line 589

Quoted 4 lines
sound/soc/codecs/msm8916-wcd-digital.c +1 -0
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
  		snd_soc_component_write(component, rx_gain_reg[w->shift],
  			      snd_soc_component_read32(component, rx_gain_reg[w->shift]));
  		break;
+	case SND_SOC_DAPM_POST_PMD:

We should do this in SND_SOC_DAPM_PRE_PMU rather than in power down sequence.

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_enable_interpolator( · line 597

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +5 -0
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 1 << w->shift);
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 0x0);
+		break;
  	}
  	return 0;
  }

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 34 lines · Srinivas Kandagatla
Quoted 14 lines · Stephan Gerhold

For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.

Quoted 6 lines

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc Srinivas Kandagatla <[email protected]>

Thanks for the patch and testing it with QDSP6.

Quoted 8 lines

---
Tested on msm8916-samsung-a5u:
- qdsp6 does no longer stop working after playing audio a few times
- lpass-cpu is still working fine (no difference)

---
  sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++
  1 file changed, 6 insertions(+)
Quoted 13 lines

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_enable_interpolator( · line 589

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +1 -0
index 58b2468fb2a7..09fccacadd6b 100644
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
  		snd_soc_component_write(component, rx_gain_reg[w->shift],
  			      snd_soc_component_read32(component, rx_gain_reg[w->shift]));
  		break;
+	case SND_SOC_DAPM_POST_PMD:

We should do this in SND_SOC_DAPM_PRE_PMU rather than in power down sequence.

Thanks for the suggestion! Any particular reason for this?

I used earlier versions of your msm8916-wcd patch series and the downstream driver as a base, and it does this in POST_PMD:

https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/sound/soc/codecs/msm8x16-wcd.c?h=LA.BR.1.2.9.1-02310-8x16.0#n3773

For msm8916_wcd_digital_enable_dec() we also do it in POST_PMD:

	/* ... */
	case SND_SOC_DAPM_POST_PMD:
		snd_soc_component_update_bits(component, dec_reset_reg, 1 << w->shift,
				    1 << w->shift);
		snd_soc_component_update_bits(component, dec_reset_reg, 1 << w->shift, 0x0);
		/* ... */

I don't mind testing if moving it to PRE_PMU works, I'm just wondering if doing it in PRE_PMU has any advantages.

Quoted 10 lines

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_enable_interpolator( · line 597

Quoted 10 lines
sound/soc/codecs/msm8916-wcd-digital.c +5 -0
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 1 << w->shift);
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 0x0);
+		break;
  	}
  	return 0;
  }

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 49 lines · Stephan Gerhold
Quoted 34 lines · Srinivas Kandagatla
Quoted 14 lines · Stephan Gerhold

For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.

Quoted 6 lines

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc Srinivas Kandagatla <[email protected]>

Thanks for the patch and testing it with QDSP6.

Quoted 8 lines

---
Tested on msm8916-samsung-a5u:
- qdsp6 does no longer stop working after playing audio a few times
- lpass-cpu is still working fine (no difference)

---
   sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++
   1 file changed, 6 insertions(+)
Quoted 13 lines

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_enable_interpolator( · line 589

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +1 -0
index 58b2468fb2a7..09fccacadd6b 100644
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
   		snd_soc_component_write(component, rx_gain_reg[w->shift],
   			      snd_soc_component_read32(component, rx_gain_reg[w->shift]));
   		break;
+	case SND_SOC_DAPM_POST_PMD:

We should do this in SND_SOC_DAPM_PRE_PMU rather than in power down sequence.

Quoted 4 lines

Thanks for the suggestion! Any particular reason for this?

I used earlier versions of your msm8916-wcd patch series and the downstream driver as a base, and it does this in POST_PMD:

Normally I would have expected that we reset as part of up sequence and continue rather than during down. Both of them will work!
For consistency reasons as we did this in down path for TX.

Thanks,
srini
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#4 lore raw

[alsa-devel] Applied "ASoC: msm8916-wcd-digital: Reset RX interpolation path after use" to the asoc tree

In reply to Stephan Gerhold

The patch

ASoC: msm8916-wcd-digital: Reset RX interpolation path after use

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 85578bbd642f65065039b1765ebe1a867d5435b0 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Sun, 5 Jan 2020 11:27:53 +0100
Subject: [PATCH] ASoC: msm8916-wcd-digital: Reset RX interpolation path after
use

For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.

So far I was not able to reproduce the problem when using lpass-cpu.

The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.

Fix this problem by adding the reset to
msm8916_wcd_digital_enable_interpolator().

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Cc Srinivas Kandagatla <[email protected]>
---
 sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++
 1 file changed, 6 insertions(+)
sound/soc/codecs/msm8916-wcd-digital.c +6 -0
index 58b2468fb2a7..09fccacadd6b 100644
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(
 		snd_soc_component_write(component, rx_gain_reg[w->shift],
 			      snd_soc_component_read32(component, rx_gain_reg[w->shift]));
 		break;
+	case SND_SOC_DAPM_POST_PMD:
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 1 << w->shift);
+		snd_soc_component_update_bits(component, LPASS_CDC_CLK_RX_RESET_CTL,
+					      1 << w->shift, 0x0);
+		break;
 	}
 	return 0;
 }
Signature · 6 lines
2.20.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel