1 /*
2 * Copyright © 2014 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24 #include <inttypes.h>
25 #include <stdio.h>
26 #include <stdbool.h>
27 #include <stdint.h>
28 #include <stdlib.h>
29
30 #include "intel_io.h"
31 #include "drmtest.h"
32
33 #define LC_FREQ 2700
34 #define LC_FREQ_2K (LC_FREQ * 2000)
35
36 #define P_MIN 2
37 #define P_MAX 64
38 #define P_INC 2
39
40 /* Constraints for PLL good behavior */
41 #define REF_MIN 48
42 #define REF_MAX 400
43 #define VCO_MIN 2400
44 #define VCO_MAX 4800
45
46 #define ABS_DIFF(a, b) ((a > b) ? (a - b) : (b - a))
47
48 struct wrpll_rnp {
49 unsigned p, n2, r2;
50 };
51
wrpll_get_budget_for_freq(int clock)52 static unsigned wrpll_get_budget_for_freq(int clock)
53 {
54 unsigned budget;
55
56 switch (clock) {
57 case 25175000:
58 case 25200000:
59 case 27000000:
60 case 27027000:
61 case 37762500:
62 case 37800000:
63 case 40500000:
64 case 40541000:
65 case 54000000:
66 case 54054000:
67 case 59341000:
68 case 59400000:
69 case 72000000:
70 case 74176000:
71 case 74250000:
72 case 81000000:
73 case 81081000:
74 case 89012000:
75 case 89100000:
76 case 108000000:
77 case 108108000:
78 case 111264000:
79 case 111375000:
80 case 148352000:
81 case 148500000:
82 case 162000000:
83 case 162162000:
84 case 222525000:
85 case 222750000:
86 case 296703000:
87 case 297000000:
88 budget = 0;
89 break;
90 case 233500000:
91 case 245250000:
92 case 247750000:
93 case 253250000:
94 case 298000000:
95 budget = 1500;
96 break;
97 case 169128000:
98 case 169500000:
99 case 179500000:
100 case 202000000:
101 budget = 2000;
102 break;
103 case 256250000:
104 case 262500000:
105 case 270000000:
106 case 272500000:
107 case 273750000:
108 case 280750000:
109 case 281250000:
110 case 286000000:
111 case 291750000:
112 budget = 4000;
113 break;
114 case 267250000:
115 case 268500000:
116 budget = 5000;
117 break;
118 default:
119 budget = 1000;
120 break;
121 }
122
123 return budget;
124 }
125
wrpll_update_rnp(uint64_t freq2k,unsigned budget,unsigned r2,unsigned n2,unsigned p,struct wrpll_rnp * best)126 static void wrpll_update_rnp(uint64_t freq2k, unsigned budget,
127 unsigned r2, unsigned n2, unsigned p,
128 struct wrpll_rnp *best)
129 {
130 uint64_t a, b, c, d, diff, diff_best;
131
132 /* No best (r,n,p) yet */
133 if (best->p == 0) {
134 best->p = p;
135 best->n2 = n2;
136 best->r2 = r2;
137 return;
138 }
139
140 /*
141 * Output clock is (LC_FREQ_2K / 2000) * N / (P * R), which compares to
142 * freq2k.
143 *
144 * delta = 1e6 *
145 * abs(freq2k - (LC_FREQ_2K * n2/(p * r2))) /
146 * freq2k;
147 *
148 * and we would like delta <= budget.
149 *
150 * If the discrepancy is above the PPM-based budget, always prefer to
151 * improve upon the previous solution. However, if you're within the
152 * budget, try to maximize Ref * VCO, that is N / (P * R^2).
153 */
154 a = freq2k * budget * p * r2;
155 b = freq2k * budget * best->p * best->r2;
156 diff = ABS_DIFF((freq2k * p * r2), (LC_FREQ_2K * n2));
157 diff_best = ABS_DIFF((freq2k * best->p * best->r2),
158 (LC_FREQ_2K * best->n2));
159 c = 1000000 * diff;
160 d = 1000000 * diff_best;
161
162 if (a < c && b < d) {
163 /* If both are above the budget, pick the closer */
164 if (best->p * best->r2 * diff < p * r2 * diff_best) {
165 best->p = p;
166 best->n2 = n2;
167 best->r2 = r2;
168 }
169 } else if (a >= c && b < d) {
170 /* If A is below the threshold but B is above it? Update. */
171 best->p = p;
172 best->n2 = n2;
173 best->r2 = r2;
174 } else if (a >= c && b >= d) {
175 /* Both are below the limit, so pick the higher n2/(r2*r2) */
176 if (n2 * best->r2 * best->r2 > best->n2 * r2 * r2) {
177 best->p = p;
178 best->n2 = n2;
179 best->r2 = r2;
180 }
181 }
182 /* Otherwise a < c && b >= d, do nothing */
183 }
184
185 static void
wrpll_compute_rnp(int clock,unsigned * r2_out,unsigned * n2_out,unsigned * p_out)186 wrpll_compute_rnp(int clock /* in Hz */,
187 unsigned *r2_out, unsigned *n2_out, unsigned *p_out)
188 {
189 uint64_t freq2k;
190 unsigned p, n2, r2;
191 struct wrpll_rnp best = { 0, 0, 0 };
192 unsigned budget;
193
194 freq2k = clock / 100;
195
196 budget = wrpll_get_budget_for_freq(clock);
197
198 /* Special case handling for 540 pixel clock: bypass WR PLL entirely
199 * and directly pass the LC PLL to it. */
200 if (freq2k == 5400000) {
201 *n2_out = 2;
202 *p_out = 1;
203 *r2_out = 2;
204 return;
205 }
206
207 /*
208 * Ref = LC_FREQ / R, where Ref is the actual reference input seen by
209 * the WR PLL.
210 *
211 * We want R so that REF_MIN <= Ref <= REF_MAX.
212 * Injecting R2 = 2 * R gives:
213 * REF_MAX * r2 > LC_FREQ * 2 and
214 * REF_MIN * r2 < LC_FREQ * 2
215 *
216 * Which means the desired boundaries for r2 are:
217 * LC_FREQ * 2 / REF_MAX < r2 < LC_FREQ * 2 / REF_MIN
218 *
219 */
220 for (r2 = LC_FREQ * 2 / REF_MAX + 1;
221 r2 <= LC_FREQ * 2 / REF_MIN;
222 r2++) {
223
224 /*
225 * VCO = N * Ref, that is: VCO = N * LC_FREQ / R
226 *
227 * Once again we want VCO_MIN <= VCO <= VCO_MAX.
228 * Injecting R2 = 2 * R and N2 = 2 * N, we get:
229 * VCO_MAX * r2 > n2 * LC_FREQ and
230 * VCO_MIN * r2 < n2 * LC_FREQ)
231 *
232 * Which means the desired boundaries for n2 are:
233 * VCO_MIN * r2 / LC_FREQ < n2 < VCO_MAX * r2 / LC_FREQ
234 */
235 for (n2 = VCO_MIN * r2 / LC_FREQ + 1;
236 n2 <= VCO_MAX * r2 / LC_FREQ;
237 n2++) {
238
239 for (p = P_MIN; p <= P_MAX; p += P_INC)
240 wrpll_update_rnp(freq2k, budget,
241 r2, n2, p, &best);
242 }
243 }
244
245 *n2_out = best.n2;
246 *p_out = best.p;
247 *r2_out = best.r2;
248 }
249
250 /* WRPLL clock dividers */
251 struct wrpll_tmds_clock {
252 uint32_t clock;
253 uint16_t p; /* Post divider */
254 uint16_t n2; /* Feedback divider */
255 uint16_t r2; /* Reference divider */
256 };
257
258 /* Table of matching values for WRPLL clocks programming for each frequency.
259 * The code assumes this table is sorted. */
260 static const struct wrpll_tmds_clock wrpll_tmds_clock_table[] = {
261 {19750000, 38, 25, 18},
262 {20000000, 48, 32, 18},
263 {21000000, 36, 21, 15},
264 {21912000, 42, 29, 17},
265 {22000000, 36, 22, 15},
266 {23000000, 36, 23, 15},
267 {23500000, 40, 40, 23},
268 {23750000, 26, 16, 14},
269 {24000000, 36, 24, 15},
270 {25000000, 36, 25, 15},
271 {25175000, 26, 40, 33},
272 {25200000, 30, 21, 15},
273 {26000000, 36, 26, 15},
274 {27000000, 30, 21, 14},
275 {27027000, 18, 100, 111},
276 {27500000, 30, 29, 19},
277 {28000000, 34, 30, 17},
278 {28320000, 26, 30, 22},
279 {28322000, 32, 42, 25},
280 {28750000, 24, 23, 18},
281 {29000000, 30, 29, 18},
282 {29750000, 32, 30, 17},
283 {30000000, 30, 25, 15},
284 {30750000, 30, 41, 24},
285 {31000000, 30, 31, 18},
286 {31500000, 30, 28, 16},
287 {32000000, 30, 32, 18},
288 {32500000, 28, 32, 19},
289 {33000000, 24, 22, 15},
290 {34000000, 28, 30, 17},
291 {35000000, 26, 32, 19},
292 {35500000, 24, 30, 19},
293 {36000000, 26, 26, 15},
294 {36750000, 26, 46, 26},
295 {37000000, 24, 23, 14},
296 {37762500, 22, 40, 26},
297 {37800000, 20, 21, 15},
298 {38000000, 24, 27, 16},
299 {38250000, 24, 34, 20},
300 {39000000, 24, 26, 15},
301 {40000000, 24, 32, 18},
302 {40500000, 20, 21, 14},
303 {40541000, 22, 147, 89},
304 {40750000, 18, 19, 14},
305 {41000000, 16, 17, 14},
306 {41500000, 22, 44, 26},
307 {41540000, 22, 44, 26},
308 {42000000, 18, 21, 15},
309 {42500000, 22, 45, 26},
310 {43000000, 20, 43, 27},
311 {43163000, 20, 24, 15},
312 {44000000, 18, 22, 15},
313 {44900000, 20, 108, 65},
314 {45000000, 20, 25, 15},
315 {45250000, 20, 52, 31},
316 {46000000, 18, 23, 15},
317 {46750000, 20, 45, 26},
318 {47000000, 20, 40, 23},
319 {48000000, 18, 24, 15},
320 {49000000, 18, 49, 30},
321 {49500000, 16, 22, 15},
322 {50000000, 18, 25, 15},
323 {50500000, 18, 32, 19},
324 {51000000, 18, 34, 20},
325 {52000000, 18, 26, 15},
326 {52406000, 14, 34, 25},
327 {53000000, 16, 22, 14},
328 {54000000, 16, 24, 15},
329 {54054000, 16, 173, 108},
330 {54500000, 14, 24, 17},
331 {55000000, 12, 22, 18},
332 {56000000, 14, 45, 31},
333 {56250000, 16, 25, 15},
334 {56750000, 14, 25, 17},
335 {57000000, 16, 27, 16},
336 {58000000, 16, 43, 25},
337 {58250000, 16, 38, 22},
338 {58750000, 16, 40, 23},
339 {59000000, 14, 26, 17},
340 {59341000, 14, 40, 26},
341 {59400000, 16, 44, 25},
342 {60000000, 16, 32, 18},
343 {60500000, 12, 39, 29},
344 {61000000, 14, 49, 31},
345 {62000000, 14, 37, 23},
346 {62250000, 14, 42, 26},
347 {63000000, 12, 21, 15},
348 {63500000, 14, 28, 17},
349 {64000000, 12, 27, 19},
350 {65000000, 14, 32, 19},
351 {65250000, 12, 29, 20},
352 {65500000, 12, 32, 22},
353 {66000000, 12, 22, 15},
354 {66667000, 14, 38, 22},
355 {66750000, 10, 21, 17},
356 {67000000, 14, 33, 19},
357 {67750000, 14, 58, 33},
358 {68000000, 14, 30, 17},
359 {68179000, 14, 46, 26},
360 {68250000, 14, 46, 26},
361 {69000000, 12, 23, 15},
362 {70000000, 12, 28, 18},
363 {71000000, 12, 30, 19},
364 {72000000, 12, 24, 15},
365 {73000000, 10, 23, 17},
366 {74000000, 12, 23, 14},
367 {74176000, 8, 100, 91},
368 {74250000, 10, 22, 16},
369 {74481000, 12, 43, 26},
370 {74500000, 10, 29, 21},
371 {75000000, 12, 25, 15},
372 {75250000, 10, 39, 28},
373 {76000000, 12, 27, 16},
374 {77000000, 12, 53, 31},
375 {78000000, 12, 26, 15},
376 {78750000, 12, 28, 16},
377 {79000000, 10, 38, 26},
378 {79500000, 10, 28, 19},
379 {80000000, 12, 32, 18},
380 {81000000, 10, 21, 14},
381 {81081000, 6, 100, 111},
382 {81624000, 8, 29, 24},
383 {82000000, 8, 17, 14},
384 {83000000, 10, 40, 26},
385 {83950000, 10, 28, 18},
386 {84000000, 10, 28, 18},
387 {84750000, 6, 16, 17},
388 {85000000, 6, 17, 18},
389 {85250000, 10, 30, 19},
390 {85750000, 10, 27, 17},
391 {86000000, 10, 43, 27},
392 {87000000, 10, 29, 18},
393 {88000000, 10, 44, 27},
394 {88500000, 10, 41, 25},
395 {89000000, 10, 28, 17},
396 {89012000, 6, 90, 91},
397 {89100000, 10, 33, 20},
398 {90000000, 10, 25, 15},
399 {91000000, 10, 32, 19},
400 {92000000, 10, 46, 27},
401 {93000000, 10, 31, 18},
402 {94000000, 10, 40, 23},
403 {94500000, 10, 28, 16},
404 {95000000, 10, 44, 25},
405 {95654000, 10, 39, 22},
406 {95750000, 10, 39, 22},
407 {96000000, 10, 32, 18},
408 {97000000, 8, 23, 16},
409 {97750000, 8, 42, 29},
410 {98000000, 8, 45, 31},
411 {99000000, 8, 22, 15},
412 {99750000, 8, 34, 23},
413 {100000000, 6, 20, 18},
414 {100500000, 6, 19, 17},
415 {101000000, 6, 37, 33},
416 {101250000, 8, 21, 14},
417 {102000000, 6, 17, 15},
418 {102250000, 6, 25, 22},
419 {103000000, 8, 29, 19},
420 {104000000, 8, 37, 24},
421 {105000000, 8, 28, 18},
422 {106000000, 8, 22, 14},
423 {107000000, 8, 46, 29},
424 {107214000, 8, 27, 17},
425 {108000000, 8, 24, 15},
426 {108108000, 8, 173, 108},
427 {109000000, 6, 23, 19},
428 {110000000, 6, 22, 18},
429 {110013000, 6, 22, 18},
430 {110250000, 8, 49, 30},
431 {110500000, 8, 36, 22},
432 {111000000, 8, 23, 14},
433 {111264000, 8, 150, 91},
434 {111375000, 8, 33, 20},
435 {112000000, 8, 63, 38},
436 {112500000, 8, 25, 15},
437 {113100000, 8, 57, 34},
438 {113309000, 8, 42, 25},
439 {114000000, 8, 27, 16},
440 {115000000, 6, 23, 18},
441 {116000000, 8, 43, 25},
442 {117000000, 8, 26, 15},
443 {117500000, 8, 40, 23},
444 {118000000, 6, 38, 29},
445 {119000000, 8, 30, 17},
446 {119500000, 8, 46, 26},
447 {119651000, 8, 39, 22},
448 {120000000, 8, 32, 18},
449 {121000000, 6, 39, 29},
450 {121250000, 6, 31, 23},
451 {121750000, 6, 23, 17},
452 {122000000, 6, 42, 31},
453 {122614000, 6, 30, 22},
454 {123000000, 6, 41, 30},
455 {123379000, 6, 37, 27},
456 {124000000, 6, 51, 37},
457 {125000000, 6, 25, 18},
458 {125250000, 4, 13, 14},
459 {125750000, 4, 27, 29},
460 {126000000, 6, 21, 15},
461 {127000000, 6, 24, 17},
462 {127250000, 6, 41, 29},
463 {128000000, 6, 27, 19},
464 {129000000, 6, 43, 30},
465 {129859000, 4, 25, 26},
466 {130000000, 6, 26, 18},
467 {130250000, 6, 42, 29},
468 {131000000, 6, 32, 22},
469 {131500000, 6, 38, 26},
470 {131850000, 6, 41, 28},
471 {132000000, 6, 22, 15},
472 {132750000, 6, 28, 19},
473 {133000000, 6, 34, 23},
474 {133330000, 6, 37, 25},
475 {134000000, 6, 61, 41},
476 {135000000, 6, 21, 14},
477 {135250000, 6, 167, 111},
478 {136000000, 6, 62, 41},
479 {137000000, 6, 35, 23},
480 {138000000, 6, 23, 15},
481 {138500000, 6, 40, 26},
482 {138750000, 6, 37, 24},
483 {139000000, 6, 34, 22},
484 {139050000, 6, 34, 22},
485 {139054000, 6, 34, 22},
486 {140000000, 6, 28, 18},
487 {141000000, 6, 36, 23},
488 {141500000, 6, 22, 14},
489 {142000000, 6, 30, 19},
490 {143000000, 6, 27, 17},
491 {143472000, 4, 17, 16},
492 {144000000, 6, 24, 15},
493 {145000000, 6, 29, 18},
494 {146000000, 6, 47, 29},
495 {146250000, 6, 26, 16},
496 {147000000, 6, 49, 30},
497 {147891000, 6, 23, 14},
498 {148000000, 6, 23, 14},
499 {148250000, 6, 28, 17},
500 {148352000, 4, 100, 91},
501 {148500000, 6, 33, 20},
502 {149000000, 6, 48, 29},
503 {150000000, 6, 25, 15},
504 {151000000, 4, 19, 17},
505 {152000000, 6, 27, 16},
506 {152280000, 6, 44, 26},
507 {153000000, 6, 34, 20},
508 {154000000, 6, 53, 31},
509 {155000000, 6, 31, 18},
510 {155250000, 6, 50, 29},
511 {155750000, 6, 45, 26},
512 {156000000, 6, 26, 15},
513 {157000000, 6, 61, 35},
514 {157500000, 6, 28, 16},
515 {158000000, 6, 65, 37},
516 {158250000, 6, 44, 25},
517 {159000000, 6, 53, 30},
518 {159500000, 6, 39, 22},
519 {160000000, 6, 32, 18},
520 {161000000, 4, 31, 26},
521 {162000000, 4, 18, 15},
522 {162162000, 4, 131, 109},
523 {162500000, 4, 53, 44},
524 {163000000, 4, 29, 24},
525 {164000000, 4, 17, 14},
526 {165000000, 4, 22, 18},
527 {166000000, 4, 32, 26},
528 {167000000, 4, 26, 21},
529 {168000000, 4, 46, 37},
530 {169000000, 4, 104, 83},
531 {169128000, 4, 64, 51},
532 {169500000, 4, 39, 31},
533 {170000000, 4, 34, 27},
534 {171000000, 4, 19, 15},
535 {172000000, 4, 51, 40},
536 {172750000, 4, 32, 25},
537 {172800000, 4, 32, 25},
538 {173000000, 4, 41, 32},
539 {174000000, 4, 49, 38},
540 {174787000, 4, 22, 17},
541 {175000000, 4, 35, 27},
542 {176000000, 4, 30, 23},
543 {177000000, 4, 38, 29},
544 {178000000, 4, 29, 22},
545 {178500000, 4, 37, 28},
546 {179000000, 4, 53, 40},
547 {179500000, 4, 73, 55},
548 {180000000, 4, 20, 15},
549 {181000000, 4, 55, 41},
550 {182000000, 4, 31, 23},
551 {183000000, 4, 42, 31},
552 {184000000, 4, 30, 22},
553 {184750000, 4, 26, 19},
554 {185000000, 4, 37, 27},
555 {186000000, 4, 51, 37},
556 {187000000, 4, 36, 26},
557 {188000000, 4, 32, 23},
558 {189000000, 4, 21, 15},
559 {190000000, 4, 38, 27},
560 {190960000, 4, 41, 29},
561 {191000000, 4, 41, 29},
562 {192000000, 4, 27, 19},
563 {192250000, 4, 37, 26},
564 {193000000, 4, 20, 14},
565 {193250000, 4, 53, 37},
566 {194000000, 4, 23, 16},
567 {194208000, 4, 23, 16},
568 {195000000, 4, 26, 18},
569 {196000000, 4, 45, 31},
570 {197000000, 4, 35, 24},
571 {197750000, 4, 41, 28},
572 {198000000, 4, 22, 15},
573 {198500000, 4, 25, 17},
574 {199000000, 4, 28, 19},
575 {200000000, 4, 37, 25},
576 {201000000, 4, 61, 41},
577 {202000000, 4, 112, 75},
578 {202500000, 4, 21, 14},
579 {203000000, 4, 146, 97},
580 {204000000, 4, 62, 41},
581 {204750000, 4, 44, 29},
582 {205000000, 4, 38, 25},
583 {206000000, 4, 29, 19},
584 {207000000, 4, 23, 15},
585 {207500000, 4, 40, 26},
586 {208000000, 4, 37, 24},
587 {208900000, 4, 48, 31},
588 {209000000, 4, 48, 31},
589 {209250000, 4, 31, 20},
590 {210000000, 4, 28, 18},
591 {211000000, 4, 25, 16},
592 {212000000, 4, 22, 14},
593 {213000000, 4, 30, 19},
594 {213750000, 4, 38, 24},
595 {214000000, 4, 46, 29},
596 {214750000, 4, 35, 22},
597 {215000000, 4, 43, 27},
598 {216000000, 4, 24, 15},
599 {217000000, 4, 37, 23},
600 {218000000, 4, 42, 26},
601 {218250000, 4, 42, 26},
602 {218750000, 4, 34, 21},
603 {219000000, 4, 47, 29},
604 {220000000, 4, 44, 27},
605 {220640000, 4, 49, 30},
606 {220750000, 4, 36, 22},
607 {221000000, 4, 36, 22},
608 {222000000, 4, 23, 14},
609 {222525000, 4, 150, 91},
610 {222750000, 4, 33, 20},
611 {227000000, 4, 37, 22},
612 {230250000, 4, 29, 17},
613 {233500000, 4, 38, 22},
614 {235000000, 4, 40, 23},
615 {238000000, 4, 30, 17},
616 {241500000, 2, 17, 19},
617 {245250000, 2, 20, 22},
618 {247750000, 2, 22, 24},
619 {253250000, 2, 15, 16},
620 {256250000, 2, 18, 19},
621 {262500000, 2, 31, 32},
622 {267250000, 2, 66, 67},
623 {268500000, 2, 94, 95},
624 {270000000, 2, 14, 14},
625 {272500000, 2, 77, 76},
626 {273750000, 2, 57, 56},
627 {280750000, 2, 24, 23},
628 {281250000, 2, 23, 22},
629 {286000000, 2, 17, 16},
630 {291750000, 2, 26, 24},
631 {296703000, 2, 100, 91},
632 {297000000, 2, 22, 20},
633 {298000000, 2, 21, 19},
634 };
635
main(void)636 int main(void)
637 {
638 int i;
639
640 for (i = 0; i < ARRAY_SIZE(wrpll_tmds_clock_table); i++) {
641 const struct wrpll_tmds_clock *ref = &wrpll_tmds_clock_table[i];
642 unsigned r2, n2, p;
643
644 wrpll_compute_rnp(ref->clock, &r2, &n2, &p);
645 igt_fail_on_f(ref->r2 != r2 || ref->n2 != n2 || ref->p != p,
646 "Computed value differs for %"PRId64" Hz:\n"" Reference: (%u,%u,%u)\n"" Computed: (%u,%u,%u)\n", (int64_t)ref->clock * 1000, ref->r2, ref->n2, ref->p, r2, n2, p);
647 }
648
649 return 0;
650 }
651