aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/arizona.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-07-09 12:41:44 -0400
committerMark Brown <broonie@linaro.org>2014-07-10 06:09:15 -0400
commit29fee829408117624efcd478f6f228d77039b969 (patch)
tree9492d1ff80ba2a6e6943b9ec679ac801fb3fa97f /sound/soc/codecs/arizona.c
parent4714bc015de147c2da5248762b2772c6dbf160eb (diff)
ASoC: arizona: Correct checking of FLL ratio limitations
The check to ensure the Fref frequency is within the bounds for the current ratio, was placed in the wrong loop. The initial configuration will always be valid and the loop lowering the ratio will only reinforce this validity. The check should be on the loop increasing the ratio. This could on occasion cause an invalid ratio/Fref combination to be selected. Reported-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r--sound/soc/codecs/arizona.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index b03974eb541e..4c4727f0837c 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1578,6 +1578,10 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
1578 while (div <= ARIZONA_FLL_MAX_REFDIV) { 1578 while (div <= ARIZONA_FLL_MAX_REFDIV) {
1579 for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; 1579 for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO;
1580 ratio++) { 1580 ratio++) {
1581 if (ARIZONA_FLL_VCO_CORNER / (fll->vco_mult * ratio) <
1582 Fref)
1583 break;
1584
1581 if (target % (ratio * Fref)) { 1585 if (target % (ratio * Fref)) {
1582 cfg->refdiv = refdiv; 1586 cfg->refdiv = refdiv;
1583 cfg->fratio = ratio - 1; 1587 cfg->fratio = ratio - 1;
@@ -1586,10 +1590,6 @@ static int arizona_calc_fratio(struct arizona_fll *fll,
1586 } 1590 }
1587 1591
1588 for (ratio = init_ratio - 1; ratio > 0; ratio--) { 1592 for (ratio = init_ratio - 1; ratio > 0; ratio--) {
1589 if (ARIZONA_FLL_VCO_CORNER / (fll->vco_mult * ratio) <
1590 Fref)
1591 break;
1592
1593 if (target % (ratio * Fref)) { 1593 if (target % (ratio * Fref)) {
1594 cfg->refdiv = refdiv; 1594 cfg->refdiv = refdiv;
1595 cfg->fratio = ratio - 1; 1595 cfg->fratio = ratio - 1;