Introduce helpers to program or disable CMN_SDP_TL and stagger registers
using the state stored in crtc_state.

Signed-off-by: Ankit Nautiyal <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_dp.c | 29 +++++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_dp.h |  2 ++
 2 files changed, 31 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c 
b/drivers/gpu/drm/i915/display/intel_dp.c
index 9204a813639a..59a8fa5e5ba9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -7317,3 +7317,32 @@ void 
intel_dp_cmn_sdp_transmission_line_get_config(struct intel_crtc_state *crtc
        crtc_state->cmn_sdp_tl.pps_stagger = REG_FIELD_GET(PPS_STAGGER_MASK, 
val);
        crtc_state->cmn_sdp_tl.gmp_stagger = REG_FIELD_GET(GMP_STAGGER_MASK, 
val);
 }
+
+void intel_dp_cmn_sdp_transmission_line_enable(const struct intel_crtc_state 
*crtc_state)
+{
+       struct intel_display *display = to_intel_display(crtc_state);
+       enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
+
+       if (!crtc_state->cmn_sdp_tl.enable)
+               return;
+
+       intel_de_write(display, CMN_SDP_TL_STGR_CTL(display, cpu_transcoder),
+                      GMP_STAGGER(crtc_state->cmn_sdp_tl.gmp_stagger) |
+                      PPS_STAGGER(crtc_state->cmn_sdp_tl.pps_stagger) |
+                      VSC_EXT_STAGGER(crtc_state->cmn_sdp_tl.vsc_ext_stagger));
+
+       intel_de_write(display, CMN_SDP_TL(display, cpu_transcoder),
+                      TRANSMISSION_LINE_ENABLE |
+                      
BASE_TRANSMISSION_LINE(crtc_state->cmn_sdp_tl.transmission_line));
+}
+
+void intel_dp_cmn_sdp_transmission_line_disable(const struct intel_crtc_state 
*old_crtc_state)
+{
+       struct intel_display *display = to_intel_display(old_crtc_state);
+       enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
+
+       if (!old_crtc_state->cmn_sdp_tl.enable)
+               return;
+
+       intel_de_write(display, CMN_SDP_TL(display, cpu_transcoder), 0);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_dp.h 
b/drivers/gpu/drm/i915/display/intel_dp.h
index abb2fcdea352..ace7d142182f 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.h
+++ b/drivers/gpu/drm/i915/display/intel_dp.h
@@ -239,5 +239,7 @@ bool intel_dp_joiner_candidate_valid(struct intel_connector 
*connector,
 
 int intel_dp_emp_as_sdp_tl(const struct intel_crtc_state *crtc_state);
 void intel_dp_cmn_sdp_transmission_line_get_config(struct intel_crtc_state 
*crtc_state);
+void intel_dp_cmn_sdp_transmission_line_enable(const struct intel_crtc_state 
*crtc_state);
+void intel_dp_cmn_sdp_transmission_line_disable(const struct intel_crtc_state 
*old_crtc_state);
 
 #endif /* __INTEL_DP_H__ */
-- 
2.45.2

Reply via email to