Commit 4f9c81d6 authored by Ankit Nautiyal's avatar Ankit Nautiyal
Browse files

drm/i915/snps_hdmi_pll: Use clamp() instead of max(min())



The values of ana_cp_int, and ana_cp_prop are clamped between 1 and 127.
Use the more intuitive and readable clamp() macro instead of using
nested max(min(...)).

Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://lore.kernel.org/r/20250618130951.1596587-3-ankit.k.nautiyal@intel.com
parent b300a175
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ static void get_ana_cp_int_prop(u64 vco_clk,
		DIV64_U64_ROUND_CLOSEST(DIV_ROUND_DOWN_ULL(adjusted_vco_clk1, curve_2_scaled1),
					CURVE2_MULTIPLIER);

	*ana_cp_int = max(1, min(ana_cp_int_temp, 127));
	*ana_cp_int = clamp(ana_cp_int_temp, 1, 127);

	curve_2_scaled_int = curve_2_scaled1 * (*ana_cp_int);

@@ -125,7 +125,7 @@ static void get_ana_cp_int_prop(u64 vco_clk,
						       curve_1_interpolated);

	*ana_cp_prop = DIV64_U64_ROUND_UP(adjusted_vco_clk2, curve_2_scaled2);
	*ana_cp_prop = max(1, min(*ana_cp_prop, 127));
	*ana_cp_prop = clamp(*ana_cp_prop, 1, 127);
}

static void compute_hdmi_tmds_pll(u64 pixel_clock, u32 refclk,