Commit graph

1,662 commits

Author SHA1 Message Date
James Smith
5261e53ea3 drivers: gpio: silabs: Don't fail to init is clock is already enabled
Don't fail to initialize gpio if it was already initialized, for
example by mcuboot. Fixes #94281.

Signed-off-by: James Smith <james@loopj.com>
2025-08-09 03:40:09 -04:00
S Mohamed Fiaz
bbd9631db6 drivers: gpio: silabs: gpio driver for EFR series 2 devices
Added the gpio driver for EFR series 2 devices.

The SILABS_SISDK_GPIO symbol is added to enable
support for the new GPIO driver.
The SOC_GECKO_GPIO symbol is retained for now to
maintain compatibility with existing drivers and
will be removed in a subsequent commit.

Signed-off-by: S Mohamed Fiaz <fiaz.mohamed@silabs.com>
2025-08-07 08:58:14 -04:00
Krzysztof Chruściński
0d813fb1db drivers: gpio: nrfx: Add support for GPIOTE0 on cpurad
Add support for special GPIOTE0 instance on nrf54h20/cpurad.
This instance requires special handling because:
- there is no support for PORT event (level interrupts)
- TE channels are fixed to the pin

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2025-08-07 13:15:45 +02:00
Sreeram Tatapudi
ba144130ce drivers: gpio: GPIO driver updates to support PSC3
Update GPIO driver to support PSC3

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2025-08-04 19:57:57 +01:00
Michael Estes
e13881ff0c drivers: gpio: add pcal9722 SPI GPIO expander driver
Adds a driver for NXP's PCAL9722 SPI GPIO expander

Signed-off-by: Michael Estes <michael.estes@byteserv.io>
2025-08-04 11:49:29 +01:00
Xing Chen
7eb6e519d7 drivers: gpio: add gpio for sama7g5
Add driver for sama7g5 GPIO controller (PIO4)

Signed-off-by: Xing Chen <xing.chen@microchip.com>
2025-07-31 17:15:27 -04:00
Bjarki Arge Andreasen
2b0d1ae4d0 soc: nordic: nrf54h: transition from gpd to zephyr pinctrl and pds
Transition nrf54h away from the soc specific gpd
(global power domain) driver which mixed power domains, pinctrl
and gpio pin retention into a non scalable solution, forcing soc
specific logic to bleed into nrf drivers.

The new solution uses zephyrs PM_DEVICE based power domains to
properly model the hardware layout of device and pin power domains,
and moves pin retention logic out of drivers into pinctrl and
gpio, which are the components which manage pins (pads).

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-07-29 09:03:37 -04:00
Ioannis Karachalios
1278fd0c0f drivers: gpio: smartbond: Fix PDC GPIO port selection
The GPIO block instance is based on the instance number during the
device driver initialization. This is not correct as instance numbers
in now way reflect any numbering scheme. Therefore, a DTS property
is introduced so that the block instance numbering is indicated
explicitly.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2025-07-25 08:17:51 -04:00
Parthiban Nallathambi
455e76f68f drivers: gpio: fix pincm lut size
LUT sizes directly reflects the global data when enabled in dts
(even if no or few pins are really consumed). Also the PINCM
numbering across the series (g, l and c) is within 255, so fix
to use uint8_t to save the global space.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2025-07-21 07:25:50 -04:00
Parthiban Nallathambi
7a70fab29b drivers: gpio: add support for mspm0L series banks
All the HAL API/wrapper depends on PINCM indexing, which cannot
be derived from neither pin number nor the address offset.

With current approach, update the LUT table of possible PINCM's
for L series with GPIO A, B and C banks.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2025-07-21 07:25:50 -04:00
Phi Tran
529a11057e drivers: gpio: renesas_rx: Refactor macros for conditional generation
This change introduces GPIO_RX_PORT_IRQ_DECL() and GPIO_RX_PORT_IRQ_ELEM()
macros to conditionally generate GPIO port IRQ declarations and elements
only when the 'port_irq_names' property exists in the device tree node.
This improves code clarity and avoids generating unused code for ports
that do not have IRQ support for Renesas RX

Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
2025-07-19 15:40:18 -04:00
Alvin Šipraga
cc08d96d79 drivers: gpio: mspm0: allow configuration of open-drain outputs
Check the GPIO_OPEN_DRAIN flag and set the corresponding HIZ1 bit in the
PINCM register.

