Skip to contentSkip to conversation

Basic Broxton enabling

PATCH In review Imre Deak 14 participants 191 messages Mar 17, 2015 – Apr 24, 2015 Page 2 of 2

Subsystems (5)
lore
Share & tools
lore
#148 lore raw

Re: [PATCH 35/49] drm/i915/bxt: fix panel fitter setup in crtc disable/enable

Quoted 2 lines · On Sun, Apr 12, 2015 at 03:49:34PM +0530, [email protected] wrote:

For updated patch that is coming up per http://lists.freedesktop.org/archives/intel-gfx/2015-March/062315.html
Reviewed-by: Sagar Kamble <sagar.a.kamble at intel.com>

Please don't reply to mails by linking to their archive link because that completely rips apart the discussion. Also the mailman archive isn't fully stable, much better to link to gman using the Message-Id if there is a need for that. But review/discussions really should be direct replies.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#149 lore raw

PATCH v2 35/49 drm/i915/bxt: fix panel fitter setup in crtc disable/enable

In reply to Imre Deak

From: Jesse Barnes <[email protected]>

Broxton has the same panel fitter registers as Skylake.

v2:
- add MISSING_CASE for future platforms (daniel)

---
 drivers/gpu/drm/i915/intel_display.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -6
index 5ee5d8c..11281f4 100644
@@ -4881,10 +4881,12 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 
 	intel_ddi_enable_pipe_clock(intel_crtc);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)
 		skylake_pfit_update(intel_crtc, 1);
-	else
+	else if (INTEL_INFO(dev)->gen < 9)
 		ironlake_pfit_enable(intel_crtc);
+	else
+		MISSING_CASE(INTEL_INFO(dev)->gen);
 
 	/*
 	 * On ILK+ LUT must be loaded before the pipe is running but with
@@ -5029,10 +5031,12 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 
 	intel_ddi_disable_transcoder_func(dev_priv, cpu_transcoder);
 
-	if (IS_SKYLAKE(dev))
+	if (INTEL_INFO(dev)->gen == 9)
 		skylake_pfit_update(intel_crtc, 0);
-	else
+	else if (INTEL_INFO(dev)->gen < 9)
 		ironlake_pfit_disable(intel_crtc);
+	else
+		MISSING_CASE(INTEL_INFO(dev)->gen);
 
 	intel_ddi_disable_pipe_clock(intel_crtc);
 
@@ -9199,10 +9203,13 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 
 	pfit_domain = POWER_DOMAIN_PIPE_PANEL_FITTER(crtc->pipe);
 	if (intel_display_power_is_enabled(dev_priv, pfit_domain)) {
-		if (IS_SKYLAKE(dev))
+		if (INTEL_INFO(dev)->gen == 9)
 			skylake_get_pfit_config(crtc, pipe_config);
-		else
+		else if (INTEL_INFO(dev)->gen < 9)
 			ironlake_get_pfit_config(crtc, pipe_config);
+		else
+			MISSING_CASE(INTEL_INFO(dev)->gen);
+
 	} else {
 		pipe_config->scaler_state.scaler_id = -1;
 		pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX);
Signature · 6 lines
2.1.0

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

PATCH 36/49 drm/i915/bxt: Define bxt DDI PLLs and implement enable/disable sequence

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Plug bxt PLL code into existing shared DPLL framework.

v2: (imre)
- squash in Satheeshakrishna's "Define BXT clock registers" and "Add state variables for bxt clock registers" patches
- squash in Vandanas's "Change grp access to lane access for PLL"
- fix group vs. lane access in bxt_ddi_pll_get_hw_state
- add code comment why we read from lane registers while writing to group registers
- clean up register macros
- use BXT_PORT_PLL_* macros instead of open-coding the same
- check if BXT_PORT_PCS_DW12_LN01 matches BXT_PORT_PCS_DW12_LN23 during hardware state readout
- add missing LANESTAGGER_STRAP_OVRD masking
- add note about missing step according to the latest BUN for PORT_PLL_9/lockthresh

---
 drivers/gpu/drm/i915/i915_drv.h  |   3 +
 drivers/gpu/drm/i915/i915_reg.h  |  76 ++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c | 165 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 244 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +3 -0
index 1b2a294..e4dd4bba 100644
@@ -303,6 +303,9 @@ struct intel_dpll_hw_state {
 	uint32_t ctrl1;
 	/* HDMI only, 0 when used for DP */
 	uint32_t cfgcr1, cfgcr2;
+
+	/* bxt */
+	uint32_t ebb0, pll0, pll1, pll2, pll3, pll6, pll8, pcsdw12;
 };
 
 struct intel_shared_dpll_config {
drivers/gpu/drm/i915/i915_reg.h +76 -0

88 lines not on this page · raw message

drivers/gpu/drm/i915/intel_ddi.c +165 -0

177 lines not on this page · raw message

Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 36/49
#151 lore raw

Re: [PATCH 36/49] drm/i915/bxt: Define bxt DDI PLLs and implement enable/disable sequence

drivers/gpu/drm/i915/intel_ddi.c void bxt_uninit_cdclk(struct drm_device *dev) · line 2318

Quoted 5 lines · Imre Deak
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	/*
+	 * FIXME: program PORT_PLL_9/i_lockthresh according to the latest
+	 * specification update.
+	 */
+

Current spec says "write 5 to i_lockthresh", but I guess that's not needed for functionality so it can be added later.

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

author
#152 lore raw

Re: [PATCH 36/49] drm/i915/bxt: Define bxt DDI PLLs and implement enable/disable sequence

Quoted 11 lines · Jesse Barnes

drivers/gpu/drm/i915/intel_ddi.c void bxt_uninit_cdclk(struct drm_device *dev) · line 2318

Quoted 5 lines · Imre Deak
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	/*
+	 * FIXME: program PORT_PLL_9/i_lockthresh according to the latest
+	 * specification update.
+	 */
+

Current spec says "write 5 to i_lockthresh", but I guess that's not needed for functionality so it can be added later.

Yea, my thought was to keep things close to what we tried on the power-on and fix things once we get the HW.

--Imre

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

author
#153 lore raw

PATCH 37/49 drm/i915: factor out vlv_PLL_is_optimal

In reply to Imre Deak

Factor out the logic to decide whether the newly calculated dividers are better than the best found so far. Do this for clarity and to prepare for the upcoming BXT helper needing the same.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +36 -14
index 95ce0a8..7feb047 100644
@@ -776,6 +776,33 @@ g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 	return found;
 }
 
+/*
+ * Check if the calculated PLL configuration is more optimal compared to the
+ * best configuration and error found so far. Return the calculated error.
+ */
+static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
+			       const intel_clock_t *calculated_clock,
+			       const intel_clock_t *best_clock,
+			       unsigned int best_error_ppm,
+			       unsigned int *error_ppm)
+{
+	*error_ppm = div_u64(1000000ULL *
+				abs(target_freq - calculated_clock->dot),
+			     target_freq);
+	/*
+	 * Prefer a better P value over a better (smaller) error if the error
+	 * is small. Ensure this preference for future configurations too by
+	 * setting the error to 0.
+	 */
+	if (*error_ppm < 100 && calculated_clock->p > best_clock->p) {
+		*error_ppm = 0;
+
+		return true;
+	}
+
+	return *error_ppm + 10 < best_error_ppm;
+}
+
 static bool
 vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   int target, int refclk, intel_clock_t *match_clock,
@@ -800,7 +827,7 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 				clock.p = clock.p1 * clock.p2;
 				/* based on hardware requirement, prefer bigger m1,m2 values */
 				for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
-					unsigned int ppm, diff;
+					unsigned int ppm;
 
 					clock.m2 = DIV_ROUND_CLOSEST(target * clock.p * clock.n,
 								     refclk * clock.m1);
@@ -811,20 +838,15 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 								&clock))
 						continue;
 
-					diff = abs(clock.dot - target);
-					ppm = div_u64(1000000ULL * diff, target);
+					if (!vlv_PLL_is_optimal(dev, target,
+								&clock,
+								best_clock,
+								bestppm, &ppm))
+						continue;
 
-					if (ppm < 100 && clock.p > best_clock->p) {
-						bestppm = 0;
-						*best_clock = clock;
-						found = true;
-					}
-
-					if (bestppm >= 10 && ppm < bestppm - 10) {
-						bestppm = ppm;
-						*best_clock = clock;
-						found = true;
-					}
+					*best_clock = clock;
+					bestppm = ppm;
+					found = true;
 				}
 			}
 		}
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 37/49
#154 lore raw

Re: [PATCH 37/49] drm/i915: factor out vlv_PLL_is_optimal

Quoted 78 lines · Imre Deak

Factor out the logic to decide whether the newly calculated dividers are better than the best found so far. Do this for clarity and to prepare for the upcoming BXT helper needing the same.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +33 -10
index 95ce0a8..7feb047 100644
@@ -776,6 +776,33 @@ g4x_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 	return found;
 }
 
+/*
+ * Check if the calculated PLL configuration is more optimal compared to the
+ * best configuration and error found so far. Return the calculated error.
+ */
+static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
+			       const intel_clock_t *calculated_clock,
+			       const intel_clock_t *best_clock,
+			       unsigned int best_error_ppm,
+			       unsigned int *error_ppm)
+{
+	*error_ppm = div_u64(1000000ULL *
+				abs(target_freq - calculated_clock->dot),
+			     target_freq);
+	/*
+	 * Prefer a better P value over a better (smaller) error if the error
+	 * is small. Ensure this preference for future configurations too by
+	 * setting the error to 0.
+	 */
+	if (*error_ppm < 100 && calculated_clock->p > best_clock->p) {
+		*error_ppm = 0;
+
+		return true;
+	}
+
+	return *error_ppm + 10 < best_error_ppm;
+}
+
 static bool
 vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   int target, int refclk, intel_clock_t *match_clock,
@@ -800,7 +827,7 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 				clock.p = clock.p1 * clock.p2;
 				/* based on hardware requirement, prefer bigger m1,m2 values */
 				for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
-					unsigned int ppm, diff;
+					unsigned int ppm;
 
 					clock.m2 = DIV_ROUND_CLOSEST(target * clock.p * clock.n,
 								     refclk * clock.m1);
@@ -811,20 +838,15 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 								&clock))
 						continue;
 
-					diff = abs(clock.dot - target);
-					ppm = div_u64(1000000ULL * diff, target);
+					if (!vlv_PLL_is_optimal(dev, target,
+								&clock,
+								best_clock,
+								bestppm, &ppm))
+						continue;
 
-					if (ppm < 100 && clock.p > best_clock->p) {
-						bestppm = 0;
-						*best_clock = clock;
-						found = true;
-					}
-
-					if (bestppm >= 10 && ppm < bestppm - 10) {

drivers/gpu/drm/i915/intel_display.c vlv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · line 852

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +3 -4
-						bestppm = ppm;
-						*best_clock = clock;
-						found = true;
-					}
+					*best_clock = clock;
+					bestppm = ppm;
+					found = true;
 				}
 			}
 		}

Did a double take because of the logic reversal, but I think it's correct.

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

author
#155 lore raw

PATCH 38/49 drm/i915: check for div-by-zero in vlv_PLL_is_optimal

In reply to Imre Deak
---
 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +3 -0
index 7feb047..5874512 100644
@@ -786,6 +786,9 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	if (WARN_ON_ONCE(!target_freq))
+		return false;
+
 	*error_ppm = div_u64(1000000ULL *
 				abs(target_freq - calculated_clock->dot),
 			     target_freq);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 38/49
#156 lore raw

Re: [PATCH 38/49] drm/i915: check for div-by-zero in vlv_PLL_is_optimal

Quoted 11 lines · Imre Deak
---
 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7feb047..5874512 100644

drivers/gpu/drm/i915/intel_display.c static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, · line 794

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -786,6 +786,9 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	if (WARN_ON_ONCE(!target_freq))
+		return false;
+
 	*error_ppm = div_u64(1000000ULL *
 				abs(target_freq - calculated_clock->dot),
 			     target_freq);

