From patchwork Thu Nov 22 14:39:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 1783871 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 09637DF230 for ; Thu, 22 Nov 2012 15:05:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 022EFE6554 for ; Thu, 22 Nov 2012 07:05:53 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by gabe.freedesktop.org (Postfix) with ESMTP id B1CCCE5EE8 for ; Thu, 22 Nov 2012 07:05:38 -0800 (PST) Received: from debian (p5DCF0728.dip0.t-ipconnect.de [93.207.7.40]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0Mf6wH-1TvfWQ399V-00ObF7; Thu, 22 Nov 2012 16:05:36 +0100 Received: from sles11.fritz.box (sles11.fritz.box [192.168.178.22]) by debian (Postfix) with ESMTP id 1AA873F361; Thu, 22 Nov 2012 16:05:33 +0100 (CET) From: Egbert Eich To: dri-devel@lists.freedesktop.org Subject: [PATCH v3] DRM/KMS/EDID: Test EDDC if EDID announces more than one Extension Block (v3) Date: Thu, 22 Nov 2012 09:39:06 -0500 Message-Id: <1353595146-22737-1-git-send-email-eich@suse.com> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1353579788-30637-6-git-send-email-eich@suse.com> References: <1353579788-30637-6-git-send-email-eich@suse.com> MIME-Version: 1.0 X-Provags-ID: V02:K0:mTXdQIBu8bwyvQX6kDZx3hipybhRdHbZmdSfXV5REQx PpMRNX0mM5++Vg3U6QvlIUXYrjjat+4q84X0dnyHAoZ3N5N9dL iStQr7yL5WZG3m1uR3pG5ujAeOJhFqU5QhCatyUSi0MAGJhQmZ p9+tebs6Yxgzhp/s+Af/NR2zxctD/10al0/xBLrR1/JRzjRrHi m3SbbS70/JTg+t5ttYM0/MjbR+mCjFeRTnsK/+oPg0CfhL4Xl6 Be/hxh7DdXVHBsoUyn06SK9OVrXfPPlmmg7MscVfcg1t0+hTIw /kFHHxHfRW/FTdxlTilM81Zz9ZDk7HfDeuX61UnC6lGyPa8WYm IEBksJGKef2ODT0h8WJI= Cc: Egbert Eich , tiwai@suse.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org There are displays which announce EDID extension blocks in the Extension Flag of the EDID base block although they are not EDDC capable (ie. take a segment address at I2C slave address 0x30). We test this by looking for an EDID header which is only possible in the base block. If the segment address is not taken into account, this block will be identical to the base block in which case we stop reading further EEDID blocks, correct the extension flag and just return the base block. v2: Split up EDID fixup code into separate commit. v3: Worked in changes suggested by Ville Syrjälä : Reworded comment, Used memcmp(), Compared entire base block instead of signature only. Signed-off-by: Egbert Eich --- drivers/gpu/drm/drm_edid.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index a952cfe..b42fbc0 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -364,6 +364,16 @@ drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter) } if (drm_edid_block_valid(block + (valid_extensions + 1) * EDID_LENGTH, j, print_bad_edid)) { valid_extensions++; + /* If extension block 2 is identical to the base block the display is probably + * not EDDC cabable - despite of what the extension flag says - as it doesn't + * select the correct segment address: detect this condition and bail early. + */ + if (j == 2) { + if (memcmp(block + EDID_LENGTH * 2, block, EDID_LENGTH) == 0) { + valid_extensions = 0; + goto done_fix_extension_count; + } + } break; } }