diff mbox series

[v9,37/39] drm/i915: Fix KBL HDCP2.2 encrypt status signalling

Message ID 1544673701-6353-38-git-send-email-ramalingam.c@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Implement HDCP2.2 | expand

Commit Message

Ramalingam C Dec. 13, 2018, 4:01 a.m. UTC
Implement the required WA sequence for KBL to fix the
incorrect positioning of the window of oppurtunity and enc_en
signalling.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 drivers/gpu/drm/i915/intel_hdcp.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Daniel Vetter Dec. 19, 2018, 3:40 p.m. UTC | #1
On Thu, Dec 13, 2018 at 09:31:39AM +0530, Ramalingam C wrote:
> Implement the required WA sequence for KBL to fix the
> incorrect positioning of the window of oppurtunity and enc_en
> signalling.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_hdcp.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
> index 42327ed30903..2b9e1b6d0b1e 100644
> --- a/drivers/gpu/drm/i915/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
> @@ -12,6 +12,7 @@
>  #include <linux/i2c.h>
>  #include <linux/random.h>
>  #include <linux/component.h>
> +#include <linux/delay.h>
>  
>  #include "intel_drv.h"
>  #include "i915_reg.h"
> @@ -20,6 +21,27 @@
>  #define ENCRYPT_STATUS_CHANGE_TIMEOUT_MS	50
>  #define HDCP2_LC_RETRY_CNT			3
>  
> +static void kbl_repositioning_enc_en_signal(struct intel_connector *connector)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
> +	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
> +	struct intel_hdcp *hdcp = &connector->hdcp;
> +	struct drm_crtc *crtc = connector->base.state->crtc;
> +	struct intel_crtc *intel_crtc = container_of(crtc,
> +						     struct intel_crtc, base);
> +	u32 scanline;
> +
> +	for (;;) {
> +		scanline = I915_READ(PIPEDSL(intel_crtc->pipe));
> +		if (scanline > 100 && scanline < 200)
> +			break;
> +		usleep_range(25, 50);
> +	}
> +
> +	hdcp->shim->toggle_signalling(intel_dig_port, false);
> +	hdcp->shim->toggle_signalling(intel_dig_port, true);
> +}
> +
>  static
>  bool intel_hdcp_is_ksv_valid(u8 *ksv)
>  {
> @@ -1382,6 +1404,13 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
>  	}
>  
>  	if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
> +		/*
> +		 * WA: To fix incorrect positioning of the window of
> +		 * opportunity and enc_en signalling in KABYLAKE.
> +		 */
> +		if (IS_KABYLAKE(dev_priv) && hdcp->shim->toggle_signalling)
> +			kbl_repositioning_enc_en_signal(connector);

This is a bit a layering violation of the shim. I think it'd be better to
push this into the toggle_signalling implementation, which you call right
above. That can easily check this register too, and retry. That way the
kbl flow is all in one place.

Bspec is down for me, so can't check the w/a itself :-(
-Daniel

