From: Ankit Nautiyal <[email protected]>

Introduce intel_display_compute_link_m_n() to compute the link M/N ratio
from the pixel clock and the link symbol clock. This logic was
previously embedded within intel_link_compute_m_n().
The new helper allows reuse of link M/N computation in other contexts
without requiring the full data M/N calculation and will be used in
later commits.

No functional changes intended.

v2:
- Rename function (Jani)
- The link symbol clock is passed in rather than derived here, so that the
DP specific conversion from the link rate stays with the caller. (Jani)

Signed-off-by: Ankit Nautiyal <[email protected]>
Co-developed-by: Suraj Kandpal <[email protected]>
Signed-off-by: Suraj Kandpal <[email protected]>
Reviewed-by: Mitul Golani <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_display.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 7602f633f49d..580c36a52921 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2650,13 +2650,20 @@ static void compute_m_n(u32 *ret_m, u32 *ret_n,
        intel_reduce_m_n_ratio(ret_m, ret_n);
 }
 
+static void intel_display_compute_link_m_n(u32 *link_m, u32 *link_n,
+                                          int pixel_clock, int 
link_symbol_clock)
+{
+       compute_m_n(link_m, link_n,
+                   pixel_clock, link_symbol_clock,
+                   0x80000);
+}
+
 void
 intel_link_compute_m_n(u16 bits_per_pixel_x16, int nlanes,
                       int pixel_clock, int link_clock,
                       int bw_overhead,
                       struct intel_link_m_n *m_n)
 {
-       u32 link_symbol_clock = intel_dp_link_symbol_clock(link_clock);
        u32 data_m = intel_dp_effective_data_rate(pixel_clock, 
bits_per_pixel_x16,
                                                  bw_overhead);
        u32 data_n = drm_dp_max_dprx_data_rate(link_clock, nlanes);
@@ -2673,9 +2680,9 @@ intel_link_compute_m_n(u16 bits_per_pixel_x16, int nlanes,
                    data_m, data_n,
                    0x8000000);
 
-       compute_m_n(&m_n->link_m, &m_n->link_n,
-                   pixel_clock, link_symbol_clock,
-                   0x80000);
+       intel_display_compute_link_m_n(&m_n->link_m, &m_n->link_n,
+                                      pixel_clock,
+                                      intel_dp_link_symbol_clock(link_clock));
 }
 
 void intel_panel_sanitize_ssc(struct intel_display *display)
-- 
2.34.1

Reply via email to