public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge
@ 2026-03-20 19:31 Shenwei Wang
  2026-03-22  3:03 ` Peng Fan (OSS)
  2026-03-23  7:26 ` Alexander Stein
  0 siblings, 2 replies; 3+ messages in thread
From: Shenwei Wang @ 2026-03-20 19:31 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Frank Li, Sascha Hauer
  Cc: Pengutronix Kernel Team, Fabio Estevam, Shenwei Wang, Peng Fan,
	linux-gpio, imx, linux-arm-kernel, linux-kernel, linux-imx,
	stable

Suspend may fail on i.MX8QM when Falling Edge is used as a pad wakeup
trigger due to a hardware bug in the detection logic. Since the hardware
does not support Both Edge wakeup, remap requests for Both Edge to Rising
Edge by default to avoid hitting this issue.

A warning is emitted when Falling Edge is selected on i.MX8QM.

Fixes: f60c9eac54af ("gpio: mxc: enable pad wakeup on i.MX8x platforms")
cc: stable@vger.kernel.org
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
---
 Changes in V2:
  - add a check for i.mx8qm and emit a warning when Falling Edge is
    selected.

 drivers/gpio/gpio-mxc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index d7666fe9dbf8..095bcfbc56e0 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -584,12 +584,13 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
 	unsigned long config;
 	bool ret = false;
 	int i, type;
+	bool is_imx8qm = of_device_is_compatible(port->dev->of_node, "fsl,imx8qm-gpio");

 	static const u32 pad_type_map[] = {
 		IMX_SCU_WAKEUP_OFF,		/* 0 */
 		IMX_SCU_WAKEUP_RISE_EDGE,	/* IRQ_TYPE_EDGE_RISING */
 		IMX_SCU_WAKEUP_FALL_EDGE,	/* IRQ_TYPE_EDGE_FALLING */
-		IMX_SCU_WAKEUP_FALL_EDGE,	/* IRQ_TYPE_EDGE_BOTH */
+		IMX_SCU_WAKEUP_RISE_EDGE,	/* IRQ_TYPE_EDGE_BOTH */
 		IMX_SCU_WAKEUP_HIGH_LVL,	/* IRQ_TYPE_LEVEL_HIGH */
 		IMX_SCU_WAKEUP_OFF,		/* 5 */
 		IMX_SCU_WAKEUP_OFF,		/* 6 */
@@ -604,6 +605,12 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
 				config = pad_type_map[type];
 			else
 				config = IMX_SCU_WAKEUP_OFF;
+
+			if (is_imx8qm && config == IMX_SCU_WAKEUP_FALL_EDGE) {
+				dev_warn_once(port->dev, "No falling-edge support on i.MX8QM\n");
+				config = IMX_SCU_WAKEUP_OFF;
+			}
+
 			ret |= mxc_gpio_generic_config(port, i, config);
 		}
 	}
--
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge
  2026-03-20 19:31 [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge Shenwei Wang
@ 2026-03-22  3:03 ` Peng Fan (OSS)
  2026-03-23  7:26 ` Alexander Stein
  1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-03-22  3:03 UTC (permalink / raw)
  To: Shenwei Wang, Linus Walleij, Bartosz Golaszewski, Frank Li,
	Sascha Hauer
  Cc: Pengutronix Kernel Team, Fabio Estevam,
	linux-gpio@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, dl-linux-imx,
	stable@vger.kernel.org

> Subject: [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising
> Edge
> 
> Suspend may fail on i.MX8QM when Falling Edge is used as a pad
> wakeup trigger due to a hardware bug in the detection logic. Since the
> hardware does not support Both Edge wakeup, remap requests for
> Both Edge to Rising Edge by default to avoid hitting this issue.
> 
> A warning is emitted when Falling Edge is selected on i.MX8QM.
> 
> Fixes: f60c9eac54af ("gpio: mxc: enable pad wakeup on i.MX8x
> platforms")
> cc: stable@vger.kernel.org
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge
  2026-03-20 19:31 [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge Shenwei Wang
  2026-03-22  3:03 ` Peng Fan (OSS)
@ 2026-03-23  7:26 ` Alexander Stein
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Stein @ 2026-03-23  7:26 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Frank Li, Sascha Hauer,
	Shenwei Wang
  Cc: Pengutronix Kernel Team, Fabio Estevam, Shenwei Wang, Peng Fan,
	linux-gpio, imx, linux-arm-kernel, linux-kernel, linux-imx,
	stable

Am Freitag, 20. März 2026, 20:31:50 CET schrieb Shenwei Wang:
> Suspend may fail on i.MX8QM when Falling Edge is used as a pad wakeup
> trigger due to a hardware bug in the detection logic. Since the hardware
> does not support Both Edge wakeup, remap requests for Both Edge to Rising
> Edge by default to avoid hitting this issue.
> 
> A warning is emitted when Falling Edge is selected on i.MX8QM.
> 
> Fixes: f60c9eac54af ("gpio: mxc: enable pad wakeup on i.MX8x platforms")
> cc: stable@vger.kernel.org
> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
> ---
>  Changes in V2:
>   - add a check for i.mx8qm and emit a warning when Falling Edge is
>     selected.
> 
>  drivers/gpio/gpio-mxc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index d7666fe9dbf8..095bcfbc56e0 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -584,12 +584,13 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
>  	unsigned long config;
>  	bool ret = false;
>  	int i, type;
> +	bool is_imx8qm = of_device_is_compatible(port->dev->of_node, "fsl,imx8qm-gpio");
> 
>  	static const u32 pad_type_map[] = {
>  		IMX_SCU_WAKEUP_OFF,		/* 0 */
>  		IMX_SCU_WAKEUP_RISE_EDGE,	/* IRQ_TYPE_EDGE_RISING */
>  		IMX_SCU_WAKEUP_FALL_EDGE,	/* IRQ_TYPE_EDGE_FALLING */
> -		IMX_SCU_WAKEUP_FALL_EDGE,	/* IRQ_TYPE_EDGE_BOTH */
> +		IMX_SCU_WAKEUP_RISE_EDGE,	/* IRQ_TYPE_EDGE_BOTH */
>  		IMX_SCU_WAKEUP_HIGH_LVL,	/* IRQ_TYPE_LEVEL_HIGH */
>  		IMX_SCU_WAKEUP_OFF,		/* 5 */
>  		IMX_SCU_WAKEUP_OFF,		/* 6 */
> @@ -604,6 +605,12 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
>  				config = pad_type_map[type];
>  			else
>  				config = IMX_SCU_WAKEUP_OFF;
> +
> +			if (is_imx8qm && config == IMX_SCU_WAKEUP_FALL_EDGE) {
> +				dev_warn_once(port->dev, "No falling-edge support on i.MX8QM\n");

How about "No falling-edge support for wakeup on i.MX8QM"? Without
context this message in the kernellog is confusing.

Best regards,
Alexander

> +				config = IMX_SCU_WAKEUP_OFF;
> +			}
> +
>  			ret |= mxc_gpio_generic_config(port, i, config);
>  		}
>  	}
> --
> 2.43.0
> 
> 
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-23  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 19:31 [PATCH v2] gpio: mxc: map Both Edge pad wakeup to Rising Edge Shenwei Wang
2026-03-22  3:03 ` Peng Fan (OSS)
2026-03-23  7:26 ` Alexander Stein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox