From patchwork Wed Mar 23 17:06:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marius Vlad X-Patchwork-Id: 8652331 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F5D4C0553 for ; Wed, 23 Mar 2016 17:05:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9FB6B203DA for ; Wed, 23 Mar 2016 17:05:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 35CE2203B7 for ; Wed, 23 Mar 2016 17:05:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED3346E016; Wed, 23 Mar 2016 17:05:51 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 955DD6E016; Wed, 23 Mar 2016 17:05:49 +0000 (UTC) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 23 Mar 2016 10:05:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,383,1455004800"; d="scan'208";a="940087911" Received: from mcvlad-wk.rb.intel.com ([10.237.105.57]) by orsmga002.jf.intel.com with ESMTP; 23 Mar 2016 10:05:30 -0700 From: Marius Vlad To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 23 Mar 2016 19:06:37 +0200 Message-Id: <1458752797-18746-1-git-send-email-marius.c.vlad@intel.com> X-Mailer: git-send-email 2.7.0 Subject: [Intel-gfx] [PATCH] drm: Add support for EDID injection. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow the possibility to return an copy of the injected EDID when the connector has been forced and an EDID has been specified over the debugfs interface. Signed-off-by: Marius Vlad --- drivers/gpu/drm/drm_edid.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 414d7f6..239f9b1 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1075,6 +1075,19 @@ static bool drm_edid_is_zero(const u8 *in_edid, int length) return true; } +static struct edid * +drm_do_get_override_edid(struct drm_connector *connector) +{ + struct edid *edid = NULL; + + if (connector->override_edid && connector->edid_blob_ptr->data) { + edid = kmemdup(connector->edid_blob_ptr->data, + connector->edid_blob_ptr->length, GFP_KERNEL); + } + + return edid; +} + /** * drm_edid_block_valid - Sanity check the EDID block (base or extension) * @raw_edid: pointer to raw EDID block @@ -1385,10 +1398,14 @@ struct edid *drm_get_edid(struct drm_connector *connector, { struct edid *edid; - if (!drm_probe_ddc(adapter)) - return NULL; + if (!connector->override_edid) { + if (!drm_probe_ddc(adapter)) + return NULL; + edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); + } else { + edid = drm_do_get_override_edid(connector); + } - edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter); if (edid) drm_get_displayid(connector, edid); return edid;