drm/i915/dp: clean up intel_dp_test.[ch] interface
authorJani Nikula <jani.nikula@intel.com>
Fri, 20 Sep 2024 11:56:46 +0000 (14:56 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 23 Sep 2024 06:54:16 +0000 (09:54 +0300)
Conform to uniform function naming. Use intel_dp. Hide checks on
intel_dp->compliance within intel_dp_test.[ch].

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c2905006d2d47040032153ca69052898529a95d5.1726833193.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/g4x_dp.c
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/i915/display/intel_dp_test.c
drivers/gpu/drm/i915/display/intel_dp_test.h

index ac9dce8..440fb30 100644 (file)
@@ -1169,12 +1169,8 @@ intel_dp_hotplug(struct intel_encoder *encoder,
        struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
        enum intel_hotplug_state state;
 
-       if (intel_dp->compliance.test_active &&
-           intel_dp->compliance.test_type == DP_TEST_LINK_PHY_TEST_PATTERN) {
-               intel_dp_phy_test(encoder);
-               /* just do the PHY test and nothing else */
+       if (intel_dp_test_phy(intel_dp))
                return INTEL_HOTPLUG_UNCHANGED;
-       }
 
        state = intel_encoder_hotplug(encoder, connector);
 
index c0ade28..fe1ded6 100644 (file)
@@ -4551,12 +4551,8 @@ intel_ddi_hotplug(struct intel_encoder *encoder,
        enum intel_hotplug_state state;
        int ret;
 
-       if (intel_dp->compliance.test_active &&
-           intel_dp->compliance.test_type == DP_TEST_LINK_PHY_TEST_PATTERN) {
-               intel_dp_phy_test(encoder);
-               /* just do the PHY test and nothing else */
+       if (intel_dp_test_phy(intel_dp))
                return INTEL_HOTPLUG_UNCHANGED;
-       }
 
        state = intel_encoder_hotplug(encoder, connector);
 
index 1cc73e2..38aeb33 100644 (file)
@@ -2455,7 +2455,7 @@ intel_dp_compute_config_limits(struct intel_dp *intel_dp,
                limits->min_rate = limits->max_rate;
        }
 
-       intel_dp_adjust_compliance_config(intel_dp, crtc_state, limits);
+       intel_dp_test_compute_config(intel_dp, crtc_state, limits);
 
        return intel_dp_compute_config_link_bpp_limits(intel_dp,
                                                       crtc_state,
@@ -5108,7 +5108,7 @@ static void intel_dp_check_device_service_irq(struct intel_dp *intel_dp)
        drm_dp_dpcd_writeb(&intel_dp->aux, DP_DEVICE_SERVICE_IRQ_VECTOR, val);
 
        if (val & DP_AUTOMATED_TEST_REQUEST)
-               intel_dp_handle_test_request(intel_dp);
+               intel_dp_test_request(intel_dp);
 
        if (val & DP_CP_IRQ)
                intel_hdcp_handle_cp_irq(intel_dp->attached_connector);
index c91e1e2..732d754 100644 (file)
@@ -542,7 +542,7 @@ intel_dp_mst_compute_config_limits(struct intel_dp *intel_dp,
         */
        limits->pipe.max_bpp = min(crtc_state->pipe_bpp, 24);
 
-       intel_dp_adjust_compliance_config(intel_dp, crtc_state, limits);
+       intel_dp_test_compute_config(intel_dp, crtc_state, limits);
 
        if (!intel_dp_compute_config_link_bpp_limits(intel_dp,
                                                     crtc_state,
index efdf25d..4608aa3 100644 (file)
@@ -16,8 +16,7 @@
 #include "intel_dp_test.h"
 
 /* Adjust link config limits based on compliance test requests. */
-void
-intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
+void intel_dp_test_compute_config(struct intel_dp *intel_dp,
                                  struct intel_crtc_state *pipe_config,
                                  struct link_config_limits *limits)
 {
@@ -339,7 +338,7 @@ static u8 intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)
        return DP_TEST_ACK;
 }
 
-void intel_dp_handle_test_request(struct intel_dp *intel_dp)
+void intel_dp_test_request(struct intel_dp *intel_dp)
 {
        struct intel_display *display = to_intel_display(intel_dp);
        u8 response = DP_TEST_NAK;
@@ -477,11 +476,17 @@ static int intel_dp_do_phy_test(struct intel_encoder *encoder,
        return 0;
 }
 
-void intel_dp_phy_test(struct intel_encoder *encoder)
+bool intel_dp_test_phy(struct intel_dp *intel_dp)
 {
+       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
+       struct intel_encoder *encoder = &dig_port->base;
        struct drm_modeset_acquire_ctx ctx;
        int ret;
 
+       if (!intel_dp->compliance.test_active ||
+           intel_dp->compliance.test_type != DP_TEST_LINK_PHY_TEST_PATTERN)
+               return false;
+
        drm_modeset_acquire_init(&ctx, 0);
 
        for (;;) {
@@ -499,4 +504,6 @@ void intel_dp_phy_test(struct intel_encoder *encoder)
        drm_modeset_acquire_fini(&ctx);
        drm_WARN(encoder->base.dev, ret,
                 "Acquiring modeset locks failed with %i\n", ret);
+
+       return true;
 }
index e865e6a..cfd3dcc 100644 (file)
@@ -4,15 +4,16 @@
 #ifndef __INTEL_DP_TEST_H__
 #define __INTEL_DP_TEST_H__
 
+#include <linux/types.h>
+
 struct intel_crtc_state;
 struct intel_dp;
-struct intel_encoder;
 struct link_config_limits;
 
-void intel_dp_handle_test_request(struct intel_dp *intel_dp);
-void intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
-                                      struct intel_crtc_state *pipe_config,
-                                      struct link_config_limits *limits);
-void intel_dp_phy_test(struct intel_encoder *encoder);
+void intel_dp_test_request(struct intel_dp *intel_dp);
+void intel_dp_test_compute_config(struct intel_dp *intel_dp,
+                                 struct intel_crtc_state *pipe_config,
+                                 struct link_config_limits *limits);
+bool intel_dp_test_phy(struct intel_dp *intel_dp);
 
 #endif /* __INTEL_DP_TEST_H__ */