Skip to contentSkip to conversation

fix HDCP CTS fail items and add MCCS support

PATCH Superseded Hermes Wu 3 participants 16 messages Sep 26, 2024

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Hermes Wu

author
#0 lore raw

v4 cover fix HDCP CTS fail items and add MCCS support

From: Hermes Wu <[email protected]>

This is a v4 patch-set.

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.

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.

Hermes Wu (11):
drm/bridge: it6505: change aux max fifo size
drm/bridge: it6505: improve aux operation for edid read drm/bridge: it6505: add aux operation for HDCP ksv list read drm/bridge: it6505: fix aux command write to aux operaction register drm/bridge: it6505: increase supports of HDCP repeater ksv devices drm/bridge: it6505: fix HDCP Bstatus check.
drm/bridge: it6505: fix HDCP encription not enable when R0 ready drm/bridge: it6505: fix HDCP KSV list did not read correctly. drm/bridge: it6505: fix HDCP CTS compare V matching without retry drm/bridge: it6505: fix HDCP CTS ksv wait timer drm/bridge: it6505: Add aux i2c functionality

 drivers/gpu/drm/bridge/ite-it6505.c | 313 +++++++++++++++++++++++-----
 1 file changed, 266 insertions(+), 47 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v4 1/11 drm/bridge: it6505: change aux max fifo size

From: Hermes Wu <[email protected]>

The hardware aux fifo is 16 byte

Change definition of AUX_FIFO_MAX_SIZE to 16

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
index f372c05360f2..28a8043229d3 100644
@@ -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
Signature · 1 line
2.34.1
Reviewed-by on v4 1/11
#2 lore raw

Re: [PATCH v4 01/11] drm/bridge: it6505: change aux max fifo size

Quoted 3 lines · Hermes Wu

From: Hermes Wu <[email protected]>

The hardware aux fifo is 16 byte

Nit: AUX, FIFO

Quoted 5 lines

Change definition of AUX_FIFO_MAX_SIZE to 16

Nit: no need for so many empty lines.

Quoted 22 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
index f372c05360f2..28a8043229d3 100644
@@ -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
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
author
#3 lore raw

PATCH v4 2/11 drm/bridge: it6505: fix aux operation for edid read

In reply to Hermes Wu

From: Hermes Wu <[email protected]>

The EDID read operation can reach the maximum size of the AUX FIFO buffer.

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +6 -2
index 28a8043229d3..b451d3c2ac1d 100644
@@ -1078,8 +1078,11 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 	int i, ret_size, ret = 0, request_size;
 
 	mutex_lock(&it6505->aux_lock);
-	for (i = 0; i < size; i += 4) {
-		request_size = min((int)size - i, 4);
+	for (i = 0; i < size; ) {
+		if (cmd == CMD_AUX_I2C_EDID_READ)
+			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
+		else
+			request_size = min_t(int, (int)size - i, 4);
 		ret_size = it6505_aux_operation(it6505, cmd, address + i,
 						buffer + i, request_size,
 						reply);
@@ -1088,6 +1091,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 			goto aux_op_err;
 		}
 
+		i += request_size;
 		ret += ret_size;
 	}
 
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v4 02/11] drm/bridge: it6505: fix aux operation for edid read

Quoted 3 lines · Hermes Wu

From: Hermes Wu <[email protected]>

The EDID read operation can reach the maximum size of the AUX FIFO buffer.

And? Commit message should describe why the change is necessary and what is being done. Just providing a statement is not enough.

Quoted 36 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +6 -2
index 28a8043229d3..b451d3c2ac1d 100644
@@ -1078,8 +1078,11 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 	int i, ret_size, ret = 0, request_size;
 
 	mutex_lock(&it6505->aux_lock);
-	for (i = 0; i < size; i += 4) {
-		request_size = min((int)size - i, 4);
+	for (i = 0; i < size; ) {
+		if (cmd == CMD_AUX_I2C_EDID_READ)
+			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
+		else
+			request_size = min_t(int, (int)size - i, 4);
 		ret_size = it6505_aux_operation(it6505, cmd, address + i,
 						buffer + i, request_size,
 						reply);
@@ -1088,6 +1091,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 			goto aux_op_err;
 		}
 
+		i += request_size;
 		ret += ret_size;
 	}
 
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
#5 lore raw

RE: [PATCH v4 02/11] drm/bridge: it6505: fix aux operation for edid read

Quoted 7 lines · Hermes Wu
Quoted 3 lines

