Skip to contentSkip to conversation

drm/i915: Detect USB-C specific dongles before reducing M and N

PATCH In review [email protected] 5 participants 8 messages May 10, 2017 – May 11, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Detect USB-C specific dongles before reducing M and N

From: Clint Taylor <[email protected]>

The Analogix 7737 DP to HDMI converter requires reduced N and M values when to operate correctly at HBR2. Detect this IC by its OUI value of 0x0022B9.

Cc Jani Nikula <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h      |  3 ++-
 drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++++++--------
 drivers/gpu/drm/i915/intel_dp.c      | 22 ++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_mst.c  |  3 ++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 5 files changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 74dffbe..492e47e 100644
@@ -563,7 +563,8 @@ struct intel_link_m_n {
 
 void intel_link_compute_m_n(int bpp, int nlanes,
 			    int pixel_clock, int link_clock,
-			    struct intel_link_m_n *m_n);
+			    struct intel_link_m_n *m_n,
+				bool reduce_m_n);
 
 /* Interface history:
  *
drivers/gpu/drm/i915/intel_display.c +14 -8
index 7bcc604..8920a99 100644
@@ -6104,7 +6104,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
 	pipe_config->fdi_lanes = lane;
 
 	intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,
-			       link_bw, &pipe_config->fdi_m_n);
+			       link_bw, &pipe_config->fdi_m_n, false);
 
 	ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);
 	if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {
@@ -6280,7 +6280,8 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
 }
 
 static void compute_m_n(unsigned int m, unsigned int n,
-			uint32_t *ret_m, uint32_t *ret_n)
+			uint32_t *ret_m, uint32_t *ret_n,
+			   bool reduce_m_n)
 {
 	/*
 	 * Reduce M/N as much as possible without loss in precision. Several DP
@@ -6288,9 +6289,11 @@ static void compute_m_n(unsigned int m, unsigned int n,
 	 * values. The passed in values are more likely to have the least
 	 * significant bits zero than M after rounding below, so do this first.
 	 */
-	while ((m & 1) == 0 && (n & 1) == 0) {
-		m >>= 1;
-		n >>= 1;
+	if (reduce_m_n) {
+		while ((m & 1) == 0 && (n & 1) == 0) {
+			m >>= 1;
+			n >>= 1;
+		}
 	}
 
 	*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
@@ -6301,16 +6304,19 @@ static void compute_m_n(unsigned int m, unsigned int 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)
+		       struct intel_link_m_n *m_n,
+			  bool reduce_m_n)
 {
 	m_n->tu = 64;
 
 	compute_m_n(bits_per_pixel * pixel_clock,
 		    link_clock * nlanes * 8,
-		    &m_n->gmch_m, &m_n->gmch_n);
+		    &m_n->gmch_m, &m_n->gmch_n,
+		    reduce_m_n);
 
 	compute_m_n(pixel_clock, link_clock,
-		    &m_n->link_m, &m_n->link_n);
+		    &m_n->link_m, &m_n->link_n,
+		    reduce_m_n);
 }
 
 static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_dp.c +20 -2
index 4a6feb6..f4c0582 100644
@@ -1548,6 +1548,20 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("common rates: %s\n", str);
 }
 
+bool __intel_reduced_m_n(struct intel_dp *intel_dp)
+{
+	struct intel_dp_desc *desc = &intel_dp->desc;
+	bool ret = false;
+
+	/* Analogix 7737 needs reduced N and M at HBR2 link rates */
+	if (desc->oui[0] == 0x00 &&
+	    desc->oui[1] == 0x22 &&
+	    desc->oui[2] == 0xb9)
+		ret = true;
+
+	return ret;
+}
+
 bool
 __intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
 {
@@ -1568,6 +1582,8 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
 	if (!__intel_dp_read_desc(intel_dp, desc))
 		return false;
 
+	intel_dp->reduce_m_n = __intel_reduced_m_n(intel_dp);
+
 	dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
 	DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
 		      drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink",
@@ -1790,7 +1806,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	if (intel_connector->panel.downclock_mode != NULL &&
 		dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -1798,7 +1815,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 			intel_link_compute_m_n(bpp, lane_count,
 				intel_connector->panel.downclock_mode->clock,
 				pipe_config->port_clock,
-				&pipe_config->dp_m2_n2);
+				&pipe_config->dp_m2_n2,
+				intel_dp->reduce_m_n);
 	}
 
 	/*
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
index 68c788e..81fd8dc 100644
@@ -79,7 +79,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	pipe_config->dp_m_n.tu = slots;
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index e8de2f67..50e5077 100644
@@ -1057,6 +1057,7 @@ struct intel_dp {
 
 	/* Displayport compliance testing */
 	struct intel_dp_compliance compliance;
