drivers: serial: nrfx_uarte: set/clear pins retention

When GPD is managed by pinctrl, pins retention needs to be controlled by
the driver to avoid glitches.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2024-10-29 10:26:39 +01:00 committed by Mahesh Mahadevan
commit b6d45423c6

View file

@ -23,6 +23,11 @@
#include <zephyr/linker/devicetree_regions.h>
#include <zephyr/irq.h>
#include <zephyr/logging/log.h>
#ifdef CONFIG_SOC_NRF54H20_GPD
#include <nrf/gpd.h>
#endif
LOG_MODULE_REGISTER(uart_nrfx_uarte, CONFIG_UART_LOG_LEVEL);
#if !defined(CONFIG_ARCH_POSIX)
@ -2098,6 +2103,9 @@ static void uarte_pm_resume(const struct device *dev)
if (IS_ENABLED(CONFIG_PM_DEVICE_RUNTIME) || !LOW_POWER_ENABLED(cfg)) {
uarte_periph_enable(dev);
#ifdef CONFIG_SOC_NRF54H20_GPD
nrf_gpd_retain_pins_set(cfg->pcfg, false);
#endif
}
}
@ -2160,6 +2168,10 @@ static void uarte_pm_suspend(const struct device *dev)
wait_for_tx_stopped(dev);
}
#ifdef CONFIG_SOC_NRF54H20_GPD
nrf_gpd_retain_pins_set(cfg->pcfg, true);
#endif
nrf_uarte_disable(uarte);
(void)pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_SLEEP);