Lines Matching full:psr
299 uint32_t clk_div, psr, pll_clock, psr_h, psr_l; in i2c_enhanced_port_set_frequency() local
305 * Let psr(Prescale) = IT8XXX2_I2C_PSR(p_ch) in i2c_enhanced_port_set_frequency()
306 * Then, 1 SCL cycle = 2 x (psr + 2) x SMBus clock cycle in i2c_enhanced_port_set_frequency()
310 * 1 / freq = 2 x (psr + 2) x (1 / (pll_clock / clk_div)) in i2c_enhanced_port_set_frequency()
311 * psr = ((pll_clock / clk_div) x (1 / freq) x (1 / 2)) - 2 in i2c_enhanced_port_set_frequency()
316 /* Calculate PSR value */ in i2c_enhanced_port_set_frequency()
317 psr = (pll_clock / (clk_div * (2U * freq_hz))) - 2U; in i2c_enhanced_port_set_frequency()
318 /* Set psr value under 0xFD */ in i2c_enhanced_port_set_frequency()
319 if (psr > 0xFD) { in i2c_enhanced_port_set_frequency()
320 psr = 0xFD; in i2c_enhanced_port_set_frequency()
324 psr_l = psr + prescale_scl; in i2c_enhanced_port_set_frequency()
327 LOG_WRN("(psr + prescale_scl) can not be greater than 0xfd."); in i2c_enhanced_port_set_frequency()
332 * The property setting prescale_scl must be less than psr and in i2c_enhanced_port_set_frequency()
335 if (psr > (prescale_scl + 2)) { in i2c_enhanced_port_set_frequency()
336 psr_h = psr - prescale_scl; in i2c_enhanced_port_set_frequency()
339 LOG_WRN("prescale_scl_low should be less than (psr - 2)."); in i2c_enhanced_port_set_frequency()
789 /* Set "PSR" registers to decide the i2c speed. */ in enhanced_i2c_cmd_queue_trans()