From nobody Tue Nov 26 22:30: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 EB01D1D14FA for ; Wed, 16 Oct 2024 07:54:12 +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=TlOcWgqXNN7Dhv4HAJ72ohRw0OWx6H8Zgx1I2JvY37rUOj+rSi4u4f78SKggPCTumN2iuZKcbIZao9a5t6R/S7jLLBTfHQ4zzrGiOmbzoLsHk8yg+e1K/8rx6C7jjpq0g/E3TyYjfxb92wfv/eUoF8IIuWAvBnOb2avD1OB4xwY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729065253; c=relaxed/simple; bh=n93E6iCB1bU0i/bh9gsTxfittNpS+aSp/DTC6Czk6DI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=koEL4cV9eMWDpv4SUF1PxxBFStqKOEAoQB+IYjZvrzMnN30fj+q/Z66wqdA6vJCwTI7l8Gc8guz5G5wURI7OgOMQrpGR/fbN8kOsIt45K4bQPZTGyloM9dBGybU8GYZlgbNk8Y1q0ZGaNrL+xT/Wv3bD4Gq4xvtlxE+JmkDEoYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pZRIFBjs; 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="pZRIFBjs" Received: by smtp.kernel.org (Postfix) with ESMTPS id 92E68C4CED6; 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=n93E6iCB1bU0i/bh9gsTxfittNpS+aSp/DTC6Czk6DI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=pZRIFBjsPkbV1eS2C/0/Oy1b42+CP0YWUZ1hmYF7JfVNufVNqhG+gHSKit1UBf4cr WM/2g5/5E+CW6ftXr3TZv1hXxTDlmqI88JQQJqjxiygS3uFu2DxZD0trQXr9UGXnKE TETY62t5ubiTpmvDpSrSxOLYcCIhZU2jS+nO0dAbPeSlwETyikCN0iqLM5zFaXt/Bb 23excqWIXxPqR37BATb/vs6R3pUPh9SU5ImMkGaez3pWZlA3Mn2K/zDoEHzGTLbxDT YAEEBL+aT8IAZd12PjnEe6nc/9sPcZThEV/tmNmsBySB+6aFtrMSGbqhgu8SGnFwpR OR+gM6YVOGGxg== 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 89D25D206AB; Wed, 16 Oct 2024 07:54:12 +0000 (UTC) From: Hermes Wu via B4 Relay Date: Wed, 16 Oct 2024 15:54:15 +0800 Subject: [PATCH v6 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read 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-3-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=3378; i=Hermes.wu@ite.com.tw; s=20241016; h=from:subject:message-id; bh=/fXuff/9Svbqq/yjBT5j6wJt5HiXdNiMkfV4cxh+1Hc=; b=hgM8V5HmaMpSlfa6wZQTlCWcl87TVKfQieSoZzkUfFgJdSlxP+CyEWIUhodpDPZt7RZQSrTEW e0biuS01fhpAgmpl84QOlj9qUzISbNCVue2iWR3FdHhe8dckvKAmJGv 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 HDCP KSV list readback can choose to use AUX FIFO or general data register. For some DisplayPort devices, the KSV list must be read in 5 byte boundaries. The original AUX read command does not support these devices. The AUX command operation control register "REG_AUX_CMD_REQ" uses b[3:0] as AUX operacion control, and b[7:4] are status bits and read only. To change KSV read operation uses "CMD_AUX_NATIVE_READ" from using the data registers to using AUX FIFO. The extended command "CMD_AUX_GET_KSV_LIST" is added as "CMD_AUX_NATIVE_READ" with the 0x10 flag which selects AUX FIFO mode. Signed-off-by: Hermes Wu Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/ite-it6505.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/i= te-it6505.c index 9747d7ccf435d536da55c6a3ff79e504b7c724f0..4e6ec1695ae45111d06026d7548= d108fac9e5219 100644 --- a/drivers/gpu/drm/bridge/ite-it6505.c +++ b/drivers/gpu/drm/bridge/ite-it6505.c @@ -126,6 +126,7 @@ #define REG_AUX_OUT_DATA0 0x27 =20 #define REG_AUX_CMD_REQ 0x2B +#define M_AUX_REQ_CMD 0x0F #define AUX_BUSY BIT(5) =20 #define REG_AUX_DATA_0_7 0x2C @@ -324,6 +325,9 @@ enum aux_cmd_type { CMD_AUX_NATIVE_READ =3D 0x0, CMD_AUX_NATIVE_WRITE =3D 0x5, CMD_AUX_I2C_EDID_READ =3D 0xB, + + /* KSV read with AUX FIFO extend from CMD_AUX_NATIVE_READ*/ + CMD_AUX_GET_KSV_LIST =3D 0x10, }; =20 enum aux_cmd_reply { @@ -965,7 +969,8 @@ static ssize_t it6505_aux_operation(struct it6505 *it65= 05, it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE); =20 aux_op_start: - if (cmd =3D=3D CMD_AUX_I2C_EDID_READ) { + /* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */ + if (cmd =3D=3D CMD_AUX_I2C_EDID_READ || cmd =3D=3D CMD_AUX_GET_KSV_LIST) { /* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */ size =3D min_t(size_t, size, AUX_FIFO_MAX_SIZE); /* Enable AUX FIFO read back and clear FIFO */ @@ -996,7 +1001,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6= 505, size); =20 /* Aux Fire */ - it6505_write(it6505, REG_AUX_CMD_REQ, cmd); + it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd)); =20 ret =3D it6505_aux_wait(it6505); if (ret < 0) @@ -1030,7 +1035,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it= 6505, goto aux_op_start; } =20 - if (cmd =3D=3D CMD_AUX_I2C_EDID_READ) { + if (cmd =3D=3D CMD_AUX_I2C_EDID_READ || cmd =3D=3D CMD_AUX_GET_KSV_LIST) { for (i =3D 0; i < size; i++) { ret =3D it6505_read(it6505, REG_AUX_DATA_FIFO); if (ret < 0) @@ -1055,7 +1060,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it= 6505, ret =3D i; =20 aux_op_err: - if (cmd =3D=3D CMD_AUX_I2C_EDID_READ) { + if (cmd =3D=3D CMD_AUX_I2C_EDID_READ || cmd =3D=3D CMD_AUX_GET_KSV_LIST) { /* clear AUX FIFO */ it6505_set_bits(it6505, REG_AUX_CTRL, AUX_EN_FIFO_READ | CLR_EDID_FIFO, @@ -1076,7 +1081,8 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *= it6505, size_t size, enum aux_cmd_reply *reply) { int i, ret_size, ret =3D 0, request_size; - int fifo_max_size =3D (cmd =3D=3D CMD_AUX_I2C_EDID_READ) ? AUX_FIFO_MAX_S= IZE : 4; + int fifo_max_size =3D (cmd =3D=3D CMD_AUX_I2C_EDID_READ || cmd =3D=3D CMD= _AUX_GET_KSV_LIST) ? + AUX_FIFO_MAX_SIZE : 4; =20 mutex_lock(&it6505->aux_lock); i =3D 0; --=20 2.34.1