* [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support
@ 2024-12-30 10:51 Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE Hermes Wu via B4 Relay
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
There are lots of failure items while running HDCP CTS using UNIGRAF DPR-100.
In Order to fix those failures, HDCP flow needs to be changed.
The DisplayPort AUX protocol supports I2C transport.
In Order to support MCCS via the aux channel, the aux-i2c operation is added.
v6->v7
-[3/10] add header <linux/bitfield.h> included
links:
https://lore.kernel.org/all/20241016-upstream-v6-v6-0-4d93a0c46de1@ite.com.tw/
v5->v6:
-keep the commit message wrapped at 72-75 chars.
-[10/10] fix return variable being used without being initialized
v4->v5:
-add more messages for changes.
-[2/10] modified AUX transfer data size judgment.
change for-loop to do-while.
-[7/10] change for-loop to do-while.
-[9/10] change wait timer with timer_after()
links:
https://lore.kernel.org/all/20240926074755.22176-4-Hermes.Wu@ite.com.tw/
https://lore.kernel.org/all/20240926075134.22394-1-Hermes.Wu@ite.com.tw/
v3->v4:
-split changes into patches.
v2->v3:
-split aux read KSV function to a patch.
-[1/3] new in v3
-[2/3] add description of patch
v1->v2:
- ignored.
To: Andrzej Hajda <andrzej.hajda@intel.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
To: Robert Foss <rfoss@kernel.org>
To: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
To: Jonas Karlman <jonas@kwiboo.se>
To: Jernej Skrabec <jernej.skrabec@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Hermes Wu <hermes.wu@ite.com.tw>
Cc: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org
Cc: Pin-yen Lin <treapking@chromium.org>
Cc: Kenneth Hung <Kenneth.Hung@ite.com.tw>
Cc: Pet Weng <Pet.Weng@ite.com.tw>
Change-Id: I7f14eeb18ae70b17ef7e1a8622c590427b0ff2ed
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
Hermes Wu (10):
drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE
drm/bridge: it6505: improve AUX operation for edid read
drm/bridge: it6505: add AUX operation for HDCP KSV list read
drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
drm/bridge: it6505: fix HDCP Bstatus check
drm/bridge: it6505: fix HDCP encryption when R0 ready
drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100.
drm/bridge: it6505: fix HDCP CTS compare V matching
drm/bridge: it6505: fix HDCP CTS KSV list wait timer
drm/bridge: it6505: add I2C functionality on AUX
drivers/gpu/drm/bridge/ite-it6505.c | 335 ++++++++++++++++++++++++++++++------
1 file changed, 278 insertions(+), 57 deletions(-)
---
base-commit: 4d1c251e8889b4629789425fe85adfc6d39666ac
change-id: 20241101-v7-upstream-75ead2f2f567
Best regards,
--
Hermes Wu <Hermes.wu@ite.corp-partner.google.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 02/10] drm/bridge: it6505: improve AUX operation for edid read Hermes Wu via B4 Relay
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
The hardware AUX FIFO is 16 bytes
Change definition of AUX_FIFO_MAX_SIZE to 16
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 7ff17aa14b01e4d9f626424e065131ae2b195c62..3272ca6951f2585f9592834869de23ac50ce41a4 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -300,7 +300,7 @@
#define MAX_CR_LEVEL 0x03
#define MAX_EQ_LEVEL 0x03
#define AUX_WAIT_TIMEOUT_MS 15
-#define AUX_FIFO_MAX_SIZE 32
+#define AUX_FIFO_MAX_SIZE 16
#define PIXEL_CLK_DELAY 1
#define PIXEL_CLK_INVERSE 0
#define ADJUST_PHASE_THRESHOLD 80000
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 02/10] drm/bridge: it6505: improve AUX operation for edid read
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read Hermes Wu via B4 Relay
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
The original AUX operation using data registers is limited to 4 bytes.
The AUX operation command CMD_AUX_I2C_EDID_READ uses AUX FIFO and
is capable of reading 16 bytes.
This improves the speed of EDID read.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 3272ca6951f2585f9592834869de23ac50ce41a4..9747d7ccf435d536da55c6a3ff79e504b7c724f0 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -1076,10 +1076,13 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
size_t size, enum aux_cmd_reply *reply)
{
int i, ret_size, ret = 0, request_size;
+ int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ) ? AUX_FIFO_MAX_SIZE : 4;
mutex_lock(&it6505->aux_lock);
- for (i = 0; i < size; i += 4) {
- request_size = min((int)size - i, 4);
+ i = 0;
+ do {
+ request_size = min_t(int, (int)size - i, fifo_max_size);
+
ret_size = it6505_aux_operation(it6505, cmd, address + i,
buffer + i, request_size,
reply);
@@ -1088,8 +1091,9 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
goto aux_op_err;
}
+ i += request_size;
ret += ret_size;
- }
+ } while (i < size);
aux_op_err:
mutex_unlock(&it6505->aux_lock);
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 02/10] drm/bridge: it6505: improve AUX operation for edid read Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Hermes Wu via B4 Relay
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <hermes.wu@ite.com.tw>
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.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 9747d7ccf435d536da55c6a3ff79e504b7c724f0..ba37974967767a17b7025595f6864f057174efb9 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -19,6 +19,7 @@
#include <linux/regulator/consumer.h>
#include <linux/types.h>
#include <linux/wait.h>
+#include <linux/bitfield.h>
#include <crypto/hash.h>
@@ -126,6 +127,7 @@
#define REG_AUX_OUT_DATA0 0x27
#define REG_AUX_CMD_REQ 0x2B
+#define M_AUX_REQ_CMD 0x0F
#define AUX_BUSY BIT(5)
#define REG_AUX_DATA_0_7 0x2C
@@ -324,6 +326,9 @@ enum aux_cmd_type {
CMD_AUX_NATIVE_READ = 0x0,
CMD_AUX_NATIVE_WRITE = 0x5,
CMD_AUX_I2C_EDID_READ = 0xB,
+
+ /* KSV read with AUX FIFO extend from CMD_AUX_NATIVE_READ*/
+ CMD_AUX_GET_KSV_LIST = 0x10,
};
enum aux_cmd_reply {
@@ -965,7 +970,8 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE);
aux_op_start:
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ /* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
/* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */
size = min_t(size_t, size, AUX_FIFO_MAX_SIZE);
/* Enable AUX FIFO read back and clear FIFO */
@@ -996,7 +1002,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
size);
/* Aux Fire */
- it6505_write(it6505, REG_AUX_CMD_REQ, cmd);
+ it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
ret = it6505_aux_wait(it6505);
if (ret < 0)
@@ -1030,7 +1036,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
goto aux_op_start;
}
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
for (i = 0; i < size; i++) {
ret = it6505_read(it6505, REG_AUX_DATA_FIFO);
if (ret < 0)
@@ -1055,7 +1061,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
ret = i;
aux_op_err:
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
/* clear AUX FIFO */
it6505_set_bits(it6505, REG_AUX_CTRL,
AUX_EN_FIFO_READ | CLR_EDID_FIFO,
@@ -1076,7 +1082,8 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
size_t size, enum aux_cmd_reply *reply)
{
int i, ret_size, ret = 0, request_size;
- int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ) ? AUX_FIFO_MAX_SIZE : 4;
+ int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) ?
+ AUX_FIFO_MAX_SIZE : 4;
mutex_lock(&it6505->aux_lock);
i = 0;
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (2 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 05/10] drm/bridge: it6505: fix HDCP Bstatus check Hermes Wu via B4 Relay
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
A HDCP source device shall support max downstream to 127 devices.
Change definition MAX_HDCP_DOWN_STREAM_COUNT to 127
KSVs shall save for DRM blocked devices check.
This results in struct it6505 growth by ~0.5 KiB.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index ba37974967767a17b7025595f6864f057174efb9..9a90a36d0421422038b04ad00b2cb2e326a9cab4 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -298,7 +298,7 @@
#define MAX_LANE_COUNT 4
#define MAX_LINK_RATE HBR
#define AUTO_TRAIN_RETRY 3
-#define MAX_HDCP_DOWN_STREAM_COUNT 10
+#define MAX_HDCP_DOWN_STREAM_COUNT 127
#define MAX_CR_LEVEL 0x03
#define MAX_EQ_LEVEL 0x03
#define AUX_WAIT_TIMEOUT_MS 15
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 05/10] drm/bridge: it6505: fix HDCP Bstatus check
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (3 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready Hermes Wu via B4 Relay
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
When HDCP is activated,
a DisplayPort source receiving CP_IRQ from the sink
shall check Bstatus from DPCD and process the corresponding value
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 9a90a36d0421422038b04ad00b2cb2e326a9cab4..760eab0b868874f96ccd4d5ec3e2f2d4ffb1e41c 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2323,14 +2323,20 @@ static int it6505_process_hpd_irq(struct it6505 *it6505)
DRM_DEV_DEBUG_DRIVER(dev, "dp_irq_vector = 0x%02x", dp_irq_vector);
if (dp_irq_vector & DP_CP_IRQ) {
- it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
- HDCP_TRIGGER_CPIRQ);
-
bstatus = it6505_dpcd_read(it6505, DP_AUX_HDCP_BSTATUS);
if (bstatus < 0)
return bstatus;
DRM_DEV_DEBUG_DRIVER(dev, "Bstatus = 0x%02x", bstatus);
+
+ /*Check BSTATUS when recive CP_IRQ */
+ if (bstatus & DP_BSTATUS_R0_PRIME_READY &&
+ it6505->hdcp_status == HDCP_AUTH_GOING)
+ it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
+ HDCP_TRIGGER_CPIRQ);
+ else if (bstatus & (DP_BSTATUS_REAUTH_REQ | DP_BSTATUS_LINK_FAILURE) &&
+ it6505->hdcp_status == HDCP_AUTH_DONE)
+ it6505_start_hdcp(it6505);
}
ret = drm_dp_dpcd_read_link_status(&it6505->aux, link_status);
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (4 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 05/10] drm/bridge: it6505: fix HDCP Bstatus check Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100 Hermes Wu via B4 Relay
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
When starting HDCP authentication, HDCP encryption should be enabled
when R0'is checked.
Change encryption enables time at R0' ready.
The hardware HDCP engine trigger is changed and the repeater KSV fails
will restart HDCP.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 760eab0b868874f96ccd4d5ec3e2f2d4ffb1e41c..614fbb6295237708aa5b692de87ab5548c499da5 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2092,15 +2092,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);
DRM_DEV_DEBUG_DRIVER(dev, "ksv list ready, ksv list check %s",
ksv_list_check ? "pass" : "fail");
- if (ksv_list_check) {
- it6505_set_bits(it6505, REG_HDCP_TRIGGER,
- HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
+
+ if (ksv_list_check)
return;
- }
+
timeout:
- it6505_set_bits(it6505, REG_HDCP_TRIGGER,
- HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL,
- HDCP_TRIGGER_KSV_DONE | HDCP_TRIGGER_KSV_FAIL);
+ it6505_start_hdcp(it6505);
}
static void it6505_hdcp_work(struct work_struct *work)
@@ -2473,7 +2470,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505)
{
struct device *dev = it6505->dev;
- DRM_DEV_DEBUG_DRIVER(dev, "HDCP event Interrupt");
+ DRM_DEV_DEBUG_DRIVER(dev, "HDCP repeater R0 event Interrupt");
+ /* 1B01 HDCP encription should start when R0 is ready*/
+ it6505_set_bits(it6505, REG_HDCP_TRIGGER,
+ HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
+
schedule_work(&it6505->hdcp_wait_ksv_list);
}
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100.
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (5 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching Hermes Wu via B4 Relay
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
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 <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
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/ite-it6505.c
index 614fbb6295237708aa5b692de87ab5548c499da5..4ed4899227602a4574a13ffa22442dcc4a5c2092 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;
}
+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;
}
+ err = it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
+ if (err < 0)
+ return err;
- 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);
-
- 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];
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (6 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100 Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Hermes Wu via B4 Relay
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
When HDCP negotiation with a repeater device.
Checking SHA V' matching must retry 3 times before restarting HDCP.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 4ed4899227602a4574a13ffa22442dcc4a5c2092..2b8f208d1e17eebe3287ab0aa71180176dd0574e 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2058,7 +2058,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
{
struct device *dev = it6505->dev;
u8 av[5][4], bv[5][4];
- int i, err;
+ int i, err, retry;
i = it6505_setup_sha1_input(it6505, it6505->sha1_input);
if (i <= 0) {
@@ -2067,22 +2067,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
}
it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av);
+ /*1B-05 V' must retry 3 times */
+ for (retry = 0; retry < 3; retry++) {
+ err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
+ sizeof(bv));
- err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
- sizeof(bv));
+ if (err < 0) {
+ dev_err(dev, "Read V' value Fail %d", retry);
+ continue;
+ }
- if (err < 0) {
- dev_err(dev, "Read V' value Fail");
- return false;
- }
+ for (i = 0; i < 5; i++) {
+ if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
+ av[i][1] != av[i][2] || bv[i][0] != av[i][3])
+ break;
- for (i = 0; i < 5; i++)
- if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
- bv[i][1] != av[i][2] || bv[i][0] != av[i][3])
- return false;
+ DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
+ return true;
+ }
+ }
- DRM_DEV_DEBUG_DRIVER(dev, "V' all match!!");
- return true;
+ DRM_DEV_DEBUG_DRIVER(dev, "V' NOT match!! %d", retry);
+ return false;
}
static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (7 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 10/10] drm/bridge: it6505: add I2C functionality on AUX Hermes Wu via B4 Relay
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng, Hermes Wu
From: Hermes Wu <Hermes.wu@ite.com.tw>
HDCP must disabled encryption and restart authentication after
waiting KSV for 5s.
The original method uses a counter in a waitting loop that may
wait much longer than it is supposed to.
Use time_after() for KSV wait timeout.
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 2b8f208d1e17eebe3287ab0aa71180176dd0574e..83e2df618c97f8fe3e59789ffb810ce8639f96bb 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2096,12 +2096,13 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
struct it6505 *it6505 = container_of(work, struct it6505,
hdcp_wait_ksv_list);
struct device *dev = it6505->dev;
- unsigned int timeout = 5000;
- u8 bstatus = 0;
+ u8 bstatus;
bool ksv_list_check;
+ /* 1B-04 wait ksv list for 5s */
+ unsigned long timeout = jiffies +
+ msecs_to_jiffies(5000) + 1;
- timeout /= 20;
- while (timeout > 0) {
+ for (;;) {
if (!it6505_get_sink_hpd_status(it6505))
return;
@@ -2110,13 +2111,12 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
if (bstatus & DP_BSTATUS_READY)
break;
- msleep(20);
- timeout--;
- }
+ if (time_after(jiffies, timeout)) {
+ DRM_DEV_DEBUG_DRIVER(dev, "KSV list wait timeout");
+ goto timeout;
+ }
- if (timeout == 0) {
- DRM_DEV_DEBUG_DRIVER(dev, "timeout and ksv list wait failed");
- goto timeout;
+ msleep(20);
}
ksv_list_check = it6505_hdcp_part2_ksvlist_check(it6505);
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH RESEND v7 10/10] drm/bridge: it6505: add I2C functionality on AUX
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (8 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Hermes Wu via B4 Relay
@ 2024-12-30 10:51 ` Hermes Wu via B4 Relay
2025-01-02 12:34 ` [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support AngeloGioacchino Del Regno
2025-01-03 18:42 ` Dmitry Baryshkov
11 siblings, 0 replies; 13+ messages in thread
From: Hermes Wu via B4 Relay @ 2024-12-30 10:51 UTC (permalink / raw)
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, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Hermes Wu, Dmitry Baryshkov
From: Hermes Wu <Hermes.wu@ite.com.tw>
DisplayPort AUX protocol supports I2C transport which is capable of
reading EDID or supports MCCS.
In drm_dp_helper, drm_dp_i2c_xfer() packs I2C requests into a
sequence of AUX requests.
it6505_aux_i2c_operation() is implemented to match drm_dp_i2c_xfer()
operactions.
it6505_aux_i2c_transfer() adds I2C functionality
for it6505_aux_transfer().
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Hermes Wu <hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 177 +++++++++++++++++++++++++++++++++++-
1 file changed, 175 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 83e2df618c97f8fe3e59789ffb810ce8639f96bb..c2a846f5d8d9b7251913c82d21f7957401e35e5e 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -268,6 +268,18 @@
#define REG_SSC_CTRL1 0x189
#define REG_SSC_CTRL2 0x18A
+#define REG_AUX_USER_CTRL 0x190
+#define EN_USER_AUX BIT(0)
+#define USER_AUX_DONE BIT(1)
+#define AUX_EVENT BIT(4)
+
+#define REG_AUX_USER_DATA_REC 0x191
+#define M_AUX_IN_REC 0xF0
+#define M_AUX_OUT_REC 0x0F
+
+#define REG_AUX_USER_REPLY 0x19A
+#define REG_AUX_USER_RXB(n) (n + 0x19B)
+
#define RBR DP_LINK_BW_1_62
#define HBR DP_LINK_BW_2_7
#define HBR2 DP_LINK_BW_5_4
@@ -303,6 +315,8 @@
#define MAX_EQ_LEVEL 0x03
#define AUX_WAIT_TIMEOUT_MS 15
#define AUX_FIFO_MAX_SIZE 16
+#define AUX_I2C_MAX_SIZE 4
+#define AUX_I2C_DEFER_RETRY 4
#define PIXEL_CLK_DELAY 1
#define PIXEL_CLK_INVERSE 0
#define ADJUST_PHASE_THRESHOLD 80000
@@ -325,7 +339,12 @@
enum aux_cmd_type {
CMD_AUX_NATIVE_READ = 0x0,
CMD_AUX_NATIVE_WRITE = 0x5,
+ CMD_AUX_GI2C_ADR = 0x08,
+ CMD_AUX_GI2C_READ = 0x09,
+ CMD_AUX_GI2C_WRITE = 0x0A,
CMD_AUX_I2C_EDID_READ = 0xB,
+ CMD_AUX_I2C_READ = 0x0D,
+ CMD_AUX_I2C_WRITE = 0x0C,
/* KSV read with AUX FIFO extend from CMD_AUX_NATIVE_READ*/
CMD_AUX_GET_KSV_LIST = 0x10,
@@ -1107,6 +1126,161 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
return ret;
}
+static bool it6505_aux_i2c_reply_defer(u8 reply)
+{
+ if (reply == DP_AUX_NATIVE_REPLY_DEFER || reply == DP_AUX_I2C_REPLY_DEFER)
+ return true;
+ return false;
+}
+
+static bool it6505_aux_i2c_reply_nack(u8 reply)
+{
+ if (reply == DP_AUX_NATIVE_REPLY_NACK || reply == DP_AUX_I2C_REPLY_NACK)
+ return true;
+ return false;
+}
+
+static int it6505_aux_i2c_wait(struct it6505 *it6505, u8 *reply)
+{
+ int err = 0;
+ unsigned long timeout;
+ struct device *dev = it6505->dev;
+
+ timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
+
+ do {
+ if (it6505_read(it6505, REG_AUX_USER_CTRL) & AUX_EVENT)
+ break;
+ if (time_after(jiffies, timeout)) {
+ dev_err(dev, "Timed out waiting AUX I2C, BUSY = %X\n",
+ it6505_aux_op_finished(it6505));
+ err = -ETIMEDOUT;
+ goto end_aux_i2c_wait;
+ }
+ usleep_range(300, 800);
+ } while (!it6505_aux_op_finished(it6505));
+
+ *reply = it6505_read(it6505, REG_AUX_USER_REPLY) >> 4;
+
+ if (*reply == 0)
+ goto end_aux_i2c_wait;
+
+ if (it6505_aux_i2c_reply_defer(*reply))
+ err = -EBUSY;
+ else if (it6505_aux_i2c_reply_nack(*reply))
+ err = -ENXIO;
+
+end_aux_i2c_wait:
+ it6505_set_bits(it6505, REG_AUX_USER_CTRL, USER_AUX_DONE, USER_AUX_DONE);
+ return err;
+}
+
+static int it6505_aux_i2c_readb(struct it6505 *it6505, u8 *buf, size_t size, u8 *reply)
+{
+ int ret, i;
+ int retry;
+
+ for (retry = 0; retry < AUX_I2C_DEFER_RETRY; retry++) {
+ it6505_write(it6505, REG_AUX_CMD_REQ, CMD_AUX_GI2C_READ);
+
+ ret = it6505_aux_i2c_wait(it6505, reply);
+ if (it6505_aux_i2c_reply_defer(*reply))
+ continue;
+ if (ret >= 0)
+ break;
+ }
+
+ for (i = 0; i < size; i++)
+ buf[i] = it6505_read(it6505, REG_AUX_USER_RXB(0 + i));
+
+ return size;
+}
+
+static int it6505_aux_i2c_writeb(struct it6505 *it6505, u8 *buf, size_t size, u8 *reply)
+{
+ int i, ret;
+ int retry;
+
+ for (i = 0; i < size; i++)
+ it6505_write(it6505, REG_AUX_OUT_DATA0 + i, buf[i]);
+
+ for (retry = 0; retry < AUX_I2C_DEFER_RETRY; retry++) {
+ it6505_write(it6505, REG_AUX_CMD_REQ, CMD_AUX_GI2C_WRITE);
+
+ ret = it6505_aux_i2c_wait(it6505, reply);
+ if (it6505_aux_i2c_reply_defer(*reply))
+ continue;
+ if (ret >= 0)
+ break;
+ }
+ return size;
+}
+
+static ssize_t it6505_aux_i2c_operation(struct it6505 *it6505,
+ struct drm_dp_aux_msg *msg)
+{
+ int ret;
+ ssize_t request_size, data_cnt = 0;
+ u8 *buffer = msg->buffer;
+
+ /* set AUX user mode */
+ it6505_set_bits(it6505, REG_AUX_CTRL,
+ AUX_USER_MODE | AUX_NO_SEGMENT_WR, AUX_USER_MODE);
+ it6505_set_bits(it6505, REG_AUX_USER_CTRL, EN_USER_AUX, EN_USER_AUX);
+ /* clear AUX FIFO */
+ it6505_set_bits(it6505, REG_AUX_CTRL,
+ AUX_EN_FIFO_READ | CLR_EDID_FIFO,
+ AUX_EN_FIFO_READ | CLR_EDID_FIFO);
+
+ it6505_set_bits(it6505, REG_AUX_CTRL,
+ AUX_EN_FIFO_READ | CLR_EDID_FIFO, 0x00);
+
+ it6505_write(it6505, REG_AUX_ADR_0_7, 0x00);
+ it6505_write(it6505, REG_AUX_ADR_8_15, msg->address << 1);
+
+ if (msg->size == 0) {
+ /* IIC Start/STOP dummy write */
+ it6505_write(it6505, REG_AUX_ADR_16_19, msg->request);
+ it6505_write(it6505, REG_AUX_CMD_REQ, CMD_AUX_GI2C_ADR);
+ ret = it6505_aux_i2c_wait(it6505, &msg->reply);
+ goto end_aux_i2c_transfer;
+ }
+
+ /* IIC data transfer */
+ data_cnt = 0;
+ do {
+ request_size = min_t(ssize_t, msg->size - data_cnt, AUX_I2C_MAX_SIZE);
+ it6505_write(it6505, REG_AUX_ADR_16_19,
+ msg->request | ((request_size - 1) << 4));
+ if ((msg->request & DP_AUX_I2C_READ) == DP_AUX_I2C_READ)
+ ret = it6505_aux_i2c_readb(it6505, &buffer[data_cnt],
+ request_size, &msg->reply);
+ else
+ ret = it6505_aux_i2c_writeb(it6505, &buffer[data_cnt],
+ request_size, &msg->reply);
+
+ if (ret < 0)
+ goto end_aux_i2c_transfer;
+
+ data_cnt += request_size;
+ } while (data_cnt < msg->size);
+ ret = data_cnt;
+end_aux_i2c_transfer:
+
+ it6505_set_bits(it6505, REG_AUX_USER_CTRL, EN_USER_AUX, 0);
+ it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, 0);
+ return ret;
+}
+
+static ssize_t it6505_aux_i2c_transfer(struct drm_dp_aux *aux,
+ struct drm_dp_aux_msg *msg)
+{
+ struct it6505 *it6505 = container_of(aux, struct it6505, aux);
+
+ guard(mutex)(&it6505->aux_lock);
+ return it6505_aux_i2c_operation(it6505, msg);
+}
+
static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,
struct drm_dp_aux_msg *msg)
{
@@ -1116,9 +1290,8 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,
int ret;
enum aux_cmd_reply reply;
- /* IT6505 doesn't support arbitrary I2C read / write. */
if (is_i2c)
- return -EINVAL;
+ return it6505_aux_i2c_transfer(aux, msg);
switch (msg->request) {
case DP_AUX_NATIVE_READ:
--
2.34.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (9 preceding siblings ...)
2024-12-30 10:51 ` [PATCH RESEND v7 10/10] drm/bridge: it6505: add I2C functionality on AUX Hermes Wu via B4 Relay
@ 2025-01-02 12:34 ` AngeloGioacchino Del Regno
2025-01-03 18:42 ` Dmitry Baryshkov
11 siblings, 0 replies; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-01-02 12:34 UTC (permalink / raw)
To: Hermes.wu, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec,
Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
David Airlie, Simona Vetter, Hermes Wu, Allen Chen
Cc: dri-devel, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng,
Dmitry Baryshkov
Il 30/12/24 11:51, Hermes Wu via B4 Relay ha scritto:
> There are lots of failure items while running HDCP CTS using UNIGRAF DPR-100.
> In Order to fix those failures, HDCP flow needs to be changed.
>
> The DisplayPort AUX protocol supports I2C transport.
> In Order to support MCCS via the aux channel, the aux-i2c operation is added.
>
> v6->v7
> -[3/10] add header <linux/bitfield.h> included
>
> links:
> https://lore.kernel.org/all/20241016-upstream-v6-v6-0-4d93a0c46de1@ite.com.tw/
>
> v5->v6:
> -keep the commit message wrapped at 72-75 chars.
> -[10/10] fix return variable being used without being initialized
>
> v4->v5:
> -add more messages for changes.
> -[2/10] modified AUX transfer data size judgment.
> change for-loop to do-while.
> -[7/10] change for-loop to do-while.
> -[9/10] change wait timer with timer_after()
>
> links:
> https://lore.kernel.org/all/20240926074755.22176-4-Hermes.Wu@ite.com.tw/
> https://lore.kernel.org/all/20240926075134.22394-1-Hermes.Wu@ite.com.tw/
>
> v3->v4:
> -split changes into patches.
>
> v2->v3:
> -split aux read KSV function to a patch.
> -[1/3] new in v3
> -[2/3] add description of patch
>
> v1->v2:
> - ignored.
>
> To: Andrzej Hajda <andrzej.hajda@intel.com>
> To: Neil Armstrong <neil.armstrong@linaro.org>
> To: Robert Foss <rfoss@kernel.org>
> To: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> To: Jonas Karlman <jonas@kwiboo.se>
> To: Jernej Skrabec <jernej.skrabec@gmail.com>
> To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> To: Maxime Ripard <mripard@kernel.org>
> To: Thomas Zimmermann <tzimmermann@suse.de>
> To: David Airlie <airlied@gmail.com>
> To: Simona Vetter <simona@ffwll.ch>
> To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> To: Hermes Wu <hermes.wu@ite.com.tw>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: Pin-yen Lin <treapking@chromium.org>
> Cc: Kenneth Hung <Kenneth.Hung@ite.com.tw>
> Cc: Pet Weng <Pet.Weng@ite.com.tw>
>
> Change-Id: I7f14eeb18ae70b17ef7e1a8622c590427b0ff2ed
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
Whole series is
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
` (10 preceding siblings ...)
2025-01-02 12:34 ` [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support AngeloGioacchino Del Regno
@ 2025-01-03 18:42 ` Dmitry Baryshkov
11 siblings, 0 replies; 13+ messages in thread
From: Dmitry Baryshkov @ 2025-01-03 18:42 UTC (permalink / raw)
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, Hermes Wu
Cc: dri-devel, linux-kernel, Pin-yen Lin, Kenneth Hung, Pet Weng, Hermes Wu
On Mon, 30 Dec 2024 18:51:18 +0800, Hermes Wu wrote:
> There are lots of failure items while running HDCP CTS using UNIGRAF DPR-100.
> In Order to fix those failures, HDCP flow needs to be changed.
>
> The DisplayPort AUX protocol supports I2C transport.
> In Order to support MCCS via the aux channel, the aux-i2c operation is added.
>
> v6->v7
> -[3/10] add header <linux/bitfield.h> included
>
> [...]
Applied to drm-misc-next, thanks!
[01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE
commit: c14870218c14532b0f0a7805b96a4d3c92d06fb2
[02/10] drm/bridge: it6505: improve AUX operation for edid read
commit: d0c97a51cdef2badc8d17f6edfbc0bdc0ba92065
[03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read
commit: 235d9bf8a1e1c0a0cf1340c40567e6b4f2b742c6
[04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT
commit: 85597bc0d70c287ba41f17d14d3d857a38a3d727
[05/10] drm/bridge: it6505: fix HDCP Bstatus check
commit: 0fd2ff47d8c207fa3173661de04bb9e8201c0ad2
[06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready
commit: 8c01b0bae2f9e58f2fee0e811cb90d8331986554
[07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100.
commit: aa97239300e3f2a9ecbccf7ebfa240860bdddafb
[08/10] drm/bridge: it6505: fix HDCP CTS compare V matching
commit: 0989c02c7a5c887c70afeae80c64d0291624e1a7
[09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer
commit: 9f9eef9ec1a2b57d95a86fe81df758e8253a7766
[10/10] drm/bridge: it6505: add I2C functionality on AUX
commit: 041d61ad66ea0d88890264e96e8f81437a33a9cf
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-01-03 18:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-30 10:51 [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 01/10] drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 02/10] drm/bridge: it6505: improve AUX operation for edid read Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 04/10] drm/bridge: it6505: Change definition MAX_HDCP_DOWN_STREAM_COUNT Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 05/10] drm/bridge: it6505: fix HDCP Bstatus check Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 06/10] drm/bridge: it6505: fix HDCP encryption when R0 ready Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 07/10] drm/bridge: it6505: fix HDCP CTS KSV list read with UNIGRAF DPR-100 Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 08/10] drm/bridge: it6505: fix HDCP CTS compare V matching Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 09/10] drm/bridge: it6505: fix HDCP CTS KSV list wait timer Hermes Wu via B4 Relay
2024-12-30 10:51 ` [PATCH RESEND v7 10/10] drm/bridge: it6505: add I2C functionality on AUX Hermes Wu via B4 Relay
2025-01-02 12:34 ` [PATCH RESEND v7 00/10] drm/bridge: it6505: fix HDCP CTS fail items and add MCCS support AngeloGioacchino Del Regno
2025-01-03 18:42 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®