+	bool reduce_m_n;
 };
 
 struct intel_lspcon {
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

== Series Details ==

== Series Details ==

Series: drm/i915: Detect USB-C specific dongles before reducing M and N
URL : https://patchwork.freedesktop.org/series/24254/
State : failure

== Summary ==

Series 24254v1 drm/i915: Detect USB-C specific dongles before reducing M and N
https://patchwork.freedesktop.org/api/1.0/series/24254/revisions/1/mbox/

Test gem_busy:

        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-elk-e7500) fdo#100942 +1
Test gem_close_race:
        Subgroup basic-process:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-threads:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_basic:
        Subgroup basic-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-render:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-render:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-render:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_create:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_fence:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wait-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-await-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup nb-await-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-batch-kernel-default-wb:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-pro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-prw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-ro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-rw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-set-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-pro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-prw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-ro-before-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-ro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-rw-before-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-rw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-set-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_gttfill:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_nop:
        Subgroup basic-parallel:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-series:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_parallel:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_reloc:
        Subgroup basic-cpu:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-cpu-gtt:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt-cpu:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-cpu-read:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt-read:

WARNING: Long output truncated

4149c7b22164d81960dae0987f497725117b68e6 drm-tip: 2017y-05m-10d-18h-09m-15s UTC integration manifest 024dd61 drm/i915: Detect USB-C specific dongles before reducing M and N

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4664/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

HI,

Quoted 16 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Patchwork
Sent: Thursday, May 11, 2017 12:55 AM
To: Taylor, Clinton A <[email protected]>
Cc: [email protected]
Subject: [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

== Series Details ==

Series: drm/i915: Detect USB-C specific dongles before reducing M and N
URL : https://patchwork.freedesktop.org/series/24254/
State : failure

== Summary ==

Quoted 7 lines

Series 24254v1 drm/i915: Detect USB-C specific dongles before reducing M and N
https://patchwork.freedesktop.org/api/1.0/series/24254/revisions/1/mbox/

Test gem_busy:

        Subgroup basic-hang-default:
                pass       -> DMESG-WARN (fi-elk-e7500) fdo#100942 +1

I suppose unstability of ELK causing rest to skip too.

Quoted 96 lines

Test gem_close_race:

        Subgroup basic-process:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-threads:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_cpu_reloc:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_cs_tlb:
        Subgroup basic-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_basic:
        Subgroup basic-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-render:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup gtt-render:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-bsd:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup readonly-render:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_create:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_fence:
        Subgroup basic-busy-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wait-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-await-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup nb-await-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-batch-kernel-default-wb:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-pro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-prw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-ro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-rw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-uc-set-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-pro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-prw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-ro-before-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-ro-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-rw-before-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-rw-default:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-wb-set-default:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_gttfill:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_nop:
        Subgroup basic-parallel:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-series:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_parallel:
        Subgroup basic:
                pass       -> SKIP       (fi-elk-e7500)
Test gem_exec_reloc:
        Subgroup basic-cpu:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-cpu-gtt:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt-cpu:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-cpu-read:
                pass       -> SKIP       (fi-elk-e7500)
        Subgroup basic-gtt-read:

WARNING: Long output truncated

Quoted 7 lines

4149c7b22164d81960dae0987f497725117b68e6 drm-tip: 2017y-05m-10d-18h- 09m-15s UTC integration manifest
024dd61 drm/i915: Detect USB-C specific dongles before reducing M and N

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4664/

Jani Saarinen
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to [email protected]
Quoted 5 lines · On Wed, 2017-05-10 at 14:32 -0700, [email protected] wrote:

From: Clint Taylor <[email protected]>

The Analogix 7737 DP to HDMI converter requires reduced N and M values when to operate correctly at HBR2. Detect this IC by its OUI value of 0x0022B9.

I like this approach because it does not change the link m/n values for sinks that were working before "drm/i915/dp: reduce link M/N parameters" and works around the dongle issue too.

The other option is to add a quirk for the sink in
(https://bugs.freedesktop.org/show_bug.cgi?id=100755) instead of this patch.

Assuming we go with this approach, I have added some review comments.

We need the patch to refer to
1) "commit 9a86cda drm/i915/dp: reduce link M/N parameters"
2) https://bugs.freedesktop.org/show_bug.cgi?id=93578
3) https://bugs.freedesktop.org/show_bug.cgi?id=100755

Fixes and Bugzilla tags perhaps.

Quoted 50 lines
Cc Jani Nikula <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h      |  3 ++-
 drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++++++--------
 drivers/gpu/drm/i915/intel_dp.c      | 22 ++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_mst.c  |  3 ++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 5 files changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 74dffbe..492e47e 100644
@@ -563,7 +563,8 @@ struct intel_link_m_n {
 
 void intel_link_compute_m_n(int bpp, int nlanes,
 			    int pixel_clock, int link_clock,
-			    struct intel_link_m_n *m_n);
+			    struct intel_link_m_n *m_n,
+				bool reduce_m_n);
 
 /* Interface history:
  *
drivers/gpu/drm/i915/intel_display.c +3 -2
index 7bcc604..8920a99 100644
@@ -6104,7 +6104,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
 	pipe_config->fdi_lanes = lane;
 
 	intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,
-			       link_bw, &pipe_config->fdi_m_n);
+			       link_bw, &pipe_config->fdi_m_n, false);
 
 	ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);
 	if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {
@@ -6280,7 +6280,8 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
 }
 
 static void compute_m_n(unsigned int m, unsigned int n,
-			uint32_t *ret_m, uint32_t *ret_n)
+			uint32_t *ret_m, uint32_t *ret_n,
+			   bool reduce_m_n)
 {
 	/*
 	 * Reduce M/N as much as possible without loss in precision. Several DP

drivers/gpu/drm/i915/intel_display.c static void compute_m_n(unsigned int m, unsigned int n, · line 6293

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +2 -3
@@ -6288,9 +6289,11 @@ static void compute_m_n(unsigned int m, unsigned int n,
 	 * values. The passed in values are more likely to have the least
 	 * significant bits zero than M after rounding below, so do this first.
 	 */
-	while ((m & 1) == 0 && (n & 1) == 0) {
-		m >>= 1;
-		n >>= 1;
+	if (reduce_m_n) {
+		while ((m & 1) == 0 && (n & 1) == 0) {

Can't we get away with reducing just 1 bit here?

Quoted 34 lines
drivers/gpu/drm/i915/intel_display.c +9 -3
+			m >>= 1;
+			n >>= 1;
+		}
 	}
 
 	*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
@@ -6301,16 +6304,19 @@ static void compute_m_n(unsigned int m, unsigned int 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)
+		       struct intel_link_m_n *m_n,
+			  bool reduce_m_n)
 {
 	m_n->tu = 64;
 
 	compute_m_n(bits_per_pixel * pixel_clock,
 		    link_clock * nlanes * 8,
-		    &m_n->gmch_m, &m_n->gmch_n);
+		    &m_n->gmch_m, &m_n->gmch_n,
+		    reduce_m_n);
 
 	compute_m_n(pixel_clock, link_clock,
-		    &m_n->link_m, &m_n->link_n);
+		    &m_n->link_m, &m_n->link_n,
+		    reduce_m_n);
 }
 
 static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 4a6feb6..f4c0582 100644

drivers/gpu/drm/i915/intel_dp.c static void intel_dp_print_rates(struct intel_dp *intel_dp) · line 1551

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -1548,6 +1548,20 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("common rates: %s\n", str);
 }
 
+bool __intel_reduced_m_n(struct intel_dp *intel_dp)

dp_branch_needs_reduced_m_n() ? The naming fits the question-like format for bool returning functions.

