Skip to content

Commit 3834c31

Browse files
[nrf fromtree] drivers: pinctrl: nrf: patch pin retain to follow lp mode
Pins can be configured to retain their config even when the power domain they belong to is suspended. Update pinctrl_nrf to enable retain only if the pin has been configured and is not in use (pincnf is low-power/sleep), disable retain otherwise. Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit 652635f)
1 parent 0ecc122 commit 3834c31

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

drivers/pinctrl/pinctrl_nrf.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,13 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
516516
}
517517
gpd_requested = true;
518518
}
519-
520-
nrf_gpio_pin_retain_disable(pin);
521519
}
520+
521+
/*
522+
* Pad power domain now on, retain no longer needed
523+
* as pad config will be persists as pad is powered.
524+
*/
525+
nrf_gpio_pin_retain_disable(pin);
522526
#endif /* CONFIG_SOC_NRF54H20_GPD */
523527

524528
if (write != NO_WRITE) {
@@ -537,7 +541,13 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,
537541
nrf_gpio_pin_clock_set(pin, NRF_GET_CLOCKPIN_ENABLE(pins[i]));
538542
#endif
539543
#ifdef CONFIG_SOC_NRF54H20_GPD
540-
if (NRF_GET_GPD_FAST_ACTIVE1(pins[i]) == 1U) {
544+
if (NRF_GET_LP(pins[i]) == NRF_LP_ENABLE) {
545+
/*
546+
* Pad power domain may be turned off, and pad is not
547+
* actively used as pincnf is low-power. Enable retain
548+
* to ensure pad output and config persists if pad
549+
* power domain is suspended.
550+
*/
541551
nrf_gpio_pin_retain_enable(pin);
542552
}
543553
#endif /* CONFIG_SOC_NRF54H20_GPD */

0 commit comments

Comments
 (0)