Skip to content

Commit 0fa1a63

Browse files
committed
iio: ad9361: Highlight selected delay in interface tuning diagnostics
For diagnostic purposes it is useful to highlight the selected clock or data delay. Indicate the chosen delay in the diagnostic by a 'O' character. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
1 parent 602caca commit 0fa1a63

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

drivers/iio/adc/ad9361_conv.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,11 @@ static int ad9361_dig_tune_iodelay(struct ad9361_rf_phy *phy, bool tx)
414414
}
415415

416416
static void ad9361_dig_tune_verbose_print(struct ad9361_rf_phy *phy,
417-
u8 field[][16], bool tx)
417+
u8 field[][16], bool tx,
418+
int sel_clk, int sel_data)
418419
{
419420
int i, j;
421+
char c;
420422

421423
printk(KERN_INFO "SAMPL CLK: %lu tuning: %s\n",
422424
clk_get_rate(phy->clks[RX_SAMPL_CLK]), tx ? "TX" : "RX");
@@ -428,7 +430,14 @@ static void ad9361_dig_tune_verbose_print(struct ad9361_rf_phy *phy,
428430
for (i = 0; i < 2; i++) {
429431
printk(KERN_INFO "%x:", i);
430432
for (j = 0; j < 16; j++) {
431-
printk(KERN_CONT "%c ", (field[i][j] ? '#' : 'o'));
433+
if (field[i][j])
434+
c = '#';
435+
else if ((i == 0 && j == sel_data) ||
436+
(i == 1 && j == sel_clk))
437+
c = 'O';
438+
else
439+
c = 'o';
440+
printk(KERN_CONT "%c ", c);
432441
}
433442
printk(KERN_CONT "\n");
434443
}
@@ -471,20 +480,22 @@ static int ad9361_dig_tune_delay(struct ad9361_rf_phy *phy,
471480
}
472481

473482
if ((flags & BE_MOREVERBOSE) && max_freq) {
474-
ad9361_dig_tune_verbose_print(phy, field, tx);
483+
ad9361_dig_tune_verbose_print(phy, field, tx, -1, -1);
475484
}
476485
}
477486

478487
c0 = ad9361_find_opt(&field[0][0], 16, &s0);
479488
c1 = ad9361_find_opt(&field[1][0], 16, &s1);
480489

481490
if (!c0 && !c1) {
482-
ad9361_dig_tune_verbose_print(phy, field, tx);
491+
ad9361_dig_tune_verbose_print(phy, field, tx, -1, -1);
483492
dev_err(&phy->spi->dev, "%s: Tuning %s FAILED!", __func__,
484493
tx ? "TX" : "RX");
485494
return -EIO;
486495
} else if (flags & BE_VERBOSE) {
487-
ad9361_dig_tune_verbose_print(phy, field, tx);
496+
ad9361_dig_tune_verbose_print(phy, field, tx,
497+
c1 > c0 ? (s1 + c1 / 2) : -1,
498+
c1 > c0 ? -1 : (s0 + c0 / 2));
488499
}
489500

490501
if (c1 > c0)

0 commit comments

Comments
 (0)