Commit graph zephyr/drivers/gpio
Author SHA1 Message Date
Bill Waters
8f58829f20 drivers: gpio: infineon: use input-buffer-off PDL drive modes
Program the CY_GPIO_DM_*_IN_OFF drive-mode variants and enable the input
buffer only when GPIO_INPUT is requested. The input-buffer control bit
(bit 3) is set on CAT1 and cleared on CAT2/PSoC4, so a pure output now
reads back without GPIO_INPUT and configure() stays consistent with the
pin_get_config() readback.

Apply the same input-buffer-off single-ended drive modes in gpio_psoc6,
rejecting the pull-up/pull-down combinations the open-drain and
open-source modes cannot represent.

Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
2026-08-26 18:09:24 -07:00
Silesh C V
6fafde9ada drivers: gpio: dw: add pinctrl support
On SoCs that route the DesignWare GPIO signals through a pin
controller, the pins must be muxed to their GPIO function before
the controller can drive them. Add an optional "default" pinctrl
state to the binding and apply it during initialization. Everything
is conditional on at least one enabled instance having a pinctrl-0
property, so existing users that do not describe pin muxing are
unaffected.

Signed-off-by: Aravind Krishnan <aravind.krishnan@alifsemi.com>
Signed-off-by: Silesh C V <silesh@alifsemi.com>
2026-08-24 18:41:36 +02:00
Tahsin Mutlugun
e9c68b152b soc: adi: max32: Support GPIO wake-up from backup mode
Manually trigger GPIO_IRQn after waking up from backup mode. Do not
disable retention ldo after waking up from backup mode as it causes
resets in standby mode.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2026-08-21 13:40:27 -07:00
Sadik Ozer
304983556d drivers: gpio: max32: Add gpio wakeup option
Any gpio can be used to wakeup device from sleep/deepsleep modes
This commit add this feature inside driver.

Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2026-08-21 13:40:27 -07:00
Darcy Lu
9bf18f4390 drivers: gpio: add GPIO driver for RTS5817
Add GPIO controller driver for RTS5817

Signed-off-by: Darcy Lu <darcy_lu@realsil.com.cn>
2026-08-21 13:35:06 -07:00
Bjarki Arge Andreasen
6f7d00ee20 gpio: nrf: implement gpiohspadctrl for nrf54l
The nrf54l has high speed pad ctrl (slew rate) of the fast GPIO port
(P2), configurable through registers sharing the address space of the
GPIO port.

Extend the nordic,nrf-gpio devicetree binding with a property
indicating if hspadctrl is available for a port, and add an optional
property for setting the optional HSBIAS value of the GPIOHSPADCTRL
BIAS register. The datasheet recommends always setting HSBIAS to its
highest value (3), which will now be set by the nrf gpio device
driver on init, unless the user specifies otherwise in the
devicetree.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2026-08-21 16:09:04 +02:00
Benjamin Cabé
d97541ecf2 drivers: gpio: add VIRTIO GPIO driver
Add a driver for the VIRTIO GPIO device (virtio spec 1.3, section 5.18),
letting a Zephyr guest drive GPIO lines exposed by a hypervisor or a
vhost-user backend.

The number of lines is read from the device configuration space at init,
and interrupts use the event virtqueue when the device offers
VIRTIO_GPIO_F_IRQ. Every operation is a round trip to the device, so the
GPIO API can only be used from a thread.

Assisted-by: Claude Code:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 18:40:12 -04:00
Marvin Gnad
adfe1dc581 drivers: gpio: mcux_igpio: serialize DR and GDIR read-modify-writes
The port writers update the data register with an unlocked read-modify-
write. port_set_masked_raw() reads and writes DR directly, and on parts
without the DR_SET/DR_CLEAR/DR_TOGGLE aliases the HAL degrades
GPIO_PortSet/Clear/Toggle() to "DR |= mask" and friends. Pin
configuration is affected too: GPIO_PinWrite() falls back the same way,
and the GDIR update is a read-modify-write on every part.

Two contexts touching different pins of the same port therefore race:
each reads the register, changes its own bits and writes the whole value
back, so the last writer reverts the other's pin.

