drm/i915/alpm: Add intel_psr_need_alpm() to simplify alpm check
authorAnimesh Manna <animesh.manna@intel.com>
Wed, 23 Apr 2025 09:23:33 +0000 (14:53 +0530)
committerAnimesh Manna <animesh.manna@intel.com>
Thu, 24 Apr 2025 08:25:08 +0000 (13:55 +0530)
Simplify the alpm check which will be used multiple places like
source configuration, sink enablement etc.

Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/20250423092334.2294483-11-animesh.manna@intel.com
drivers/gpu/drm/i915/display/intel_alpm.c
drivers/gpu/drm/i915/display/intel_psr.c
drivers/gpu/drm/i915/display/intel_psr.h

index 24b666e6d8f9b9a4d9276aa80bb8383eca22d3fd..c4b6da2e6ccf61a52f7a2ef98b405e173fa1c180 100644 (file)
@@ -13,6 +13,7 @@
 #include "intel_display_types.h"
 #include "intel_dp.h"
 #include "intel_dp_aux.h"
+#include "intel_psr.h"
 #include "intel_psr_regs.h"
 
 bool intel_alpm_aux_wake_supported(struct intel_dp *intel_dp)
@@ -331,8 +332,8 @@ static void lnl_alpm_configure(struct intel_dp *intel_dp,
        enum port port = dp_to_dig_port(intel_dp)->base.port;
        u32 alpm_ctl;
 
-       if (DISPLAY_VER(display) < 20 ||
-           (!crtc_state->has_sel_update && !intel_dp_is_edp(intel_dp)))
+       if (DISPLAY_VER(display) < 20 || (!intel_psr_needs_alpm(intel_dp, crtc_state) &&
+                                         !crtc_state->has_lobf))
                return;
 
        mutex_lock(&intel_dp->alpm_parameters.lock);
index a6b925d2b7b44a14dad3a1b4e80228a65e6a0b24..53366663b58b96ca8a5c54e34559a1badcecd487 100644 (file)
@@ -4192,3 +4192,9 @@ void intel_psr_connector_debugfs_add(struct intel_connector *connector)
                debugfs_create_file("i915_psr_status", 0444, root,
                                    connector, &i915_psr_status_fops);
 }
+
+bool intel_psr_needs_alpm(struct intel_dp *intel_dp, const struct intel_crtc_state *crtc_state)
+{
+       return intel_dp_is_edp(intel_dp) && (crtc_state->has_sel_update ||
+                                            crtc_state->has_panel_replay);
+}
index c61384bb7382abae00eb6c570dda1fe1ce4b1d7a..601e47ad3297342900d8f44a585e1ded29536c69 100644 (file)
@@ -75,5 +75,6 @@ void intel_psr_trigger_frame_change_event(struct intel_dsb *dsb,
                                          struct intel_crtc *crtc);
 void intel_psr_connector_debugfs_add(struct intel_connector *connector);
 void intel_psr_debugfs_register(struct intel_display *display);
+bool intel_psr_needs_alpm(struct intel_dp *intel_dp, const struct intel_crtc_state *crtc_state);
 
 #endif /* __INTEL_PSR_H__ */