Quoted 17 lines
drivers/gpu/drm/i915/intel_dp.c +13 -0
+{
+	struct intel_dp_desc *desc = &intel_dp->desc;
+	bool ret = false;
+
+	/* Analogix 7737 needs reduced N and M at HBR2 link rates */
+	if (desc->oui[0] == 0x00 &&
+	    desc->oui[1] == 0x22 &&
+	    desc->oui[2] == 0xb9)
+		ret = true;
+
+	return ret;
+}
+
 bool
 __intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
 {

drivers/gpu/drm/i915/intel_dp.c bool intel_dp_read_desc(struct intel_dp *intel_dp) · line 1585

Quoted 4 lines
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -1568,6 +1582,8 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
 	if (!__intel_dp_read_desc(intel_dp, desc))
 		return false;
 
+	intel_dp->reduce_m_n = __intel_reduced_m_n(intel_dp);

As you are setting intel_dp->reduce_m_n in the caller, why not just pass intel_dp_desc? The function could just be an inline

	return 	(desc->oui[0] == 0x00 &&
		 desc->oui[1] == 0x22 &&
		 desc->oui[2] == 0xb9)

How about restricting this workaround with a drm_dp_is_branch() ?

Quoted 43 lines
drivers/gpu/drm/i915/intel_dp.c +5 -2
+
 	dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
 	DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
 		      drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink",
@@ -1790,7 +1806,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	if (intel_connector->panel.downclock_mode != NULL &&
 		dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -1798,7 +1815,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 			intel_link_compute_m_n(bpp, lane_count,
 				intel_connector->panel.downclock_mode->clock,
 				pipe_config->port_clock,
-				&pipe_config->dp_m2_n2);
+				&pipe_config->dp_m2_n2,
+				intel_dp->reduce_m_n);
 	}
 
 	/*
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
index 68c788e..81fd8dc 100644
@@ -79,7 +79,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	pipe_config->dp_m_n.tu = slots;
 
drivers/gpu/drm/i915/intel_drv.h +0 -0
index e8de2f67..50e5077 100644

drivers/gpu/drm/i915/intel_drv.h struct intel_dp { · line 1063

Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1057,6 +1057,7 @@ struct intel_dp {
 
 	/* Displayport compliance testing */
 	struct intel_dp_compliance compliance;
+	bool reduce_m_n;
 };
 
 struct intel_lspcon {

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

In reply to [email protected]
== Series Details ==

== Series Details ==

Series: drm/i915: Detect USB-C specific dongles before reducing M and N
URL : https://patchwork.freedesktop.org/series/24254/
State : failure

== Summary ==

Series 24254v1 drm/i915: Detect USB-C specific dongles before reducing M and N
https://patchwork.freedesktop.org/api/1.0/series/24254/revisions/1/mbox/

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-7560u) fdo#100125
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> INCOMPLETE (fi-bxt-t5700)

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:443s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:439s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:581s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:515s
fi-bxt-t5700     total:209  pass:195  dwarn:0   dfail:0   fail:0   skip:13 
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:483s
fi-elk-e7500     total:278  pass:229  dwarn:0   dfail:0   fail:0   skip:49  time:432s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:415s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:423s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:487s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:476s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:462s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:580s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:459s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:577s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:471s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:503s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:438s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:541s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:408s

4149c7b22164d81960dae0987f497725117b68e6 drm-tip: 2017y-05m-10d-18h-09m-15s UTC integration manifest d1b8be1 drm/i915: Detect USB-C specific dongles before reducing M and N

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4668/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

Hi,

Quoted 21 lines

