From patchwork Thu Nov 1 10:21:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1684241 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 78836E003B for ; Thu, 1 Nov 2012 10:21:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757601Ab2KAKV7 (ORCPT ); Thu, 1 Nov 2012 06:21:59 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:58494 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757363Ab2KAKV6 (ORCPT ); Thu, 1 Nov 2012 06:21:58 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MCT007J20SJ1150@mailout2.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 01 Nov 2012 19:21:57 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-44-50924d4470a3 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 82.CC.01231.44D42905; Thu, 01 Nov 2012 19:21:56 +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 <0MCT009RA0SKM940@mmp2.samsung.com> for linux-fbdev@vger.kernel.org; Thu, 01 Nov 2012 19:21:56 +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: <011d01cdb81a$4914c1d0$db3e4570$%han@samsung.com> Subject: [PATCH v3 4/8] video: exynos_dp: Improve EDID error handling Date: Thu, 01 Nov 2012 19:21:56 +0900 Message-id: <012001cdb81a$b87fb4d0$297f1e70$%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+Tb9VxGTiWIp02dvaPqfwAAFVVw Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrFLMWRmVeSWpSXmKPExsVy+t9jQV0X30kBBls/WFuc6PvA6sDo8XmT XABjFJdNSmpOZllqkb5dAlfGtZUbWAtOyFVcaCttYFwl0cXIySEhYCJxZPJWdghbTOLCvfVs XYxcHEIC0xklpuy6yg7hzGKS6Fy7hRWkik1ATeLLl8NACQ4OEQEriU1bNUFMZoEsidPHFEAq hARsJda1fGIEsTkF7CRaHzYxgdjCAq4SW39+AIuzCKhK7Pkynw3E5gWq3713OiuELSjxY/I9 FhCbWUBLYv3O40wQtrzE5jVvmUFWSQioSzz6qwsSFhEwkjiwfipUuYjEvhfvGCcwCs1CMmkW kkmzkEyahaRlASPLKkbR1ILkguKk9FxDveLE3OLSvHS95PzcTYzgEH4mtYNxZYPFIUYBDkYl Hl7D0okBQqyJZcWVuYcYJTiYlUR4H3cDhXhTEiurUovy44tKc1KLDzFKc7AoifM2e6QECAmk J5akZqemFqQWwWSZODilGhiXfFnueb9t/4rox3W3HojmnHyqzxvwq/6h08EvvVNXHVswUeCu /4vezrdLhU+8Wblm6rXgRI+Ju95GcD+I3euk+Jp7wqWZcRpZezcXp8albkoNEfkouXdDZm/0 kUM+b5Z9eXT7epxXYdTyaoHTqrbmAQvrG8JSP+/K3+R0Z9Ul5a/71H7mpu7yVWIpzkg01GIu Kk4EAMjoqI1dAgAA Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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 --- 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);