From: Hermes Wu <[email protected]>

The EDID read operation can reach the maximum size of the AUX FIFO buffer.

And? Commit message should describe why the change is necessary and what is being done. Just providing a statement is not enough.

The original AUX operation treat all reads by using data registers will be limited at 4 bytes. AUX operation command CMD_AUX_I2C_EDID_READ using AUX FIFO is capable of reads data by 16 bytes each time. It can improve speed of read EDID.

Quoted 30 lines
Quoted 30 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +5 -2
index 28a8043229d3..b451d3c2ac1d 100644
@@ -1078,8 +1078,11 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 	int i, ret_size, ret = 0, request_size;
 
 	mutex_lock(&it6505->aux_lock);
-	for (i = 0; i < size; i += 4) {
-		request_size = min((int)size - i, 4);
+	for (i = 0; i < size; ) {
+		if (cmd == CMD_AUX_I2C_EDID_READ)
+			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
+		else
+			request_size = min_t(int, (int)size - i, 4);
 		ret_size = it6505_aux_operation(it6505, cmd, address + i,
 						buffer + i, request_size,
 						reply);
@@ -1088,6 +1091,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 			goto aux_op_err;
 		}
 
Quoted 12 lines
Quoted 7 lines
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
+		i += request_size;
 		ret += ret_size;
 	}
 
--

2.34.1

Signature · 2 lines
With best wishes
Dmitry

BR,
Hermes

#6 lore raw

Re: [PATCH v4 02/11] drm/bridge: it6505: fix aux operation for edid read

Quoted 4 lines · On Thu, 26 Sept 2024 at 10:04, <[email protected]> wrote:
Quoted 4 lines · Hermes Wu
Quoted 2 lines

From: Hermes Wu <[email protected]>

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

The EDID read operation can reach the maximum size of the AUX FIFO buffer.

And? Commit message should describe why the change is necessary and what is being done. Just providing a statement is not enough.

The original AUX operation treat all reads by using data registers will be limited at 4 bytes. AUX operation command CMD_AUX_I2C_EDID_READ using AUX FIFO is capable of reads data by 16 bytes each time. It can improve speed of read EDID.

improves, rather than "can improve". Please add this to the commit message.

Quoted 48 lines
Quoted 36 lines
Quoted 36 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +6 -2
index 28a8043229d3..b451d3c2ac1d 100644
@@ -1078,8 +1078,11 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
     int i, ret_size, ret = 0, request_size;
 
     mutex_lock(&it6505->aux_lock);
-    for (i = 0; i < size; i += 4) {
-            request_size = min((int)size - i, 4);
+    for (i = 0; i < size; ) {
+            if (cmd == CMD_AUX_I2C_EDID_READ)
+                    request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
+            else
+                    request_size = min_t(int, (int)size - i, 4);
             ret_size = it6505_aux_operation(it6505, cmd, address + i,
                                             buffer + i, request_size,
                                             reply);
@@ -1088,6 +1091,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
                     goto aux_op_err;
             }
 
+            i += request_size;
             ret += ret_size;
     }
 
Quoted 8 lines
Quoted 3 lines

--
2.34.1

--
With best wishes
Dmitry

BR,
Hermes

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

Re: [PATCH v4 02/11] drm/bridge: it6505: fix aux operation for edid read

In reply to Hermes Wu

Il 26/09/24 09:47, Hermes Wu ha scritto:

Quoted 15 lines

From: Hermes Wu <[email protected]>

The EDID read operation can reach the maximum size of the AUX FIFO buffer.

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
  drivers/gpu/drm/bridge/ite-it6505.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +0 -0
index 28a8043229d3..b451d3c2ac1d 100644

