]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/psr: Set frames before SU entry for psr2
authorvathsala nagaraju <vathsala.nagaraju@intel.com>
Tue, 26 Sep 2017 09:59:13 +0000 (15:29 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 28 Sep 2017 16:40:34 +0000 (09:40 -0700)
Set frames before SU entry value for max resync frame count of
dpcd register 2009, bit field 0:3.

v2 :
 - add macro  EDP_PSR2_FRAME_BEFORE_SU (Rodrigo)
 - remove EDP_FRAMES_BEFORE_SU_ENTRY (Rodrigo)
 - add check ==1 for dpcd_read call (ville)

v3 : (Rodrigo)
 - move macro EDP_PSR2_FRAME_BEFORE_SU after EDP_PSR2_FRAME_BEFORE_SU
 - replace with &=

v4 :
 - change the macro to shift value (jani)
 - updated register names

Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
CC: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Vathsala Nagaraju <vathsala.nagaraju@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1506419953-32605-2-git-send-email-vathsala.nagaraju@intel.com
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_psr.c

index e4c424ba59051efa03ac59c7a24457b902a76ac2..ee0d4f14ac98c07b6f4f4cdf7a42b948cb6e0553 100644 (file)
@@ -4055,7 +4055,7 @@ enum {
 #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
 #define   EDP_PSR2_FRAME_BEFORE_SU_MASK        (0xf<<4)
 #define   EDP_PSR2_IDLE_MASK           0xf
-#define   EDP_FRAMES_BEFORE_SU_ENTRY   (1<<4)
+#define   EDP_PSR2_FRAME_BEFORE_SU(a)  ((a)<<4)
 
 #define EDP_PSR2_STATUS_CTL            _MMIO(0x6f940)
 #define EDP_PSR2_STATUS_STATE_MASK     (0xf<<28)
index 0a17d1f3ca7710d74570ca3e7c3e96db96f9de8b..5419cda83ba8fdc3918a8caa6dfe856d51b1b92c 100644 (file)
@@ -327,6 +327,7 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
         */
        uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
        uint32_t val;
+       uint8_t sink_latency;
 
        val = idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
@@ -334,8 +335,16 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
         * mesh at all with our frontbuffer tracking. And the hw alone isn't
         * good enough. */
        val |= EDP_PSR2_ENABLE |
-               EDP_SU_TRACK_ENABLE |
-               EDP_FRAMES_BEFORE_SU_ENTRY;
+               EDP_SU_TRACK_ENABLE;
+
+       if (drm_dp_dpcd_readb(&intel_dp->aux,
+                               DP_SYNCHRONIZATION_LATENCY_IN_SINK,
+                               &sink_latency) == 1) {
+               sink_latency &= DP_MAX_RESYNC_FRAME_COUNT_MASK;
+       } else {
+               sink_latency = 0;
+       }
+       val |= EDP_PSR2_FRAME_BEFORE_SU(sink_latency + 1);
 
        if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
                val |= EDP_PSR2_TP2_TIME_2500;