Skip to content

Commit dce48ad

Browse files
larsclausencommodo
authored andcommitted
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 <[email protected]>
1 parent 2d81d83 commit dce48ad

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
@@ -428,9 +428,11 @@ static int ad9361_dig_tune_iodelay(struct ad9361_rf_phy *phy, bool tx)
428428
}
429429

430430
static void ad9361_dig_tune_verbose_print(struct ad9361_rf_phy *phy,
431-
u8 field[][16], bool tx)
431+
u8 field[][16], bool tx,
432+
int sel_clk, int sel_data)
432433
{
433434
int i, j;
435+
char c;
434436

435437
pr_info("SAMPL CLK: %lu tuning: %s\n",
436438
clk_get_rate(phy->clks[RX_SAMPL_CLK]), tx ? "TX" : "RX");
@@ -442,7 +444,14 @@ static void ad9361_dig_tune_verbose_print(struct ad9361_rf_phy *phy,
442444
for (i = 0; i < 2; i++) {
443445
pr_info("%x:", i);
444446
for (j = 0; j < 16; j++) {
445-
pr_cont("%c ", (field[i][j] ? '#' : 'o'));
447+
if (field[i][j])
448+
c = '#';
449+
else if ((i == 0 && j == sel_data) ||
450+
(i == 1 && j == sel_clk))
451+
c = 'O';
452+
else
453+
c = 'o';
454+
pr_cont("%c ", c);
446455
}
447456
pr_cont("\n");
448457
}
@@ -483,20 +492,22 @@ static int ad9361_dig_tune_delay(struct ad9361_rf_phy *phy,
483492
}
484493

485494
if ((flags & BE_MOREVERBOSE) && max_freq) {
486-
ad9361_dig_tune_verbose_print(phy, field, tx);
495+
ad9361_dig_tune_verbose_print(phy, field, tx, -1, -1);
487496
}
488497
}
489498

490499
c0 = ad9361_find_opt(&field[0][0], 16, &s0);
491500
c1 = ad9361_find_opt(&field[1][0], 16, &s1);
492501

493502
if (!c0 && !c1) {
494-
ad9361_dig_tune_verbose_print(phy, field, tx);
503+
ad9361_dig_tune_verbose_print(phy, field, tx, -1, -1);
495504
dev_err(&phy->spi->dev, "%s: Tuning %s FAILED!", __func__,
496505
tx ? "TX" : "RX");
497506
return -EIO;
498507
} else if (flags & BE_VERBOSE) {
499-
ad9361_dig_tune_verbose_print(phy, field, tx);
508+
ad9361_dig_tune_verbose_print(phy, field, tx,
509+
c1 > c0 ? (s1 + c1 / 2) : -1,
510+
c1 > c0 ? -1 : (s0 + c0 / 2));
500511
}
501512

502513
if (c1 > c0)

0 commit comments

Comments
 (0)