[PATCH 43/43] drm/i915: Invoke check link on CP_IRQ of DP

Ramalingam C
2018-02-14T14:21:28Z

On DP HDCP1.4 and 2.2, when CP_IRQ is received, start the link
integrity check for the HDCP version that is enabled.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
drivers/gpu/drm/i915/intel_dp.c | 9 +++------
drivers/gpu/drm/i915/intel_drv.h | 2 +-
drivers/gpu/drm/i915/intel_hdcp.c | 11 ++++++++++-
3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index ec929b1ff0ae..46e1a0cce2d5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4438,8 +4438,10 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
intel_dp_handle_test_request(intel_dp);
if (sink_irq_vector & DP_CP_IRQ) {
- if (connector->hdcp)
+ if (connector->hdcp) {
+ intel_hdcp_cp_irq_received(connector);
complete(&connector->hdcp->cp_irq_recved);
+ }
}

if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
@@ -5799,11 +5801,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
drm_modeset_acquire_fini(&ctx);
WARN(iret, "Acquiring modeset locks failed with %i\n", iret);

- /* Short pulse can signify loss of hdcp authentication */
- if (intel_dp->attached_connector->hdcp)
- intel_hdcp_check_link(
- intel_dp->attached_connector->hdcp);
-
if (!handled) {
intel_dp->detect_done = false;
goto put_power;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 842a22502763..4b5fd92c115e 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1954,8 +1954,8 @@ int intel_hdcp_init(struct intel_connector *connector,
const struct intel_hdcp2_shim *hdcp2_shim);
int intel_hdcp_enable(struct intel_connector *connector);
int intel_hdcp_disable(struct intel_connector *connector);
-int intel_hdcp_check_link(struct intel_hdcp *hdcp);
bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
+void intel_hdcp_cp_irq_received(struct intel_connector *connector);

/* intel_psr.c */
#define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c b/drivers/gpu/drm/i915/intel_hdcp.c
index bb56e4e595d8..ab482082c5e4 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -27,6 +27,7 @@ static int _intel_hdcp2_disable(struct intel_hdcp *hdcp);
static void intel_hdcp2_check_work(struct work_struct *work);
static int intel_hdcp2_check_link(struct intel_hdcp *hdcp);
static void intel_hdcp2_exit(struct intel_connector *connector);
+static int intel_hdcp_check_link(struct intel_hdcp *hdcp);

static inline bool intel_hdcp1_supported(struct intel_hdcp *hdcp)
{
@@ -1024,7 +1025,7 @@ void intel_hdcp_atomic_check(struct drm_connector *connector,
}

/* Implements Part 3 of the HDCP authorization procedure */
-int intel_hdcp_check_link(struct intel_hdcp *hdcp)
+static int intel_hdcp_check_link(struct intel_hdcp *hdcp)
{
struct intel_connector *connector = hdcp->connector;
struct drm_i915_private *dev_priv = connector->base.dev->dev_private;
@@ -1789,3 +1790,11 @@ static int intel_hdcp2_check_link(struct intel_hdcp *hdcp)
mutex_unlock(&hdcp->hdcp_mutex);
return ret;
}
+
+void intel_hdcp_cp_irq_received(struct intel_connector *connector)
+{
+ if (intel_hdcp_in_force(connector->hdcp))
+ intel_hdcp_check_link(connector->hdcp);
+ else if (intel_hdcp2_in_force(connector->hdcp))
+ intel_hdcp2_check_link(connector->hdcp);
+}