Thank you. This one bites a lot in debug.

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

#157 lore raw

Re: [PATCH 38/49] drm/i915: check for div-by-zero in vlv_PLL_is_optimal

Quoted 24 lines · Jesse Barnes
Quoted 11 lines · Imre Deak
---
 drivers/gpu/drm/i915/intel_display.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +0 -0
index 7feb047..5874512 100644

drivers/gpu/drm/i915/intel_display.c static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, · line 794

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -786,6 +786,9 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	if (WARN_ON_ONCE(!target_freq))
+		return false;
+
 	*error_ppm = div_u64(1000000ULL *
 				abs(target_freq - calculated_clock->dot),
 			     target_freq);

Thank you. This one bites a lot in debug.

Quoted 1 line

I went ahead and merged these 2 prep patches to dinq right away.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#158 lore raw

PATCH 39/49 drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll

In reply to Imre Deak

Prepare chv_find_best_dpll to be used for BXT too, where we want to consider the error between target and calculated frequency too when choosing a better PLL configuration.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +20 -6
index 5874512..9ca84a2 100644
@@ -786,6 +786,16 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	/*
+	 * For CHV ignore the error and consider only the P value.
+	 * Prefer a bigger P value based on HW requirements.
+	 */
+	if (IS_CHERRYVIEW(dev)) {
+		*error_ppm = 0;
+
+		return calculated_clock->p > best_clock->p;
+	}
+
 	if (WARN_ON_ONCE(!target_freq))
 		return false;
 
@@ -864,11 +874,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
+	unsigned int best_error_ppm;
 	intel_clock_t clock;
 	uint64_t m2;
 	int found = false;
 
 	memset(best_clock, 0, sizeof(*best_clock));
+	best_error_ppm = 1000000;
 
 	/*
 	 * Based on hardware doc, the n always set to 1, and m1 always
@@ -882,6 +894,7 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		for (clock.p2 = limit->p2.p2_fast;
 				clock.p2 >= limit->p2.p2_slow;
 				clock.p2 -= clock.p2 > 10 ? 2 : 1) {
+			unsigned int error_ppm;
 
 			clock.p = clock.p1 * clock.p2;
 
@@ -898,12 +911,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 			if (!intel_PLL_is_valid(dev, limit, &clock))
 				continue;
 
-			/* based on hardware requirement, prefer bigger p
-			 */
-			if (clock.p > best_clock->p) {
-				*best_clock = clock;
-				found = true;
-			}
+			if (!vlv_PLL_is_optimal(dev, target, &clock, best_clock,
+						best_error_ppm, &error_ppm))
+				continue;
+
+			*best_clock = clock;
+			best_error_ppm = error_ppm;
+			found = true;
 		}
 	}
 
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 39/49
#159 lore raw

Re: [PATCH 39/49] drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll

Quoted 65 lines · Imre Deak

Prepare chv_find_best_dpll to be used for BXT too, where we want to consider the error between target and calculated frequency too when choosing a better PLL configuration.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -6
index 5874512..9ca84a2 100644
@@ -786,6 +786,16 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	/*
+	 * For CHV ignore the error and consider only the P value.
+	 * Prefer a bigger P value based on HW requirements.
+	 */
+	if (IS_CHERRYVIEW(dev)) {
+		*error_ppm = 0;
+
+		return calculated_clock->p > best_clock->p;
+	}
+
 	if (WARN_ON_ONCE(!target_freq))
 		return false;
 
@@ -864,11 +874,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
+	unsigned int best_error_ppm;
 	intel_clock_t clock;
 	uint64_t m2;
 	int found = false;
 
 	memset(best_clock, 0, sizeof(*best_clock));
+	best_error_ppm = 1000000;
 
 	/*
 	 * Based on hardware doc, the n always set to 1, and m1 always
@@ -882,6 +894,7 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		for (clock.p2 = limit->p2.p2_fast;
 				clock.p2 >= limit->p2.p2_slow;
 				clock.p2 -= clock.p2 > 10 ? 2 : 1) {
+			unsigned int error_ppm;
 
 			clock.p = clock.p1 * clock.p2;
 
@@ -898,12 +911,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 			if (!intel_PLL_is_valid(dev, limit, &clock))
 				continue;
 
-			/* based on hardware requirement, prefer bigger p
-			 */
-			if (clock.p > best_clock->p) {
-				*best_clock = clock;
-				found = true;
-			}

drivers/gpu/drm/i915/intel_display.c chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · line 923

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
+			if (!vlv_PLL_is_optimal(dev, target, &clock, best_clock,
+						best_error_ppm, &error_ppm))
+				continue;
+
+			*best_clock = clock;
+			best_error_ppm = error_ppm;
+			found = true;
 		}
 	}
 

Looking at it again, maybe vlv_PLL_is_better() might be a better name.

Also, could you just make the ppm variable a scratch one and ignore it?
It just gets set to 0 no matter what, right?

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

author
#160 lore raw

Re: [PATCH 39/49] drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll

Quoted 70 lines · Jesse Barnes
Quoted 69 lines · Imre Deak

Prepare chv_find_best_dpll to be used for BXT too, where we want to consider the error between target and calculated frequency too when choosing a better PLL configuration.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +18 -6
index 5874512..9ca84a2 100644
@@ -786,6 +786,16 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	/*
+	 * For CHV ignore the error and consider only the P value.
+	 * Prefer a bigger P value based on HW requirements.
+	 */
+	if (IS_CHERRYVIEW(dev)) {
+		*error_ppm = 0;
+
+		return calculated_clock->p > best_clock->p;
+	}
+
 	if (WARN_ON_ONCE(!target_freq))
 		return false;
 
@@ -864,11 +874,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
+	unsigned int best_error_ppm;
 	intel_clock_t clock;
 	uint64_t m2;
 	int found = false;
 
 	memset(best_clock, 0, sizeof(*best_clock));
+	best_error_ppm = 1000000;
 
 	/*
 	 * Based on hardware doc, the n always set to 1, and m1 always
@@ -882,6 +894,7 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		for (clock.p2 = limit->p2.p2_fast;
 				clock.p2 >= limit->p2.p2_slow;
 				clock.p2 -= clock.p2 > 10 ? 2 : 1) {
+			unsigned int error_ppm;
 
 			clock.p = clock.p1 * clock.p2;
 
@@ -898,12 +911,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 			if (!intel_PLL_is_valid(dev, limit, &clock))
 				continue;
 
-			/* based on hardware requirement, prefer bigger p
-			 */
-			if (clock.p > best_clock->p) {
-				*best_clock = clock;
-				found = true;
-			}
+			if (!vlv_PLL_is_optimal(dev, target, &clock, best_clock,
+						best_error_ppm, &error_ppm))
+				continue;
+
+			*best_clock = clock;
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · line 923

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+			best_error_ppm = error_ppm;
+			found = true;
 		}
 	}
 

Looking at it again, maybe vlv_PLL_is_better() might be a better name.

Ok, will change it.

Quoted 2 lines

Also, could you just make the ppm variable a scratch one and ignore it?
It just gets set to 0 no matter what, right?

For CHV yes. But the next patch takes the same function into use in BXT too, where error_ppm will be set to the actual error, the same way as on VLV.

Quoted 1 line

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

#161 lore raw

Re: [PATCH 39/49] drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll

Quoted 80 lines · Imre Deak
Quoted 70 lines · Jesse Barnes
Quoted 69 lines · Imre Deak

Prepare chv_find_best_dpll to be used for BXT too, where we want to consider the error between target and calculated frequency too when choosing a better PLL configuration.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +18 -6
index 5874512..9ca84a2 100644
@@ -786,6 +786,16 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	/*
+	 * For CHV ignore the error and consider only the P value.
+	 * Prefer a bigger P value based on HW requirements.
+	 */
+	if (IS_CHERRYVIEW(dev)) {
+		*error_ppm = 0;
+
+		return calculated_clock->p > best_clock->p;
+	}
+
 	if (WARN_ON_ONCE(!target_freq))
 		return false;
 
@@ -864,11 +874,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
+	unsigned int best_error_ppm;
 	intel_clock_t clock;
 	uint64_t m2;
 	int found = false;
 
 	memset(best_clock, 0, sizeof(*best_clock));
+	best_error_ppm = 1000000;
 
 	/*
 	 * Based on hardware doc, the n always set to 1, and m1 always
@@ -882,6 +894,7 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		for (clock.p2 = limit->p2.p2_fast;
 				clock.p2 >= limit->p2.p2_slow;
 				clock.p2 -= clock.p2 > 10 ? 2 : 1) {
+			unsigned int error_ppm;
 
 			clock.p = clock.p1 * clock.p2;
 
@@ -898,12 +911,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 			if (!intel_PLL_is_valid(dev, limit, &clock))
 				continue;
 
-			/* based on hardware requirement, prefer bigger p
-			 */
-			if (clock.p > best_clock->p) {
-				*best_clock = clock;
-				found = true;
-			}
+			if (!vlv_PLL_is_optimal(dev, target, &clock, best_clock,
+						best_error_ppm, &error_ppm))
+				continue;
+
+			*best_clock = clock;
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · line 923

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
+			best_error_ppm = error_ppm;
+			found = true;
 		}
 	}
 

Looking at it again, maybe vlv_PLL_is_better() might be a better name.

Quoted 8 lines

Ok, will change it.

Quoted 2 lines

Also, could you just make the ppm variable a scratch one and ignore it?
It just gets set to 0 no matter what, right?

For CHV yes. But the next patch takes the same function into use in BXT too, where error_ppm will be set to the actual error, the same way as on VLV.

Oh right it's a patch *series*. Ignore the noise. :)

The rename is optional too; I just had to think about it when I saw

Quoted 1 line
Quoted 1 line

drivers/gpu/drm/i915/intel_display.c static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, · line 796

Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1 -0
+		return calculated_clock->p > best_clock->p;

since in that case we're really checking whether the new calculated p value is better (higher) than the last one. The _is_optimal() name made me think it should be >= or something. But it's not a big deal.

Thanks,
Jesse
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#162 lore raw

Re: [PATCH 39/49] drm/i915/chv: use vlv_PLL_is_optimal in chv_find_best_dpll

In reply to Jesse Barnes
Quoted 79 lines · Jesse Barnes
Quoted 65 lines · Imre Deak

Prepare chv_find_best_dpll to be used for BXT too, where we want to consider the error between target and calculated frequency too when choosing a better PLL configuration.

No functional change.

---
 drivers/gpu/drm/i915/intel_display.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -6
index 5874512..9ca84a2 100644
@@ -786,6 +786,16 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq,
 			       unsigned int best_error_ppm,
 			       unsigned int *error_ppm)
 {
+	/*
+	 * For CHV ignore the error and consider only the P value.
+	 * Prefer a bigger P value based on HW requirements.
+	 */
+	if (IS_CHERRYVIEW(dev)) {
+		*error_ppm = 0;
+
+		return calculated_clock->p > best_clock->p;
+	}
+
 	if (WARN_ON_ONCE(!target_freq))
 		return false;
 
@@ -864,11 +874,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		   intel_clock_t *best_clock)
 {
 	struct drm_device *dev = crtc->base.dev;
+	unsigned int best_error_ppm;
 	intel_clock_t clock;
 	uint64_t m2;
 	int found = false;
 
 	memset(best_clock, 0, sizeof(*best_clock));
+	best_error_ppm = 1000000;
 
 	/*
 	 * Based on hardware doc, the n always set to 1, and m1 always
@@ -882,6 +894,7 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 		for (clock.p2 = limit->p2.p2_fast;
 				clock.p2 >= limit->p2.p2_slow;
 				clock.p2 -= clock.p2 > 10 ? 2 : 1) {
+			unsigned int error_ppm;
 
 			clock.p = clock.p1 * clock.p2;
 
@@ -898,12 +911,13 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 			if (!intel_PLL_is_valid(dev, limit, &clock))
 				continue;
 
-			/* based on hardware requirement, prefer bigger p
-			 */
-			if (clock.p > best_clock->p) {
-				*best_clock = clock;
-				found = true;
-			}

drivers/gpu/drm/i915/intel_display.c chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc, · line 923

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
+			if (!vlv_PLL_is_optimal(dev, target, &clock, best_clock,
+						best_error_ppm, &error_ppm))
+				continue;
+
+			*best_clock = clock;
+			best_error_ppm = error_ppm;
+			found = true;
 		}
 	}
 

Looking at it again, maybe vlv_PLL_is_better() might be a better name.

Quoted 4 lines

Also, could you just make the ppm variable a scratch one and ignore it?
It just gets set to 0 no matter what, right?

Also merged to dinq. If there's other refactorings to existing platform code then I need to get that in in the next few days for it to make the 4.1 cutoff. Otherwise we can't pull the usual "separate branch&late pull" trick for new platforms.

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#163 lore raw

PATCH 40/49 drm/i915/bxt: add bxt_find_best_dpll

In reply to Imre Deak
---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 2 files changed, 30 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +28 -4
index 9ca84a2..3606366 100644
@@ -102,6 +102,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
 static void intel_begin_crtc_commit(struct drm_crtc *crtc);
 static void intel_finish_crtc_commit(struct drm_crtc *crtc);
+static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors);
 
 static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe)
 {
@@ -399,6 +400,18 @@ static const intel_limit_t intel_limits_chv = {
 	.p2 = {	.p2_slow = 1, .p2_fast = 14 },
 };
 
+static const intel_limit_t intel_limits_bxt = {
+	/* FIXME: find real dot limits */
+	.dot = { .min = 0, .max = INT_MAX },
+	.vco = { .min = 4800000, .max = 6480000 },
+	.n = { .min = 1, .max = 1 },
+	.m1 = { .min = 2, .max = 2 },
+	/* FIXME: find real m2 limits */
+	.m2 = { .min = 2 << 22, .max = 255 << 22 },
+	.p1 = { .min = 2, .max = 4 },
+	.p2 = { .p2_slow = 1, .p2_fast = 20 },
+};
+
 static void vlv_clock(int refclk, intel_clock_t *clock)
 {
 	clock->m = clock->m1 * clock->m2;
@@ -492,7 +505,9 @@ static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk)
 	struct drm_device *dev = crtc->base.dev;
 	const intel_limit_t *limit;
 
-	if (HAS_PCH_SPLIT(dev))
+	if (IS_BROXTON(dev))
+		limit = &intel_limits_bxt;
+	else if (HAS_PCH_SPLIT(dev))
 		limit = intel_ironlake_limit(crtc, refclk);
 	else if (IS_G4X(dev)) {
 		limit = intel_g4x_limit(crtc);
@@ -577,11 +592,11 @@ static bool intel_PLL_is_valid(struct drm_device *dev,
 	if (clock->m1  < limit->m1.min  || limit->m1.max  < clock->m1)
 		INTELPllInvalid("m1 out of range\n");
 
-	if (!IS_PINEVIEW(dev) && !IS_VALLEYVIEW(dev))
+	if (!IS_PINEVIEW(dev) && !IS_VALLEYVIEW(dev) && !IS_BROXTON(dev))
 		if (clock->m1 <= clock->m2)
 			INTELPllInvalid("m1 <= m2\n");
 
-	if (!IS_VALLEYVIEW(dev)) {
+	if (!IS_VALLEYVIEW(dev) && !IS_BROXTON(dev)) {
 		if (clock->p < limit->p.min || limit->p.max < clock->p)
 			INTELPllInvalid("p out of range\n");
 		if (clock->m < limit->m.min || limit->m.max < clock->m)
@@ -924,6 +939,15 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 	return found;
 }
 
+bool bxt_find_best_dpll(struct intel_crtc *crtc, int target_clock,
+			intel_clock_t *best_clock)
+{
+	int refclk = i9xx_get_refclk(crtc, 0);
+
+	return chv_find_best_dpll(intel_limit(crtc, refclk), crtc, target_clock,
+				  refclk, NULL, best_clock);
+}
+
 bool intel_crtc_active(struct drm_crtc *crtc)
 {
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -5913,7 +5937,7 @@ static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int refclk;
 
-	if (IS_VALLEYVIEW(dev)) {
+	if (IS_VALLEYVIEW(dev) || IS_BROXTON(dev)) {
 		refclk = 100000;
 	} else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) &&
 	    intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 262314b..56a5cc9 100644
@@ -1033,6 +1033,8 @@ int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_state *pipe_config,
 				int dotclock);
+bool bxt_find_best_dpll(struct intel_crtc *crtc, int target_clock,
+			intel_clock_t *best_clock);
 bool intel_crtc_active(struct drm_crtc *crtc);
 void hsw_enable_ips(struct intel_crtc *crtc);
 void hsw_disable_ips(struct intel_crtc *crtc);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 40/49
#164 lore raw

Re: [PATCH 40/49] drm/i915/bxt: add bxt_find_best_dpll

Quoted 93 lines · Imre Deak
---
 drivers/gpu/drm/i915/intel_display.c | 32 ++++++++++++++++++++++++++++----
 drivers/gpu/drm/i915/intel_drv.h     |  2 ++
 2 files changed, 30 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +28 -4
index 9ca84a2..3606366 100644
@@ -102,6 +102,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
 			    const struct intel_crtc_state *pipe_config);
 static void intel_begin_crtc_commit(struct drm_crtc *crtc);
 static void intel_finish_crtc_commit(struct drm_crtc *crtc);
+static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors);
 
 static struct intel_encoder *intel_find_encoder(struct intel_connector *connector, int pipe)
 {
@@ -399,6 +400,18 @@ static const intel_limit_t intel_limits_chv = {
 	.p2 = {	.p2_slow = 1, .p2_fast = 14 },
 };
 
+static const intel_limit_t intel_limits_bxt = {
+	/* FIXME: find real dot limits */
+	.dot = { .min = 0, .max = INT_MAX },
+	.vco = { .min = 4800000, .max = 6480000 },
+	.n = { .min = 1, .max = 1 },
+	.m1 = { .min = 2, .max = 2 },
+	/* FIXME: find real m2 limits */
+	.m2 = { .min = 2 << 22, .max = 255 << 22 },
+	.p1 = { .min = 2, .max = 4 },
+	.p2 = { .p2_slow = 1, .p2_fast = 20 },
+};
+
 static void vlv_clock(int refclk, intel_clock_t *clock)
 {
 	clock->m = clock->m1 * clock->m2;
@@ -492,7 +505,9 @@ static const intel_limit_t *intel_limit(struct intel_crtc *crtc, int refclk)
 	struct drm_device *dev = crtc->base.dev;
 	const intel_limit_t *limit;
 
-	if (HAS_PCH_SPLIT(dev))
+	if (IS_BROXTON(dev))
+		limit = &intel_limits_bxt;
+	else if (HAS_PCH_SPLIT(dev))
 		limit = intel_ironlake_limit(crtc, refclk);
 	else if (IS_G4X(dev)) {
 		limit = intel_g4x_limit(crtc);
@@ -577,11 +592,11 @@ static bool intel_PLL_is_valid(struct drm_device *dev,
 	if (clock->m1  < limit->m1.min  || limit->m1.max  < clock->m1)
 		INTELPllInvalid("m1 out of range\n");
 
-	if (!IS_PINEVIEW(dev) && !IS_VALLEYVIEW(dev))
+	if (!IS_PINEVIEW(dev) && !IS_VALLEYVIEW(dev) && !IS_BROXTON(dev))
 		if (clock->m1 <= clock->m2)
 			INTELPllInvalid("m1 <= m2\n");
 
-	if (!IS_VALLEYVIEW(dev)) {
+	if (!IS_VALLEYVIEW(dev) && !IS_BROXTON(dev)) {
 		if (clock->p < limit->p.min || limit->p.max < clock->p)
 			INTELPllInvalid("p out of range\n");
 		if (clock->m < limit->m.min || limit->m.max < clock->m)
@@ -924,6 +939,15 @@ chv_find_best_dpll(const intel_limit_t *limit, struct intel_crtc *crtc,
 	return found;
 }
 
+bool bxt_find_best_dpll(struct intel_crtc *crtc, int target_clock,
+			intel_clock_t *best_clock)
+{
+	int refclk = i9xx_get_refclk(crtc, 0);
+
+	return chv_find_best_dpll(intel_limit(crtc, refclk), crtc, target_clock,
+				  refclk, NULL, best_clock);
+}
+
 bool intel_crtc_active(struct drm_crtc *crtc)
 {
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -5913,7 +5937,7 @@ static int i9xx_get_refclk(struct intel_crtc *crtc, int num_connectors)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int refclk;
 
-	if (IS_VALLEYVIEW(dev)) {
+	if (IS_VALLEYVIEW(dev) || IS_BROXTON(dev)) {
 		refclk = 100000;
 	} else if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_LVDS) &&
 	    intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 262314b..56a5cc9 100644

drivers/gpu/drm/i915/intel_drv.h int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n); · line 1040

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1033,6 +1033,8 @@ int intel_dotclock_calculate(int link_freq, const struct intel_link_m_n *m_n);
 void
 ironlake_check_encoder_dotclock(const struct intel_crtc_state *pipe_config,
 				int dotclock);
+bool bxt_find_best_dpll(struct intel_crtc *crtc, int target_clock,
+			intel_clock_t *best_clock);
 bool intel_crtc_active(struct drm_crtc *crtc);
 void hsw_enable_ips(struct intel_crtc *crtc);
 void hsw_disable_ips(struct intel_crtc *crtc);

Do we have a JIRA on getting the final pixel clock and M2 params? If not, can you create one so we don't forget to add the real limits?

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

author
#165 lore raw

PATCH 41/49 drm/i915/bxt: BXT clock divider calculation

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Calculate and cache clock parameters. Follow bspec algorithm for HDMI. Use precalculated values for DisplayPort linkrates.

v2: (imre)
- rebase against upstream crtc_state change
- use the existing CHV based helper instead of handrolling the same

---
 drivers/gpu/drm/i915/intel_ddi.c | 129 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +129 -0
index bbc3da5..fa4f8f4 100644
@@ -1204,6 +1204,132 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc,
 	return true;
 }
 
+/* bxt clock parameters */
+struct bxt_clk_div {
+	uint32_t p1;
+	uint32_t p2;
+	uint32_t m2_int;
+	uint32_t m2_frac;
+	bool m2_frac_en;
+	uint32_t n;
+	uint32_t prop_coef;
+	uint32_t int_coef;
+	uint32_t gain_ctl;
+	uint32_t targ_cnt;
+	uint32_t lanestagger;
+};
+
+/* pre-calculated values for DP linkrates */
+static struct bxt_clk_div bxt_dp_clk_val[7] = {
+	/* 162 */ {4, 2, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 270 */ {4, 1, 27,       0, 0, 1, 3,  8, 1, 9, 0xd},
+	/* 540 */ {2, 1, 27,       0, 0, 1, 3,  8, 1, 9, 0x18},
+	/* 216 */ {3, 2, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 243 */ {4, 1, 24, 1258291, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 324 */ {4, 1, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 432 */ {3, 1, 32, 1677722, 1, 1, 5, 11, 2, 9, 0x18}
+};
+
+static bool
+bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
+		   struct intel_crtc_state *crtc_state,
+		   struct intel_encoder *intel_encoder,
+		   int clock)
+{
+	struct intel_shared_dpll *pll;
+	struct bxt_clk_div clk_div = {0};
+
+	if (intel_encoder->type == INTEL_OUTPUT_HDMI) {
+		intel_clock_t best_clock;
+
+		/* Calculate HDMI div */
+		/*
+		 * FIXME: tie the following calculation into
+		 * i9xx_crtc_compute_clock
+		 */
+		if (!bxt_find_best_dpll(intel_crtc, clock, &best_clock)) {
+			DRM_DEBUG_DRIVER("no PLL dividers found for clock %d pipe %c\n",
+					 clock, pipe_name(intel_crtc->pipe));
+			return false;
+		}
+
+		clk_div.p1 = best_clock.p1;
+		clk_div.p2 = best_clock.p2;
+		WARN_ON(best_clock.m1 != 2);
+		clk_div.n = best_clock.n;
+		clk_div.m2_int = best_clock.m2 >> 22;
+		clk_div.m2_frac = best_clock.m2 & ((1 << 22) - 1);
+		clk_div.m2_frac_en = clk_div.m2_frac != 0;
+
+		/* FIXME: set coef, gain, targcnt based on freq band */
+		clk_div.prop_coef = 5;
+		clk_div.int_coef = 11;
+		clk_div.gain_ctl = 2;
+		clk_div.targ_cnt = 9;
+		if (clock > 270000)
+			clk_div.lanestagger = 0x18;
+		else if (clock > 135000)
+			clk_div.lanestagger = 0x0d;
+		else if (clock > 67000)
+			clk_div.lanestagger = 0x07;
+		else if (clock > 33000)
+			clk_div.lanestagger = 0x04;
+		else
+			clk_div.lanestagger = 0x02;
+	} else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
+			intel_encoder->type == INTEL_OUTPUT_EDP) {
+		struct drm_encoder *encoder = &intel_encoder->base;
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		switch (intel_dp->link_bw) {
+		case DP_LINK_BW_1_62:
+			clk_div = bxt_dp_clk_val[0];
+			break;
+		case DP_LINK_BW_2_7:
+			clk_div = bxt_dp_clk_val[1];
+			break;
+		case DP_LINK_BW_5_4:
+			clk_div = bxt_dp_clk_val[2];
+			break;
+		default:
+			clk_div = bxt_dp_clk_val[0];
+			DRM_ERROR("Unknown link rate\n");
+		}
+	}
+
+	crtc_state->dpll_hw_state.ebb0 =
+		PORT_PLL_P1(clk_div.p1) | PORT_PLL_P2(clk_div.p2);
+	crtc_state->dpll_hw_state.pll0 = clk_div.m2_int;
+	crtc_state->dpll_hw_state.pll1 = PORT_PLL_N(clk_div.n);
+	crtc_state->dpll_hw_state.pll2 = clk_div.m2_frac;
+
+	if (clk_div.m2_frac_en)
+		crtc_state->dpll_hw_state.pll3 =
+			PORT_PLL_M2_FRAC_ENABLE;
+
+	crtc_state->dpll_hw_state.pll6 =
+		clk_div.prop_coef | PORT_PLL_INT_COEFF(clk_div.int_coef);
+	crtc_state->dpll_hw_state.pll6 |=
+		PORT_PLL_GAIN_CTL(clk_div.gain_ctl);
+
+	crtc_state->dpll_hw_state.pll8 = clk_div.targ_cnt;
+
+	crtc_state->dpll_hw_state.pcsdw12 =
+		LANESTAGGER_STRAP_OVRD | clk_div.lanestagger;
+
+	pll = intel_get_shared_dpll(intel_crtc, crtc_state);
+	if (pll == NULL) {
+		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
+			pipe_name(intel_crtc->pipe));
+		return false;
+	}
+
+	/* shared DPLL id 0 is DPLL A */
+	crtc_state->ddi_pll_sel = pll->id;
+
+	return true;
+}
+
 /*
  * Tries to find a *shared* PLL for the CRTC and store it in
  * intel_crtc->ddi_pll_sel.
@@ -1222,6 +1348,9 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
 	if (IS_SKYLAKE(dev))
 		return skl_ddi_pll_select(intel_crtc, crtc_state,
 					  intel_encoder, clock);
+	else if (IS_BROXTON(dev))
+		return bxt_ddi_pll_select(intel_crtc, crtc_state,
+					  intel_encoder, clock);
 	else
 		return hsw_ddi_pll_select(intel_crtc, crtc_state,
 					  intel_encoder, clock);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 41/49
#166 lore raw

Re: [PATCH 41/49] drm/i915/bxt: BXT clock divider calculation

Quoted 154 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Calculate and cache clock parameters. Follow bspec algorithm for HDMI. Use precalculated values for DisplayPort linkrates.

v2: (imre)
- rebase against upstream crtc_state change
- use the existing CHV based helper instead of handrolling the same

---
 drivers/gpu/drm/i915/intel_ddi.c | 129 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 129 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +126 -0
index bbc3da5..fa4f8f4 100644
@@ -1204,6 +1204,132 @@ skl_ddi_pll_select(struct intel_crtc *intel_crtc,
 	return true;
 }
 
+/* bxt clock parameters */
+struct bxt_clk_div {
+	uint32_t p1;
+	uint32_t p2;
+	uint32_t m2_int;
+	uint32_t m2_frac;
+	bool m2_frac_en;
+	uint32_t n;
+	uint32_t prop_coef;
+	uint32_t int_coef;
+	uint32_t gain_ctl;
+	uint32_t targ_cnt;
+	uint32_t lanestagger;
+};
+
+/* pre-calculated values for DP linkrates */
+static struct bxt_clk_div bxt_dp_clk_val[7] = {
+	/* 162 */ {4, 2, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 270 */ {4, 1, 27,       0, 0, 1, 3,  8, 1, 9, 0xd},
+	/* 540 */ {2, 1, 27,       0, 0, 1, 3,  8, 1, 9, 0x18},
+	/* 216 */ {3, 2, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 243 */ {4, 1, 24, 1258291, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 324 */ {4, 1, 32, 1677722, 1, 1, 5, 11, 2, 9, 0xd},
+	/* 432 */ {3, 1, 32, 1677722, 1, 1, 5, 11, 2, 9, 0x18}
+};
+
+static bool
+bxt_ddi_pll_select(struct intel_crtc *intel_crtc,
+		   struct intel_crtc_state *crtc_state,
+		   struct intel_encoder *intel_encoder,
+		   int clock)
+{
+	struct intel_shared_dpll *pll;
+	struct bxt_clk_div clk_div = {0};
+
+	if (intel_encoder->type == INTEL_OUTPUT_HDMI) {
+		intel_clock_t best_clock;
+
+		/* Calculate HDMI div */
+		/*
+		 * FIXME: tie the following calculation into
+		 * i9xx_crtc_compute_clock
+		 */
+		if (!bxt_find_best_dpll(intel_crtc, clock, &best_clock)) {
+			DRM_DEBUG_DRIVER("no PLL dividers found for clock %d pipe %c\n",
+					 clock, pipe_name(intel_crtc->pipe));
+			return false;
+		}
+
+		clk_div.p1 = best_clock.p1;
+		clk_div.p2 = best_clock.p2;
+		WARN_ON(best_clock.m1 != 2);
+		clk_div.n = best_clock.n;
+		clk_div.m2_int = best_clock.m2 >> 22;
+		clk_div.m2_frac = best_clock.m2 & ((1 << 22) - 1);
+		clk_div.m2_frac_en = clk_div.m2_frac != 0;
+
+		/* FIXME: set coef, gain, targcnt based on freq band */
+		clk_div.prop_coef = 5;
+		clk_div.int_coef = 11;
+		clk_div.gain_ctl = 2;
+		clk_div.targ_cnt = 9;
+		if (clock > 270000)
+			clk_div.lanestagger = 0x18;
+		else if (clock > 135000)
+			clk_div.lanestagger = 0x0d;
+		else if (clock > 67000)
+			clk_div.lanestagger = 0x07;
+		else if (clock > 33000)
+			clk_div.lanestagger = 0x04;
+		else
+			clk_div.lanestagger = 0x02;
+	} else if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
+			intel_encoder->type == INTEL_OUTPUT_EDP) {
+		struct drm_encoder *encoder = &intel_encoder->base;
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		switch (intel_dp->link_bw) {
+		case DP_LINK_BW_1_62:
+			clk_div = bxt_dp_clk_val[0];
+			break;
+		case DP_LINK_BW_2_7:
+			clk_div = bxt_dp_clk_val[1];
+			break;
+		case DP_LINK_BW_5_4:
+			clk_div = bxt_dp_clk_val[2];
+			break;
+		default:
+			clk_div = bxt_dp_clk_val[0];
+			DRM_ERROR("Unknown link rate\n");
+		}
+	}
+
+	crtc_state->dpll_hw_state.ebb0 =
+		PORT_PLL_P1(clk_div.p1) | PORT_PLL_P2(clk_div.p2);
+	crtc_state->dpll_hw_state.pll0 = clk_div.m2_int;
+	crtc_state->dpll_hw_state.pll1 = PORT_PLL_N(clk_div.n);
+	crtc_state->dpll_hw_state.pll2 = clk_div.m2_frac;
+
+	if (clk_div.m2_frac_en)
+		crtc_state->dpll_hw_state.pll3 =
+			PORT_PLL_M2_FRAC_ENABLE;
+
+	crtc_state->dpll_hw_state.pll6 =
+		clk_div.prop_coef | PORT_PLL_INT_COEFF(clk_div.int_coef);
+	crtc_state->dpll_hw_state.pll6 |=
+		PORT_PLL_GAIN_CTL(clk_div.gain_ctl);
+
+	crtc_state->dpll_hw_state.pll8 = clk_div.targ_cnt;
+
+	crtc_state->dpll_hw_state.pcsdw12 =
+		LANESTAGGER_STRAP_OVRD | clk_div.lanestagger;
+
+	pll = intel_get_shared_dpll(intel_crtc, crtc_state);
+	if (pll == NULL) {
+		DRM_DEBUG_DRIVER("failed to find PLL for pipe %c\n",
+			pipe_name(intel_crtc->pipe));
+		return false;
+	}
+
+	/* shared DPLL id 0 is DPLL A */
+	crtc_state->ddi_pll_sel = pll->id;
+
+	return true;
+}
+
 /*
  * Tries to find a *shared* PLL for the CRTC and store it in
  * intel_crtc->ddi_pll_sel.

drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_pll_select(struct intel_crtc *intel_crtc, · line 1356

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
@@ -1222,6 +1348,9 @@ bool intel_ddi_pll_select(struct intel_crtc *intel_crtc,
 	if (IS_SKYLAKE(dev))
 		return skl_ddi_pll_select(intel_crtc, crtc_state,
 					  intel_encoder, clock);
+	else if (IS_BROXTON(dev))
+		return bxt_ddi_pll_select(intel_crtc, crtc_state,
+					  intel_encoder, clock);
 	else
 		return hsw_ddi_pll_select(intel_crtc, crtc_state,
 					  intel_encoder, clock);

Should probably have a JIRA on the proper coeff etc values as well. They're in the bspec, we just have to add the code for the frequency bands.

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

author
#167 lore raw

PATCH 42/49 drm/i915/bxt: Assign PLL for pipe

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Assign PLL for pipe (dependent on port attached to the pipe)

v2:
- fix incorrect encoder vs. new_encoder check for crtc (imre)

v3:
- warn and return error if no encoder is attached (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c     | 21 ------------------
 drivers/gpu/drm/i915/intel_display.c | 41 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 42 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -21
index fa4f8f4..0a5d71e 100644
@@ -491,27 +491,6 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc)
 	return ret;
 }
 
-static struct intel_encoder *
-intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
-{
-	struct drm_device *dev = crtc->base.dev;
-	struct intel_encoder *intel_encoder, *ret = NULL;
-	int num_encoders = 0;
-
-	for_each_intel_encoder(dev, intel_encoder) {
-		if (intel_encoder->new_crtc == crtc) {
-			ret = intel_encoder;
-			num_encoders++;
-		}
-	}
-
-	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
-	     pipe_name(crtc->pipe));
-
-	BUG_ON(ret == NULL);
-	return ret;
-}
-
 #define LC_FREQ 2700
 #define LC_FREQ_2K U64_C(LC_FREQ * 2000)
 
drivers/gpu/drm/i915/intel_display.c +41 -0

53 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +1 -0
index 56a5cc9..097fb85 100644
@@ -991,6 +991,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
 			bool state);
 #define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
 #define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
+struct intel_encoder *intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc);
 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 						struct intel_crtc_state *state);
 void intel_put_shared_dpll(struct intel_crtc *crtc);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 42/49
#168 lore raw

Re: [PATCH 42/49] drm/i915/bxt: Assign PLL for pipe

Quoted 115 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Assign PLL for pipe (dependent on port attached to the pipe)

v2:
- fix incorrect encoder vs. new_encoder check for crtc (imre)

v3:
- warn and return error if no encoder is attached (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c     | 21 ------------------
 drivers/gpu/drm/i915/intel_display.c | 41 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 42 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -21
index fa4f8f4..0a5d71e 100644
@@ -491,27 +491,6 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc)
 	return ret;
 }
 
-static struct intel_encoder *
-intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
-{
-	struct drm_device *dev = crtc->base.dev;
-	struct intel_encoder *intel_encoder, *ret = NULL;
-	int num_encoders = 0;
-
-	for_each_intel_encoder(dev, intel_encoder) {
-		if (intel_encoder->new_crtc == crtc) {
-			ret = intel_encoder;
-			num_encoders++;
-		}
-	}
-
-	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
-	     pipe_name(crtc->pipe));
-
-	BUG_ON(ret == NULL);
-	return ret;
-}
-
 #define LC_FREQ 2700
 #define LC_FREQ_2K U64_C(LC_FREQ * 2000)
 
drivers/gpu/drm/i915/intel_display.c +41 -0
index 3606366..411bf50 100644
@@ -4037,6 +4037,27 @@ void intel_put_shared_dpll(struct intel_crtc *crtc)
 	crtc->config->shared_dpll = DPLL_ID_PRIVATE;
 }
 
+struct intel_encoder *
+intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct intel_encoder *intel_encoder, *ret = NULL;
+	int num_encoders = 0;
+
+	for_each_intel_encoder(dev, intel_encoder) {
+		if (intel_encoder->new_crtc == crtc) {
+			ret = intel_encoder;
+			num_encoders++;
+		}
+	}
+
+	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
+	     pipe_name(crtc->pipe));
+
+	BUG_ON(ret == NULL);
+	return ret;
+}
+
 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 						struct intel_crtc_state *crtc_state)
 {
@@ -4057,6 +4078,26 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 		goto found;
 	}
 
+	if (IS_BROXTON(dev_priv->dev)) {
+		/* PLL is attached to port in bxt */
+		struct intel_encoder *encoder;
+		struct intel_digital_port *intel_dig_port;
+
+		encoder = intel_ddi_get_crtc_new_encoder(crtc);
+		if (WARN_ON(!encoder))
+			return NULL;
+
+		intel_dig_port = enc_to_dig_port(&encoder->base);
+		/* 1:1 mapping between ports and PLLs */
+		i = (enum intel_dpll_id)intel_dig_port->port;
+		pll = &dev_priv->shared_dplls[i];
+		DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n",
+			crtc->base.base.id, pll->name);
+		WARN_ON(pll->new_config->crtc_mask);
+
+		goto found;
+	}
+
 	for (i = 0; i < dev_priv->num_shared_dpll; i++) {
 		pll = &dev_priv->shared_dplls[i];
 
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 56a5cc9..097fb85 100644

drivers/gpu/drm/i915/intel_drv.h void assert_shared_dpll(struct drm_i915_private *dev_priv, · line 997

Quoted 7 lines
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -991,6 +991,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
 			bool state);
 #define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
 #define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
+struct intel_encoder *intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc);
 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 						struct intel_crtc_state *state);
 void intel_put_shared_dpll(struct intel_crtc *crtc);

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

#169 lore raw

Re: [PATCH 42/49] drm/i915/bxt: Assign PLL for pipe

In reply to Imre Deak
Quoted 68 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Assign PLL for pipe (dependent on port attached to the pipe)

v2:
- fix incorrect encoder vs. new_encoder check for crtc (imre)

v3:
- warn and return error if no encoder is attached (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c     | 21 ------------------
 drivers/gpu/drm/i915/intel_display.c | 41 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 3 files changed, 42 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +0 -21
index fa4f8f4..0a5d71e 100644
@@ -491,27 +491,6 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc)
 	return ret;
 }
 
-static struct intel_encoder *
-intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
-{
-	struct drm_device *dev = crtc->base.dev;
-	struct intel_encoder *intel_encoder, *ret = NULL;
-	int num_encoders = 0;
-
-	for_each_intel_encoder(dev, intel_encoder) {
-		if (intel_encoder->new_crtc == crtc) {
-			ret = intel_encoder;
-			num_encoders++;
-		}
-	}
-
-	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
-	     pipe_name(crtc->pipe));
-
-	BUG_ON(ret == NULL);
-	return ret;
-}
-
 #define LC_FREQ 2700
 #define LC_FREQ_2K U64_C(LC_FREQ * 2000)
 
drivers/gpu/drm/i915/intel_display.c +10 -0
index 3606366..411bf50 100644
@@ -4037,6 +4037,27 @@ void intel_put_shared_dpll(struct intel_crtc *crtc)
 	crtc->config->shared_dpll = DPLL_ID_PRIVATE;
 }
 
+struct intel_encoder *
+intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct intel_encoder *intel_encoder, *ret = NULL;
+	int num_encoders = 0;
+
+	for_each_intel_encoder(dev, intel_encoder) {
+		if (intel_encoder->new_crtc == crtc) {
+			ret = intel_encoder;

drivers/gpu/drm/i915/intel_display.c void intel_put_shared_dpll(struct intel_crtc *crtc) · line 4059

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+			num_encoders++;
+		}
+	}
+
+	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
+	     pipe_name(crtc->pipe));
+
+	BUG_ON(ret == NULL);
+	return ret;
+}

Imo no need to move this function around, so I dropped that part. -Daniel

Quoted 50 lines
drivers/gpu/drm/i915/intel_display.c +21 -0
+
 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 						struct intel_crtc_state *crtc_state)
 {
@@ -4057,6 +4078,26 @@ struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 		goto found;
 	}
 
+	if (IS_BROXTON(dev_priv->dev)) {
+		/* PLL is attached to port in bxt */
+		struct intel_encoder *encoder;
+		struct intel_digital_port *intel_dig_port;
+
+		encoder = intel_ddi_get_crtc_new_encoder(crtc);
+		if (WARN_ON(!encoder))
+			return NULL;
+
+		intel_dig_port = enc_to_dig_port(&encoder->base);
+		/* 1:1 mapping between ports and PLLs */
+		i = (enum intel_dpll_id)intel_dig_port->port;
+		pll = &dev_priv->shared_dplls[i];
+		DRM_DEBUG_KMS("CRTC:%d using pre-allocated %s\n",
+			crtc->base.base.id, pll->name);
+		WARN_ON(pll->new_config->crtc_mask);
+
+		goto found;
+	}
+
 	for (i = 0; i < dev_priv->num_shared_dpll; i++) {
 		pll = &dev_priv->shared_dplls[i];
 
drivers/gpu/drm/i915/intel_drv.h +1 -0
index 56a5cc9..097fb85 100644
@@ -991,6 +991,7 @@ void assert_shared_dpll(struct drm_i915_private *dev_priv,
 			bool state);
 #define assert_shared_dpll_enabled(d, p) assert_shared_dpll(d, p, true)
 #define assert_shared_dpll_disabled(d, p) assert_shared_dpll(d, p, false)
+struct intel_encoder *intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc);
 struct intel_shared_dpll *intel_get_shared_dpll(struct intel_crtc *crtc,
 						struct intel_crtc_state *state);
 void intel_put_shared_dpll(struct intel_crtc *crtc);
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#170 lore raw

PATCH 43/49 drm/i915/bxt: Determine PLL attached to pipe

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Determine PLL attached to pipe (which is same as DDI PLL)

v2:
- rebased on upstream s/crtc_config/crtc_state/ (imre)

---
 drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_display.c +24 -0
index 411bf50..c060496 100644
@@ -8468,6 +8468,28 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 	return 0;
 }
 
+static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state *pipe_config)
+{
+	switch (port) {
+	case PORT_A:
+		pipe_config->ddi_pll_sel = SKL_DPLL0;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL1;
+		break;
+	case PORT_B:
+		pipe_config->ddi_pll_sel = SKL_DPLL1;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL2;
+		break;
+	case PORT_C:
+		pipe_config->ddi_pll_sel = SKL_DPLL2;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL3;
+		break;
+	default:
+		DRM_ERROR("Incorrect port type\n");
+	}
+}
+
 static void skylake_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state *pipe_config)
@@ -8530,6 +8552,8 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 
 	if (IS_SKYLAKE(dev))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_BROXTON(dev))
+		bxt_get_ddi_pll(dev_priv, port, pipe_config);
 	else
 		haswell_get_ddi_pll(dev_priv, port, pipe_config);
 
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 43/49
#171 lore raw

Re: [PATCH 43/49] drm/i915/bxt: Determine PLL attached to pipe

Quoted 48 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Determine PLL attached to pipe (which is same as DDI PLL)

v2:
- rebased on upstream s/crtc_config/crtc_state/ (imre)

---
 drivers/gpu/drm/i915/intel_display.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/gpu/drm/i915/intel_display.c +22 -0
index 411bf50..c060496 100644
@@ -8468,6 +8468,28 @@ static int haswell_crtc_compute_clock(struct intel_crtc *crtc,
 	return 0;
 }
 
+static void bxt_get_ddi_pll(struct drm_i915_private *dev_priv,
+				enum port port,
+				struct intel_crtc_state *pipe_config)
+{
+	switch (port) {
+	case PORT_A:
+		pipe_config->ddi_pll_sel = SKL_DPLL0;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL1;
+		break;
+	case PORT_B:
+		pipe_config->ddi_pll_sel = SKL_DPLL1;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL2;
+		break;
+	case PORT_C:
+		pipe_config->ddi_pll_sel = SKL_DPLL2;
+		pipe_config->shared_dpll = DPLL_ID_SKL_DPLL3;
+		break;
+	default:
+		DRM_ERROR("Incorrect port type\n");
+	}
+}
+
 static void skylake_get_ddi_pll(struct drm_i915_private *dev_priv,
 				enum port port,
 				struct intel_crtc_state *pipe_config)

drivers/gpu/drm/i915/intel_display.c static void haswell_get_ddi_port_state(struct intel_crtc *crtc, · line 8559

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -8530,6 +8552,8 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 
 	if (IS_SKYLAKE(dev))
 		skylake_get_ddi_pll(dev_priv, port, pipe_config);
+	else if (IS_BROXTON(dev))
+		bxt_get_ddi_pll(dev_priv, port, pipe_config);
 	else
 		haswell_get_ddi_pll(dev_priv, port, pipe_config);
 

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

author
#172 lore raw

PATCH 44/49 drm/i915/bxt: Determine programmed frequency

In reply to Imre Deak

From: Satheeshakrishna M <[email protected]>

Add placeholder function for calculating programmed pixel clock.
Note: Formula to back calculate link clock from dividers not available currently.

v2:
- rebased on upstream s/crtc_config/crtc_state/ change (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c | 30 +++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dp.c  |  2 ++
 2 files changed, 31 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -1
index 0a5d71e..ff62054 100644
@@ -851,6 +851,32 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder,
 		pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
 }
 
+static int bxt_calc_pll_link(struct drm_i915_private *dev_priv,
+				enum intel_dpll_id dpll)
+{
+	/* FIXME formula not available in bspec */
+	return 0;
+}
+
+static void bxt_ddi_clock_get(struct intel_encoder *encoder,
+				struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
+	enum port port = intel_ddi_get_encoder_port(encoder);
+	uint32_t dpll = port;
+
+	pipe_config->port_clock =
+		bxt_calc_pll_link(dev_priv, dpll);
+
+	if (pipe_config->has_dp_encoder)
+		pipe_config->base.adjusted_mode.crtc_clock =
+			intel_dotclock_calculate(pipe_config->port_clock,
+							&pipe_config->dp_m_n);
+	else
+		pipe_config->base.adjusted_mode.crtc_clock =
+							pipe_config->port_clock;
+}
+
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config)
 {
@@ -858,8 +884,10 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 
 	if (INTEL_INFO(dev)->gen <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
-	else
+	else if (IS_SKYLAKE(dev))
 		skl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_BROXTON(dev))
+		bxt_ddi_clock_get(encoder, pipe_config);
 }
 
 static void
