From nobody Thu Nov 28 14:41:35 2024 Received: from ironport.ite.com.tw (60-251-196-230.hinet-ip.hinet.net [60.251.196.230]) (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 97B7C1BC9EF for ; Tue, 1 Oct 2024 06:43:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.251.196.230 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727765036; cv=none; b=U/2cqM2f8RL+iySb1TufLeZ+k3HthndUPEb1vdkoAFhcFHMj/31QztSjufSgmSVfNIYbu08WymyUKLTNvE4/Ib3dxyv2RNqV7vsXijHtdmZFVfmgNCIMl8z/mvBGdt2K4riFovJlx9Wmk8fru9Wfl2zSI6wfm74kbpb0I/l+nzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727765036; c=relaxed/simple; bh=gMJwj3brJOKIPUejPw5rewVB/IHICnQkFWDPFF01N6Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iu1MWuTUR1CQ3BTpBBzvW2YXwzHe99R+EMvF+QCzQwrLkA6UC/LCPUycX4HCT+wTUVK8I96brnlwpQ5MZY9KEpg+vzgL7QhPjiaDpnRkDAse0bvxctCBaCazGSm8a3eJB+Xk1njTY23X/V4k+JDZqcp+GtnQfOuqB39qkZBZiog= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ite.com.tw; spf=pass smtp.mailfrom=ite.com.tw; dkim=fail (0-bit key) header.d=ite.com.tw header.i=@ite.com.tw header.b=W20YDrna reason="key not found in DNS"; arc=none smtp.client-ip=60.251.196.230 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ite.com.tw Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ite.com.tw Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ite.com.tw header.i=@ite.com.tw header.b="W20YDrna" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ite.com.tw; s=dkim; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZKXe6cejtTfwAdkLPishQV6If6We7/xhoRLP0BCApug=; b=W20YDrnaPiNDMo8ZxBVJCXMjBmSjG/xh4oATreTfiKmbFatqEc6gGLzd LufvD3TasSARBCYQ7FHFlshsYEclN6oTvx864s9tRvq1ji/t5hcP9b7Yl 5CEfJ3K/mbv2x54XvilVYGDSyB85aHZruFxnFdjjTUISw50ogpbrCTZ/P u8eaP8fP0HsGJLtwZPNv9OUZQPLDZEjA7OWOwLbqFMe4Yibefd4Hxkq4i AcHCiP6U8NtLPVQIp578Ri8+AOuHSSRxvdQO+TcQzSp1NPsq+OUuLXFxw 5qjmDrt4nGuIqSTfg0uI1mBWSfjPZdqKzqCvACVR3PYE/t+f5N+nssp0L Q==; X-CSE-ConnectionGUID: hlniAeixSW6uxjk9P2b96Q== X-CSE-MsgGUID: DJ3zsK0HSiGABjVWQilnJQ== Received: from unknown (HELO mse.ite.com.tw) ([192.168.35.30]) by ironport.ite.com.tw with ESMTP; 01 Oct 2024 14:43:43 +0800 Received: from tpemail1.internal.ite.com.tw (TPEMAIL1.internal.ite.com.tw [192.168.15.58]) by mse.ite.com.tw with ESMTP id 4916hdBV044745; Tue, 1 Oct 2024 14:43:39 +0800 (GMT-8) (envelope-from Hermes.Wu@ite.com.tw) Received: from LAPTOP-C4GM1L3U.localdomain (192.168.82.6) by TPEMAIL1.internal.ite.com.tw (192.168.15.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 1 Oct 2024 14:43:39 +0800 From: Hermes Wu To: Pin-yen Lin CC: Kenneth Hung , Pet Weng , Hermes Wu , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , "open list:DRM DRIVERS" , open list Subject: [PATCH v5 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read Date: Tue, 1 Oct 2024 14:43:02 +0800 Message-ID: <20241001064305.32180-4-Hermes.Wu@ite.com.tw> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241001064305.32180-1-Hermes.Wu@ite.com.tw> References: <20241001064305.32180-1-Hermes.Wu@ite.com.tw> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: TPEMAIL1.internal.ite.com.tw (192.168.15.58) To TPEMAIL1.internal.ite.com.tw (192.168.15.58) X-TM-SNTS-SMTP: CDE6E7CBE5A25FF8EBDF2B2901BE69E59694DFAD01550D3A9EF650F510CBB6442002:8 X-MAIL: mse.ite.com.tw 4916hdBV044745 Content-Type: text/plain; charset="utf-8" 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 boundarie= s. 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_REA= D" 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 864fab7e388f..9a022c095af4 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