Commit graph

1,812 commits

Author SHA1 Message Date
Raffael Rostagno
2a0650072e drivers: gpio: esp32: Handle GPIO_INT_WAKEUP in pin_interrupt_configure
The GPIO subsystem forwards GPIO_INT_WAKEUP from dt_flags into the trig
argument of pin_interrupt_configure(). Wakeup source configuration is
already handled in gpio_esp32_config(); strip the bit before passing trig
to convert_int_type() to avoid -EINVAL return.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-05-29 07:45:26 +02:00
Alain Volmat
d0a08f6cb7 drivers: gpio: mfxstm32l152: add BOTH EDGE trigger support
The MFX does not natively support BOTH direction edge
detection. In order to support it, adapt the requested edge
depending on the level at configuration time and toggle the
edge whenever an interrupt is received.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2026-05-29 07:36:55 +02:00
Alain Volmat
d9a32d3395 drivers: gpio: mfxstm32l152: correct PU/PD handling
So far the driver was setting the PU/PD bit properly however
missed setting another bit indicating of a Pull-Down or Pull-Up
are necessary.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2026-05-29 07:36:55 +02:00
Alain Volmat
a51f00c81a drivers: gpio: mfxstm32l152: simplify PUPD/Direction handling
Simplify the way bit handling for direction and PullUp/PullDown
control is done.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2026-05-29 07:36:55 +02:00
Bjarki Arge Andreasen
18fef60e35 drivers: gpio: handlers: remove redundant cast to struct device *
Remove the redundant cast to struct device * from struct device * in
some of the GPIO API syscall handlers in gpio_handlers.c

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-05-29 07:35:53 +02:00
Bjarki Arge Andreasen
02657c2971 include: drivers: gpio: make gpio_pin_* APIs syscalls
The following APIs

  - gpio_port_set_masked()
  - gpio_port_set_bits()
  - gpio_port_clear_bits()
  - gpio_port_set_clr_bits_raw()
  - gpio_port_set_clr_bits()
  - gpio_pin_get_raw()
  - gpio_pin_get()
  - gpio_pin_set_raw()
  - gpio_pin_set()
  - gpio_pin_toggle()

are currently not syscalls, while the following are:

  - gpio_port_set_bits_raw()
  - gpio_port_get_raw()

It is therefore possible to set and get any pin of the entire port
from userspace, but only through a few of the APIs.

These APIs should all be either syscalls, or not syscalls.

Align the APIs so they are all syscalls and add syscall handlers for
them in gpio_handler.c

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-05-29 07:35:53 +02:00
Daniel Schultz
aca1beaa5b drivers: gpio: aesc: Add pinctrl
Apply pinctrl settings during the init function.

Signed-off-by: Daniel Schultz <dnltz@aesc-silicon.de>
2026-05-27 08:34:52 +02:00
cyliang tw
dc5f98e241 drivers: pinctrl & gpio: modify numaker driver for m031x support
Modify gpio_numaker.c & pinctrl_numaker.c for SOC_SERIES_M031X support.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2026-05-25 18:18:15 +02:00
Yuzhuo Liu
ef185cbe6a drivers: gpio: fix bee gpio direction detection
The GPIO_DDR register uses 1 for output mode and 0 for input mode.
The previous implementation incorrectly swapped these values, causing
gpio_pin_is_input() and gpio_pin_is_output() to return wrong results.

Also mask out unconnected pins using connect_pin to ensure
disconnected GPIOs are not reported as either input or output.

Fixes gpio_get_direction test failures on RTL87x2G and RTL8752H series.

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-05-24 18:35:47 -07:00
Zhaoxiang Jin
afefde1f80 gpio: mcux: add reset controller support
add reset controller support

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-22 18:23:27 +02:00
Zhaoxiang Jin
f488ca84c7 gpio: mcux: enable clocks from devicetree
Use the optional clocks property to request the GPIO port clock
during driver initialization.

