summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/arizona.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2013-02-20 18:28:36 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-04 04:01:00 +0100
commitd122d6c974e35c940a638c26aa70bea363141d27 (patch)
treeb8fec25641d2c4adf08f0fc1c3dca491dce3f7f2 /sound/soc/codecs/arizona.c
parentASoC: arizona: Tidy up SYNCCLK selection and cache values (diff)
downloadlinux-d122d6c974e35c940a638c26aa70bea363141d27.tar.xz
linux-d122d6c974e35c940a638c26aa70bea363141d27.zip
ASoC: arizona: Factor out check for enabled FLL
In preparation for additional features on the FLL this patch factors out the code which checks if an FLL is currently enabled into a seperate function. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r--sound/soc/codecs/arizona.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 03076efa4d9e..4640bccbfba2 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1074,12 +1074,27 @@ static void arizona_apply_fll(struct arizona *arizona, unsigned int base,
ARIZONA_FLL1_CTRL_UPD | cfg->n);
}
+static bool arizona_is_enabled_fll(struct arizona_fll *fll)
+{
+ struct arizona *arizona = fll->arizona;
+ unsigned int reg;
+ int ret;
+
+ ret = regmap_read(arizona->regmap, fll->base + 1, &reg);
+ if (ret != 0) {
+ arizona_fll_err(fll, "Failed to read current state: %d\n",
+ ret);
+ return ret;
+ }
+
+ return reg & ARIZONA_FLL1_ENA;
+}
+
int arizona_set_fll(struct arizona_fll *fll, int source,
unsigned int Fref, unsigned int Fout)
{
struct arizona *arizona = fll->arizona;
struct arizona_fll_cfg ref, sync;
- unsigned int reg;
bool ena;
int ret;
@@ -1111,13 +1126,7 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
fll->sync_freq = Fref;
}
- ret = regmap_read(arizona->regmap, fll->base + 1, &reg);
- if (ret != 0) {
- arizona_fll_err(fll, "Failed to read current state: %d\n",
- ret);
- return ret;
- }
- ena = reg & ARIZONA_FLL1_ENA;
+ ena = arizona_is_enabled_fll(fll);
if (Fout) {
regmap_update_bits(arizona->regmap, fll->base + 5,