Received: by 10.213.65.68 with SMTP id h4csp794236imn; Tue, 13 Mar 2018 23:32:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELsvx8MkhjkdP+QjaEjfr9DlZ5ffLk8HR5btKm0UIqDepNPGqAN11qm5x9cCcRfFFNyqsPee X-Received: by 10.99.169.10 with SMTP id u10mr2753352pge.163.1521009140410; Tue, 13 Mar 2018 23:32:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521009140; cv=none; d=google.com; s=arc-20160816; b=Y+iDcwH7pn74lb6omUFtcoQzTLpWR1gPJqGrImq3JaRlYrS0TwTBuNOGqxfL1G1zkM yyQBe4Qsu9KinxYzbIX+7foTSbGgoMOhVuz9YVNbgrsUD2tdNZkV9ozzKH6IxExkKGdO +8otIRbjqNKmbKR5m6fFll1Qy552B9SoV01uaVuaeW3dxfFf9sRFJtrM1zp1MCE2fifx OzCbrz0Nt1kvL2Yphtq+zuy9AqZUr+2fnFGFa6q7GrXit3Iur7YdBizDQqqAtZfks4wD tIlBmaqTpi+wnGQz4CmeLx3wAD85rjHQqpwAVxY5+WZJW4xJHOxctW0UThjUub7AGLh4 8wiA== 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-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=IOSlAi/GRl0Iqr5wDOlIQA2ejJSIL5VuGSiHMahcMVs=; b=zf4aR2HADrHDOhIZFwrenB9K0MSzjZrwutCsQdHwoQStFjKBMGiyuawOGsWDxdzCJE RFkWVs+THwsgLUwBrmD8mTxuZ++9J8p5e3X25ehWFVrSVlXUKGENid0g/CR3PArB50IX vMuVTRAjrm+EZ8BDe7vQto9Uet9JxjifaYsCI/nz+UNoRGFz60okAkdzPYNz1yySbXkI WQ1S1chgyhZobi/Xm5ZdbqJtoHCkFHRb8qlSR+vVY0iTlkl9AwzQDeqsAXMZwEnhseLJ I0DOoKIjvJTTssHehcPzts6D0rHNcE6lKxZtE4fxOiKfIJeR28f9RLThkCcC/fbEFKka q9tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ln1Q0M1/; dkim=pass header.i=@codeaurora.org header.s=default header.b=kq5vy7Ct; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si1508477pff.214.2018.03.13.23.32.05; Tue, 13 Mar 2018 23:32:20 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=Ln1Q0M1/; dkim=pass header.i=@codeaurora.org header.s=default header.b=kq5vy7Ct; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753383AbeCNGbK (ORCPT + 99 others); Wed, 14 Mar 2018 02:31:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49978 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbeCNGbI (ORCPT ); Wed, 14 Mar 2018 02:31:08 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1022F60867; Wed, 14 Mar 2018 06:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521009068; bh=nXOgQT3/Z5QlDWKqTprDLs+Z2klRULGXzMLXkt5ww0Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Ln1Q0M1/JD/tVpOegAcCKfLLBZkrdEZomLy69/ZynPShiXN4gOSGX7OGF4bzC6EM6 Fg97n4HDslqNZreZW8Eg+evgj9OV72RuzFKdcZEs5/OX81Dnu6sJvVAvblo4GhPrnk 71hEcBjq5B4Dcw1U/TzdU+Hh2QMxW/J4inWdg35E= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.1.84] (unknown [182.71.117.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: architt@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 43D1060314; Wed, 14 Mar 2018 06:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521009066; bh=nXOgQT3/Z5QlDWKqTprDLs+Z2klRULGXzMLXkt5ww0Q=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=kq5vy7CtwNxyvbEmpmBdlAMmsDzB2z0EFcag2WmvfsQAqY+kxfy8pkZKLEEzMlfv4 e6eQCwErH0sL1N/mevHz8hEIP3+FpWZnPeOz9qbwNWEl/ZrfpGcWOwpVSUXu3Tb0gj iNHPLkNuF75aw0XopO8cSmTgfTG5UKG8ruelhaYM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 43D1060314 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=architt@codeaurora.org Subject: Re: [PATCH v5 18/36] drm/bridge: analogix_dp: Reset aux channel if an error occurred To: Enric Balletbo i Serra , 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, ykk@rock-chips.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, linux-input@vger.kernel.org, orjan.eide@arm.com, wxt@rock-chips.com, jeffy.chen@rock-chips.com, linux-arm-kernel@lists.infradead.org, mark.yao@rock-chips.com, 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 References: <20180309222327.18689-1-enric.balletbo@collabora.com> <20180309222327.18689-19-enric.balletbo@collabora.com> From: Archit Taneja Message-ID: Date: Wed, 14 Mar 2018 12:00:51 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180309222327.18689-19-enric.balletbo@collabora.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 10 March 2018 03:53 AM, Enric Balletbo i Serra wrote: > 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 > Signed-off-by: Enric Balletbo i Serra > --- > > 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); > + Is this additional power on/off the analog power to the AUX block required to reset it correctly? If so, could you mention that in the commit message? > 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; A couple of ETIMEDOUTs have been replaced with EREMOTEIOs after this change. Maybe we set it the error no in ret and return ret? With those changes, Reviewed-by: Archit Taneja Thanks, Archit > } >