ASoC: arizona: Poll for FLL clock OK rather than use interrupts
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tue, 25 Aug 2015 11:43:48 +0000 (12:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Sep 2015 17:05:39 +0000 (10:05 -0700)
commitb3100c898181590cabc652a925d268c78a69b77a
tree3f50083d9e2081cf42e69f03a939d34707467915
parentd23f2688b991310d4f27d4abaf7769ea301c9a91
ASoC: arizona: Poll for FLL clock OK rather than use interrupts

commit 0e7659712836ca59b4735bc5cc94de38698a5e01 upstream.

The extcon driver takes the DAPM mutex from within the interrupt thread
in several places, which makes it possible to get into a situation where
the interrupt thread is blocked waiting on the DAPM mutex whilst a DAPM
sequence is running which is attempting to configure the FLL. In this
case the FLL completion can't be completed as as the IRQ handler is
ONE_SHOT, which cause the FLL lock to use the full time out (250mS) and
report that the process timed out.

It is not really practical to make the extcon driver not take the DAPM
mutex from within the interrupt thread, at least not without extensive
modification. So this patch fixes the issue by switching the wait for
the FLL lock to polling. A few fast polls are done first as the FLL
should lock quickly for a good quality reference clock, (indeed it hits
on the first poll on my system) and it will poll every 20mS after that
until it times out.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/codecs/arizona.c
sound/soc/codecs/arizona.h