From nobody Tue Nov 26 21:32:45 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 3A1C41D1E75 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=OzoYNzkJi6UDtfe3lAtceKcsuQm6fmGeyvvibBRxOc8Tklcgh1jvvD/P2u3Jo28F69ygTC4pXhxVVlA33sSfjMVOetWo+Yil1V/i6LeuoPQKTsqdiuO2blVz6B7f1UXXPbOUAcLkODiKN/pVRZTRsQV30t6CArA0ZWZGFZ1tVWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729065253; c=relaxed/simple; bh=3/AamiyrIYhBdVOlu9ElIgKN5r16P+kbe+BSQtba8g4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qQAn8+NhLh27eiO5uhq8TlFapBdArev9Ccdri72d8TF2ZxlQAb0fGGTV8kRFHBRqxktaN2hgfmTR90AupYdMZqW8R0AccUi2qBky44LnhK9A/IUWKb1WMW2l03B00BQZ9rXdDq91jWaiFR15MAivwo8kS9g6l+ovuAM7bJiwnLc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fVDvWBAm; 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="fVDvWBAm" Received: by smtp.kernel.org (Postfix) with ESMTPS id D3123C4CECE; 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=3/AamiyrIYhBdVOlu9ElIgKN5r16P+kbe+BSQtba8g4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=fVDvWBAmL9lqeIoSYZ8MvKNQhDaBIIm0guy62aZ1Zb4+LGNBNHS9BsagTOge+A4Dt 2Te0bUV7pdyk4lz/JqdFEZp7R7wAMSOQwwc7sE0200CWYXIgN5bp5agOhIL23glNac h1HzZbtOZVm06/+FM22EZvli9NjVqZbSjcA5HVRsTWmAhijZRFsA350GmlbFHlUHQd SpXCWocv/Fb2e0YceiinLeDDuGm1s2QVaFFOL6W8zjHh9h4Q03rMabEGYeQj2gzC3S CoQJE+VwOqIgpEToP5KNYcAxV4MOYvCgrcllsTH+3o3x32CyzwXkmUeO67zJCeL2Pq Aa532HNfS7tNQ== 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 CB8FFD206AB; Wed, 16 Oct 2024 07:54:12 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Wed, 16 Oct 2024 15:54:19 +0800 Subject: [PATCH v6 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100. 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-7-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=2956; i=Hermes.wu@ite.com.tw; s=20241016; h=from:subject:message-id; bh=+V21HG3VVxkOkslhvoDICqbbbWGD4xtrVrwwYpVZ5VE=; b=0bKDdOl3LcNCuPrzr4p1kkdxq7KZQG4I1H1BzDtHfhPR2nD+NFLiVuiQb+qzFMAjKnbqmH28M YPTcqnQby4uAdmjfHNJlcKglRmPOI4cSYu5wwYgZ0pkqyzu2/BAC2Oy 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 running the HDCP CTS test with UNIGRAF DPR-100. KSV list must be read from DP_AUX_HDCP_KSV_FIFO in an AUX request, and can not separate with multiple read requests. The AUX operation command "CMD_AUX_GET_KSV_LIST" reads the KSV list with AUX FIFO and is able to read DP_AUX_HDCP_KSV_FIFO in an AUX request. Add it6505_get_ksvlist() which uses CMD_AUX_GET_KSV_LIST operation to read the KSV list. Signed-off-by: Hermes Wu Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/ite-it6505.c | 48 +++++++++++++++++++++++++++------= ---- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 85626b49a048a1178676ed616130a522ca314152..40fb47f4954331d63681066fb3a= f19f0f57bb929 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -1188,6 +1188,37 @@ static int it6505_get_edid_block(void *data, u8 *buf= , unsigned int block, return 0; } =20 +static int it6505_get_ksvlist(struct it6505 *it6505, u8 *buf, size_t len) +{ + struct device *dev =3D it6505->dev; + enum aux_cmd_reply reply; + int request_size, ret; + int i =3D 0; + + do { + request_size =3D min_t(int, (int)len - i, 15); + + ret =3D it6505_aux_do_transfer(it6505, CMD_AUX_GET_KSV_LIST, + DP_AUX_HDCP_KSV_FIFO, + buf + i, request_size, &reply); + + DRM_DEV_DEBUG_DRIVER(dev, "request_size =3D %d, ret =3D%d", request_size= , ret); + if (ret < 0) + return ret; + + i +=3D request_size; + } while (i < len); + + DRM_DEV_DEBUG_DRIVER(dev, "ksv read cnt =3D %d down_stream_cnt=3D%d ", i,= i / 5); + + for (i =3D 0 ; i < len; i +=3D 5) { + DRM_DEV_DEBUG_DRIVER(dev, "ksv[%d] =3D %02X%02X%02X%02X%02X", + i / 5, buf[i], buf[i + 1], buf[i + 2], buf[i + 3], buf[i + 4]); + } + + return len; +} + static void it6505_variable_config(struct it6505 *it6505) { it6505->link_rate_bw_code =3D HBR; @@ -1969,7 +2000,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6= 505, u8 *sha1_input) { struct device *dev =3D it6505->dev; u8 binfo[2]; - int down_stream_count, i, err, msg_count =3D 0; + int down_stream_count, err, msg_count =3D 0; =20 err =3D it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo, ARRAY_SIZE(binfo)); @@ -1994,18 +2025,11 @@ static int it6505_setup_sha1_input(struct it6505 *i= t6505, u8 *sha1_input) down_stream_count); return 0; } + err =3D it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5); + if (err < 0) + return err; =20 - for (i =3D 0; i < down_stream_count; i++) { - err =3D it6505_get_dpcd(it6505, DP_AUX_HDCP_KSV_FIFO + - (i % 3) * DRM_HDCP_KSV_LEN, - sha1_input + msg_count, - DRM_HDCP_KSV_LEN); - - if (err < 0) - return err; - - msg_count +=3D 5; - } + msg_count +=3D down_stream_count * 5; =20 it6505->hdcp_down_stream_count =3D down_stream_count; sha1_input[msg_count++] =3D binfo[0]; --=20 2.34.1