snd_soc_tdm_params_to_bclk(9)
π snd_soc_tdm_params_to_bclk(9) π
okay bestie, welcome to the Kernel API Manual β this one's a function called snd_soc_tdm_params_to_bclk and honestly? it's giving "math girlie who does your audio clock math for you" energy β¨
πΈ NAME πΈ
snd_soc_tdm_params_to_bclk β calculate bclk from params and tdm slot info π
β¨ SYNOPSIS β¨
int snd_soc_tdm_params_to_bclk (const struct snd_pcm_hw_params *params ,
int tdm_width , int tdm_slots , int slot_multiple );
like, that's the whole signature, no cap π«Ά
π ARGUMENTS π
paramsβ a pointer tostruct_pcm_hw_params. your fave little struct of hardware params πtdm_widthβ width in bits of the tdm slots. must be>= 0. yes, zero is allowed, we'll get to that πtdm_slotsβ number of tdm slots per frame. must be>= 0. same deal β¨slot_multipleβ if>1, roundup slot count to a multiple of this value. like a little snap-to-grid for your slots π₯
π¦ DESCRIPTION π¦
so what does it actually do? it calculates the bclk from the params sample rate, the tdm slot count, and the tdm slot width. optionally it rounds up the slot count to a given multiple. and here's the iconic part: either or both of tdm_width and tdm_slots can be 0. main character flexibility fr fr π
the fallbacks, spelled out:
- If
tdm_width == 0: useparams_widthas the slot width. - If
tdm_slots == 0: useparams_channelsas the slot count.
and if slot_multiple > 1 the slot count (or params_channels if tdm_slots == 0) will be rounded up to a multiple of slot_multiple. this is mainly useful for I2S mode, which has a left and right phase so the number of slots is always a multiple of 2. cute, right? π§
and the big brain equivalence moment:
Iftdm_width == 0 && tdm_slots == 0 && slot_multiple < 2, this is equivalent to callingsnd_soc_params_to_bclk. same thing, different outfit π
π RETURN π
bclk frequency in Hz, else a negative error code if params format is invalid π (iykyk β always check your return value bestie)
β SEE ALSO β
- Kernel file
./sound/soc/soc-utils.cβ go read it, it ate π
and that's the page!! thank you for coming to my ted talk π§
source path: ./sound/soc Β· version/date: October 2026 β mwah, see u in the kernel, bestie ππβ¨
π¦ 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