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 2106D24468C; Tue, 20 May 2025 14:10:44 +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=1747750244; cv=none; b=uTGdvnb7Y1+UMzmGLVSCl3p5oaMz98W4n+5Y+dDQMTVvwPAtm0kXlz02Iu+uLtqfxnHa+P5ZCsWpH4Vxgh8iIFETiWq2BhQpZGu7thZhqYTnm3NnjyzEB4T3x1a+WBCkPB6KsBl8RQbonyvZUkZUrwW0ji8AUBoDZPBnPvijno8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747750244; c=relaxed/simple; bh=NXCO0RFw0Stfajwpwqfo3X16F501FBo04ZI3L0obck8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FqZUBYGwdt9N40J4rC4GfjaJCdHtbkCSI8niQ2KSEq5Yi3EZ3W3ENw0IzN1tLD/qUrFyVbjL4n+var6W+Gu1qfchTZdjhWHEpGFLXFoaOJWRUwKu6mGLNMqzCK+2B82QmYNdN41Jrpm3PvBomVw1vhOkreOO5ZsDLRvImbWPEyI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xQcQk4BO; 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="xQcQk4BO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DB72C4CEEA; Tue, 20 May 2025 14:10:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1747750244; bh=NXCO0RFw0Stfajwpwqfo3X16F501FBo04ZI3L0obck8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xQcQk4BOW8KCgNPcOb5NrSGbgkh0KLLE1wQCGcYICdr1GIgBuoe6O0P+WWuljgsPY L09oxmtLHKjJ9h59RmPl38I/F2lyF/r7Tm9cq+tC735xH9yE7E3Md1TyN6TuuqeMt5 6rbVU4guXhSnNv9Pa5XS2UkYqYVR/RJ9aa9dER9w= 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 Subject: [PATCH 6.12 089/143] gpio: pca953x: fix IRQ storm on system wake up Date: Tue, 20 May 2025 15:50:44 +0200 Message-ID: <20250520125813.558050786@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250520125810.036375422@linuxfoundation.org> References: <20250520125810.036375422@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Emanuele Ghidoli commit 3e38f946062b4845961ab86b726651b4457b2af8 upstream. 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 Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-pca953x.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -1203,6 +1203,8 @@ static int pca953x_restore_context(struc guard(mutex)(&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(chip); @@ -1215,6 +1217,10 @@ static int pca953x_restore_context(struc static void pca953x_save_context(struct pca953x_chip *chip) { guard(mutex)(&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); }