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=1796386962; b=NkDGyOHljCOU2VG5/RuROgGVRiV3kPm9FyjRijrlqXfKR0Ef0q8wef8njZPB56n+vDs8 pKHgacuNQ82nA96j+AjIJJp/k2fPiIP7ZymP9l0/rmHS/VkENcrpNY9N9k3qTf89659gd gXurdP/jFPTzwB+g/y9Sv0gHrLxdpGFKi+U2hKmnRVbftVGBf7f23MN54nGY32WpatAz6 sz0QDdXp+0mQGhOqzdfSBGPc1ZMgYOPFbEiz9+jmFv2kmoL7Rmqso3Nd8bLxsEmU0P2s0 PfN2+fH+PhTr51FrqydjMw3znYL2Bl7RcYCfaFjbRHZBhgcRDMSqDqbPbUnfHWXGeHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796386962; 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=nw5JPvofwWzcROanng2w6OrwAJM9Y0JOD6Nbbe1rilM=; b=b7NLLTP2Xv4sb5YIuJU2WbkL9mPswty9+QX6+f88LLvuwA2Z0xnppJWHm0dfMv3/Z9vl lDLlVNsFiKiGX5QQ6xK2A/HAoXUxc99AOTY/iRmJnijthchJjtULw+b/qfQSpVABy0UxA LuKYiBEfDwkzHhXBs6V/v/GUMqFXd5+PhFpAD9+hsjFKRJ2vThInqFef6wwSQqisJOyrt jJRCGL8hYeis594Kbf9aFyOq9uD8buSgNfgh7DOobnWEIbYnqy/m/WS/dXoeFLSDUjV+2 Uwxt7iI3hnU+SiuAX+300tm9PTbx2eDn1K7b1odMf9SAnn8hC7pf4N2tV1dbVi0zHqQ== 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=TGpxAThb; 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 36714606A32C; Fri, 4 Dec 2026 12:22:42 +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=TGpxAThb Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6B421F000C2; Fri, 4 Dec 2026 12:22:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796386962; bh=nw5JPvofwWzcROanng2w6OrwAJM9Y0JOD6Nbbe1rilM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TGpxAThb2LphkHtFlMgbWU5pmZnunDjS8cRNO5JYgUv4X94pjAopQAQ5FJQpDM9ub RZY09xR+YUuGDEqtFg055EJdzKCOct6fExNV21vQQ6qPjgJRFiMyI6FCtiPOPV0TAy 5DiZaLzIFejAfNTjgkeLrCy0rmNm7Hhah47uBFLg= 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.1 0076/1059] gpio: mpc8xxx: Add wake on GPIO support Date: Fri, 4 Dec 2026 18:53:27 +0900 Message-ID: <20261204100646.073437150@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 5a91044f86f2c..82641263d8067 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -412,6 +412,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); @@ -428,6 +430,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",}, @@ -439,6 +466,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