Skip to content

Conversation

@nika-nordic
Copy link
Contributor

@nika-nordic nika-nordic commented Oct 15, 2025

Align GPIOTE shim to changes in nrfx instantiation.

Draft PR before pulling the trigger on the approach in nrfx.

@nika-nordic nika-nordic force-pushed the nrfx_gpiote_extract_cb_sdkzephyr branch from 17612bd to d3b73fd Compare October 28, 2025 17:17
@nika-nordic nika-nordic marked this pull request as ready for review October 28, 2025 17:21
@nika-nordic nika-nordic changed the title drivers: gpio: nrf: align to nrfx_gpiote extracted control block [collab-nrfx-4.0] drivers: gpio: nrf: align to nrfx_gpiote extracted control block Oct 28, 2025
@nika-nordic nika-nordic changed the title [collab-nrfx-4.0] drivers: gpio: nrf: align to nrfx_gpiote extracted control block [collab-nrfx-4.0] drivers: gpio: nrf: align to nrfx_gpiote extracted cb Oct 28, 2025
};

static nrfx_gpiote_t gpiote_nrfx[] = {
DT_FOREACH_STATUS_OKAY(nordic_nrf_gpiote, GPIOTE_NRFX_INST)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if those instances should not be created in soc file? What about cases where gpiote is used without CONFIG_GPIO=y? Unless we assume that it is required to enable GPIO driver to use gpiote.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we would need to have a software component (like dmm.c ) to create and own the nrfx_gpiote instances, and some nordic-soc-level API to extract those instances, correct? Then both gpio shim and non-shim users could use that to obtain given nrfx_gpiote instance.

I wonder if this is worth the hassle - if any code runs with CONFIG_GPIO=n it means no one is the owner of GPIOTE instance so its the application responsibility to manage nrfx_gpiote instance.

I can try the suggested approach, however I am afraid it might be problematic when it comes to IRQ_CONNECT macro in gpio shim which expects the arguments to be constant. I guess with suggested approach the instance would need to be obtained in run-time? Alternatively via linker magic and global variables, but it won't be pretty

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nordic-krch I have extracted nrfx_gpiote instances into new gpiote_nrfx.c component in soc/common + macrology to allow to obtain any nrfx_gpiote via global variable. This should ease the nrfx_gpiote instances sharing across the system as well as CONFIG_GPIO=n variant.

A big plus of this approach is quite small impact on nrfx_gpiote users - instead of creating NRFX_GPIOTE_INSTANCE macrology needs to be used to obtain reference to global nrfx_gpiote instance.

Please take a look if this is what you had in mind.

…ponent

GPIOTE driver instances are no longer defined within nrfx.
Add a component supplementing missing functionality,
as GPIOTE driver instances are often shared across the system.

Upstream PR #: 98527

Signed-off-by: Nikodem Kastelik <[email protected]>
…trol block

Align GPIOTE shim to changes in nrfx instantiation.

Upstream PR #: 98527

Signed-off-by: Nikodem Kastelik <[email protected]>
… control block

GPIOTE driver instances are no longer defined within nrfx.

Upstream PR #: 98527

Signed-off-by: Nikodem Kastelik <[email protected]>
…tracted cb

GPIOTE driver instances are no longer defined within nrfx.

Upstream PR #: 98527

Signed-off-by: Nikodem Kastelik <[email protected]>
… with extracted cb

GPIOTE driver instances are no longer defined within nrfx.

Upstream PR #: 98527

Signed-off-by: Nikodem Kastelik <[email protected]>
@nika-nordic nika-nordic force-pushed the nrfx_gpiote_extract_cb_sdkzephyr branch from d3b73fd to 3391840 Compare October 29, 2025 20:21
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.

2 participants