-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Patchwork
Sent: Thursday, May 11, 2017 9:06 AM
To: Taylor, Clinton A <[email protected]>
Cc: [email protected]
Subject: [Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915: Detect USB-C specific dongles before reducing M and N

== Series Details ==

Series: drm/i915: Detect USB-C specific dongles before reducing M and N
URL : https://patchwork.freedesktop.org/series/24254/
State : failure

== Summary ==

Series 24254v1 drm/i915: Detect USB-C specific dongles before reducing M and N
https://patchwork.freedesktop.org/api/1.0/series/24254/revisions/1/mbox/

Quoted 6 lines

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                dmesg-warn -> PASS       (fi-kbl-7560u) fdo#100125
Test kms_flip:
        Subgroup basic-flip-vs-wf_vblank:
                pass       -> INCOMPLETE (fi-bxt-t5700)

Re-run this to see if ELK was happy now as it was. But now Joule is not.

Quoted 26 lines

fdo#100125 https://bugs.freedesktop.org/show_bug.cgi?id=100125

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:443s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:439s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:581s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:515s
fi-bxt-t5700     total:209  pass:195  dwarn:0   dfail:0   fail:0   skip:13
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:492s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:483s
fi-elk-e7500     total:278  pass:229  dwarn:0   dfail:0   fail:0   skip:49  time:432s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:415s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:423s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:487s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:476s
fi-kbl-7500u     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:462s
fi-kbl-7560u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:580s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:459s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time:577s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:471s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:503s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:438s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:541s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time:408s
Quoted 7 lines

4149c7b22164d81960dae0987f497725117b68e6 drm-tip: 2017y-05m-10d-18h- 09m-15s UTC integration manifest
d1b8be1 drm/i915: Detect USB-C specific dongles before reducing M and N

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4668/

Jani Saarinen
Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
In reply to [email protected]
Quoted 4 lines · On Wed, 10 May 2017, [email protected] wrote:

From: Clint Taylor <[email protected]>

The Analogix 7737 DP to HDMI converter requires reduced N and M values when to operate correctly at HBR2. Detect this IC by its OUI value of 0x0022B9.

I'm not happy, but I also see no alternative than to go this route. Thanks for the patch. I do think we need to start a common drm quirk database for this stuff though. Added one, and rebased this one on top:

https://patchwork.freedesktop.org/series/24282/

Please give it a go; I don't have a DA200.

BR,
Jani.

Quoted 168 lines
Cc Jani Nikula <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h      |  3 ++-
 drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++++++--------
 drivers/gpu/drm/i915/intel_dp.c      | 22 ++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_dp_mst.c  |  3 ++-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 5 files changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 74dffbe..492e47e 100644
@@ -563,7 +563,8 @@ struct intel_link_m_n {
 
 void intel_link_compute_m_n(int bpp, int nlanes,
 			    int pixel_clock, int link_clock,
-			    struct intel_link_m_n *m_n);
+			    struct intel_link_m_n *m_n,
+				bool reduce_m_n);
 
 /* Interface history:
  *
drivers/gpu/drm/i915/intel_display.c +14 -8
index 7bcc604..8920a99 100644
@@ -6104,7 +6104,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
 	pipe_config->fdi_lanes = lane;
 
 	intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,
-			       link_bw, &pipe_config->fdi_m_n);
+			       link_bw, &pipe_config->fdi_m_n, false);
 
 	ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);
 	if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {
@@ -6280,7 +6280,8 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
 }
 
 static void compute_m_n(unsigned int m, unsigned int n,
-			uint32_t *ret_m, uint32_t *ret_n)
+			uint32_t *ret_m, uint32_t *ret_n,
+			   bool reduce_m_n)
 {
 	/*
 	 * Reduce M/N as much as possible without loss in precision. Several DP
@@ -6288,9 +6289,11 @@ static void compute_m_n(unsigned int m, unsigned int n,
 	 * values. The passed in values are more likely to have the least
 	 * significant bits zero than M after rounding below, so do this first.
 	 */
-	while ((m & 1) == 0 && (n & 1) == 0) {
-		m >>= 1;
-		n >>= 1;
+	if (reduce_m_n) {
+		while ((m & 1) == 0 && (n & 1) == 0) {
+			m >>= 1;
+			n >>= 1;
+		}
 	}
 
 	*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
@@ -6301,16 +6304,19 @@ static void compute_m_n(unsigned int m, unsigned int 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)
+		       struct intel_link_m_n *m_n,
+			  bool reduce_m_n)
 {
 	m_n->tu = 64;
 
 	compute_m_n(bits_per_pixel * pixel_clock,
 		    link_clock * nlanes * 8,
-		    &m_n->gmch_m, &m_n->gmch_n);
+		    &m_n->gmch_m, &m_n->gmch_n,
+		    reduce_m_n);
 
 	compute_m_n(pixel_clock, link_clock,
-		    &m_n->link_m, &m_n->link_n);
+		    &m_n->link_m, &m_n->link_n,
+		    reduce_m_n);
 }
 
 static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_dp.c +20 -2
index 4a6feb6..f4c0582 100644
@@ -1548,6 +1548,20 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 	DRM_DEBUG_KMS("common rates: %s\n", str);
 }
 
