msm_fb: display: fix frame rate wrong calculation

For cmd mode the frame rate calculation result is wrong. Also in mdp
driver there are several places to do the same calculation. So fix the
wrong calculation and use a single func to do calculation.

Conflicts:

	drivers/video/msm/msm_fb.c

Change-Id: I3a4be39e480ce82677dcefb666202947f7f6d3c1
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit d4eb5a1a3ef0935ce6aeffb2b48974c01b9518b9)
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
This commit is contained in:
Huaibin Yang 2012-12-10 16:37:01 -08:00 committed by Stephen Boyd
parent e126957a07
commit c0e1c24799
2 changed files with 35 additions and 40 deletions

View file

@ -1419,18 +1419,20 @@ int mdp_ppp_pipe_wait(void)
u32 mdp_get_panel_framerate(struct msm_fb_data_type *mfd)
{
u32 frame_rate = 0, total_pixel;
u32 frame_rate = 0, pixel_rate = 0, total_pixel;
struct msm_panel_info *panel_info = &mfd->panel_info;
if (mfd->dest == DISPLAY_LCD) {
if (panel_info->type == MDDI_PANEL && panel_info->mddi.is_type1)
frame_rate = panel_info->lcd.refx100 / (100 * 2);
else
frame_rate = panel_info->lcd.refx100 / 100;
} else {
if (panel_info->type == MIPI_VIDEO_PANEL) {
frame_rate = panel_info->mipi.frame_rate;
} else {
total_pixel = (panel_info->lcdc.h_back_porch +
pixel_rate =
(panel_info->type == MIPI_CMD_PANEL ||
panel_info->type == MIPI_VIDEO_PANEL) ?
panel_info->mipi.dsi_pclk_rate :
panel_info->clk_rate;
if (!pixel_rate)
pr_warn("%s pixel rate is zero\n", __func__);
total_pixel =
(panel_info->lcdc.h_back_porch +
panel_info->lcdc.h_front_porch +
panel_info->lcdc.h_pulse_width +
panel_info->xres) *
@ -1438,13 +1440,26 @@ u32 mdp_get_panel_framerate(struct msm_fb_data_type *mfd)
panel_info->lcdc.v_front_porch +
panel_info->lcdc.v_pulse_width +
panel_info->yres);
if (total_pixel)
frame_rate = panel_info->clk_rate /
total_pixel;
frame_rate = pixel_rate / total_pixel;
else
pr_warn("%s total pixels are zero\n", __func__);
if (mfd->dest == DISPLAY_LCD) {
if (panel_info->type == MDDI_PANEL && panel_info->mddi.is_type1)
frame_rate = panel_info->lcd.refx100 / (100 * 2);
else if (panel_info->type != MIPI_CMD_PANEL)
frame_rate = panel_info->lcd.refx100 / 100;
}
}
if (frame_rate == 0)
if (frame_rate == 0) {
frame_rate = DEFAULT_FRAME_RATE;
pr_warn("%s frame rate=%d is default\n", __func__, frame_rate);
}
pr_debug("%s frame rate=%d total_pixel=%d, pixel_rate=%d\n", __func__,
frame_rate, total_pixel, pixel_rate);
return frame_rate;
}

View file

@ -1372,27 +1372,7 @@ static int msm_fb_register(struct msm_fb_data_type *mfd)
var->yres_virtual = panel_info->yres * mfd->fb_page +
((PAGE_SIZE - remainder)/fix->line_length) * mfd->fb_page;
var->bits_per_pixel = bpp * 8; /* FrameBuffer color depth */
if (mfd->dest == DISPLAY_LCD) {
if (panel_info->type == MDDI_PANEL && panel_info->mddi.is_type1)
var->reserved[3] = panel_info->lcd.refx100 / (100 * 2);
else
var->reserved[3] = panel_info->lcd.refx100 / 100;
} else {
if (panel_info->type == MIPI_VIDEO_PANEL) {
var->reserved[3] = panel_info->mipi.frame_rate;
} else {
var->reserved[3] = panel_info->clk_rate /
((panel_info->lcdc.h_back_porch +
panel_info->lcdc.h_front_porch +
panel_info->lcdc.h_pulse_width +
panel_info->xres) *
(panel_info->lcdc.v_back_porch +
panel_info->lcdc.v_front_porch +
panel_info->lcdc.v_pulse_width +
panel_info->yres));
}
}
pr_debug("reserved[3] %u\n", var->reserved[3]);
var->reserved[3] = mdp_get_panel_framerate(mfd);
/*
* id field for fb app