Add support for half LFPS cycle calculation for DP2.1 ALPM as dependent
parameters got changed.

v1: Initial version.
v2: Avoid returning early. [Jani]
v3: Use intel_crtc_has_type(). [Suraj]

Cc: Jouni Högander <[email protected]>
Signed-off-by: Animesh Manna <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_alpm.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_alpm.c 
b/drivers/gpu/drm/i915/display/intel_alpm.c
index 81472254ab73..33620f95ecc5 100644
--- a/drivers/gpu/drm/i915/display/intel_alpm.c
+++ b/drivers/gpu/drm/i915/display/intel_alpm.c
@@ -73,12 +73,20 @@ static int get_silence_period_symbols(const struct 
intel_crtc_state *crtc_state)
 static void get_lfps_cycle_min_max_time(const struct intel_crtc_state 
*crtc_state,
                                        int *min, int *max)
 {
-       if (crtc_state->port_clock < 540000) {
-               *min = 65 * LFPS_CYCLE_COUNT;
-               *max = 75 * LFPS_CYCLE_COUNT;
+       struct intel_display *display = to_intel_display(crtc_state);
+
+       if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP)) {
+               if (crtc_state->port_clock < 540000) {
+                       *min = DISPLAY_VER(display) < 35 ? 65 * 
LFPS_CYCLE_COUNT : 140;
+                       *max = DISPLAY_VER(display) < 35 ? 75 * 
LFPS_CYCLE_COUNT : 800;
+               } else {
+                       *min = 140;
+                       *max = 800;
+               }
        } else {
-               *min = 140;
-               *max = 800;
+               *min = 320;
+               *max = 1600;
+               return;
        }
 }
 
-- 
2.29.0

Reply via email to