From patchwork Thu Aug 23 07:05:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 1364501 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 B720BDF2AB for ; Thu, 23 Aug 2012 05:51:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A2769E93B for ; Wed, 22 Aug 2012 22:51:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id D9F109E746 for ; Wed, 22 Aug 2012 21:57:02 -0700 (PDT) Received: from epcpsbgm1.samsung.com (mailout3.samsung.com [203.254.224.33]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9600MKKZ1KMHM0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 23 Aug 2012 13:57:02 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-05-5035b81e74f2 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 5A.3E.17335.E18B5305; Thu, 23 Aug 2012 13:57:02 +0900 (KST) Received: from localhost.localdomain ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M9600IJVZ2FO100@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 23 Aug 2012 13:57:02 +0900 (KST) From: Shirish S To: dri-devel@lists.freedesktop.org Subject: [PATCH V2] drm: edid: add support for E-DDC Date: Thu, 23 Aug 2012 12:35:01 +0530 Message-id: <1345705501-26246-2-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1345705501-26246-1-git-send-email-s.shirish@samsung.com> References: <1345705501-26246-1-git-send-email-s.shirish@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jAV25HaYBBveucltc+fqezYHR4373 caYAxigum5TUnMyy1CJ9uwSujNmXv7IUNAhUPJ53krmBsZmni5GTQ0LARGLthDOsELaYxIV7 69m6GLk4hAQWMUpsm7aQCcJZzSTxbsstsCo2AXWJi5NXM4PYIgLKEn8nrmLsYuTgYBbQktiz WwgkLAw09PWtTywgNouAqsTrhf/AbF4BV4nDy7sZIZYpSLQuO8QOYnMKuEkcnHsZbKQQUM3c HzuZJjDyLmBkWMUomlqQXFCclJ5rqFecmFtcmpeul5yfu4kR7PNnUjsYVzZYHGIU4GBU4uHN iDUNEGJNLCuuzD3EKMHBrCTCGz4PKMSbklhZlVqUH19UmpNafIhRmoNFSZyXv88wQEggPbEk NTs1tSC1CCbLxMEp1cB47LLLUnetvLf3bc7XVmnkcOx+WP7i7WLz2ZqlOcIGQUGtryrMan8U rf7BqS7fz+A4Obxz+4200ukqJx/KP80xvFvHOrlls1n+35iJHpbS5qmT3hz7ZKmds8OGe+O9 E1F3OLdlfSmwvyL7cWXFaZeTZT98enhzdye+XPKPp+Cg4Ju8IA5l6UQlluKMREMt5qLiRACc 3Z+M9QEAAA== X-TM-AS-MML: No X-Mailman-Approved-At: Wed, 22 Aug 2012 22:44:24 -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 | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index a8743c3..33a3888 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -253,7 +253,9 @@ static int drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, int block, int len) { - unsigned char start = block * EDID_LENGTH; + unsigned short start = block * EDID_LENGTH; + unsigned char segment = block >> 1; + unsigned short segFlags = segment ? 0 : I2C_M_IGNORE_NAK; int ret, retries = 5; /* The core i2c driver will automatically retry the transfer if the @@ -264,27 +266,32 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, */ do { struct i2c_msg msgs[] = { - { + { /*set segment pointer */ + .addr = DDC_SEGMENT_ADDR, + .flags = segFlags, + .len = 1, + .buf = &segment, + }, { /*set offset */ .addr = DDC_ADDR, .flags = 0, .len = 1, .buf = &start, - }, { + }, { /*set data */ .addr = DDC_ADDR, .flags = I2C_M_RD, .len = len, .buf = buf, } }; - ret = i2c_transfer(adapter, msgs, 2); + ret = i2c_transfer(adapter, msgs, 3); if (ret == -ENXIO) { DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", adapter->name); break; } - } while (ret != 2 && --retries); + } while (ret != 3 && --retries); - return ret == 2 ? 0 : -1; + return ret == 3 ? 0 : -1; } static bool drm_edid_is_zero(u8 *in_edid, int length)