Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b06d8023 authored by Lipsa Rout's avatar Lipsa Rout Committed by Ritesh Kumar
Browse files

disp: msm: dsi: Fix porch calculation issue for constant fps



For constant fps feature, porch is calculated based on supported
clk rates. Currently, data type of local variables used for porch
calculation is u32 which leads to incorrect porch calculation for
higher clk rates. So, update the data type to u64.

Change-Id: I8eb04487d1dcce05989448c0b063e56752af412b
Signed-off-by: default avatarLipsa Rout <lrout@codeaurora.org>
Signed-off-by: default avatarRitesh Kumar <riteshk@codeaurora.org>
parent ba8899f3
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -5934,7 +5934,7 @@ void dsi_display_adjust_mode_timing(
			struct dsi_display_mode *dsi_mode,
			int lanes, int bpp)
{
	u32 new_htotal, new_vtotal, htotal, vtotal, old_htotal;
	u64 new_htotal, new_vtotal, htotal, vtotal, old_htotal, div;

	if (!dyn_clk_caps->maintain_const_fps)
		return;
@@ -5949,8 +5949,9 @@ void dsi_display_adjust_mode_timing(
	case DSI_DYN_CLK_TYPE_CONST_FPS_ADJUST_HFP:
		vtotal = DSI_V_TOTAL(&dsi_mode->timing);
		old_htotal = DSI_H_TOTAL_DSC(&dsi_mode->timing);
		new_htotal = (dsi_mode->timing.clk_rate_hz * lanes);
		new_htotal /= (bpp * vtotal * dsi_mode->timing.refresh_rate);
		new_htotal = dsi_mode->timing.clk_rate_hz * lanes;
		div = bpp * vtotal * dsi_mode->timing.refresh_rate;
		do_div(new_htotal, div);
		if (old_htotal > new_htotal)
			dsi_mode->timing.h_front_porch -=
					(old_htotal - new_htotal);
@@ -5961,8 +5962,9 @@ void dsi_display_adjust_mode_timing(

	case DSI_DYN_CLK_TYPE_CONST_FPS_ADJUST_VFP:
		htotal = DSI_H_TOTAL_DSC(&dsi_mode->timing);
		new_vtotal = (dsi_mode->timing.clk_rate_hz * lanes);
		new_vtotal /= (bpp * htotal * dsi_mode->timing.refresh_rate);
		new_vtotal = dsi_mode->timing.clk_rate_hz * lanes;
		div = bpp * htotal * dsi_mode->timing.refresh_rate;
		do_div(new_vtotal, div);
		dsi_mode->timing.v_front_porch = new_vtotal -
				dsi_mode->timing.v_back_porch -
				dsi_mode->timing.v_sync_width -