drivers: gpio: gpio_mcux_lpc: fix bug disabling pulls

If the gpio had pull previous enabled, but new config
request wants the pull disabled, the code was failing
to clear the previous pull setting.

Signed-off-by: Mike J. Chen <mjchen@google.com>
This commit is contained in:
Mike J. Chen 2023-11-03 16:37:25 -07:00 committed by Carles Cufí
parent 63b8890ad4
commit 054f9d7a82

View File

@ -119,6 +119,12 @@ static int gpio_mcux_lpc_configure(const struct device *dev, gpio_pin_t pin,
} else if ((flags & GPIO_PULL_DOWN) != 0) {
*pinconfig |= IOCON_PIO_MODE_PULLDOWN;
}
#endif
} else {
#ifdef IOPCTL /* RT600 and RT500 series */
*pinconfig &= ~IOPCTL_PIO_PUPD_EN;
#else /* LPC SOCs */
*pinconfig &= ~(IOCON_PIO_MODE_PULLUP|IOCON_PIO_MODE_PULLDOWN);
#endif
}