[Intel-gfx] [PATCH i-g-t 3/4] skl_compute_wrpll: Cycle through dividers, then central freqs

Damien Lespiau damien.lespiau at intel.com
Thu Jun 25 08:21:42 PDT 2015


Follow Paulo's comment on the corresponding kernel patch.

This means we also have to move the break when we have cycled through
the even dividers as well.

This improves the number of even dividers used across the tested
frequencies (373) (at the expense of a slightly worse average deviation,
but "even dividers take precedence over a lower deviation".

before:
  even/odd dividers: 338/35
  average deviation: 206.52

after:
  even/odd dividers: 363/10
  average deviation: 215.13

Signed-off-by: Damien Lespiau <damien.lespiau at intel.com>
---
 tools/skl_compute_wrpll.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/skl_compute_wrpll.c b/tools/skl_compute_wrpll.c
index be4fc26..3a2d029 100644
--- a/tools/skl_compute_wrpll.c
+++ b/tools/skl_compute_wrpll.c
@@ -422,8 +422,8 @@ skl_ddi_calculate_wrpll2(int clock /* in Hz */,
 
 	skl_wrpll_context_init(&ctx);
 
-	for (dco = 0; dco < ARRAY_SIZE(dco_central_freq); dco++) {
-		for (d = 0; d < ARRAY_SIZE(dividers); d++) {
+	for (d = 0; d < ARRAY_SIZE(dividers); d++) {
+		for (dco = 0; dco < ARRAY_SIZE(dco_central_freq); dco++) {
 			for (i = 0; i < dividers[d].n_dividers; i++) {
 				unsigned int p = dividers[d].list[i];
 				uint64_t dco_freq = p * afe_clock;
@@ -433,14 +433,14 @@ skl_ddi_calculate_wrpll2(int clock /* in Hz */,
 						      dco_freq,
 						      p);
 			}
-
-			/*
-			 * If a solution is found with an even divider, prefer
-			 * this one.
-			 */
-			if (d == 0 && ctx.p)
-				break;
 		}
+
+		/*
+		 * If a solution is found with an even divider, prefer
+		 * this one.
+		 */
+		if (d == 0 && ctx.p)
+			break;
 	}
 
 	if (!ctx.p)
-- 
2.1.0



More information about the Intel-gfx mailing list