Message ID | 1544673701-6353-2-git-send-email-ramalingam.c@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/i915: Implement HDCP2.2 | expand |
> > All HDCP1.4 routines are gathered together, followed by the generic functions > those can be extended for HDCP2.2 too. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> > --- > drivers/gpu/drm/i915/intel_hdcp.c | 118 +++++++++++++++++++------------------ > - > 1 file changed, 59 insertions(+), 59 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_hdcp.c > b/drivers/gpu/drm/i915/intel_hdcp.c > index e000e54ad569..506b4cc6f46b 100644 > --- a/drivers/gpu/drm/i915/intel_hdcp.c > +++ b/drivers/gpu/drm/i915/intel_hdcp.c > @@ -731,6 +731,65 @@ struct intel_connector > *intel_hdcp_to_connector(struct intel_hdcp *hdcp) > return container_of(hdcp, struct intel_connector, hdcp); } > > +/* Implements Part 3 of the HDCP authorization procedure */ int > +intel_hdcp_check_link(struct intel_connector *connector) { Should be static > + struct intel_hdcp *hdcp = &connector->hdcp; > + struct drm_i915_private *dev_priv = connector->base.dev- > >dev_private; > + struct intel_digital_port *intel_dig_port = > conn_to_dig_port(connector); > + enum port port = intel_dig_port->base.port; > + int ret = 0; > + > + if (!hdcp->shim) > + return -ENOENT; > + > + mutex_lock(&hdcp->mutex); > + > + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) > + goto out; > + > + if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { > + DRM_ERROR("%s:%d HDCP check failed: link is not > encrypted,%x\n", > + connector->base.name, connector->base.base.id, > + I915_READ(PORT_HDCP_STATUS(port))); > + ret = -ENXIO; > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > + if (hdcp->shim->check_link(intel_dig_port)) { > + if (hdcp->value != > DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { > + hdcp->value = > DRM_MODE_CONTENT_PROTECTION_ENABLED; > + schedule_work(&hdcp->prop_work); > + } > + goto out; > + } > + > + DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying > authentication\n", > + connector->base.name, connector->base.base.id); > + > + ret = _intel_hdcp_disable(connector); > + if (ret) { > + DRM_ERROR("Failed to disable hdcp (%d)\n", ret); > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > + ret = _intel_hdcp_enable(connector); > + if (ret) { > + DRM_ERROR("Failed to enable hdcp (%d)\n", ret); > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > +out: > + mutex_unlock(&hdcp->mutex); > + return ret; > +} > + > static void intel_hdcp_check_work(struct work_struct *work) { > struct intel_hdcp *hdcp = container_of(to_delayed_work(work), > @@ -867,62 +926,3 @@ void intel_hdcp_atomic_check(struct drm_connector > *connector, > new_state->crtc); > crtc_state->mode_changed = true; > } > - > -/* Implements Part 3 of the HDCP authorization procedure */ -int > intel_hdcp_check_link(struct intel_connector *connector) -{ > - struct intel_hdcp *hdcp = &connector->hdcp; > - struct drm_i915_private *dev_priv = connector->base.dev- > >dev_private; > - struct intel_digital_port *intel_dig_port = > conn_to_dig_port(connector); > - enum port port = intel_dig_port->base.port; > - int ret = 0; > - > - if (!hdcp->shim) > - return -ENOENT; > - > - mutex_lock(&hdcp->mutex); > - > - if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) > - goto out; > - > - if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { > - DRM_ERROR("%s:%d HDCP check failed: link is not > encrypted,%x\n", > - connector->base.name, connector->base.base.id, > - I915_READ(PORT_HDCP_STATUS(port))); > - ret = -ENXIO; > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > - if (hdcp->shim->check_link(intel_dig_port)) { > - if (hdcp->value != > DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { > - hdcp->value = > DRM_MODE_CONTENT_PROTECTION_ENABLED; > - schedule_work(&hdcp->prop_work); > - } > - goto out; > - } > - > - DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying > authentication\n", > - connector->base.name, connector->base.base.id); > - > - ret = _intel_hdcp_disable(connector); > - if (ret) { > - DRM_ERROR("Failed to disable hdcp (%d)\n", ret); > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > - ret = _intel_hdcp_enable(connector); > - if (ret) { > - DRM_DEBUG_KMS("Failed to enable hdcp (%d)\n", ret); > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > -out: > - mutex_unlock(&hdcp->mutex); > - return ret; > -} > -- > 2.7.4
On 12/13/2018 1:47 PM, Winkler, Tomas wrote: > >> All HDCP1.4 routines are gathered together, followed by the generic functions >> those can be extended for HDCP2.2 too. >> >> Signed-off-by: Ramalingam C <ramalingam.c@intel.com> >> --- >> drivers/gpu/drm/i915/intel_hdcp.c | 118 +++++++++++++++++++------------------ >> - >> 1 file changed, 59 insertions(+), 59 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/intel_hdcp.c >> b/drivers/gpu/drm/i915/intel_hdcp.c >> index e000e54ad569..506b4cc6f46b 100644 >> --- a/drivers/gpu/drm/i915/intel_hdcp.c >> +++ b/drivers/gpu/drm/i915/intel_hdcp.c >> @@ -731,6 +731,65 @@ struct intel_connector >> *intel_hdcp_to_connector(struct intel_hdcp *hdcp) >> return container_of(hdcp, struct intel_connector, hdcp); } >> >> +/* Implements Part 3 of the HDCP authorization procedure */ int >> +intel_hdcp_check_link(struct intel_connector *connector) { > > Should be static At this point in time, invoked from intel_dp.c. But at later part of this series this function can be defined as static. Will do it then. -Ram > >> + struct intel_hdcp *hdcp = &connector->hdcp; >> + struct drm_i915_private *dev_priv = connector->base.dev- >>> dev_private; >> + struct intel_digital_port *intel_dig_port = >> conn_to_dig_port(connector); >> + enum port port = intel_dig_port->base.port; >> + int ret = 0; >> + >> + if (!hdcp->shim) >> + return -ENOENT; >> + >> + mutex_lock(&hdcp->mutex); >> + >> + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) >> + goto out; >> + >> + if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { >> + DRM_ERROR("%s:%d HDCP check failed: link is not >> encrypted,%x\n", >> + connector->base.name, connector->base.base.id, >> + I915_READ(PORT_HDCP_STATUS(port))); >> + ret = -ENXIO; >> + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> + schedule_work(&hdcp->prop_work); >> + goto out; >> + } >> + >> + if (hdcp->shim->check_link(intel_dig_port)) { >> + if (hdcp->value != >> DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { >> + hdcp->value = >> DRM_MODE_CONTENT_PROTECTION_ENABLED; >> + schedule_work(&hdcp->prop_work); >> + } >> + goto out; >> + } >> + >> + DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying >> authentication\n", >> + connector->base.name, connector->base.base.id); >> + >> + ret = _intel_hdcp_disable(connector); >> + if (ret) { >> + DRM_ERROR("Failed to disable hdcp (%d)\n", ret); >> + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> + schedule_work(&hdcp->prop_work); >> + goto out; >> + } >> + >> + ret = _intel_hdcp_enable(connector); >> + if (ret) { >> + DRM_ERROR("Failed to enable hdcp (%d)\n", ret); >> + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> + schedule_work(&hdcp->prop_work); >> + goto out; >> + } >> + >> +out: >> + mutex_unlock(&hdcp->mutex); >> + return ret; >> +} >> + >> static void intel_hdcp_check_work(struct work_struct *work) { >> struct intel_hdcp *hdcp = container_of(to_delayed_work(work), >> @@ -867,62 +926,3 @@ void intel_hdcp_atomic_check(struct drm_connector >> *connector, >> new_state->crtc); >> crtc_state->mode_changed = true; >> } >> - >> -/* Implements Part 3 of the HDCP authorization procedure */ -int >> intel_hdcp_check_link(struct intel_connector *connector) -{ >> - struct intel_hdcp *hdcp = &connector->hdcp; >> - struct drm_i915_private *dev_priv = connector->base.dev- >>> dev_private; >> - struct intel_digital_port *intel_dig_port = >> conn_to_dig_port(connector); >> - enum port port = intel_dig_port->base.port; >> - int ret = 0; >> - >> - if (!hdcp->shim) >> - return -ENOENT; >> - >> - mutex_lock(&hdcp->mutex); >> - >> - if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) >> - goto out; >> - >> - if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { >> - DRM_ERROR("%s:%d HDCP check failed: link is not >> encrypted,%x\n", >> - connector->base.name, connector->base.base.id, >> - I915_READ(PORT_HDCP_STATUS(port))); >> - ret = -ENXIO; >> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> - schedule_work(&hdcp->prop_work); >> - goto out; >> - } >> - >> - if (hdcp->shim->check_link(intel_dig_port)) { >> - if (hdcp->value != >> DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { >> - hdcp->value = >> DRM_MODE_CONTENT_PROTECTION_ENABLED; >> - schedule_work(&hdcp->prop_work); >> - } >> - goto out; >> - } >> - >> - DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying >> authentication\n", >> - connector->base.name, connector->base.base.id); >> - >> - ret = _intel_hdcp_disable(connector); >> - if (ret) { >> - DRM_ERROR("Failed to disable hdcp (%d)\n", ret); >> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> - schedule_work(&hdcp->prop_work); >> - goto out; >> - } >> - >> - ret = _intel_hdcp_enable(connector); >> - if (ret) { >> - DRM_DEBUG_KMS("Failed to enable hdcp (%d)\n", ret); >> - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; >> - schedule_work(&hdcp->prop_work); >> - goto out; >> - } >> - >> -out: >> - mutex_unlock(&hdcp->mutex); >> - return ret; >> -} >> -- >> 2.7.4 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body text="#000000" bgcolor="#FFFFFF"> <p><br> </p> <div class="moz-cite-prefix">On 12/13/2018 1:47 PM, Winkler, Tomas wrote:<br> </div> <blockquote type="cite" cite="mid:5B8DA87D05A7694D9FA63FD143655C1B9DA51DBC@hasmsx108.ger.corp.intel.com"> <pre class="moz-quote-pre" wrap=""> </pre> <blockquote type="cite"> <pre class="moz-quote-pre" wrap=""> All HDCP1.4 routines are gathered together, followed by the generic functions those can be extended for HDCP2.2 too. Signed-off-by: Ramalingam C <a class="moz-txt-link-rfc2396E" href="mailto:ramalingam.c@intel.com"><ramalingam.c@intel.com></a> --- drivers/gpu/drm/i915/intel_hdcp.c | 118 +++++++++++++++++++------------------ - 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index e000e54ad569..506b4cc6f46b 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -731,6 +731,65 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp) return container_of(hdcp, struct intel_connector, hdcp); } +/* Implements Part 3 of the HDCP authorization procedure */ int +intel_hdcp_check_link(struct intel_connector *connector) { </pre> </blockquote> <pre class="moz-quote-pre" wrap=""> Should be static</pre> </blockquote> <pre>At this point in time, invoked from intel_dp.c. But at later part of this series this function can be defined as static. Will do it then. -Ram </pre> <blockquote type="cite" cite="mid:5B8DA87D05A7694D9FA63FD143655C1B9DA51DBC@hasmsx108.ger.corp.intel.com"> <pre class="moz-quote-pre" wrap=""> </pre> <blockquote type="cite"> <pre class="moz-quote-pre" wrap="">+ struct intel_hdcp *hdcp = &connector->hdcp; + struct drm_i915_private *dev_priv = connector->base.dev- </pre> <blockquote type="cite"> <pre class="moz-quote-pre" wrap="">dev_private; </pre> </blockquote> <pre class="moz-quote-pre" wrap="">+ struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + enum port port = intel_dig_port->base.port; + int ret = 0; + + if (!hdcp->shim) + return -ENOENT; + + mutex_lock(&hdcp->mutex); + + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) + goto out; + + if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { + DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", + connector->base.name, connector->base.base.id, + I915_READ(PORT_HDCP_STATUS(port))); + ret = -ENXIO; + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + + if (hdcp->shim->check_link(intel_dig_port)) { + if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { + hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(&hdcp->prop_work); + } + goto out; + } + + DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", + connector->base.name, connector->base.base.id); + + ret = _intel_hdcp_disable(connector); + if (ret) { + DRM_ERROR("Failed to disable hdcp (%d)\n", ret); + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + + ret = _intel_hdcp_enable(connector); + if (ret) { + DRM_ERROR("Failed to enable hdcp (%d)\n", ret); + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + +out: + mutex_unlock(&hdcp->mutex); + return ret; +} + static void intel_hdcp_check_work(struct work_struct *work) { struct intel_hdcp *hdcp = container_of(to_delayed_work(work), @@ -867,62 +926,3 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, new_state->crtc); crtc_state->mode_changed = true; } - -/* Implements Part 3 of the HDCP authorization procedure */ -int intel_hdcp_check_link(struct intel_connector *connector) -{ - struct intel_hdcp *hdcp = &connector->hdcp; - struct drm_i915_private *dev_priv = connector->base.dev- </pre> <blockquote type="cite"> <pre class="moz-quote-pre" wrap="">dev_private; </pre> </blockquote> <pre class="moz-quote-pre" wrap="">- struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); - enum port port = intel_dig_port->base.port; - int ret = 0; - - if (!hdcp->shim) - return -ENOENT; - - mutex_lock(&hdcp->mutex); - - if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) - goto out; - - if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { - DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", - connector->base.name, connector->base.base.id, - I915_READ(PORT_HDCP_STATUS(port))); - ret = -ENXIO; - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - - if (hdcp->shim->check_link(intel_dig_port)) { - if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); - } - goto out; - } - - DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", - connector->base.name, connector->base.base.id); - - ret = _intel_hdcp_disable(connector); - if (ret) { - DRM_ERROR("Failed to disable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - - ret = _intel_hdcp_enable(connector); - if (ret) { - DRM_DEBUG_KMS("Failed to enable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - -out: - mutex_unlock(&hdcp->mutex); - return ret; -} -- 2.7.4 </pre> </blockquote> <pre class="moz-quote-pre" wrap=""> </pre> </blockquote> </body> </html>
On Thu, Dec 13, 2018 at 09:31:03AM +0530, Ramalingam C wrote: > All HDCP1.4 routines are gathered together, followed by the generic > functions those can be extended for HDCP2.2 too. > > Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Since just code movement: Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/i915/intel_hdcp.c | 118 +++++++++++++++++++------------------- > 1 file changed, 59 insertions(+), 59 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c > index e000e54ad569..506b4cc6f46b 100644 > --- a/drivers/gpu/drm/i915/intel_hdcp.c > +++ b/drivers/gpu/drm/i915/intel_hdcp.c > @@ -731,6 +731,65 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp) > return container_of(hdcp, struct intel_connector, hdcp); > } > > +/* Implements Part 3 of the HDCP authorization procedure */ > +int intel_hdcp_check_link(struct intel_connector *connector) > +{ > + struct intel_hdcp *hdcp = &connector->hdcp; > + struct drm_i915_private *dev_priv = connector->base.dev->dev_private; > + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); > + enum port port = intel_dig_port->base.port; > + int ret = 0; > + > + if (!hdcp->shim) > + return -ENOENT; > + > + mutex_lock(&hdcp->mutex); > + > + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) > + goto out; > + > + if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { > + DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", > + connector->base.name, connector->base.base.id, > + I915_READ(PORT_HDCP_STATUS(port))); > + ret = -ENXIO; > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > + if (hdcp->shim->check_link(intel_dig_port)) { > + if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; > + schedule_work(&hdcp->prop_work); > + } > + goto out; > + } > + > + DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", > + connector->base.name, connector->base.base.id); > + > + ret = _intel_hdcp_disable(connector); > + if (ret) { > + DRM_ERROR("Failed to disable hdcp (%d)\n", ret); > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > + ret = _intel_hdcp_enable(connector); > + if (ret) { > + DRM_ERROR("Failed to enable hdcp (%d)\n", ret); > + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > + schedule_work(&hdcp->prop_work); > + goto out; > + } > + > +out: > + mutex_unlock(&hdcp->mutex); > + return ret; > +} > + > static void intel_hdcp_check_work(struct work_struct *work) > { > struct intel_hdcp *hdcp = container_of(to_delayed_work(work), > @@ -867,62 +926,3 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, > new_state->crtc); > crtc_state->mode_changed = true; > } > - > -/* Implements Part 3 of the HDCP authorization procedure */ > -int intel_hdcp_check_link(struct intel_connector *connector) > -{ > - struct intel_hdcp *hdcp = &connector->hdcp; > - struct drm_i915_private *dev_priv = connector->base.dev->dev_private; > - struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); > - enum port port = intel_dig_port->base.port; > - int ret = 0; > - > - if (!hdcp->shim) > - return -ENOENT; > - > - mutex_lock(&hdcp->mutex); > - > - if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) > - goto out; > - > - if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { > - DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", > - connector->base.name, connector->base.base.id, > - I915_READ(PORT_HDCP_STATUS(port))); > - ret = -ENXIO; > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > - if (hdcp->shim->check_link(intel_dig_port)) { > - if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; > - schedule_work(&hdcp->prop_work); > - } > - goto out; > - } > - > - DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", > - connector->base.name, connector->base.base.id); > - > - ret = _intel_hdcp_disable(connector); > - if (ret) { > - DRM_ERROR("Failed to disable hdcp (%d)\n", ret); > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > - ret = _intel_hdcp_enable(connector); > - if (ret) { > - DRM_DEBUG_KMS("Failed to enable hdcp (%d)\n", ret); > - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; > - schedule_work(&hdcp->prop_work); > - goto out; > - } > - > -out: > - mutex_unlock(&hdcp->mutex); > - return ret; > -} > -- > 2.7.4 >
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c index e000e54ad569..506b4cc6f46b 100644 --- a/drivers/gpu/drm/i915/intel_hdcp.c +++ b/drivers/gpu/drm/i915/intel_hdcp.c @@ -731,6 +731,65 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp) return container_of(hdcp, struct intel_connector, hdcp); } +/* Implements Part 3 of the HDCP authorization procedure */ +int intel_hdcp_check_link(struct intel_connector *connector) +{ + struct intel_hdcp *hdcp = &connector->hdcp; + struct drm_i915_private *dev_priv = connector->base.dev->dev_private; + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); + enum port port = intel_dig_port->base.port; + int ret = 0; + + if (!hdcp->shim) + return -ENOENT; + + mutex_lock(&hdcp->mutex); + + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) + goto out; + + if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { + DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", + connector->base.name, connector->base.base.id, + I915_READ(PORT_HDCP_STATUS(port))); + ret = -ENXIO; + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + + if (hdcp->shim->check_link(intel_dig_port)) { + if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { + hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; + schedule_work(&hdcp->prop_work); + } + goto out; + } + + DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", + connector->base.name, connector->base.base.id); + + ret = _intel_hdcp_disable(connector); + if (ret) { + DRM_ERROR("Failed to disable hdcp (%d)\n", ret); + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + + ret = _intel_hdcp_enable(connector); + if (ret) { + DRM_ERROR("Failed to enable hdcp (%d)\n", ret); + hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; + schedule_work(&hdcp->prop_work); + goto out; + } + +out: + mutex_unlock(&hdcp->mutex); + return ret; +} + static void intel_hdcp_check_work(struct work_struct *work) { struct intel_hdcp *hdcp = container_of(to_delayed_work(work), @@ -867,62 +926,3 @@ void intel_hdcp_atomic_check(struct drm_connector *connector, new_state->crtc); crtc_state->mode_changed = true; } - -/* Implements Part 3 of the HDCP authorization procedure */ -int intel_hdcp_check_link(struct intel_connector *connector) -{ - struct intel_hdcp *hdcp = &connector->hdcp; - struct drm_i915_private *dev_priv = connector->base.dev->dev_private; - struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); - enum port port = intel_dig_port->base.port; - int ret = 0; - - if (!hdcp->shim) - return -ENOENT; - - mutex_lock(&hdcp->mutex); - - if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) - goto out; - - if (!(I915_READ(PORT_HDCP_STATUS(port)) & HDCP_STATUS_ENC)) { - DRM_ERROR("%s:%d HDCP check failed: link is not encrypted,%x\n", - connector->base.name, connector->base.base.id, - I915_READ(PORT_HDCP_STATUS(port))); - ret = -ENXIO; - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - - if (hdcp->shim->check_link(intel_dig_port)) { - if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); - } - goto out; - } - - DRM_DEBUG_KMS("[%s:%d] HDCP link failed, retrying authentication\n", - connector->base.name, connector->base.base.id); - - ret = _intel_hdcp_disable(connector); - if (ret) { - DRM_ERROR("Failed to disable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - - ret = _intel_hdcp_enable(connector); - if (ret) { - DRM_DEBUG_KMS("Failed to enable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); - goto out; - } - -out: - mutex_unlock(&hdcp->mutex); - return ret; -}
All HDCP1.4 routines are gathered together, followed by the generic functions those can be extended for HDCP2.2 too. Signed-off-by: Ramalingam C <ramalingam.c@intel.com> --- drivers/gpu/drm/i915/intel_hdcp.c | 118 +++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 59 deletions(-)