This lets RT7xx GPIO instances rely on the common clock control
path instead of board-specific clock enabling.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-05-22 18:23:27 +02:00
Paolo Wattebled
42a6663502 drivers: gpio: mcux_igpio: fix flags typo
Fix a typo in mcux_igpio_configure() for CONFIG_SOC_MIMX8MQ6_M4
where `flag` was used instead of `flags` when checking
GPIO_PULL_DOWN.

Signed-off-by: Paolo Wattebled <paolo.wattebled@savoirfairelinux.com>
2026-05-18 18:40:45 +02:00
Carlo Caione
6084fe8903 drivers: gpio: add PI4IOE5V6408 driver
Add a driver for the Diodes/Pericom PI4IOE5V6408 8-bit I2C-bus I/O
expander.

The chip provides eight independently configurable GPIO lines, each
with optional pull-up or pull-down resistor and an interrupt source
that fires on transitions away from a programmable default state.

Link: https://www.diodes.com/datasheet/download/PI4IOE5V6408.pdf

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-05-18 15:20:20 +01:00
Andrej Butok
12a0137b3a drivers: gpio: nxp: mcux_rgpio: fix mcux_rgpio_configure()
- Enables input buffer via Software Input On (SION)
  to get correct pin value in PDIR for both input/output pins
  for IMXRT118X.
- Issue has been discovered during Safety DIO self-tests.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-05-14 21:55:44 +02:00
Michał Stasiak
eaa479eace driver: gpio_nrfx: Remove config option for latch detection
Coming with nrfx 4.3, NRF_GPIO_HAS_DETECTMODE is now
defned only when it is actually accessible.
Removed the hidden Kconfig option and used
nrfx symbol only.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2026-05-14 15:16:07 +02:00
Davide Di Lello
82741b2614 drivers: infineon: Update copyright for Infineon
Update structure of the copyright

Signed-off-by: Davide Di Lello <Davide.Dilello@Infineon.com>
2026-05-12 22:19:02 +02:00
Zhaoming Li
64f5fabf2a drivers: gpio: add MMIO latch GPIO driver
Add a generic GPIO driver for a memory-mapped output latch register.

Include the driver implementation and devicetree binding.
Also add the required Kconfig and CMake integration.

Signed-off-by: Zhaoming Li <lizhaoming634@gmail.com>
2026-05-11 21:03:38 -05:00
Michał Stasiak
b530448c2c drivers: gpio: disable latch detection for nRF92 series
Latch detection is not supported on nRF92 GPIO driver.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2026-05-11 15:29:14 +01:00
Michał Stasiak
cf79aa7c90 drivers: gpio: gpio_nrfx: Add support for latch detection
Added latch detection mode based on DTS property.
Required register is inaccessible in non-secure
builds and on nRF54H20 SoC. Added hidden Kconfig
to guard it.

Signed-off-by: Michał Stasiak <michal.stasiak@nordicsemi.no>
2026-05-11 15:29:14 +01:00
Sergei Ovchinnikov
5d62f0f3d0 drivers: gpio: npm10xx GPIO driver
Nordic's nPM10 Series PMICs' GPIO driver and Devicetree bindings

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2026-05-08 06:49:40 -05:00
Ren Chen
ddba70043d soc: ite: ec: extend irq number size to 16-bit
Next-generation it51xxx SoCs support more than 256 irqs.
This change extends irq range up to 16 bit depend on
CONFIG_NUM_IRQS.

And the it8xxx2 SoC series only supports 8-bit irq
number size. Add irq type check assertion for this
series.

Tested with:
- it82xx2_evb/it8xxx2_evb/it51xxx_evb_it51526aw:
  tests/drivers/gpio/gpio_basic_api
