From df072230c0f546d0660ad2aedb71e0a8ade61087 Mon Sep 17 00:00:00 2001 From: Padmanabhan Komanduru Date: Wed, 3 May 2017 13:21:54 -0700 Subject: [PATCH] drm: edid: HDMI 2.0 HF-VSDB block parsing Adds parsing for HDMI 2.0 'HDMI Forum Vendor Specific Data Block'. This block is present in some HDMI 2.0 EDID's and gives information about scrambling support, SCDC, 3D Views, and others. Parsed parameters are stored in drm_connector structure. Change-Id: I018cfefea2fd3827d5f83c8e5717ebd95e497519 Signed-off-by: Jose Abreu Cc: Carlos Palminha Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Patch-mainline: dri-devel @ 10 Aug 2016 16:29 Signed-off-by: Jin Li Signed-off-by: Abhinav Kumar Signed-off-by: Padmanabhan Komanduru Signed-off-by: Tatenda Chipeperekwa --- drivers/gpu/drm/drm_edid.c | 34 ++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 12 ++++++++++++ include/drm/drm_edid.h | 5 +++++ 3 files changed, 51 insertions(+) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 75b0eb9ae531..287fbaac6cac 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3846,6 +3846,37 @@ add_YCbCr420VDB_modes(struct drm_connector *connector, struct edid *edid) return modes; } +static void +parse_hdmi_hf_vsdb(struct drm_connector *connector, const u8 *db) +{ + u8 len = cea_db_payload_len(db); + + if (len < 7) + return; + + if (db[4] != 1) + return; /* invalid version */ + + connector->max_tmds_char = db[5] * 5; + connector->scdc_present = db[6] & (1 << 7); + connector->rr_capable = db[6] & (1 << 6); + connector->flags_3d = db[6] & 0x7; + connector->supports_scramble = connector->scdc_present && + (db[6] & (1 << 3)); + + DRM_DEBUG_KMS("HDMI v2: max TMDS char %d, " + "scdc %s, " + "rr %s, " + "3D flags 0x%x, " + "scramble %s\n", + connector->max_tmds_char, + connector->scdc_present ? "available" : "not available", + connector->rr_capable ? "capable" : "not capable", + connector->flags_3d, + connector->supports_scramble ? + "supported" : "not supported"); +} + static void monitor_name(struct detailed_timing *t, void *data) { @@ -3972,6 +4003,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) /* HDMI Vendor-Specific Data Block */ if (cea_db_is_hdmi_vsdb(db)) drm_parse_hdmi_vsdb_audio(connector, db); + /* HDMI Forum Vendor-Specific Data Block */ + else if (cea_db_is_hdmi_forum_vsdb(db)) + parse_hdmi_hf_vsdb(connector, db); break; default: break; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index bb7250f644d7..131896879342 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -708,6 +708,11 @@ struct drm_cmdline_mode { * @hdr_avg_luminance: desired avg luminance obtained from HDR block * @hdr_min_luminance: desired min luminance obtained from HDR block * @hdr_supported: does the sink support HDR content + * @max_tmds_char: indicates the maximum TMDS Character Rate supported + * @scdc_present: when set the sink supports SCDC functionality + * @rr_capable: when set the sink is capable of initiating an SCDC read request + * @supports_scramble: when set the sink supports less than 340Mcsc scrambling + * @flags_3d: 3D view(s) supported by the sink, see drm_edid.h (DRM_EDID_3D_*) * @edid_corrupt: indicates whether the last read EDID was corrupt * @debugfs_entry: debugfs directory for this connector * @has_tile: is this connector connected to a tiled monitor @@ -892,6 +897,13 @@ struct drm_connector { u32 hdr_min_luminance; bool hdr_supported; + /* EDID bits HDMI 2.0 */ + int max_tmds_char; /* in Mcsc */ + bool scdc_present; + bool rr_capable; + bool supports_scramble; + int flags_3d; + /* Flag for raw EDID header corruption - used in Displayport * compliance testing - * Displayport Link CTS Core 1.2 rev1.1 4.2.2.6 */ diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index a992434ded99..44d22ad182dd 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -279,6 +279,11 @@ struct detailed_timing { #define DRM_ELD_CEA_SAD(mnl, sad) (20 + (mnl) + 3 * (sad)) +/* HDMI 2.0 */ +#define DRM_EDID_3D_INDEPENDENT_VIEW (1 << 2) +#define DRM_EDID_3D_DUAL_VIEW (1 << 1) +#define DRM_EDID_3D_OSD_DISPARITY (1 << 0) + struct edid { u8 header[8]; /* Vendor & product info */