[PATCH 7/7] iio: imu: adis16607: Report loss of external sync

From: Radu Sabau via B4 Relay

Date: Mon Nov 23 2026 - 08:27:21 EST


From: Radu Sabau <radu.sabau@xxxxxxxxxx>

Loss of the external clock or of the sync PLL lock raises DEV_NOK like any
other DIAG_STAT flag, and the interrupt handler already reads DIAG_STAT.
Warn about SYNC_LOST and DPLL_UNLOCKED there, rate limited, without
stopping the capture, since a short loss of the clock can recover. An
interrupt raised by one of these flags is handled even when the FIFO
threshold is not met.

Signed-off-by: Radu Sabau <radu.sabau@xxxxxxxxxx>
---
drivers/iio/imu/adis16607.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/imu/adis16607.c b/drivers/iio/imu/adis16607.c
index 60433c97a855..dddbe3c7fb52 100644
--- a/drivers/iio/imu/adis16607.c
+++ b/drivers/iio/imu/adis16607.c
@@ -83,6 +83,10 @@
#define ADIS16607_FIFO_THR_MET_MASK BIT(0)
#define ADIS16607_FIFO_DATA_CMD 0xA9

+/* DIAG_STAT sync flags */
+#define ADIS16607_DIAG_DPLL_UNLOCKED BIT(1)
+#define ADIS16607_DIAG_SYNC_LOST BIT(2)
+
/* FIFO limits */
#define ADIS16607_MAX_FIFO_WM 38
#define ADIS16607_FIFO_WORDS_PER_SAMPLE 26
@@ -396,8 +400,17 @@ static irqreturn_t adis16607_irq_thread(int irq, void *p)
if (ret)
return IRQ_HANDLED;

+ /* Only warn: a short loss of the clock should not stop the capture */
+ if (diag_stat & ADIS16607_DIAG_SYNC_LOST)
+ dev_warn_ratelimited(&st->adis.spi->dev, "external sync lost\n");
+
+ if (diag_stat & ADIS16607_DIAG_DPLL_UNLOCKED)
+ dev_warn_ratelimited(&st->adis.spi->dev, "sync PLL unlocked\n");
+
if (!(diag_stat & ADIS16607_FIFO_THR_MET_MASK))
- return IRQ_NONE;
+ return diag_stat & (ADIS16607_DIAG_SYNC_LOST |
+ ADIS16607_DIAG_DPLL_UNLOCKED) ?
+ IRQ_HANDLED : IRQ_NONE;

ret = __adis_read_reg_16(&st->adis, ADIS16607_REG_FIFO_WORD_CNT, &word_cnt);
if (ret)

--
2.43.0