> +
>  		/* Link is Authenticated. Now set for Encryption */
>  		I915_WRITE(HDCP2_CTL_DDI(port),
>  			   I915_READ(HDCP2_CTL_DDI(port)) |
> -- 
> 2.7.4
>
Ramalingam C Dec. 19, 2018, 4:16 p.m. UTC | #2
On 12/19/2018 9:10 PM, Daniel Vetter wrote:
> On Thu, Dec 13, 2018 at 09:31:39AM +0530, Ramalingam C wrote:
>> Implement the required WA sequence for KBL to fix the
>> incorrect positioning of the window of oppurtunity and enc_en
>> signalling.
>>
>> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
>> ---
>>   drivers/gpu/drm/i915/intel_hdcp.c | 29 +++++++++++++++++++++++++++++
>>   1 file changed, 29 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
>> index 42327ed30903..2b9e1b6d0b1e 100644
>> --- a/drivers/gpu/drm/i915/intel_hdcp.c
>> +++ b/drivers/gpu/drm/i915/intel_hdcp.c
>> @@ -12,6 +12,7 @@
>>   #include <linux/i2c.h>
>>   #include <linux/random.h>
>>   #include <linux/component.h>
>> +#include <linux/delay.h>
>>   
>>   #include "intel_drv.h"
>>   #include "i915_reg.h"
>> @@ -20,6 +21,27 @@
>>   #define ENCRYPT_STATUS_CHANGE_TIMEOUT_MS	50
>>   #define HDCP2_LC_RETRY_CNT			3
>>   
>> +static void kbl_repositioning_enc_en_signal(struct intel_connector *connector)
>> +{
>> +	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
>> +	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
>> +	struct intel_hdcp *hdcp = &connector->hdcp;
>> +	struct drm_crtc *crtc = connector->base.state->crtc;
>> +	struct intel_crtc *intel_crtc = container_of(crtc,
>> +						     struct intel_crtc, base);
>> +	u32 scanline;
>> +
>> +	for (;;) {
>> +		scanline = I915_READ(PIPEDSL(intel_crtc->pipe));
>> +		if (scanline > 100 && scanline < 200)
>> +			break;
>> +		usleep_range(25, 50);
>> +	}
>> +
>> +	hdcp->shim->toggle_signalling(intel_dig_port, false);
>> +	hdcp->shim->toggle_signalling(intel_dig_port, true);
>> +}
>> +
>>   static
>>   bool intel_hdcp_is_ksv_valid(u8 *ksv)
>>   {
>> @@ -1382,6 +1404,13 @@ static int hdcp2_enable_encryption(struct intel_connector *connector)
>>   	}
>>   
>>   	if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
>> +		/*
>> +		 * WA: To fix incorrect positioning of the window of
>> +		 * opportunity and enc_en signalling in KABYLAKE.
>> +		 */
>> +		if (IS_KABYLAKE(dev_priv) && hdcp->shim->toggle_signalling)
>> +			kbl_repositioning_enc_en_signal(connector);
> This is a bit a layering violation of the shim. I think it'd be better to
> push this into the toggle_signalling implementation, which you call right
> above. That can easily check this register too, and retry. That way the
> kbl flow is all in one place.

Yes, any way this is a fix for hdcp_signalling for kbl. I will do that.

-Ram

>
> Bspec is down for me, so can't check the w/a itself :-(
> -Daniel
>
>> +
>>   		/* Link is Authenticated. Now set for Encryption */
>>   		I915_WRITE(HDCP2_CTL_DDI(port),
>>   			   I915_READ(HDCP2_CTL_DDI(port)) |
>> -- 
>> 2.7.4
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index 42327ed30903..2b9e1b6d0b1e 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -12,6 +12,7 @@ 
 #include <linux/i2c.h>
 #include <linux/random.h>
 #include <linux/component.h>
+#include <linux/delay.h>
 
 #include "intel_drv.h"
 #include "i915_reg.h"
@@ -20,6 +21,27 @@ 
 #define ENCRYPT_STATUS_CHANGE_TIMEOUT_MS	50
 #define HDCP2_LC_RETRY_CNT			3
 
+static void kbl_repositioning_enc_en_signal(struct intel_connector *connector)
+{
+	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+	struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
+	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct drm_crtc *crtc = connector->base.state->crtc;
+	struct intel_crtc *intel_crtc = container_of(crtc,
+						     struct intel_crtc, base);
+	u32 scanline;
+
+	for (;;) {
+		scanline = I915_READ(PIPEDSL(intel_crtc->pipe));
+		if (scanline > 100 && scanline < 200)
+			break;
+		usleep_range(25, 50);
+	}
+
+	hdcp->shim->toggle_signalling(intel_dig_port, false);
+	hdcp->shim->toggle_signalling(intel_dig_port, true);
+}
+
 static
 bool intel_hdcp_is_ksv_valid(u8 *ksv)
 {
@@ -1382,6 +1404,13 @@  static int hdcp2_enable_encryption(struct intel_connector *connector)
 	}
 
 	if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
+		/*
+		 * WA: To fix incorrect positioning of the window of
+		 * opportunity and enc_en signalling in KABYLAKE.
+		 */
+		if (IS_KABYLAKE(dev_priv) && hdcp->shim->toggle_signalling)
+			kbl_repositioning_enc_en_signal(connector);
+
 		/* Link is Authenticated. Now set for Encryption */
 		I915_WRITE(HDCP2_CTL_DDI(port),
 			   I915_READ(HDCP2_CTL_DDI(port)) |