diff mbox series

[v3,2/3] drm/bridge: it6505: HDCP CTS fail on repeater items

Message ID 20240923094826.13471-3-Hermes.Wu@ite.com.tw (mailing list archive)
State New, archived
Headers show
Series drm/bridge: it6505: update dp aux funxtion | expand

Commit Message

Hermes Wu Sept. 23, 2024, 9:48 a.m. UTC
From: Hermes Wu <Hermes.wu@ite.com.tw>

Changes in v3:
 -add detials about fail item and changes.


Fix HDCP CTS fail items on UNIGRAF DRP-100

DUT must Support 127 devices.
DUT must check BSTATUS when recive CP_IRQ.
DUT must enable encription when R0' is ready.
DUT must retry V' check 3 times.
it6505 must read DRP-100 KSV FIFO by FIFO mode.
it6505 should restart HDCP within 5s if KSV not ready.

Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
 drivers/gpu/drm/bridge/ite-it6505.c | 112 ++++++++++++++++++----------
 1 file changed, 74 insertions(+), 38 deletions(-)

Comments

Dmitry Baryshkov Sept. 23, 2024, 10:14 a.m. UTC | #1
On Mon, Sep 23, 2024 at 05:48:28PM GMT, Hermes Wu wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
> 
> Changes in v3:
>  -add detials about fail item and changes.
> 
> 
> Fix HDCP CTS fail items on UNIGRAF DRP-100
> 
> DUT must Support 127 devices.
> DUT must check BSTATUS when recive CP_IRQ.
> DUT must enable encription when R0' is ready.
> DUT must retry V' check 3 times.
> it6505 must read DRP-100 KSV FIFO by FIFO mode.
> it6505 should restart HDCP within 5s if KSV not ready.

Still not readable.

English text, please. Split the patch to fix one issue at a time.
Describe the _reason_ for the change. Annotate fixes with Fixes tags.

> 
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
>  drivers/gpu/drm/bridge/ite-it6505.c | 112 ++++++++++++++++++----------
>  1 file changed, 74 insertions(+), 38 deletions(-)
Hermes Wu Sept. 23, 2024, 10:45 a.m. UTC | #2
>On Mon, Sep 23, 2024 at 05:48:28PM GMT, Hermes Wu wrote:
>> From: Hermes Wu <Hermes.wu@ite.com.tw>
>> 
>> Changes in v3:
>>  -add detials about fail item and changes.
>> 
>> 
>> Fix HDCP CTS fail items on UNIGRAF DRP-100
>> 
>> DUT must Support 127 devices.
>> DUT must check BSTATUS when receive CP_IRQ.
>> DUT must enable encryption when R0' is ready.
>> DUT must retry V' check 3 times.
>> it6505 must read DRP-100 KSV FIFO by FIFO mode.
>> it6505 should restart HDCP within 5s if KSV not ready.
>
>Still not readable.
>
>English text, please. Split the patch to fix one issue at a time.
>Describe the _reason_ for the change. Annotate fixes with Fixes tags.
>

with fixes tag include drm/bridge like this ?  => "Fixes: drm/bridge: it6505: HDCP CTS fail 1B-xx"

About the reason about bug fixes. 

for example, the 1B-01 device count.
will this readable?

" When connect to HDCP repeater, it6505 must support 127 downstream devices. "

And this will be only one change in a patch?

>> 
>> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
>> ---
>>  drivers/gpu/drm/bridge/ite-it6505.c | 112 ++++++++++++++++++----------
>>  1 file changed, 74 insertions(+), 38 deletions(-)
>
>-- 
>With best wishes
>Dmitry

BR,
Hermes
Dmitry Baryshkov Sept. 23, 2024, 11:49 a.m. UTC | #3
On Mon, Sep 23, 2024 at 10:45:49AM GMT, Hermes.Wu@ite.com.tw wrote:
> >On Mon, Sep 23, 2024 at 05:48:28PM GMT, Hermes Wu wrote:
> >> From: Hermes Wu <Hermes.wu@ite.com.tw>
> >> 
> >> Changes in v3:
> >>  -add detials about fail item and changes.
> >> 
> >> 
> >> Fix HDCP CTS fail items on UNIGRAF DRP-100
> >> 
> >> DUT must Support 127 devices.
> >> DUT must check BSTATUS when receive CP_IRQ.
> >> DUT must enable encryption when R0' is ready.
> >> DUT must retry V' check 3 times.
> >> it6505 must read DRP-100 KSV FIFO by FIFO mode.
> >> it6505 should restart HDCP within 5s if KSV not ready.
> >
> >Still not readable.
> >
> >English text, please. Split the patch to fix one issue at a time.
> >Describe the _reason_ for the change. Annotate fixes with Fixes tags.
> >
> 
> with fixes tag include drm/bridge like this ?  => "Fixes: drm/bridge: it6505: HDCP CTS fail 1B-xx"

No. Please read the document that I have been pointing you to. It
describes all the tags and procedures.

> 
> About the reason about bug fixes. 
> 
> for example, the 1B-01 device count.
> will this readable?
> 
> " When connect to HDCP repeater, it6505 must support 127 downstream devices. "
> 
> And this will be only one change in a patch?

Let me repeat the phrase that you have quoted few lines above. "Split
the patch to fix one issue at a time." So, no, this will not be the only
change in the patch.

> 
> >> 
> >> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> >> ---
> >>  drivers/gpu/drm/bridge/ite-it6505.c | 112 ++++++++++++++++++----------
> >>  1 file changed, 74 insertions(+), 38 deletions(-)
> >
> >-- 
> >With best wishes
> >Dmitry
> 
> BR,
> Hermes
Hermes Wu Sept. 24, 2024, 2:57 a.m. UTC | #4
>On Mon, Sep 23, 2024 at 10:45:49AM GMT, Hermes.Wu@ite.com.tw wrote:
>> >On Mon, Sep 23, 2024 at 05:48:28PM GMT, Hermes Wu wrote:
>> >> From: Hermes Wu <Hermes.wu@ite.com.tw>
>> >> 
>> >> Changes in v3:
>> >>  -add detials about fail item and changes.
>> >> 
>> >> 
>> >> Fix HDCP CTS fail items on UNIGRAF DRP-100
>> >> 
>> >> DUT must Support 127 devices.
>> >> DUT must check BSTATUS when receive CP_IRQ.
>> >> DUT must enable encryption when R0' is ready.
>> >> DUT must retry V' check 3 times.
>> >> it6505 must read DRP-100 KSV FIFO by FIFO mode.
>> >> it6505 should restart HDCP within 5s if KSV not ready.
>> >
>> >Still not readable.
>> >
>> >English text, please. Split the patch to fix one issue at a time.
>> >Describe the _reason_ for the change. Annotate fixes with Fixes tags.
>> >
>> 
>> with fixes tag include drm/bridge like this ?  => "Fixes: drm/bridge: it6505: HDCP CTS fail 1B-xx"
>
>No. Please read the document that I have been pointing you to. It describes all the tags and procedures.
>
>> 
>> About the reason about bug fixes. 
>> 
>> for example, the 1B-01 device count.
>> will this readable?
>> 
>> " When connect to HDCP repeater, it6505 must support 127 downstream devices. "
>> 
>> And this will be only one change in a patch?
>
>Let me repeat the phrase that you have quoted few lines above. "Split the patch to fix one issue at a time." So, no, this will not be the only change in the patch.
>

The HDCP CTS include serval items, I should split each failure item fixes into different patch?


>> 
>> >> 
>> >> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
>> >> ---
>> >>  drivers/gpu/drm/bridge/ite-it6505.c | 112 
>> >> ++++++++++++++++++----------
>> >>  1 file changed, 74 insertions(+), 38 deletions(-)
>> >
>> >--
>> >With best wishes
>> >Dmitry
>> 
>> BR,
>> Hermes
>
>--
>With best wishes
>Dmitry
Pin-yen Lin Sept. 24, 2024, 2:59 a.m. UTC | #5
On Tue, Sep 24, 2024 at 10:57 AM <Hermes.Wu@ite.com.tw> wrote:
>
> >On Mon, Sep 23, 2024 at 10:45:49AM GMT, Hermes.Wu@ite.com.tw wrote:
> >> >On Mon, Sep 23, 2024 at 05:48:28PM GMT, Hermes Wu wrote:
> >> >> From: Hermes Wu <Hermes.wu@ite.com.tw>
> >> >>
> >> >> Changes in v3:
> >> >>  -add detials about fail item and changes.
> >> >>
> >> >>
> >> >> Fix HDCP CTS fail items on UNIGRAF DRP-100
> >> >>
> >> >> DUT must Support 127 devices.
> >> >> DUT must check BSTATUS when receive CP_IRQ.
> >> >> DUT must enable encryption when R0' is ready.
> >> >> DUT must retry V' check 3 times.
> >> >> it6505 must read DRP-100 KSV FIFO by FIFO mode.
> >> >> it6505 should restart HDCP within 5s if KSV not ready.
> >> >
> >> >Still not readable.
> >> >
> >> >English text, please. Split the patch to fix one issue at a time.
> >> >Describe the _reason_ for the change. Annotate fixes with Fixes tags.
> >> >
> >>
> >> with fixes tag include drm/bridge like this ?  => "Fixes: drm/bridge: it6505: HDCP CTS fail 1B-xx"
> >
> >No. Please read the document that I have been pointing you to. It describes all the tags and procedures.
> >
> >>
> >> About the reason about bug fixes.
> >>
> >> for example, the 1B-01 device count.
> >> will this readable?
> >>
> >> " When connect to HDCP repeater, it6505 must support 127 downstream devices. "
> >>
> >> And this will be only one change in a patch?
> >
> >Let me repeat the phrase that you have quoted few lines above. "Split the patch to fix one issue at a time." So, no, this will not be the only change in the patch.
> >
>
> The HDCP CTS include serval items, I should split each failure item fixes into different patch?

Yes, please. You can mention in the cover letter that those patches
are fixing HDCP CTS failures, but please fix one issue at a time and
explain what it fixes in the commit message.
>
>
> >>
> >> >>
> >> >> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> >> >> ---
> >> >>  drivers/gpu/drm/bridge/ite-it6505.c | 112
> >> >> ++++++++++++++++++----------
> >> >>  1 file changed, 74 insertions(+), 38 deletions(-)
> >> >
> >> >--
> >> >With best wishes
> >> >Dmitry
> >>
> >> BR,
> >> Hermes
> >
> >--
> >With best wishes
> >Dmitry

Regards,
Pin-yen
kernel test robot Sept. 24, 2024, 11:01 a.m. UTC | #6
Hi Hermes,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.11 next-20240923]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hermes-Wu/drm-bridge-it6505-fix-AUX-read-use-aux-fifo/20240923-175041
base:   git://anongit.freedesktop.org/drm/drm drm-next
patch link:    https://lore.kernel.org/r/20240923094826.13471-3-Hermes.Wu%40ite.com.tw
patch subject: [PATCH v3 2/3] drm/bridge: it6505: HDCP CTS fail on repeater items
config: nios2-randconfig-r073-20240924 (https://download.01.org/0day-ci/archive/20240924/202409241856.OWgR1x3Y-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 14.1.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409241856.OWgR1x3Y-lkp@intel.com/

smatch warnings:
drivers/gpu/drm/bridge/ite-it6505.c:2027 it6505_setup_sha1_input() warn: inconsistent indenting

vim +2027 drivers/gpu/drm/bridge/ite-it6505.c

b5c84a9edcd418 Allen Chen  2022-01-14  1996  
b5c84a9edcd418 Allen Chen  2022-01-14  1997  static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
b5c84a9edcd418 Allen Chen  2022-01-14  1998  {
d65feac281ab47 Pin-yen Lin 2023-07-18  1999  	struct device *dev = it6505->dev;
b5c84a9edcd418 Allen Chen  2022-01-14  2000  	u8 binfo[2];
9665163df60e16 Hermes Wu   2024-09-23  2001  	int down_stream_count, err, msg_count = 0;
b5c84a9edcd418 Allen Chen  2022-01-14  2002  
b5c84a9edcd418 Allen Chen  2022-01-14  2003  	err = it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo,
b5c84a9edcd418 Allen Chen  2022-01-14  2004  			      ARRAY_SIZE(binfo));
b5c84a9edcd418 Allen Chen  2022-01-14  2005  
b5c84a9edcd418 Allen Chen  2022-01-14  2006  	if (err < 0) {
b5c84a9edcd418 Allen Chen  2022-01-14  2007  		dev_err(dev, "Read binfo value Fail");
b5c84a9edcd418 Allen Chen  2022-01-14  2008  		return err;
b5c84a9edcd418 Allen Chen  2022-01-14  2009  	}
b5c84a9edcd418 Allen Chen  2022-01-14  2010  
b5c84a9edcd418 Allen Chen  2022-01-14  2011  	down_stream_count = binfo[0] & 0x7F;
b5c84a9edcd418 Allen Chen  2022-01-14  2012  	DRM_DEV_DEBUG_DRIVER(dev, "binfo:0x%*ph", (int)ARRAY_SIZE(binfo),
b5c84a9edcd418 Allen Chen  2022-01-14  2013  			     binfo);
b5c84a9edcd418 Allen Chen  2022-01-14  2014  
b5c84a9edcd418 Allen Chen  2022-01-14  2015  	if ((binfo[0] & BIT(7)) || (binfo[1] & BIT(3))) {
b5c84a9edcd418 Allen Chen  2022-01-14  2016  		dev_err(dev, "HDCP max cascade device exceed");
b5c84a9edcd418 Allen Chen  2022-01-14  2017  		return 0;
b5c84a9edcd418 Allen Chen  2022-01-14  2018  	}
b5c84a9edcd418 Allen Chen  2022-01-14  2019  
b5c84a9edcd418 Allen Chen  2022-01-14  2020  	if (!down_stream_count ||
b5c84a9edcd418 Allen Chen  2022-01-14  2021  	    down_stream_count > MAX_HDCP_DOWN_STREAM_COUNT) {
b5c84a9edcd418 Allen Chen  2022-01-14  2022  		dev_err(dev, "HDCP down stream count Error %d",
b5c84a9edcd418 Allen Chen  2022-01-14  2023  			down_stream_count);
b5c84a9edcd418 Allen Chen  2022-01-14  2024  		return 0;
b5c84a9edcd418 Allen Chen  2022-01-14  2025  	}
9665163df60e16 Hermes Wu   2024-09-23  2026  	err =  it6505_get_ksvlist(it6505, sha1_input, down_stream_count * 5);
b5c84a9edcd418 Allen Chen  2022-01-14 @2027  		if (err < 0)
b5c84a9edcd418 Allen Chen  2022-01-14  2028  			return err;
b5c84a9edcd418 Allen Chen  2022-01-14  2029  
9665163df60e16 Hermes Wu   2024-09-23  2030  	msg_count += down_stream_count * 5;
b5c84a9edcd418 Allen Chen  2022-01-14  2031  
b5c84a9edcd418 Allen Chen  2022-01-14  2032  	it6505->hdcp_down_stream_count = down_stream_count;
b5c84a9edcd418 Allen Chen  2022-01-14  2033  	sha1_input[msg_count++] = binfo[0];
b5c84a9edcd418 Allen Chen  2022-01-14  2034  	sha1_input[msg_count++] = binfo[1];
b5c84a9edcd418 Allen Chen  2022-01-14  2035  
b5c84a9edcd418 Allen Chen  2022-01-14  2036  	it6505_set_bits(it6505, REG_HDCP_CTRL2, HDCP_EN_M0_READ,
b5c84a9edcd418 Allen Chen  2022-01-14  2037  			HDCP_EN_M0_READ);
b5c84a9edcd418 Allen Chen  2022-01-14  2038  
b5c84a9edcd418 Allen Chen  2022-01-14  2039  	err = regmap_bulk_read(it6505->regmap, REG_M0_0_7,
b5c84a9edcd418 Allen Chen  2022-01-14  2040  			       sha1_input + msg_count, 8);
b5c84a9edcd418 Allen Chen  2022-01-14  2041  
b5c84a9edcd418 Allen Chen  2022-01-14  2042  	it6505_set_bits(it6505, REG_HDCP_CTRL2, HDCP_EN_M0_READ, 0x00);
b5c84a9edcd418 Allen Chen  2022-01-14  2043  
b5c84a9edcd418 Allen Chen  2022-01-14  2044  	if (err < 0) {
b5c84a9edcd418 Allen Chen  2022-01-14  2045  		dev_err(dev, " Warning, Read M value Fail");
b5c84a9edcd418 Allen Chen  2022-01-14  2046  		return err;
b5c84a9edcd418 Allen Chen  2022-01-14  2047  	}
b5c84a9edcd418 Allen Chen  2022-01-14  2048  
b5c84a9edcd418 Allen Chen  2022-01-14  2049  	msg_count += 8;
b5c84a9edcd418 Allen Chen  2022-01-14  2050  
b5c84a9edcd418 Allen Chen  2022-01-14  2051  	return msg_count;
b5c84a9edcd418 Allen Chen  2022-01-14  2052  }
b5c84a9edcd418 Allen Chen  2022-01-14  2053
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index d8b40ad890bf..156440c6517e 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -296,7 +296,7 @@ 
 #define MAX_LANE_COUNT 4
 #define MAX_LINK_RATE HBR
 #define AUTO_TRAIN_RETRY 3
