Message ID | 1404924109-1750-3-git-send-email-ckeepax@opensource.wolfsonmicro.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 29fee829408117624efcd478f6f228d77039b969 |
Headers | show |
On Wed, Jul 09, 2014 at 05:41:44PM +0100, Charles Keepax wrote: > 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. Applied all, thanks. You should really have put this and patch 3 first since they're bug fixes.
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index a0252a7..e9e0b6b 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c @@ -1623,6 +1623,10 @@ static int arizona_calc_fratio(struct arizona_fll *fll, while (div <= ARIZONA_FLL_MAX_REFDIV) { for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; ratio++) { + if (ARIZONA_FLL_VCO_CORNER / (fll->vco_mult * ratio) < + Fref) + break; + if (target % (ratio * Fref)) { cfg->refdiv = refdiv; cfg->fratio = ratio - 1; @@ -1631,10 +1635,6 @@ static int arizona_calc_fratio(struct arizona_fll *fll, } for (ratio = init_ratio - 1; ratio > 0; ratio--) { - if (ARIZONA_FLL_VCO_CORNER / (fll->vco_mult * ratio) < - Fref) - break; - if (target % (ratio * Fref)) { cfg->refdiv = refdiv; cfg->fratio = ratio - 1;
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> --- sound/soc/codecs/arizona.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)