Commit graph

1,812 commits

Author SHA1 Message Date
Stan Verschuuren
4e9285c496 drivers: gpio: max149x6: propagate SPI write errors
Several MAX14906/916/915 SPI write paths ignore MAX149xx_REG_WRITE()
return values and proceed silently after SPI write failures.

Fixed by propagating SPI write errors in the affected paths.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
373d45f554 drivers: gpio: max149x6: propagate SPI read errors
Several MAX14906/916/915 Read/ReadModifyWrite update paths use
MAX149xx_REG_READ() return values directly without validating SPI read
errors first. This leaves SPI read errors unnoticed and corrupts registers
by writing return values unconditionally.

Fixed by early returning on SPI read errors.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
de8640db7f drivers: gpio: max149x6: fix spurious error return on write
When max149x6_reg_transceive is called with rw=WRITE and rx_diag_buff=NULL,
the SPI diagnostic response byte is returned instead of 0, even though the
write was proper and successful.

Fixed by restricting the offending branch to READ only.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Sylvio Alves
99d1a8919b drivers: gpio: add esp32c5 support
Extend the ESP32 GPIO driver to support ESP32-C5 by adding the
SoC series to the register struct compatibility defines.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-19 14:53:05 -05:00
Sylvio Alves
b88407bbff drivers: gpio: fix interrupt reconfiguration race
Disable the interrupt before reconfiguring its type to prevent
spurious triggers and edge detector asymmetry. Without this, the
first gpio_pin_interrupt_configure(GPIO_INT_EDGE_BOTH) can leave
the edge detector in an inconsistent state causing a persistent
timing offset between rising and falling edge detection.

Also skip the enable call when the requested mode is disable,
avoiding a redundant enable immediately after setting the type to
GPIO_INTR_DISABLE.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-19 14:53:05 -05:00
Bert Abrath
fe0ad472cd drivers: gpio: sam: only call back when interrupt is actually enabled
ISR bits are set on input level or edge changes, regardless of whether an
interrupt is actually enabled on that line. Therefore, we check whether an
interrupt is actually enabled by masking with IMR. If we didn't do this,
some other enabled interrupt firing could also result in a callback for a
disabled interrupt.

Signed-off-by: Bert Abrath <bert.abrath@basalte.be>
2026-03-19 11:32:53 +00:00
Duy Nguyen
29d7529518 drivers: gpio: Add missing port init for RX GPIO
The RX GPIO was originally develop for RX130 MCU which only have port
0 to 5 and A to J, this commit add missing port initialize for other RX
MCU family

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2026-03-19 15:27:18 +09:00
William Markezana
d547042bf9 drivers: bflb: extend shared drivers with BL70XL SoC support
Add CONFIG_SOC_SERIES_BL70XL to preprocessor conditionals across
existing Bouffalo Lab drivers that share register-compatible code
paths with BL60x/BL70x:

- cache: L1C flush-enable workaround applies to BL70XL
- flash: XIP address defines, L1C wrap, QPI JEDEC ID support
- gpio: BL70XL includes, fix BIT() usage for pin set/clear
- i2c: clock source calculation
- serial: UART clock divider, guard UART1 (BL70XL has only UART0)
- spi: GLB address and FIFO size, clock calculation
- syscon: efuse SAHB clock selection
- input: IR receiver pin mapping and clock divider

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-03-18 17:40:26 -05:00
Jacob Wienecke
6c3b96e7df gpio: mcux_lpc: apply pinctrl in PM
Apply PINCTRL_STATE_SLEEP on suspend and PINCTRL_STATE_DEFAULT on resume
to ensure pins take on the DTS defined sleep state if one is defined.
TURN_ON already applies PINCTRL_STATE_DEFAULT (could be removed
potentially). RESUME handles the case where the device suspends without
full power-off.

Signed-off-by: Jacob Wienecke <jacob.wienecke@nxp.com>
2026-03-18 11:03:32 +09:00
Jiafei Pan
e7ad32472a drivers: gpio: rgpio: fix access protection for A-Core
For Cortex-A Core, Zephyr runs on non-secure world, the bit in PCNS
or ICNS for corresponding GPIO pin is 1, no need to clear it and
Cortex-A Core could access the corresponding pin's regitsters, so
disable this feature for Cortex-A Core.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2026-03-17 18:23:22 -04:00
Bartosz Bilas
b34e098f4f drivers: gpio: pcf857x: fix race condition in port_set_raw
The pcf857x_port_set_raw() function has a race condition where
the lock is only taken after the I2C write to update the cached
outputs_state. This allows concurrent threads to read stale
outputs_state values and compute tx_buf based on outdated data.

