drm/i915: Extract intel_crtc_dotclock()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 4 May 2022 12:33:50 +0000 (15:33 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 14 Jun 2022 10:34:33 +0000 (13:34 +0300)
Extract intel_crtc_dotclock() from ddi_dotclock_get(). We'll reuse
this during state computation in order to determine the actual final
dotclcok after the DPLL computation has been done (which may not give
us the exact same port_clock that we fed in).

v2: Add the prototype

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504123350.13235-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display.h

index 132bf5a17d1572c8c4d750d2467f11644d7ac4d9..5d448e0563be470dcefdb1735c8e8405a5d81d76 100644 (file)
@@ -323,14 +323,10 @@ static int icl_calc_tbt_pll_link(struct drm_i915_private *dev_priv,
        }
 }
 
-static void ddi_dotclock_get(struct intel_crtc_state *pipe_config)
+int intel_crtc_dotclock(const struct intel_crtc_state *pipe_config)
 {
        int dotclock;
 
-       /* CRT dotclock is determined via other means */
-       if (pipe_config->has_pch_encoder)
-               return;
-
        if (intel_crtc_has_dp_encoder(pipe_config))
                dotclock = intel_dotclock_calculate(pipe_config->port_clock,
                                                    &pipe_config->dp_m_n);
@@ -346,7 +342,17 @@ static void ddi_dotclock_get(struct intel_crtc_state *pipe_config)
        if (pipe_config->pixel_multiplier)
                dotclock /= pipe_config->pixel_multiplier;
 
-       pipe_config->hw.adjusted_mode.crtc_clock = dotclock;
+       return dotclock;
+}
+
+static void ddi_dotclock_get(struct intel_crtc_state *pipe_config)
+{
+       /* CRT dotclock is determined via other means */
+       if (pipe_config->has_pch_encoder)
+               return;
+
+       pipe_config->hw.adjusted_mode.crtc_clock =
+               intel_crtc_dotclock(pipe_config);
 }
 
 void intel_ddi_set_dp_msa(const struct intel_crtc_state *crtc_state,
index 187910d94ec65db2425619cc707f28486557b0a0..7af6b5a413dc0258f849625cba5df91920330793 100644 (file)
@@ -635,6 +635,7 @@ void intel_cpu_transcoder_get_m2_n2(struct intel_crtc *crtc,
 void i9xx_crtc_clock_get(struct intel_crtc *crtc,
                         struct intel_crtc_state *pipe_config);
 int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
+int intel_crtc_dotclock(const struct intel_crtc_state *pipe_config);
 enum intel_display_power_domain intel_port_to_power_domain(struct intel_digital_port *dig_port);
 enum intel_display_power_domain
 intel_aux_power_domain(struct intel_digital_port *dig_port);