ASoC: arizona: Calculate OUTDIV first
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Fri, 7 Mar 2014 16:34:22 +0000 (16:34 +0000)
committerMark Brown <broonie@linaro.org>
Sun, 9 Mar 2014 08:28:06 +0000 (08:28 +0000)
OUTDIV will remain unchanged whilst the rest of the FLL configuration is
calculated so do this first.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/arizona.c

index 7b1354ae337b78681b2a1524750b02c5750358e7..1f106abf1bb0b76751f20b8c01aad079c0f06d60 100644 (file)
@@ -1415,6 +1415,18 @@ static int arizona_calc_fll(struct arizona_fll *fll,
 
        arizona_fll_dbg(fll, "Fref=%u Fout=%u\n", Fref, fll->fout);
 
+       /* Fvco should be over the targt; don't check the upper bound */
+       div = ARIZONA_FLL_MIN_OUTDIV;
+       while (fll->fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) {
+               div++;
+               if (div > ARIZONA_FLL_MAX_OUTDIV)
+                       return -EINVAL;
+       }
+       target = fll->fout * div / fll->vco_mult;
+       cfg->outdiv = div;
+
+       arizona_fll_dbg(fll, "Fvco=%dHz\n", target);
+
        /* Fref must be <=13.5MHz */
        div = 1;
        cfg->refdiv = 0;
@@ -1429,18 +1441,6 @@ static int arizona_calc_fll(struct arizona_fll *fll,
        /* Apply the division for our remaining calculations */
        Fref /= div;
 
-       /* Fvco should be over the targt; don't check the upper bound */
-       div = ARIZONA_FLL_MIN_OUTDIV;
-       while (fll->fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) {
-               div++;
-               if (div > ARIZONA_FLL_MAX_OUTDIV)
-                       return -EINVAL;
-       }
-       target = fll->fout * div / fll->vco_mult;
-       cfg->outdiv = div;
-
-       arizona_fll_dbg(fll, "Fvco=%dHz\n", target);
-
        /* Find an appropraite FLL_FRATIO and factor it out of the target */
        for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) {
                if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) {
This page took 0.029624 seconds and 5 git commands to generate.