drivers: gpio_mcux_lpc: fix bug configuring interrupts with GPIO_INT_WAKEUP

If GPIO_INT_WAKEUP is in the trig argument, the selection
of trigger mode breaks because the GPIO_INT_WAKEUP flag
breaks the equal comparisons.

Signed-off-by: Mike J. Chen <mjchen@google.com>
This commit is contained in:
Mike J. Chen 2025-03-25 09:45:00 -07:00 committed by Benjamin Cabé
commit 122b14bc68

View file

@ -263,8 +263,11 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
const struct gpio_mcux_lpc_config *config = dev->config; const struct gpio_mcux_lpc_config *config = dev->config;
enum nxp_pint_trigger interrupt_mode = NXP_PINT_NONE; enum nxp_pint_trigger interrupt_mode = NXP_PINT_NONE;
uint32_t port = config->port_no; uint32_t port = config->port_no;
bool wake = ((trig & GPIO_INT_WAKEUP) == GPIO_INT_WAKEUP);
int ret; int ret;
trig &= ~GPIO_INT_WAKEUP;
switch (mode) { switch (mode) {
case GPIO_INT_MODE_DISABLED: case GPIO_INT_MODE_DISABLED:
nxp_pint_pin_disable((port * 32) + pin); nxp_pint_pin_disable((port * 32) + pin);
@ -292,7 +295,7 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
} }
/* PINT treats GPIO pins as continuous. Each port has 32 pins */ /* PINT treats GPIO pins as continuous. Each port has 32 pins */
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, (trig & GPIO_INT_WAKEUP)); ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, wake);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }