From nobody Tue Nov 26 21:26:54 2024 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 3A25A1D1E78 for ; Wed, 16 Oct 2024 07:54:13 +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=1729065253; cv=none; b=LOoGzNNmzSGaJOZ/a5T3vy97i/ykT9DdUiYIu1dg0s0TF2U5FA3iwo0TGevfJ4uY4CADV/h/WRYrPb7tIJvWmnQaQcIBM2WHwsvXmxE9Cf62OjFCNlbjLwdCx5huDMkDD6cZmHDcLp6JQEBDQP3RTQRokf24U7QqAdKEUrR8uE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729065253; c=relaxed/simple; bh=oPCRUpLGMx61HeGBVmDtTagHLW4mYnC+zOcvc9PEJPc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bbdQSENZKwlaCT8u1aMWXdvJwMQy1eIk+i+aatYTnLseDjGYgnVFuvshU7LBE+zaZpiqHM2gu39GZrdYX7F+i+X0fnCAr26aNn1bv5GmXC5YQnuoTc1JeZG80tAzuTs5YjJoNMj5lcjTVHzg2MinYMDWIj7xpXksVkcIyC3eMqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XDGXEiea; 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="XDGXEiea" Received: by smtp.kernel.org (Postfix) with ESMTPS id E2EB8C4CED7; Wed, 16 Oct 2024 07:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729065252; bh=oPCRUpLGMx61HeGBVmDtTagHLW4mYnC+zOcvc9PEJPc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XDGXEieaGDn9mjXqiW74u9UAF1dVAMNtVXnvlleAkoMVdXRvHF+P81iEl49Dz8lsS i41GqAiSEJ8coyCVwSgY9Ke3TGlMHtkRZaHeZUz0elsmPoxHZJyFpN8m4pdli6wjoN yaqVzHxv7PyojRjRNSER4hOOW7YLEB45gQp0tS41YtMxiOx8jYdeANU3pKLLs8aBl5 RaPKWBcfDCtF/rMOka60rci7S/O3kRQcYpUX/3FRqJKRjpyagNaAce5iaX7OIf8rr/ asz2ST7vZ/NDJQ9H/oQOOMmvP3EYI7MGdx/SezqFNl0sLmC45kpva4VyJVrI+xnVBT O+pZmYbgoRrHg== 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 DB002D206B1; Wed, 16 Oct 2024 07:54:12 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Wed, 16 Oct 2024 15:54:20 +0800 Subject: [PATCH v6 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching 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: <20241016-upstream-v6-v6-8-4d93a0c46de1@ite.com.tw> References: <20241016-upstream-v6-v6-0-4d93a0c46de1@ite.com.tw> In-Reply-To: <20241016-upstream-v6-v6-0-4d93a0c46de1@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 , AngeloGioacchino Del Regno , Pin-yen Lin Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Kenneth Hung , Pet Weng , Hermes Wu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729065263; l=2090; i=Hermes.wu@ite.com.tw; s=20241016; h=from:subject:message-id; bh=vVGOPh2gUmJR+gDRTv9xrafnNiddtntN9yPHXoZ0A7Y=; b=OhDMy/DGwZCFCTXSW4O5wIhEi0wj63lfX8wE8fgG/wVL5mzlXwX5mi906+fCnd3oxkJtwrf+S hffdaKRx9ELDya2dnsW8IkAP4XiJAKhCP0NG/iL2O3ns/4Cl+c0ani0 X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=kV18uQEXox+1WccdQceCbMlJKN+BBNUk3N8VsoULcQ0= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241016 with auth_id=250 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.com.tw From: Hermes Wu When HDCP negotiation with a repeater device. Checking SHA V' matching must retry 3 times before restarting HDCP. Signed-off-by: Hermes Wu --- drivers/gpu/drm/bridge/ite-it6505.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 40fb47f4954331d63681066fb3af19f0f57bb929..439cca455ecf91b5f83b0add416= db7f099f9a34d 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -2057,7 +2057,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it= 6505 *it6505) { struct device *dev =3D it6505->dev; u8 av[5][4], bv[5][4]; - int i, err; + int i, err, retry; =20 i =3D it6505_setup_sha1_input(it6505, it6505->sha1_input); if (i <=3D 0) { @@ -2066,22 +2066,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct = it6505 *it6505) } =20 it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av); + /*1B-05 V' must retry 3 times */ + for (retry =3D 0; retry < 3; retry++) { + err =3D it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv, + sizeof(bv)); =20 - err =3D it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv, - sizeof(bv)); + if (err < 0) { + dev_err(dev, "Read V' value Fail %d", retry); + continue; + } =20 - if (err < 0) { - dev_err(dev, "Read V' value Fail"); - return false; - } + for (i =3D 0; i < 5; i++) { + if (bv[i][3] !=3D av[i][0] || bv[i][2] !=3D av[i][1] || + av[i][1] !=3D av[i][2] || bv[i][0] !=3D av[i][3]) + break; =20 - for (i =3D 0; i < 5; i++) - if (bv[i][3] !=3D av[i][0] || bv[i][2] !=3D av[i][1] || - bv[i][1] !=3D av[i][2] || bv[i][0] !=3D av[i][3]) - return false; + DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i); + return true; + } + } =20 - DRM_DEV_DEBUG_DRIVER(dev, "V' all match!!"); - return true; + DRM_DEV_DEBUG_DRIVER(dev, "V' NOT match!! %d", retry); + return false; } =20 static void it6505_hdcp_wait_ksv_list(struct work_struct *work) --=20 2.34.1