]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/hdcp: move update pipe code to hdcp
authorJani Nikula <jani.nikula@intel.com>
Tue, 28 Jan 2020 16:38:03 +0000 (18:38 +0200)
committerJani Nikula <jani.nikula@intel.com>
Wed, 5 Feb 2020 09:08:28 +0000 (11:08 +0200)
The DDI encoder code shouln't have to know about the guts of
HDCP. Abstract the pipe update code to a new intel_hdcp_update_pipe() in
intel_hdcp.c. No functional changes.

Cc: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Anshuman Gupta <anshuman.gupta@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128163803.5954-1-jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_hdcp.c
drivers/gpu/drm/i915/display/intel_hdcp.h

index aa066fb9eb00a6142d74ce0823d4517661158b18..1ab638e1704607a017dacd75ce7c3e4aa9de2c18 100644 (file)
@@ -4080,43 +4080,11 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
                                  const struct intel_crtc_state *crtc_state,
                                  const struct drm_connector_state *conn_state)
 {
-       struct intel_connector *connector =
-                               to_intel_connector(conn_state->connector);
-       struct intel_hdcp *hdcp = &connector->hdcp;
-       bool content_protection_type_changed =
-                       (conn_state->hdcp_content_type != hdcp->content_type &&
-                        conn_state->content_protection !=
-                        DRM_MODE_CONTENT_PROTECTION_UNDESIRED);
 
        if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
                intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
 
-       /*
-        * During the HDCP encryption session if Type change is requested,
-        * disable the HDCP and reenable it with new TYPE value.
-        */
-       if (conn_state->content_protection ==
-           DRM_MODE_CONTENT_PROTECTION_UNDESIRED ||
-           content_protection_type_changed)
-               intel_hdcp_disable(connector);
-
-       /*
-        * Mark the hdcp state as DESIRED after the hdcp disable of type
-        * change procedure.
-        */
-       if (content_protection_type_changed) {
-               mutex_lock(&hdcp->mutex);
-               hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
-               schedule_work(&hdcp->prop_work);
-               mutex_unlock(&hdcp->mutex);
-       }
-
-       if (conn_state->content_protection ==
-           DRM_MODE_CONTENT_PROTECTION_DESIRED ||
-           content_protection_type_changed)
-               intel_hdcp_enable(connector,
-                                 crtc_state->cpu_transcoder,
-                                 (u8)conn_state->hdcp_content_type);
+       intel_hdcp_update_pipe(encoder, crtc_state, conn_state);
 }
 
 static void
index 2d25244f38df4d63b05bd092dc770fa4b6eddc35..4d1a33d1310534d96d2dcb919b50a9f6e2f77f7e 100644 (file)
@@ -2050,6 +2050,46 @@ int intel_hdcp_disable(struct intel_connector *connector)
        return ret;
 }
 
+void intel_hdcp_update_pipe(struct intel_encoder *encoder,
+                           const struct intel_crtc_state *crtc_state,
+                           const struct drm_connector_state *conn_state)
+{
+       struct intel_connector *connector =
+                               to_intel_connector(conn_state->connector);
+       struct intel_hdcp *hdcp = &connector->hdcp;
+       bool content_protection_type_changed =
+               (conn_state->hdcp_content_type != hdcp->content_type &&
+                conn_state->content_protection !=
+                DRM_MODE_CONTENT_PROTECTION_UNDESIRED);
+
+       /*
+        * During the HDCP encryption session if Type change is requested,
+        * disable the HDCP and reenable it with new TYPE value.
+        */
+       if (conn_state->content_protection ==
+           DRM_MODE_CONTENT_PROTECTION_UNDESIRED ||
+           content_protection_type_changed)
+               intel_hdcp_disable(connector);
+
+       /*
+        * Mark the hdcp state as DESIRED after the hdcp disable of type
+        * change procedure.
+        */
+       if (content_protection_type_changed) {
+               mutex_lock(&hdcp->mutex);
+               hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
+               schedule_work(&hdcp->prop_work);
+               mutex_unlock(&hdcp->mutex);
+       }
+
+       if (conn_state->content_protection ==
+           DRM_MODE_CONTENT_PROTECTION_DESIRED ||
+           content_protection_type_changed)
+               intel_hdcp_enable(connector,
+                                 crtc_state->cpu_transcoder,
+                                 (u8)conn_state->hdcp_content_type);
+}
+
 void intel_hdcp_component_fini(struct drm_i915_private *dev_priv)
 {
        mutex_lock(&dev_priv->hdcp_comp_mutex);
index f3c3272e712a18a6fdb6e8cc255ca90d936a3073..1b2eacaf89490408075be728f9047a479ae660e1 100644 (file)
@@ -14,6 +14,8 @@ struct drm_connector;
 struct drm_connector_state;
 struct drm_i915_private;
 struct intel_connector;
+struct intel_crtc_state;
+struct intel_encoder;
 struct intel_hdcp_shim;
 enum port;
 enum transcoder;
@@ -26,6 +28,9 @@ int intel_hdcp_init(struct intel_connector *connector,
 int intel_hdcp_enable(struct intel_connector *connector,
                      enum transcoder cpu_transcoder, u8 content_type);
 int intel_hdcp_disable(struct intel_connector *connector);
+void intel_hdcp_update_pipe(struct intel_encoder *encoder,
+                           const struct intel_crtc_state *crtc_state,
+                           const struct drm_connector_state *conn_state);
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
 bool intel_hdcp_capable(struct intel_connector *connector);
 bool intel_hdcp2_capable(struct intel_connector *connector);