Received: by 10.213.65.68 with SMTP id h4csp782861imn; Tue, 13 Mar 2018 23:02:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELsr5mBim0ZMUXQRM30PeY/o8SLwsvF+rtDOBKlci8GoF/DoWAxa+MCVuvjpnHvSjchslDjB X-Received: by 10.99.167.2 with SMTP id d2mr2662952pgf.408.1521007373315; Tue, 13 Mar 2018 23:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521007373; cv=none; d=google.com; s=arc-20160816; b=ujXH0xNPsveDsQFWMdgecyQlC5VE9kKUXy+qalOKADVEHEdTMElQwu1jSSHpV1ePgZ Cm3T7BHlNh/l7+Xav19f/avzKNBDpWQHZH4U3kGBzSbM6TNwsLSnV4Wuv6++xE/XRhYm FMy8ZAejApKkctHZPuxe80wsGeI9JGgcPignvAwimc3UUGc2ikeIigYNGJ2GjEHOcEIw 0L+hp8pfNL5MhPI5RbXJ6fyYOPR3opzRk/PRonurZ8gS+pPFSiQgTWfDTJRkS8YxsDwK hNo0nIBWUipynDSQ9n+78eKgWSfFobO3EkCcYUWp3U8U1w1Zl3rVOBH8mf2npSTHa41j M8wA== 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=1FJB8qkHIzQ9YviY2fh7q8Ts/HFrMnWgiufpXedjXYo=; b=EiZSYRCGVaKvZAtHLY4SmZSQOIJWrcy8gF8AR2c4IAZPYl+odGHaQt0qVQSY8ZuGjo qSjRneVN3bISt1Lee8+ky6DbtTKHfGpJmRqhFgT4YR1sz0dOIqVL2rxfwrcp0icQOVP9 6q9mm0JtxDCpogPBIfggmiPS2fipflVid1uVOc7alzSuiJ2iTkOns76RdFoc8TjibWUY +Trfvv3D2pKAgvP6wCq4goOmh+VH3GkHXguOSpfiExAAKgbsOuZwrEqneB4H6xSozDWX GXgovN9DSRgsitNR6HQadb/o8Z0k88lAGindRsBBrxSnBNI17S8o6OfR+64kuWjgdAoB njNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=hcRMT9/4; dkim=pass header.i=@codeaurora.org header.s=default header.b=gHa92sj1; 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 p7si1155340pgn.373.2018.03.13.23.02.39; Tue, 13 Mar 2018 23:02:53 -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=hcRMT9/4; dkim=pass header.i=@codeaurora.org header.s=default header.b=gHa92sj1; 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 S1753361AbeCNGBq (ORCPT + 99 others); Wed, 14 Mar 2018 02:01:46 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51830 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbeCNGBp (ORCPT ); Wed, 14 Mar 2018 02:01:45 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A33F8609F3; Wed, 14 Mar 2018 06:01:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521007304; bh=cdf91Zf1qvR8ysuXGeR2ic9Ki0sSyBO5oAMRSmx/hpM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=hcRMT9/4NyiymnELrbZ/iYZbs/9GIfM4jim+d08SIBIm3CTtapoLZoab1Arxhc1PN 4Cd6BIwwKFfRShLoGSTyGJCD9ui/HCqy+nu6T+z2+PfkTlbNI0/9AmDTrM8dgXQhZW DtC7caDiWJ/lDAbOgwS6qUcq21NfmIcuUoE6qTqc= 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 63E5B60590; Wed, 14 Mar 2018 06:01:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1521007302; bh=cdf91Zf1qvR8ysuXGeR2ic9Ki0sSyBO5oAMRSmx/hpM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gHa92sj1IwwEyJOvxcYV7/9CvVNrQ7j+vSuo72VA5epPFeW05zOVJZADaWWs1LkW7 K1tKKGrFLbHOImRNIX0A5giPKXFp/zp3xLW2RnUhBUp4sHH+SHXri6TQMgoBQWl5RX sEkqS2cXnTxf+EH0aSO5QKswKpgf+92BTbUoXl7s= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 63E5B60590 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 08/36] drm/bridge: analogix_dp: Check AUX_EN status when doing AUX transfer 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, =?UTF-8?Q?St=c3=a9phane_Marchesin?= References: <20180309222327.18689-1-enric.balletbo@collabora.com> <20180309222327.18689-9-enric.balletbo@collabora.com> From: Archit Taneja Message-ID: Date: Wed, 14 Mar 2018 11:31:28 +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-9-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:52 AM, Enric Balletbo i Serra wrote: > From: Lin Huang > > We should check AUX_EN bit to confirm the AUX CH operation is completed. > Reviewed-by: Archit Taneja Thanks, Archit > 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 > --- > > 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 */ >