Commit 6f49919d authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Mark Brown

ASoC: max98090: exit workaround earlier if PLL is locked

According to the datasheet, PLL lock time typically takes 2 msec and
at most takes 7 msec.

Check the lock status every 1 msec and exit the workaround if PLL is
locked.
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20191122073114.219945-3-tzungbi@google.comReviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent acb874a7
...@@ -2108,6 +2108,8 @@ static void max98090_pll_work(struct work_struct *work) ...@@ -2108,6 +2108,8 @@ static void max98090_pll_work(struct work_struct *work)
struct max98090_priv *max98090 = struct max98090_priv *max98090 =
container_of(work, struct max98090_priv, pll_work); container_of(work, struct max98090_priv, pll_work);
struct snd_soc_component *component = max98090->component; struct snd_soc_component *component = max98090->component;
unsigned int pll;
int i;
if (!snd_soc_component_is_active(component)) if (!snd_soc_component_is_active(component))
return; return;
...@@ -2127,8 +2129,16 @@ static void max98090_pll_work(struct work_struct *work) ...@@ -2127,8 +2129,16 @@ static void max98090_pll_work(struct work_struct *work)
snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN, snd_soc_component_update_bits(component, M98090_REG_DEVICE_SHUTDOWN,
M98090_SHDNN_MASK, M98090_SHDNN_MASK); M98090_SHDNN_MASK, M98090_SHDNN_MASK);
for (i = 0; i < 10; ++i) {
/* Give PLL time to lock */ /* Give PLL time to lock */
msleep(10); usleep_range(1000, 1200);
/* Check lock status */
pll = snd_soc_component_read32(
component, M98090_REG_DEVICE_STATUS);
if (!(pll & M98090_ULK_MASK))
break;
}
} }
static void max98090_jack_work(struct work_struct *work) static void max98090_jack_work(struct work_struct *work)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment