]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: mxc: map Both Edge pad wakeup to Rising Edge
authorShenwei Wang <shenwei.wang@nxp.com>
Tue, 24 Mar 2026 19:21:29 +0000 (14:21 -0500)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Thu, 26 Mar 2026 08:41:44 +0000 (09:41 +0100)
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
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Link: https://patch.msgid.link/20260324192129.2797237-1-shenwei.wang@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-mxc.c

index d7666fe9dbf86e36ffbbb62b5653ea205761bc54..647b6f4861b74416abc564430c57c672f813f6bd 100644 (file)
@@ -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,13 @@ 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 for wakeup on i.MX8QM\n");
+                               config = IMX_SCU_WAKEUP_OFF;
+                       }
+
                        ret |= mxc_gpio_generic_config(port, i, config);
                }
        }