diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2014-03-07 11:34:18 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-09 04:28:06 -0400 |
commit | 87383ac5a73ff34c60d3ea483bf24cabb27fb522 (patch) | |
tree | 8abf165155b82cd4e291b8d1d8c12190cd573c51 | |
parent | da28ed585b26dc6eb0c8d897a9b842a86dd6a659 (diff) |
ASoC: arizona: Add defines for FLL configuration constants
Improve readability by adding defines for some of the constants
associated with FLL configuration.
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 | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index d90804686e4e..3d4408db075f 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -53,6 +53,12 @@ | |||
53 | #define ARIZONA_AIF_RX_ENABLES 0x1A | 53 | #define ARIZONA_AIF_RX_ENABLES 0x1A |
54 | #define ARIZONA_AIF_FORCE_WRITE 0x1B | 54 | #define ARIZONA_AIF_FORCE_WRITE 0x1B |
55 | 55 | ||
56 | #define ARIZONA_FLL_MAX_FREF 13500000 | ||
57 | #define ARIZONA_FLL_MIN_FVCO 90000000 | ||
58 | #define ARIZONA_FLL_MAX_REFDIV 8 | ||
59 | #define ARIZONA_FLL_MIN_OUTDIV 2 | ||
60 | #define ARIZONA_FLL_MAX_OUTDIV 7 | ||
61 | |||
56 | #define arizona_fll_err(_fll, fmt, ...) \ | 62 | #define arizona_fll_err(_fll, fmt, ...) \ |
57 | dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__) | 63 | dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__) |
58 | #define arizona_fll_warn(_fll, fmt, ...) \ | 64 | #define arizona_fll_warn(_fll, fmt, ...) \ |
@@ -1390,11 +1396,11 @@ static int arizona_calc_fll(struct arizona_fll *fll, | |||
1390 | /* Fref must be <=13.5MHz */ | 1396 | /* Fref must be <=13.5MHz */ |
1391 | div = 1; | 1397 | div = 1; |
1392 | cfg->refdiv = 0; | 1398 | cfg->refdiv = 0; |
1393 | while ((Fref / div) > 13500000) { | 1399 | while ((Fref / div) > ARIZONA_FLL_MAX_FREF) { |
1394 | div *= 2; | 1400 | div *= 2; |
1395 | cfg->refdiv++; | 1401 | cfg->refdiv++; |
1396 | 1402 | ||
1397 | if (div > 8) { | 1403 | if (div > ARIZONA_FLL_MAX_REFDIV) { |
1398 | arizona_fll_err(fll, | 1404 | arizona_fll_err(fll, |
1399 | "Can't scale %dMHz in to <=13.5MHz\n", | 1405 | "Can't scale %dMHz in to <=13.5MHz\n", |
1400 | Fref); | 1406 | Fref); |
@@ -1406,10 +1412,10 @@ static int arizona_calc_fll(struct arizona_fll *fll, | |||
1406 | Fref /= div; | 1412 | Fref /= div; |
1407 | 1413 | ||
1408 | /* Fvco should be over the targt; don't check the upper bound */ | 1414 | /* Fvco should be over the targt; don't check the upper bound */ |
1409 | div = 2; | 1415 | div = ARIZONA_FLL_MIN_OUTDIV; |
1410 | while (Fout * div < 90000000 * fll->vco_mult) { | 1416 | while (Fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) { |
1411 | div++; | 1417 | div++; |
1412 | if (div > 7) { | 1418 | if (div > ARIZONA_FLL_MAX_OUTDIV) { |
1413 | arizona_fll_err(fll, "No FLL_OUTDIV for Fout=%uHz\n", | 1419 | arizona_fll_err(fll, "No FLL_OUTDIV for Fout=%uHz\n", |
1414 | Fout); | 1420 | Fout); |
1415 | return -EINVAL; | 1421 | return -EINVAL; |