DIV_ROUND_CLOSEST
*ref_div = min(max(DIV_ROUND_CLOSEST(den, post_div), 1u), ref_div_max);
*fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);
*ref_div = DIV_ROUND_CLOSEST(*ref_div * fb_div_max, *fb_div);
clock = DIV_ROUND_CLOSEST(clock * 1001, 1000);
clock = DIV_ROUND_CLOSEST(clock * 1000, 1001);
refresh = DIV_ROUND_CLOSEST(num, den);
afe_clk_khz = DIV_ROUND_CLOSEST(intel_dsi->pclk * bpp,
cdclk_state->cdclk = DIV_ROUND_CLOSEST(cdclk_state->vco, div);
int ratio = DIV_ROUND_CLOSEST(vco, dev_priv->cdclk.hw.ref);
switch (DIV_ROUND_CLOSEST(vco, cdclk)) {
cdclk_state->cdclk = DIV_ROUND_CLOSEST(cdclk_state->vco, div);
int ratio = DIV_ROUND_CLOSEST(vco, dev_priv->cdclk.hw.ref);
switch (DIV_ROUND_CLOSEST(vco, cdclk)) {
rawclk |= CNP_RAWCLK_FRAC(DIV_ROUND_CLOSEST(1000,
cdclk_state->cdclk = DIV_ROUND_CLOSEST(cdclk_state->vco,
cdclk_state->cdclk = DIV_ROUND_CLOSEST(cdclk_state->vco,
return DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1, cdclk) - 1;
divider = DIV_ROUND_CLOSEST(dev_priv->hpll_freq << 1,
I915_WRITE(CDCLK_FREQ, DIV_ROUND_CLOSEST(cdclk, 1000) - 1);
return DIV_ROUND_CLOSEST(cdclk - 1000, 500);
return DIV_ROUND_CLOSEST(ref_freq << 1, divider + 1);
desired_divisor = DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
return DIV_ROUND_CLOSEST(iclk_virtual_root_freq,
clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n + 2);
clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
clock->vco = DIV_ROUND_CLOSEST(refclk * clock->m, clock->n);
clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
clock->dot = DIV_ROUND_CLOSEST(clock->vco, clock->p);
clock.m2 = DIV_ROUND_CLOSEST(target * clock.p * clock.n,
return DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
return DIV_ROUND_CLOSEST(dev_priv->cdclk.hw.cdclk, 2000);
return DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
fxp = DIV_ROUND_CLOSEST(KHz(DP_EDP_BACKLIGHT_FREQ_BASE_KHZ), freq);
fxp_min = DIV_ROUND_CLOSEST(fxp * 3, 4);
fxp_max = DIV_ROUND_CLOSEST(fxp * 5, 4);
f = clamp(DIV_ROUND_CLOSEST(fxp, 1 << pn), 1, 255);
return DIV_ROUND_CLOSEST(KHz(dev_priv->rawclk_freq), pwm_freq_hz);
return DIV_ROUND_CLOSEST(KHz(19200), pwm_freq_hz);
return DIV_ROUND_CLOSEST(MHz(24), pwm_freq_hz * mul);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul);
return DIV_ROUND_CLOSEST(KHz(dev_priv->rawclk_freq), pwm_freq_hz * 128);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 32);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 128);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * mul);
linetime = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
ips_linetime = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
ia_freq = DIV_ROUND_CLOSEST(ia_freq, 100);
return DIV_ROUND_CLOSEST(rps->gpll_ref_freq * (val - 0xb7), 1000);
return DIV_ROUND_CLOSEST(1000 * val, rps->gpll_ref_freq) + 0xb7;
return DIV_ROUND_CLOSEST(rps->gpll_ref_freq * val, 2 * 2 * 1000);
return DIV_ROUND_CLOSEST(2 * 1000 * val, rps->gpll_ref_freq) * 2;
return DIV_ROUND_CLOSEST(val * GT_FREQUENCY_MULTIPLIER,
return DIV_ROUND_CLOSEST(val * GEN9_FREQ_SCALER,
return DIV_ROUND_CLOSEST(val, GT_FREQUENCY_MULTIPLIER);
DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 1000));
contrast = DIV_ROUND_CLOSEST(255 << 6, 235 - 16);
brightness = -DIV_ROUND_CLOSEST(16 * 255, 235 - 16);
sh_scale = DIV_ROUND_CLOSEST(128 << 7, 240 - 128);
pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
div1_value = DIV_ROUND_CLOSEST(ddr_clk, 20000);
dsi_clk_khz = DIV_ROUND_CLOSEST(pclk * bpp, lane_count);
*fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den);