WSL2-Linux-Kernel/sound
Aidan MacDonald ad721bc919
ASoC: jz4740-i2s: Make I2S divider calculations more robust
When the CPU supplies bit/frame clocks, the system clock (clk_i2s)
is divided to produce the bit clock. This is a simple 1/N divider
with a fairly limited range, so for a given system clock frequency
only a few sample rates can be produced. Usually a wider range of
sample rates is supported by varying the system clock frequency.

The old calculation method was not very robust and could easily
produce the wrong clock rate, especially with non-standard rates.
For example, if the system clock is 1.99x the target bit clock
rate, the divider would be calculated as 1 instead of the more
accurate 2.

Instead, use a more accurate method that considers two adjacent
divider settings and selects the one that produces the least error
versus the requested rate. If the error is 5% or higher then the
rate setting is rejected to prevent garbled audio.

Skip divider calculation when the codec is supplying both the bit
and frame clock; in that case, the divider outputs are unused and
we don't want to constrain the sample rate.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com
Link: https://lore.kernel.org/r/20230509125134.208129-1-aidanmacdonald.0x0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org
2023-05-11 10:17:58 +09:00
..
ac97
aoa
arm
atmel
core sound fixes for 6.4-rc1 2023-05-06 08:07:11 -07:00
drivers ASoC: Updates for v6.4 2023-04-24 15:15:31 +02:00
firewire ALSA: firewire-tascam: add missing unwind goto in snd_tscm_stream_start_duplex() 2023-04-06 16:45:03 +02:00
hda
i2c ALSA: i2c/cs8427: fix iec958 mixer control deactivation 2023-04-06 08:09:36 +02:00
isa
mips
oss
parisc
pci sound fixes for 6.4-rc1 2023-05-06 08:07:11 -07:00
pcmcia
ppc ASoC: Updates for v6.4 2023-04-24 15:15:31 +02:00
sh
soc ASoC: jz4740-i2s: Make I2S divider calculations more robust 2023-05-11 10:17:58 +09:00
sparc ALSA: sparc/dbri: Convert to platform remove callback returning void 2023-03-20 13:09:37 +00:00
spi
synth
usb ALSA: caiaq: input: Add error handling for unsupported input methods in `snd_usb_caiaq_input_init` 2023-05-04 09:50:11 +02:00
virtio
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c