| /linux/include/linux/ |
| H A D | units.h | 88 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); in millicelsius_to_kelvin() 95 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DEGREE); in deci_kelvin_to_celsius() 102 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); in celsius_to_deci_kelvin() 126 return DIV_ROUND_CLOSEST(t, MILLIDEGREE_PER_DECIDEGREE); in millicelsius_to_deci_kelvin() 131 return t + DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, in kelvin_to_celsius() 137 return t - DIV_ROUND_CLOSEST(ABSOLUTE_ZERO_MILLICELSIUS, in celsius_to_kelvin()
|
| /linux/drivers/clk/ |
| H A D | clk-clps711x.c | 73 f_spi = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 96); in clps711x_clk_init_dt() 75 f_pwm = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 128); in clps711x_clk_init_dt() 82 f_spi = DIV_ROUND_CLOSEST(f_cpu, 576); in clps711x_clk_init_dt() 83 f_pwm = DIV_ROUND_CLOSEST(f_cpu, 768); in clps711x_clk_init_dt() 88 f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 26); in clps711x_clk_init_dt() 90 f_tim = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 24); in clps711x_clk_init_dt() 92 f_tim = DIV_ROUND_CLOSEST(f_cpu, 144); in clps711x_clk_init_dt()
|
| /linux/drivers/hwmon/pmbus/ |
| H A D | mp2891.c | 286 ret = DIV_ROUND_CLOSEST(ret * data->vout_scale[page], MP2891_VOUT_SCALE_DIV); in mp2891_read_word_data() 293 ret = DIV_ROUND_CLOSEST((ret & GENMASK(10, 0)) * data->iout_scale[page], in mp2891_read_word_data() 350 ret = DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) * data->iout_scale[page] * in mp2891_read_word_data() 363 ret = DIV_ROUND_CLOSEST((ret & GENMASK(9, 0)), 2); in mp2891_read_word_data() 400 DIV_ROUND_CLOSEST(word * MP2891_VOUT_SCALE_DIV, in mp2891_write_word_data() 416 DIV_ROUND_CLOSEST(word + in mp2891_write_word_data() 424 DIV_ROUND_CLOSEST(word, in mp2891_write_word_data() 440 DIV_ROUND_CLOSEST(word - in mp2891_write_word_data() 448 DIV_ROUND_CLOSEST(word, in mp2891_write_word_data() 465 DIV_ROUND_CLOSEST(word, 4))); in mp2891_write_word_data() [all …]
|
| H A D | mp29502.c | 229 ov_value = DIV_ROUND_CLOSEST(FIELD_GET(GENMASK(12, 7), ret) * in mp29502_read_vout_ov_limit() 262 DIV_ROUND_CLOSEST(word * data->ovp_div, in mp29502_write_vout_ov_limit() 321 ret = DIV_ROUND_CLOSEST((ret & GENMASK(11, 0)) * in mp29502_read_word_data() 339 ret = DIV_ROUND_CLOSEST(mp29502_reg2data_linear11(ret), in mp29502_read_word_data() 367 ret = DIV_ROUND_CLOSEST(mp29502_reg2data_linear11(ret) * in mp29502_read_word_data() 377 ret = DIV_ROUND_CLOSEST((ret & GENMASK(10, 0)) * data->iout_scale, in mp29502_read_word_data() 428 ret = DIV_ROUND_CLOSEST((FIELD_GET(GENMASK(8, 0), ret) * in mp29502_read_word_data() 441 ret = DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) * in mp29502_read_word_data() 493 DIV_ROUND_CLOSEST(word, in mp29502_write_word_data() 525 DIV_ROUND_CLOSEST(word * in mp29502_write_word_data() [all …]
|
| H A D | mp2888.c | 121 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 D | mp2869.c | 304 ret = DIV_ROUND_CLOSEST((ret & GENMASK(11, 0)) * data->vout_scale[page], in mp2869_read_word_data() 312 ret = DIV_ROUND_CLOSEST((ret & GENMASK(10, 0)) * data->iout_scale[page], in mp2869_read_word_data() 390 ret = DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) * data->iout_scale[page] * in mp2869_read_word_data() 429 DIV_ROUND_CLOSEST(word + in mp2869_write_word_data() 438 DIV_ROUND_CLOSEST(word, in mp2869_write_word_data() 454 DIV_ROUND_CLOSEST(word - in mp2869_write_word_data() 463 DIV_ROUND_CLOSEST(word, in mp2869_write_word_data() 503 DIV_ROUND_CLOSEST(word, in mp2869_write_word_data() 526 DIV_ROUND_CLOSEST(word * MP2869_READ_IOUT_DIV, in mp2869_write_word_data() 542 DIV_ROUND_CLOSEST(word, in mp2869_write_word_data()
|
| H A D | mp2993.c | 90 ret = DIV_ROUND_CLOSEST(ret * MP2993_VOUT_OVUV_UINT, MP2993_VOUT_OVUV_DIV); in mp2993_read_word_data() 108 ret = DIV_ROUND_CLOSEST((ret & GENMASK(9, 0)) * MP2993_READ_VIN_UINT, in mp2993_read_word_data() 120 ret = DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) * MP2993_VIN_LIMIT_UINT, in mp2993_read_word_data() 150 ret = DIV_ROUND_CLOSEST(word * MP2993_VOUT_OVUV_DIV, MP2993_VOUT_OVUV_UINT); in mp2993_write_word_data() 169 DIV_ROUND_CLOSEST(word * MP2993_VIN_LIMIT_DIV, in mp2993_write_word_data()
|
| H A D | lm25066.c | 254 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 D | xdpe12284.c | 52 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 D | zl6100.c | 109 mantissa = DIV_ROUND_CLOSEST(val, 1000); in zl6100_d2l() 171 ret = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(ret) * 9, 10)); in zl6100_read_word_data() 174 ret = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(ret) * 11, 10)); in zl6100_read_word_data() 226 word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 9)); in zl6100_write_word_data() 235 word = zl6100_d2l(DIV_ROUND_CLOSEST(zl6100_l2d(word) * 10, 11)); in zl6100_write_word_data()
|
| H A D | mp9941.c | 158 ret = DIV_ROUND_CLOSEST((ret & GENMASK(9, 0)) * MP9941_READ_VIN_UINT, in mp9941_read_word_data() 174 ret = DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) * MP9941_VIN_LIMIT_UINT, in mp9941_read_word_data() 227 DIV_ROUND_CLOSEST(word * MP9941_VIN_LIMIT_DIV, in mp9941_write_word_data() 234 DIV_ROUND_CLOSEST(word, data->vid_resolution)); in mp9941_write_word_data()
|
| /linux/drivers/gpu/drm/nouveau/nvkm/subdev/volt/ |
| H A D | gk20a.c | 56 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()
|
| /linux/drivers/hwmon/ |
| H A D | mc13783-adc.c | 79 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 D | tmp513.c | 210 *val = DIV_ROUND_CLOSEST(*val * 10 * (long)MILLI, (long)data->shunt_uohms); in tmp51x_get_value() 227 *val = DIV_ROUND_CLOSEST(*val, (long)MILLI); in tmp51x_get_value() 239 *val = DIV_ROUND_CLOSEST(*val * 625, 10); in tmp51x_get_value() 267 val = DIV_ROUND_CLOSEST(val * (long)data->shunt_uohms, 10 * (long)MILLI); in tmp51x_set_value() 277 val = clamp_val(DIV_ROUND_CLOSEST(val, 4), 0, max_val); in tmp51x_set_value() 281 regval = clamp_val(DIV_ROUND_CLOSEST(val, data->pwr_lsb_uw), 0, in tmp51x_set_value() 290 regval = DIV_ROUND_CLOSEST(val * 10, 625) << TMP51X_TEMP_SHIFT; in tmp51x_set_value() 295 regval = DIV_ROUND_CLOSEST(val, 500); in tmp51x_set_value() 569 DIV_ROUND_CLOSEST(40960, div)); in tmp51x_calibrate()
|
| H A D | ina2xx.c | 225 return DIV_ROUND_CLOSEST(avg * INA226_TOTAL_CONV_TIME_DEFAULT, 1000); in ina226_reg_to_interval() 242 avg = DIV_ROUND_CLOSEST(interval * 1000, in ina226_interval_to_reg() 258 val = DIV_ROUND_CLOSEST((s16)regval, data->config->shunt_div); in ina2xx_get_value() 263 val = DIV_ROUND_CLOSEST(val, 1000); in ina2xx_get_value() 271 val = DIV_ROUND_CLOSEST(val, 1000); in ina2xx_get_value() 368 val = DIV_ROUND_CLOSEST(val, data->config->bus_voltage_lsb); in ina226_alert_to_reg() 372 val = DIV_ROUND_CLOSEST(val, data->power_lsb_uW); in ina226_alert_to_reg() 377 val = DIV_ROUND_CLOSEST(val * 1000, data->current_lsb_uA); in ina226_alert_to_reg() 535 *val = DIV_ROUND_CLOSEST(accumulator_24, sample_count) * data->power_lsb_uW; in sy24655_average_power_read() 822 unsigned int dividend = DIV_ROUND_CLOSEST(1000000000, in ina2xx_set_shunt() [all …]
|
| H A D | ads7828.c | 66 DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000)); in ads7828_in_show() 131 vref_mv = DIV_ROUND_CLOSEST(vref_uv, 1000); in ads7828_probe() 147 data->lsb_resol = DIV_ROUND_CLOSEST(vref_mv * 1000, 4096); in ads7828_probe() 151 data->lsb_resol = DIV_ROUND_CLOSEST(vref_mv * 1000, 256); in ads7828_probe()
|
| H A D | tsc1641.c | 145 rshunt_reg = DIV_ROUND_CLOSEST(val, TSC1641_RSHUNT_LSB_UOHM); in tsc1641_set_shunt() 151 data->current_lsb_ua = DIV_ROUND_CLOSEST(TSC1641_VSHUNT_LSB_NVOLT * 1000, in tsc1641_set_shunt() 174 return DIV_ROUND_CLOSEST(conv_time, 1000); in tsc1641_reg_to_upd_interval() 333 *val = DIV_ROUND_CLOSEST((s16)regval * data->current_lsb_ua, 1000); in tsc1641_curr_read() 417 regval = DIV_ROUND_CLOSEST(val, TSC1641_VLOAD_LSB_MVOLT); in tsc1641_in_write() 442 regval = DIV_ROUND_CLOSEST(val * 1000, data->current_lsb_ua); in tsc1641_curr_write() 463 regval = DIV_ROUND_CLOSEST(val, TSC1641_POWER_LSB_UWATT); in tsc1641_power_write() 481 regval = DIV_ROUND_CLOSEST(val, TSC1641_TEMP_LSB_MDEGC); in tsc1641_temp_write()
|
| H A D | lan966x-hwmon.c | 147 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 D | ltc2947-core.c | 613 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp() 618 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp() 628 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp() 633 DIV_ROUND_CLOSEST(val - 550, 204)); in ltc2947_write_temp() 654 DIV_ROUND_CLOSEST(val, 200000)); in ltc2947_write_power() 659 DIV_ROUND_CLOSEST(val, 200000)); in ltc2947_write_power() 680 DIV_ROUND_CLOSEST(val, 12)); in ltc2947_write_curr() 685 DIV_ROUND_CLOSEST(val, 12)); in ltc2947_write_curr() 717 DIV_ROUND_CLOSEST(val, 145)); in ltc2947_write_in() 723 DIV_ROUND_CLOSEST(val, 2)); in ltc2947_write_in() [all …]
|
| /linux/drivers/media/pci/cx23885/ |
| H A D | cx23888-ir.c | 181 DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, freq * 16)); in carrier_freq_to_clock_divider() 186 return DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, (divider + 1) * 16); in clock_divider_to_carrier_freq() 192 return DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ, in clock_divider_to_freq() 215 DIV_ROUND_CLOSEST(CX23888_IR_REFCLK_FREQ / 1000000 * ns, 1000)); in ns_to_lpf_count() 221 return DIV_ROUND_CLOSEST(count * 1000, in lpf_count_to_ns() 228 return DIV_ROUND_CLOSEST(count, CX23888_IR_REFCLK_FREQ / 1000000); in lpf_count_to_us() 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() [all …]
|
| /linux/drivers/media/i2c/cx25840/ |
| H A D | cx25840-ir.c | 142 DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ, freq * 16)); in carrier_freq_to_clock_divider() 147 return DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ, (divider + 1) * 16); in clock_divider_to_carrier_freq() 153 return DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ, in clock_divider_to_freq() 176 DIV_ROUND_CLOSEST(CX25840_IR_REFCLK_FREQ / 1000000 * ns, 1000)); in ns_to_lpf_count() 182 return DIV_ROUND_CLOSEST(count * 1000, in lpf_count_to_ns() 189 return DIV_ROUND_CLOSEST(count, CX25840_IR_REFCLK_FREQ / 1000000); in lpf_count_to_us() 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() [all …]
|
| /linux/drivers/gpu/drm/vkms/ |
| H A D | vkms_formats.c | 600 out_pixel[3] = DIV_ROUND_CLOSEST(in_pixel->a, 257); in argb_u16_to_ARGB8888() 601 out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257); in argb_u16_to_ARGB8888() 602 out_pixel[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257); in argb_u16_to_ARGB8888() 603 out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); in argb_u16_to_ARGB8888() 609 out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->r, 257); in argb_u16_to_XRGB8888() 610 out_pixel[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257); in argb_u16_to_XRGB8888() 611 out_pixel[0] = DIV_ROUND_CLOSEST(in_pixel->b, 257); in argb_u16_to_XRGB8888() 616 out_pixel[3] = DIV_ROUND_CLOSEST(in_pixel->a, 257); in argb_u16_to_ABGR8888() 617 out_pixel[2] = DIV_ROUND_CLOSEST(in_pixel->b, 257); in argb_u16_to_ABGR8888() 618 out_pixel[1] = DIV_ROUND_CLOSEST(in_pixel->g, 257); in argb_u16_to_ABGR8888() [all …]
|
| /linux/drivers/clk/sunxi-ng/ |
| H A D | ccu_phase.c | 52 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()
|
| /linux/drivers/thermal/tegra/ |
| H A D | tegra30-tsensor.c | 198 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() 368 id, DIV_ROUND_CLOSEST(temps.crit_trip, 1000)); in tegra_tsensor_enable_hw_channel() 481 ts->calib.a = DIV_ROUND_CLOSEST((t2_90C - t1_25C) * 1000000, in tegra_tsensor_nvmem_setup() 497 ts->calib.r = DIV_ROUND_CLOSEST(ts->calib.n, ts->calib.m * 2); in tegra_tsensor_nvmem_setup()
|
| /linux/drivers/media/rc/ |
| H A D | meson-ir-tx.c | 81 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()
|