summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorOleksandr Suvorov <oleksandr.suvorov@toradex.com>2019-05-03 11:15:06 +0300
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2020-04-15 01:24:38 +0200
commit8e4179bae7730f3bca6ba80e2a4106a395a0e7c9 (patch)
treeae66c9523ad0db4ccd59a57fd22afb5e22dd4fd1 /sound
parentb44e234290c2e93882ba3844108b2ef2bb296e11 (diff)
ASoC: sgtl5000: Fix leading and trailing pops
- increase trailing delay after VAG power down to reduce trailing pop; - mute HP/LINE output before VAG power up. Related to: #48500 Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/sgtl5000.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index a78996a4c85d..aa8bbcdc7228 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -35,6 +35,8 @@
#define SGTL5000_DAP_REG_OFFSET 0x0100
#define SGTL5000_MAX_REG_OFFSET 0x013A
+#define SGTL5000_VAG_POWERDOWN_TIME 500 /* ms */
+
/* default value of sgtl5000 registers */
static const struct reg_default sgtl5000_reg_defaults[] = {
{ SGTL5000_CHIP_DIG_POWER, 0x0000 },
@@ -161,13 +163,21 @@ static int power_vag_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
- const u32 mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;
+ const u32 power_mask = SGTL5000_DAC_POWERUP | SGTL5000_ADC_POWERUP;
+ const u32 mute_mask = SGTL5000_HP_MUTE | SGTL5000_LINE_OUT_MUTE;
+ static int reg = 0;
switch (event) {
- case SND_SOC_DAPM_POST_PMU:
+ case SND_SOC_DAPM_PRE_PMU:
+ reg = snd_soc_read(codec, SGTL5000_CHIP_ANA_CTRL);
+ snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_CTRL,
+ mute_mask, mute_mask);
snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP);
- msleep(400);
+ break;
+ case SND_SOC_DAPM_POST_PMU:
+ snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_CTRL,
+ mute_mask, reg);
break;
case SND_SOC_DAPM_PRE_PMD:
/*
@@ -176,10 +186,10 @@ static int power_vag_event(struct snd_soc_dapm_widget *w,
* other one of them.
*/
if ((snd_soc_read(codec, SGTL5000_CHIP_ANA_POWER) &
- mask) != mask) {
+ power_mask) != power_mask) {
snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
SGTL5000_VAG_POWERUP, 0);
- msleep(400);
+ msleep(SGTL5000_VAG_POWERDOWN_TIME);
}
break;
default: