Home
last modified time | relevance | path

Searched refs:DIV_ROUND_CLOSEST (Results 1 – 25 of 487) sorted by relevance

12345678910>>...20

/openbmc/linux/include/linux/
H A Dunits.h58 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); in millicelsius_to_kelvin()
65 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); in deci_kelvin_to_celsius()
72 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); in celsius_to_deci_kelvin()
96 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); in millicelsius_to_deci_kelvin()
101 return t + DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, in kelvin_to_celsius()
107 return t - DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, in celsius_to_kelvin()
/openbmc/linux/drivers/clk/
H A Dclk-clps711x.c74 f_spi = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 96); in clps711x_clk_init_dt()
76 f_pwm = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 128); in clps711x_clk_init_dt()
83 f_spi = DIV_ROUND_CLOSEST(f_cpu, 576); in clps711x_clk_init_dt()
84 f_pwm = DIV_ROUND_CLOSEST(f_cpu, 768); in clps711x_clk_init_dt()
89 f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 26); in clps711x_clk_init_dt()
91 f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 24); in clps711x_clk_init_dt()
93 f_tim = DIV_ROUND_CLOSEST(f_cpu, 144); in clps711x_clk_init_dt()
/openbmc/u-boot/drivers/clk/
H A Dclk_zynq.c197 return DIV_ROUND_CLOSEST(zynq_clk_get_pll_rate(priv, pll), div); in zynq_clk_get_cpu_rate()
209 return DIV_ROUND_CLOSEST(zynq_clk_get_pll_rate(priv, ddrpll_clk), div); in zynq_clk_get_ddr2x_rate()
221 return DIV_ROUND_CLOSEST(zynq_clk_get_pll_rate(priv, ddrpll_clk), div); in zynq_clk_get_ddr3x_rate()
234 return DIV_ROUND_CLOSEST(DIV_ROUND_CLOSEST( in zynq_clk_get_dci_rate()
263 DIV_ROUND_CLOSEST( in zynq_clk_get_peripheral_rate()
264 DIV_ROUND_CLOSEST( in zynq_clk_get_peripheral_rate()
297 new_rate = DIV_ROUND_CLOSEST( in zynq_clk_calc_peripheral_two_divs()
298 DIV_ROUND_CLOSEST(pll_rate, d0), d1); in zynq_clk_calc_peripheral_two_divs()
334 div0 = DIV_ROUND_CLOSEST(pll_rate, rate); in zynq_clk_set_peripheral_rate()
337 new_rate = DIV_ROUND_CLOSEST(rate, div0); in zynq_clk_set_peripheral_rate()
H A Dclk_zynqmp.c389 return DIV_ROUND_CLOSEST(pllrate, div); in zynqmp_clk_get_cpu_rate()
412 return DIV_ROUND_CLOSEST(pllrate, div); in zynqmp_clk_get_ddr_rate()
446 DIV_ROUND_CLOSEST( in zynqmp_clk_get_peripheral_rate()
447 DIV_ROUND_CLOSEST(pllrate, div0), div1); in zynqmp_clk_get_peripheral_rate()
489 DIV_ROUND_CLOSEST( in zynqmp_clk_get_wdt_rate()
490 DIV_ROUND_CLOSEST(pllrate, div0), div1); in zynqmp_clk_get_wdt_rate()
503 new_rate = DIV_ROUND_CLOSEST( in zynqmp_clk_calc_peripheral_two_divs()
504 DIV_ROUND_CLOSEST(pll_rate, d0), d1); in zynqmp_clk_calc_peripheral_two_divs()
549 div0 = DIV_ROUND_CLOSEST(pll_rate, rate); in zynqmp_clk_set_peripheral_rate()
552 new_rate = DIV_ROUND_CLOSEST(rate, div0); in zynqmp_clk_set_peripheral_rate()
/openbmc/u-boot/arch/arm/mach-omap2/
H A Dabb.c50 sys_rate = DIV_ROUND_CLOSEST(V_OSCK, 1000000); in abb_setup_timings()
51 clk_cycles = DIV_ROUND_CLOSEST(OMAP_ABB_CLOCK_CYCLES * 10, sys_rate); in abb_setup_timings()
52 sr2_cnt = DIV_ROUND_CLOSEST(OMAP_ABB_SETTLING_TIME * 10, clk_cycles); in abb_setup_timings()
/openbmc/linux/drivers/gpu/drm/nouveau/nvkm/subdev/volt/
H A Dgk20a.c56 mv = DIV_ROUND_CLOSEST(coef->c2 * speedo, s_scale); in gk20a_volt_get_cvb_voltage()
57 mv = DIV_ROUND_CLOSEST((mv + coef->c1) * speedo, s_scale) + coef->c0; in gk20a_volt_get_cvb_voltage()
74 mv = DIV_ROUND_CLOSEST(coef->c3 * speedo, s_scale) + coef->c4 + in gk20a_volt_get_cvb_t_voltage()
75 DIV_ROUND_CLOSEST(coef->c5 * temp, t_scale); in gk20a_volt_get_cvb_t_voltage()
76 mv = DIV_ROUND_CLOSEST(mv * temp, t_scale) + cvb_mv; in gk20a_volt_get_cvb_t_voltage()
/openbmc/linux/drivers/gpu/drm/vkms/
H A Dvkms_formats.c165 dst_pixels[3] = DIV_ROUND_CLOSEST(in_pixel->a, 257); in argb_u16_to_ARGB8888()
166 dst_pixels[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257); in argb_u16_to_ARGB8888()
167 dst_pixels[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257); in argb_u16_to_ARGB8888()
168 dst_pixels[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); in argb_u16_to_ARGB8888()
174 dst_pixels[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257); in argb_u16_to_XRGB8888()
175 dst_pixels[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257); in argb_u16_to_XRGB8888()
176 dst_pixels[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); in argb_u16_to_XRGB8888()
/openbmc/linux/drivers/hwmon/pmbus/
H A Dmp2888.c121 ret = DIV_ROUND_CLOSEST(ret * 200 - 19600, data->curr_sense_gain); in mp2888_read_phase()
214 ret = data->total_curr_resolution ? ret : DIV_ROUND_CLOSEST(ret, 2); in mp2888_read_word_data()
270 word = DIV_ROUND_CLOSEST(word, MP2888_TEMP_UNIT); in mp2888_write_word_data()
276 word = data->total_curr_resolution ? DIV_ROUND_CLOSEST(word, 8) : in mp2888_write_word_data()
277 DIV_ROUND_CLOSEST(word, 4); in mp2888_write_word_data()
283 word = data->total_curr_resolution ? DIV_ROUND_CLOSEST(word, 4) : in mp2888_write_word_data()
284 DIV_ROUND_CLOSEST(word, 2); in mp2888_write_word_data()
H A Dxdpe12284.c52 return 1 + DIV_ROUND_CLOSEST(val - 500, 10); in xdpe122_read_word_data()
56 return 1 + DIV_ROUND_CLOSEST(val - 250, 5); in xdpe122_read_word_data()
60 return 1 + DIV_ROUND_CLOSEST(val - 200, 10); in xdpe122_read_word_data()
64 return DIV_ROUND_CLOSEST((1550 - val) * 100, in xdpe122_read_word_data()
H A Dlm25066.c254 ret = DIV_ROUND_CLOSEST(ret * 293, 6140); in lm25066_read_word_data()
258 ret = DIV_ROUND_CLOSEST(ret * 2832, 45400); in lm25066_read_word_data()
262 ret = DIV_ROUND_CLOSEST(ret * 70, 453); in lm25066_read_word_data()
267 ret = DIV_ROUND_CLOSEST(ret * 725, 2180); in lm25066_read_word_data()
335 ret = DIV_ROUND_CLOSEST(ret * 293, 6140); in lm25056_read_word_data()
343 ret = DIV_ROUND_CLOSEST(ret * 293, 6140); in lm25056_read_word_data()
411 word = DIV_ROUND_CLOSEST((int)word * 6140, 293); in lm25066_write_word_data()
418 word = DIV_ROUND_CLOSEST((int)word * 6140, 293); in lm25066_write_word_data()
H A Dzl6100.c111 mantissa = DIV_ROUND_CLOSEST(val, 1000); in zl6100_d2l()
185 ret = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(ret) * 9, 10)); in zl6100_read_word_data()
188 ret = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(ret) * 11, 10)); in zl6100_read_word_data()
245 word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 9)); in zl6100_write_word_data()
254 word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 11)); in zl6100_write_word_data()
/openbmc/u-boot/lib/
H A Dstrmhz.c13 n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L; in strmhz()
17 m = DIV_ROUND_CLOSEST(hz, 1000L); in strmhz()
/openbmc/linux/drivers/hwmon/
H A Dmc13783-adc.c79 val = DIV_ROUND_CLOSEST(val * 9, 2); in mc13783_adc_bp_show()
85 val = DIV_ROUND_CLOSEST(val * 9, 4) + 2400; in mc13783_adc_bp_show()
104 val = DIV_ROUND_CLOSEST(val * 9, 4); in mc13783_adc_gp_show()
123 val = DIV_ROUND_CLOSEST(val * 4800, 1024); in mc13783_adc_uid_show()
126 val = DIV_ROUND_CLOSEST(val * 2555, 1024); in mc13783_adc_uid_show()
149 ret = DIV_ROUND_CLOSEST(-2635920 + val * 4244, 10); in mc13783_adc_temp_show()
H A Dtmp513.c199 *val = DIV_ROUND_CLOSEST(*val * 10000, data->shunt_uohms); in tmp51x_get_value()
215 *val = DIV_ROUND_CLOSEST(*val, 1000); in tmp51x_get_value()
227 *val = DIV_ROUND_CLOSEST(*val * 625, 10); in tmp51x_get_value()
255 val = DIV_ROUND_CLOSEST(val * data->shunt_uohms, 10000); in tmp51x_set_value()
265 val = clamp_val(DIV_ROUND_CLOSEST(val, 4), 0, max_val); in tmp51x_set_value()
269 regval = clamp_val(DIV_ROUND_CLOSEST(val, data->pwr_lsb_uw), 0, in tmp51x_set_value()
278 regval = DIV_ROUND_CLOSEST(val * 10, 625) << TMP51X_TEMP_SHIFT; in tmp51x_set_value()
283 regval = DIV_ROUND_CLOSEST(val, 500); in tmp51x_set_value()
559 DIV_ROUND_CLOSEST(40960, div)); in tmp51x_calibrate()
H A Dads7828.c66 DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000)); in ads7828_in_show()
133 vref_mv = DIV_ROUND_CLOSEST(vref_uv, 1000); in ads7828_probe()
152 data->lsb_resol = DIV_ROUND_CLOSEST(vref_mv * 1000, 4096); in ads7828_probe()
156 data->lsb_resol = DIV_ROUND_CLOSEST(vref_mv * 1000, 256); in ads7828_probe()
H A Dina2xx.c162 return DIV_ROUND_CLOSEST(avg * INA226_TOTAL_CONV_TIME_DEFAULT, 1000); in ina226_reg_to_interval()
173 avg = DIV_ROUND_CLOSEST(interval * 1000, in ina226_interval_to_reg()
272 val = DIV_ROUND_CLOSEST((s16)regval, data->config->shunt_div); in ina2xx_get_value()
277 val = DIV_ROUND_CLOSEST(val, 1000); in ina2xx_get_value()
285 val = DIV_ROUND_CLOSEST(val, 1000); in ina2xx_get_value()
354 val = DIV_ROUND_CLOSEST(val, data->config->bus_voltage_lsb); in ina226_alert_to_reg()
357 val = DIV_ROUND_CLOSEST(val, data->power_lsb_uW); in ina226_alert_to_reg()
462 unsigned int dividend = DIV_ROUND_CLOSEST(1000000000, in ina2xx_set_shunt()
469 data->current_lsb_uA = DIV_ROUND_CLOSEST(dividend, val); in ina2xx_set_shunt()
H A Dlan966x-hwmon.c147 tmp = DIV_ROUND_CLOSEST(hwmon->clk_rate, 256); in lan966x_hwmon_read_pwm_freq()
148 *val = DIV_ROUND_CLOSEST(tmp, data); in lan966x_hwmon_read_pwm_freq()
194 val = DIV_ROUND_CLOSEST(hwmon->clk_rate, val); in lan966x_hwmon_write_pwm_freq()
195 val = DIV_ROUND_CLOSEST(val, 256) - 1; in lan966x_hwmon_write_pwm_freq()
307 div = DIV_ROUND_CLOSEST(hwmon->clk_rate, LAN966X_PVT_CLK); in lan966x_hwmon_enable()
H A Dltc2947-core.c632 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp()
637 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp()
647 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp()
673 DIV_ROUND_CLOSEST(val, 200000)); in ltc2947_write_power()
678 DIV_ROUND_CLOSEST(val, 200000)); in ltc2947_write_power()
699 DIV_ROUND_CLOSEST(val, 12)); in ltc2947_write_curr()
704 DIV_ROUND_CLOSEST(val, 12)); in ltc2947_write_curr()
736 DIV_ROUND_CLOSEST(val, 145)); in ltc2947_write_in()
742 DIV_ROUND_CLOSEST(val, 2)); in ltc2947_write_in()
748 DIV_ROUND_CLOSEST(val, 145)); in ltc2947_write_in()
[all …]
H A Dltc4222.c64 val = DIV_ROUND_CLOSEST(val * 5, 4); in ltc4222_get_value()
69 val = DIV_ROUND_CLOSEST(val * 125, 4); in ltc4222_get_value()
80 val = DIV_ROUND_CLOSEST(val * 125, 2); in ltc4222_get_value()
/openbmc/linux/drivers/clk/sunxi-ng/
H A Dccu_phase.c52 step = DIV_ROUND_CLOSEST(360, parent_div); in ccu_phase_get_phase()
104 step = DIV_ROUND_CLOSEST(360, parent_div); in ccu_phase_set_phase()
105 delay = DIV_ROUND_CLOSEST(degrees, step); in ccu_phase_set_phase()
/openbmc/linux/drivers/media/pci/cx23885/
H A Dcx23888-ir.c181 DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * 16)); in carrier_freq_to_clock_divider()
192 return DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, in clock_divider_to_freq()
221 return DIV_ROUND_CLOSEST(count * 1000, in lpf_count_to_ns()
241 return DIV_ROUND_CLOSEST((1 << 2) * ((u32) divider + 1) * 1000, in clock_divider_to_resolution()
376 if (*carrier_range_low < DIV_ROUND_CLOSEST(c16, 16 + 3)) { in control_rx_s_carrier_window()
378 *carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 4); in control_rx_s_carrier_window()
381 *carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 3); in control_rx_s_carrier_window()
384 if (*carrier_range_high > DIV_ROUND_CLOSEST(c16, 16 - 3)) { in control_rx_s_carrier_window()
386 *carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 4); in control_rx_s_carrier_window()
389 *carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 3); in control_rx_s_carrier_window()
[all …]
/openbmc/linux/drivers/media/i2c/cx25840/
H A Dcx25840-ir.c142 DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ, freq * 16)); in carrier_freq_to_clock_divider()
153 return DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ, in clock_divider_to_freq()
182 return DIV_ROUND_CLOSEST(count * 1000, in lpf_count_to_ns()
202 return DIV_ROUND_CLOSEST((1 << 2) * ((u32) divider + 1) * 1000, in clock_divider_to_resolution()
363 if (*carrier_range_low < DIV_ROUND_CLOSEST(c16, 16 + 3)) { in control_rx_s_carrier_window()
365 *carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 4); in control_rx_s_carrier_window()
368 *carrier_range_low = DIV_ROUND_CLOSEST(c16, 16 + 3); in control_rx_s_carrier_window()
371 if (*carrier_range_high > DIV_ROUND_CLOSEST(c16, 16 - 3)) { in control_rx_s_carrier_window()
373 *carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 4); in control_rx_s_carrier_window()
376 *carrier_range_high = DIV_ROUND_CLOSEST(c16, 16 - 3); in control_rx_s_carrier_window()
[all …]
/openbmc/u-boot/drivers/serial/
H A Dserial_mtk.c71 quot = DIV_ROUND_CLOSEST(priv->clock, 16 * baud); in _mtk_serial_setbrg()
75 quot = DIV_ROUND_CLOSEST(priv->clock, 256 * baud); in _mtk_serial_setbrg()
79 samplecount = DIV_ROUND_CLOSEST(priv->clock, in _mtk_serial_setbrg()
113 tmp = DIV_ROUND_CLOSEST(priv->clock, quot * baud); in _mtk_serial_setbrg()
/openbmc/linux/drivers/media/rc/
H A Dmeson-ir-tx.c81 unsigned int cnt = DIV_ROUND_CLOSEST(ir->clk_rate, ir->carrier); in meson_irtx_set_mod()
82 unsigned int pulse_cnt = DIV_ROUND_CLOSEST(cnt * ir->duty_cycle, 100); in meson_irtx_set_mod()
116 unsigned int tb_us = DIV_ROUND_CLOSEST(USEC_PER_SEC, ir->carrier); in meson_irtx_prepare_pulse()
118 delay = (DIV_ROUND_CLOSEST(time, tb_us) - 1) & IRB_DELAY_MASK; in meson_irtx_prepare_pulse()
140 delay = (DIV_ROUND_CLOSEST(time, tb_us) - 1) & IRB_DELAY_MASK; in meson_irtx_prepare_space()
/openbmc/linux/drivers/thermal/tegra/
H A Dtegra30-tsensor.c198 c1 = DIV_ROUND_CLOSEST(ts->calib.a * counter + ts->calib.b, 1000000); in tegra_tsensor_get_temp()
200 c2 = DIV_ROUND_CLOSEST(ts->calib.p, c1); in tegra_tsensor_get_temp()
204 *temp = DIV_ROUND_CLOSEST(c1 * (c2 + c3 + c4), 1000); in tegra_tsensor_get_temp()
213 c1 = DIV_ROUND_CLOSEST(ts->calib.p - temp * 1000, ts->calib.m); in tegra_tsensor_temp_to_counter()
216 return DIV_ROUND_CLOSEST(c2 * 1000000 - ts->calib.b, ts->calib.a); in tegra_tsensor_temp_to_counter()
363 id, DIV_ROUND_CLOSEST(crit_trip, 1000)); in tegra_tsensor_enable_hw_channel()
476 ts->calib.a = DIV_ROUND_CLOSEST((t2_90C - t1_25C) * 1000000, in tegra_tsensor_nvmem_setup()
492 ts->calib.r = DIV_ROUND_CLOSEST(ts->calib.n, ts->calib.m * 2); in tegra_tsensor_nvmem_setup()

12345678910>>...20