linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: Georgii Staroselskii <georgii.staroselskii@emlid.com>,
	Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Danny Milosavljevic <dannym@scratchpost.org>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
Date: Wed, 29 May 2019 10:34:25 +0800	[thread overview]
Message-ID: <CAGb2v64osE5yVdpCxSRfpkaq2TqeUUiLUbr3wZWW1rawuqxW-Q@mail.gmail.com> (raw)
In-Reply-To: <1559040459-16488-1-git-send-email-georgii.staroselskii@emlid.com>

On Tue, May 28, 2019 at 6:48 PM Georgii Staroselskii
<georgii.staroselskii@emlid.com> wrote:
>
> Allwinner DAC seems to have a delay in the Speaker audio routing. When
> playing a sound for the first time, the sound gets chopped. On a second
> play the sound is played correctly. After some time (~5s) the issue gets
> back.

FYI that is DAPM powering down the amp. You'll here a light pop when that
happens.

> This commit seems to be fixing the same issue as bf14da7 but
> for another codepath.
>
> This is the DTS that was used to debug the problem.
>
> &codec {
>         allwinner,pa-gpios = <&r_pio 0 11 GPIO_ACTIVE_HIGH>; /* PL11 */
>         allwinner,audio-routing =
>                 "Speaker", "LINEOUT";
>
>         status = "okay";
> }
>
> Signed-off-by: Georgii Staroselskii <georgii.staroselskii@emlid.com>
> ---
>  sound/soc/sunxi/sun4i-codec.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c
> index f2deffe..9e1f00e 100644
> --- a/sound/soc/sunxi/sun4i-codec.c
> +++ b/sound/soc/sunxi/sun4i-codec.c
> @@ -1320,6 +1320,15 @@ static int sun4i_codec_spk_event(struct snd_soc_dapm_widget *w,
>         gpiod_set_value_cansleep(scodec->gpio_pa,
>                                  !!SND_SOC_DAPM_EVENT_ON(event));
>
> +       if (SND_SOC_DAPM_EVENT_ON(event)) {
> +               /*
> +                * Need a delay to wait for DAC to push the data. 700ms seems
> +                * to be the best compromise not to feel this delay while
> +                * playing a sound.

It is not that the DAC is not pushing data, it's just the internal headphone
amp needs some time to charge up. So this patch basically adds a delay before
sound is actually pushed out, thereby preventing any sound from being silently
dropped. It doesn't help with the pop on power down though, and the latency
might not be that great.

I wonder if we shouldn't just keep the amplifier section powered up
all the time.
Also it seems not very many codec drivers go all out with DAPM.

Mark, any suggestions on the matter?

ChenYu


> +                */
> +               msleep(700);
> +       }
> +
>         return 0;
>  }
>
> --
> 2.7.4
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-05-29  2:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28 10:47 [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker Georgii Staroselskii
2019-05-29  2:34 ` Chen-Yu Tsai [this message]
2019-05-29 10:28   ` Mark Brown
2019-05-29 12:14     ` Chen-Yu Tsai
2019-05-29 15:45 ` Applied "ASoC: sun4i-codec: fix first delay on Speaker" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGb2v64osE5yVdpCxSRfpkaq2TqeUUiLUbr3wZWW1rawuqxW-Q@mail.gmail.com \
    --to=wens@csie.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dannym@scratchpost.org \
    --cc=georgii.staroselskii@emlid.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).