Received: by 10.213.65.68 with SMTP id h4csp1738863imn; Thu, 5 Apr 2018 03:00:29 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/1Ug1zqHCfqEEz9fvOFO5wDwjYED6VV/3kpgttgPlmXnr24e6tIIQWN3Mms3dw+yNXz67L X-Received: by 10.98.63.75 with SMTP id m72mr16548810pfa.167.1522922429360; Thu, 05 Apr 2018 03:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522922429; cv=none; d=google.com; s=arc-20160816; b=c3VHVy9H6JaMuPOEE7ZwZ9Ym1GVd/az5uv86RL/T7R0Y2lv4of04DbGZNKytMoY4Y5 wCZV0wwfywiRDtlZoNUJ/vdEFdDbnNt8IB4R1YXv/EmWRZ4gqrm1zsrw8oFOvWqUv+5p PYUYZZ+aKUn9BErRuT+pm+sRe2vz1o4UCSmWncQjt83+aviigR0tNKLvikFB1tHq+kqI 9ngmMrUuwUhJHL8D6sYYDyEYBI7pHg2ysOVpQPRb+98YcQ8RtMP4ujlxoimllH/3ngR0 ntwSZqNYxqqYuyheA0iu7vfdqryk3gn+pmdA5GO+Dt3bNfWG8Ajss9W3vh61b89X5Gqq 1NkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=coXr/cSN72zbqevJkxlm5OX/Mu8hNLrsmHogjxxLk0c=; b=PTtJcaqL+c48QJs05Wrpx2k65fhwK2OhXlflY5EwqWuiMfGsb0IuViUEm6lcTJCJbY tqr8TGCORSPWBV/2f8CZZxOnvqalevr9SrG31jvr3oSSszBfYRWTFEyk0RGad8daCu5o L9sdJDeYMTCa3p+cFv6pyAD0ZAV6mhx+Z85Pw0gsusT2TMsM9cvfuE496XvWLLgrGBp9 8mDUQCby3mzHlB1q2qBjQW7vuJj2SwxnxfH5C6ShCQsHQjw/FUJ3kDAMD5N5Nc4pjSiO 0LwDzuRPcf8swAvpTc0tJnOiBPijzNbJjnXv9pg0p1fXd0L3dQpjRnGz8WrpnMHKPxjO 2e9A== 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 b67si5051653pga.503.2018.04.05.03.00.15; Thu, 05 Apr 2018 03:00:29 -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 S1752470AbeDEJ6J (ORCPT + 99 others); Thu, 5 Apr 2018 05:58:09 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60912 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbeDEJuv (ORCPT ); Thu, 5 Apr 2018 05:50:51 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id D4729277A2A 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, Enric Balletbo i Serra Subject: [PATCH v6 17/30] drm/bridge: analogix_dp: Move fast link training detect to set_bridge Date: Thu, 5 Apr 2018 11:49:47 +0200 Message-Id: <20180405095000.9756-18-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> 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 Signed-off-by: Enric Balletbo i Serra Tested-by: Marek Szyprowski Reviewed-by: Archit Taneja --- 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 a72e454a7292..69b2c16e5776 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -601,7 +601,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); @@ -645,20 +645,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; @@ -996,6 +982,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; @@ -1038,8 +1040,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.16.3