Signed-off-by: Alvin Šipraga <alsi@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Emil Dahl Juhl
5ede804e2d drivers: gpio: mspm0: Mask interrupts correctly
Reading back the raw interrupt status from the gpio controller, provides
the interrupt mask _without_ the controller's masking registers applied.
This means that e.g. a rising edge would trigger an interrupt even on
pins that are configured for falling edge only.

Fix this by reading the "enabled" interrupt status instead of the raw
one.

Signed-off-by: Emil Dahl Juhl <emdj@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Emil Dahl Juhl
3e5b9728e9 drivers: gpio: mspm0: Fix interrupt polarity
The polarity mapping was swapped such that GPIO_INT_TRIG_LOW would
translate to high, and vice versa, on the chip configuration.

Swap the polarity to fix this.

Signed-off-by: Emil Dahl Juhl <emdj@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Hans Binderup
e88a14751a drivers: gpio: mspm0: Add support for GPIO_GET_DIRECTION
This commit implements the gpio_get_direction handle for the gpio_mspm0
driver.

Signed-off-by: Hans Binderup <habi@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Hans Binderup
8bc98ead34 drivers: gpio: mspm0: Add support for GPIO_GET_CONFIG
This commit implements the gpio_get_config handle for the gpio_mspm0
driver.
NOTE: Currently only handles input/output state and not configured flags

Signed-off-by: Hans Binderup <habi@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Hans Binderup
9edd7b0661 drivers: gpio: mspm0: fix disabled state handling
Prior to this commit, writing a gpio port would completely clear
the state of given port. This commit ensures that state is kept
when writing, reading and configuring gpio ports.

Signed-off-by: Hans Binderup <habi@bang-olufsen.dk>
2025-07-19 10:09:13 +02:00
Alberto Escolar Piedras
0ec02c1873 drivers/gpio/sdl: Remove NATIVE_APPLICATION support
It is not possible to build anymore in that mode, so we do not
need to support it in this driver cmake files.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2025-07-19 09:38:15 +02:00
Chris Friedt
8fd0b704ab drivers: gpio: gpio_pca_series: check return values and exit on error
Check return values and exit on error to address CID 434641.

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2025-07-11 08:19:39 -10:00
Jiafei Pan
255e7f960b drivers: gpio: pca6416: fix dt get id
It should use "n" but not use "inst".

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-07-10 10:14:16 -05:00
Pisit Sawangvonganan
b8a8173c1f drivers: kconfig: fix typo
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-07-01 10:58:54 -10:00
sudarsan N
c9be1972b2 gpio: pca_series: fix shift overflow and use 3ULL instead of 0b11
Replaces binary literal with 3ULL to avoid shift overflow and align
with Zephyr coding style.

Fixes: #81963
Fixes: CID 434591

Signed-off-by: sudarsan N <sudarsansamy2002@gmail.com>
2025-06-27 09:00:35 -10:00
Pieter De Gendt
70ee055caf drivers: gpio: Place device APIs in linker sections
Use DEVICE_API macro to place driver API instances into a linker section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-06-27 10:09:32 -05:00
Sebastian Huber
9832973bec drivers: gpio: mchp_mss: Add reset support
Add support to reset the device through a reset controller.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2025-06-27 09:59:08 -05:00
Steven Chang
7d2be3bbff drivers: gpio: gpio driver
Add gpio driver for ENE KB106X

