Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e87d9ae8 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

ASoC: arizona: Correct handling of FLL theta in synchroniser mode



Theta/lambda is used to give the fractional portion of the FLL
frequency multiplication. When the synchroniser is active the
reference path lambda value is hard coded in the hardware to
65536. This patch corrects the handling of theta such that it
is scaled to match this denominator, when the synchroniser is
active.

Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 63d19e06
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1920,8 +1920,8 @@ static struct {

struct arizona_fll_cfg {
	int n;
	int theta;
	int lambda;
	unsigned int theta;
	unsigned int lambda;
	int refdiv;
	int outdiv;
	int fratio;
@@ -2233,6 +2233,10 @@ static int arizona_enable_fll(struct arizona_fll *fll)
	    fll->ref_src != fll->sync_src) {
		arizona_calc_fll(fll, &cfg, fll->ref_freq, false);

		/* Ref path hardcodes lambda to 65536 when sync is on */
		if (fll->sync_src >= 0 && cfg.lambda)
			cfg.theta = (cfg.theta * (1 << 16)) / cfg.lambda;

		arizona_apply_fll(arizona, fll->base, &cfg, fll->ref_src,
				  false);
		if (fll->sync_src >= 0) {