rk3x_i2c_v1_calc_timings(9)
๐ rk3x_i2c_v1_calc_timings โจ
okay so bestie, welcome to the Kernel API Manual page for rk3x_i2c_v1_calc_timings โ yes we are doing kernel I2C timing math and honestly it is giving "niche but iconic" ๐. This one calculates timing values for the SCL frequency you want, and it is lowkey a whole moment. Slay. ๐
โจ NAME โจ
rk3x_i2c_v1_calc_timings โ calculate timing values for desired SCL frequency. That is literally the whole point, bestie. ๐
๐ธ SYNOPSIS ๐ธ
int rk3x_i2c_v1_calc_timings (unsigned long clk_rate , struct
i2c_timings *t , struct rk3x_i2c_calced_timings *t_calc );
๐ ARGUMENTS ๐
clk_rateโ I2C input clock rate. That is the clock rate coming in, bestie. โฐtโ Known I2C timing information. You bring the timing tea. ๐ซt_calcโ Caculated rk3x private timings that would be written into regs. Yes, "Caculated" is literally how it is spelled here ๐ญ. These are the private rk3x values that would be written into the registers. ๐พ
๐ฅ RETURN ๐ฅ
It returns 0 on success. If the goal SCL rate is too slow, it returns -EINVAL, and in that case a best-effort divider value is returned in divs. If the target rate is too high, it silently uses the highest possible rate โ no drama, just maxed out. โก
And just so you know: the following formulas are v1's method to calculate timings. ๐งฎ
๐ฆ DESCRIPTION ๐ฆ
okay, formula time โ keep these exact, no freestyling:
l = divl + 1; h = divh + 1; s = sda_update_config + 1; u =
start_setup_config + 1; p = stop_setup_config + 1; T = Tclk_i2c;
tHigh = 8 * h * T; tLow = 8 * l * T;
tHD;sda = (l * s + 1) * T; tSU;sda = [(8 - s) * l + 1] * T; tI2C = 8 *
(l + h) * T;
tSU;sta = (8h * u + 1) * T; tHD;sta = [8h * (u + 1) - 1] * T; tSU;sto =
(8h * p + 1) * T;
๐ SEE ALSO ๐
Kernel file ./drivers/i2c/busses/i2c-rk3x.c โ and here is the whole friend group:
struct i2c_spec_values(9)struct rk3x_i2c_calced_timings(9)struct rk3x_i2c_soc_data(9)struct rk3x_i2c(9)rk3x_i2c_start(9)rk3x_i2c_stop(9)rk3x_i2c_prepare_read(9)rk3x_i2c_fill_transmit_buf(9)rk3x_i2c_get_spec(9)rk3x_i2c_v0_calc_timings(9)rk3x_i2c_clk_notifier_cb(9)rk3x_i2c_setup(9)
mwah ๐ and that is the page! Source/version: ./drivers/i2c/busses ยท date: October 2026 ยท page: rk3x_i2c_v1_calc_timings(9). Go calculate those timings, queen ๐โจ
๐ฆ 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