drm/bridge: it6505: update dp aux function
Subsystems (3)
cover drm/bridge: it6505: update dp aux function
From: "Hermes.Wu" <[email protected]>
This series change aux function to support MCCS and fix HDCP CTS
Hermes.Wu (1):
drm/bridge: it6505: Add MSSC suport
allen chen (1):
drm/bridge: it6505: HDCP CTS fail on repeater items
drivers/gpu/drm/bridge/ite-it6505.c | 343 +++++++++++++++++++++++----- 1 file changed, 292 insertions(+), 51 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/2 drm/bridge: it6505: HDCP CTS fail on repeater items
From: allen chen <[email protected]>
Fix HDCP CTS items on UNIGRAF DPR-100.
Change-Id: I03f0758779f73164c8ae2fdf61e41dc693e27605
--- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++---------- 1 file changed, 101 insertions(+), 51 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +101 -51
@@ -298,11 +298,11 @@#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 -#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
@@ -326,6 +326,9 @@ enum aux_cmd_type {CMD_AUX_NATIVE_READ =0x0 ,CMD_AUX_NATIVE_WRITE =0x5 ,CMD_AUX_I2C_EDID_READ =0xB , + +/*extend read ncommand */ + CMD_AUX_GET_KSV_LIST = 0x10, }; enum aux_cmd_reply {
@@ -973,7 +976,7 @@ 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 ) { +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 */
@@ -1004,7 +1007,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 , (cmd &0x0F )); ret =it6505_aux_wait (it6505);if (ret <0 )
@@ -1038,7 +1041,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 )
@@ -1063,7 +1066,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,
@@ -1084,18 +1087,25 @@ 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; +struct device *dev = &it6505->client->dev;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 || cmd ==CMD_AUX_GET_KSV_LIST ) + request_size =min ((int )size - i,AUX_FIFO_MAX_SIZE ); +else + request_size =min ((int )size - i,4 ); + ret_size =it6505_aux_operation (it6505, cmd, address + i, buffer + i, request_size, reply); +if (ret_size <0 ) { ret = ret_size; goto aux_op_err; } + i += request_size; ret += ret_size; }
@@ -1186,6 +1196,35 @@ 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) +{ +int i, request_size, ret; +struct device *dev = &it6505->client->dev; +enum aux_cmd_reply reply; + +for (i =0 ; i < len; ) { + request_size =min ((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; + } + +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 ;
@@ -1927,6 +1966,7 @@ static void it6505_hdcp_part1_auth(struct it6505 *it6505)it6505_set_bits (it6505,REG_HDCP_TRIGGER ,HDCP_TRIGGER_START ,HDCP_TRIGGER_START ); + it6505->is_repeater = (hdcp_bcaps &DP_BCAPS_REPEATER_PRESENT ); it6505->hdcp_status =HDCP_AUTH_GOING ; }
@@ -1963,7 +2003,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) {struct device *dev = &it6505->client->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));
@@ -1989,17 +2029,12 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)return 0 ; } -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; + err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); +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 ];
@@ -2027,7 +2062,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) {struct device *dev = &it6505->client->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 ) {
@@ -2037,21 +2072,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)it6505_sha1_digest (it6505, it6505->sha1_input, i, (u8 *)av); - err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +for (retry =0 ; retry <3 ; retry++) { -if (err <0 ) { -dev_err (dev,"Read V' value Fail" ); -return false; - } + err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, +sizeof (bv)); -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; +if (err <0 ) { +dev_err (dev,"Read V' value Fail %d" , retry); +continue ; + } -DRM_DEV_DEBUG_DRIVER (dev,"V' all match!!" ); -return true; +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 ]) +break ; + +DRM_DEV_DEBUG_DRIVER (dev,"V' all match!! %d, %d" , retry, i); +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)
@@ -2059,7 +2101,7 @@ 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->client->dev; -unsigned int timeout =5000 ; +unsigned int timeout =2000 ;u8 bstatus =0 ;bool ksv_list_check;
@@ -2079,21 +2121,18 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)if (timeout ==0 ) {DRM_DEV_DEBUG_DRIVER (dev,"timeout and ksv list wait failed" ); - goto timeout; + goto hdcp_ksvlist_fail; } 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 ); + ksv_list_check ?"pass" :"fail" ); + +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 ); + +hdcp_ksvlist_fail: +it6505_start_hdcp (it6505); }static void it6505_hdcp_work (struct work_struct *work)
@@ -2139,7 +2178,7 @@ static void it6505_hdcp_work(struct work_struct *work)it6505_hdcp_part1_auth (it6505); } -static void it6505_show_hdcp_info (struct it6505 *it6505) +static void it6505_show_hdcp_info (struct it6505 *it6505,bool repeater_info) {struct device *dev = &it6505->client->dev;int i;
@@ -2150,7 +2189,7 @@ static void it6505_show_hdcp_info(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"bksv = 0x%*ph" , (int )ARRAY_SIZE (it6505->bksvs), it6505->bksvs); -if (it6505->is_repeater) { +if ((repeater_info) && (it6505->is_repeater)) {DRM_DEV_DEBUG_DRIVER (dev,"hdcp_down_stream_count: %d" , it6505->hdcp_down_stream_count); DRM_DEV_DEBUG_DRIVER(dev, "sha1_input: 0x%*ph",
@@ -2251,12 +2290,11 @@ static void it6505_link_training_work(struct work_struct *work)if (ret) { it6505->auto_train_retry =AUTO_TRAIN_RETRY ;it6505_link_train_ok (it6505); -return ; }else { it6505->auto_train_retry--; +it6505_dump (it6505); } -it6505_dump (it6505); }static void it6505_plugged_status_to_codec (struct it6505 *it6505)
@@ -2311,14 +2349,22 @@ 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); + +/*1B-02 ignore when bstatus is 0 */ +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);
@@ -2431,7 +2477,7 @@ static void it6505_irq_hdcp_done(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp done interrupt" ); it6505->hdcp_status =HDCP_AUTH_DONE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, false); }static void it6505_irq_hdcp_fail (struct it6505 *it6505)
@@ -2440,7 +2486,7 @@ static void it6505_irq_hdcp_fail(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp fail interrupt" ); it6505->hdcp_status =HDCP_AUTH_IDLE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, true);it6505_start_hdcp (it6505); }
@@ -2455,7 +2501,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505) {struct device *dev = &it6505->client->dev; -DRM_DEV_DEBUG_DRIVER (dev,"HDCP event Interrupt" ); +DRM_DEV_DEBUG_DRIVER (dev,"HDCP repeater R0 event Interrupt" ); + +it6505_set_bits (it6505,REG_HDCP_TRIGGER , +HDCP_TRIGGER_KSV_DONE ,HDCP_TRIGGER_KSV_DONE ); +schedule_work (&it6505->hdcp_wait_ksv_list); }
Signature · 1 line
2.34.1
Re: [PATCH v1 1/2] drm/bridge: it6505: HDCP CTS fail on repeater items
Quoted 3 lines · Hermes Wu
From: allen chen <[email protected]>
Fix HDCP CTS items on UNIGRAF DPR-100.
Fix how? What was broken? Please describe the reasoning for the change. Also if it a fix, please use Fixes tags as required. If you have further questions, see Documentation/process/submitting-patches.rst
Quoted 4 lines
Change-Id: I03f0758779f73164c8ae2fdf61e41dc693e27605
Change-Id: Ib7a8fabaeccd56d3bd7c8adc7384a363b0f7b88d
Please drop Gerrit tags
Quoted 74 lines
Signed-off-by Hermes Wu <[email protected]>--- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++---------- 1 file changed, 101 insertions(+), 51 deletions(-)drivers/gpu/drm/bridge/ite-it6505.c +10
-6@@ -298,11 +298,11 @@#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 -#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@@ -326,6 +326,9 @@ enum aux_cmd_type {CMD_AUX_NATIVE_READ =0x0 ,CMD_AUX_NATIVE_WRITE =0x5 ,CMD_AUX_I2C_EDID_READ =0xB , + +/*extend read ncommand */ + CMD_AUX_GET_KSV_LIST = 0x10, }; enum aux_cmd_reply {@@ -973,7 +976,7 @@ 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 ) { +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 */ @@ -1004,7 +1007,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 , (cmd &0x0F )); ret =it6505_aux_wait (it6505);if (ret <0 )@@ -1038,7 +1041,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 )@@ -1063,7 +1066,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,@@ -1084,18 +1087,25 @@ 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; +struct device *dev = &it6505->client->dev;
drivers/gpu/drm/bridge/ite-it6505.c static ssize_t it6505_aux_do_transfer(struct it6505 *it6505, · line 1098
Quoted 10 lines
drivers/gpu/drm/bridge/ite-it6505.c +6
-2mutex_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 || cmd ==CMD_AUX_GET_KSV_LIST ) + request_size =min ((int )size - i,AUX_FIFO_MAX_SIZE ); +else + request_size =min ((int )size - i,4 ); +
This looks as if this is also fixing the EDID read, so it probably needs a separate commit and a separate description.
Quoted 15 lines
drivers/gpu/drm/bridge/ite-it6505.c +2
-0ret_size =it6505_aux_operation (it6505, cmd, address + i, buffer + i, request_size, reply); +if (ret_size <0 ) { ret = ret_size; goto aux_op_err; } + i += request_size; ret += ret_size; }@@ -1186,6 +1196,35 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,return 0 ;
drivers/gpu/drm/bridge/ite-it6505.c static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block, · line 1206
Quoted 10 lines
drivers/gpu/drm/bridge/ite-it6505.c +8
-0} +static int it6505_get_ksvlist (struct it6505 *it6505,u8 *buf,size_t len) +{ +int i, request_size, ret; +struct device *dev = &it6505->client->dev; +enum aux_cmd_reply reply; + +for (i =0 ; i < len; ) { + request_size =min ((int )len - i,15 );
min_t ?
Quoted 25 lines
drivers/gpu/drm/bridge/ite-it6505.c +21
-0+ + 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; + } + +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 ;
drivers/gpu/drm/bridge/ite-it6505.c static void it6505_hdcp_part1_auth(struct it6505 *it6505) · line 1969
Quoted 4 lines
drivers/gpu/drm/bridge/ite-it6505.c +1
-0@@ -1927,6 +1966,7 @@ static void it6505_hdcp_part1_auth(struct it6505 *it6505)it6505_set_bits (it6505,REG_HDCP_TRIGGER ,HDCP_TRIGGER_START ,HDCP_TRIGGER_START ); + it6505->is_repeater = (hdcp_bcaps &DP_BCAPS_REPEATER_PRESENT );
This looks like a separate change.
Quoted 68 lines
drivers/gpu/drm/bridge/ite-it6505.c +13
-22it6505->hdcp_status =HDCP_AUTH_GOING ; }@@ -1963,7 +2003,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) {struct device *dev = &it6505->client->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));@@ -1989,17 +2029,12 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)return 0 ; } -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; + err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); +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 ];@@ -2027,7 +2062,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) {struct device *dev = &it6505->client->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 ) {@@ -2037,21 +2072,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)it6505_sha1_digest (it6505, it6505->sha1_input, i, (u8 *)av); - err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +for (retry =0 ; retry <3 ; retry++) { -if (err <0 ) { -dev_err (dev,"Read V' value Fail" ); -return false; - } + err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, +sizeof (bv)); -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; +if (err <0 ) { +dev_err (dev,"Read V' value Fail %d" , retry); +continue ; + } -DRM_DEV_DEBUG_DRIVER (dev,"V' all match!!" );
drivers/gpu/drm/bridge/ite-it6505.c static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) · line 2093
Quoted 10 lines
drivers/gpu/drm/bridge/ite-it6505.c +9
-1-return true; +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 ]) +break ; + +DRM_DEV_DEBUG_DRIVER (dev,"V' all match!! %d, %d" , retry, i); +return true; + } + }
And this too. And other chunks are also unrelated.
drivers/gpu/drm/bridge/ite-it6505.c static void it6505_hdcp_wait_ksv_list(struct work_struct *work) · line 2104
Quoted 12 lines
drivers/gpu/drm/bridge/ite-it6505.c +4
-1+ +DRM_DEV_DEBUG_DRIVER (dev,"V' NOT match!! %d" , retry); +return false; }static void it6505_hdcp_wait_ksv_list (struct work_struct *work)@@ -2059,7 +2101,7 @@ 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->client->dev; -unsigned int timeout =5000 ; +unsigned int timeout =2000 ;
And this.
Quoted 123 lines
drivers/gpu/drm/bridge/ite-it6505.c +27
-19u8 bstatus =0 ;bool ksv_list_check;@@ -2079,21 +2121,18 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)if (timeout ==0 ) {DRM_DEV_DEBUG_DRIVER (dev,"timeout and ksv list wait failed" ); - goto timeout; + goto hdcp_ksvlist_fail; } 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 ); + ksv_list_check ?"pass" :"fail" ); + +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 ); + +hdcp_ksvlist_fail: +it6505_start_hdcp (it6505); }static void it6505_hdcp_work (struct work_struct *work)@@ -2139,7 +2178,7 @@ static void it6505_hdcp_work(struct work_struct *work)it6505_hdcp_part1_auth (it6505); } -static void it6505_show_hdcp_info (struct it6505 *it6505) +static void it6505_show_hdcp_info (struct it6505 *it6505,bool repeater_info) {struct device *dev = &it6505->client->dev;int i;@@ -2150,7 +2189,7 @@ static void it6505_show_hdcp_info(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"bksv = 0x%*ph" , (int )ARRAY_SIZE (it6505->bksvs), it6505->bksvs); -if (it6505->is_repeater) { +if ((repeater_info) && (it6505->is_repeater)) {DRM_DEV_DEBUG_DRIVER (dev,"hdcp_down_stream_count: %d" , it6505->hdcp_down_stream_count); DRM_DEV_DEBUG_DRIVER(dev, "sha1_input: 0x%*ph",@@ -2251,12 +2290,11 @@ static void it6505_link_training_work(struct work_struct *work)if (ret) { it6505->auto_train_retry =AUTO_TRAIN_RETRY ;it6505_link_train_ok (it6505); -return ; }else { it6505->auto_train_retry--; +it6505_dump (it6505); } -it6505_dump (it6505); }static void it6505_plugged_status_to_codec (struct it6505 *it6505)@@ -2311,14 +2349,22 @@ 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); + +/*1B-02 ignore when bstatus is 0 */ +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);@@ -2431,7 +2477,7 @@ static void it6505_irq_hdcp_done(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp done interrupt" ); it6505->hdcp_status =HDCP_AUTH_DONE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, false); }static void it6505_irq_hdcp_fail (struct it6505 *it6505)@@ -2440,7 +2486,7 @@ static void it6505_irq_hdcp_fail(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp fail interrupt" ); it6505->hdcp_status =HDCP_AUTH_IDLE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, true);it6505_start_hdcp (it6505); }@@ -2455,7 +2501,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505) {struct device *dev = &it6505->client->dev; -DRM_DEV_DEBUG_DRIVER (dev,"HDCP event Interrupt" ); +DRM_DEV_DEBUG_DRIVER (dev,"HDCP repeater R0 event Interrupt" ); + +it6505_set_bits (it6505,REG_HDCP_TRIGGER , +HDCP_TRIGGER_KSV_DONE ,HDCP_TRIGGER_KSV_DONE ); +schedule_work (&it6505->hdcp_wait_ksv_list); }Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH 2/2 drm/bridge: it6505: Add MSSC suport
In reply to Hermes WuFrom: "Hermes.Wu" <[email protected]>
add AUX-I2C functionality to support MCCS.
--- drivers/gpu/drm/bridge/ite-it6505.c | 209 ++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +200 -9
@@ -127,6 +127,9 @@#define REG_AUX_ADR_16_19 0x26#define REG_AUX_OUT_DATA0 0x27 +#define REG_AUX_I2C_ADR 0x25 +#define REG_AUX_I2C_OP 0x26 +#define REG_AUX_CMD_REQ 0x2B#define AUX_BUSY BIT(5)
@@ -268,6 +271,19 @@#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_TXB 0x190 +#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 +319,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 +343,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 ,/*extend read ncommand */ CMD_AUX_GET_KSV_LIST =0x10 ,
@@ -333,8 +356,11 @@ enum aux_cmd_type {enum aux_cmd_reply {REPLY_ACK , -REPLY_NACK , -REPLY_DEFER , +REPLY_NACK =1 , +REPLY_DEFER =2 , + +REPLY_I2C_NACK =4 , +REPLY_I2C_DEFER =8 , };enum link_train_status {
@@ -1087,7 +1113,6 @@ 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; -struct device *dev = &it6505->client->dev;mutex_lock (&it6505->aux_lock);for (i =0 ; i < size; ) {
@@ -1114,6 +1139,168 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,return ret; } + +static int it6505_aux_i2c_wait (struct it6505 *it6505,u8 *reply) +{ +int err =0 ; +unsigned long timeout; +struct device *dev = &it6505->client->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)); + +if (reply ==NULL ) + goto end_aux_i2c_wait; + + *reply =it6505_read (it6505,REG_AUX_USER_REPLY ) >>4 ; + +if (*reply ==0 ) + goto end_aux_i2c_wait; + +if ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) + err = -EBUSY ; +else if ((*reply ==DP_AUX_NATIVE_REPLY_NACK ) || + (*reply ==DP_AUX_I2C_REPLY_NACK )) + 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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +continue ; + +if (ret >=0 ) +break ; + } + +for (i =0 ; i < size; i++) + buf[i] = (u8 )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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +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 ; +struct device *dev = &it6505->client->dev; +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_I2C_ADR , msg->address <<1 ); + +if (msg->size ==0 ) { +/* IIC Start/STOP dummy write */ +it6505_write (it6505,REG_AUX_I2C_OP , 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 */ +for (data_cnt =0 ; data_cnt < msg->size; ) { + request_size =min (msg->size - data_cnt,AUX_I2C_MAX_SIZE ); +it6505_write (it6505,REG_AUX_I2C_OP , + (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; + } + 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); +int ret; + +mutex_lock (&it6505->aux_lock); + ret =it6505_aux_i2c_operation (it6505, msg); +mutex_unlock (&it6505->aux_lock); +return ret; +} + +static ssize_t it6505_aux_transfer (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg) {
@@ -1125,7 +1312,7 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,/* 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 :
@@ -1153,6 +1340,8 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,case REPLY_DEFER : msg->reply =DP_AUX_NATIVE_REPLY_DEFER ;break ; +default : +break ; }return ret;
@@ -1180,7 +1369,7 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,switch (reply) {case REPLY_ACK :DRM_DEV_DEBUG_DRIVER (dev,"[0x%02x]: %8ph" , offset, - buf + offset); + uf + offset); offset +=8 ; aux_retry =100 ;break ;
@@ -1190,6 +1379,8 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,msleep (20 );if (!(--aux_retry))return -EIO ; +default : +break ; } }
@@ -2031,8 +2222,8 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); -if (err <0 ) -return err; +if (err <0 ) +return err; msg_count += down_stream_count *5 ;
@@ -2075,7 +2266,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)for (retry =0 ; retry <3 ; retry++) { err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +sizeof (bv));if (err <0 ) {dev_err (dev,"Read V' value Fail %d" , retry);
@@ -2126,7 +2317,7 @@ 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" ); + ksv_list_check ?"pass" :"fail" );if (ksv_list_check)return ;
Signature · 1 line
2.34.1
Re: [PATCH v1 2/2] drm/bridge: it6505: Add MSSC suport
Quoted 3 lines · Hermes Wu
From: "Hermes.Wu" <[email protected]>
add AUX-I2C functionality to support MCCS.
Same comment regarding the commit message.
Quoted 2 lines
Change-Id: I63e1a0e5da67526f89f35605a82944be67dee8ac
No Gerrit
Quoted 62 lines
Signed-off-by Hermes Wu <[email protected]>--- drivers/gpu/drm/bridge/ite-it6505.c | 209 ++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 9 deletions(-)drivers/gpu/drm/bridge/ite-it6505.c +23
-0@@ -127,6 +127,9 @@#define REG_AUX_ADR_16_19 0x26#define REG_AUX_OUT_DATA0 0x27 +#define REG_AUX_I2C_ADR 0x25 +#define REG_AUX_I2C_OP 0x26 +#define REG_AUX_CMD_REQ 0x2B#define AUX_BUSY BIT(5)@@ -268,6 +271,19 @@#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_TXB 0x190 +#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 +319,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 +343,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 ,/*extend read ncommand */ CMD_AUX_GET_KSV_LIST =0x10 ,
drivers/gpu/drm/bridge/ite-it6505.c enum aux_cmd_type { · line 360
Quoted 7 lines
drivers/gpu/drm/bridge/ite-it6505.c +2
-2@@ -333,8 +356,11 @@ enum aux_cmd_type {enum aux_cmd_reply {REPLY_ACK , -REPLY_NACK , -REPLY_DEFER , +REPLY_NACK =1 , +REPLY_DEFER =2 ,
These are not changed. Why are you adding someting to it? Is it in fact BIT(n) rather than just values?
drivers/gpu/drm/bridge/ite-it6505.c static ssize_t it6505_aux_do_transfer(struct it6505 *it6505, · line 1090
Quoted 11 lines
drivers/gpu/drm/bridge/ite-it6505.c +3
-1+ +REPLY_I2C_NACK =4 , + REPLY_I2C_DEFER = 8, }; enum link_train_status {@@ -1087,7 +1113,6 @@ 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; -struct device *dev = &it6505->client->dev;
unrelated.
Quoted 182 lines
drivers/gpu/drm/bridge/ite-it6505.c +163
-1mutex_lock (&it6505->aux_lock);for (i =0 ; i < size; ) {@@ -1114,6 +1139,168 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,return ret; } + +static int it6505_aux_i2c_wait (struct it6505 *it6505,u8 *reply) +{ +int err =0 ; +unsigned long timeout; +struct device *dev = &it6505->client->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)); + +if (reply ==NULL ) + goto end_aux_i2c_wait; + + *reply =it6505_read (it6505,REG_AUX_USER_REPLY ) >>4 ; + +if (*reply ==0 ) + goto end_aux_i2c_wait; + +if ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) + err = -EBUSY ; +else if ((*reply ==DP_AUX_NATIVE_REPLY_NACK ) || + (*reply ==DP_AUX_I2C_REPLY_NACK )) + 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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +continue ; + +if (ret >=0 ) +break ; + } + +for (i =0 ; i < size; i++) + buf[i] = (u8 )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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +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 ; +struct device *dev = &it6505->client->dev; +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_I2C_ADR , msg->address <<1 ); + +if (msg->size ==0 ) { +/* IIC Start/STOP dummy write */ +it6505_write (it6505,REG_AUX_I2C_OP , 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 */ +for (data_cnt =0 ; data_cnt < msg->size; ) { + request_size =min (msg->size - data_cnt,AUX_I2C_MAX_SIZE ); +it6505_write (it6505,REG_AUX_I2C_OP , + (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; + } + 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); +int ret; + +mutex_lock (&it6505->aux_lock); + ret =it6505_aux_i2c_operation (it6505, msg); +mutex_unlock (&it6505->aux_lock); +return ret; +} + +static ssize_t it6505_aux_transfer (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg) {@@ -1125,7 +1312,7 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,/* 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 :
drivers/gpu/drm/bridge/ite-it6505.c static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux, · line 1344
Quoted 5 lines
drivers/gpu/drm/bridge/ite-it6505.c +2
-0@@ -1153,6 +1340,8 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,case REPLY_DEFER : msg->reply =DP_AUX_NATIVE_REPLY_DEFER ;break ; +default : +break ;
why?
drivers/gpu/drm/bridge/ite-it6505.c static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block, · line 1372
Quoted 9 lines
drivers/gpu/drm/bridge/ite-it6505.c +1
-1}return ret;@@ -1180,7 +1369,7 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,switch (reply) {case REPLY_ACK :DRM_DEV_DEBUG_DRIVER (dev,"[0x%02x]: %8ph" , offset, - buf + offset); + uf + offset);
This won't even compile.
Quoted 13 lines
drivers/gpu/drm/bridge/ite-it6505.c +2
-0offset +=8 ; aux_retry =100 ;break ;@@ -1190,6 +1379,8 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,msleep (20 );if (!(--aux_retry))return -EIO ; +default : +break ; } }
drivers/gpu/drm/bridge/ite-it6505.c static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) · line 2226
Quoted 7 lines
drivers/gpu/drm/bridge/ite-it6505.c +2
-2@@ -2031,8 +2222,8 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); -if (err <0 ) -return err; +if (err <0 ) +return err;
Don't randomly change the alignment (especially in the incorrect way).
drivers/gpu/drm/bridge/ite-it6505.c static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) · line 2269
Quoted 9 lines
drivers/gpu/drm/bridge/ite-it6505.c +1
-1msg_count += down_stream_count *5 ;@@ -2075,7 +2266,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)for (retry =0 ; retry <3 ; retry++) { err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +sizeof (bv));
Again.
drivers/gpu/drm/bridge/ite-it6505.c static void it6505_hdcp_wait_ksv_list(struct work_struct *work) · line 2320
Quoted 9 lines
drivers/gpu/drm/bridge/ite-it6505.c +1
-1if (err <0 ) {dev_err (dev,"Read V' value Fail %d" , retry);@@ -2126,7 +2317,7 @@ 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" ); + ksv_list_check ?"pass" :"fail" );
and again.
Please review your patches before submitting them.
Quoted 6 lines
drivers/gpu/drm/bridge/ite-it6505.c +0
-0if (ksv_list_check)return ;Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH v2 1/2 drm/bridge: it6505: HDCP CTS fail on repeater
In reply to Hermes WuFrom: Hermes Wu <[email protected]>
Fix HDCP CTS items on UNIGRAF DPR-100
--- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++---------- 1 file changed, 101 insertions(+), 51 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +101 -51
@@ -298,11 +298,11 @@#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 -#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
@@ -326,6 +326,9 @@ enum aux_cmd_type {CMD_AUX_NATIVE_READ =0x0 ,CMD_AUX_NATIVE_WRITE =0x5 ,CMD_AUX_I2C_EDID_READ =0xB , + +/*extend read ncommand */ + CMD_AUX_GET_KSV_LIST = 0x10, }; enum aux_cmd_reply {
@@ -973,7 +976,7 @@ 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 ) { +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 */
@@ -1004,7 +1007,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 , (cmd &0x0F )); ret =it6505_aux_wait (it6505);if (ret <0 )
@@ -1038,7 +1041,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 )
@@ -1063,7 +1066,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,
@@ -1084,18 +1087,25 @@ 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; +struct device *dev = &it6505->client->dev;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 || cmd ==CMD_AUX_GET_KSV_LIST ) + request_size =min ((int )size - i,AUX_FIFO_MAX_SIZE ); +else + request_size =min ((int )size - i,4 ); + ret_size =it6505_aux_operation (it6505, cmd, address + i, buffer + i, request_size, reply); +if (ret_size <0 ) { ret = ret_size; goto aux_op_err; } + i += request_size; ret += ret_size; }
@@ -1186,6 +1196,35 @@ 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) +{ +int i, request_size, ret; +struct device *dev = &it6505->client->dev; +enum aux_cmd_reply reply; + +for (i =0 ; i < len; ) { + request_size =min ((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; + } + +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 ;
@@ -1927,6 +1966,7 @@ static void it6505_hdcp_part1_auth(struct it6505 *it6505)it6505_set_bits (it6505,REG_HDCP_TRIGGER ,HDCP_TRIGGER_START ,HDCP_TRIGGER_START ); + it6505->is_repeater = (hdcp_bcaps &DP_BCAPS_REPEATER_PRESENT ); it6505->hdcp_status =HDCP_AUTH_GOING ; }
@@ -1963,7 +2003,7 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) {struct device *dev = &it6505->client->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));
@@ -1989,17 +2029,12 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)return 0 ; } -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; + err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); +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 ];
@@ -2027,7 +2062,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505) {struct device *dev = &it6505->client->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 ) {
@@ -2037,21 +2072,28 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)it6505_sha1_digest (it6505, it6505->sha1_input, i, (u8 *)av); - err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +for (retry =0 ; retry <3 ; retry++) { -if (err <0 ) { -dev_err (dev,"Read V' value Fail" ); -return false; - } + err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, +sizeof (bv)); -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; +if (err <0 ) { +dev_err (dev,"Read V' value Fail %d" , retry); +continue ; + } -DRM_DEV_DEBUG_DRIVER (dev,"V' all match!!" ); -return true; +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 ]) +break ; + +DRM_DEV_DEBUG_DRIVER (dev,"V' all match!! %d, %d" , retry, i); +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)
@@ -2059,7 +2101,7 @@ 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->client->dev; -unsigned int timeout =5000 ; +unsigned int timeout =2000 ;u8 bstatus =0 ;bool ksv_list_check;
@@ -2079,21 +2121,18 @@ static void it6505_hdcp_wait_ksv_list(struct work_struct *work)if (timeout ==0 ) {DRM_DEV_DEBUG_DRIVER (dev,"timeout and ksv list wait failed" ); - goto timeout; + goto hdcp_ksvlist_fail; } 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 ); + ksv_list_check ?"pass" :"fail" ); + +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 ); + +hdcp_ksvlist_fail: +it6505_start_hdcp (it6505); }static void it6505_hdcp_work (struct work_struct *work)
@@ -2139,7 +2178,7 @@ static void it6505_hdcp_work(struct work_struct *work)it6505_hdcp_part1_auth (it6505); } -static void it6505_show_hdcp_info (struct it6505 *it6505) +static void it6505_show_hdcp_info (struct it6505 *it6505,bool repeater_info) {struct device *dev = &it6505->client->dev;int i;
@@ -2150,7 +2189,7 @@ static void it6505_show_hdcp_info(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"bksv = 0x%*ph" , (int )ARRAY_SIZE (it6505->bksvs), it6505->bksvs); -if (it6505->is_repeater) { +if ((repeater_info) && (it6505->is_repeater)) {DRM_DEV_DEBUG_DRIVER (dev,"hdcp_down_stream_count: %d" , it6505->hdcp_down_stream_count); DRM_DEV_DEBUG_DRIVER(dev, "sha1_input: 0x%*ph",
@@ -2251,12 +2290,11 @@ static void it6505_link_training_work(struct work_struct *work)if (ret) { it6505->auto_train_retry =AUTO_TRAIN_RETRY ;it6505_link_train_ok (it6505); -return ; }else { it6505->auto_train_retry--; +it6505_dump (it6505); } -it6505_dump (it6505); }static void it6505_plugged_status_to_codec (struct it6505 *it6505)
@@ -2311,14 +2349,22 @@ 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); + +/*1B-02 ignore when bstatus is 0 */ +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);
@@ -2431,7 +2477,7 @@ static void it6505_irq_hdcp_done(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp done interrupt" ); it6505->hdcp_status =HDCP_AUTH_DONE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, false); }static void it6505_irq_hdcp_fail (struct it6505 *it6505)
@@ -2440,7 +2486,7 @@ static void it6505_irq_hdcp_fail(struct it6505 *it6505)DRM_DEV_DEBUG_DRIVER (dev,"hdcp fail interrupt" ); it6505->hdcp_status =HDCP_AUTH_IDLE ; -it6505_show_hdcp_info (it6505); +it6505_show_hdcp_info (it6505, true);it6505_start_hdcp (it6505); }
@@ -2455,7 +2501,11 @@ static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505) {struct device *dev = &it6505->client->dev; -DRM_DEV_DEBUG_DRIVER (dev,"HDCP event Interrupt" ); +DRM_DEV_DEBUG_DRIVER (dev,"HDCP repeater R0 event Interrupt" ); + +it6505_set_bits (it6505,REG_HDCP_TRIGGER , +HDCP_TRIGGER_KSV_DONE ,HDCP_TRIGGER_KSV_DONE ); +schedule_work (&it6505->hdcp_wait_ksv_list); }
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] drm/bridge: it6505: HDCP CTS fail on repeater
Quoted 5 lines · Hermes Wu
From: Hermes Wu <[email protected]>
Fix HDCP CTS items on UNIGRAF DPR-100
Signed-off-by Hermes Wu <[email protected]>
All my comments from v1 (except for the Changes-Id trailers) seem to apply as well.
Quoted 3 lines
--- drivers/gpu/drm/bridge/ite-it6505.c | 152 ++++++++++++++++++---------- 1 file changed, 101 insertions(+), 51 deletions(-)
Signature · 2 lines
With best wishes Dmitry
v2 cover drm/bridge: it6505: update dp aux function
In reply to Hermes WuFrom: Hermes Wu <[email protected]>
This series change aux function to support MCCS and fix HDCP CTS
Hermes Wu (2):
drm/bridge: it6505: HDCP CTS fail on repeater
drm/bridge: it6505: Add MCCS support
drivers/gpu/drm/bridge/ite-it6505.c | 343 +++++++++++++++++++++++----- 1 file changed, 292 insertions(+), 51 deletions(-)
Signature · 1 line
2.34.1
Quoted 3 lines · Hermes Wu
From: Hermes Wu <[email protected]>
This series change aux function to support MCCS and fix HDCP CTS
It is v2, but where is the changelog?
Also please give reviewers some time and don't next revisions too quickly.
Last, but not least, new series = new thread. Don't send new revisions as a response to the previous one.
Quoted 11 lines
Hermes Wu (2):
drm/bridge: it6505: HDCP CTS fail on repeater
drm/bridge: it6505: Add MCCS supportdrivers/gpu/drm/bridge/ite-it6505.c | 343 +++++++++++++++++++++++----- 1 file changed, 292 insertions(+), 51 deletions(-)Signature · 1 line
2.34.1
Signature · 2 lines
With best wishes Dmitry
PATCH v2 2/2 drm/bridge: it6505: Add MSSC suport
In reply to Hermes WuFrom: "Hermes.Wu" <[email protected]>
Add AUX i2c funtion for MCCS
--- drivers/gpu/drm/bridge/ite-it6505.c | 209 ++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +200 -9
@@ -127,6 +127,9 @@#define REG_AUX_ADR_16_19 0x26#define REG_AUX_OUT_DATA0 0x27 +#define REG_AUX_I2C_ADR 0x25 +#define REG_AUX_I2C_OP 0x26 +#define REG_AUX_CMD_REQ 0x2B#define AUX_BUSY BIT(5)
@@ -268,6 +271,19 @@#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_TXB 0x190 +#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 +319,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 +343,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 ,/*extend read ncommand */ CMD_AUX_GET_KSV_LIST =0x10 ,
@@ -333,8 +356,11 @@ enum aux_cmd_type {enum aux_cmd_reply {REPLY_ACK , -REPLY_NACK , -REPLY_DEFER , +REPLY_NACK =1 , +REPLY_DEFER =2 , + +REPLY_I2C_NACK =4 , +REPLY_I2C_DEFER =8 , };enum link_train_status {
@@ -1087,7 +1113,6 @@ 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; -struct device *dev = &it6505->client->dev;mutex_lock (&it6505->aux_lock);for (i =0 ; i < size; ) {
@@ -1114,6 +1139,168 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,return ret; } + +static int it6505_aux_i2c_wait (struct it6505 *it6505,u8 *reply) +{ +int err =0 ; +unsigned long timeout; +struct device *dev = &it6505->client->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)); + +if (reply ==NULL ) + goto end_aux_i2c_wait; + + *reply =it6505_read (it6505,REG_AUX_USER_REPLY ) >>4 ; + +if (*reply ==0 ) + goto end_aux_i2c_wait; + +if ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) + err = -EBUSY ; +else if ((*reply ==DP_AUX_NATIVE_REPLY_NACK ) || + (*reply ==DP_AUX_I2C_REPLY_NACK )) + 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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +continue ; + +if (ret >=0 ) +break ; + } + +for (i =0 ; i < size; i++) + buf[i] = (u8 )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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +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 ; +struct device *dev = &it6505->client->dev; +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_I2C_ADR , msg->address <<1 ); + +if (msg->size ==0 ) { +/* IIC Start/STOP dummy write */ +it6505_write (it6505,REG_AUX_I2C_OP , 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 */ +for (data_cnt =0 ; data_cnt < msg->size; ) { + request_size =min (msg->size - data_cnt,AUX_I2C_MAX_SIZE ); +it6505_write (it6505,REG_AUX_I2C_OP , + (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; + } + 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); +int ret; + +mutex_lock (&it6505->aux_lock); + ret =it6505_aux_i2c_operation (it6505, msg); +mutex_unlock (&it6505->aux_lock); +return ret; +} + +static ssize_t it6505_aux_transfer (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg) {
@@ -1125,7 +1312,7 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,/* 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 :
@@ -1153,6 +1340,8 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,case REPLY_DEFER : msg->reply =DP_AUX_NATIVE_REPLY_DEFER ;break ; +default : +break ; }return ret;
@@ -1180,7 +1369,7 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,switch (reply) {case REPLY_ACK :DRM_DEV_DEBUG_DRIVER (dev,"[0x%02x]: %8ph" , offset, - buf + offset); + uf + offset); offset +=8 ; aux_retry =100 ;break ;
@@ -1190,6 +1379,8 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,msleep (20 );if (!(--aux_retry))return -EIO ; +default : +break ; } }
@@ -2031,8 +2222,8 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); -if (err <0 ) -return err; +if (err <0 ) +return err; msg_count += down_stream_count *5 ;
@@ -2075,7 +2266,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)for (retry =0 ; retry <3 ; retry++) { err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +sizeof (bv));if (err <0 ) {dev_err (dev,"Read V' value Fail %d" , retry);
@@ -2126,7 +2317,7 @@ 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" ); + ksv_list_check ?"pass" :"fail" );if (ksv_list_check)return ;
Signature · 1 line
2.34.1
PATCH v2 2/2 drm/bridge: it6505: Add MCCS support
In reply to Hermes WuFrom: Hermes Wu <[email protected]>
add AUX-I2C functionality to support MCCS
--- drivers/gpu/drm/bridge/ite-it6505.c | 209 ++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/ite-it6505.c +200 -9
@@ -127,6 +127,9 @@#define REG_AUX_ADR_16_19 0x26#define REG_AUX_OUT_DATA0 0x27 +#define REG_AUX_I2C_ADR 0x25 +#define REG_AUX_I2C_OP 0x26 +#define REG_AUX_CMD_REQ 0x2B#define AUX_BUSY BIT(5)
@@ -268,6 +271,19 @@#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_TXB 0x190 +#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 +319,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 +343,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 ,/*extend read ncommand */ CMD_AUX_GET_KSV_LIST =0x10 ,
@@ -333,8 +356,11 @@ enum aux_cmd_type {enum aux_cmd_reply {REPLY_ACK , -REPLY_NACK , -REPLY_DEFER , +REPLY_NACK =1 , +REPLY_DEFER =2 , + +REPLY_I2C_NACK =4 , +REPLY_I2C_DEFER =8 , };enum link_train_status {
@@ -1087,7 +1113,6 @@ 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; -struct device *dev = &it6505->client->dev;mutex_lock (&it6505->aux_lock);for (i =0 ; i < size; ) {
@@ -1114,6 +1139,168 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,return ret; } + +static int it6505_aux_i2c_wait (struct it6505 *it6505,u8 *reply) +{ +int err =0 ; +unsigned long timeout; +struct device *dev = &it6505->client->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)); + +if (reply ==NULL ) + goto end_aux_i2c_wait; + + *reply =it6505_read (it6505,REG_AUX_USER_REPLY ) >>4 ; + +if (*reply ==0 ) + goto end_aux_i2c_wait; + +if ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) + err = -EBUSY ; +else if ((*reply ==DP_AUX_NATIVE_REPLY_NACK ) || + (*reply ==DP_AUX_I2C_REPLY_NACK )) + 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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +continue ; + +if (ret >=0 ) +break ; + } + +for (i =0 ; i < size; i++) + buf[i] = (u8 )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 =0 ; + +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 ((*reply ==DP_AUX_NATIVE_REPLY_DEFER ) || + (*reply ==DP_AUX_I2C_REPLY_DEFER )) +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 ; +struct device *dev = &it6505->client->dev; +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_I2C_ADR , msg->address <<1 ); + +if (msg->size ==0 ) { +/* IIC Start/STOP dummy write */ +it6505_write (it6505,REG_AUX_I2C_OP , 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 */ +for (data_cnt =0 ; data_cnt < msg->size; ) { + request_size =min (msg->size - data_cnt,AUX_I2C_MAX_SIZE ); +it6505_write (it6505,REG_AUX_I2C_OP , + (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; + } + 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); +int ret; + +mutex_lock (&it6505->aux_lock); + ret =it6505_aux_i2c_operation (it6505, msg); +mutex_unlock (&it6505->aux_lock); +return ret; +} + +static ssize_t it6505_aux_transfer (struct drm_dp_aux *aux,struct drm_dp_aux_msg *msg) {
@@ -1125,7 +1312,7 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,/* 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 :
@@ -1153,6 +1340,8 @@ static ssize_t it6505_aux_transfer(struct drm_dp_aux *aux,case REPLY_DEFER : msg->reply =DP_AUX_NATIVE_REPLY_DEFER ;break ; +default : +break ; }return ret;
@@ -1180,7 +1369,7 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,switch (reply) {case REPLY_ACK :DRM_DEV_DEBUG_DRIVER (dev,"[0x%02x]: %8ph" , offset, - buf + offset); + uf + offset); offset +=8 ; aux_retry =100 ;break ;
@@ -1190,6 +1379,8 @@ static int it6505_get_edid_block(void *data, u8 *buf, unsigned int block,msleep (20 );if (!(--aux_retry))return -EIO ; +default : +break ; } }
@@ -2031,8 +2222,8 @@ static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input) err =it6505_get_ksvlist (it6505, sha1_input, down_stream_count *5 ); -if (err <0 ) -return err; +if (err <0 ) +return err; msg_count += down_stream_count *5 ;
@@ -2075,7 +2266,7 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)for (retry =0 ; retry <3 ; retry++) { err =it6505_get_dpcd (it6505,DP_AUX_HDCP_V_PRIME (0 ), (u8 *)bv, -sizeof (bv)); +sizeof (bv));if (err <0 ) {dev_err (dev,"Read V' value Fail %d" , retry);
@@ -2126,7 +2317,7 @@ 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" ); + ksv_list_check ?"pass" :"fail" );if (ksv_list_check)return ;
Signature · 1 line
2.34.1
Re: [PATCH v2 2/2] drm/bridge: it6505: Add MCCS support
Quoted 9 lines · Hermes Wu
From: Hermes Wu <[email protected]>
add AUX-I2C functionality to support MCCS
Signed-off-by Hermes Wu <[email protected]>--- drivers/gpu/drm/bridge/ite-it6505.c | 209 ++++++++++++++++++++++++++-- 1 file changed, 200 insertions(+), 9 deletions(-)
All my comments from v1 (except for the Changes-Id trailers) seem to apply as well.
Signature · 2 lines
With best wishes Dmitry