* [RFC PATCH 0/2] wcd937x codec fixes
@ 2024-10-22 3:31 Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 1/2] ASoC: codecs: wcd937x: add missing LO Switch control Alexey Klimov
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Alexey Klimov @ 2024-10-22 3:31 UTC (permalink / raw)
To: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs
Cc: linux-sound, krzysztof.kozlowski, lgirdwood, broonie, perex,
tiwai, dmitry.baryshkov, linux-kernel
This sent as RFC because of the following:
- regarding the LO switch patch. I've got info about that from two persons
independently hence not sure what tags to put there and who should be
the author. Please let me know if that needs to be corrected.
- the wcd937x pdm watchdog is a problem for audio playback and needs to be
fixed. The minimal fix would be to at least increase timeout value but
it will still trigger in case of plenty of dbg messages or other
delay-generating things. Unfortunately, I can't test HPHL/R outputs hence
the patch is only for AUX. The other options would be introducing
module parameter for debugging and using HOLD_OFF bit for that or
adding Kconfig option.
Alexey Klimov (2):
ASoC: codecs: wcd937x: add missing LO Switch control
ASoC: codecs: wcd937x: relax the AUX PDM watchdog
sound/soc/codecs/wcd937x.c | 12 ++++++++++--
sound/soc/codecs/wcd937x.h | 4 ++++
2 files changed, 14 insertions(+), 2 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC PATCH 1/2] ASoC: codecs: wcd937x: add missing LO Switch control
2024-10-22 3:31 [RFC PATCH 0/2] wcd937x codec fixes Alexey Klimov
@ 2024-10-22 3:31 ` Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 2/2] ASoC: codecs: wcd937x: relax the AUX PDM watchdog Alexey Klimov
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Alexey Klimov @ 2024-10-22 3:31 UTC (permalink / raw)
To: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs
Cc: linux-sound, krzysztof.kozlowski, lgirdwood, broonie, perex,
tiwai, dmitry.baryshkov, linux-kernel
The wcd937x supports also AUX input but the control that sets correct
soundwire port for this is missing. This control is required for audio
playback, for instance, on qrb4210 RB2 board as well as on other
SoCs.
Reported-by: Adam Skladowski <a39.skl@gmail.com>
Reported-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Suggested-by: Adam Skladowski <a39.skl@gmail.com>
Suggested-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Cc: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
sound/soc/codecs/wcd937x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index 45f32d281908..0f0d2537d322 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -2049,6 +2049,8 @@ static const struct snd_kcontrol_new wcd937x_snd_controls[] = {
wcd937x_get_swr_port, wcd937x_set_swr_port),
SOC_SINGLE_EXT("HPHR Switch", WCD937X_HPH_R, 0, 1, 0,
wcd937x_get_swr_port, wcd937x_set_swr_port),
+ SOC_SINGLE_EXT("LO Switch", WCD937X_LO, 0, 1, 0,
+ wcd937x_get_swr_port, wcd937x_set_swr_port),
SOC_SINGLE_EXT("ADC1 Switch", WCD937X_ADC1, 1, 1, 0,
wcd937x_get_swr_port, wcd937x_set_swr_port),
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [RFC PATCH 2/2] ASoC: codecs: wcd937x: relax the AUX PDM watchdog
2024-10-22 3:31 [RFC PATCH 0/2] wcd937x codec fixes Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 1/2] ASoC: codecs: wcd937x: add missing LO Switch control Alexey Klimov
@ 2024-10-22 3:31 ` Alexey Klimov
2024-10-22 23:21 ` [RFC PATCH 0/2] wcd937x codec fixes Mark Brown
2024-10-29 20:35 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Alexey Klimov @ 2024-10-22 3:31 UTC (permalink / raw)
To: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs
Cc: linux-sound, krzysztof.kozlowski, lgirdwood, broonie, perex,
tiwai, dmitry.baryshkov, linux-kernel
On a system with wcd937x, rxmacro and Qualcomm audio DSP, which is pretty
common set of devices on Qualcomm platforms, and due to the order of how
DAPM widgets are powered on (they are sorted), there is a small time window
when wcd937x chip is online and expects the flow of incoming data but
rxmacro is not yet online. When wcd937x is programmed to receive data
via AUX port then its AUX PDM watchdog is enabled in
wcd937x_codec_enable_aux_pa(). If due to some reasons the rxmacro and
soundwire machinery are delayed to start streaming data, then there is
a chance for this AUX PDM watchdog to reset the wcd937x codec. Such event
is not logged as a message and only wcd937x IRQ counter is increased
however there could be a lot of other reasons for that IRQ.
There is a similar opportunity for such delay during DAPM widgets power
down sequence.
If wcd937x codec reset happens on the start of the playback, then there
will be no sound and if such reset happens at the end of a playback then
it may generate additional clicks and pops noises.
On qrb4210 RB2 board without any debugging bits the wcd937x resets are
sometimes observed at the end of a playback though not always.
With some debugging messages or with some tracing enabled the AUX PDM
watchdog resets the wcd937x codec at the start of a playback and there
is no sound output at all.
In this patch:
- TIMEOUT_SEL bit in PDM_WD_CTL2 register is set to increase the watchdog
reset delay to 100ms which eliminates the AUX PDM watchdog IRQs on
qrb4210 RB2 board completely and decreases the number of unwanted clicks
noises;
- HOLD_OFF bit postpones triggering such watchdog IRQ till wcd937x codec
reset which usually happens at the end of a playback. This allows to
actually output some sound in case of debugging.
Cc: Adam Skladowski <a39.skl@gmail.com>
Cc: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Cc: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
---
sound/soc/codecs/wcd937x.c | 10 ++++++++--
sound/soc/codecs/wcd937x.h | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index 0f0d2537d322..08fb13a334a4 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -715,12 +715,17 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct wcd937x_priv *wcd937x = snd_soc_component_get_drvdata(component);
int hph_mode = wcd937x->hph_mode;
+ u8 val;
switch (event) {
case SND_SOC_DAPM_PRE_PMU:
+ val = WCD937X_DIGITAL_PDM_WD_CTL2_EN |
+ WCD937X_DIGITAL_PDM_WD_CTL2_TIMEOUT_SEL |
+ WCD937X_DIGITAL_PDM_WD_CTL2_HOLD_OFF;
snd_soc_component_update_bits(component,
WCD937X_DIGITAL_PDM_WD_CTL2,
- BIT(0), BIT(0));
+ WCD937X_DIGITAL_PDM_WD_CTL2_MASK,
+ val);
break;
case SND_SOC_DAPM_POST_PMU:
usleep_range(1000, 1010);
@@ -741,7 +746,8 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w,
hph_mode);
snd_soc_component_update_bits(component,
WCD937X_DIGITAL_PDM_WD_CTL2,
- BIT(0), 0x00);
+ WCD937X_DIGITAL_PDM_WD_CTL2_MASK,
+ 0x00);
break;
}
diff --git a/sound/soc/codecs/wcd937x.h b/sound/soc/codecs/wcd937x.h
index 35f3d48bd7dd..4afa48dcaf74 100644
--- a/sound/soc/codecs/wcd937x.h
+++ b/sound/soc/codecs/wcd937x.h
@@ -391,6 +391,10 @@
#define WCD937X_DIGITAL_PDM_WD_CTL0 0x3465
#define WCD937X_DIGITAL_PDM_WD_CTL1 0x3466
#define WCD937X_DIGITAL_PDM_WD_CTL2 0x3467
+#define WCD937X_DIGITAL_PDM_WD_CTL2_HOLD_OFF BIT(2)
+#define WCD937X_DIGITAL_PDM_WD_CTL2_TIMEOUT_SEL BIT(1)
+#define WCD937X_DIGITAL_PDM_WD_CTL2_EN BIT(0)
+#define WCD937X_DIGITAL_PDM_WD_CTL2_MASK GENMASK(2, 0)
#define WCD937X_DIGITAL_INTR_MODE 0x346A
#define WCD937X_DIGITAL_INTR_MASK_0 0x346B
#define WCD937X_DIGITAL_INTR_MASK_1 0x346C
--
2.45.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCH 0/2] wcd937x codec fixes
2024-10-22 3:31 [RFC PATCH 0/2] wcd937x codec fixes Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 1/2] ASoC: codecs: wcd937x: add missing LO Switch control Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 2/2] ASoC: codecs: wcd937x: relax the AUX PDM watchdog Alexey Klimov
@ 2024-10-22 23:21 ` Mark Brown
2024-11-01 13:33 ` Alexey Klimov
2024-10-29 20:35 ` Mark Brown
3 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2024-10-22 23:21 UTC (permalink / raw)
To: Alexey Klimov
Cc: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs,
linux-sound, krzysztof.kozlowski, lgirdwood, perex, tiwai,
dmitry.baryshkov, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
On Tue, Oct 22, 2024 at 04:31:29AM +0100, Alexey Klimov wrote:
> This sent as RFC because of the following:
>
> - regarding the LO switch patch. I've got info about that from two persons
> independently hence not sure what tags to put there and who should be
> the author. Please let me know if that needs to be corrected.
The tags are fine there.
Just as a general thing if two changes aren't directly related and don't
overlap at all it's usually better to send them separately to avoid
creating spurious dependencies which can slow down getting things
reviewed and merged.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC PATCH 0/2] wcd937x codec fixes
2024-10-22 3:31 [RFC PATCH 0/2] wcd937x codec fixes Alexey Klimov
` (2 preceding siblings ...)
2024-10-22 23:21 ` [RFC PATCH 0/2] wcd937x codec fixes Mark Brown
@ 2024-10-29 20:35 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2024-10-29 20:35 UTC (permalink / raw)
To: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs,
Alexey Klimov
Cc: linux-sound, krzysztof.kozlowski, lgirdwood, perex, tiwai,
dmitry.baryshkov, linux-kernel
On Tue, 22 Oct 2024 04:31:29 +0100, Alexey Klimov wrote:
> This sent as RFC because of the following:
>
> - regarding the LO switch patch. I've got info about that from two persons
> independently hence not sure what tags to put there and who should be
> the author. Please let me know if that needs to be corrected.
>
> - the wcd937x pdm watchdog is a problem for audio playback and needs to be
> fixed. The minimal fix would be to at least increase timeout value but
> it will still trigger in case of plenty of dbg messages or other
> delay-generating things. Unfortunately, I can't test HPHL/R outputs hence
> the patch is only for AUX. The other options would be introducing
> module parameter for debugging and using HOLD_OFF bit for that or
> adding Kconfig option.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: codecs: wcd937x: add missing LO Switch control
commit: 041db4bbe04e8e0b48350b3bbbd9a799794d5c1e
[2/2] ASoC: codecs: wcd937x: relax the AUX PDM watchdog
commit: 107a5c853eef5336a9846e7dd2f9184b6e3c07c7
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] 6+ messages in thread
* Re: [RFC PATCH 0/2] wcd937x codec fixes
2024-10-22 23:21 ` [RFC PATCH 0/2] wcd937x codec fixes Mark Brown
@ 2024-11-01 13:33 ` Alexey Klimov
0 siblings, 0 replies; 6+ messages in thread
From: Alexey Klimov @ 2024-11-01 13:33 UTC (permalink / raw)
To: Mark Brown
Cc: srinivas.kandagatla, quic_pkumpatl, a39.skl, quic_mohs,
linux-sound, krzysztof.kozlowski, lgirdwood, perex, tiwai,
dmitry.baryshkov, linux-kernel
Hi Mark,
On Wed Oct 23, 2024 at 12:21 AM BST, Mark Brown wrote:
> On Tue, Oct 22, 2024 at 04:31:29AM +0100, Alexey Klimov wrote:
> > This sent as RFC because of the following:
> >
> > - regarding the LO switch patch. I've got info about that from two persons
> > independently hence not sure what tags to put there and who should be
> > the author. Please let me know if that needs to be corrected.
>
> The tags are fine there.
>
> Just as a general thing if two changes aren't directly related and don't
> overlap at all it's usually better to send them separately to avoid
> creating spurious dependencies which can slow down getting things
> reviewed and merged.
Thank you. Noted. Yes, they are technically independent. They were
somehow connected in my head, something like "both are needed to have
working audio with lesser troubles". I'll try to keep not related and
not overlapping things separated.
Best regards,
Alexey
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-11-01 13:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 3:31 [RFC PATCH 0/2] wcd937x codec fixes Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 1/2] ASoC: codecs: wcd937x: add missing LO Switch control Alexey Klimov
2024-10-22 3:31 ` [RFC PATCH 2/2] ASoC: codecs: wcd937x: relax the AUX PDM watchdog Alexey Klimov
2024-10-22 23:21 ` [RFC PATCH 0/2] wcd937x codec fixes Mark Brown
2024-11-01 13:33 ` Alexey Klimov
2024-10-29 20:35 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox