From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384424; b=EtnHtHCSozxsXFOS3MgzrKSNbl3lVhvOMH+gcZxUpCU1x/nQlLrSBClcrjiE7WqzyTrx grt82F0SKiaJNKQ3vuEgp5UcadTK95HsZemwkAllw28/Q/b0gthl+kRWN0TsHPbCBlhf1 Y3f+XBVGP320h8KX4puz4auyUx7eEfTHFLymmao8dKc1NtsORc7j1LmA+fhEsO27PXTvL +3kRtFigEl2MY43wDYdD588ppJ3cuUeTdOmgPtO5IYNiDoMkTd9X40uCZsSg2iqHe+DgB Yx4LXQ8jeaE6o71TbF2vupx0vMwlyTtHgbozaVwAAYmcu5UzHl+ZjS/uXkarrnItWiQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384424; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=1VvfbqdRzXbteuQc4OpPxmD4aHcJq8UZ/lhTUAXX8eY=; b=AktgO/jcbC4Deg+1twi3TAYws91yVIB/8MZ+AMuRUHDDTOajYsl+bBI12FwTGQIPPx+m JkRgxjjv5Y3YBnv5YvrVjWbBFR3801NgrM2ObxHRSyRQZkKKiJEG7X4sDfXrOgMtT+ZHu B8mF4RwDPMFpaTF2iUPkyRy5bomR041vyw8R5OP3+eE8t4Mfhknx85p62fckauZn1llLI Zuwawknr503ea49/c14og7xaOyEI4ay7TVuym9HdH8hXBWFDXo3EZZE5rycUHgwhGVfpo V0jc9gXogci2c9U3ixFATSFdvQRLuoyOud2MDPPRoxeAfa5dY76Srr2JvI2URUWc1xg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vDiJN6U7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9828606A322; Fri, 4 Dec 2026 11:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=vDiJN6U7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BD941F000C2; Fri, 4 Dec 2026 11:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384424; bh=1VvfbqdRzXbteuQc4OpPxmD4aHcJq8UZ/lhTUAXX8eY=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vDiJN6U71cyGlcFEti5Cg3FHUM+KzY83U/W9znOKLIOfzRDK+L1U0U+PZc56TGFoV +mLR54kyOLCzLUeFQzR50A1KPlJmPy2Cd+Xd58X2Ulh+HDxicIy6Lxm2ochS2eyNu5 DAFsy7yXJxijFObsBUOhKfgn77K51+UoCw8cxE3g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Martyn Welch , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.6 0107/1167] gpio: mpc8xxx: Add wake on GPIO support Date: Fri, 4 Dec 2026 18:52:14 +0900 Message-ID: <20261204100704.879486575@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martyn Welch [ Upstream commit e9482dc50ab2cb81b7735180345c48ada87205a5 ] The mpc8xxx GPIO can generate an interrupt on state change. This interrupt can be used to wake up the device from its sleep state if enabled to do so. Add required support to the driver so that the GPIO can be used in this way. In order for the GPIO to actually function in this way, it is necessary to also set the GPIO bit in the RCPM. This can be done via the device tree fsl,rcpm-wakeup property. Signed-off-by: Martyn Welch Link: https://lore.kernel.org/r/20240820143328.1987442-1-martyn.welch@collabora.com Signed-off-by: Bartosz Golaszewski Stable-dep-of: 9e4b35c95fed ("gpio: mpc8xxx: Fix potential use-after-free of IRQ domain") Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mpc8xxx.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index c0125ac739066..ab30c911c9d50 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -413,6 +413,8 @@ static int mpc8xxx_probe(struct platform_device *pdev) goto err; } + device_init_wakeup(&pdev->dev, true); + return 0; err: irq_domain_remove(mpc8xxx_gc->irq); @@ -429,6 +431,31 @@ static void mpc8xxx_remove(struct platform_device *pdev) } } +#ifdef CONFIG_PM +static int mpc8xxx_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev); + + if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev)) + enable_irq_wake(mpc8xxx_gc->irqn); + + return 0; +} + +static int mpc8xxx_resume(struct platform_device *pdev) +{ + struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev); + + if (mpc8xxx_gc->irqn && device_may_wakeup(&pdev->dev)) + disable_irq_wake(mpc8xxx_gc->irqn); + + return 0; +} +#else +#define mpc8xxx_suspend NULL +#define mpc8xxx_resume NULL +#endif + #ifdef CONFIG_ACPI static const struct acpi_device_id gpio_acpi_ids[] = { {"NXP0031",}, @@ -440,6 +467,8 @@ MODULE_DEVICE_TABLE(acpi, gpio_acpi_ids); static struct platform_driver mpc8xxx_plat_driver = { .probe = mpc8xxx_probe, .remove_new = mpc8xxx_remove, + .suspend = mpc8xxx_suspend, + .resume = mpc8xxx_resume, .driver = { .name = "gpio-mpc8xxx", .of_match_table = mpc8xxx_gpio_ids, -- 2.53.0