Received: by 10.223.176.46 with SMTP id f43csp687120wra; Fri, 26 Jan 2018 05:24:08 -0800 (PST) X-Google-Smtp-Source: AH8x2279eAZ14yi2ScckSVOfnwHgJfJ5kzZ9m+znw0cTsGyAuu7ZEoHDcmkZ2xIQjzxcA1XpKKb4 X-Received: by 10.99.125.78 with SMTP id m14mr15939339pgn.383.1516973048349; Fri, 26 Jan 2018 05:24:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516973048; cv=none; d=google.com; s=arc-20160816; b=Kr8DcVQTq69SdxIDaH/ugq4mZ9A22wg0ffBBcLNtuiODA31sIhuw8u0Qq0ND6uSBVb Sag6hn5tSt06YghZyWP6yw/sQ8YqKmuYdbtkipQ826rgh4iU7suf1kv3SrxIdo3HDFr8 5HXvPPvJ7YUKSOhe3rsWkLX2PbiFayiBoSeQzGAvRxR4COS8fiKBhOUIm91Hk8jUooU3 lTyr1e4oADsEFIpVySKFIW8AAi+go3LjnZDB2j5I9YA2cfV71WNcjxydeC1YJMR+Zgyp 5VNw3PenWcgcEEJz19PGCeLMabtRtYpgLr+82cCE4+Wyre/KDr8NFlfkjUG9HzK1jbSY Phww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-transfert-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=ZWqmOsLX2I/KZcEAFeVfPE32A5RDqVbUkPK/Dm+NZYk=; b=eVMSqYhy1uPlckYTsJQPKPmV1zfokjtZ7tDi8+soFPrAIBnt0vaxMVL/oGOGy4UmYo s7HYlTG9vxfXC7lWUMIcxj/CVcHw7C2GHRJZ5YVHhIxmvjeexXKpkxLygG7Fl+IjwWQR qTNF/zGnJuX7E5vGnrPu3ISTHNIWfpzpH/nUN8/F6Z6l99hWR+S8382qvceA5qgb+2B8 upurLzPv/PK3nKJ7HlKPzZoeXe2ghWaUswgbZy1dpv9m2J9oy4p35At7xG6ypIaglb9H csKABijAStFlF8NT1Wyo6azqrRCTVFuguAgu0aBYtrc6RA7QxPvFRyF6+Ir3sK0GDZV2 SflA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i12-v6si3725919plk.139.2018.01.26.05.23.54; Fri, 26 Jan 2018 05:24:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555AbeAZNWV (ORCPT + 99 others); Fri, 26 Jan 2018 08:22:21 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34516 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752331AbeAZNRz (ORCPT ); Fri, 26 Jan 2018 08:17:55 -0500 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:8a7e:4790:a8d7:ca4:7b4f:7f87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tescande) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 5AED6274DC9; Fri, 26 Jan 2018 13:17:54 +0000 (GMT) From: Thierry Escande To: Archit Taneja , Inki Dae , Thierry Reding , Sandy Huang , Sean Paul , David Airlie , Tomasz Figa Cc: Haixia Shi , =?UTF-8?q?=C3=98rjan=20Eide?= , Zain Wang , Yakir Yang , Lin Huang , Douglas Anderson , Mark Yao , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: [PATCH v2 24/43] drm/bridge: analogix_dp: Reset aux channel if an error occurred Date: Fri, 26 Jan 2018 14:16:51 +0100 Message-Id: <20180126131710.7622-25-thierry.escande@collabora.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180126131710.7622-1-thierry.escande@collabora.com> References: <20180126131710.7622-1-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Huang AUX errors are caused by many different reasons. We may not know what happened in aux channel on failure, so let's reset aux channel if some errors occurred. Cc: 征增 王 Cc: Douglas Anderson Signed-off-by: Lin Huang Signed-off-by: Sean Paul Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index dee1ba109b5f..7b7fd227e1f9 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -466,6 +466,10 @@ void analogix_dp_init_aux(struct analogix_dp_device *dp) reg = RPLY_RECEIV | AUX_ERR; writel(reg, dp->reg_base + ANALOGIX_DP_INT_STA); + analogix_dp_set_analog_power_down(dp, AUX_BLOCK, true); + usleep_range(10, 11); + analogix_dp_set_analog_power_down(dp, AUX_BLOCK, false); + analogix_dp_reset_aux(dp); /* Disable AUX transaction H/W retry */ @@ -1159,7 +1163,7 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, reg, !(reg & AUX_EN), 25, 500 * 1000); if (ret) { dev_err(dp->dev, "AUX CH enable timeout!\n"); - return -ETIMEDOUT; + goto aux_error; } /* TODO: Wait for an interrupt instead of looping? */ @@ -1168,7 +1172,7 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, reg, reg & RPLY_RECEIV, 10, 20 * 1000); if (ret) { dev_err(dp->dev, "AUX CH cmd reply timeout!\n"); - return -ETIMEDOUT; + goto aux_error; } /* Clear interrupt source for AUX CH command reply */ @@ -1178,7 +1182,7 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, reg = readl(dp->reg_base + ANALOGIX_DP_INT_STA); if (reg & AUX_ERR) { writel(AUX_ERR, dp->reg_base + ANALOGIX_DP_INT_STA); - return -EREMOTEIO; + goto aux_error; } /* Check AUX CH error access status */ @@ -1186,7 +1190,7 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, if ((reg & AUX_STATUS_MASK)) { dev_err(dp->dev, "AUX CH error happened: %d\n\n", reg & AUX_STATUS_MASK); - return -EREMOTEIO; + goto aux_error; } if (msg->request & DP_AUX_I2C_READ) { @@ -1212,4 +1216,10 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, msg->reply = DP_AUX_NATIVE_REPLY_ACK; return num_transferred > 0 ? num_transferred : -EBUSY; + +aux_error: + /* if aux err happen, reset aux */ + analogix_dp_init_aux(dp); + + return -EREMOTEIO; } -- 2.14.1