From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 From: Daniil Gnusarev To: devel-kernel@lists.altlinux.org Date: Mon, 14 Oct 2024 18:01:50 +0400 Message-ID: <20241014140221.535985-10-gnusarevda@basealt.ru> X-Mailer: git-send-email 2.42.2 In-Reply-To: <20241014140221.535985-1-gnusarevda@basealt.ru> References: <20241014140221.535985-1-gnusarevda@basealt.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [d-kernel] [PATCH 09/39] sound: baikal-i2s: paper over RX overrun warnings on Baikal-M X-BeenThere: devel-kernel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux kernel packages development List-Id: ALT Linux kernel packages development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2024 14:01:54 -0000 Archived-At: List-Archive: List-Post: i2s_irq_handler: avoid flooding system with RX overrun warnings Co-developed-by: Alexey Sheplyakov Signed-off-by: Daniil Gnusarev --- 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