From 9db22dae0e388c73516169ea5444145d68288120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Mon, 22 Apr 2013 17:01:14 +0300 Subject: [RFC][PATCH] drm/i915: Make data/link N value power of two MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BIOS uses power of two values for the data/link N value. Follow suit to make the Zotac DP to dual-HDMI dongle work. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49402 Signed-off-by: Ville Syrjälä --- Warning: I've only tested this with the Zotac dongle hooked to my 1080p Samsumg telly. Whether or not it works with other displays is an open question. drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 74156e2..fea9c99 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -4151,18 +4151,29 @@ intel_reduce_ratio(uint32_t *num, uint32_t *den) } } +static void compute_m_n(int m, int n, uint32_t *ret_m, uint32_t *ret_n) +{ + if (n >= 1 << 23) + *ret_n = 1 << 23; + else + *ret_n = roundup_pow_of_two(n); + *ret_m = div_u64((uint64_t) m * *ret_n, n); + intel_reduce_ratio(ret_m, ret_n); +} + void intel_link_compute_m_n(int bits_per_pixel, int nlanes, int pixel_clock, int link_clock, struct intel_link_m_n *m_n) { m_n->tu = 64; - m_n->gmch_m = bits_per_pixel * pixel_clock; - m_n->gmch_n = link_clock * nlanes * 8; - intel_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); - m_n->link_m = pixel_clock; - m_n->link_n = link_clock; - intel_reduce_ratio(&m_n->link_m, &m_n->link_n); + + compute_m_n(bits_per_pixel * pixel_clock, + link_clock * nlanes * 8, + &m_n->gmch_m, &m_n->gmch_n); + + compute_m_n(pixel_clock, link_clock, + &m_n->link_m, &m_n->link_n); } static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) -- 1.8.1.5