Skip to content

Commit 122b14b

Browse files
mjchen0kartben
authored andcommitted
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>
1 parent d8358b2 commit 122b14b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpio/gpio_mcux_lpc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,11 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
263263
const struct gpio_mcux_lpc_config *config = dev->config;
264264
enum nxp_pint_trigger interrupt_mode = NXP_PINT_NONE;
265265
uint32_t port = config->port_no;
266+
bool wake = ((trig & GPIO_INT_WAKEUP) == GPIO_INT_WAKEUP);
266267
int ret;
267268

269+
trig &= ~GPIO_INT_WAKEUP;
270+
268271
switch (mode) {
269272
case GPIO_INT_MODE_DISABLED:
270273
nxp_pint_pin_disable((port * 32) + pin);
@@ -292,7 +295,7 @@ static int gpio_mcux_lpc_pint_interrupt_cfg(const struct device *dev,
292295
}
293296

294297
/* PINT treats GPIO pins as continuous. Each port has 32 pins */
295-
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, (trig & GPIO_INT_WAKEUP));
298+
ret = nxp_pint_pin_enable((port * 32) + pin, interrupt_mode, wake);
296299
if (ret < 0) {
297300
return ret;
298301
}

0 commit comments

Comments
 (0)