lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN7C2SDMB8_b-m0ZMzuSmhHxWpA10mcxxxDMKWuNe6wfiEXo-g@mail.gmail.com>
Date: Wed, 8 Oct 2025 21:26:16 +0800
From: Sune Brian <briansune@...il.com>
To: Mark Brown <broonie@...nel.org>
Cc: Charles Keepax <ckeepax@...nsource.cirrus.com>, Liam Girdwood <lgirdwood@...il.com>, 
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>, linux-sound@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] ASoC: wm8978: add missing BCLK divider setup

Mark Brown <broonie@...nel.org> 於 2025年10月8日 週三 下午8:12寫道:

> Consider the case where the BCLK needed is 100 and SYSCLK is 198.
> Dividing by 1 will result in an absolute difference of 98 and a BCLK of
> 198 while dividing by 2 will result in an absolute difference 1 and a
> BCLK of 99 which is lower than the required BCLK.

for (i = 0; i < ARRAY_SIZE(bclk_divs); i++) {
bclk = wm8978->f_256fs / bclk_divs[i];
if (abs(bclk - target_bclk) < min_diff) {
min_diff = abs(bclk - target_bclk);
bclkdiv = i;
}
}

Cycle 0: min_diff=0xffff_ffff
bclk = 198/bclk_divs[0] = 198/1=198
bclk-target_bclk = 198-100 = 98
98 < 0xffff_ffff
min_diff = 98
bclkdiv=0

Cycle 1: min_diff = 98
bclk = 198/bclk_divs[1] = 198/2=99
bclk-target_bclk = 99-100 = 1
1 < 98
min_diff = 1
bclk_div=1

Cycle 2: min_diff = 1
bclk = 198/bclk_divs[2] = 198/4=49
bclk-target_bclk = 49-1 = 48
48 < 1 skip

loop done

Final bclk_div=1 LUT=/2 198/2 ~= 100

what it the issue here or I messed up?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