Commit graph zephyr/drivers/gpio
Author SHA1 Message Date
Krzysztof Chruściński
fea078ff42 drivers: gpio: nrf: Do not use nrfx_gpiote when no interrupts
If CONFIG_GPIO_NRFX_INTERRUPT is disabled then nrfx_gpiote driver API
shall no be accessed at all (driver can be disabled).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-03-11 17:53:23 +00:00
Tom Burdick
bdcade6646 gpio: infineon: Add shared gpio ports
Infineon PSOC4 parts share many ports with a single IRQ line. Using the
SHARED_INTERRUPT handler feature of Zephyr results in a very large IRQ
vector table. Instead structure in DT the idea that the ports are
sharing an interrupt with a sort of pseudo interrupt controller.

This also rectifies the need to ifdef on CAT1C/M0+. I added a note
making it clear that in those cases we likely need to rework the way
interrupts are done anyways as there's secondary interrupt
muxes/controllers involved.

Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-03-10 17:58:42 -07:00
Tom Burdick
75132cf2df gpio: infineon: Clean up GPIO driver
Use IF_ENABLED when possible to keep code indents looking nicer rather
than ifdef's. Rename everything to be ifx (drop the cat1 naming). Drops
the unused intc_prio config member.

Signed-off-by: Tom Burdick <thomas.burdick@infineon.com>
2026-03-10 17:58:42 -07:00
Camille BAUD
0fdda30623 drivers: gpio: Introduce BFLB BL61x GPIO FIFO / Wire Out
Introduce a fast GPIO output system with pulse width modifications

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-03-10 22:20:46 +01:00
Camille BAUD
358b954dda drivers: gpios: Various BL61x improvement and support GPIO > 31
Various BL61x GPIO improvements

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-03-10 22:20:46 +01:00
Raffael Rostagno
1dd41b7a0b drivers: gpio: esp32: Add pull support for wakeup
Add pull-up/down support to RTCIO pins for wakeup function.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-10 15:09:30 +01:00
Raffael Rostagno
f25243cf7a drivers: gpio: esp32: Add wakeup support
Add support to GPIO_INT_WAKEUP flag at config() event.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-10 15:09:30 +01:00
Raffael Rostagno
53fe964473 drivers: gpio: esp32: Add device PM
Add device PM to ESP32 GPIO driver.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-10 15:09:30 +01:00
Nhut Nguyen
5eb9d75dcc drivers: gpio: renesas: Add support for RZ/T2H, N2H
Update GPIO driver to support Renesas RZ/T2H, N2H

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-03-10 09:33:25 +01:00
Yuzhuo Liu
f91ac6596e drivers: gpio: add rtl8752h gpio driver
Add rtl8752h series in bee gpio driver.

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-03-09 15:03:48 -05:00
Sylvio Alves
1f672c777a soc: esp32c6: lp core gpio driver fixes and improvements
- Fix lp_gpio Kconfig dependency to use proper
  DT_HAS_ESPRESSIF_ESP32_LPGPIO_ENABLED symbol instead of
  SOC_ESP32C6_LPCORE, and separate GPIO_ESP32 from LPGPIO_ESP32

- fix lp_gpio compatible string to espressif,esp32-lpgpio to
  match the corrected Kconfig dependency

- enable global LP core interrupts at startup via
  ulp_lp_core_intr_enable() in lp_core_startup(); the LP core
  has no interrupt allocator so this must be done once for any
  peripheral using the single interrupt vector

- enable lp_gpio in gpio_wakeup sample overlay

- fix ESP_CONSOLE_UART_NUM default for LP HP UART console

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-05 04:51:18 +01:00
John Batch
304fdce920 drivers: gpio: Infineon: enable input+output mode and bug fixes
- Enables GPIO input+output mode to enable gpio_api_1pin test
- Retains current pin state when no output init flag specified.
- Adds pull up register validation, sets pull up register in
  both pull-up and pull-up+pull-down cases.

Signed-off-by: John Batch <john.batch@infineon.com>
2026-03-03 11:26:53 +01:00
John Batch
ff093ee750 drivers: gpio: Infineon: refactor drive mode selection into helpers
Refactors the drive mode selection logic for input and output pins into
dedicated helper functions.

