Skip to content

Commit c720fb5

Browse files
Shenwei WangBartosz Golaszewski
authored andcommitted
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: f60c9ea ("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>
1 parent 8de4e0f commit c720fb5

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/gpio/gpio-mxc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,12 +584,13 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
584584
unsigned long config;
585585
bool ret = false;
586586
int i, type;
587+
bool is_imx8qm = of_device_is_compatible(port->dev->of_node, "fsl,imx8qm-gpio");
587588

588589
static const u32 pad_type_map[] = {
589590
IMX_SCU_WAKEUP_OFF, /* 0 */
590591
IMX_SCU_WAKEUP_RISE_EDGE, /* IRQ_TYPE_EDGE_RISING */
591592
IMX_SCU_WAKEUP_FALL_EDGE, /* IRQ_TYPE_EDGE_FALLING */
592-
IMX_SCU_WAKEUP_FALL_EDGE, /* IRQ_TYPE_EDGE_BOTH */
593+
IMX_SCU_WAKEUP_RISE_EDGE, /* IRQ_TYPE_EDGE_BOTH */
593594
IMX_SCU_WAKEUP_HIGH_LVL, /* IRQ_TYPE_LEVEL_HIGH */
594595
IMX_SCU_WAKEUP_OFF, /* 5 */
595596
IMX_SCU_WAKEUP_OFF, /* 6 */
@@ -604,6 +605,13 @@ static bool mxc_gpio_set_pad_wakeup(struct mxc_gpio_port *port, bool enable)
604605
config = pad_type_map[type];
605606
else
606607
config = IMX_SCU_WAKEUP_OFF;
608+
609+
if (is_imx8qm && config == IMX_SCU_WAKEUP_FALL_EDGE) {
610+
dev_warn_once(port->dev,
611+
"No falling-edge support for wakeup on i.MX8QM\n");
612+
config = IMX_SCU_WAKEUP_OFF;
613+
}
614+
607615
ret |= mxc_gpio_generic_config(port, i, config);
608616
}
609617
}

0 commit comments

Comments
 (0)