linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [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
  2019-05-29 15:45 ` Applied "ASoC: sun4i-codec: fix first delay on Speaker" to the asoc tree Mark Brown
  0 siblings, 2 replies; 5+ 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] 5+ messages in thread

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

Thread overview: 5+ 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-29  2:34 ` Chen-Yu Tsai
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

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