Skip to content

Conversation

@bjarki-andreasen
Copy link
Contributor

Device deinit driver support

@bjarki-andreasen
Copy link
Contributor Author

The change request is regarding a commit adding stuff to the zephyr release notes, this commit is not cherry picked, so merge with superpowers should be ok :)

The usage of nrf_gpio_port_retain_disable/_enable, in cases where
the soc pins support retention, every pin must be
retained/unretained regardless of what power domain the pad is in.

This patch ensures retain is applied to all pins in all domains by
the gpio_nrfx device driver, not only pins specifically in the
fast_active_1 domain. Without this patch, pinctrl will correctly
retain pins, while gpio_nrfx will fail to unretain them when
again.

We no longer check the output state either, which was passed with
the flags arg of gpio_nrfx_gpd_retain_set() so this arg has been
removed.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 691b335)
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)
Add DEVICE_DEINIT variants of SPI_DEVICE_ macros. These include

- SPI_DEVICE_DT_DEINIT_DEFINE()
- SPI_DEVICE_DT_INST_DEINIT_DEFINE()

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 1663253)
Implement device deinit for nRF SPIM device driver.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 2609cfb)
Introduce test for device_deinit() which deinitializes the spi
bus, then configures miso as input, mosi as output using gpio,
utilizing the loopback to test directly controlling the pins.
Then reinit the spi device.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit ecb5457)
…h miso/mosi

Add miso-gpios and mosi-gpios to nrf overlays required for
device_deinit testing.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 160c196)
Add device deinit variants of the I2C_DEVICE_DT_*_DEFINE macros.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit 8a928ea)
Implement device deinit for the nRF TWIM device drivers.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit bd73c73)
Implement device deinit hooks for nRF TWIS device driver.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit f22ffee)
…t case

Add device_deinit test case which, in case there are two devices
using gpio loopbacks, deinits both controller and target devices,
then uses gpio to configure and toggle the pins of the bus, then
reinitializes both devices.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit db1f14e)
…ith bus gpios

Add bus gpios to zephyr,user node in nrf overlays to enable testing
device_deinit test case.

Signed-off-by: Bjarki Arge Andreasen <[email protected]>
(cherry picked from commit e0fa444)
@bjarki-andreasen bjarki-andreasen force-pushed the device-deinit-driver-support branch from 8bdb2ed to c6effa3 Compare June 27, 2025 10:04
@sonarqubecloud
Copy link

@bjarki-andreasen
Copy link
Contributor Author

@carlescufi carlescufi merged commit 27b6d12 into nrfconnect:main Jul 3, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants