diff mbox series

[1/1] drm/i915/hdcp: restore hdcp state same as previous

Message ID 20200103130021.15992-2-anshuman.gupta@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/1] drm/i915/hdcp: restore hdcp state same as previous | expand

Commit Message

Gupta, Anshuman Jan. 3, 2020, 1 p.m. UTC
When port is disabled due to modeset or DPMS off actually
it disables the HDCP encryption keeping its state to
CP_ENABLED this doesn't enable HDCP again while port
gets enable again. HDCP state should set accordingly
when port is disabled.

CC: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Ramalingam C Jan. 3, 2020, 1:34 p.m. UTC | #1
On 2020-01-03 at 18:30:21 +0530, Anshuman Gupta wrote:
> When port is disabled due to modeset or DPMS off actually
> it disables the HDCP encryption keeping its state to
> CP_ENABLED this doesn't enable HDCP again while port
> gets enable again. HDCP state should set accordingly
> when port is disabled.
> 
> CC: Ramalingam C <ramalingam.c@intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 07acd0daca25..b1b79073e3f9 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -4137,7 +4137,14 @@ static void intel_disable_ddi(struct intel_encoder *encoder,
>  			      const struct intel_crtc_state *old_crtc_state,
>  			      const struct drm_connector_state *old_conn_state)
>  {
> -	intel_hdcp_disable(to_intel_connector(old_conn_state->connector));
> +	int ret;
> +
> +	ret = intel_hdcp_disable(to_intel_connector(old_conn_state->connector));
> +
> +	if (old_conn_state->content_protection ==
> +	    DRM_MODE_CONTENT_PROTECTION_ENABLED && !ret)
while relooking at it, locking is missing. 

                mutex_lock(&hdcp->mutex);
                hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
                schedule_work(&hdcp->prop_work);
                mutex_unlock(&hdcp->mutex);

-Ram

> +		drm_hdcp_update_content_protection(old_conn_state->connector,
> +						   DRM_MODE_CONTENT_PROTECTION_DESIRED);
>  
>  	if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
>  		intel_disable_ddi_hdmi(encoder, old_crtc_state, old_conn_state);
> -- 
> 2.24.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 07acd0daca25..b1b79073e3f9 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -4137,7 +4137,14 @@  static void intel_disable_ddi(struct intel_encoder *encoder,
 			      const struct intel_crtc_state *old_crtc_state,
 			      const struct drm_connector_state *old_conn_state)
 {
-	intel_hdcp_disable(to_intel_connector(old_conn_state->connector));
+	int ret;
+
+	ret = intel_hdcp_disable(to_intel_connector(old_conn_state->connector));
+
+	if (old_conn_state->content_protection ==
+	    DRM_MODE_CONTENT_PROTECTION_ENABLED && !ret)
+		drm_hdcp_update_content_protection(old_conn_state->connector,
+						   DRM_MODE_CONTENT_PROTECTION_DESIRED);
 
 	if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
 		intel_disable_ddi_hdmi(encoder, old_crtc_state, old_conn_state);