mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hermes Wu via B4 Relay <devnull+Hermes.wu.ite.corp-partner.google.com@kernel.org>
To: Andrzej Hajda <andrzej.hajda@intel.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	 Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	 Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	 Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	 David Airlie <airlied@gmail.com>,
	Simona Vetter <simona@ffwll.ch>,
	 AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	 Hermes Wu <hermes.wu@ite.com.tw>,
	Allen Chen <allen.chen@ite.com.tw>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Pin-yen Lin <treapking@chromium.org>,
	 Kenneth Hung <Kenneth.Hung@ite.com.tw>,
	Pet Weng <Pet.Weng@ite.com.tw>,  Hermes Wu <Hermes.wu@ite.com.tw>,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: [PATCH RESEND v7 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100.
Date: Mon, 30 Dec 2024 18:51:25 +0800	[thread overview]
Message-ID: <20241230-v7-upstream-v7-7-e0fdd4844703@ite.corp-partner.google.com> (raw)
In-Reply-To: <20241230-v7-upstream-v7-0-e0fdd4844703@ite.corp-partner.google.com>

From: Hermes Wu <Hermes.wu@ite.com.tw>

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.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
 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/ite-it6505.c
index 614fbb6295237708aa5b692de87ab5548c499da5..4ed4899227602a4574a13ffa22442dcc4a5c2092 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1189,6 +1189,37 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,
 	return 0;
 }
 
+static int it6505_get_ksvlist(struct it6505 *it6505, u8 *buf, size_t len)
+{
+	struct device *dev = it6505->dev;
+	enum aux_cmd_reply reply;
+	int request_size, ret;
+	int i = 0;
+
+	do {
+		request_size = min_t(int, (int)len - i, 15);
+
+		ret = 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 = %d, ret =%d", request_size, ret);
+		if (ret < 0)
+			return ret;
+
+		i += request_size;
+	} while (i < len);
+
+	DRM_DEV_DEBUG_DRIVER(dev, "ksv read cnt = %d down_stream_cnt=%d ", i, i / 5);
+
+	for (i = 0 ; i < len; i += 5) {
+		DRM_DEV_DEBUG_DRIVER(dev, "ksv[%d] = %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 = HBR;
@@ -1970,7 +2001,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
 {
 	struct device *dev = it6505->dev;
 	u8 binfo[2];
-	int down_stream_count, i, err, msg_count = 0;
+	int down_stream_count, err, msg_count = 0;
 
 	err = it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo,
 			      ARRAY_SIZE(binfo));
@@ -1995,18 +2026,11 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
 			down_stream_count);
 		return 0;
 	}
+	err =  it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
+	if (err < 0)
+		return err;
 
-	for (i = 0; i < down_stream_count; i++) {
-		err = 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 += 5;
-	}
+	msg_count += down_stream_count * 5;
 
 	it6505->hdcp_down_stream_count = down_stream_count;
 	sha1_input[msg_count++] = binfo[0];

-- 
2.34.1



  parent reply	other threads:[~2024-12-30 10:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 02/10] drm/bridge: it6505: improve AUX operation for edid read Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 05/10] drm/bridge: it6505: fix HDCP Bstatus check Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready Hermes Wu via B4 Relay
2024-12-30 10:51 ` Hermes Wu via B4 Relay [this message]
2024-12-30 10:51 ` [PATCH RESEND v7 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 10/10] drm/bridge: it6505: add I2C functionality on AUX Hermes Wu via B4 Relay
2025-01-02 12:34 ` [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support AngeloGioacchino Del Regno
2025-01-03 18:42 ` Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241230-v7-upstream-v7-7-e0fdd4844703@ite.corp-partner.google.com \
    --to=devnull+hermes.wu.ite.corp-partner.google.com@kernel.org \
    --cc=Hermes.wu@ite.corp-partner.google.com \
    --cc=Kenneth.Hung@ite.com.tw \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=Pet.Weng@ite.com.tw \
    --cc=airlied@gmail.com \
    --cc=allen.chen@ite.com.tw \
    --cc=andrzej.hajda@intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hermes.wu@ite.com.tw \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=treapking@chromium.org \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®