drivers/gpu/drm/bridge/ite-it6505.c static ssize_t it6505_aux_do_transfer(struct it6505 *it6505, · line 1078

Quoted 1 line
drivers/gpu/drm/bridge/ite-it6505.c +0 -0
@@ -1078,8 +1078,11 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
  	int i, ret_size, ret = 0, request_size;

int fifo_max_sz = (cmd == CMD_AUX_I2C_EDID_READ) ?

		  AUX_FIFO_MAX_SIZE : 4;

which later becomes

int fifo_max_sz = (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) ?

		  AUX_FIFO_MAX_SIZE : 4;

otherwise you can do it "the long way"...

if (cmd == .....)

	fifo_max_sz = AUX_FIFO_MAX_SIZE;
else
	fifo_max_sz = 4;

The point is, cmd won't change during iterations, so it's useless to put that if branch inside of that loop below.

drivers/gpu/drm/bridge/ite-it6505.c static ssize_t it6505_aux_do_transfer(struct it6505 *it6505, · line 1082

Quoted 4 lines
drivers/gpu/drm/bridge/ite-it6505.c +0 -2
  	mutex_lock(&it6505->aux_lock);
-	for (i = 0; i < size; i += 4) {
-		request_size = min((int)size - i, 4);
		request_size = min_t(int, (int)size - i, fifo_max_sz);

P.S.: Also, I'd consider changing this to a do-while instead...

Cheers,
Angelo

Quoted 16 lines
drivers/gpu/drm/bridge/ite-it6505.c +6 -0
+	for (i = 0; i < size; ) {
+		if (cmd == CMD_AUX_I2C_EDID_READ)
+			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
+		else
+			request_size = min_t(int, (int)size - i, 4);
  		ret_size = it6505_aux_operation(it6505, cmd, address + i,
  						buffer + i, request_size,
  						reply);
@@ -1088,6 +1091,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
  			goto aux_op_err;
  		}
 
+		i += request_size;
  		ret += ret_size;
  	}
 
author
#8 lore raw

PATCH v4 3/11 drm/bridge: it6505: add aux operation for HDCP ksv list read

In reply to Hermes Wu

From: Hermes Wu <[email protected]>

Add aux operaction command which supports read DPCD KSV FIFO with aux fifo.

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +8 -4
index b451d3c2ac1d..0583abdca75f 100644
@@ -324,6 +324,9 @@ enum aux_cmd_type {
 	CMD_AUX_NATIVE_READ = 0x0,
 	CMD_AUX_NATIVE_WRITE = 0x5,
 	CMD_AUX_I2C_EDID_READ = 0xB,
+
+	/* KSV list read using AUX native read with FIFO */
+	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
 enum aux_cmd_reply {
@@ -965,7 +968,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 aread */
+	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 */
@@ -1030,7 +1034,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 +1059,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,
@@ -1079,7 +1083,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 
 	mutex_lock(&it6505->aux_lock);
 	for (i = 0; i < size; ) {
-		if (cmd == CMD_AUX_I2C_EDID_READ)
+		if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST)
 			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
 		else
 			request_size = min_t(int, (int)size - i, 4);
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v4 03/11] drm/bridge: it6505: add aux operation for HDCP ksv list read

Quoted 4 lines · Hermes Wu

From: Hermes Wu <[email protected]>

Add aux operaction command which supports read DPCD KSV FIFO with aux fifo.

Nit: AUX, FIFO. Please be consistent in your commit messages.

Quoted 3 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")

Why is this considered to be a fix? From the commit message it sounds like a new feature.

LGTM otherwise

Quoted 59 lines
---
 drivers/gpu/drm/bridge/ite-it6505.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +8 -4
index b451d3c2ac1d..0583abdca75f 100644
@@ -324,6 +324,9 @@ enum aux_cmd_type {
 	CMD_AUX_NATIVE_READ = 0x0,
 	CMD_AUX_NATIVE_WRITE = 0x5,
 	CMD_AUX_I2C_EDID_READ = 0xB,
+
+	/* KSV list read using AUX native read with FIFO */
+	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
 enum aux_cmd_reply {
@@ -965,7 +968,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 aread */
+	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 */
@@ -1030,7 +1034,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 +1059,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,
@@ -1079,7 +1083,7 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
 
 	mutex_lock(&it6505->aux_lock);
 	for (i = 0; i < size; ) {
-		if (cmd == CMD_AUX_I2C_EDID_READ)
+		if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST)
 			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
 		else
 			request_size = min_t(int, (int)size - i, 4);
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
#10 lore raw

RE: [PATCH v4 03/11] drm/bridge: it6505: add aux operation for HDCP ksv list read

Quoted 6 lines · Hermes Wu
Quoted 4 lines

From: Hermes Wu <[email protected]>

Add aux operaction command which supports read DPCD KSV FIFO with aux fifo.

Quoted 7 lines

Nit: AUX, FIFO. Please be consistent in your commit messages.

Quoted 3 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")

Why is this considered to be a fix? From the commit message it sounds like a new feature.

It will be a necessary change for HDCP reads KSV FIFO.

Quoted 53 lines

LGTM otherwise

Quoted 50 lines
---
 drivers/gpu/drm/bridge/ite-it6505.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +5 -1
index b451d3c2ac1d..0583abdca75f 100644
@@ -324,6 +324,9 @@ enum aux_cmd_type {
 	CMD_AUX_NATIVE_READ = 0x0,
 	CMD_AUX_NATIVE_WRITE = 0x5,
 	CMD_AUX_I2C_EDID_READ = 0xB,
+
+	/* KSV list read using AUX native read with FIFO */
+	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
 enum aux_cmd_reply {
@@ -965,7 +968,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 aread */
+	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 */ @@ -1030,7 +1034,7 

@@ static ssize_t it6505_aux_operation(struct it6505 *it6505,

drivers/gpu/drm/bridge/ite-it6505.c +2 -2
 		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 +1059,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, @@ -1079,7 +1083,7 @@ static 

ssize_t it6505_aux_do_transfer(struct it6505 *it6505,

Quoted 15 lines
Quoted 10 lines
drivers/gpu/drm/bridge/ite-it6505.c +1 -2
 	mutex_lock(&it6505->aux_lock);
 	for (i = 0; i < size; ) {
-		if (cmd == CMD_AUX_I2C_EDID_READ)
+		if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST)
 			request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
 		else
 			request_size = min_t(int, (int)size - i, 4);
--

2.34.1

Signature · 2 lines
With best wishes
Dmitry

BR,
Hermes

#11 lore raw

Re: [PATCH v4 03/11] drm/bridge: it6505: add aux operation for HDCP ksv list read

Quoted 11 lines · On Thu, 26 Sept 2024 at 11:46, <[email protected]> wrote:
Quoted 11 lines · Hermes Wu
Quoted 4 lines

From: Hermes Wu <[email protected]>

Add aux operaction command which supports read DPCD KSV FIFO with aux fifo.

Nit: AUX, FIFO. Please be consistent in your commit messages.

Quoted 2 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")

Why is this considered to be a fix? From the commit message it sounds like a new feature.

It will be a necessary change for HDCP reads KSV FIFO.

First of all, it should be a part of the commit message, because the patch itself doesn't fix an issue.
Judging by the amount and the intrusivity of the patches, I'd say that all KSV / HDCP-related patches constitute a new development, rather than a bugfix.

Quoted 74 lines
Quoted 55 lines

LGTM otherwise

Quoted 50 lines
---
 drivers/gpu/drm/bridge/ite-it6505.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +5 -1
index b451d3c2ac1d..0583abdca75f 100644
@@ -324,6 +324,9 @@ enum aux_cmd_type {
     CMD_AUX_NATIVE_READ = 0x0,
     CMD_AUX_NATIVE_WRITE = 0x5,
     CMD_AUX_I2C_EDID_READ = 0xB,
+
+    /* KSV list read using AUX native read with FIFO */
+    CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
 enum aux_cmd_reply {
@@ -965,7 +968,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 aread */
+    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 */ @@ -1030,7 +1034,7

@@ static ssize_t it6505_aux_operation(struct it6505 *it6505,

             goto aux_op_start;
     }
drivers/gpu/drm/bridge/ite-it6505.c +2 -2
-    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 +1059,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, @@ -1079,7 +1083,7 @@ static

ssize_t it6505_aux_do_transfer(struct it6505 *it6505,

Quoted 15 lines
Quoted 10 lines
     mutex_lock(&it6505->aux_lock);
     for (i = 0; i < size; ) {
drivers/gpu/drm/bridge/ite-it6505.c +1 -2
-            if (cmd == CMD_AUX_I2C_EDID_READ)
+            if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST)
                     request_size = min_t(int, (int)size - i, AUX_FIFO_MAX_SIZE);
             else
                     request_size = min_t(int, (int)size - i, 4);
--

2.34.1

--
With best wishes
Dmitry

BR,
Hermes

Signature · 2 lines
With best wishes
Dmitry
author
#12 lore raw

PATCH v4 4/11 drm/bridge: it6505: fix aux command write to aux operaction register

In reply to Hermes Wu

From: Hermes Wu <[email protected]>

The aux control register command is 4 bits LSB only, adding a MACRO to get correct operaction command.

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +3 -1
index 0583abdca75f..d1f5220e04a6 100644
@@ -329,6 +329,8 @@ enum aux_cmd_type {
 	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
+#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
+
 enum aux_cmd_reply {
 	REPLY_ACK,
 	REPLY_NACK,
@@ -1000,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, GET_AUX_CONTROL_CODE(cmd));
 
 	ret = it6505_aux_wait(it6505);
 	if (ret < 0)
Signature · 1 line
2.34.1
#13 lore raw

Re: [PATCH v4 04/11] drm/bridge: it6505: fix aux command write to aux operaction register

Quoted 4 lines · Hermes Wu

From: Hermes Wu <[email protected]>

The aux control register command is 4 bits LSB only, adding a MACRO to get correct operaction command.

Nit: AUX, add (not adding), macro.

What happens if the driver doesn't limit the field? Let me guess, the KSV reading command is 0x10 (it should have been a part of the commit message, BTW), so it overrides some other bits? In such a case this either should be a part of the previous commit, or, at least, come before it.

Quoted 31 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +3 -1
index 0583abdca75f..d1f5220e04a6 100644
@@ -329,6 +329,8 @@ enum aux_cmd_type {
 	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
+#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
+
 enum aux_cmd_reply {
 	REPLY_ACK,
 	REPLY_NACK,
@@ -1000,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, GET_AUX_CONTROL_CODE(cmd));
 
 	ret = it6505_aux_wait(it6505);
 	if (ret < 0)
Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes
Dmitry
#14 lore raw

RE: [PATCH v4 04/11] drm/bridge: it6505: fix aux command write to aux operaction register

Quoted 10 lines · Hermes Wu
Quoted 4 lines

From: Hermes Wu <[email protected]>

The aux control register command is 4 bits LSB only, adding a MACRO to get correct operaction command.

Nit: AUX, add (not adding), macro.

What happens if the driver doesn't limit the field? Let me guess, the KSV reading command is 0x10 (it should have been a part of the commit message, BTW), so it overrides some other bits? In such a case this either should be a part of the previous commit, or, at least, come before it.

Nothing Happens.

The AUX control command at control register REG_AUX_CMD_REQ is 4 bits LSB only, and b[7:4] is ready only. AUX FIFO access cannot reach all DPCD area, only KSV FIFO at DPCD(0x6802C).
The commend define use [7:4] to extend original AUX_NATIVE_READ(0) as AUX_NATIVE_READ with AUX FIFO

It should be a part of previous commit.

Quoted 27 lines
Quoted 27 lines
Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
 drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +3 -1
index 0583abdca75f..d1f5220e04a6 100644
@@ -329,6 +329,8 @@ enum aux_cmd_type {
 	CMD_AUX_GET_KSV_LIST = 0x10,
 };
 
+#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
+
 enum aux_cmd_reply {
 	REPLY_ACK,
 	REPLY_NACK,
@@ -1000,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, GET_AUX_CONTROL_CODE(cmd));
 
Quoted 10 lines
Quoted 5 lines
drivers/gpu/drm/bridge/ite-it6505.c +0 -1
 	ret = it6505_aux_wait(it6505);
 	if (ret < 0)
--

2.34.1

Signature · 2 lines
With best wishes
Dmitry

BR,
Hermes

#15 lore raw

Re: [PATCH v4 04/11] drm/bridge: it6505: fix aux command write to aux operaction register

In reply to Hermes Wu

Il 26/09/24 09:47, Hermes Wu ha scritto:

Quoted 16 lines

From: Hermes Wu <[email protected]>

The aux control register command is 4 bits LSB only, adding a MACRO to get correct operaction command.

Fixes b5c84a9edcd4 ("drm/bridge: add it6505 driver")
---
  drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it6505.c +0 -0
index 0583abdca75f..d1f5220e04a6 100644

drivers/gpu/drm/bridge/ite-it6505.c enum aux_cmd_type { · line 332

Quoted 4 lines
drivers/gpu/drm/bridge/ite-it6505.c +1 -0
@@ -329,6 +329,8 @@ enum aux_cmd_type {
  	CMD_AUX_GET_KSV_LIST = 0x10,
  };
 
+#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)

Just (cmd & 0xf) as the leading zero is meaningless.

As a out-of-scope consideration, though, this driver would really benefit from a conversion to use bitfield macros... would be a nice cleanup.

Cheers,
Angelo

Quoted 13 lines
drivers/gpu/drm/bridge/ite-it6505.c +2 -1
+
  enum aux_cmd_reply {
  	REPLY_ACK,
  	REPLY_NACK,
@@ -1000,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, GET_AUX_CONTROL_CODE(cmd));
 
  	ret = it6505_aux_wait(it6505);
  	if (ret < 0)