[d-kernel] [PATCH 09/39] sound: baikal-i2s: paper over RX overrun warnings on Baikal-M

Daniil Gnusarev gnusarevda на basealt.ru
Пн Окт 14 17:01:50 MSK 2024


i2s_irq_handler: avoid flooding system with RX overrun warnings

Co-developed-by: Alexey Sheplyakov <asheplyakov на basealt.ru>
Signed-off-by: Daniil Gnusarev <gnusarevda на basealt.ru>
---
 sound/soc/baikal/baikal-i2s.c | 9 +++++++--
 sound/soc/baikal/local.h      | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/baikal/baikal-i2s.c b/sound/soc/baikal/baikal-i2s.c
index 91d8fe742f673..d985b3fe4b7d4 100644
--- a/sound/soc/baikal/baikal-i2s.c
+++ b/sound/soc/baikal/baikal-i2s.c
@@ -98,6 +98,7 @@ static inline void i2s_enable_irqs(struct dw_i2s_dev *dev, u32 stream,
 
 static irqreturn_t i2s_irq_handler(int irq, void *dev_id)
 {
+	unsigned int rxor_count;
 	struct dw_i2s_dev *dev = dev_id;
 	bool irq_valid = false;
 	u32 isr[4];
@@ -130,13 +131,17 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id)
 
 		/* Error Handling: TX */
 		if (isr[i] & ISR_TXFO) {
-			dev_err(dev->dev, "TX overrun (ch_id=%d)\n", i);
+			dev_err_ratelimited(dev->dev, "TX overrun (ch_id=%d)\n", i);
 			irq_valid = true;
 		}
 
 		/* Error Handling: RX */
 		if (isr[i] & ISR_RXFO) {
-			dev_err(dev->dev, "RX overrun (ch_id=%d)\n", i);
+			rxor_count = READ_ONCE(dev->rx_overrun_count);
+			if (!(rxor_count & 0x3ff))
+				dev_err_ratelimited(dev->dev, "RX overrun (ch_id=%d)\n", i);
+			rxor_count++;
+			WRITE_ONCE(dev->rx_overrun_count, rxor_count);
 			irq_valid = true;
 		}
 	}
diff --git a/sound/soc/baikal/local.h b/sound/soc/baikal/local.h
index b1754e0f3bd8d..d1cd07e540b45 100644
--- a/sound/soc/baikal/local.h
+++ b/sound/soc/baikal/local.h
@@ -119,6 +119,7 @@ struct dw_i2s_dev {
 			bool *period_elapsed);
 	unsigned int tx_ptr;
 	unsigned int rx_ptr;
+	unsigned int rx_overrun_count;
 };
 
 #if IS_ENABLED(CONFIG_SND_BAIKAL_PIO_PCM)
-- 
2.42.2



Подробная информация о списке рассылки devel-kernel