Skip to content

Commit 4eb1730

Browse files
committed
silabs: allow configuring of zero latency gpio irq
Make it possible to enable zero latency GPIO IRQ mode through Kconfig. Signed-off-by: Jonny Gellhaar <[email protected]>
1 parent 41e5d58 commit 4eb1730

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

drivers/gpio/Kconfig.gecko

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Gecko GPIO configuration options
22

33
# Copyright (c) 2017 Christian Taedcke
4+
# Copyright (c) 2025 Jonny Gellhaar
45
# SPDX-License-Identifier: Apache-2.0
56

67
menuconfig GPIO_GECKO
@@ -15,3 +16,13 @@ config GPIO_GECKO_COMMON_INIT_PRIORITY
1516
int "Common initialization priority"
1617
depends on GPIO_GECKO
1718
default 39
19+
20+
config GPIO_GECKO_ZERO_LATENCY_IRQ
21+
bool "Cofigure GPIO as Zephyr zero latency IRQ"
22+
default n
23+
depends on GPIO_GECKO
24+
select ZERO_LATENCY_IRQS
25+
help
26+
Make sure to read documentatino of zero latency IRQ and its
27+
implications and potential dangers. Do not call kernel API
28+
from the GPIO inerrupt callback.

drivers/gpio/gpio_gecko.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2017, Christian Taedcke
3+
* Copyright (c) 2025, Jonny Gellhaar
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
@@ -391,6 +392,12 @@ DEVICE_DT_DEFINE(DT_INST(0, silabs_gecko_gpio),
391392
PRE_KERNEL_1, CONFIG_GPIO_GECKO_COMMON_INIT_PRIORITY,
392393
&gpio_gecko_common_driver_api);
393394

395+
#ifdef CONFIG_GPIO_GECKO_ZERO_LATENCY_IRQ
396+
#define CONFIGURED_FLAGS IRQ_ZERO_LATENCY
397+
#else
398+
#define CONFIGURED_FLAGS 0u
399+
#endif /* CONFIG_GPIO_GECKO_ZERO_LATENCY_IRQ */
400+
394401
static int gpio_gecko_common_init(const struct device *dev)
395402
{
396403
#ifdef CONFIG_SOC_GECKO_DEV_INIT
@@ -400,12 +407,12 @@ static int gpio_gecko_common_init(const struct device *dev)
400407
IRQ_CONNECT(GPIO_EVEN_IRQn,
401408
DT_IRQ_BY_NAME(DT_INST(0, silabs_gecko_gpio), gpio_even, priority),
402409
gpio_gecko_common_isr,
403-
DEVICE_DT_GET(DT_INST(0, silabs_gecko_gpio)), 0);
410+
DEVICE_DT_GET(DT_INST(0, silabs_gecko_gpio)), CONFIGURED_FLAGS);
404411

405412
IRQ_CONNECT(GPIO_ODD_IRQn,
406413
DT_IRQ_BY_NAME(DT_INST(0, silabs_gecko_gpio), gpio_odd, priority),
407414
gpio_gecko_common_isr,
408-
DEVICE_DT_GET(DT_INST(0, silabs_gecko_gpio)), 0);
415+
DEVICE_DT_GET(DT_INST(0, silabs_gecko_gpio)), CONFIGURED_FLAGS);
409416

410417
irq_enable(GPIO_EVEN_IRQn);
411418
irq_enable(GPIO_ODD_IRQn);

0 commit comments

Comments
 (0)