Since PCF8574/PCF8575 devices have a single output register that
is written atomically (all pins at once), a stale read causes one
thread's pin changes to be overwritten by another thread's write.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2026-03-16 12:20:15 +01:00
Steven Chang
802f790a4a drivers: gpio: kb106x: GPIO ports always readable
- The state of a GPIO pin can be sampled even if the output is enabled.

Signed-off-by: Steven Chang <steven@ene.com.tw>
2026-03-16 07:22:29 +01:00
Mathieu Choplain
7dc5e73f39 drivers: gpio|pinctrl: stm32: perform pin configuration in common module
The `gpio_stm32_configure()` function is used by both the GPIO and PINCTRL
drivers to configure I/O pins. Move it to the GPIO port manager module's
code so it can be shared properly and update both drivers accordingly.

With this change, the GPIO and PINCTRL drivers are completely decoupled.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Mathieu Choplain
7e18141046 drivers: gpio|pinctrl: stm32: introduce common module for device mgmt
On STM32 hardware, the GPIO port's MMIO interface is used for two purposes
which have their own separate Zephyr API: controlling the state of digital
I/O pins directly (GPIO API) and configuring I/O pins for a specific usage
(PINCTRL API). Historically, this was handled by having the PINCTRL driver
call inside the GPIO driver which works but creates a dependency loop.

Introduce a new `GPIO port manager` module in SoC-specific common code that
takes over various from the existing GPIO/PINCTRL drivers: GPIO port device
instantiation and `GPIO port index -> device` mapping respectively.

Modify the GPIO and PINCTRL drivers to make use of this GPIO port manager
module - a first step in decoupling both drivers from each other.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Mathieu Choplain
13442977f4 drivers: gpio: stm32: move pinnum-to-LL-value helper to shared header
Move the helper function which computes the LL pin value from a pin number
to the <stm32_gpio_shared.h> header as this function can be useful for
modules other than the GPIO driver.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Mathieu Choplain
a6315d8332 drivers: gpio: stm32: move ports list to shared SoC-level header
Move the ports list from the GPIO driver to a shared SoC-specific header.
This will allow reuse from other drivers such as pinctrl.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Mathieu Choplain
8e07d72a52 drivers: gpio: stm32: inline gpio_stm32_clock_request
The function is only used from the device's PM action and is very trivial.
Inline it inside gpio_stm32_pm_action to simplify the driver.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Mathieu Choplain
6e42b8ef61 dts: bindings: stm32*-pinctrl: move definitions to SoC pinctrl header
The STM32 pinctrl dt-bindings headers were full of definitions used by the
SoC-specific pinctrl header (<pinctrl_soc.h>) rather than from Devicetree.

Move these definitions to the appropriate header. While at it, include the
<pinctrl_soc.h> header from GPIO driver instead of series-specific pinctrl
header since it uses these definitions.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-03-13 14:27:30 -07:00
Sylvio Alves
c64a74e711 espressif: adapt to hal_espressif IDF master sync
Adapt all Espressif SoC and driver code to the updated
hal_espressif module synced with IDF master branch.

Main changes:
- clock control: delegate peripheral clock gating to HAL
  layer using new clock/reset APIs
- SPI/GDMA: adapt to restructured DMA HAL with new channel
  allocation and configuration interfaces
- ethernet: add RMII clock configuration and PHY management
- GPIO: simplify using direct HAL function calls
- flash: adapt to updated SPI flash HAL interfaces
- linker scripts: update IRAM/DRAM mappings for new HAL
  object files
- DTS: fix ESP32-S2 PSRAM dcache1 address to match actual
  MMU mapping region (0x3f800000 DRAM1 instead of 0x3f500000
  DPORT which lacks 8-bit access capability)
- west.yml: update hal_espressif revision

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-03-13 11:38:18 +01:00
John Lin
b4332e55fd drivers: gpio: add Infineon CYW43 GPIO driver
Add a GPIO driver for the Infineon CYW43439 WiFi chip that exposes
WL_GPIO0-2 as standard Zephyr GPIO pins. Pin 0 is the onboard LED
on Raspberry Pi Pico W and Pico 2 W boards.

The GPIO node is a child of the AIROC WiFi device node in the
devicetree. GPIO control is performed via the WHD gpioout iovar,
serialized with a mutex. A shadow register tracks pin state since
the CYW43439 does not support GPIO readback.

Signed-off-by: John Lin <mcjelcom@gmail.com>
2026-03-11 20:53:08 -04:00
Krzysztof Chruściński
16efc6c909 modules: hal_nordic: nrfx: Cleanup GPIOTE Kconfigs
Remove instance specific Kconfigs (CONFIG_NRFX_GPIOTEx) as they are no
longer used. Cleanup in all places.

Add prompt to CONFIG_NRFX_GPIOTE to allow enabling the driver.

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-03-11 17:53:23 +00:00
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