summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarender Ankam <nankam@codeaurora.org>2019-11-12 12:58:50 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2020-03-03 02:33:31 -0800
commitd529c3c30d21efb96378bf050415d3ff82eb02b7 (patch)
treec06a496480a069c4ceb8a79adbca4499a3beee0a
parent3399105cab52dd586f945d09c0bf56dcbf0f3b07 (diff)
msm: mdss: hdmi: parse E-EDID's COLORIMETRY data block
As part of EDID parser, parse E-EDID's COLORIMETRY data block. Change-Id: I37fb2a436e5c2520b3e0d0c7411047514aecfbcf Signed-off-by: Narender Ankam <nankam@codeaurora.org> Signed-off-by: Ramendra Kumar <ramendra@codeaurora.org>
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_edid.c44
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_edid.h12
2 files changed, 55 insertions, 1 deletions
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_edid.c b/drivers/video/fbdev/msm/mdss_hdmi_edid.c
index fec364b15b22..67697025c3bb 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_edid.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_edid.c
@@ -92,6 +92,7 @@ enum extended_data_block_types {
VIDEO_CAPABILITY_DATA_BLOCK = 0x0,
VENDOR_SPECIFIC_VIDEO_DATA_BLOCK = 0x01,
HDMI_VIDEO_DATA_BLOCK = 0x04,
+ COLORIMETRY_DATA_BLOCK = 0x05,
HDR_STATIC_METADATA_DATA_BLOCK = 0x06,
Y420_VIDEO_DATA_BLOCK = 0x0E,
VIDEO_FORMAT_PREFERENCE_DATA_BLOCK = 0x0D,
@@ -130,6 +131,11 @@ struct hdmi_edid_y420_cmdb {
u32 len;
};
+struct hdmi_edid_colorimetry {
+ u8 standards;
+ u8 metadata_profiles;
+};
+
struct hdmi_edid_ctrl {
u8 pt_scan_info;
u8 it_scan_info;
@@ -166,6 +172,7 @@ struct hdmi_edid_ctrl {
struct hdmi_edid_sink_caps sink_caps;
struct hdmi_edid_override_data override_data;
struct hdmi_edid_hdr_data hdr_data;
+ struct hdmi_edid_colorimetry colorimetry;
};
static bool hdmi_edid_is_mode_supported(struct hdmi_edid_ctrl *edid_ctrl,
@@ -1142,6 +1149,26 @@ static void hdmi_edid_parse_hvdb(struct hdmi_edid_ctrl *edid_ctrl,
}
+static void hdmi_edid_parse_colorimetry(
+ struct hdmi_edid_ctrl *edid_ctrl, const u8 *in_buf)
+{
+ u8 len = 0;
+
+ if (!edid_ctrl) {
+ DEV_ERR("%s: invalid input\n", __func__);
+ return;
+ }
+
+ len = in_buf[0] & 0x1F;
+ if ((in_buf[1] != COLORIMETRY_DATA_BLOCK) || (len < 3)) {
+ DEV_ERR("%s: Not a Colorimetry tag code\n", __func__);
+ return;
+ }
+
+ edid_ctrl->colorimetry.standards = in_buf[2];
+ edid_ctrl->colorimetry.metadata_profiles = in_buf[3];
+}
+
static void hdmi_edid_extract_extended_data_blocks(
struct hdmi_edid_ctrl *edid_ctrl, const u8 *in_buf)
{
@@ -1225,6 +1252,11 @@ static void hdmi_edid_extract_extended_data_blocks(
hdmi_edid_parse_hdrdb(edid_ctrl, etag);
edid_ctrl->hdr_supported = true;
break;
+ case COLORIMETRY_DATA_BLOCK:
+ DEV_DBG("%s found COLORIMETRY block. byte 3 = 0x%x",
+ __func__, etag[2]);
+ hdmi_edid_parse_colorimetry(edid_ctrl, etag);
+ break;
default:
DEV_DBG("%s: Tag Code %d not supported\n",
__func__, etag[1]);
@@ -2692,6 +2724,18 @@ void hdmi_edid_get_hdr_data(void *input,
*hdr_data = &edid_ctrl->hdr_data;
}
+u8 hdmi_edid_get_colorimetry(void *input)
+{
+ struct hdmi_edid_ctrl *edid_ctrl = (struct hdmi_edid_ctrl *)input;
+
+ if (!edid_ctrl) {
+ DEV_ERR("%s: invalid input\n", __func__);
+ return 0;
+ }
+
+ return edid_ctrl->colorimetry.standards;
+}
+
bool hdmi_edid_is_s3d_mode_supported(void *input, u32 video_mode, u32 s3d_mode)
{
int i;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_edid.h b/drivers/video/fbdev/msm/mdss_hdmi_edid.h
index 63785e95bd59..ae4f47ca42aa 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_edid.h
+++ b/drivers/video/fbdev/msm/mdss_hdmi_edid.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
@@ -20,6 +20,15 @@
#define EDID_BLOCK_ADDR 0xA0
#define MAX_EDID_BLOCKS 5
+#define EDID_COLORIMETRY_xvYCC_601 (1 << 0)
+#define EDID_COLORIMETRY_xvYCC_709 (1 << 1)
+#define EDID_COLORIMETRY_sYCC_601 (1 << 2)
+#define EDID_COLORIMETRY_ADBYCC_601 (1 << 3)
+#define EDID_COLORIMETRY_ADB_RGB (1 << 4)
+#define EDID_COLORIMETRY_BT2020_CYCC (1 << 5)
+#define EDID_COLORIMETRY_BT2020_YCC (1 << 6)
+#define EDID_COLORIMETRY_BT2020_RGB (1 << 7)
+
struct hdmi_edid_init_data {
struct kobject *kobj;
struct hdmi_util_ds_data ds_data;
@@ -83,5 +92,6 @@ void hdmi_edid_config_override(void *input, bool enable,
void hdmi_edid_set_max_pclk_rate(void *input, u32 max_pclk_khz);
bool hdmi_edid_is_audio_supported(void *input);
u32 hdmi_edid_get_sink_caps_max_tmds_clk(void *input);
+u8 hdmi_edid_get_colorimetry(void *input);
#endif /* __HDMI_EDID_H__ */