Serialize the accesses with a spinlock, which unlike irq_lock() also
covers a concurrent write from another CPU on an SMP build. The lock
cannot be limited to the parts that lack the set/clear aliases, because
port_set_masked_raw() read-modify-writes DR everywhere: an atomic DR_SET
from another context would still be clobbered by it.

While here, use GPIO_PinWrite() instead of the deprecated
GPIO_WritePinOutput() wrapper.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Marvin Gnad <marvin.gnad@gmail.com>
2026-08-19 17:10:54 +01:00
Fin Maaß
f9305cb819 drivers: gpio: silabs: use DT_INST_FOREACH_STATUS_OKAY
use DT_INST_FOREACH_STATUS_OKAY for the
ports instead of
DT_INST_FOREACH_CHILD_STATUS_OKAY.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
f5ff367644 drivers: gpio: cypress: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
34758b515b drivers: gpio: infineon: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
766fcbb06e drivers: gpio: efinix: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
9afa6a47e7 drivers: gpio: gecko: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
b23c8fe9b7 drivers: gpio: ite: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
dfdef06f45 drivers: gpio: max22190: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
9936afff2b drivers: gpio: max14917: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
29a17f1b18 drivers: gpio: nxp: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
4ed42fea6b drivers: gpio: sedi: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
9d1e5c2082 drivers: gpio: stmpe1600: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
e1f047842a drivers: gpio: renesas: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
6d3e211210 drivers: gpio: rt1718s: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
945beb4a83 drivers: gpio: si32: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
9066212c03 drivers: gpio: mfxstm32l152: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
8101477de3 drivers: gpio: nuvoton: use GPIO_COMMON_CONFIG_FROM_DT_INST
use GPIO_COMMON_CONFIG_FROM_DT_INST

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Fin Maaß
4ad8541198 drivers: gpio: sy1xx: add the mandatory common structs
gpio drivers need to have struct gpio_driver_config and
struct gpio_driver_data at the first position of the data
and config struct.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-18 19:07:16 +01:00
Aksel Skauge Mellbye
f6d41635f0 drivers: gpio: silabs: Support not having EM4 wakeup on all ports
The implementation of EM4 wakeup pin support assumed all ports
have at least one EM4WU capable pin. Support the case where
EM4WU pins may not be available on every port.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-17 16:30:37 -04:00
Mathieu Choplain
94d4dbfd5a soc: st: stm32: drop the old wake-up pins driver
Now that all series (with wake-up pins) have been migrated to the new
binding, drop the old driver.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-08-12 19:24:53 -04:00
Mathieu Choplain
971ddd1f51 soc: st: stm32: common: add new driver for wake-up pins/lines management
Add a new STM32 SoC-specific driver for management of wake-up pins at
Power Controller level. The more generic terminology "wake-up lines" is
used for consistency across all series, but the driver currently focuses
only on wake-up lines connected to GPIO pins. This driver is designed to
handle nodes with the new `st,stm32-pwr-wkupctrl` compatible as well as
derivatives (`st,stm32f1-pwr-wkupctrl` and `st,stm32f7-pwr-wkupctrl`).

The old driver is retained for backward compatibility; selection is done
automatically based on whether a node with the new compatible is present
and active in the Devicetree or not.

While at it, also update the STM32 GPIO driver to use the new driver
when appropriate by introducing a new (private) API. The old driver is
considered as deprecated and will be removed in a future commit.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-08-12 19:24:53 -04:00
Oliver Schmidhauser
703a676388 drivers: gpio: add TCA9554 driver
Adds a driver for the TI TCA9554 8-Bit SMBus I/O expander.

Signed-off-by: Oliver Schmidhauser <oliver.schmidhauser@leica-geosystems.com>
2026-08-10 11:36:53 -07:00
Lucien Zhao
15d75c5634 drivers: gpio: mcux_igpio: fix pinmux lookup for non-contiguous layouts
The pue_mux register layout check indexed the pinmux array with the
raw pin number, while all other accesses use the gap-compensated
cfg_idx. On a port with gpio-reserved-ranges and a compacted pinmux
map this reads the wrong entry, or past the end of the array.

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2026-08-10 07:10:41 -07:00
Jason Yu
92361ede1e drivers: gpio: gpio_mcux: exclude disconnected pins from direction query
The patch ad42613252 added GPIO_DISCONNECTED support
for gpio_mcux_port_configure, but port_get_direction was not updated
accordingly.

port_get_direction() only checks PDDR to determine pin direction,
so a disconnected pin (PDDR cleared) is incorrectly reported as an
input. This causes the gpio_get_direction.test_disconnect test to
fail on boards using the PORT-based gpio_mcux driver.

Check PORT PCR and PDDR state to identify disconnected pins and
exclude them from direction results, so they are reported as
neither input nor output per the Zephyr GPIO API contract.

Fixes: #114432

Assisted-by: Claude:opus-4.6
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2026-08-06 14:33:22 +02:00
Liam Ogletree
026bdb2003 drivers: gpio: Unify runtime PM log messages
Propagates #113545 to GPIO drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:26:47 +02:00
Tiago Medicci
19143c7d22 drivers: gpio: esp32: esp32h2: share GPIO IRQ line with ana_cmpr
On ESP32-H2, the analog comparator (ana_cmpr) unit shares its
interrupt source (GPIO_INTR_SOURCE) with the GPIO peripheral, but uses
its own separate status/enable/clear registers (GPIO_EXT.*). Register
the GPIO driver's own interrupt via esp_intr_alloc_intrstatus() with
ESP_INTR_FLAG_SHARED, scoped to the GPIO status register/mask, so both
drivers can coexist on the same line independently.

Only takes effect when the new ana_cmpr driver is enabled, so this is
a no-op otherwise.

Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
2026-08-03 15:03:02 -04:00
Tiago Medicci
8c1998b488 drivers: gpio: esp32: format file with clang-format
This commit just formats drivers/gpio/gpio_esp32.c with the
clang-format tool.

Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
2026-08-03 15:03:02 -04:00
Elie Carrot
0c8714fb67 drivers: gpio: add WCH CH5xx GPIO driver support
Add GPIO driver support for the CH5xx series with the required bindings.
This enables the blinky sample to run by default, and the basic/button
sample when a device tree overlay is provided.

Signed-off-by: Elie Carrot <elie.carrot@smile.fr>
2026-08-03 15:00:06 -04:00
Johnny Chuang
a74f7ee65a drivers: gpio: Add GPIO driver for ELAN EM32 series
Add the initial GPIO driver support for the ELAN EM32 SoC family.
The driver provides basic GPIO input/output control, pin configuration,
and interrupt handling. Device instances are created from devicetree.

Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
2026-07-28 12:28:40 -07:00
Liu Changjie
16405ef6d9 soc: wch: add CH32H41X series (CH32H417 dual-core)
Add the CH32H41X SoC series under the ch32v family. The CH32H417 is
an asymmetric dual-core (AMP) RISC-V part with a QingKe V3F boot
core and a QingKe V5F application core.

Model the two cores as cpuclusters with separate CPU descriptions,
runtime-idle power states, interrupt entry, vector handling, and
non-overlapping memory. Keep the external HSE frequency
board-specific.

The optional SOC_CH32H417_BOOT_V5F setting lets the V3F early-init
hook wake the V5F image at its real flash address, 0x08010000, while
allowing standalone V3F applications to disable that behavior.

Signed-off-by: Liu Changjie <liucj1228@outlook.com>
2026-07-27 11:36:23 -07:00
Ayush Singh
095ec75a76 drivers: gpio: mspm0: Add MSPM0L1117 support
- Some of the lut values are missing in the datasheet. In these places,
  use UINT8_MAX to denote that this pin does not support being used as
  GPIO.
