summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/msm
diff options
context:
space:
mode:
authorNarender Ankam <nankam@codeaurora.org>2019-09-10 17:29:33 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2020-03-03 02:32:04 -0800
commit6f43fdaba403ee9ebe37d18b931714b3563ea3f8 (patch)
treeabb7c039807dd170ab6edf1f2774563a7dc6d709 /drivers/video/fbdev/msm
parentaa19db6cfde4e937957cbcd32dfb70f39b371535 (diff)
msm: mdss: hdmi: check if given resolution is CE video format
As per CEA-861 spec, any standard resolution ranging from VIC=2 to VIC=107 are CE video formats. All other non standard resolutions and VIC=1 (640x480p) are IT video formats. Check if the output video format timing is a CE video format or an IT video format. Change-Id: I26405e1cb77a89ea81acb633ee2475021d61f116 Signed-off-by: Narender Ankam <nankam@codeaurora.org> Signed-off-by: Ramendra Kumar <ramendra@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev/msm')
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_tx.c7
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_util.c63
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_util.h3
-rw-r--r--drivers/video/fbdev/msm/mdss_panel.h3
4 files changed, 72 insertions, 4 deletions
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.c b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
index 33345d5c36da..12955e955ba5 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_tx.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
@@ -1862,7 +1862,6 @@ static int hdmi_tx_read_edid(struct hdmi_tx_ctrl *hdmi_ctrl)
}
} while ((cea_blks-- > 0) && (block++ < MAX_EDID_BLOCKS));
end:
-
return ret;
}
@@ -4033,9 +4032,11 @@ sysfs_err:
static int hdmi_tx_evt_handle_check_param(struct hdmi_tx_ctrl *hdmi_ctrl)
{
+ struct mdss_panel_info *pinfo = &hdmi_ctrl->panel_data.panel_info;
int new_vic = -1;
int rc = 0;
+ pinfo->is_ce_mode = false;
new_vic = hdmi_panel_get_vic(hdmi_ctrl->evt_arg, &hdmi_ctrl->ds_data);
if ((new_vic < 0) || (new_vic > HDMI_VFRMT_MAX)) {
@@ -4052,6 +4053,7 @@ static int hdmi_tx_evt_handle_check_param(struct hdmi_tx_ctrl *hdmi_ctrl)
rc = 1;
DEV_DBG("%s: res change %d ==> %d\n", __func__,
hdmi_ctrl->vic, new_vic);
+ goto done;
}
/*
@@ -4063,6 +4065,8 @@ static int hdmi_tx_evt_handle_check_param(struct hdmi_tx_ctrl *hdmi_ctrl)
rc = 1;
DEV_DBG("%s: Bitdepth changed\n", __func__);
}
+done:
+ pinfo->is_ce_mode = hdmi_util_is_ce_mode(new_vic);
end:
return rc;
}
@@ -5115,6 +5119,7 @@ static int hdmi_tx_probe(struct platform_device *pdev)
hdmi_ctrl->pdata.primary = true;
hdmi_ctrl->vic = vic;
hdmi_ctrl->panel_data.panel_info.is_prim_panel = true;
+ hdmi_ctrl->panel_data.panel_info.is_ce_mode = true;
hdmi_ctrl->panel_data.panel_info.cont_splash_enabled =
hdmi_ctrl->mdss_util->panel_intf_status(DISPLAY_1,
MDSS_PANEL_INTF_HDMI) ? true : false;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.c b/drivers/video/fbdev/msm/mdss_hdmi_util.c
index 8e854c54bae8..88bceabc4783 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_util.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_util.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, 2019, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -566,6 +566,67 @@ int msm_hdmi_get_timing_info(
return ret;
}
+static u32 cea_mode_alternate_clock(struct msm_hdmi_mode_timing_info *info)
+{
+ u32 clock = info->pixel_freq;
+
+ if (info->refresh_rate % 6 != 0)
+ return clock;
+
+ clock = DIV_ROUND_CLOSEST(clock * 1000, 1001);
+
+ return clock;
+}
+
+bool hdmi_util_is_ce_mode(u32 vic)
+{
+ struct msm_hdmi_mode_timing_info info1 = {0};
+ struct msm_hdmi_mode_timing_info info2 = {0};
+ u32 mode = 0;
+ u32 clock1, clock2, clock2_alt;
+ bool is_ce_mode = false;
+
+ if (vic <= HDMI_VFRMT_640x480p60_4_3) {
+ is_ce_mode = false;
+ goto end;
+ }
+
+ if (vic >= HDMI_VFRMT_720x480p60_4_3 &&
+ vic <= HDMI_VFRMT_3840x2160p60_64_27) {
+ is_ce_mode = true;
+ goto end;
+ }
+
+ msm_hdmi_get_timing_info(&info1, vic);
+
+ for (mode = HDMI_VFRMT_720x480p60_4_3; mode < HDMI_VFRMT_END; mode++) {
+
+ msm_hdmi_get_timing_info(&info2, mode);
+
+ clock1 = info1.pixel_freq;
+ clock2 = info2.pixel_freq;
+ clock2_alt = cea_mode_alternate_clock(&info2);
+
+ if ((clock1 == clock2) || (clock1 == clock2_alt)) {
+ if (info1.active_h == info2.active_h &&
+ info1.front_porch_h == info2.front_porch_h &&
+ info1.pulse_width_h == info2.pulse_width_h &&
+ info1.back_porch_h == info2.back_porch_h &&
+ info1.active_v == info2.active_v &&
+ info1.front_porch_v == info2.front_porch_v &&
+ info1.pulse_width_v == info2.pulse_width_v &&
+ info1.back_porch_v == info2.back_porch_v) {
+ is_ce_mode = true;
+ break;
+ }
+ }
+ continue;
+ }
+end:
+ pr_debug("%s: vic = %d, is_ce_mode = %d\n", __func__, vic, is_ce_mode);
+ return is_ce_mode;
+}
+
int hdmi_get_supported_mode(struct msm_hdmi_mode_timing_info *info,
struct hdmi_util_ds_data *ds_data, u32 mode)
{
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.h b/drivers/video/fbdev/msm/mdss_hdmi_util.h
index fe554f8e9e67..2f752dc79c7a 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_util.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_util.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -490,6 +490,7 @@ static inline int hdmi_tx_get_h_total(const struct msm_hdmi_mode_timing_info *t)
return 0;
}
+bool hdmi_util_is_ce_mode(u32 vic);
/* video timing related utility routines */
int hdmi_get_video_id_code(struct msm_hdmi_mode_timing_info *timing_in,
struct hdmi_util_ds_data *ds_data);
diff --git a/drivers/video/fbdev/msm/mdss_panel.h b/drivers/video/fbdev/msm/mdss_panel.h
index f8993f3774e6..6211191c378c 100644
--- a/drivers/video/fbdev/msm/mdss_panel.h
+++ b/drivers/video/fbdev/msm/mdss_panel.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2018, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2008-2020, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -800,6 +800,7 @@ struct mdss_panel_info {
u32 rst_seq_len;
u32 vic; /* video identification code */
u32 deep_color;
+ bool is_ce_mode; /* CE video format */
struct mdss_rect roi;
struct mdss_dsi_dual_pu_roi dual_roi;
int pwm_pmic_gpio;