From patchwork Wed Aug 22 13:26:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 1364481 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id E00313FCAE for ; Thu, 23 Aug 2012 05:48:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE8509E7B5 for ; Wed, 22 Aug 2012 22:48:07 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by gabe.freedesktop.org (Postfix) with ESMTP id 909DFA0271 for ; Wed, 22 Aug 2012 04:26:08 -0700 (PDT) Received: from epcpsbgm1.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M950020QMFI1L20@mailout2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 22 Aug 2012 20:26:07 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-8e-5034c1cf0adb Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id EB.42.17335.FC1C4305; Wed, 22 Aug 2012 20:26: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 <0M9500025MCJTD70@mmp2.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 22 Aug 2012 20:26:07 +0900 (KST) From: Shirish S To: dri-devel@lists.freedesktop.org Subject: [PATCH V2] drm: edid: add support for E-DDC Date: Wed, 22 Aug 2012 18:56:16 +0530 Message-id: <1345641976-13307-2-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1345641976-13307-1-git-send-email-s.shirish@samsung.com> References: <1345641976-13307-1-git-send-email-s.shirish@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrEJMWRmVeSWpSXmKPExsVy+t9jQd3zB00CDBYftrC48vU9mwOjx/3u 40wBjFFcNimpOZllqUX6dglcGVsvaxTsF6j4cmYacwPjbp4uRk4OCQETiTf3T7JA2GISF+6t Z+ti5OIQEpjOKHHi8R8WCGc1k8S+rzvBqtgE1CUuTl7NDGKLCChL/J24ihHEZhaIlNi26S0b iC0MNPX1rU9g9SwCqhI9S56A1fAKuEpMWvwFapuCROuyQ+wgNqeAm8SWX+fBbCGgmiuLZzFP YORdwMiwilE0tSC5oDgpPddQrzgxt7g0L10vOT93EyPY58+kdjCubLA4xCjAwajEw+uRYBIg xJpYVlyZe4hRgoNZSYT30W6gEG9KYmVValF+fFFpTmrxIUZpDhYlcV7+PsMAIYH0xJLU7NTU gtQimCwTB6dUA+PEKwddjmoq7m+vl97wTJO1UfFm/m7x9yIfL3e+Za7iFLySb/Vg26o0HcX4 LZFJAn+PdgY6yV/50inkce7Zq5qlS07VrUs4ot3bbjPtnOn+9COh7yP4rh//lsjXO0HlFPPi 1uUy0rHlbwU0/ade7Pi/KuCjz2df11eudwVMvsQesV6ft+rbn/lKLMUZiYZazEXFiQCfZMGj 9QEAAA== X-TM-AS-MML: No X-Mailman-Approved-At: Wed, 22 Aug 2012 22:44:23 -0700 Cc: Shirish Shankarappa 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 From: Shirish Shankarappa 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 Shankarappa --- 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)