From patchwork Thu Nov 1 10:30:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1684401 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9AFACE003B for ; Thu, 1 Nov 2012 10:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751836Ab2KAKa5 (ORCPT ); Thu, 1 Nov 2012 06:30:57 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:23691 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751487Ab2KAKa4 (ORCPT ); Thu, 1 Nov 2012 06:30:56 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MCT00E5J16W8QP0@mailout1.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 01 Nov 2012 19:30:54 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-18-50924f5e57fd Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F3.BE.01231.E5F42905; Thu, 01 Nov 2012 19:30:54 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MCT009QL17IWS40@mmp2.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 01 Nov 2012 19:30:54 +0900 (KST) From: Jingoo Han To: 'Florian Tobias Schandinat' Cc: linux-fbdev@vger.kernel.org, 'Sean Paul' , 'Jingoo Han' References: <011d01cdb81a$4914c1d0$db3e4570$%han@samsung.com> In-reply-to: Subject: [PATCH v3 4/8] video: exynos_dp: Improve EDID error handling Date: Thu, 01 Nov 2012 19:30:54 +0900 Message-id: <012701cdb81b$f919fc70$eb4df550$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac24Gkjta+Tb9VxGTiWIp02dvaPqfwAAFVVwAABNGjA= Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jQd04/0kBBkc3GVuc6PvA6sDo8XmT XABjFJdNSmpOZllqkb5dAldG59oTTAXL5Cs2TJ/K0sD4U6KLkZNDQsBEYt6MPlYIW0ziwr31 bF2MXBxCAtMZJda8aGKFcGYxSVz49JAFpIpNQE3iy5fD7F2MHBwiAlYSm7ZqgpjMAlkSp48p gFQICdhKrGv5xAhicwrwSKz708kMYgsLuEps/fkBLM4ioCox/8AJJpBWXqD6ud+cQcK8AoIS PybfA1vELKAlsX7ncSYIW15i85q3zCDlEgLqEo/+6oKEQfYffXOWGaJERGLfi3eMExiFZiGZ NAvJpFlIJs1C0rKAkWUVo2hqQXJBcVJ6rqFecWJucWleul5yfu4mRnAIP5PawbiyweIQowAH oxIPr2HpxAAh1sSy4srcQ4wSHMxKIryPu4FCvCmJlVWpRfnxRaU5qcWHGKU5WJTEeZs9UgKE BNITS1KzU1MLUotgskwcnFINjAr6E7rYrJn6V8wR07YVjFr7vsaQR1r3v8OurpIlc+v+7kiY uEvpldZEBSbOL0pl//QV953X/xfR81DybCjrLPGjnz/whTOfvVW/eZf8ovnm93YbaJw/rRIo f+zN1aOB1XcdzBz+pNbpHdH/Jmfnvnirce7SG36G3JxHpniyND0uPtRw9s2KmUosxRmJhlrM RcWJAD9K5ZRdAgAA Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org From: Sean Paul EDID error handling has 2 problems: - It doesn't fail as early as it can - The retry counts for i2c and aux transactions are huge This patch fails if the initial i2c transaction fails, and reduces the aux and i2c retry counts down to 3. [jg1.han@samsung.com: reduced the retry count of exynos_dp_read_byte_from_dpcd()] Signed-off-by: Sean Paul Signed-off-by: Jingoo Han --- Added 'From: Sean Paul ' drivers/video/exynos/exynos_dp_core.c | 13 ++++++++----- drivers/video/exynos/exynos_dp_reg.c | 11 +++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c index 878b4b6..ee957e0 100644 --- a/drivers/video/exynos/exynos_dp_core.c +++ b/drivers/video/exynos/exynos_dp_core.c @@ -90,9 +90,11 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) */ /* Read Extension Flag, Number of 128-byte EDID extension blocks */ - exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, + retval = exynos_dp_read_byte_from_i2c(dp, I2C_EDID_DEVICE_ADDR, EDID_EXTENSION_FLAG, &extend_block); + if (retval) + return retval; if (extend_block > 0) { dev_dbg(dp->dev, "EDID data includes a single extension!\n"); @@ -181,14 +183,15 @@ static int exynos_dp_handle_edid(struct exynos_dp_device *dp) int retval; /* Read DPCD DPCD_ADDR_DPCD_REV~RECEIVE_PORT1_CAP_1 */ - exynos_dp_read_bytes_from_dpcd(dp, - DPCD_ADDR_DPCD_REV, - 12, buf); + retval = exynos_dp_read_bytes_from_dpcd(dp, DPCD_ADDR_DPCD_REV, + 12, buf); + if (retval) + return retval; /* Read EDID */ for (i = 0; i < 3; i++) { retval = exynos_dp_read_edid(dp); - if (retval == 0) + if (!retval) break; } diff --git a/drivers/video/exynos/exynos_dp_reg.c b/drivers/video/exynos/exynos_dp_reg.c index 3f5ca8a..dc09278 100644 --- a/drivers/video/exynos/exynos_dp_reg.c +++ b/drivers/video/exynos/exynos_dp_reg.c @@ -491,7 +491,7 @@ int exynos_dp_read_byte_from_dpcd(struct exynos_dp_device *dp, int i; int retval; - for (i = 0; i < 10; i++) { + for (i = 0; i < 3; i++) { /* Clear AUX CH data buffer */ reg = BUF_CLR; writel(reg, dp->reg_base + EXYNOS_DP_BUFFER_DATA_CTL); @@ -552,7 +552,7 @@ int exynos_dp_write_bytes_to_dpcd(struct exynos_dp_device *dp, else cur_data_count = count - start_offset; - for (i = 0; i < 10; i++) { + for (i = 0; i < 3; i++) { /* Select DPCD device address */ reg = AUX_ADDR_7_0(reg_addr + start_offset); writel(reg, dp->reg_base + EXYNOS_DP_AUX_ADDR_7_0); @@ -617,7 +617,7 @@ int exynos_dp_read_bytes_from_dpcd(struct exynos_dp_device *dp, cur_data_count = count - start_offset; /* AUX CH Request Transaction process */ - for (i = 0; i < 10; i++) { + for (i = 0; i < 3; i++) { /* Select DPCD device address */ reg = AUX_ADDR_7_0(reg_addr + start_offset); writel(reg, dp->reg_base + EXYNOS_DP_AUX_ADDR_7_0); @@ -700,7 +700,7 @@ int exynos_dp_read_byte_from_i2c(struct exynos_dp_device *dp, int i; int retval; - for (i = 0; i < 10; i++) { + for (i = 0; i < 3; i++) { /* Clear AUX CH data buffer */ reg = BUF_CLR; writel(reg, dp->reg_base + EXYNOS_DP_BUFFER_DATA_CTL); @@ -708,7 +708,6 @@ int exynos_dp_read_byte_from_i2c(struct exynos_dp_device *dp, /* Select EDID device */ retval = exynos_dp_select_i2c_device(dp, device_addr, reg_addr); if (retval != 0) { - dev_err(dp->dev, "Select EDID device fail!\n"); continue; } @@ -750,7 +749,7 @@ int exynos_dp_read_bytes_from_i2c(struct exynos_dp_device *dp, int retval = 0; for (i = 0; i < count; i += 16) { - for (j = 0; j < 100; j++) { + for (j = 0; j < 3; j++) { /* Clear AUX CH data buffer */ reg = BUF_CLR; writel(reg, dp->reg_base + EXYNOS_DP_BUFFER_DATA_CTL);