Received: by 10.192.165.148 with SMTP id m20csp3279775imm; Mon, 23 Apr 2018 04:00:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49JjjW8L2Dge5YCuXAIZij/k1VDviLMaOnJdpdyiDucRlwYiRihxM7KYwBGRpluM7lZW2ho X-Received: by 10.99.126.78 with SMTP id o14mr7305291pgn.18.1524481200374; Mon, 23 Apr 2018 04:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524481200; cv=none; d=google.com; s=arc-20160816; b=FtLCxqd+uLPMmKcrMYnOOnzvQUY/mbdwuA34kMCGDBH4eRn67ngcHb+0w6C3uwSMzu gjs7S2kbqpx03yi4hvNTT//CH94pL8LiIyQQq4YrNdgJN7330R2/M2jIzUvlkOsxALB0 Ia6vrUKehIOFiUj+/jnwRNpzaFVxpfJooH6e6rgk90ScQGtd7Y+IrgnHT1KnTF6S9k9m pKlPyDDfshSPNiBTrad+t3iGxccPjiTktp0FjqaPwemrxFM9PkAfBtBLtnH62YmpRWQA xJYdUbUwL6mhNsJlxtvWfLMZWrw3UrxS/r4nCbIS6EgdgBm908tvHU7Z93/re9zEIu30 vqIA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=iGKRO06leQHyOLCemPYcPlSghpv6SMMh5EsiQZrTvgY=; b=K907ZeMz9OFIO9JJtJlG3DWRZqaD6AuK1+0cLVo9N92VzQNJeMw1hvzVfrQvcJueb/ GlfbyqPaCvkhuwYY/DrINIdi1DCDSPinfE03H/UpLW7dc5J8Ax1Ljhm6AI+VNlL2drv3 Ijl/0heT3K1fU+TjJzgEH37Qkm4l8eipGaiF/hA0rt0fGepwos8dGnwx3F8xrUg2bkbd mK0kq75lo2iamGMY7EiscnggdpmA+3noS6y2r65D1BVR9g3cluWTY+b3TfOjGyWUPQIN zzO6MWWbOFgnCDve0O1CjhVGe2aaxdnDEP+PV0OhcasSJ5Ta4aADJ9I9h3vNtG7nsxuG 8mFw== 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 y3si9227019pgc.601.2018.04.23.03.59.15; Mon, 23 Apr 2018 04:00:00 -0700 (PDT) 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 S1755065AbeDWKuy (ORCPT + 99 others); Mon, 23 Apr 2018 06:50:54 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38760 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754953AbeDWKum (ORCPT ); Mon, 23 Apr 2018 06:50:42 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id D9D44277B99 From: Enric Balletbo i Serra To: architt@codeaurora.org, inki.dae@samsung.com, thierry.reding@gmail.com, hjc@rock-chips.com, seanpaul@chromium.org, airlied@linux.ie, tfiga@chromium.org, heiko@sntech.de Cc: dri-devel@lists.freedesktop.org, dianders@chromium.org, a.hajda@samsung.com, kernel@collabora.com, m.szyprowski@samsung.com, linux-samsung-soc@vger.kernel.org, jy0922.shim@samsung.com, rydberg@bitmath.org, krzk@kernel.org, linux-rockchip@lists.infradead.org, kgene@kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, wzz@rock-chips.com, hl@rock-chips.com, jingoohan1@gmail.com, sw0312.kim@samsung.com, linux-kernel@vger.kernel.org, kyungmin.park@samsung.com, Laurent.pinchart@ideasonboard.com, kuankuan.y@gmail.com, hshi@chromium.org, Enric Balletbo i Serra Subject: [RESEND PATCH v6 12/27] drm/bridge: analogix_dp: Reset aux channel if an error occurred Date: Mon, 23 Apr 2018 12:49:48 +0200 Message-Id: <20180423105003.9004-13-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180423105003.9004-1-enric.balletbo@collabora.com> References: <20180423105003.9004-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Tested-by: Marek Szyprowski Reviewed-by: Archit Taneja Signed-off-by: Enric Balletbo i Serra --- .../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.17.0