- native_sim/native:
  tests/drivers/gpio/gpio_ite_it8xxx2_v2

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-05-07 09:23:06 +02:00
Ayush Singh
c483b2aaae gpio: mspm0: Add MSPM0L110x support
- As described in datasheet, MSPM0L110x has 28 pins in GPIOA.
- Also, it does not contain GPIOB and GPIOC.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-05-06 19:57:20 +02:00
Lay Desai
24cb0d8055 drivers: gpio: pca_series: Allow disabling automatic reset
The PCA series GPIO driver was updated to allow disabling automatic
reset. This feature would enable GPIO expander ports to retain states
which could be helpful for situations where certain pins are configured
in the bootloader and their states need to be retained when switching to
application code.

Signed-off-by: Lay Desai <lay.desai@he360.com>
2026-05-06 07:06:39 +02:00
Martin Hoff
4503dab4a5 drivers: gpio: siwx91x: enable uulp gpio wakeup interrupt feature
This patch handles UULP GPIO configuration when the GPIO_INT_WAKEUP
flag is set. It allows the interrupt to wake the device from deep sleep.
The code has been tested by configuring UULP GPIO 2 (button_0) as a
wakeup interrupt on the siwx91x_rb4338a board.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2026-04-29 06:25:46 -05:00
William Markezana
2b7f32de58 drivers: share BL61x drivers with BL808
Rename BL61x GPIO and pinctrl drivers to bl61x_808 variants since
BL808 shares identical register layouts. Update compatible strings,
Kconfig, CMakeLists, and BL61x device tree accordingly. Extend the
DMA and IR receiver drivers' BL61x guards to also cover BL808.

Signed-off-by: William Markezana <william.markezana@gmail.com>
2026-04-28 00:25:43 +01:00
Mathieu Choplain
f4612856e3 drivers: pinctrl: stm32: rework format of pinctrl_soc_pin_t type
The `pinctrl_soc_pin_t` format occupied two uint32_t even though all info
it stores can be compressed in 32 bits only, and also didn't map very well
to the hardware (especially on STM32F1). Due to defects, the format was
also NOT what the `stm32_gpioport_configure_pin()` function consumed to
actually configure a GPIO port, requiring additional decoding/manipulation
logic.

Introduce a vastly reworked format which only requires 32-bit per pinctrl
entry and maps nicely to hardware and becomes the new format consumed by
stm32_gpioport_configure_pin(). This heavily simplifies the pinctrl driver
since it no longer needs to examine the actual values (except to determine
the target GPIO port and pin - this is done on purpose!). The GPIO driver
converts Zephyr flags to this new format too.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-04-27 14:24:18 +02:00
Mathieu Choplain
998c600dc5 drivers: gpio: stm32: handle GP OUT with PU/PD more cleanly on STM32F1
Instead of silently ignoring the flags, warn the user when an illegal
GPIO configuration is provided on STM32F1. To avoid breaking backwards
compatibility and tests, the old behavior is however retained.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-04-27 14:24:18 +02:00
Mathieu Choplain
af45174c96 drivers: gpio: stm32: simplify flag translation logic
Simplify the logic translating Zephyr GPIO flags into STM32-specific flags:
- flatten if chain for output type determination
- change how input modes are handled
    - introduce new INPUT_FLOAT/INPUT_PUPD pincfg values which are used for
      input mode depending on whether or not user requests pull-up/down
    - these values can have the PULL_UP / PULL_DOWN OR'ed into them
- share PU/PD decoding between INPUT and OUTPUT mode

