Received: by 10.223.176.5 with SMTP id f5csp3457523wra; Mon, 29 Jan 2018 13:29:13 -0800 (PST) X-Google-Smtp-Source: AH8x226jgdMHh6cDIX+E/c2twZhUciJDbrXTGuhWDAy1g0wKZXIYDtzyjYMWT0a1xrcWdOaG8+X8 X-Received: by 10.99.96.203 with SMTP id u194mr22331879pgb.167.1517261353161; Mon, 29 Jan 2018 13:29:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517261353; cv=none; d=google.com; s=arc-20160816; b=f1HJ18xVOWgS/5DzIEz7FYR4iWmkhH8hND1nWcHwHGSZY8l3m4kM+9N6NHacqZKv58 T4DmT9Oh/OLpyXQn8Ofpqn05hhONNLCtaCS16Xm1vFTqS7G2+vIjC8F8jpvqGwPIDaRK 8LPhVPoO371iXvJT6QN1gCsgQzMVPebz+mt3YfSKvhPdWsILWp9Lr0QQnt8nJQfwUQtz bmnpcwRwLZXqa1gspD8Q+az8J2lguBFgPwH2oVFIqQEmhMkeknjqJcbjf0l9JARMy5Uf V2LhkTS+Wqf2RmvyNuKXOJUBe+BJVaqa503J4fuMXErCXNb2j4QBrCUUmwBw9k9hJNfH jb/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=sOMwuBE06KzCZlM+k9mNGf7vtXgqLZlkCzqUSjv27oE=; b=vX6wHWW4v33FlnXPlA0LSNvbwlbQxift9oM+jtSC2z3mNYItRFSdeZJOD6N1kZ8cPr oX/AErN3qPGOpu0qq+2MRZijo1bKrRMc4uNFvLMgziFkbYiM4nTn7eUHGeZwt8kuQu1q QvB8jyX914TYLvdB2RnpUdxJPSjabU8HURVjyGlOyyzyWuk+478UIGrUEX9qlTP00f7h LKcURw9nZhLfsFkA45hjJklxSLJV5+BFqPfOkTdDKWQniNKC+Tuup8/K8EAqyOKPvm1M zygrckoh2PCUWSLJ18Fixvs4tROefSLNWy1WJf+WOsawPU5WPgFVZNik2fsz6kilfF1W B56w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LVX9f9jj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 43-v6si3444127plc.167.2018.01.29.13.28.57; Mon, 29 Jan 2018 13:29:13 -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; dkim=pass header.i=@chromium.org header.s=google header.b=LVX9f9jj; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751632AbeA2V1y (ORCPT + 99 others); Mon, 29 Jan 2018 16:27:54 -0500 Received: from mail-yw0-f195.google.com ([209.85.161.195]:32815 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751360AbeA2V1x (ORCPT ); Mon, 29 Jan 2018 16:27:53 -0500 Received: by mail-yw0-f195.google.com with SMTP id x24so3256538ywj.0 for ; Mon, 29 Jan 2018 13:27:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=sOMwuBE06KzCZlM+k9mNGf7vtXgqLZlkCzqUSjv27oE=; b=LVX9f9jjY+mBULbmoRro7IpFdZh1yrph0dMO+Fv/ElXv6EKh8jkCWlp+qb47hA3k7u VaNlSCYKKQL2cedgGmkiDHeXtZ+bQ+kTZxsFtbTcBjH9Xvg/ZqjKgigGbSPxJeOnssVg gvA+IrDYT9VsRrGkc68KQg8TuLL/O59Se307w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=sOMwuBE06KzCZlM+k9mNGf7vtXgqLZlkCzqUSjv27oE=; b=ISkqHrY+2Tr+ysOWPrYo8kmFNFLis5uBv63T5XDp8mAQZMS5ezX8NaWwQxGi9Pk1xp Kd+wByWiTClIF4+rVBW8GQCXBbTbOU3RZWEhvCP1JhK4R6J/o5eAmpf4O5b4z+N/PVHU KeZvJ68WR2CKfyAyqEKlDIOZt3EQdnVFOpQnhGbkGQvEgUNhgVNqkCvoKsGmDBuW33Q0 oz4ZXMf/ukMhXA3f8H1Iuz5tb6a3Irxiwomf+i7RHJsKRZlDvLdNYtjjtaqGHoKgxOI2 qIljoC6INZYf9khrem/1CM8rCnvpLsu7OQxu5WQqekTlaWpRUNiXnS3HutC5DmEX7HLo Q5+A== X-Gm-Message-State: AKwxyte3mrD9dRM7FUUiDMzTeR4W7sgqKa3Oj4R9kdVd4/M14Eq2aaB3 3W6BDl8HA/Gq7xMBXlcl+7EuOfQStiA= X-Received: by 10.129.162.79 with SMTP id z76mr17676676ywg.365.1517261272843; Mon, 29 Jan 2018 13:27:52 -0800 (PST) Received: from localhost ([2620:0:1013:11:d3af:69ac:1964:28e8]) by smtp.gmail.com with ESMTPSA id q9sm4781361ywq.29.2018.01.29.13.27.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2018 13:27:52 -0800 (PST) Date: Mon, 29 Jan 2018 16:27:51 -0500 From: Sean Paul To: Thierry Escande Cc: Archit Taneja , Inki Dae , Thierry Reding , Sandy Huang , Sean Paul , David Airlie , Tomasz Figa , Haixia Shi , =?iso-8859-1?Q?=D8rjan?= Eide , 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: Re: [PATCH v2 24/43] drm/bridge: analogix_dp: Reset aux channel if an error occurred Message-ID: <20180129212751.25eqa4s4aml52z6m@art_vandelay> References: <20180126131710.7622-1-thierry.escande@collabora.com> <20180126131710.7622-25-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180126131710.7622-25-thierry.escande@collabora.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 26, 2018 at 02:16:51PM +0100, Thierry Escande 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 > --- > 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); This is kind of lame. I don't think this needs to be _exactly_ 10us, even 10/20 would be an improvement. Since this is so infrequent, it's not a dealbreaker either way, I guess. Sean > + 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 > -- Sean Paul, Software Engineer, Google / Chromium OS