-#define MAX_HDCP_DOWN_STREAM_COUNT 10
+#define MAX_HDCP_DOWN_STREAM_COUNT 127
 #define MAX_CR_LEVEL 0x03
 #define MAX_EQ_LEVEL 0x03
 #define AUX_WAIT_TIMEOUT_MS 15
@@ -1188,6 +1188,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->dev;
+	enum aux_cmd_reply reply;
+
+	for (i = 0; i < len; ) {
+		request_size = min_t(int, (int)len - i, 15);
+
+		ret = it6505_aux_do_transfer(it6505, CMD_AUX_GET_KSV_LIST,
+					     DP_AUX_HDCP_KSV_FIFO,
+					     buf + i, request_size, &reply);
+
+		DRM_DEV_DEBUG_DRIVER(dev, "request_size = %d, ret =%d", request_size, ret);
+		if (ret < 0)
+			return ret;
+
+		i += request_size;
+	}
+
+	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;
@@ -1969,7 +1998,7 @@  static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
 {
 	struct device *dev = it6505->dev;
 	u8 binfo[2];
-	int down_stream_count, i, err, msg_count = 0;
+	int down_stream_count, err, msg_count = 0;
 
 	err = it6505_get_dpcd(it6505, DP_AUX_HDCP_BINFO, binfo,
 			      ARRAY_SIZE(binfo));
@@ -1994,18 +2023,11 @@  static int it6505_setup_sha1_input(struct it6505 *it6505, u8 *sha1_input)
 			down_stream_count);
 		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);
