From nobody Wed Mar 12 13:44:04 2025 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 0C34B1A7AFD for ; Mon, 30 Dec 2024 10:51:01 +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=1735555862; cv=none; b=UmHOdNIUEmqK5TTRqoljNGmC7cPJOOeBuG1g+qwLmrSDCxafdpzznorxr8bOZLxw9R6YQBmMEQVnWEsuwAZymuNQX7U03eK5YU218TTPD6qecOOUYtovCAP/9iQpUqY/1Z8q60fdovvnvMNlaSQXt3SkF8YU/2P3T36I8KRSH9I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735555862; c=relaxed/simple; bh=OrW7zJ21stvDnpp/P7e26kdsuNdebpykAQ0uJlts2ec=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dQhGlY06OtZBRJWDPJopC/GWaJ6yb/HRpLpyNvM8TQ5AMxBg0HxrxLNQS5YlruOdHBXOpttjhIXT/8aGYlVJhns7EobWutlMQ6P5qWbNPVrhJY6qXDvFS+qLO2dC4aYJJxb9k/MQKI3D1WTH8nZkLxNb8SmfSLVLviXSyzKqROg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oebVDqI9; 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="oebVDqI9" Received: by smtp.kernel.org (Postfix) with ESMTPS id A0D0FC4CEE6; Mon, 30 Dec 2024 10:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1735555861; bh=OrW7zJ21stvDnpp/P7e26kdsuNdebpykAQ0uJlts2ec=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=oebVDqI9J/kTukz57JaYX9lh3+WvPDxB1kJbxN8HQaOmZ+chvxvpBoMlMK+AytqoS izQmotQZ3oo1O4cHnH37gJaNIAQFl2atX7ADuDI148tmAiVk6DXvOoKFC1owbQtSMN aj04ZPKoMeW7XeBQt+u9S8ipwGbp1944WYwDh7YQkNyas3wmnQfRQCasHsd6jNmvyI dBl2MOufyY/mOhz0GhbR7foGu2XuryDm7k4eQH12ojxQ/By5xJ7Z+UISrR/nHWyUEz sVLUyg1KiM+McnejS3hSqnOKqStYIKHB0opLPQAHNpAXEH6BGu7Q+WSQCinpK77Y8b ROLiBZ9qK3gZA== 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 96FF6E77188; Mon, 30 Dec 2024 10:51:01 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Mon, 30 Dec 2024 18:51:25 +0800 Subject: [PATCH RESEND 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: <20241230-v7-upstream-v7-7-e0fdd4844703@ite.corp-partner.google.com> References: <20241230-v7-upstream-v7-0-e0fdd4844703@ite.corp-partner.google.com> In-Reply-To: <20241230-v7-upstream-v7-0-e0fdd4844703@ite.corp-partner.google.com> 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 , Allen Chen 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=1735555881; l=3017; i=Hermes.wu@ite.corp-partner.google.com; s=20241230; h=from:subject:message-id; bh=LkPmWJ3+m9M5J4gwKc6RK5juQw3WKrt44Jh3DJ8DUnY=; b=XhasEndtLKETx3pdOStimdJD4B7rLoxm68C/BuvCZj6km7HkEsMMqy8+VBUsz4t+EjKypiJxr VU9ZfEqwcwVB9rJf3EgnI7TP7VGGxdmqOE0Tjlj9xR9tRwmJfkjTn0k X-Developer-Key: i=Hermes.wu@ite.corp-partner.google.com; a=ed25519; pk=qho5Dawp2WWj9CGyjtJ6/Y10xH8odjRdS6SXDaDAerU= X-Endpoint-Received: by B4 Relay for Hermes.wu@ite.corp-partner.google.com/20241230 with auth_id=307 X-Original-From: Hermes Wu Reply-To: Hermes.wu@ite.corp-partner.google.com 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