Signed-off-by: John Batch <john.batch@infineon.com>
2026-03-03 11:26:53 +01:00
Lucien Zhao
a2f0191e2e drivers: gpio: mcux_rgpio: use cfg_idx instead of pin for pue_mux access
Fix incorrect array index on line 101. Should use cfg_idx (which accounts
for non-contiguous pin layouts) instead of pin when accessing pin_muxes
array elements. This prevents potential out-of-bounds access and ensures
correct pull configuration on i.MX RT118x SOCs.

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2026-03-02 15:45:15 -08:00
Khoa Tran
ee99677faa drivers: gpio: Update Renesas RA GPIO driver to support RA0 series
- Update Renesas RA GPIO driver to support Renesas RA0 series
- Add macro to disable port external interrupt the the compatible
nodes `renesas,ra-external-interrupt` are not enabled.

Signed-off-by: Khoa Tran <khoa.tran.yj@bp.renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2026-03-02 10:48:45 +01:00
Mathieu Choplain
bdb8a8bf30 drivers: gpio: stm32: add missing port "W" to list
This was not noticed because there is currently no STM32 with a GPIOW port,
but adding it to the list is better for future-proofing.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-25 13:24:37 +01:00
William Markezana
b2ffb8b7a7 drivers: gpio: bflb: route BL70x PSRAM GPIOs when PSRAM is disabled
On BL70x, pins 23-28 are output-only and must be routed through the
PSRAM IO pads. When PSRAM is not enabled, set GLB_GPIO_USE_PSRAM_IO
so these pins are usable as regular GPIOs.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-02-25 13:17:31 +01:00
William Markezana
e42bc6dc58 drivers: gpio: bflb: fix GPIO output init pin mask
Use BIT(pin) instead of the raw pin number when setting or clearing
GPIO output values. Without BIT(), only the lowest pins were
affected and higher pins were never toggled.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-02-25 13:17:31 +01:00
Manojkumar Konisetty
2565018964 drivers: gpio: Use shared interrupts for PSOC4
Enable CONFIG_SHARED_INTERRUPTS to allow multiple devices
to register handlers on the same IRQ line.

Replace irq_connect_dynamic() with IRQ_CONNECT() to configure
interrupts at build time, eliminating runtime setup overhead.

Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2026-02-24 16:04:54 -06:00
Bernardo Perez Priego
1d12eb64e3 gpio: mchp: Don't skip interrupt enable when IDET is unchanged
`gpio_xec_pin_interrupt_config` returned early when the computed IDET
configuration matched the current CR1 IDET field. On some reset paths
the GPIO control register can retain the same IDET value while the
interrupt aggregator state is reset/reconfigured. In that case, the
early return prevents re-enabling the aggregator and interrupts remain
disabled.

Remove the IDET equality early-return so the driver always updates the
level/edge bookkeeping and programs the interrupt aggregator enable
state.

Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
2026-02-24 10:39:09 +01:00
Fin Maaß
eaccc7a84a gpio: litex: fix setting oe
set oe (output enable) correctly and not always to 1.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-23 11:35:54 +00:00
Fin Maaß
6cd2923835 gpio: litex: clear all pending irq before enabling
clear all pending irq before enabling.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-23 11:35:54 +00:00
Fin Maaß
44b1f1b5df gpio: litex: enable the irq via ev_enable at the end
when configureing the irq, do the enableing at last.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-23 11:35:54 +00:00
Mathieu Choplain
b779a2b03f drivers: gpio: stm32: use device as ISR argument instead of data
The GPIO ISR needs both a pointer to the device object and its data block
(because the callback linked list is stored in the data block). Sicne the
device object has a built-in pointer to the data block, using that as the
ISR's argument allows obtaining all we need "for free" whereas the current
approach wastes 4 bytes of RAM per GPIO port instance.

Note that once compiled, the reworked ISR is effectively identical to the
old one (only the offset of one `ldr Rt, [Rn, #off]` changes).

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-20 10:31:46 -08:00
Cliff Brake
baafb791c4 drivers: gpio: mcp23xxx: fix drive mode validation for input pins
The drive mode validation added in commit ede19a4337 was rejecting
valid configurations for input pins. The validation ensures that
GPIO_SINGLE_ENDED and GPIO_LINE_OPEN_DRAIN flags match the hardware
capabilities of each MCP23xxx variant (push-pull vs open-drain).

However, this validation was applied to all pin configurations,
including input pins. Input pins do not have a drive mode, so
applications typically configure them without setting drive mode flags.
This caused the validation to incorrectly reject input pin configurations
with -ENOTSUP.

Fix by only validating drive mode flags when GPIO_OUTPUT is set.
Input pins now configure successfully, while output pins still receive
proper validation to ensure the requested drive mode matches the
hardware capabilities.

Fixes: ede19a4337 ("drivers: mcp23xxx: add support for open-drain ...")
Signed-off-by: Cliff Brake <cbrake@bec-systems.com>
2026-02-19 09:59:41 -06:00
Fin Maaß
04f652c4bd drivers: gpio: add macro to set common config struct
use macro to set common config struct.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-19 09:25:11 +01:00
Yuzhuo Liu
08bad54b32 drivers: gpio: add realtek bee gpio driver
Add realtek bee gpio driver.

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-02-17 15:22:38 +00:00
Fin Maaß
c57cf5d05b gpio: litex: remove unused parts
remove unused parts in the litex gpio driver.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-02-17 15:21:58 +00:00
Stan Verschuuren
da0c815974 drivers: gpio: max149x6: Handle GPIO_OUTPUT_INIT_HIGH/LOW flags
When calling `gpio_pin_configure` with GPIO_OUTPUT_INIT_LOW or
GPIO_OUTPUT_INIT_HIGH, it is expected from the driver to set initial
output state. The current driver implementation does not set this
user provided initial state.

This commit sets requested output state before changing channel mode
to output.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Stan Verschuuren
efc66a9cd9 drivers: gpio: max14906: Apply new value in toggle_bits
MAX14906 implementation of GPIO function `port_toggle_bits` writes
back old register value instead of inverted new value.

This commit XOR's current output state with requested pins (as expected)
and writes new value to register.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Stan Verschuuren
0cbfd7b445 drivers: gpio: max149x6: Add missing port_set_masked_raw GPIO API
The MAX149x6 drivers do not implement the generic GPIO function
port_set_masked_raw. The current implementation therefore hard faults due
to dereferencing NULL ptr on calls to gpio_port_set_masked_raw.

This commit adds port_set_masked_raw for both MAX14906 and MAX14916.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Stan Verschuuren
e78120f768 drivers: gpio: max14906: Fix clear_bits_raw to erase correct output bits
The MAX14906 SetOUT register packs direction bits in [7:4] and output
state in [3:0]. The existing implementation clears all output bits
regardless of pin mask, as the mask is ANDed with 0xf0 before inversion.

This commit fixes that by masking before inverting.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Stan Verschuuren
be3ce18908 drivers: gpio: max14906: Make non-essential ports optional
The MAX14906 can be operated compliantly without directly controlling
EN/FAULT/SYNCH/READY ports. The MAX14906 DTS files already reflect this
optional nature.

This commit makes the driver treat these ports as optional without changing
the business logic of the driver. If these ports are not defined,
certain diagnostic logging calls are simply skipped over.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Stan Verschuuren
2d4c96901e drivers: gpio: max149x6: Handle check_byte in CRC function
The MAX14906 (p36), MAX14915 (p26), and MAX14916 (p28) datasheets state
that the device includes A0,A1,ThrErr bits in CRC calculation. The existing
solution doesnt handle these bits.

This commit passes the 3 top bits of the SDO check byte to the CRC
function, making the CRC calculation datasheet compliant

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-02-17 10:32:50 +01:00
Muhammed Asif
a51311010c drivers: microchip: interrupt_controller: Add g1 driver for eic
- Adds the g1 driver for eic for microchip devices
- Uses the APIs of the eic driver from gpio driver

Signed-off-by: Muhammed Asif <muhammed.asif@microchip.com>
2026-02-16 00:12:43 +00:00
Mathieu Choplain
a11688fab5 drivers: *: stm32: don't check if clock device is ready
If the clock device (i.e., RCC) failed to initialize, we have bigger
problems than trying to call clock_control_{off,on,configure} on it.
Don't bother checking to save some footprint.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-02-13 18:59:16 +00:00
Sylvio Alves
39de685f64 drivers: gpio: esp32_lp: add pull-up/down and wakeup support
Add GPIO_PULL_UP and GPIO_PULL_DOWN handling in pin_configure
and enable LP_IO wakeup source in pin_interrupt_configure via
rtcio_ll_wakeup_enable(). Both rtcio_ll_intr_enable() and
rtcio_ll_wakeup_enable() are required for LP_IO wakeup to
function, as clk_en must be set for the interrupt status
register to update.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-02-12 20:04:04 +01:00
Aksel Skauge Mellbye
bf4591b4bc drivers: gpio: silabs: Set port_pin_mask from Devicetree
Set `port_pin_mask` in the GPIO driver for Silicon Labs Series 2
based on Devicetree `ngpios` and `gpio-reserved-ranges`. This
mask is used to validate that the pin numbers passed to the GPIO
API are valid on a given device.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-02-09 13:32:07 +01:00
Matthias Alleman
821d372c47 drivers: gpio: gpio_pca_series: fix unresponsive gpio_pca_series
The gpio_pca_series driver may stop responding if the gpio_int is
asserted between reading the interrupt status and clearing it.
If the interrupt gpio_int is not deasserted by the time the handler
finishes, the interrupt work should be rescheduled.

Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
2026-02-04 12:51:00 -06:00
Zacck Osiemo
690660f8f6 drivers: gpio: Introduce SC18IS606 GPIO Controller
Added a driver implementation for the GPIO Controller
on the sc18is606

