Skip to contentSkip to conversation

ASoC: arizona: Add 32uS delay after putting FLL into freerun

PATCH In review Charles Keepax 2 participants 3 messages Nov 26, 2015 – Nov 27, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: arizona: Add 32uS delay after putting FLL into freerun

When switching between two clock sources using the FLL freerun to smooth the transition we should wait 32uS after putting the FLL into freerun before we proceed. In practice we appear to be getting enough delay from the surrounding code, but better to make it explicit.

---
 sound/soc/codecs/arizona.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/codecs/arizona.c +1 -0
index e76ecc7..8cd448c 100644
@@ -2215,6 +2215,7 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 		regmap_update_bits_async(fll->arizona->regmap, fll->base + 1,
 					 ARIZONA_FLL1_FREERUN,
 					 ARIZONA_FLL1_FREERUN);
+		udelay(32);
 	}
 
 	/*
Signature · 1 line
1.7.2.5
maintainer
#1 lore raw
Quoted 4 lines · Charles Keepax

When switching between two clock sources using the FLL freerun to smooth the transition we should wait 32uS after putting the FLL into freerun before we proceed. In practice we appear to be getting enough delay from the surrounding code, but better to make it explicit.

You'll almost certainly get 32us from just setting up the I/O and also...

sound/soc/codecs/arizona.c static int arizona_enable_fll(struct arizona_fll *fll) · line 2218

Quoted 6 lines

+++ b/sound/soc/codecs/arizona.c

sound/soc/codecs/arizona.c +1 -0
@@ -2215,6 +2215,7 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 		regmap_update_bits_async(fll->arizona->regmap, fll->base + 1,
 					 ARIZONA_FLL1_FREERUN,
 					 ARIZONA_FLL1_FREERUN);
+		udelay(32);

...this won't do what you say it will - the I/O is asynchronous so what this will do is add a delay immediately after scheduling the I/O while the I/O is at best in progress and most likely before it is ever begun. You'd need to make the I/O synchronous to actually introduce the delay.

#2 lore raw
Quoted 9 lines · Mark Brown
Quoted 4 lines · Charles Keepax

When switching between two clock sources using the FLL freerun to smooth the transition we should wait 32uS after putting the FLL into freerun before we proceed. In practice we appear to be getting enough delay from the surrounding code, but better to make it explicit.

You'll almost certainly get 32us from just setting up the I/O and also...

Quoted 11 lines

sound/soc/codecs/arizona.c static int arizona_enable_fll(struct arizona_fll *fll) · line 2218

Quoted 6 lines

+++ b/sound/soc/codecs/arizona.c

sound/soc/codecs/arizona.c +1 -0
@@ -2215,6 +2215,7 @@ static int arizona_enable_fll(struct arizona_fll *fll)
 		regmap_update_bits_async(fll->arizona->regmap, fll->base + 1,
 					 ARIZONA_FLL1_FREERUN,
 					 ARIZONA_FLL1_FREERUN);
+		udelay(32);

...this won't do what you say it will - the I/O is asynchronous so what this will do is add a delay immediately after scheduling the I/O while the I/O is at best in progress and most likely before it is ever begun. You'd need to make the I/O synchronous to actually introduce the delay.

Oops.. missed that, apologies I will respin.

Thanks,
Charles