Commit aa972393 authored by Hermes Wu's avatar Hermes Wu Committed by Dmitry Baryshkov
Browse files

drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100.



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: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarHermes Wu <hermes.wu@ite.com.tw>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-7-e0fdd4844703@ite.corp-partner.google.com
parent 8c01b0ba
Loading
Loading
Loading
Loading
+36 −12
Original line number Diff line number Diff line
@@ -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;
	}

	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);

	err =  it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
	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];