cdns_i2c_calc_divs(9)
β¨ cdns_i2c_calc_divs β Calculate clock dividers β¨
okay so real talk, this is a page from the Kernel API Manual (yes, the kernel ones, we're in the big leagues now bestie π ) and it's all about one little function that does math so your I2C bus actually ticks at the right speed. buckle up π
π NAME π
cdns_i2c_calc_divs β literally just: calculate clock dividers. that's the whole vibe. math girl summer π₯
πΈ SYNOPSIS πΈ
int cdns_i2c_calc_divs (unsigned long *f , unsigned long input_clk ,
unsigned int *a , unsigned int *b );
look at her. four args, returns an int, pointers everywhere. she's iconic, she's pointer-pilled π«Ά
π¦ ARGUMENTS π¦
fβ the I2C clock frequency. she's a pointer, she's in and out, she's doing both jobs, main character energy fr fr πinput_clkβ the input clock frequency. your starting material, your raw ingredient πaβ the first divider. this is a return value, so it gets written, not read πbβ the second divider. also a return value. also gets written. two dividers, no cap β¨
π DESCRIPTION π
okay so this is the important part, listen up π’
f is used as both an input and an output variable. as an input, it's the target I2C frequency you're aiming for β your dream frequency, your goal, your manifestation π§
then on function exit, f holds the actually resulting I2C frequency. so like... what you actually got after the divider math did its thing. sometimes your dream frequency and your real frequency aren't the same and that's just how it is π the function is being honest with you and honestly? we respect it π«Ά
β RETURN β
0on success β slay, we ate π- negative
errnootherwise β not slay, something went sideways π
π₯ SEE ALSO π₯
bestie, there is a whole friend group here. the kernel file lives at ./drivers/i2c/busses/i2c-cadence.c and here's everyone in the group chat π:
- enum
cdns_i2c_mode(9) - enum
cdns_i2c_slave_state(9) - struct
cdns_i2c(9) cdns_i2c_init(9)cdns_i2c_runtime_suspend(9)cdns_i2c_runtime_resume(9)cdns_i2c_clear_bus_hold(9)cdns_i2c_slave_isr(9)cdns_i2c_master_isr(9)cdns_i2c_isr(9)cdns_i2c_mrecv(9)cdns_i2c_msend(9)cdns_i2c_master_reset(9)cdns_i2c_master_xfer(9)cdns_i2c_master_xfer_atomic(9)cdns_i2c_func(9)cdns_i2c_setclk(9)cdns_i2c_clk_notifier_cb(9)cdns_i2c_detect_transfer_size(9)cdns_i2c_probe(9)cdns_i2c_remove(9)cdns_i2c_shutdown(9)
like I said. full group chat. go say hi πΈ
okay that's the page!! shoutout to ./drivers/i2c/busses for being the source, and mark your calendars for October 2026 because that's the date on this one π stay hydrated, read your kernel docs, and remember: f is input and output, don't forget πβ¨
π¦ 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