+bool __intel_reduced_m_n(struct intel_dp *intel_dp)
+{
+	struct intel_dp_desc *desc = &intel_dp->desc;
+	bool ret = false;
+
+	/* Analogix 7737 needs reduced N and M at HBR2 link rates */
+	if (desc->oui[0] == 0x00 &&
+	    desc->oui[1] == 0x22 &&
+	    desc->oui[2] == 0xb9)
+		ret = true;
+
+	return ret;
+}
+
 bool
 __intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
 {
@@ -1568,6 +1582,8 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
 	if (!__intel_dp_read_desc(intel_dp, desc))
 		return false;
 
+	intel_dp->reduce_m_n = __intel_reduced_m_n(intel_dp);
+
 	dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
 	DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
 		      drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink",
@@ -1790,7 +1806,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	if (intel_connector->panel.downclock_mode != NULL &&
 		dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -1798,7 +1815,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
 			intel_link_compute_m_n(bpp, lane_count,
 				intel_connector->panel.downclock_mode->clock,
 				pipe_config->port_clock,
-				&pipe_config->dp_m2_n2);
+				&pipe_config->dp_m2_n2,
+				intel_dp->reduce_m_n);
 	}
 
 	/*
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
index 68c788e..81fd8dc 100644
@@ -79,7 +79,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	intel_link_compute_m_n(bpp, lane_count,
 			       adjusted_mode->crtc_clock,
 			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
 	pipe_config->dp_m_n.tu = slots;
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index e8de2f67..50e5077 100644
@@ -1057,6 +1057,7 @@ struct intel_dp {
 
 	/* Displayport compliance testing */
 	struct intel_dp_compliance compliance;
+	bool reduce_m_n;
 };
 
 struct intel_lspcon {
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 5 lines · Jani Nikula
Quoted 4 lines · On Wed, 10 May 2017, [email protected] wrote:

From: Clint Taylor <[email protected]>

The Analogix 7737 DP to HDMI converter requires reduced N and M values when to operate correctly at HBR2. Detect this IC by its OUI value of 0x0022B9.

Quoted 8 lines

I'm not happy, but I also see no alternative than to go this route. Thanks for the patch. I do think we need to start a common drm quirk database for this stuff though. Added one, and rebased this one on top:

https://patchwork.freedesktop.org/series/24282/

Please give it a go; I don't have a DA200.

patches work as expected. quirks is set correctly when OUI 0x0022B9 based DA200 and SlimPort USB-C dongles are used. All other dongles tested do not set quirks.

[   64.569833] [drm:intel_dp_read_desc] DP branch: OUI 00-1c-f8 dev-ID 176GB0 HW-rev 1.0 SW-rev 7.38 quirks 0x0000
[  111.053902] [drm:intel_dp_read_desc] DP branch: OUI 00-22-b9 dev-ID 7737 HW-rev 10.12 SW-rev 6.4 quirks 0x0001

-Clint

Quoted 166 lines

BR,
Jani.

Quoted 161 lines
Cc Jani Nikula <[email protected]>
Cc Dhinakaran Pandiyan <[email protected]>
---
  drivers/gpu/drm/i915/i915_drv.h      |  3 ++-
  drivers/gpu/drm/i915/intel_display.c | 22 ++++++++++++++--------
  drivers/gpu/drm/i915/intel_dp.c      | 22 ++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_dp_mst.c  |  3 ++-
  drivers/gpu/drm/i915/intel_drv.h     |  1 +
  5 files changed, 39 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -1
index 74dffbe..492e47e 100644
@@ -563,7 +563,8 @@ struct intel_link_m_n {
 
  void intel_link_compute_m_n(int bpp, int nlanes,
  			    int pixel_clock, int link_clock,
-			    struct intel_link_m_n *m_n);
+			    struct intel_link_m_n *m_n,
+				bool reduce_m_n);
 
  /* Interface history:
   *
drivers/gpu/drm/i915/intel_display.c +14 -8
index 7bcc604..8920a99 100644
@@ -6104,7 +6104,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
  	pipe_config->fdi_lanes = lane;
 
  	intel_link_compute_m_n(pipe_config->pipe_bpp, lane, fdi_dotclock,
-			       link_bw, &pipe_config->fdi_m_n);
+			       link_bw, &pipe_config->fdi_m_n, false);
 
  	ret = ironlake_check_fdi_lanes(dev, intel_crtc->pipe, pipe_config);
  	if (ret == -EINVAL && pipe_config->pipe_bpp > 6*3) {
@@ -6280,7 +6280,8 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
  }
 
  static void compute_m_n(unsigned int m, unsigned int n,
-			uint32_t *ret_m, uint32_t *ret_n)
+			uint32_t *ret_m, uint32_t *ret_n,
+			   bool reduce_m_n)
  {
  	/*
  	 * Reduce M/N as much as possible without loss in precision. Several DP
@@ -6288,9 +6289,11 @@ static void compute_m_n(unsigned int m, unsigned int n,
  	 * values. The passed in values are more likely to have the least
  	 * significant bits zero than M after rounding below, so do this first.
  	 */
-	while ((m & 1) == 0 && (n & 1) == 0) {
-		m >>= 1;
-		n >>= 1;
+	if (reduce_m_n) {
+		while ((m & 1) == 0 && (n & 1) == 0) {
+			m >>= 1;
+			n >>= 1;
+		}
  	}
 
  	*ret_n = min_t(unsigned int, roundup_pow_of_two(n), DATA_LINK_N_MAX);
@@ -6301,16 +6304,19 @@ static void compute_m_n(unsigned int m, unsigned int 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)
+		       struct intel_link_m_n *m_n,
+			  bool reduce_m_n)
  {
  	m_n->tu = 64;
 
  	compute_m_n(bits_per_pixel * pixel_clock,
  		    link_clock * nlanes * 8,
-		    &m_n->gmch_m, &m_n->gmch_n);
+		    &m_n->gmch_m, &m_n->gmch_n,
+		    reduce_m_n);
 
  	compute_m_n(pixel_clock, link_clock,
-		    &m_n->link_m, &m_n->link_n);
+		    &m_n->link_m, &m_n->link_n,
+		    reduce_m_n);
  }
 
  static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
