From patchwork Fri Nov 9 05:50:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1718751 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 9D37EDF264 for ; Fri, 9 Nov 2012 05:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752380Ab2KIFur (ORCPT ); Fri, 9 Nov 2012 00:50:47 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:28889 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752333Ab2KIFuq (ORCPT ); Fri, 9 Nov 2012 00:50:46 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MD700AH4HJY6JP0@mailout3.samsung.com> for linux-fbdev@vger.kernel.org; Fri, 09 Nov 2012 14:50:45 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.51]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A4.47.01231.3B99C905; Fri, 09 Nov 2012 14:50:43 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-cf-509c99b3cea9 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 54.47.01231.3B99C905; Fri, 09 Nov 2012 14:50:43 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MD700CZEHKJRS00@mmp1.samsung.com> for linux-fbdev@vger.kernel.org; Fri, 09 Nov 2012 14:50:43 +0900 (KST) From: Jingoo Han To: 'Florian Tobias Schandinat' Cc: linux-fbdev@vger.kernel.org, 'Sean Paul' , 'Jingoo Han' References: In-reply-to: Subject: [PATCH v4 4/8] video: exynos_dp: Improve EDID error handling Date: Fri, 09 Nov 2012 14:50:43 +0900 Message-id: <001c01cdbe3e$283d7ae0$78b870a0$%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: Ac2+Pd0+5OZ6ri/CQOacII/BjUUEfAAADUww Content-language: ko DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMIsWRmVeSWpSXmKPExsVy+t8zY93NM+cEGMw+a2pxou8DqwOjx+dN cgGMUVw2Kak5mWWpRfp2CVwZ0+ZPZip4K1cxb/ka5gbGHRJdjJwcEgImEtN+97NC2GISF+6t Z+ti5OIQEljGKLH+4VwWmKLOcwuhEosYJQ6++ssOkhASmMUk8aPVEcRmE1CT+PLlMFCcg0NE wEpi01ZNEJNZIEvi9DEFEFNIgFtidXMQSDGnAI/Euj+dzCC2sICrxJpvp8FOYBFQlZjy7xcb iM0rYCsx6dJvJghbUOLH5Htg1zALaEms33mcCcKWl9i85i0zyHgJAXWJR391QcIiAkYSH2Zt Y4coEZHY9+IdI8R4AYlvkw+xQJTLSmw6wAzyk4TAMnaJ/wumMkE8KylxcMUNlgmMErOQbJ6F ZPMsJJtnIVmxgJFlFaNoakFyQXFSeq6hXnFibnFpXrpecn7uJkZITEntYFzZYHGIUYCDUYmH N/HB7AAh1sSy4srcQ4wSHMxKIrxzM+cECPGmJFZWpRblxxeV5qQWH2L0Abp8IrOUaHI+MN7z SuINjY1NzExMTcwtTc1NcQgrifM2e6QECAmkJ5akZqemFqQWwYxj4uCUamAMvOrVrRb5ReHR tvWSDay6mnffb+46b9Q7senqlQd9xpNv+ccsvTnvaXSDf1dantu5gELbK/V/mHz+blduVTuk lLtk2YqHKc2xypbyje63v7hfENn++/DHBUs41tt9Ms2qyHP80L11FtvRGp/wo7ILHDQD95yt idd7szq9Zd2vK3/6DSO7jMuVWIozEg21mIuKEwFBP7/J1gIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrEIsWRmVeSWpSXmKPExsVy+t9jAd3NM+cEGLS8MLQ40feB1YHR4/Mm uQDGqAZGm4zUxJTUIoXUvOT8lMy8dFsl7+B453hTMwNDXUNLC3MlhbzE3FRbJRefAF23zByg qUoKZYk5pUChgMTiYiV9O0wTQkPcdC1gGiN0fUOC4HqMDNBAwjrGjGnzJzMVvJWrmLd8DXMD 4w6JLkZODgkBE4nOcwvZIGwxiQv31gPZXBxCAosYJQ6++ssOkhASmMUk8aPVEcRmE1CT+PLl MFCcg0NEwEpi01ZNEJNZIEvi9DEFEFNIgFtidXMQSDGnAI/Euj+dzCC2sICrxJpvp1lBbBYB VYkp/36BbeUVsJWYdOk3E4QtKPFj8j0WEJtZQEti/c7jTBC2vMTmNW+ZQcZLCKhLPPqrCxIW ETCS+DBrGztEiYjEvhfvGCcwCs1CMmkWkkmzkEyahaRlASPLKkbR1ILkguKk9FxDveLE3OLS vHS95PzcTYzgiH0mtYNxZYPFIUYBDkYlHt7EB7MDhFgTy4orcw8xSnAwK4nwzs2cEyDEm5JY WZValB9fVJqTWnyI0Qfo0YnMUqLJ+cBkklcSb2hsYmZkaWRmYWRibo5DWEmct9kjJUBIID2x JDU7NbUgtQhmHBMHp1QDo/O/e+WMF0Kyvdbt2p5ZLGvampQSF3DVor2rdvuysEMWsQoXn3te fXNI/2JI8S4dponyTZvY9k24xOqsveLp/KcymnZHHqze9vgqx72DhXs7/upfMQtglv90c3rA YZvjmqdZ8h4pXXJ/4cb/cnYbR9Ge0C/hodl6C8q2K0g9mfyw4++B3sW7+5RYijMSDbWYi4oT AYV64vwFAwAA X-CFilter-Loop: Reflected 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 --- drivers/video/exynos/exynos_dp_core.c | 13 ++++++++----- drivers/video/exynos/exynos_dp_reg.c | 14 ++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c index 6e54a18..4a6ed2f 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..fc19ef6 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,17 +700,15 @@ 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); /* 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"); + if (retval != 0) continue; - } /* * Set I2C transaction and read data @@ -750,7 +748,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);