linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Speaker pops with max98357a on rk3399-gru-kevin since v5.7
@ 2020-07-16 11:49 Alper Nebi Yasak
  2020-07-17  2:27 ` Tzung-Bi Shih
  0 siblings, 1 reply; 5+ messages in thread
From: Alper Nebi Yasak @ 2020-07-16 11:49 UTC (permalink / raw)
  To: Tzung-Bi Shih, Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Heiko Stuebner,
	Alper Nebi Yasak, alsa-devel, linux-kernel, linux-rockchip

Hi,

I have been getting "pop" sounds from the speaker on my rk3399-gru-kevin
for a while, and bisected it to 128f825aeab7 ("ASoC: max98357a: move
control of SD_MODE to DAPM"), but looks like the pops were somewhat
expected:

On 12 Feb 2020 13:55:15 +0800, Tzung-Bi Shih wrote [1]:
> Possible drawback: may generate pop noise when BCLK=on but LRCLK=off.
> As the datasheet[2] mentioned:
> > Do not remove LRCLK while BCLK is present.
> > Removing LRCLK while BCLK is present can cause unexpected output behavior
> > including a large DC output voltage.

[1] https://lore.kernel.org/alsa-devel/20200212055517.122728-1-tzungbi@google.com/

As of v5.8-rc5 I'm still getting the speaker pops. More info below, but
not all pops coincide with "set sdmode" messages, and vice versa.
Reverting that commit stops the pops, but then the "Speakers Switch" can
no longer mute the speakers.

I don't really know much about these things, could anyone have a look at
it? I'll try to read relevant documentation and code to make sense of it,
but wanted to send an email in case there is an immediately obvious
solution (besides reverting) and maybe just nobody had the time to
implement it yet.

Thanks in advance.

---

I've experimented a bit on a Debian userspace (with #define DEBUG 1
to get sdmode messages), here's what happens without PulseAudio:
- When playback starts, speaker pops with "set sdmode to 1".
- During playback, toggling "Speakers Switch" sets sdmode to 0/1 and
  mutes/unmutes speakers without any pops.
- Pausing/resuming playback (like seeking on a media player) make pops
  without changing sdmode. Also pops when playback ends (e.g. when
  "speaker-test -l 1" quits).
- A few seconds after playback ends, speaker pops for the last time with
  "set sdmode to 0".
- Within that few seconds, toggling "Speakers Switch" sets sdmode to 0/1
  and makes a pop each time.

It's mostly the same with PulseAudio but:
- Pause/resume during playback doesn't make any pops.
- The penultimate pop happens a few seconds after playback stops, when
  PA says it's suspending the max98357a device (no sdmode changes).
- The final pop comes a few seconds after that (still with "set sdmode
  to 0").

Even without any playback it makes several pops during boot when e.g.
PulseAudio starts/stops running in the display manager or in the user
session.

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

* Re: Speaker pops with max98357a on rk3399-gru-kevin since v5.7
  2020-07-16 11:49 Speaker pops with max98357a on rk3399-gru-kevin since v5.7 Alper Nebi Yasak
@ 2020-07-17  2:27 ` Tzung-Bi Shih
  2020-07-20 22:40   ` Alper Nebi Yasak
  0 siblings, 1 reply; 5+ messages in thread
From: Tzung-Bi Shih @ 2020-07-17  2:27 UTC (permalink / raw)
  To: Alper Nebi Yasak
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Heiko Stuebner, ALSA development, Linux Kernel Mailing List,
	linux-rockchip

On Thu, Jul 16, 2020 at 7:49 PM Alper Nebi Yasak
<alpernebiyasak@gmail.com> wrote:
> I have been getting "pop" sounds from the speaker on my rk3399-gru-kevin
> for a while, and bisected it to 128f825aeab7 ("ASoC: max98357a: move
> control of SD_MODE to DAPM"), but looks like the pops were somewhat
> expected:

I am not convinced the pop comes from 128f825aeab7.

> As of v5.8-rc5 I'm still getting the speaker pops. More info below, but
> not all pops coincide with "set sdmode" messages, and vice versa.
> Reverting that commit stops the pops, but then the "Speakers Switch" can
> no longer mute the speakers.

(I don't have a rk3399-gru-kevin so I got another test machine with MAX98357A.)
(I was testing with and without an audio server.)
Observations:
- I can hear the pop either with or without 128f825aeab7 (with and
without sdmode-delay).
- The pop noise is not always.  Higher probability after stopping
playback than before starting.
- As you also mentioned, the pop noise is not directly related to
SD_MODE transition.

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

* Re: Speaker pops with max98357a on rk3399-gru-kevin since v5.7
  2020-07-17  2:27 ` Tzung-Bi Shih
