Skip to content

Commit

Permalink
UPSTREAM: ASoC: cs42l43: Use fls to calculate the pre-divider for the…
Browse files Browse the repository at this point in the history
… PLL

Use fls to calculate the pre-divider and input frequency for the PLL,
this is marginally faster than the previous loop.

Suggested-by: Andy Shevchenko <[email protected]>
Signed-off-by: Charles Keepax <[email protected]>
Link: https://msgid.link/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
(cherry picked from commit 31c6e53a4da5fe626b99e1ebf777d751994e3281)

BUG=b:326869955
TEST=Test Audio use cases.

Change-Id: I59d02dc969f9b43f6958aa9318e4db2bf628abff
Signed-off-by: Debi sahoo <[email protected]>
  • Loading branch information
charleskeepax authored and terry182 committed Aug 20, 2024
1 parent b4a1222 commit 8b7300a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions sound/soc/codecs/cs42l43.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,10 +1339,9 @@ static int cs42l43_enable_pll(struct cs42l43_codec *priv)

dev_dbg(priv->dev, "Enabling PLL at %uHz\n", freq);

while (freq > cs42l43_pll_configs[ARRAY_SIZE(cs42l43_pll_configs) - 1].freq) {
div++;
freq /= 2;
}
div = fls(freq) -
fls(cs42l43_pll_configs[ARRAY_SIZE(cs42l43_pll_configs) - 1].freq);
freq >>= div;

if (div <= CS42L43_PLL_REFCLK_DIV_MASK) {
int i;
Expand Down

0 comments on commit 8b7300a

Please sign in to comment.