From nobody Thu Jan 30 23:17:14 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37A0F1D3582 for ; Fri, 24 Jan 2025 02:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737685765; cv=none; b=DVZxErR1tKADmu8/DvkOjcexU7YV5zqhAJbnjJmCOnV3bEgaaFgRC1asJuEe5ClXTWbpvtoJWPiFTWkAhi9vSurcI6LWjNLDOX2JYGnEoJ5lzVD//+WACC2xLmD3ieLWM4ANMCBZPXaromSijFcZRpopVWxF925v2+G53GkziC4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737685765; c=relaxed/simple; bh=4mDtKJNOvXzo04STzoLEDzk08HuB8UCxRKC60TOOa6c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XBCFW6LEvlix7mZsPvDdKOfDzR7wM1E84sAGk3HYWOFHA9RiELNtCynQkeiyomJJ7RP6PXHLSJX2mbBQ+S9nd6ShcwEPBjHM5VEokoy0OUJoTwGvI/L1jjrgA84paC+Wr6rl+SbWmj1ZN+VXlymtOTmkb7dp3+Jb49/LYoESzf8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P99gJVvE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P99gJVvE" Received: by smtp.kernel.org (Postfix) with ESMTPS id C397AC4AF0B; Fri, 24 Jan 2025 02:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737685764; bh=4mDtKJNOvXzo04STzoLEDzk08HuB8UCxRKC60TOOa6c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=P99gJVvE1XxGljWYnzdTMrh+SAxE00R18hLOFQl/hb82eSaDT4BEPoZjKmJVwtkeZ 3HVnu4BwZp7T5kQlbt+Fp6hoD/hFec6rm3koyyQ10GCGzVrfUdk2vASzj910YUVQLY EIOFtd405kh/2YGBHx2IzvUjVAn776xMPGtolBVMsqUkRJeCxjqiT4e79bB2YfKlaY 5ElypLsQtla2IVkYwEVcQH6OtsDU2YlcnQwNQsgzSP8S43euy7XKDadKfl3Yz3ysEg yCEbbyAAjkhSVPaq47QZ1cbfcIUXQ1LoBk9RUZ/PTPlWGBub2G8/HDMc6KP6hr7X3g 2SKU30NyPL95Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4DE2C0218B; Fri, 24 Jan 2025 02:29:24 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Fri, 24 Jan 2025 10:29:52 +0800 Subject: [PATCH 3/3] drm/bridge: it6505: skip auto training when previous try fail Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250124-fix-link-training-v1-3-09511050bb2c@ite.com.tw> References: <20250124-fix-link-training-v1-0-09511050bb2c@ite.com.tw> In-Reply-To: <20250124-fix-link-training-v1-0-09511050bb2c@ite.com.tw> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: Pet.Weng@ite.com.tw, Kenneth.Hung@ite.com.tw, treapking@chromium.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1737685792; l=2801; i=Hermes.wu@ite.com.tw; s=20241230; h=from:subject:message-id; bh=JH5TB+6KMos7mGcxiEmqDSjWU1p596CHLwJaILJm+RQ=; b=gXdNFv910hf0FF8myxOgVbYKQXZOItlk/m9x4G2/vhbNJ2J2mq7Jl5s3XPYZjzGW+gfQg8z+r +MLx3OxKsewDK2slp+NFS2yx6vPlduwM79JeJxZhh73fsT+ywN/qVy/ X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241230 with auth_id=310 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu When connect to device which can only training done by step training, skip auto training when link training restart, usually happen when display resolution is changed. Signed-off-by: Hermes Wu --- drivers/gpu/drm/bridge/ite-it6505.c | 36 +++++++++++++++++++++------------= --- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 11231a642bbe185c4f36bf5f2a0b115fa056213b..730481a9446ff00a54ef70e86b4= c28ff0a3f417e 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -468,6 +468,7 @@ struct it6505 { struct work_struct hdcp_wait_ksv_list; struct completion extcon_completion; u8 auto_train_retry; + u8 step_train_only; bool hdcp_desired; bool is_repeater; u8 hdcp_down_stream_count; @@ -2459,11 +2460,13 @@ static void it6505_link_step_train_process(struct i= t6505 *it6505) ret ? "pass" : "failed", i + 1); if (ret) { it6505_link_train_ok(it6505); + it6505->step_train_only =3D true; return; } } =20 DRM_DEV_DEBUG_DRIVER(dev, "training fail"); + it6505->step_train_only =3D false; it6505->link_state =3D LINK_IDLE; it6505_video_reset(it6505); } @@ -2479,21 +2482,23 @@ static void it6505_link_training_work(struct work_s= truct *work) =20 if (!it6505_get_sink_hpd_status(it6505)) return; - - retry =3D it6505->auto_train_retry; - do { - it6505_link_training_setup(it6505); - it6505_reset_hdcp(it6505); - it6505_aux_reset(it6505); - - ret =3D it6505_link_start_auto_train(it6505); - DRM_DEV_DEBUG_DRIVER(dev, "auto train %s, auto_train_retry: %d", - ret ? "pass" : "failed", it6505->auto_train_retry); - if (ret) { - it6505_link_train_ok(it6505); - return; - } - } while (retry--); + /* skip auto training if previous auto train is fail*/ + if (!it6505->step_train_only) { + retry =3D it6505->auto_train_retry; + do { + it6505_link_training_setup(it6505); + it6505_reset_hdcp(it6505); + it6505_aux_reset(it6505); + + ret =3D it6505_link_start_auto_train(it6505); + DRM_DEV_DEBUG_DRIVER(dev, "auto train %s, auto_train_retry: %d", + ret ? "pass" : "failed", it6505->auto_train_retry); + if (ret) { + it6505_link_train_ok(it6505); + return; + } + } while (retry--); + } =20 /*After HW auto training fail, try link training step by step*/ it6505_link_step_train_process(it6505); @@ -2605,6 +2610,7 @@ static void it6505_irq_hpd(struct it6505 *it6505) it6505_parse_link_capabilities(it6505); } it6505->auto_train_retry =3D AUTO_TRAIN_RETRY; + it6505->step_train_only =3D false; =20 it6505_drm_dp_link_set_power(&it6505->aux, &it6505->link, DP_SET_POWER_D0); --=20 2.34.1