drivers/gpu/drm/i915/intel_dp.c +20 -2
index 4a6feb6..f4c0582 100644
@@ -1548,6 +1548,20 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
  	DRM_DEBUG_KMS("common rates: %s\n", str);
  }
 
+bool __intel_reduced_m_n(struct intel_dp *intel_dp)
+{
+	struct intel_dp_desc *desc = &intel_dp->desc;
+	bool ret = false;
+
+	/* Analogix 7737 needs reduced N and M at HBR2 link rates */
+	if (desc->oui[0] == 0x00 &&
+	    desc->oui[1] == 0x22 &&
+	    desc->oui[2] == 0xb9)
+		ret = true;
+
+	return ret;
+}
+
  bool
  __intel_dp_read_desc(struct intel_dp *intel_dp, struct intel_dp_desc *desc)
  {
@@ -1568,6 +1582,8 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
  	if (!__intel_dp_read_desc(intel_dp, desc))
  		return false;
 
+	intel_dp->reduce_m_n = __intel_reduced_m_n(intel_dp);
+
  	dev_id_len = strnlen(desc->device_id, sizeof(desc->device_id));
  	DRM_DEBUG_KMS("DP %s: OUI %*phD%s dev-ID %*pE HW-rev %d.%d SW-rev %d.%d\n",
  		      drm_dp_is_branch(intel_dp->dpcd) ? "branch" : "sink",
@@ -1790,7 +1806,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
  	intel_link_compute_m_n(bpp, lane_count,
  			       adjusted_mode->crtc_clock,
  			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
  	if (intel_connector->panel.downclock_mode != NULL &&
  		dev_priv->drrs.type == SEAMLESS_DRRS_SUPPORT) {
@@ -1798,7 +1815,8 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
  			intel_link_compute_m_n(bpp, lane_count,
  				intel_connector->panel.downclock_mode->clock,
  				pipe_config->port_clock,
-				&pipe_config->dp_m2_n2);
+				&pipe_config->dp_m2_n2,
+				intel_dp->reduce_m_n);
  	}
 
  	/*
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
index 68c788e..81fd8dc 100644
@@ -79,7 +79,8 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder,
  	intel_link_compute_m_n(bpp, lane_count,
  			       adjusted_mode->crtc_clock,
  			       pipe_config->port_clock,
-			       &pipe_config->dp_m_n);
+			       &pipe_config->dp_m_n,
+				intel_dp->reduce_m_n);
 
  	pipe_config->dp_m_n.tu = slots;
 
drivers/gpu/drm/i915/intel_drv.h +0 -0
index e8de2f67..50e5077 100644
@@ -1057,6 +1057,7 @@ struct intel_dp {
 
Quoted 6 lines

drivers/gpu/drm/i915/intel_drv.h struct intel_dp { · line 1063

Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +1 -0
  	/* Displayport compliance testing */
  	struct intel_dp_compliance compliance;
+	bool reduce_m_n;
  };
 
  struct intel_lspcon {

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx