Commit b6d45423 authored by Gerard Marull-Paretas's avatar Gerard Marull-Paretas Committed by Mahesh Mahadevan
Browse files

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: default avatarGerard Marull-Paretas <gerard@teslabs.com>
parent 77fc1832
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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);