drivers/gpu/drm/i915/intel_dp.c +2 -0
index ca60060..4bfbeed 100644
@@ -1416,6 +1416,8 @@ found:
 
 	if (IS_SKYLAKE(dev) && is_edp(intel_dp))
 		skl_edp_set_pll_config(pipe_config, supported_rates[clock]);
+	else if (IS_BROXTON(dev))
+		/* handled in ddi */;
 	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw);
 	else
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 44/49
#173 lore raw

Re: [PATCH 44/49] drm/i915/bxt: Determine programmed frequency

Quoted 71 lines · Imre Deak

From: Satheeshakrishna M <[email protected]>

Add placeholder function for calculating programmed pixel clock.
Note: Formula to back calculate link clock from dividers not available currently.

v2:
- rebased on upstream s/crtc_config/crtc_state/ change (imre)

---
 drivers/gpu/drm/i915/intel_ddi.c | 30 +++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dp.c  |  2 ++
 2 files changed, 31 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -1
index 0a5d71e..ff62054 100644
@@ -851,6 +851,32 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder,
 		pipe_config->base.adjusted_mode.crtc_clock = pipe_config->port_clock;
 }
 
+static int bxt_calc_pll_link(struct drm_i915_private *dev_priv,
+				enum intel_dpll_id dpll)
+{
+	/* FIXME formula not available in bspec */
+	return 0;
+}
+
+static void bxt_ddi_clock_get(struct intel_encoder *encoder,
+				struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
+	enum port port = intel_ddi_get_encoder_port(encoder);
+	uint32_t dpll = port;
+
+	pipe_config->port_clock =
+		bxt_calc_pll_link(dev_priv, dpll);
+
+	if (pipe_config->has_dp_encoder)
+		pipe_config->base.adjusted_mode.crtc_clock =
+			intel_dotclock_calculate(pipe_config->port_clock,
+							&pipe_config->dp_m_n);
+	else
+		pipe_config->base.adjusted_mode.crtc_clock =
+							pipe_config->port_clock;
+}
+
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config)
 {
@@ -858,8 +884,10 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 
 	if (INTEL_INFO(dev)->gen <= 8)
 		hsw_ddi_clock_get(encoder, pipe_config);
-	else
+	else if (IS_SKYLAKE(dev))
 		skl_ddi_clock_get(encoder, pipe_config);
+	else if (IS_BROXTON(dev))
+		bxt_ddi_clock_get(encoder, pipe_config);
 }
 
 static void
drivers/gpu/drm/i915/intel_dp.c +0 -0
index ca60060..4bfbeed 100644

drivers/gpu/drm/i915/intel_dp.c found: · line 1423

Quoted 8 lines
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -1416,6 +1416,8 @@ found:
 
 	if (IS_SKYLAKE(dev) && is_edp(intel_dp))
 		skl_edp_set_pll_config(pipe_config, supported_rates[clock]);
+	else if (IS_BROXTON(dev))
+		/* handled in ddi */;
 	else if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		hsw_dp_set_ddi_pll_sel(pipe_config, intel_dp->link_bw);
 	else

Another one for JIRA. Looks like the formulas are in there now:
Actual Output = M2 * 400 / (P1 * P2) // Actual differs from desired due to limited M2 fractional precision

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

author
#174 lore raw

PATCH 45/49 drm/i915: suppress false PLL state warnings on non-GMCH platforms

In reply to Imre Deak

The checks for PLL enabled state on CPU ports are valid only on GMCH platforms but atm we'd also call them on non-PCH-split/non-GMCH platforms like BXT, triggering false warnings. Until the proper check is implented for these platforms simply disable the check.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index c060496..ff26752 100644
@@ -2099,7 +2099,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
 	 * a plane.  On ILK+ the pipe PLLs are integrated, so we don't
 	 * need the check.
 	 */
-	if (!HAS_PCH_SPLIT(dev_priv->dev))
+	if (HAS_GMCH_DISPLAY(dev_priv->dev))
 		if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else
@@ -4376,7 +4376,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
 	if (!crtc->state->enable || !intel_crtc->active)
 		return;
 
-	if (!HAS_PCH_SPLIT(dev_priv->dev)) {
+	if (HAS_GMCH_DISPLAY(dev_priv->dev)) {
 		if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else
Signature · 6 lines
2.1.0

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

Re: [PATCH 45/49] drm/i915: suppress false PLL state warnings on non-GMCH platforms

Quoted 25 lines · Imre Deak

The checks for PLL enabled state on CPU ports are valid only on GMCH platforms but atm we'd also call them on non-PCH-split/non-GMCH platforms like BXT, triggering false warnings. Until the proper check is implented for these platforms simply disable the check.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index c060496..ff26752 100644
@@ -2099,7 +2099,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
 	 * a plane.  On ILK+ the pipe PLLs are integrated, so we don't
 	 * need the check.
 	 */
-	if (!HAS_PCH_SPLIT(dev_priv->dev))
+	if (HAS_GMCH_DISPLAY(dev_priv->dev))
 		if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_load_lut(struct drm_crtc *crtc) · line 4382

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -4376,7 +4376,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
 	if (!crtc->state->enable || !intel_crtc->active)
 		return;
 
-	if (!HAS_PCH_SPLIT(dev_priv->dev)) {
+	if (HAS_GMCH_DISPLAY(dev_priv->dev)) {
 		if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else

It looks like we're doing dsi calls, so this must at least apply to BYT, right? We might need more granularity here...

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

author
#176 lore raw

Re: [PATCH 45/49] drm/i915: suppress false PLL state warnings on non-GMCH platforms

Quoted 28 lines · Jesse Barnes
Quoted 27 lines · Imre Deak

The checks for PLL enabled state on CPU ports are valid only on GMCH platforms but atm we'd also call them on non-PCH-split/non-GMCH platforms like BXT, triggering false warnings. Until the proper check is implented for these platforms simply disable the check.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index c060496..ff26752 100644
@@ -2099,7 +2099,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
 	 * a plane.  On ILK+ the pipe PLLs are integrated, so we don't
 	 * need the check.
 	 */
-	if (!HAS_PCH_SPLIT(dev_priv->dev))
+	if (HAS_GMCH_DISPLAY(dev_priv->dev))
 		if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else
@@ -4376,7 +4376,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
 	if (!crtc->state->enable || !intel_crtc->active)
 		return;
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_load_lut(struct drm_crtc *crtc) · line 4382

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
-	if (!HAS_PCH_SPLIT(dev_priv->dev)) {
+	if (HAS_GMCH_DISPLAY(dev_priv->dev)) {
 		if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else

It looks like we're doing dsi calls, so this must at least apply to BYT, right? We might need more granularity here...

Yea, but VLV is covered by the GMCH check.

Quoted 2 lines

Jesse

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

Reviewed-by
#177 lore raw

Re: [PATCH 45/49] drm/i915: suppress false PLL state warnings on non-GMCH platforms

Quoted 39 lines · Imre Deak
Quoted 28 lines · Jesse Barnes
Quoted 27 lines · Imre Deak

The checks for PLL enabled state on CPU ports are valid only on GMCH platforms but atm we'd also call them on non-PCH-split/non-GMCH platforms like BXT, triggering false warnings. Until the proper check is implented for these platforms simply disable the check.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
index c060496..ff26752 100644
@@ -2099,7 +2099,7 @@ static void intel_enable_pipe(struct intel_crtc *crtc)
 	 * a plane.  On ILK+ the pipe PLLs are integrated, so we don't
 	 * need the check.
 	 */
-	if (!HAS_PCH_SPLIT(dev_priv->dev))
+	if (HAS_GMCH_DISPLAY(dev_priv->dev))
 		if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else
@@ -4376,7 +4376,7 @@ static void intel_crtc_load_lut(struct drm_crtc *crtc)
 	if (!crtc->state->enable || !intel_crtc->active)
 		return;
 
Quoted 9 lines

drivers/gpu/drm/i915/intel_display.c static void intel_crtc_load_lut(struct drm_crtc *crtc) · line 4382

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
-	if (!HAS_PCH_SPLIT(dev_priv->dev)) {
+	if (HAS_GMCH_DISPLAY(dev_priv->dev)) {
 		if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DSI))
 			assert_dsi_pll_enabled(dev_priv);
 		else

It looks like we're doing dsi calls, so this must at least apply to BYT, right? We might need more granularity here...

Quoted 1 line

Yea, but VLV is covered by the GMCH check.

Ah ok, in that case it's fine.

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

author
#178 lore raw

PATCH 46/49 drm/i915: Iterate through the initialized DDIs to prepare their buffers

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

Not every DDIs is necessarily connected can be strapped off and, in the future, we'll have platforms with a different number of default DDI ports. So, let's only call intel_prepare_ddi_buffers() on DDI ports that are actually detected.

We also use the opportunity to give a struct intel_digital_port to intel_prepare_ddi_buffers() as we'll need it in a following patch to query if the port supports HMDI or not.

On my HSW machine this removes the initialization of a couple of (unused) DDIs.

---
 drivers/gpu/drm/i915/i915_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_ddi.c | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index e4dd4bba..e6402b0 100644
@@ -251,6 +251,10 @@ enum hpd_pin {
 			    &dev->mode_config.connector_list,	\
 			    base.head)
 
+#define for_each_digital_port(dev, digital_port)		\
+	list_for_each_entry(digital_port,			\
+			    &dev->mode_config.encoder_list,	\
+			    base.base.head)
 
 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
 	list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
drivers/gpu/drm/i915/intel_ddi.c +12 -4
index ff62054..5c18018 100644
@@ -189,10 +189,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
  * in either FDI or DP modes only, as HDMI connections will work with both
  * of those
  */
-static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
+static void intel_prepare_ddi_buffers(struct drm_device *dev,
+				      struct intel_digital_port *intel_dig_port)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 reg;
+	int port = intel_dig_port->port;
 	int i, n_hdmi_entries, n_dp_entries, n_edp_entries, hdmi_default_entry,
 	    size;
 	int hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
@@ -307,13 +309,19 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
  */
 void intel_prepare_ddi(struct drm_device *dev)
 {
-	int port;
+	struct intel_digital_port *intel_dig_port;
+	bool visited[I915_MAX_PORTS] = { 0, };
 
 	if (!HAS_DDI(dev))
 		return;
 
-	for (port = PORT_A; port <= PORT_E; port++)
-		intel_prepare_ddi_buffers(dev, port);
+	for_each_digital_port(dev, intel_dig_port) {
+		if (visited[intel_dig_port->port])
+			continue;
+
+		intel_prepare_ddi_buffers(dev, intel_dig_port);
+		visited[intel_dig_port->port] = true;
+	}
 }
 
 static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 46/49
#179 lore raw

Re: [PATCH 46/49] drm/i915: Iterate through the initialized DDIs to prepare their buffers

Quoted 66 lines · Imre Deak

From: Damien Lespiau <[email protected]>

Not every DDIs is necessarily connected can be strapped off and, in the future, we'll have platforms with a different number of default DDI ports. So, let's only call intel_prepare_ddi_buffers() on DDI ports that are actually detected.

We also use the opportunity to give a struct intel_digital_port to intel_prepare_ddi_buffers() as we'll need it in a following patch to query if the port supports HMDI or not.

On my HSW machine this removes the initialization of a couple of (unused) DDIs.

---
  drivers/gpu/drm/i915/i915_drv.h  |  4 ++++
  drivers/gpu/drm/i915/intel_ddi.c | 16 ++++++++++++----
  2 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +4 -0
index e4dd4bba..e6402b0 100644
@@ -251,6 +251,10 @@ enum hpd_pin {
  			    &dev->mode_config.connector_list,	\
  			    base.head)
 
+#define for_each_digital_port(dev, digital_port)		\
+	list_for_each_entry(digital_port,			\
+			    &dev->mode_config.encoder_list,	\
+			    base.base.head)
 
  #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
  	list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
drivers/gpu/drm/i915/intel_ddi.c +5 -4
index ff62054..5c18018 100644
@@ -189,10 +189,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
   * in either FDI or DP modes only, as HDMI connections will work with both
   * of those
   */
-static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
+static void intel_prepare_ddi_buffers(struct drm_device *dev,
+				      struct intel_digital_port *intel_dig_port)
  {
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	u32 reg;
+	int port = intel_dig_port->port;
  	int i, n_hdmi_entries, n_dp_entries, n_edp_entries, hdmi_default_entry,
  	    size;
  	int hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
@@ -307,13 +309,19 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
   */
  void intel_prepare_ddi(struct drm_device *dev)
  {
-	int port;
+	struct intel_digital_port *intel_dig_port;
+	bool visited[I915_MAX_PORTS] = { 0, };
 
  	if (!HAS_DDI(dev))
  		return;
 
-	for (port = PORT_A; port <= PORT_E; port++)
-		intel_prepare_ddi_buffers(dev, port);

drivers/gpu/drm/i915/intel_ddi.c static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) · line 327

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	for_each_digital_port(dev, intel_dig_port) {
+		if (visited[intel_dig_port->port])
+			continue;
+
+		intel_prepare_ddi_buffers(dev, intel_dig_port);
+		visited[intel_dig_port->port] = true;
+	}
  }
 
  static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,

is visited[] for handling MST scenarios ?if so looks good to me.

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

#180 lore raw

Re: [PATCH 46/49] drm/i915: Iterate through the initialized DDIs to prepare their buffers

Quoted 11 lines · Sivakumar Thulasimani
Quoted 11 lines

void intel_prepare_ddi(struct drm_device *dev)
{

drivers/gpu/drm/i915/intel_ddi.c +4 -3
-	int port;
+	struct intel_digital_port *intel_dig_port;
+	bool visited[I915_MAX_PORTS] = { 0, };
 	if (!HAS_DDI(dev))
 		return;
-	for (port = PORT_A; port <= PORT_E; port++)
-		intel_prepare_ddi_buffers(dev, port);
+	for_each_digital_port(dev, intel_dig_port) {
+		if (visited[intel_dig_port->port])
Quoted 8 lines

drivers/gpu/drm/i915/intel_ddi.c static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) · line 327

Quoted 7 lines
drivers/gpu/drm/i915/intel_ddi.c +5 -0
+			continue;
+
+		intel_prepare_ddi_buffers(dev, intel_dig_port);
+		visited[intel_dig_port->port] = true;
+	}
 }
 static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,

is visited[] for handling MST scenarios ?if so looks good to me.

Yes visited[] is to make sure we don't re-init the DDI for the MST encoders.

Paulo had another review comment I never had time to address though:

https://freedesktop.org/patch/31026/

Signature · 5 lines
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#181 lore raw

Re: [PATCH 46/49] drm/i915: Iterate through the initialized DDIs to prepare their buffers

In reply to Imre Deak
Quoted 25 lines · Imre Deak

From: Damien Lespiau <[email protected]>

Not every DDIs is necessarily connected can be strapped off and, in the future, we'll have platforms with a different number of default DDI ports. So, let's only call intel_prepare_ddi_buffers() on DDI ports that are actually detected.

We also use the opportunity to give a struct intel_digital_port to intel_prepare_ddi_buffers() as we'll need it in a following patch to query if the port supports HMDI or not.

On my HSW machine this removes the initialization of a couple of (unused) DDIs.

---
 drivers/gpu/drm/i915/i915_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_ddi.c | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index e4dd4bba..e6402b0 100644

drivers/gpu/drm/i915/i915_drv.h enum hpd_pin { · line 257

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +4 -0
@@ -251,6 +251,10 @@ enum hpd_pin {
 			    &dev->mode_config.connector_list,	\
 			    base.head)
 
+#define for_each_digital_port(dev, digital_port)		\
+	list_for_each_entry(digital_port,			\
+			    &dev->mode_config.encoder_list,	\
+			    base.base.head)

This breaks HSW machines with CRTs. We can't just assume all the encoders are digital ports.

Ander

Quoted 34 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define for_each_encoder_on_crtc(dev, __crtc, intel_encoder) \
 	list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
drivers/gpu/drm/i915/intel_ddi.c +5 -4
index ff62054..5c18018 100644
@@ -189,10 +189,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
  * in either FDI or DP modes only, as HDMI connections will work with both
  * of those
  */
-static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
+static void intel_prepare_ddi_buffers(struct drm_device *dev,
+				      struct intel_digital_port *intel_dig_port)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	u32 reg;
+	int port = intel_dig_port->port;
 	int i, n_hdmi_entries, n_dp_entries, n_edp_entries, hdmi_default_entry,
 	    size;
 	int hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
@@ -307,13 +309,19 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
  */
 void intel_prepare_ddi(struct drm_device *dev)
 {
-	int port;
+	struct intel_digital_port *intel_dig_port;
+	bool visited[I915_MAX_PORTS] = { 0, };
 
 	if (!HAS_DDI(dev))
 		return;
 
-	for (port = PORT_A; port <= PORT_E; port++)
-		intel_prepare_ddi_buffers(dev, port);

drivers/gpu/drm/i915/intel_ddi.c static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port) · line 327

Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7 -0
+	for_each_digital_port(dev, intel_dig_port) {
+		if (visited[intel_dig_port->port])
+			continue;
+
+		intel_prepare_ddi_buffers(dev, intel_dig_port);
+		visited[intel_dig_port->port] = true;
+	}
 }
 
 static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,

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

author
#182 lore raw

Re: [PATCH 46/49] drm/i915: Iterate through the initialized DDIs to prepare their buffers

Quoted 29 lines · Ander Conselvan De Oliveira
Quoted 28 lines · Imre Deak

From: Damien Lespiau <[email protected]>

Not every DDIs is necessarily connected can be strapped off and, in the future, we'll have platforms with a different number of default DDI ports. So, let's only call intel_prepare_ddi_buffers() on DDI ports that are actually detected.

We also use the opportunity to give a struct intel_digital_port to intel_prepare_ddi_buffers() as we'll need it in a following patch to query if the port supports HMDI or not.

On my HSW machine this removes the initialization of a couple of (unused) DDIs.

---
 drivers/gpu/drm/i915/i915_drv.h  |  4 ++++
 drivers/gpu/drm/i915/intel_ddi.c | 16 ++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index e4dd4bba..e6402b0 100644
@@ -251,6 +251,10 @@ enum hpd_pin {
 			    &dev->mode_config.connector_list,	\
 			    base.head)
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.h enum hpd_pin { · line 257

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +4 -0
+#define for_each_digital_port(dev, digital_port)		\
+	list_for_each_entry(digital_port,			\
+			    &dev->mode_config.encoder_list,	\
+			    base.base.head)

This breaks HSW machines with CRTs. We can't just assume all the encoders are digital ports.

I posted a fix for this:
http://lists.freedesktop.org/archives/intel-gfx/2015-April/064993.html

--Imre

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

author
#183 lore raw

PATCH 47/49 drm/i915: Don't write the HDMI buffer translation entry when not needed

In reply to Imre Deak

From: Damien Lespiau <[email protected]>

We don't actually need to write the HDMI entry on DDIs that have no chance to be used as HDMI ports.

While this patch shouldn't change the current behaviour, it makes further enabling work easier as we'll have an eDP table filling the full 10 entries.

v2: Rely on the logic from intel_ddi_init() to figure out if the DDI port
supports HDMI or not (Paulo).

---
 drivers/gpu/drm/i915/intel_ddi.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +9 -0
index 5c18018..5aa4dab 100644
@@ -182,6 +182,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
 	}
 }
 
+static bool
+intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
+{
+	return intel_dig_port->hdmi.hdmi_reg;
+}
+
 /*
  * Starting with Haswell, DDI port buffers must be programmed with correct
  * values in advance. The buffer values are different for FDI and DP modes,
@@ -292,6 +298,9 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev,
 		reg += 4;
 	}
 
+	if (!intel_dig_port_supports_hdmi(intel_dig_port))
+		return;
+
 	/* Choose a good default if VBT is badly populated */
 	if (hdmi_level == HDMI_LEVEL_SHIFT_UNKNOWN ||
 	    hdmi_level >= n_hdmi_entries)
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 47/49
#184 lore raw

Re: [PATCH 47/49] drm/i915: Don't write the HDMI buffer translation entry when not needed

Quoted 36 lines · Imre Deak

From: Damien Lespiau <[email protected]>

We don't actually need to write the HDMI entry on DDIs that have no chance to be used as HDMI ports.

While this patch shouldn't change the current behaviour, it makes further enabling work easier as we'll have an eDP table filling the full 10 entries.

v2: Rely on the logic from intel_ddi_init() to figure out if the DDI port
supports HDMI or not (Paulo).

---
  drivers/gpu/drm/i915/intel_ddi.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_ddi.c +6 -0
index 5c18018..5aa4dab 100644
@@ -182,6 +182,12 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *intel_encoder)
  	}
  }
 
+static bool
+intel_dig_port_supports_hdmi(const struct intel_digital_port *intel_dig_port)
+{
+	return intel_dig_port->hdmi.hdmi_reg;
+}
+
  /*
   * Starting with Haswell, DDI port buffers must be programmed with correct
   * values in advance. The buffer values are different for FDI and DP modes,

drivers/gpu/drm/i915/intel_ddi.c static void intel_prepare_ddi_buffers(struct drm_device *dev, · line 306

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +3 -0
@@ -292,6 +298,9 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev,
  		reg += 4;
  	}
 
+	if (!intel_dig_port_supports_hdmi(intel_dig_port))
+		return;
+
  	/* Choose a good default if VBT is badly populated */
  	if (hdmi_level == HDMI_LEVEL_SHIFT_UNKNOWN ||
  	    hdmi_level >= n_hdmi_entries)

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

author
#185 lore raw

PATCH 48/49 drm/i915/bxt: VSwing programming sequence

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

VSwing programming sequence as specified in the updated BXT BSpec

v2: Satheesh's review comments addressed.
- clear value before setting into registers
- move print statement to bxt function
Other changes
- since signal level will not be set into DDI_BUF_CTL, the value need not be returned to intel_dp_set_signal_levels(). Making the bxt specific function to return void and setting signal_levels = 0 for bxt inside intel_dp_set_signal_levels()
- instead of signal levels, printing vswing level and pre-emphasis level
- in case none of the pre-emphasis levels or vswing levels are set, setting default of 400mV + 0dB

v3: Satheesh's review comments
- Check for mask before printing signal_levels.
- Removing redundant register writes
- Call intel_prepare_ddi_buffers only for HAS_PCH_SPLIT
- Making register write part generic as it will be required for HDMI as well.

Re-structure the code to include an array for vswing related values, set signal levels

v4: Satheesh's review comments
- Rebase over latest renaming patches
- use hsw_signal_levels for HAS_DDI
Other changes
- Modified vswing_sequence() func definition
- Rebased on top of register macro definitions

v5: Satheesh's review comments
- Check ddi translation table size

v6: Imre's review comments
- removed comments in vswing sequence
- added vswing, pre-emphasis prints in intel_dp_set_signal_levels
- added comment explaining use of DP vswing values for eDP
- initialize n_entries and ddi_transaltion table based on encoder type
- create bxt_ddi_buf_trans structure and use decimal values
- adding a flag in bxt buffer translation table to indicate def entry

v7: (imre)
- squash in Vandana's "VSwing register definition", "HDMI VSwing programming", "Re-enable vswing programming", "Fix vswing sequence" patches
- use BXT_PORT_* regs directly instead of via a temp var
- simplify BXT_PORT_* macro definitions
- add code comment why we read lane while write group registers
- fix readout of DP_TRAIN_PRE_EMPHASIS in debug message

---
 drivers/gpu/drm/i915/i915_reg.h  |  61 ++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c | 120 ++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_dp.c  |  64 ++++++++++++++++++++-
 drivers/gpu/drm/i915/intel_drv.h |   2 +
 4 files changed, 244 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +61 -0
index 2e72283c..545b7cf 100644
@@ -1269,6 +1269,21 @@ enum bxt_phy {
 						     _PORT_REF_DW8_BC)
 
 /* BXT PHY PCS registers */
+#define _PORT_PCS_DW10_LN01_A		0x162428
+#define _PORT_PCS_DW10_LN01_B		0x6C428
+#define _PORT_PCS_DW10_LN01_C		0x6C828
+#define _PORT_PCS_DW10_GRP_A		0x162C28
+#define _PORT_PCS_DW10_GRP_B		0x6CC28
+#define _PORT_PCS_DW10_GRP_C		0x6CE28
+#define BXT_PORT_PCS_DW10_LN01(port)	_PORT3(port, _PORT_PCS_DW10_LN01_A, \
+						     _PORT_PCS_DW10_LN01_B, \
+						     _PORT_PCS_DW10_LN01_C)
+#define BXT_PORT_PCS_DW10_GRP(port)	_PORT3(port, _PORT_PCS_DW10_GRP_A,  \
+						     _PORT_PCS_DW10_GRP_B,  \
+						     _PORT_PCS_DW10_GRP_C)
+#define   TX2_SWING_CALC_INIT		(1 << 31)
+#define   TX1_SWING_CALC_INIT		(1 << 30)
+
 #define _PORT_PCS_DW12_LN01_A		0x162430
 #define _PORT_PCS_DW12_LN01_B		0x6C430
 #define _PORT_PCS_DW12_LN01_C		0x6C830
