summaryrefslogtreecommitdiff
path: root/sound/soc/sunxi/sun4i-codec.c
diff options
context:
space:
mode:
authorGeorgii Staroselskii <georgii.staroselskii@emlid.com>2019-05-28 13:47:39 +0300
committerMark Brown <broonie@kernel.org>2019-05-29 16:31:32 +0100
commit1f2675f6655838aaf910f911fd0abc821e3ff3df (patch)
treee7602f78859b783da5106a2fe0dd76ed6c7f8f83 /sound/soc/sunxi/sun4i-codec.c
parentbe1b577d01787c67acc6dd1257588183386a08f4 (diff)
downloadlwn-1f2675f6655838aaf910f911fd0abc821e3ff3df.tar.gz
lwn-1f2675f6655838aaf910f911fd0abc821e3ff3df.zip
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>
Diffstat (limited to 'sound/soc/sunxi/sun4i-codec.c')
-rw-r--r--sound/soc/sunxi/sun4i-codec.c9
1 files changed, 9 insertions, 0 deletions
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;
}