diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2014-03-07 11:34:22 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-09 04:28:06 -0400 |
commit | f641aec62c948c7754429136ad176824fbb97238 (patch) | |
tree | f89418a2ac43b7356bc3ccee252df880ed3d096d | |
parent | 8ccefcd265b486186c94ea70c77511e7c570347d (diff) |
ASoC: arizona: Calculate OUTDIV first
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>
-rw-r--r-- | sound/soc/codecs/arizona.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 7b1354ae337b..1f106abf1bb0 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1415,6 +1415,18 @@ static int arizona_calc_fll(struct arizona_fll *fll, | |||
1415 | 1415 | ||
1416 | arizona_fll_dbg(fll, "Fref=%u Fout=%u\n", Fref, fll->fout); | 1416 | arizona_fll_dbg(fll, "Fref=%u Fout=%u\n", Fref, fll->fout); |
1417 | 1417 | ||
1418 | /* Fvco should be over the targt; don't check the upper bound */ | ||
1419 | div = ARIZONA_FLL_MIN_OUTDIV; | ||
1420 | while (fll->fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) { | ||
1421 | div++; | ||
1422 | if (div > ARIZONA_FLL_MAX_OUTDIV) | ||
1423 | return -EINVAL; | ||
1424 | } | ||
1425 | target = fll->fout * div / fll->vco_mult; | ||
1426 | cfg->outdiv = div; | ||
1427 | |||
1428 | arizona_fll_dbg(fll, "Fvco=%dHz\n", target); | ||
1429 | |||
1418 | /* Fref must be <=13.5MHz */ | 1430 | /* Fref must be <=13.5MHz */ |
1419 | div = 1; | 1431 | div = 1; |
1420 | cfg->refdiv = 0; | 1432 | cfg->refdiv = 0; |
@@ -1429,18 +1441,6 @@ static int arizona_calc_fll(struct arizona_fll *fll, | |||
1429 | /* Apply the division for our remaining calculations */ | 1441 | /* Apply the division for our remaining calculations */ |
1430 | Fref /= div; | 1442 | Fref /= div; |
1431 | 1443 | ||
1432 | /* Fvco should be over the targt; don't check the upper bound */ | ||
1433 | div = ARIZONA_FLL_MIN_OUTDIV; | ||
1434 | while (fll->fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) { | ||
1435 | div++; | ||
1436 | if (div > ARIZONA_FLL_MAX_OUTDIV) | ||
1437 | return -EINVAL; | ||
1438 | } | ||
1439 | target = fll->fout * div / fll->vco_mult; | ||
1440 | cfg->outdiv = div; | ||
1441 | |||
1442 | arizona_fll_dbg(fll, "Fvco=%dHz\n", target); | ||
1443 | |||
1444 | /* Find an appropraite FLL_FRATIO and factor it out of the target */ | 1444 | /* Find an appropraite FLL_FRATIO and factor it out of the target */ |
1445 | for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) { | 1445 | for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) { |
1446 | if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) { | 1446 | if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) { |