Received: by 10.213.65.68 with SMTP id h4csp1743994imn; Thu, 5 Apr 2018 03:05:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Of5HVgxLjf2rjSw9gj/yy00DowVu1Ze+JjMww/cM3aEmyN+m+LtXPV2uVpVy00nw/tkhK X-Received: by 10.99.171.72 with SMTP id k8mr14750423pgp.355.1522922700861; Thu, 05 Apr 2018 03:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522922700; cv=none; d=google.com; s=arc-20160816; b=WMhg/FZqvXbWfAQrt+5i/qGSseodTIwCvr/QvYt3dVeYJ6ZYY2PoIMJ/KcT0d0Owgb H6kHR1R/AiqxPfO3xDBpDoet0DAQz5cbN6THzofHjukO6U5CUVKUuKDL7DYsrOURmK0x vqvh4ZKtm6y8fDgEGrS6xeuQOFRognaL8TPzoy7QcA+CLij4POnA2MyvM5sRP1NZRYpc DIJb4dIDN07arUpyymSi0VxoFU2RRTnNay7+NJ/gWFzkG+PU3H6bqAxal4mCHPTqv6rh 9Z1gQKP0tT2GvFipHjgXaIN/pBtzvowREI6MenZ/NrbXcAdAae8vpO2FRs6+4o5plu1S MXIw== 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=kJ+e/rDCz/JnXtAFPm23fxD7zh/HvIm3HHV/eJh9H14=; b=c2Uza2pUZuiWKZ2FIj/3izkBaIJE4vUcJI//1/0+ALqF82uqNh6ckkT3214csT6HUx bgvObve63a7ox3cVlSTxS5R9ZDe29PXZsh/5SY6TJ5URLgxQ/V2Yf8DWzQniYi7ynMLB x9yP9TP4/x1wXXmpSpkwZOpoQ9xbFIJaBLTXfRm5qrj4r6VKMAjG1m7+JHbZ9wI8Tl9X L1jO6seu8FSKUNmq9upgSSFZz0GMTJ1v8sruS7Wx45mEizYZNzPmz2sU8h1vYVTmMzza ElIwbRfco4nymrKKh1EtlHpij65PTZdPCYEMvuldPzxrhTU1iQlCyGPhpB2sxWsMH9/R 8v0w== 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 y10-v6si5457359plt.533.2018.04.05.03.04.47; Thu, 05 Apr 2018 03:05: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 S1751413AbeDEJuT (ORCPT + 99 others); Thu, 5 Apr 2018 05:50:19 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60486 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751097AbeDEJuR (ORCPT ); Thu, 5 Apr 2018 05:50:17 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 0778E277A2C 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, 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, =?UTF-8?q?St=C3=A9phane=20Marchesin?= , Enric Balletbo i Serra Subject: [PATCH v6 02/30] drm/bridge: analogix_dp: Check AUX_EN status when doing AUX transfer Date: Thu, 5 Apr 2018 11:49:32 +0200 Message-Id: <20180405095000.9756-3-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180405095000.9756-1-enric.balletbo@collabora.com> References: <20180405095000.9756-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 We should check AUX_EN bit to confirm the AUX CH operation is completed. Cc: Stéphane Marchesin Signed-off-by: Lin Huang Signed-off-by: zain wang Signed-off-by: Sean Paul Signed-off-by: Thierry Escande Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski Reviewed-by: Archit Taneja --- drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 25 +++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c index 9df2f3ef000c..e78c861b9e06 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c @@ -1073,9 +1073,9 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, { u32 reg; u8 *buffer = msg->buffer; - int timeout_loop = 0; unsigned int i; int num_transferred = 0; + int ret; /* Buffer size of AUX CH is 16 bytes */ if (WARN_ON(msg->size > 16)) @@ -1139,17 +1139,20 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, writel(reg, dp->reg_base + ANALOGIX_DP_AUX_CH_CTL_2); - /* Is AUX CH command reply received? */ + ret = readx_poll_timeout(readl, dp->reg_base + ANALOGIX_DP_AUX_CH_CTL_2, + reg, !(reg & AUX_EN), 25, 500 * 1000); + if (ret) { + dev_err(dp->dev, "AUX CH enable timeout!\n"); + return -ETIMEDOUT; + } + /* TODO: Wait for an interrupt instead of looping? */ - reg = readl(dp->reg_base + ANALOGIX_DP_INT_STA); - while (!(reg & RPLY_RECEIV)) { - timeout_loop++; - if (timeout_loop > DP_TIMEOUT_LOOP_COUNT) { - dev_err(dp->dev, "AUX CH command reply failed!\n"); - return -ETIMEDOUT; - } - reg = readl(dp->reg_base + ANALOGIX_DP_INT_STA); - usleep_range(10, 11); + /* Is AUX CH command reply received? */ + ret = readx_poll_timeout(readl, dp->reg_base + ANALOGIX_DP_INT_STA, + reg, reg & RPLY_RECEIV, 10, 20 * 1000); + if (ret) { + dev_err(dp->dev, "AUX CH cmd reply timeout!\n"); + return -ETIMEDOUT; } /* Clear interrupt source for AUX CH command reply */ -- 2.16.3