All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
@ 2019-05-28 10:47 ` Georgii Staroselskii
  0 siblings, 0 replies; 9+ messages in thread
From: Georgii Staroselskii @ 2019-05-28 10:47 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, maxime.ripard, wens, dannym
  Cc: georgii.staroselskii, alsa-devel, linux-arm-kernel

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.

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.
+		 */
+		msleep(700);
+	}
+
 	return 0;
 }
 
-- 
2.7.4

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

* [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
@ 2019-05-28 10:47 ` Georgii Staroselskii
  0 siblings, 0 replies; 9+ messages in thread
From: Georgii Staroselskii @ 2019-05-28 10:47 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, maxime.ripard, wens, dannym
  Cc: georgii.staroselskii, alsa-devel, linux-arm-kernel

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.

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.
+		 */
+		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

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

* Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
  2019-05-28 10:47 ` Georgii Staroselskii
@ 2019-05-29  2:34   ` Chen-Yu Tsai
  -1 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2019-05-29  2:34 UTC (permalink / raw)
  To: Georgii Staroselskii, Mark Brown
  Cc: Linux-ALSA, Maxime Ripard, Danny Milosavljevic, Takashi Iwai,
	Liam Girdwood, Jaroslav Kysela, linux-arm-kernel

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
>

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

* Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
@ 2019-05-29  2:34   ` Chen-Yu Tsai
  0 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2019-05-29  2:34 UTC (permalink / raw)
  To: Georgii Staroselskii, Mark Brown
  Cc: Linux-ALSA, Maxime Ripard, Danny Milosavljevic, Takashi Iwai,
	Liam Girdwood, Jaroslav Kysela, linux-arm-kernel

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

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

* Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
  2019-05-29  2:34   ` Chen-Yu Tsai
  (?)
@ 2019-05-29 10:28   ` Mark Brown
  2019-05-29 12:14       ` Chen-Yu Tsai
  -1 siblings, 1 reply; 9+ messages in thread
From: Mark Brown @ 2019-05-29 10:28 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Linux-ALSA, Maxime Ripard, Danny Milosavljevic, Takashi Iwai,
	Liam Girdwood, Georgii Staroselskii, Jaroslav Kysela,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 353 bytes --]

On Wed, May 29, 2019 at 10:34:25AM +0800, Chen-Yu Tsai wrote:

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

Leaving the amplifier powered up all the time is going to burn a lot of
power and make any pop/click issues in the inputs more apparent.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

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

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

* Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
  2019-05-29 10:28   ` Mark Brown
@ 2019-05-29 12:14       ` Chen-Yu Tsai
  0 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2019-05-29 12:14 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linux-ALSA, Maxime Ripard, Danny Milosavljevic, Takashi Iwai,
	Liam Girdwood, Georgii Staroselskii, Jaroslav Kysela,
	linux-arm-kernel

On Wed, May 29, 2019 at 6:28 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, May 29, 2019 at 10:34:25AM +0800, Chen-Yu Tsai wrote:
>
> > 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.
>
> Leaving the amplifier powered up all the time is going to burn a lot of
> power and make any pop/click issues in the inputs more apparent.

Sounds like this patch is a better compromise. Thanks for the insight.

The patch is

Reviewed-by: Chen-Yu Tsai <wens@csie.org>

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

* Re: [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker
@ 2019-05-29 12:14       ` Chen-Yu Tsai
  0 siblings, 0 replies; 9+ messages in thread
From: Chen-Yu Tsai @ 2019-05-29 12:14 UTC (permalink / raw)
  To: Mark Brown
  Cc: Linux-ALSA, Maxime Ripard, Danny Milosavljevic, Takashi Iwai,
	Liam Girdwood, Georgii Staroselskii, Jaroslav Kysela,
	linux-arm-kernel

On Wed, May 29, 2019 at 6:28 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, May 29, 2019 at 10:34:25AM +0800, Chen-Yu Tsai wrote:
>
> > 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.
>
> Leaving the amplifier powered up all the time is going to burn a lot of
> power and make any pop/click issues in the inputs more apparent.

Sounds like this patch is a better compromise. Thanks for the insight.

The patch is

Reviewed-by: Chen-Yu Tsai <wens@csie.org>

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

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

* Applied "ASoC: sun4i-codec: fix first delay on Speaker" to the asoc tree
  2019-05-28 10:47 ` Georgii Staroselskii
@ 2019-05-29 15:45   ` Mark Brown
  -1 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-05-29 15:45 UTC (permalink / raw)
  Cc: alsa-devel, maxime.ripard, dannym, tiwai, lgirdwood, perex,
	georgii.staroselskii, wens, Mark Brown, linux-arm-kernel

The patch

   ASoC: sun4i-codec: fix first delay on Speaker

has been applied to the asoc tree at

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

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 1f2675f6655838aaf910f911fd0abc821e3ff3df Mon Sep 17 00:00:00 2001
From: Georgii Staroselskii <georgii.staroselskii@emlid.com>
Date: Tue, 28 May 2019 13:47:39 +0300
Subject: [PATCH] ASoC: sun4i-codec: fix first delay on Speaker

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.

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>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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 15d08e343b47..28d2f7713f8d 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1329,6 +1329,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.
+		 */
+		msleep(700);
+	}
+
 	return 0;
 }
 
-- 
2.20.1

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

* Applied "ASoC: sun4i-codec: fix first delay on Speaker" to the asoc tree
@ 2019-05-29 15:45   ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2019-05-29 15:45 UTC (permalink / raw)
  To: Georgii Staroselskii
  Cc: alsa-devel, maxime.ripard, dannym, tiwai, lgirdwood, perex,
	georgii.staroselskii, wens, Mark Brown, linux-arm-kernel

The patch

   ASoC: sun4i-codec: fix first delay on Speaker

has been applied to the asoc tree at

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

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 1f2675f6655838aaf910f911fd0abc821e3ff3df Mon Sep 17 00:00:00 2001
From: Georgii Staroselskii <georgii.staroselskii@emlid.com>
Date: Tue, 28 May 2019 13:47:39 +0300
Subject: [PATCH] ASoC: sun4i-codec: fix first delay on Speaker

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.

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>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 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 15d08e343b47..28d2f7713f8d 100644
--- a/sound/soc/sunxi/sun4i-codec.c
+++ b/sound/soc/sunxi/sun4i-codec.c
@@ -1329,6 +1329,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.
+		 */
+		msleep(700);
+	}
+
 	return 0;
 }
 
-- 
2.20.1


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

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

end of thread, other threads:[~2019-05-29 15:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-28 10:47 [PATCH v2] ASoC: sun4i-codec: fix first delay on Speaker Georgii Staroselskii
2019-05-28 10:47 ` Georgii Staroselskii
2019-05-29  2:34 ` Chen-Yu Tsai
2019-05-29  2:34   ` Chen-Yu Tsai
2019-05-29 10:28   ` Mark Brown
2019-05-29 12:14     ` Chen-Yu Tsai
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
2019-05-29 15:45   ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.