From patchwork Wed Aug 29 14:46:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 1385471 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 E9040DF2AB for ; Wed, 29 Aug 2012 15:43:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E148B9F4E5 for ; Wed, 29 Aug 2012 08:43:01 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 1F7529E75D for ; Wed, 29 Aug 2012 04:44:08 -0700 (PDT) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9I001LILWPDP10@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 29 Aug 2012 20:44:07 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-a9-503e0087f452 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 95.0F.17335.7800E305; Wed, 29 Aug 2012 20:44:07 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M9I0077YLVGUR80@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 29 Aug 2012 20:44:07 +0900 (KST) From: Shirish S To: dri-devel@lists.freedesktop.org Subject: [PATCH V5] drm: edid: add support for E-DDC Date: Wed, 29 Aug 2012 20:16:28 +0530 Message-id: <1346251588-17104-2-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1346251588-17104-1-git-send-email-s.shirish@samsung.com> References: <1346251588-17104-1-git-send-email-s.shirish@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrIJMWRmVeSWpSXmKPExsVy+t9jQd12BrsAgykzuC2ufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxvFTk5gLdghU3Ht/mL2B8RRPFyMnh4SAicTe6T1sELaYxIV7 64FsLg4hgemMErduzmaFcFYzSRyeuJUdpIpNQF3i4uTVzCC2iICyxN+Jqxi7GDk4mAW0JPbs FgIJCwMNnfXrAhNImEVAVeJJUxhImFfAVWLjiiVMELsUJFqXHQKbyCngJrH21EkwWwio5uSK a0wTGHkXMDKsYhRNLUguKE5KzzXUK07MLS7NS9dLzs/dxAj2+DOpHYwrGywOMQpwMCrx8F7g tg0QYk0sK67MPcQowcGsJMKb+gooxJuSWFmVWpQfX1Sak1p8iFGag0VJnJe/zzBASCA9sSQ1 OzW1ILUIJsvEwSnVwHien5GpW0wr8iJH89HPZ2xcug8sdxbxNVvA1Fg2a7JU1KLPK7W1dq6q zdTVqGs8fVk6Iam6x3BbWpze5I41u97XFN6xl/u/wqHP1qCjbZeO5gR/hv8hK6seT877z1zo JukbcJNn5nppq7ajyln1rt5RLu3WZytlePo7F0eWRGVULp1+tU9UiaU4I9FQi7moOBEA+XM1 WfQBAAA= X-Mailman-Approved-At: Wed, 29 Aug 2012 08:40:27 -0700 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: , MIME-Version: 1.0 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 The current logic for probing ddc is limited to 2 blocks (256 bytes), this patch adds support for the 4 block (512) data. To do this, a single 8-bit segment index is passed to the display via the I2C address 30h. Data from the selected segment is then immediately read via the regular DDC2 address using a repeated I2C 'START' signal. Signed-off-by: Shirish S --- drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index bcc4725..b9ffc30 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -254,6 +254,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, int block, int len) { unsigned char start = block * EDID_LENGTH; + unsigned char segment = block >> 1; + unsigned char xfers = segment ? 3 : 2; int ret, retries = 5; /* The core i2c driver will automatically retry the transfer if the @@ -265,6 +267,11 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, do { struct i2c_msg msgs[] = { { + .addr = DDC_SEGMENT_ADDR, + .flags = segment ? 0 : I2C_M_IGNORE_NAK, + .len = 1, + .buf = &segment, + }, { .addr = DDC_ADDR, .flags = 0, .len = 1, @@ -276,15 +283,24 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, .buf = buf, } }; - ret = i2c_transfer(adapter, msgs, 2); + + /* + * Avoid sending the segment addr to not upset non-compliant ddc + * monitors. + */ + if (!segment) + ret = i2c_transfer(adapter, &msgs[1], xfers); + else + ret = i2c_transfer(adapter, msgs, xfers); + if (ret == -ENXIO) { DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", adapter->name); break; } - } while (ret != 2 && --retries); + } while (ret != xfers && --retries); - return ret == 2 ? 0 : -1; + return ret == xfers ? 0 : -1; } static bool drm_edid_is_zero(u8 *in_edid, int length)