@ 2020-07-20 22:40   ` Alper Nebi Yasak
  2020-07-21 11:46     ` Tzung-Bi Shih
  0 siblings, 1 reply; 5+ messages in thread
From: Alper Nebi Yasak @ 2020-07-20 22:40 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Heiko Stuebner, ALSA development, Linux Kernel Mailing List,
	linux-rockchip

On 17/07/2020 05:27, Tzung-Bi Shih wrote:
> I am not convinced the pop comes from 128f825aeab7.

Maybe some pre-existing defect in rk3399_gru_sound got exposed by
128f825aeab7 or the machine driver needs some changes to complement
that commit?

> (I don't have a rk3399-gru-kevin so I got another test machine with MAX98357A.)
> (I was testing with and without an audio server.)

Your observations are also a bit different from mine, which IMO also
suggests the machine driver is the true culprit -- I'd guess the pops
you hear would be from a different problem in your test machine's
machine driver?

(Let me restate my observations to contrast with yours, as I feel my
previous explanation was too wordy:)

> Observations:
> - I can hear the pop either with or without 128f825aeab7 (with and
> without sdmode-delay).

I never hear pops without 128f825aeab7, but always hear pops with it.
(no change when I remove "sdmode-delay" from the device-tree)

> - The pop noise is not always.  Higher probability after stopping
> playback than before starting.

I always hear one pop when starting playback, and two pops (with a few
seconds between them) when stopping playback.

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

* Re: Speaker pops with max98357a on rk3399-gru-kevin since v5.7
  2020-07-20 22:40   ` Alper Nebi Yasak
@ 2020-07-21 11:46     ` Tzung-Bi Shih
  2020-07-21 13:31       ` Alper Nebi Yasak
  0 siblings, 1 reply; 5+ messages in thread
From: Tzung-Bi Shih @ 2020-07-21 11:46 UTC (permalink / raw)
  To: Alper Nebi Yasak
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Heiko Stuebner, ALSA development, Linux Kernel Mailing List,
	linux-rockchip

On Tue, Jul 21, 2020 at 6:40 AM Alper Nebi Yasak
<alpernebiyasak@gmail.com> wrote:
>
> On 17/07/2020 05:27, Tzung-Bi Shih wrote:
> > I am not convinced the pop comes from 128f825aeab7.
>
> Maybe some pre-existing defect in rk3399_gru_sound got exposed by
> 128f825aeab7 or the machine driver needs some changes to complement
> that commit?

Hi, I got a rk3399-gru-kevin and can reproduce the issue.

Could you take a try on the proposed patch here
https://patchwork.kernel.org/patch/11675533/ to see if it fixes?

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

* Re: Speaker pops with max98357a on rk3399-gru-kevin since v5.7
  2020-07-21 11:46     ` Tzung-Bi Shih
@ 2020-07-21 13:31       ` Alper Nebi Yasak
  0 siblings, 0 replies; 5+ messages in thread
From: Alper Nebi Yasak @ 2020-07-21 13:31 UTC (permalink / raw)
  To: Tzung-Bi Shih
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	Heiko Stuebner, ALSA development, Linux Kernel Mailing List,
	linux-rockchip

On 21/07/2020 14:46, Tzung-Bi Shih wrote:
> Hi, I got a rk3399-gru-kevin and can reproduce the issue.
> 
> Could you take a try on the proposed patch here
> https://patchwork.kernel.org/patch/11675533/ to see if it fixes?

It does eliminate the pops, thanks.

(I've replied to the patch, I am sending this for completeness as the Cc
list isn't exactly the same.)

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

end of thread, other threads:[~2020-07-21 13:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-16 11:49 Speaker pops with max98357a on rk3399-gru-kevin since v5.7 Alper Nebi Yasak
2020-07-17  2:27 ` Tzung-Bi Shih
2020-07-20 22:40   ` Alper Nebi Yasak
2020-07-21 11:46     ` Tzung-Bi Shih
2020-07-21 13:31       ` Alper Nebi Yasak

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).