From f4507f987c4cbac5803574668c3246d90b8a19c1 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Thu, 24 Apr 2025 23:01:40 +0300 Subject: [PATCH] drm/i915/hdcp: simplify HDCP GSC firmware usage selection Just localize the GSC decision inside intel_hdcp.c, and deduplicate the conditions. Cc: Suraj Kandpal Reviewed-by: Suraj Kandpal Link: https://lore.kernel.org/r/a1d031bfbff7073e576dfe8d3d3d5a28d7bb2c15.1745524803.git.jani.nikula@intel.com Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++++---- drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 5 ----- drivers/gpu/drm/i915/display/intel_hdcp_gsc.h | 1 - drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 5 ----- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 4857685c4020..39bcf8f3d810 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -32,6 +32,8 @@ #include "intel_hdcp_shim.h" #include "intel_pcode.h" +#define USE_HDCP_GSC(__display) (DISPLAY_VER(__display) >= 14) + #define KEY_LOAD_TRIES 5 #define HDCP2_LC_RETRY_CNT 3 @@ -251,7 +253,7 @@ static bool intel_hdcp2_prerequisite(struct intel_connector *connector) return false; /* If MTL+ make sure gsc is loaded and proxy is setup */ - if (intel_hdcp_gsc_cs_required(display)) { + if (USE_HDCP_GSC(display)) { if (!intel_hdcp_gsc_check_status(display)) return false; } @@ -2340,7 +2342,7 @@ static int initialize_hdcp_port_data(struct intel_connector *connector, static bool is_hdcp2_supported(struct intel_display *display) { - if (intel_hdcp_gsc_cs_required(display)) + if (USE_HDCP_GSC(display)) return true; if (!IS_ENABLED(CONFIG_INTEL_MEI_HDCP)) @@ -2364,7 +2366,7 @@ void intel_hdcp_component_init(struct intel_display *display) display->hdcp.comp_added = true; mutex_unlock(&display->hdcp.hdcp_mutex); - if (intel_hdcp_gsc_cs_required(display)) + if (USE_HDCP_GSC(display)) ret = intel_hdcp_gsc_init(display); else ret = component_add_typed(display->drm->dev, &i915_hdcp_ops, @@ -2639,7 +2641,7 @@ void intel_hdcp_component_fini(struct intel_display *display) display->hdcp.comp_added = false; mutex_unlock(&display->hdcp.hdcp_mutex); - if (intel_hdcp_gsc_cs_required(display)) + if (USE_HDCP_GSC(display)) intel_hdcp_gsc_fini(display); else component_del(display->drm->dev, &i915_hdcp_ops); diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c index 1ea2c7204444..4194ef77f7c3 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.c @@ -19,11 +19,6 @@ struct intel_hdcp_gsc_context { void *hdcp_cmd_out; }; -bool intel_hdcp_gsc_cs_required(struct intel_display *display) -{ - return DISPLAY_VER(display) >= 14; -} - bool intel_hdcp_gsc_check_status(struct intel_display *display) { struct drm_i915_private *i915 = to_i915(display->drm); diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h index fbef56db54f2..e963c1fcc39e 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +++ b/drivers/gpu/drm/i915/display/intel_hdcp_gsc.h @@ -12,7 +12,6 @@ struct intel_display; struct intel_hdcp_gsc_context; -bool intel_hdcp_gsc_cs_required(struct intel_display *display); ssize_t intel_hdcp_gsc_msg_send(struct intel_hdcp_gsc_context *gsc_context, void *msg_in, size_t msg_in_len, void *msg_out, size_t msg_out_len); diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c index 7712d53627f0..078916072c10 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -30,11 +30,6 @@ struct intel_hdcp_gsc_context { #define HDCP_GSC_HEADER_SIZE sizeof(struct intel_gsc_mtl_header) -bool intel_hdcp_gsc_cs_required(struct intel_display *display) -{ - return DISPLAY_VER(display) >= 14; -} - bool intel_hdcp_gsc_check_status(struct intel_display *display) { struct xe_device *xe = to_xe_device(display->drm); -- 2.50.1