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

Commit 7e0545ce authored by Veera Sundaram Sankaran's avatar Veera Sundaram Sankaran
Browse files

msm: mdss: match pixclock calculation for videomode and fb var



When multiple panel timings are available and enumerating videomode
list, pixclock is calculated using htotal, vtotal and refresh rate.
But fb var struct is populated with actual pixclock value calculated
by DSI. This pixclock mismatch would cause issues, when usermode
does GET_VSCREENINFO/PUT_VSCREENINFO. Fix by using the same pixclock
calculation for both structures.

Change-Id: I42bfc40b5904ec80f20b296e3b4610ca3b2c5ee0
[veeras@codeaurora.org: Resolved conflicts in mdss_fb.c]
Signed-off-by: default avatarVeera Sundaram Sankaran <veeras@codeaurora.org>
parent aa6c3c5f
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -3388,6 +3388,8 @@ static void mdss_fb_var_to_panelinfo(struct fb_var_screeninfo *var,
void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
						struct fb_var_screeninfo *var)
{
	u32 frame_rate;

	var->xres = mdss_fb_get_panel_xres(pinfo);
	var->yres = pinfo->yres;
	var->lower_margin = pinfo->lcdc.v_front_porch -
@@ -3399,9 +3401,21 @@ void mdss_panelinfo_to_fb_var(struct mdss_panel_info *pinfo,
	var->left_margin = pinfo->lcdc.h_back_porch;
	var->hsync_len = pinfo->lcdc.h_pulse_width;

	if (pinfo->clk_rate)
		var->pixclock = KHZ2PICOS((unsigned long int)
			pinfo->clk_rate/1000);
	frame_rate = mdss_panel_get_framerate(pinfo);
	if (frame_rate) {
		unsigned long clk_rate, h_total, v_total;

		h_total = var->xres + var->left_margin
			+ var->right_margin + var->hsync_len;
		v_total = var->yres + var->lower_margin
			+ var->upper_margin + var->vsync_len;
		clk_rate = h_total * v_total * frame_rate;
		var->pixclock = KHZ2PICOS(clk_rate / 1000);
	} else if (pinfo->clk_rate) {
		var->pixclock = KHZ2PICOS(
				(unsigned long int) pinfo->clk_rate / 1000);
	}

	if (pinfo->physical_width)
		var->width = pinfo->physical_width;
	if (pinfo->physical_height)