From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6787832B116 for ; Tue, 9 Jun 2026 01:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780968712; cv=none; b=ggUzZ1MDO7AtfPBua2mkBJVCYEy5NuLlpl9hFUYBXKhBBsop5pfkoNMSMwJ8oD1S4vKF/Kl5GXcSrpoiEHZYrc3DmW7X6U4ObCZ13Ux2z27TVpjuIchaNbFYemNGCCMcIX1jngZBV5TOtKPsvaDjaxBecRWVpXwPJltSCRkCCYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780968712; c=relaxed/simple; bh=hoCOcrMSjaAWKeNIF/wdCoUBsEe6mU/OTO9zKbkRgdM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U1uUNkucy9vpsvcPnscrCTmpC0ZRZfL7ObYnBvJgKE9sg7y2eU+tA2HTbLE1VjHbtM+jAwXJCc8933S46MfRN/vgPKlnzlWZDsGeB2sqsZlXmWyvl6HV21o1nDa0h27Mut3At35sxRJvZNMViQNiwOFQMPmBqxrDo1L44G52ylI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Esy6C02X; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Esy6C02X" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2c0c3184c71so37656085ad.1 for ; Mon, 08 Jun 2026 18:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780968710; x=1781573510; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=++sjJT39ps4CzpziCYW8Pzk1hFHYus8aC6jLUnr2CbM=; b=Esy6C02XDUQLLJRx8HU8tSLCGxfpuBZJywUQZsiNuoVVO1bbUU3+TjVJ4TqALXaMGz gCcSkzYoTLrir4aB17p9VwwwY3FgBn/7FRNeY9celMTKFVyxXyoXRfrkq97jx6cTcog7 BzVbf1ukq5XlJMfZ+h+IcINY75Sjg3E4Mk4Kby/ChRaViySIIrKR+8E9fIKvTYsRa02X SQW/tQH+FGAbvqMmVBJKNNeqjC9CTBk/28jkDvTp1aQ79POIgsOFMCeSARmHzHVUn3iK WL7SrfJRMEXiaa/j98D+3PRK/p/DyKaDRgiRg0BpxMIml6TB1DwkDVQuuatj+iBxOE3t ECnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780968710; x=1781573510; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=++sjJT39ps4CzpziCYW8Pzk1hFHYus8aC6jLUnr2CbM=; b=XLA1FjsCJ82SWpCZIO4Hzo9zy1rZ2ywGUzUyVA7hcT/WgQHVq92agYDApR8C1K2lwX Ni1b1UYEovxZ4UUtasJ1ebsfORae5K2q0NlM6tse7mPW9wS0IVJllTIXV/FKRwfuZJxf ZEffg6Fh8ZA83UC2t8HzPbVdID1e7WDZjaHtgFVZSt/z1/Swqrt63UqH7rU10gMX3jam gPtxQ+L4jOpCPLYOqSI0lY6tdLpYrJ6buhgqp/i2klFxlfwBTV4HMhsPVbobbMRWYWR/ 6zQRKcPs2pePWJpP4Ejwf8ODfQ71v1fR6sCD6adMRvmbYyO6jcMskrvmTXJCMvH5fPJr m+JA== X-Forwarded-Encrypted: i=1; AFNElJ+ZEyxB9vdtF1wI2w2ia13kzQtPLvD87yHUyc9Ur8rnOMRfXfgcdWfTuH7d7thDPHH3S9qX6/hraCc53KQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw1un07FbhHUeOiknpskiddVtUy5pzNGV/pKnJUz1CAet68el6i Noyx4LFLXfb+2I/A0VzSi4I+x5Iryp1SdoNek5elhjuy3fWfiHHMga1p X-Gm-Gg: Acq92OEcJLexUN8MhIhLcexhKKjACt6T+EysoUBELV13yzjoP7mTTeItNm/e22wRPy/ txSGBz3FPTd7jZMr2RWZSrFV1fswzReOhQ0J1rkkUkUWRPjAzjw+mCBQapQ9lcBwdxKmjhCgjCb yLFAJmkeTVzSgcVGI48i0d1olD4MzVSeJXimKUm+R0+SEabZIvlqgCc9wxnhIGAcYxuf1s3srqY 8hOsH0ZVVehfgFvAqnLSILSavuH0xQ7isrcmJVevltb+7zz9Jp99XH9IUb9rPTG67Vv+0mX7YMi 8e+7Z6WsHKGE6xN2xod5c6fy7ypH8eqH0Q9Gf3jllvBaHedBy2J+iz1N6Op9f3ssxJ0Ih2y31CE k3jxUWwA1oSxKGxYsRz8TZE9titTu/vc8MGSadtnNLIUZnihGChbIuLc9BJIg7wc7NnuQ431Irk WnkzSARmyNUBWuAlq2S/yHphiFbiAlQLz4hszSjRFIxHXsE1fWs3KT4mKW7J24q8Ax45Js X-Received: by 2002:a17:903:1aed:b0:2c1:69cb:4423 with SMTP id d9443c01a7336-2c1e7e527bdmr204388505ad.14.1780968709665; Mon, 08 Jun 2026 18:31:49 -0700 (PDT) Received: from phuc-desktop.. ([183.91.15.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c16609e627sm198765335ad.52.2026.06.08.18.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jun 2026 18:31:49 -0700 (PDT) From: phucduc.bui@gmail.com To: Kuninori Morimoto , Mark Brown , Geert Uytterhoeven Cc: Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Magnus Damm , Jaroslav Kysela , Takashi Iwai , linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bui duc phuc Subject: [PATCH v5 05/11] ASoC: renesas: fsi: Fix register access from in-flight IRQ after shutdown Date: Tue, 9 Jun 2026 08:31:01 +0700 Message-ID: <20260609013107.5995-6-phucduc.bui@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260609013107.5995-1-phucduc.bui@gmail.com> References: <20260609013107.5995-1-phucduc.bui@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: bui duc phuc In-flight IRQs may still be running when the SPU clock is disabled, leading to register access after shutdown and causing system hangs. Fix this to use fsi_stream_is_working() when handling in-flight IRQ handlers. If no streams are active, the handler now returns immediately to prevent hardware access. Suggested-by: Kuninori Morimoto Signed-off-by: bui duc phuc --- Changes in v4: - use fsi_stream_is_working instead of running_streams. sound/soc/renesas/fsi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/renesas/fsi.c b/sound/soc/renesas/fsi.c index 0bd0e0c8c5a3..3e3c6fd7c56b 100644 --- a/sound/soc/renesas/fsi.c +++ b/sound/soc/renesas/fsi.c @@ -470,6 +470,10 @@ static int fsi_get_current_fifo_samples(struct fsi_priv *fsi, static void fsi_count_fifo_err(struct fsi_priv *fsi) { + if (!fsi_stream_is_working(fsi, &fsi->playback) && + !fsi_stream_is_working(fsi, &fsi->capture)) + return; + u32 ostatus = fsi_reg_read(fsi, DOFF_ST); u32 istatus = fsi_reg_read(fsi, DIFF_ST); @@ -681,6 +685,10 @@ static void fsi_irq_clear_status(struct fsi_priv *fsi) u32 data = 0; struct fsi_master *master = fsi_get_master(fsi); + if (!fsi_stream_is_working(fsi, &fsi->playback) && + !fsi_stream_is_working(fsi, &fsi->capture)) + return; + data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->playback)); data |= AB_IO(1, fsi_get_port_shift(fsi, &fsi->capture)); -- 2.43.0