Signed-off-by: Zacck Osiemo <coderv63@gmail.com>
2026-02-03 14:22:34 -06:00
Pisit Sawangvonganan
5f2d9f5e7b drivers: gpio: place API into iterable section
Add the `DEVICE_API` wrapper to the remaining `gpio_driver_api` instances,
ensuring that each driver API is placed in its respective linker section.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-01-26 12:09:59 +01:00
Pieter De Gendt
8402a4f8e5 drivers: gpio: mcux: Fix updating ICR registers without IRQ lock
During configuration the base->ICR1 or base->ICR2 register is written
without an IRQ lock. This can result in unwanted side-effects if the status
bit isn't cleared, or the edge select still needs to be updated.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2026-01-23 13:54:42 +01:00
Braeden Lane
fe9ecee97e drivers: gpio: Add Infineon PSOC 4 GPIO driver support
Add GPIO driver for Infineon PSOC 4 series MCUs using the
Infineon PDL.

Signed-off-by: Braeden Lane <Braeden.Lane@infineon.com>
2026-01-22 13:01:21 -05:00
Nhut Nguyen
e200e82909 drivers: gpio: renesas: Refactor gpio for RZ family
- Decouple interrupt settings from gpio drivers, making them configured
  and handled independently by tint and ext_irq drivers.
- Remove device-specific hardware definitions in gpio_renesas_rz.h and
  take advantage of pinctrl data type and dtsi for certain series.

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2026-01-20 13:25:13 +00:00
Bjarki Arge Andreasen
7f685ca60a drivers: gpio: nrfx_gpio: Use NRF_DT_INST_IRQ macros
Use NRF_DT_INST_IRQ_ macros which support building with and without
SW ISR table for all nordic socs.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-01-16 18:06:06 +01:00
Tom Hughes
6d7b8b6b2d drivers: gpio: max14906: Fix initialization
Found when building with clang with -Winitializer-overrides:

drivers/gpio/gpio_max14906.c:495:29: error: initializer overrides prior
initialization of this subobject [-Werror,-Winitializer-overrides]
  495 | DT_INST_FOREACH_STATUS_OKAY(GPIO_MAX14906_DEVICE)
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2026-01-16 11:38:13 +00:00
Fin Maaß
075f2e7361 drivers: gpio: litex: rework litex gpio driver
rework litex gpio driver.
It is now also supported to change direction.
now uses the reg names to detect if what modes the gpio
controller supports.
use the reg names directly from litex.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-13 17:26:08 +01:00
Woobin Song
028abf54ba drivers: gpio: tca6424a: fix race condition in port_get_raw()
Avoid overwriting cached input state while ISR-deferred work is pending.
Previously, port_get_raw() updated pins_state.input via
update_input_regs(), which could corrupt previous_state used for
transition detection.
Fix by reading input registers directly without updating the global cache.

Signed-off-by: Woobin Song <woobin.song@assaabloy.com>
2026-01-09 10:37:29 +01:00
Manojkumar Konisetty
547f1bbb11 drivers: gpio: Add Infineon PSoC4 GPIO driver
Introduces a GPIO driver that provides generic interfaces
for both interrupt-driven inputs and controllable outputs.

Signed-off-by: Manojkumar Konisetty <manoj@aerlync.com>
Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
2026-01-08 09:27:24 +01:00
Jayvik Desai
8c207308a4 drivers: gpio: emul: validate pins in single-pin APIs and mask in port APIs
Add input validation to single-pin GPIO APIs (e.g., gpio_pin_configure)
and emulator-specific helpers to return -EINVAL for invalid pins. This
ensures tests correctly fail when targeting non-existent pins.

For standard port-wide APIs (e.g., gpio_port_set_bits_raw), align behavior
with hardware drivers by masking out invalid pins instead of returning an
error. This mimics hardware behavior where writing to unimplemented bits
is ignored, and ensures compatibility with generic tests that use full
32-bit masks (e.g., 0xFFFFFFFF).

Signed-off-by: Jayvik Desai <jayvik@google.com>
2026-01-07 14:50:43 -06:00