Received: by 10.223.176.46 with SMTP id f43csp685697wra; Fri, 26 Jan 2018 05:22:41 -0800 (PST) X-Google-Smtp-Source: AH8x227M80Hd5WuM8U5b3mzAftsFT8M7AdavU8/Zfi51r+7m/ZuSeNcZeL1yNbM/i3I5wng0EkdK X-Received: by 10.98.144.79 with SMTP id a76mr19041930pfe.15.1516972961564; Fri, 26 Jan 2018 05:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972961; cv=none; d=google.com; s=arc-20160816; b=jSxH6waYaYZxB3l8aaY7bWBGyARX+VqJlDKorniCYvAZJH/AdlzlNEjlN5t8rwe8Al jDLcJAG56GTVh1weQ45TMAC5i/huSssrxqpw3C3G1SUiBcKwIhBDBc+FY+s56/YQsmNa Y5PYMRZywyFYqXTw39NADE5dsMo5gqEtiRP6u2AGyis5eVif1kIo2nyvnF7FnLzKx5/v vhvi7Bmy3gwMfPzpiipkHx+zRcDn8KNXEpGN+ow06QUUuEwaafDmky1gxy3k4NUtOUhC X4awZY2S74x3WDwDomI1pJycnO/3efxkI7TiRlQ4bTR+1wEVWAVTRosu+bi1gLWxq1WZ B0Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfert-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ddhcliod5SO46OZ55Edz0gnJcYcVpO/YEwRl8O5rKyc=; b=zjWvLwoTG6S1NReleiKZZVvGs8Mu8+OXYVvakukLMgRvf9paqnqtiNSsGndvMP4XH3 jT0gZlVXs9HQ//bhgFkA6WYKs01bOZ6HkDX6kXZfey6tk54iiRP0hW84cqERdempDdP0 GzzbQcRLSwtW597vkatkG7enEhs6o7rydIPztGM/3da8iSZQPG0VbQo8hkeafacS6dcY 99euitMhcFdQdqugc5Tj8OMUSxnSo54HjgXpGABf+ZIKHjs2t5AX4v++j/EsAHcWPOhS 0UGL9y+S6ZchWdfTAXVO/VRhxVg64wd+Gm59lUlU3eXcYU2Xf65xdvnEwOwMlPhqHeja sazQ== 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 a2-v6si3657803plp.475.2018.01.26.05.22.27; Fri, 26 Jan 2018 05:22:41 -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; 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 S1752744AbeAZNVJ (ORCPT + 99 others); Fri, 26 Jan 2018 08:21:09 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34784 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752371AbeAZNR7 (ORCPT ); Fri, 26 Jan 2018 08:17:59 -0500 Received: from localhost.localdomain (unknown [IPv6:2a01:e35:8a7e:4790:a8d7:ca4:7b4f:7f87]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tescande) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id BF7B6274DD9; Fri, 26 Jan 2018 13:17:57 +0000 (GMT) From: Thierry Escande To: Archit Taneja , Inki Dae , Thierry Reding , Sandy Huang , Sean Paul , David Airlie , Tomasz Figa Cc: Haixia Shi , =?UTF-8?q?=C3=98rjan=20Eide?= , 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: [PATCH v2 29/43] drm/bridge: analogix_dp: Move fast link training detect to set_bridge Date: Fri, 26 Jan 2018 14:16:56 +0100 Message-Id: <20180126131710.7622-30-thierry.escande@collabora.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180126131710.7622-1-thierry.escande@collabora.com> References: <20180126131710.7622-1-thierry.escande@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset = "utf-8" Content-Transfert-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zain wang It's too early to detect fast link training, if other step after it failed, we will set fast_link flag to 1, and retry set_bridge again. In this case we will power down and power up panel power supply, and we will do fast link training since we have set fast_link flag to 1. In fact, we should do full link training now, not the fast link training. So we should move the fast link detection at the end of set_bridge. Cc: Tomasz Figa Signed-off-by: zain wang Signed-off-by: Douglas Anderson Signed-off-by: Sean Paul Signed-off-by: Thierry Escande Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 42 +++++++++++++--------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c index e7ab871e62b5..bee0f7aa5c23 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -599,7 +599,7 @@ static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp) { int lane, lane_count, retval; u32 reg; - u8 link_align, link_status[2], adjust_request[2], spread; + u8 link_align, link_status[2], adjust_request[2]; usleep_range(400, 401); @@ -643,20 +643,6 @@ static int analogix_dp_process_equalizer_training(struct analogix_dp_device *dp) dev_dbg(dp->dev, "final lane count = %.2x\n", dp->link_train.lane_count); - retval = drm_dp_dpcd_readb(&dp->aux, DP_MAX_DOWNSPREAD, - &spread); - if (retval != 1) { - dev_err(dp->dev, "failed to read downspread %d\n", - retval); - dp->fast_train_enable = false; - } else { - dp->fast_train_enable = - (spread & DP_NO_AUX_HANDSHAKE_LINK_TRAINING) ? - true : false; - } - dev_dbg(dp->dev, "fast link training %s\n", - dp->fast_train_enable ? "supported" : "unsupported"); - dp->link_train.lt_state = FINISHED; return 0; @@ -997,6 +983,22 @@ static irqreturn_t analogix_dp_irq_thread(int irq, void *arg) return IRQ_HANDLED; } +static int analogix_dp_fast_link_train_detection(struct analogix_dp_device *dp) +{ + int ret; + u8 spread; + + ret = drm_dp_dpcd_readb(&dp->aux, DP_MAX_DOWNSPREAD, &spread); + if (ret != 1) { + dev_err(dp->dev, "failed to read downspread %d\n", ret); + return ret; + } + dp->fast_train_enable = !!(spread & DP_NO_AUX_HANDSHAKE_LINK_TRAINING); + dev_dbg(dp->dev, "fast link training %s\n", + dp->fast_train_enable ? "supported" : "unsupported"); + return 0; +} + static int analogix_dp_commit(struct analogix_dp_device *dp) { int ret; @@ -1039,8 +1041,16 @@ static int analogix_dp_commit(struct analogix_dp_device *dp) if (ret) return ret; - if (dp->psr_enable) + if (dp->psr_enable) { ret = analogix_dp_enable_sink_psr(dp); + if (ret) + return ret; + } + + /* Check whether panel supports fast training */ + ret = analogix_dp_fast_link_train_detection(dp); + if (ret) + dp->psr_enable = false; return ret; } -- 2.14.1