Signed-off-by: Steven Chang <steven@ene.com.tw>
2025-06-27 10:57:20 +02:00
Bjarki Arge Andreasen
691b3356f8 drivers: gpio: nrfx: extend pin retain to every pin
The usage of nrf_gpio_port_retain_disable/_enable, in cases where
the soc pins support retention, every pin must be
retained/unretained regardless of what power domain the pad is in.

This patch ensures retain is applied to all pins in all domains by
the gpio_nrfx device driver, not only pins specifically in the
fast_active_1 domain. Without this patch, pinctrl will correctly
retain pins, while gpio_nrfx will fail to unretain them when
again.

We no longer check the output state either, which was passed with
the flags arg of gpio_nrfx_gpd_retain_set() so this arg has been
removed.

Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
2025-06-26 14:07:43 +02:00
37190890d6 drivers: gpio: add interrupt support for the CH32V family
The WCH GPIO peripheral integrates with the EXTI and supports firing
interrupts when a GPIO pin changes.

Add optional support for firing a callback on rising edge, falling
edge, or both edges.

Tested on the `linkw` and the `ch32v006evt` using
`samples/basic/button`.

Signed-off-by: Michael Hope <michaelh@juju.nz>
2025-06-26 09:38:56 +02:00
Thao Luong
40ff446e10 drivers: gpio: add support for RA8P1
RA8P1 has 14 ports (from 0 to d) and 32 external irq while current
driver support 12 ports (0 to b) and 16 external irq.
This add addtional support for remain ports and external irq to be
able to work with RA8P1.

Fix the lack condition GPIO_RA_IOPORT for GPIO_RA_HAS_VBTICTLR
config

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-06-25 15:56:20 -10:00
Benjamin Cabé
5b0808fa4a drivers: gpio: rzt2m: properly handle error from rzt2m_gpio_get_pin_irq
For the negative errno rzt2m_gpio_get_pin_irq may return to be properly
handled, irq variable needs to use signed type.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-25 15:55:58 -10:00
Yishai Jaffe
88eda71497 gpio: adopt SHELL_HELP
Adopt SHELL_HELP macro for gpio_shell

Signed-off-by: Yishai Jaffe <yishai1999@gmail.com>
2025-06-25 15:53:28 -10:00
Loic Domaigne
836cf37dcc driver: gpio_ite_it8xxx2_v2: fix untrusted bound loop
Coverity is reporting a possible untrusted loop bound, caused by accessing
num_pins through a tainted pointer. Use explicit type cast to keep coverity
happy.

CID: 347195

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-06-25 14:09:34 +02:00
Markus Lassila
581f75656d drivers: gpio_nrfx: Free channel when changing mode
Fix an issue where calling gpio_pin_interrupt_configure
with edge mode and later calling it with level mode, did
not release the allocated gpiote channel.

Repeating the above sequence caused us to run out of
gpiote channels.

Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no>
2025-06-25 14:07:48 +02:00
Tallplay Lin
da4b8ec802 drivers: gpio: Support gpio_pin_get_config_dt
Add CONFIG_GPIO_GET_CONFIG feature to gpio_cmsdk_ahb.c

Signed-off-by: Tallplay Lin <tlin@atmosic.com>
2025-06-24 14:22:49 +02:00
Phi Tran
3fa9495172 drivers: gpio: add gpio interrupt support for RX130
- Add support for gpio interrupt on RX130.
- Add support for gpio-keys input subsys on RSK_RX130_512KB boards.

Signed-off-by: Phi Tran <phi.tran.jg@bp.renesas.com>
2025-06-24 14:18:41 +02:00
Sergei Ovchinnikov
645159dc26 drivers: npm13xx: add support for nPM1304
Add support for nPM1304 in the npm13xx drivers. The nPM1304 supports
different voltage and current ranges which are handled through the
initialization macros.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Sergei Ovchinnikov
89b8383633 drivers: npm13xx: rename npm1300 to npm13xx
Rename npm1300 to npm13xx in function names, documentation, etc. where
applicable for all the npm13xx drivers

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Sergei Ovchinnikov
fb007db50a drivers: npm1300: rename to npm13xx
Rename npm1300 drivers and header files to npm13xx to allow for usage
with other nPM13xx product variants.

Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
2025-06-23 16:19:43 +01:00
Benjamin Cabé
a55a9670ee drivers: gpio: max149xx: fix error handling
Use signed variable for negative error codes so that potential errors
are actually detected and returned properly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-23 15:50:05 +01:00
Corey Wharton
846d8197a7 drivers: gpio: gpio_dw: move base_addr to config struct
This variable should be const and inside the driver config struct.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-06-22 18:39:18 -07:00
Corey Wharton
338c5051db drivers: gpio: gpio_dw: add custom flag to set data and control source
If supported, the data and control source for a signal can come from
either software or hardware. This change adds a custom configuration
flag to set this for a specific pin.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-06-22 18:39:18 -07:00
Benjamin Cabé
6176b2ca1b drivers: gpio: wch: simplify port_toggle_bits logic
computation of BSHR was unnecessarily complex, with redundant
XOR/masking operations.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-21 15:31:27 +02:00
Hoang Nguyen
87177d1ac4 drivers: gpio: rz: improve gpio driver for Renesas RZ/A2M
- Adding support for GPIO_DISCONNECTED mode.
- Removing redundant interrupt configuration logic from the
.pin_configure API (already handled in pin_interrupt_configure).

Signed-off-by: Hoang Nguyen <hoang.nguyen.jx@bp.renesas.com>
Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
2025-06-20 16:24:01 +02:00
Chekhov Ma
7726b70033 drivers: gpio_adp5585: fix input register address
The input register address was somehow missing, fix it.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2025-06-18 09:10:55 -04:00
Chekhov Ma
41950cab0f drivers: gpio_adp5585: fix non-contiguous pin layout issue
Fixes #90988. The pin gap handling is wrong in the original code.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2025-06-18 09:10:55 -04:00
Youssef Zini
0972b23171 drivers: gpio: add mp2 gpio clock handling
Remove gpio clock management from the GPIO driver when running on the
cortex-m33 on the mp2 and gpio clocks are managed by the cortex-A, being
the resource manager, allowed by the Resource Isolation Framework (RIF).
Also add a specific binding for the mp2 gpio to make clock property
optional.

Signed-off-by: Youssef Zini <youssef.zini@savoirfairelinux.com>
2025-06-17 08:20:33 +02:00
Tien Nguyen
5599bc2ecb drivers: gpio: Add support for RZ/V2N
Add support for RZ/V2N

Signed-off-by: Tien Nguyen <tien.nguyen.zg@renesas.com>
Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
2025-06-16 14:00:22 -04:00
Khaoula Bidani
a9aa341ed5 drivers: gpio: fix gpio warning
Implement conditional compilation to avoid the warning:
- Use LL_PWR_EnableVDDIO2() for STM32U3 series.
- Use LL_PWR_EnableVddIO2() for other series.

Signed-off-by: Khaoula Bidani <khaoula.bidani-ext@st.com>
2025-06-16 13:59:38 -04:00
Sylvio Alves
2742eb4dc7 driver: gpio: esp32: move config to iram
Make gpio configuration in IRAM area to speed up
access.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2025-06-13 15:40:42 -07:00
Benjamin Cabé
4ad921660f drivers: gpio: rpi_pico: fix typo in gpio_set_dir_masked_n
gpio_set_dir_masked_n on port 1 should manipulate gpio_hi_oe_togl, not
gpio_oe_togl

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 15:39:50 -07:00
Benjamin Cabé
d9dedff71a drivers: gpio: rpi_pico: route ISR to the right irq_ctrl
gpio_rpi_isr() always addressed io_bank0->proc0_irq_ctrl, so any
interrupts taken while code was running on core 1 were invisible and
left pending.
Use get_core_num() to pick proc1_irq_ctrl when the ISR executes on core
1, ensuring callbacks fire from both cores.
Also fix stray `iobank0_hw` symbol for the correct `io_bank0_hw`.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 15:39:50 -07:00