Skip to content

Commit

Permalink
drivers: serial: nrfx_uarte: set/clear pins retention
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gmarull authored and cooked committed Nov 6, 2024
1 parent b910f8d commit 05308c7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/serial/uart_nrfx_uarte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 05308c7

Please sign in to comment.