- Tested using blinky sample in beagleconnect_zepto.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2026-07-26 16:55:53 +02:00
Flavio Ceolin
28fac2e862 drivers: gpio: combine OR'd flag bitmask checks
(flags & A) || (flags & B) is equivalent to flags & (A | B). Collapse
the pull-up/pull-down, output-init, and input/output bias tests into a
single masked check.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-07-25 11:54:45 -07:00
Benjamin Cabé
47dc88536d drivers: gpio: b91: Fix bit index for GPIO function enable
WRITE_BIT takes a bit index but was passed BIT(pin), applying the
GPIO-function enable to the wrong bit. Pass the pin index.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-25 17:09:17 +02:00
Raffael Rostagno
99e635ace5 drivers: gpio: esp32: Fix deep_sleep current on first cycle
LP IO wakeup sampling needs the independent LP IO clock enabled
when programming pin wakeup. Without it, the first deep sleep
cycle can draw excess current until sleep prepare force-enables
the clock. Enable/disable the clock with EXT1/GPIO wakeup setup.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2026-07-23 13:47:07 -05:00
Benjamin Cabé
5a0f490e5b drivers: gpio: mcux_rgpio: Fix pinmux copy size
The memcpy used sizeof(pin_cfg), reading a whole pinctrl_soc_pin from
a single pinmux array element and past the end for the last pin. Use
sizeof(pin_cfg.pinmux).

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 11:11:20 +01:00
Benjamin Cabé
a74c96af99 drivers: gpio: adp5585: Configure input pins as inputs
The GPIO_INPUT branch wrote adp5585_pin_output into the direction
register, so pins requested as inputs were driven as outputs.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-07-22 11:07:15 +01:00
Leonardo José Consoni
ad42613252 drivers: gpio: gpio_mcux: support GPIO_DISCONNECTED in PORT variant
The PORT-based gpio_mcux_port_configure() rejects any configuration
that sets neither GPIO_INPUT nor GPIO_OUTPUT with -ENOTSUP. This makes
it impossible to release a pin with gpio_pin_configure(dev, pin,
GPIO_DISCONNECTED), which applications such as debug probes and
programmers need in order to tri-state shared target pins (SWD, ICSP,
UPDI) when a protocol is deactivated.

Handle GPIO_DISCONNECTED by clearing the pin's direction bit in PDDR
and setting the PCR MUX field to 0 (pin disabled / Alternative 0),
disconnecting the pin from the GPIO module. This also disables the
digital input buffer (cleared explicitly via IBE on parts that have
it), so the released pad is high impedance and draws no current when
left floating.

Signed-off-by: Leonardo José Consoni <leonardo@binho.io>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 10:45:44 -04:00
Mathieu Choplain
b3fa989bbb include: drivers: misc: stm32_wkup_pins: make the API private
This API was never intended to be "public" in the sense now documented
in the Glossary, as said in 559c72d7a6:
  "Introduce public functions for GPIO pins configuration [...]  in
   stm32 drivers & routines such gpio_stm32 & poweroff."

Remove the header from the public API directory and move the definitions
to a private header in SoC-specific includes. Update all previous users
of the header (which are as expected only those documented in the commit
message quoted above: gpio_stm32 and SoC poweroff.c).

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-07-15 19:03:02 -04:00
Alberto Escolar Piedras
4b2a0898ad drivers: gpio: tla2528: Remove double const
DEVICE_API already includes const, with another const,
clang warns us about the double specifier.

Remove it to avoid the warning.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2026-07-14 17:57:24 +02:00
Oliver Schmidhauser
e72986dc95 drivers: adc, gpio, mfd: add TLA2528 driver
Adds support for the TI TLA2528 I2C ADC with GPIOs.
The TLA2528 is a 12-bit 8-channel ADC, where each channel can also be
configured as a GPIO in- or output in push-pull or open-drain.

Signed-off-by: Oliver Schmidhauser <oliver.schmidhauser@leica-geosystems.com>
2026-07-14 09:56:45 -04:00
CHEN Xing
c6da46432a drivers: gpio: mchp: sam_pio4: fix gpio_sam_port_toggle_bits()
Fix gpio_sam_port_toggle_bits() and gpio_sam_port_set_masked_raw()
PIO_MSKR need to be set before configure PIO_ODSR.

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
2026-07-12 20:00:17 -04:00
Camille BAUD
a0473c3a2f drivers: bflb: extend shared drivers with BL616CL support
Add support for BL616CL in shared drivers

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-07-08 10:01:48 +02:00
Khai Do
c5ba1c9559 drivers: gpio: Add Allwinner H618 GPIO driver
Add standard Zephyr GPIO driver for Allwinner H618 SoC.
This driver supports pin configuration, reading/writing,
and basic external interrupt configuration.

Signed-off-by: Khai Do <dovankhai97@gmail.com>
2026-07-06 14:48:00 +01:00