From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0D581B424F; Sun, 7 Sep 2025 20:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757276041; cv=none; b=TgJWPUZ8qA2d+f26aMtGSRRjx8mxahkb678y5aHU3wHiWo62rcTOBJBB4iyvUhlq4LNDlZno6ZCO3lnsVUOZZoKsunAs26StyAMzUvhspyVZx1MkhQkfABbNMOsLD4pie7W+xC1xsv4858366zY6dsAobjBeEY8fDpI6nM2jPG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757276041; c=relaxed/simple; bh=ioBNiOS/xiKMKpI62xAfKC8hFX6Cm4/LdjNzmdpPSqs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aw/SJkXbWjYMRRksvlWVMov5O+gNiL0LxbLkC1UTTW38yIvu+cpLKnJcetHrjlLBSzZXtmbJW5fCQFRcMKZtoDhe21VjjrteNXPU4QfwgRjMNrqmeS4oOJuTqEyWEay95pWsE8EGz2yQuBRxHd3ZxkDdOzwr7agITqgRE2OtYE4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=D9498OUN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="D9498OUN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 611ADC4CEF8; Sun, 7 Sep 2025 20:14:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757276040; bh=ioBNiOS/xiKMKpI62xAfKC8hFX6Cm4/LdjNzmdpPSqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9498OUN8UHGNshfa9gPmLvQQgHxYY1fOoC5M67trtM8BjQuTuoUrusqEO09HgGmz vKPjC2utkynJfxDE+WI86UzdNP/fyrEM5wuElQ2pOsbnl39Elt2KQNhHProQIOoTXy 5Yz0G27awoCf/irpOG7GdeRnfwC/PZcyMY2N3X28= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Emanuele Ghidoli , Francesco Dolcini , Andy Shevchenko , Geert Uytterhoeven , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.15 45/64] gpio: pca953x: fix IRQ storm on system wake up Date: Sun, 7 Sep 2025 21:58:27 +0200 Message-ID: <20250907195604.648449402@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250907195603.394640159@linuxfoundation.org> References: <20250907195603.394640159@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emanuele Ghidoli [ Upstream commit 3e38f946062b4845961ab86b726651b4457b2af8 ] If an input changes state during wake-up and is used as an interrupt source, the IRQ handler reads the volatile input register to clear the interrupt mask and deassert the IRQ line. However, the IRQ handler is triggered before access to the register is granted, causing the read operation to fail. As a result, the IRQ handler enters a loop, repeatedly printing the "failed reading register" message, until `pca953x_resume()` is eventually called, which restores the driver context and enables access to registers. Fix by disabling the IRQ line before entering suspend mode, and re-enabling it after the driver context is restored in `pca953x_resume()`. An IRQ can be disabled with disable_irq() and still wake the system as long as the IRQ has wake enabled, so the wake-up functionality is preserved. Fixes: b76574300504 ("gpio: pca953x: Restore registers after suspend/resume cycle") Cc: stable@vger.kernel.org Signed-off-by: Emanuele Ghidoli Signed-off-by: Francesco Dolcini Reviewed-by: Andy Shevchenko Tested-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20250512095441.31645-1-francesco@dolcini.it Signed-off-by: Bartosz Golaszewski [ Apply directly to suspend/resume functions ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-pca953x.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -1145,6 +1145,9 @@ static int pca953x_suspend(struct device struct pca953x_chip *chip = dev_get_drvdata(dev); mutex_lock(&chip->i2c_lock); + /* Disable IRQ to prevent early triggering while regmap "cache only" is on */ + if (chip->client->irq > 0) + disable_irq(chip->client->irq); regcache_cache_only(chip->regmap, true); mutex_unlock(&chip->i2c_lock); @@ -1170,6 +1173,8 @@ static int pca953x_resume(struct device } mutex_lock(&chip->i2c_lock); + if (chip->client->irq > 0) + enable_irq(chip->client->irq); regcache_cache_only(chip->regmap, false); regcache_mark_dirty(chip->regmap); ret = pca953x_regcache_sync(dev);