While at it, also return -ENOTSUP to caller if attempting to set a pull-up
or pull-down on a disabled pin instead of silently discarding the request.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-04-27 14:24:18 +02:00
Mathieu Choplain
50aae9065d drivers: pinctrl: stm32: apply GP output level from common code
Move the logic which sets the output level based on configuration to the
common `stm32_gpioport_configure_pin()` function to reduce duplication.
To support the GPIO use case where a pin's configuration is changed without
modifying its output state, a new parameter is introduced which specifies
whether or not the output level should be modified.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-04-27 14:24:18 +02:00
Muhammad Waleed Badar
ff5fec7364 drivers: gpio: dw: add port_get_direction API support
Add support for retrieving GPIO pin direction
when GPIO_GET_DIRECTION kconfig is enabled.

Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
2026-04-22 12:54:22 +02:00
Muhammad Waleed Badar
23abcfe5c9 drivers: gpio: dw: add reset controller support
Add support for toggling a reset line during GPIO
initialization when a reset controller is available
in the device tree.

Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
2026-04-22 12:54:22 +02:00
Muhammad Waleed Badar
790b6242fc drivers: gpio: dw: use MMIO macros to access hw registers
Replace direct register access using raw base addresses with
MMIO accessors to align with Zephyr DEVICE_MMIO API.

Use mem_addr_t for the base address and ensures compatibility with
architectures.

Signed-off-by: Muhammad Waleed Badar <muhammadx.waleedbadar@altera.com>
2026-04-22 12:54:22 +02:00
Rick Tsao
f36a432ac1 drivers: gpio: atcgpio100: add pull-up/pull-down support
Add support for internal pull-up and pull-down configuration.

Signed-off-by: Rick Tsao <rick592@andestech.com>
2026-04-22 10:07:50 +02:00
Yuzhuo Liu
d7c5fb5290 drivers: gpio: bee: return -ENOTSUP for simultaneous input/output
Realtek Bee series GPIO does not support configuring a pin as both
input and output simultaneously. Return -ENOTSUP to skip related
test cases.

Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
2026-04-15 05:42:52 -04:00
Ren Chen
5f455612de drivers: gpio: it51xxx: add port_get_direction support
Add support for retrieving the direction of selected GPIO
pins. The it51xxx SoC does not support a combined
input-output mode, so return -ENOTSUP when such that mode
is requested.

Tested with:
- tests/drivers/gpio/gpio_hogs
- tests/drivers/gpio/gpio_get_direction

Signed-off-by: Ren Chen <Ren.Chen@ite.com.tw>
2026-04-15 05:40:40 -04:00
Matin Lotfaliei
68398e706b drivers: gpio: esp32: fix BIT overflow for pins >= 32
gpio_pin_is_valid() and gpio_pin_is_output_capable() use BIT() which
expands to (1UL << n). On 32-bit Xtensa targets, unsigned long is
32 bits, so BIT(n) for n >= 32 is undefined behavior.

This causes gpio1 pins (GPIO32+) to always fail validation with
-EINVAL, breaking any peripheral connected to GPIO32-GPIO48 on
ESP32-S3 (and similar ESP32 variants with gpio1).

Fix by using BIT64() which correctly handles pin numbers >= 32
since SOC_GPIO_VALID_GPIO_MASK is already a 64-bit value.

Signed-off-by: Matin Lotfaliei <matinlotfali@gmail.com>
2026-04-14 22:31:46 -04:00
Fabian Kainka
218484b36b drivers: gpio: pca_series: fix GPIO_DISCONNECTED as not supported
Configuring a pin with GPIO_DISCONNECTED currently
results in the pin being set as output due to a
fallthrough in the code. This is not supported by
the driver and should return -ENOTSUP instead.

This commit ensures that configuring GPIO_DISCONNECTED
is explicitly rejected and not applied to the hardware.

