diff options
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r-- | sound/soc/codecs/arizona.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 657808ba1418..6f05b17d1965 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1477,21 +1477,25 @@ static void arizona_enable_fll(struct arizona_fll *fll, | |||
1477 | { | 1477 | { |
1478 | struct arizona *arizona = fll->arizona; | 1478 | struct arizona *arizona = fll->arizona; |
1479 | int ret; | 1479 | int ret; |
1480 | bool use_sync = false; | ||
1480 | 1481 | ||
1481 | /* | 1482 | /* |
1482 | * If we have both REFCLK and SYNCCLK then enable both, | 1483 | * If we have both REFCLK and SYNCCLK then enable both, |
1483 | * otherwise apply the SYNCCLK settings to REFCLK. | 1484 | * otherwise apply the SYNCCLK settings to REFCLK. |
1484 | */ | 1485 | */ |
1485 | if (fll->ref_src >= 0 && fll->ref_src != fll->sync_src) { | 1486 | if (fll->ref_src >= 0 && fll->ref_freq && |
1487 | fll->ref_src != fll->sync_src) { | ||
1486 | regmap_update_bits(arizona->regmap, fll->base + 5, | 1488 | regmap_update_bits(arizona->regmap, fll->base + 5, |
1487 | ARIZONA_FLL1_OUTDIV_MASK, | 1489 | ARIZONA_FLL1_OUTDIV_MASK, |
1488 | ref->outdiv << ARIZONA_FLL1_OUTDIV_SHIFT); | 1490 | ref->outdiv << ARIZONA_FLL1_OUTDIV_SHIFT); |
1489 | 1491 | ||
1490 | arizona_apply_fll(arizona, fll->base, ref, fll->ref_src, | 1492 | arizona_apply_fll(arizona, fll->base, ref, fll->ref_src, |
1491 | false); | 1493 | false); |
1492 | if (fll->sync_src >= 0) | 1494 | if (fll->sync_src >= 0) { |
1493 | arizona_apply_fll(arizona, fll->base + 0x10, sync, | 1495 | arizona_apply_fll(arizona, fll->base + 0x10, sync, |
1494 | fll->sync_src, true); | 1496 | fll->sync_src, true); |
1497 | use_sync = true; | ||
1498 | } | ||
1495 | } else if (fll->sync_src >= 0) { | 1499 | } else if (fll->sync_src >= 0) { |
1496 | regmap_update_bits(arizona->regmap, fll->base + 5, | 1500 | regmap_update_bits(arizona->regmap, fll->base + 5, |
1497 | ARIZONA_FLL1_OUTDIV_MASK, | 1501 | ARIZONA_FLL1_OUTDIV_MASK, |
@@ -1511,7 +1515,7 @@ static void arizona_enable_fll(struct arizona_fll *fll, | |||
1511 | * Increase the bandwidth if we're not using a low frequency | 1515 | * Increase the bandwidth if we're not using a low frequency |
1512 | * sync source. | 1516 | * sync source. |
1513 | */ | 1517 | */ |
1514 | if (fll->sync_src >= 0 && fll->sync_freq > 100000) | 1518 | if (use_sync && fll->sync_freq > 100000) |
1515 | regmap_update_bits(arizona->regmap, fll->base + 0x17, | 1519 | regmap_update_bits(arizona->regmap, fll->base + 0x17, |
1516 | ARIZONA_FLL1_SYNC_BW, 0); | 1520 | ARIZONA_FLL1_SYNC_BW, 0); |
1517 | else | 1521 | else |
@@ -1526,8 +1530,7 @@ static void arizona_enable_fll(struct arizona_fll *fll, | |||
1526 | 1530 | ||
1527 | regmap_update_bits(arizona->regmap, fll->base + 1, | 1531 | regmap_update_bits(arizona->regmap, fll->base + 1, |
1528 | ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA); | 1532 | ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA); |
1529 | if (fll->ref_src >= 0 && fll->sync_src >= 0 && | 1533 | if (use_sync) |
1530 | fll->ref_src != fll->sync_src) | ||
1531 | regmap_update_bits(arizona->regmap, fll->base + 0x11, | 1534 | regmap_update_bits(arizona->regmap, fll->base + 0x11, |
1532 | ARIZONA_FLL1_SYNC_ENA, | 1535 | ARIZONA_FLL1_SYNC_ENA, |
1533 | ARIZONA_FLL1_SYNC_ENA); | 1536 | ARIZONA_FLL1_SYNC_ENA); |
@@ -1561,10 +1564,12 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source, | |||
1561 | if (fll->ref_src == source && fll->ref_freq == Fref) | 1564 | if (fll->ref_src == source && fll->ref_freq == Fref) |
1562 | return 0; | 1565 | return 0; |
1563 | 1566 | ||
1564 | if (fll->fout && Fref > 0) { | 1567 | if (fll->fout) { |
1565 | ret = arizona_calc_fll(fll, &ref, Fref, fll->fout); | 1568 | if (Fref > 0) { |
1566 | if (ret != 0) | 1569 | ret = arizona_calc_fll(fll, &ref, Fref, fll->fout); |
1567 | return ret; | 1570 | if (ret != 0) |
1571 | return ret; | ||
1572 | } | ||
1568 | 1573 | ||
1569 | if (fll->sync_src >= 0) { | 1574 | if (fll->sync_src >= 0) { |
1570 | ret = arizona_calc_fll(fll, &sync, fll->sync_freq, | 1575 | ret = arizona_calc_fll(fll, &sync, fll->sync_freq, |