STRUCT CS4270_MODE_RATIOS(9)
โจ struct cs4270_mode_ratios(9) โจ
okay so bestie, welcome to the kernel API manual ๐
โ today we're looking at struct cs4270_mode_ratios, and honestly? it's giving "small struct, big responsibilities." no cap.
๐ NAME ๐
struct cs4270_mode_ratios โ clock ratio tables, fr fr ๐ฐ๏ธโจ
๐ฆ SYNOPSIS ๐ฆ
struct cs4270_mode_ratios {
unsigned int ratio;
u8 speed_mode;
u8 mclk;
};
like, that's the whole struct. three fields. iconic minimalism ๐
๐ธ Members ๐ธ
ratioโ the ratio of MCLK to the sample rate. it's literally the math-y one ๐งฎspeed_modeโ the Speed Mode bits you gotta set in the Mode Control register for this ratio ๐ฅmclkโ the Ratio Select bits to set in the Mode Control register for this ratio ๐ฏ
๐ Description ๐
okay so the data for this chart is taken from Table 5 of the CS4270 reference manual โ so like, not us making it up, that's canon ๐โจ
This table is used to determine how to program the Mode Control register. It's also used by cs4270_set_dai_sysclk to tell ALSA which sampling rates the CS4270 currently supports. so yeah, it's double-booked and it's thriving ๐ซถ
speed_modeis the corresponding bit pattern to be written to the MODE bits of the Mode Control Registermclkis the corresponding bit pattern to be wirten to the MCLK bits of the Mode Control Register.
ngl that "wirten" is a typo that lives in the source and I'm not fixing it, we respect our elders ๐ (also written, bestie, it means written ๐)
In situations where a single ratio is represented by multiple speed modes, we favor the slowest speed. E.g, for a ratio of 128, we pick double-speed instead of quad-speed. lowkey a whole lifestyle choice โ slow and steady, main character energy ๐ขโจ However, the CS4270 errata states that divide-By-1.5 can cause failures, so we avoid that mode where possible. ๐จ
Errata: There is an errata for the CS4270 where divide-by-1.5 does not work if Vd is 3.3V. If this effects you, select the CONFIG_SND_SOC_CS4270_VD33_ERRATA Kconfig option, and the driver will never select any sample rates that require divide-by-1.5. like, ever. periodt. ๐
โ ๏ธ
๐ SEE ALSO ๐
Kernel file ./sound/soc/codecs/cs4270.c plus the whole friend group:
cs4270_set_dai_sysclk(9)cs4270_set_dai_fmt(9)cs4270_hw_params(9)cs4270_dai_mute(9)cs4270_soc_put_mute(9)cs4270_probe(9)cs4270_remove(9)cs4270_i2c_remove(9)cs4270_i2c_probe(9)
and that's the page!! ๐ this lil love letter to the CS4270 lives in ./sound/soc/codecs, dated October 2026, and it's part of the Kernel API Manual โ stay hydrated, read your errata, and slay your Mode Control register ๐๐๐
๐ฆ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms