From nobody Sun Nov 24 18:56:13 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 05E4418D65F for ; Mon, 4 Nov 2024 06:44:07 +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=1730702647; cv=none; b=XuaJC5P80Qp1GMYAbCaAGiOjULHerRLUIHadeTt78SRiUE2+w9/F4zL2chGUNe8zEuPh/K+1whRcbJq56qatFfCc7iqxg1qtlLEhmuWborQB/1ioZal2eTjw810CX9w8BsprxyagpHXPURAyf17BsAxmtTa5LPD8mBfT3o8E97M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730702647; c=relaxed/simple; bh=OrW7zJ21stvDnpp/P7e26kdsuNdebpykAQ0uJlts2ec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jz2eByVtndaLFiNLSMfaeEKp72Gxv5qfPEirqkNWDQEhwM2Ba62kRNj6SCKsofJB4SPI3UICWVQWkVkr/JUA/L03gczBwgRqA+L5ree8A5BEV0jABj1wbC/dHVjOhgxF0WEITXAiyfPO4UrglgN3I46/oP8Pd9Cwj0OvKmJsdno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pvdEDfPr; 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="pvdEDfPr" Received: by smtp.kernel.org (Postfix) with ESMTPS id D23A3C4CECE; Mon, 4 Nov 2024 06:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1730702646; bh=OrW7zJ21stvDnpp/P7e26kdsuNdebpykAQ0uJlts2ec=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=pvdEDfPrx5R6YJaDgRPXAXCbVPkob3Rvl4xd3HTbno5wdYndU3olL1sQTdfjfrG3t Ie0tOfLamtMpl5yAzVzD+COqexM4bmUFoPAh6LCmi8hsNK3rUAyjhH+mr9Qugl/AOx H+50GFDMaV6RCwl+QGsLevU+28T/l4KcXPLzM51wlhpgmnoKAMaibyK6756tl702J9 voAYRip0Oy+6IVviwwAe/T6PudbXnwmp9lqU9L25jcu0+UfzDnD/Icd603mIsQufGi 2kBo+HRg+4/h/X12ko70XurFCuR5DaqGDVW9ljexDNGo0BiQ848GYKH/1IvxJ2QMCk wOsiiagF2ENeg== 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 C6538D111AD; Mon, 4 Nov 2024 06:44:06 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Mon, 04 Nov 2024 14:43:37 +0800 Subject: [PATCH v7 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: <20241104-v7-upstream-v7-7-8b71fd0f1d2d@ite.com.tw> References: <20241104-v7-upstream-v7-0-8b71fd0f1d2d@ite.com.tw> In-Reply-To: <20241104-v7-upstream-v7-0-8b71fd0f1d2d@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 , Hermes Wu Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Pin-yen Lin , Kenneth Hung , Pet Weng , Hermes Wu , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1730702658; l=3017; i=Hermes.wu@ite.com.tw; s=20241101; h=from:subject:message-id; bh=LkPmWJ3+m9M5J4gwKc6RK5juQw3WKrt44Jh3DJ8DUnY=; b=/4DGNl6gmpJctBFosSW3teRnwAylMwNxDWmHIo/I0uS3ya8Giz7igPIWIDr0M9XMQ/JM+r68N 07XvT2jGbNdBq/0jkfwFWZvcPKkedRW+m5rJQT9Is7PkYfA26gsxVOv X-Developer-Key: i=Hermes.wu@ite.com.tw; a=ed25519; pk=FOYYbsP2Nlw6mjB3rLFYSLmAiENzj4AWQly5XTcDuMM= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.com.tw/20241101 with auth_id=268 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. Reviewed-by: Dmitry Baryshkov Signed-off-by: Hermes Wu --- 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 614fbb6295237708aa5b692de87ab5548c499da5..4ed4899227602a4574a13ffa224= 42dcc4a5c2092 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; } =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; @@ -1970,7 +2001,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)); @@ -1995,18 +2026,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