Signed-off-by: Fabian Kainka <f.kainka@gmx.de>
2026-04-01 09:09:57 -05:00
Pisit Sawangvonganan
edae0e7e30 drivers: fix typo in (ethernet, flash, fpga, fuel_gauge, gpio, i2c)
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/ethernet`
- `drivers/flash`
- `drivers/fpga`
- `drivers/fuel_gauge`
- `drivers/gpio`
- `drivers/i2c`

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2026-03-27 20:21:24 -04:00
Camille BAUD
1eb897d206 drivers: gpio: Fix and extend GPIO irqs for BL70xL
Configuration per reg was wrong, also it supports both edges.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-03-25 07:56:19 -04:00
Fabian Blatz
c12245ce61 drivers: gpio: grgpio2: Initialize polmask always
Ensure the polmask variable is always initialized.

Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
2026-03-25 07:55:49 -04:00
Raffael Rostagno
d1637e3401 drivers: gpio: esp32: Low power management
Add hardware and software strategies to switch pins to low power
mode both in light and deep sleep. Add hold feature to device tree
flags to allow application to configure which pins will be
automatically held (pin state preserved) during sleep.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-03-24 09:05:47 -04:00
Hau Ho
02e2bd37d0 drivers: gpio: Fix GPIO device init list for all ports
Add missing GPIO_DEVICE_INIT_RX_IF_OKAY()

Signed-off-by: Hau Ho <hau.ho.xc@bp.renesas.com>
2026-03-23 10:16:41 +01:00
Stan Verschuuren
a5b1724903 drivers: gpio: max14906: fix swapped config_do/config_di types
The max149x6_config struct declared config_do/config_di with swapped
names, inverting semantics. Both fields are not yet used by the driver,
which is likely the reason why this went unnoticed.

Fixed by assigning each field its matching config union type.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
5bd971d97b drivers: gpio: max14916: parse write faults on all channels
max14916_pars_spi_diag() wrongly uses same mask as for MAX14906. On
4 channel MAX14906 SDO byte1 upper nibble is DoiLevel bits. On 8 channel
MAX14916, those are fault bits for channels 5-8.

Fixed by checking the full fault byte in the MAX14916 diagnostic parser.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
5b61544014 drivers: gpio: max14916: wire channel-enable DT properties
MAX14916/915 defines GPIO channel specific DT properties, but the driver
does not apply them at init and programs zero values instead. Secondly, the
build test overlay for MAX14916 only sets 4 channels out of 8.

Fixed by initializing OW-on, OW-off, and short-to-VDD from DT during
config and setting the correct channel count in the test overlay.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
19031fcc4b drivers: gpio: max14916: fix ow_on_en written to wrong register
gpio_max14916_config_diag() writes ow_on_en to wrong register
(OW_OFF_EN_REG instead of OW_ON_EN_REG).

Fixed by writing to correct register.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
7bcb55f1f0 drivers: gpio: max149x6: harmonize diagnostic helper error handling
MAX14906/916 diagnostic helpers handle error propagation differently
across diag_chan_get(), pars_spi_diag(), and reg_trans_spi_diag(). This
creates asymmetry in parser/wrapper flows.

Additionally, the parser overwrites transport errors, obfuscating their
source.

Fixed by aligning helpers to standard errno-style return semantics and
failing fast consistently, propagating nested transport errors.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
6734317755 drivers: gpio: max149x6: clear stale diagnostic channel caches
Both MAX14906/916 diag_chan_get paths keep previously cached channel fault
values when the corresponding interrupt bits are not set in later calls.
This leaves stale fault data such that diag_chan_get keeps reporting faults
after they have cleared.

Fixed by clearing fault caches before updating them from current interrupt
status.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
91e76ab2b9 drivers: gpio: max149x6: preserve parser fault status
Both MAX14906/916 pars_spi_diag paths can lose an captured FAULT1 error
when diag_chan_get() returns 0.

Fixed by only updating the parser return status when diag_chan_get()
returns nonzero.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00
Stan Verschuuren
a82ebd31ed drivers: gpio: max149x6: propagate config path errors
max14906_ch_func(), gpio_max14906_config(), and gpio_max14916_config()
ignore return values from lower level register update/write helpers.

This leads to reports of successful pin configuration even when SPI
transactions fail.

Fixed by propagating the first error (effectively forwarding SPI errors)
to the caller, with no behaviour change in success path.

Signed-off-by: Stan Verschuuren <stverschuuren@gmail.com>
2026-03-21 00:48:23 +00:00