-
+	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];
@@ -2033,7 +2055,7 @@  static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
 {
 	struct device *dev = it6505->dev;
 	u8 av[5][4], bv[5][4];
-	int i, err;
+	int i, err, retry;
 
 	i = it6505_setup_sha1_input(it6505, it6505->sha1_input);
 	if (i <= 0) {
@@ -2042,22 +2064,28 @@  static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
 	}
 
 	it6505_sha1_digest(it6505, it6505->sha1_input, i, (u8 *)av);
+	/*1B-05 V' must retry 3 times */
+	for (retry = 0; retry < 3; retry++) {
+		err = it6505_get_dpcd(it6505, DP_AUX_HDCP_V_PRIME(0), (u8 *)bv,
+				      sizeof(bv));
+
+		if (err < 0) {
+			dev_err(dev, "Read V' value Fail %d", retry);
+			continue;
+		}
 
-	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] ||
+			    av[i][1] != av[i][2] || bv[i][0] != av[i][3])
+				break;
 
-	if (err < 0) {
-		dev_err(dev, "Read V' value Fail");
-		return false;
+			DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
+			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])
-			return false;
-
-	DRM_DEV_DEBUG_DRIVER(dev, "V' all match!!");
-	return true;
+	DRM_DEV_DEBUG_DRIVER(dev, "V' NOT match!! %d", retry);
+	return false;
 }
 
 static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
@@ -2065,7 +2093,8 @@  static void it6505_hdcp_wait_ksv_list(struct work_struct *work)
 	struct it6505 *it6505 = container_of(work, struct it6505,
 					     hdcp_wait_ksv_list);
 	struct device *dev = it6505->dev;
-	unsigned int timeout = 5000;
+	/* 1B-04 fail, wait to long to Stop encription(5s->2s). */
+	unsigned int timeout = 2000;
 	u8 bstatus = 0;
 	bool ksv_list_check;
 
@@ -2085,21 +2114,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);
+
+	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)
@@ -2321,14 +2347,20 @@  static int it6505_process_hpd_irq(struct it6505 *it6505)
 	DRM_DEV_DEBUG_DRIVER(dev, "dp_irq_vector = 0x%02x", dp_irq_vector);
 
 	if (dp_irq_vector & DP_CP_IRQ) {
-		it6505_set_bits(it6505, REG_HDCP_TRIGGER, HDCP_TRIGGER_CPIRQ,
-				HDCP_TRIGGER_CPIRQ);
-
 		bstatus = it6505_dpcd_read(it6505, DP_AUX_HDCP_BSTATUS);
 		if (bstatus < 0)
 			return bstatus;
 
 		DRM_DEV_DEBUG_DRIVER(dev, "Bstatus = 0x%02x", bstatus);
+
+		/*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);
@@ -2465,7 +2497,11 @@  static void it6505_irq_hdcp_ksv_check(struct it6505 *it6505)
 {
 	struct device *dev = it6505->dev;
 
-	DRM_DEV_DEBUG_DRIVER(dev, "HDCP event Interrupt");
+	DRM_DEV_DEBUG_DRIVER(dev, "HDCP repeater R0 event Interrupt");
+	/* 1B01 HDCP encription should start when R0 is ready*/
+	it6505_set_bits(it6505, REG_HDCP_TRIGGER,
+			HDCP_TRIGGER_KSV_DONE, HDCP_TRIGGER_KSV_DONE);
+
 	schedule_work(&it6505->hdcp_wait_ksv_list);
 }