cs4270_set_dai_sysclk(9)
π cs4270_set_dai_sysclk(9) π
okay so this is straight out of the Kernel API Manual, and honestly? she's a little baddie with one job and she does it flawlessly. bestie, let's get into it β¨
π NAME π
cs4270_set_dai_sysclk β figure out which sample rates the CS4270 can actually do. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
int cs4270_set_dai_sysclk (struct snd_soc_dai *codec_dai , int clk_id ,
unsigned int freq , int dir );
π¦ ARGUMENTS π¦
codec_daiβ the codec DAI. the main character of this whole function, lowkey π«Άclk_idβ the clock ID. and before you ask: it's ignored. literally does nothing, we love a decorative parameter πfreqβ the MCLK input frequency. this one? actually matters. this is the whole plot π₯dirβ the clock direction. also ignored. also just vibing. no cap π
β¨ DESCRIPTION β¨
so what this function does is tell the codec driver what the input MCLK frequency is. that's her entire purpose in life and she's obsessed with it.
the value of MCLK is what decides which sample rates the CS4270 supports. here's the rule: the ratio of MCLK / Fs has to be equal to exactly one of nine supported values β and those nine iconic numbers are 64, 96, 128, 192, 256, 384, 512, 768, and 1024. periodt. π―
the function calculates all nine ratios and works out which ones match a standard sample rate. if there's a match, it gets added to the list of supported sample rates. slay. π
β οΈ okay this part is important, don't skip it: this function must be called by the machine driver's startup function, otherwise the list of supported sample rates won't be available in time for ALSA. like... the whole thing falls apart. don't do that to her π
for setups with variable MCLKs, pass 0 as the 'freq' argument. that'll cause the theoretically possible sample rates to be enabled. then call it again with a proper value set once the external clock is set β most probably you'd do that from a machine's driver hw_param hook. two-step process, both iconic, iykyk π
π SEE ALSO π
- Kernel file
./sound/soc/codecs/cs4270.c struct cs4270_mode_ratios(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)
the whole friend group fr fr π«Άβ¨
mwah π that's the page! brought to you by the lovely humans over in ./sound/soc/codecs, dated October 2026 β go drink some water and call your machine driver's startup function bestie, ily ππ§ββοΈ
π¦ 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