@@ -1294,6 +1309,52 @@ enum bxt_phy {
 #define BXT_LANE_OFFSET(lane)           (((lane) >> 1) * 0x200 +	\
 					 ((lane) & 1) * 0x80)
 
+#define _PORT_TX_DW2_LN0_A		0x162508
+#define _PORT_TX_DW2_LN0_B		0x6C508
+#define _PORT_TX_DW2_LN0_C		0x6C908
+#define _PORT_TX_DW2_GRP_A		0x162D08
+#define _PORT_TX_DW2_GRP_B		0x6CD08
+#define _PORT_TX_DW2_GRP_C		0x6CF08
+#define BXT_PORT_TX_DW2_GRP(port)	_PORT3(port, _PORT_TX_DW2_GRP_A,  \
+						     _PORT_TX_DW2_GRP_B,  \
+						     _PORT_TX_DW2_GRP_C)
+#define BXT_PORT_TX_DW2_LN0(port)	_PORT3(port, _PORT_TX_DW2_LN0_A,  \
+						     _PORT_TX_DW2_LN0_B,  \
+						     _PORT_TX_DW2_LN0_C)
+#define   MARGIN_000_SHIFT		16
+#define   MARGIN_000			(0xFF << MARGIN_000_SHIFT)
+#define   UNIQ_TRANS_SCALE_SHIFT	8
+#define   UNIQ_TRANS_SCALE		(0xFF << UNIQ_TRANS_SCALE_SHIFT)
+
+#define _PORT_TX_DW3_LN0_A		0x16250C
+#define _PORT_TX_DW3_LN0_B		0x6C50C
+#define _PORT_TX_DW3_LN0_C		0x6C90C
+#define _PORT_TX_DW3_GRP_A		0x162D0C
+#define _PORT_TX_DW3_GRP_B		0x6CD0C
+#define _PORT_TX_DW3_GRP_C		0x6CF0C
+#define BXT_PORT_TX_DW3_GRP(port)	_PORT3(port, _PORT_TX_DW3_GRP_A,  \
+						     _PORT_TX_DW3_GRP_B,  \
+						     _PORT_TX_DW3_GRP_C)
+#define BXT_PORT_TX_DW3_LN0(port)	_PORT3(port, _PORT_TX_DW3_LN0_A,  \
+						     _PORT_TX_DW3_LN0_B,  \
+						     _PORT_TX_DW3_LN0_C)
+#define   UNIQE_TRANGE_EN_METHOD	(1 << 27)
+
+#define _PORT_TX_DW4_LN0_A		0x162510
+#define _PORT_TX_DW4_LN0_B		0x6C510
+#define _PORT_TX_DW4_LN0_C		0x6C910
+#define _PORT_TX_DW4_GRP_A		0x162D10
+#define _PORT_TX_DW4_GRP_B		0x6CD10
+#define _PORT_TX_DW4_GRP_C		0x6CF10
+#define BXT_PORT_TX_DW4_LN0(port)	_PORT3(port, _PORT_TX_DW4_LN0_A,  \
+						     _PORT_TX_DW4_LN0_B,  \
+						     _PORT_TX_DW4_LN0_C)
+#define BXT_PORT_TX_DW4_GRP(port)	_PORT3(port, _PORT_TX_DW4_GRP_A,  \
+						     _PORT_TX_DW4_GRP_B,  \
+						     _PORT_TX_DW4_GRP_C)
+#define   DEEMPH_SHIFT			24
+#define   DE_EMPHASIS			(0xFF << DEEMPH_SHIFT)
+
 #define _PORT_TX_DW14_LN0_A		0x162538
 #define _PORT_TX_DW14_LN0_B		0x6C538
 #define _PORT_TX_DW14_LN0_C		0x6C938
drivers/gpu/drm/i915/intel_ddi.c +119 -1

150 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dp.c +62 -2

82 lines not on this page · raw message

drivers/gpu/drm/i915/intel_drv.h +2 -0
index 097fb85..f07a14a 100644
@@ -874,6 +874,8 @@ void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config);
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
 void bxt_select_cdclk_freq(struct drm_device *dev, u32 frequency);
+void bxt_ddi_vswing_sequence(struct drm_device *dev, u32 level,
+				enum port port, int type);
 
 /* intel_frontbuffer.c */
 void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 48/49
#186 lore raw

Re: [PATCH 48/49] drm/i915/bxt: VSwing programming sequence

Quoted 6 lines · Imre Deak

From: Vandana Kannan <[email protected]>

VSwing programming sequence as specified in the updated BXT BSpec
...
...

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc) · line 1727

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +9 -0
+void bxt_ddi_vswing_sequence(struct drm_device *dev, u32 level,
+			     enum port port, int type)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const struct bxt_ddi_buf_trans *ddi_translations;
+	u32 n_entries, i;
+	uint32_t val;
+
+	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {

INTEL_OUPPUT_DP_MST might be needed here, please check once. otherwise fine with the changes.

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

author
#187 lore raw

Re: [PATCH 48/49] drm/i915/bxt: VSwing programming sequence

Hi Sivakumar,

Quoted 8 lines · Sivakumar Thulasimani
Quoted 6 lines · Imre Deak

From: Vandana Kannan <[email protected]>

VSwing programming sequence as specified in the updated BXT BSpec
...
...

Quoted 11 lines

drivers/gpu/drm/i915/intel_ddi.c void intel_ddi_disable_pipe_clock(struct intel_crtc *intel_crtc) · line 1727

Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c +9 -0
+void bxt_ddi_vswing_sequence(struct drm_device *dev, u32 level,
+			     enum port port, int type)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	const struct bxt_ddi_buf_trans *ddi_translations;
+	u32 n_entries, i;
+	uint32_t val;
+
+	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {

INTEL_OUPPUT_DP_MST might be needed here, please check once. otherwise fine with the changes.

Tbh, I had to check this after you brought this up: we can't get here with INTEL_OUTPUT_DP_MST. That type is only assigned to "fake" encoders, which only handle the MST aspects of the modeset. An MST encoder like this will have an associated "primary" encoder (available via its "primary" digital port field) which will handle the ordinary DP aspects of the modeset. So link training as such is handled by the primary encoder which for DP will be always either INTEL_OUTPUT_DISPLAYPORT or INTEL_OUTPUT_EDP.

Thanks for pointing this out,
Imre

Quoted 1 line

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

author
#188 lore raw

PATCH 49/49 drm/i915/bxt: Update max level of vswing

In reply to Imre Deak

From: Vandana Kannan <[email protected]>

Broxton supports 3 voltage swing levels on all DP ports. Max level of pre-emphasis will be taken care with the existing code.

v2: Patch rebased

v3: (imre)
- keep existing behavior for other platforms
- clarify commit message

---
 drivers/gpu/drm/i915/intel_dp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +3 -1
index 1cb6eb0..019c224 100644
@@ -2832,7 +2832,9 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum port port = dp_to_dig_port(intel_dp)->port;
 
-	if (INTEL_INFO(dev)->gen >= 9) {
+	if (IS_BROXTON(dev))
+		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
+	else if (INTEL_INFO(dev)->gen >= 9) {
 		if (dev_priv->vbt.edp_low_vswing && port == PORT_A)
 			return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
 		return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;
Signature · 6 lines
2.1.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 49/49
#189 lore raw

Re: [PATCH 49/49] drm/i915/bxt: Update max level of vswing

Task id: 5978 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                 -1              268/268              267/268
ILK                 -1              303/303              302/303

SNB 283/283 283/283
IVB -1 343/343 342/343
BYT 287/287 287/287
HSW -4 319/319 315/319
BDW 308/308 308/308
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied

*PNV  igt_gem_userptr_blits_minor-normal-sync      PASS(3)      DMESG_WARN(1)PASS(1)
*ILK  igt_drv_suspend_fence-restore-untiled      PASS(2)      DMESG_WARN(1)PASS(1)
*IVB  igt_gem_storedw_batches_loop_normal      PASS(2)      DMESG_WARN(1)PASS(1)
*HSW  igt_pm_rpm_cursor      PASS(2)      TIMEOUT(1)PASS(1)
*HSW  igt_pm_rpm_cursor-dpms      PASS(2)      TIMEOUT(2)
*HSW  igt_pm_rpm_debugfs-forcewake-user      PASS(2)      TIMEOUT(1)
*HSW  igt_pm_rpm_debugfs-read      PASS(2)      TIMEOUT(1)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 49/49
#190 lore raw

Re: [PATCH 49/49] drm/i915/bxt: Update max level of vswing

In reply to Imre Deak
Quoted 22 lines · Imre Deak

From: Vandana Kannan <[email protected]>

Broxton supports 3 voltage swing levels on all DP ports. Max level of pre-emphasis will be taken care with the existing code.

v2: Patch rebased

v3: (imre)
- keep existing behavior for other platforms
- clarify commit message

---
  drivers/gpu/drm/i915/intel_dp.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dp.c +0 -0
index 1cb6eb0..019c224 100644

drivers/gpu/drm/i915/intel_dp.c intel_dp_voltage_max(struct intel_dp *intel_dp) · line 2840

Quoted 10 lines
drivers/gpu/drm/i915/intel_dp.c +3 -1
@@ -2832,7 +2832,9 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	enum port port = dp_to_dig_port(intel_dp)->port;
 
-	if (INTEL_INFO(dev)->gen >= 9) {
+	if (IS_BROXTON(dev))
+		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
+	else if (INTEL_INFO(dev)->gen >= 9) {
  		if (dev_priv->vbt.edp_low_vswing && port == PORT_A)
  			return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
  		return DP_TRAIN_VOLTAGE_SWING_LEVEL_2;

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