Commit graph

1,644 commits

Author SHA1 Message Date
Mika Braunschweig
cc6eaa0cf9 drivers: gpio: davinci: fix config layout
Zephyr GPIO drivers require the pin mask `struct gpio_driver_data` to be
the first element of the driver config. Reordering fixes failures in ASSERT
statements of the GPIO driver due to the base address being interpreted as
supported pin mask.

Signed-off-by: Mika Braunschweig <mika.braunschweig@siemens.com>
2025-03-17 09:26:45 +01:00
Nhut Nguyen
9077d46c5d drivers: gpio: Add support for RZ/T2L
Add GPIO driver support for RZ/T2L

Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
Signed-off-by: Hieu Nguyen <hieu.nguyen.ym@bp.renesas.com>
2025-03-17 09:26:13 +01:00
Ayush Singh
99e7223a1c drivers: gpio_cc13xx_cc26xx: Update for latest sdk
- It seems that the mask variants of GPIO functions are not present in
  the latest sdk, so replace those with direct register access.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
2025-03-17 09:25:58 +01:00
Ryan McClelland
705491e306 drivers: gpio: shell: fix warning
A warning is generated due to a cast-function-type. Remove the unused
arg.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2025-03-17 02:21:37 +01:00
Camille BAUD
7955757450 drivers: gpio: Introduce CH32V20x/30x GPIOs support to CH32V0x driver
This introduces support for CH32V20x/30x GPIOs

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-03-14 14:39:30 +01:00
Quang Le
b7f99ffbdd drivers: gpio: Add support for RZ/N2L
Add GPIO driver for RZ/N2L

Signed-off-by: Quang Le <quang.le.eb@bp.renesas.com>
Signed-off-by: Nhut Nguyen <nhut.nguyen.kc@renesas.com>
2025-03-14 09:23:50 +01:00
TOKITA Hiroshi
5184fb9257 drivers: gpio: rpi_pico: Add support for RP2350B
As the RP2350B has more than 32 GPIO pins,
we changed the configuration so that it is split into two ports.

To do this, we created a `raspberrypi,pico-gpio-port` node and
moved the previous `raspberrypi,pico-gpio-port` functions to it.

This became a child node of `raspberrypi,pico-gpio-port`, and
`raspberrypi,pico-gpio-port` will remain a gpio mapper.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-03-10 11:20:30 +01:00
Henrik Brix Andersen
63c24d9d34 soc: neorv32: update to support NEORV32 v1.11.1
Update the NEORV32 SoC, peripheral drivers, and board to support NEORV32
v1.11.1. Notable changes include:

- Optional RISC-V ISA Kconfigs are now selected on the board level.
- Peripheral registers are now automatically reset in hardware, no need for
  software initialization code.
- The NEORV32 GPIO controller now supports 32 pins, not 64. Interrupt
  support will be submitted in a separate PR.
- Default board configuration has 64k RAM and is clocked at 18 MHz.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2025-03-10 11:11:22 +01:00
Tim Lin
0d4f8feb6f drivers/gpio: ite: it8801: Fix the GPIO output configure issue
If the output level does not change to high or low, it should not be
changed to 0.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-03-10 08:59:46 +01:00
Chekhov Ma
c87900aa40 drivers: gpio: adp5585: fix wrong reg during pin configure
The ADP5585_GPO_OUT_MODE_A is used when configuring initial output
during pin configuration, causing pins configured HIGH is incorrectly
configured as open-drain. Replacing the reg with ADP5585_GPO_DATA_OUT
fixes the issue.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2025-03-10 08:59:26 +01:00
Pisit Sawangvonganan
84bc26eeec drivers: gpio: shell: streamline code
Streamline code in multiple places as follows:
- Remove redundant initialization of `ret` to `0`,
  as it is immediately assigned a value.
- Add `len` to store the result of `strlen(argv[ARGV_CONF])` to avoid
  multiple calls to `strlen` within the `for-loop` in `cmd_gpio_conf`.
- Merge separate `shell_print` calls by including a newline `\n`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2025-03-07 19:57:50 +01:00
Fabio Baltieri
3d24b8b552 gpio: shell: use the first nodelabel when available
Use the first nodelabel rather than the node name when available for
shell completion as well as "gpio info". This label is always set gpio
nodes as that's what's used for references by device nodes, there may be
some case where a node has multiple labels for some reason but for a
human I reckon it still makes more sense to suggest a label rather than
the address.

This means that the commands would use, for example "gpioa" rather than
"gpio@58020000".

Fall back to the normal node name if there's no label set or if dt
metadata is not enabled.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-03-07 19:57:07 +01:00
Robert Budai
c55204f761 drivers: gpio: extend max14916 to max14915
The MAX14915 has eight high-side switches specified to deliver up to
700mA continuous current with simlar register map and diagnostics
parameters to MAX14916.

Documentation:
https://www.analog.com/en/products/max14915.html

Signed-off-by: Robert Budai <robert.budai@analog.com>
2025-03-07 19:51:07 +01:00
Martin Hoff
13e152a579 drivers: gpio: gecko: add check for interrupt configuration
Add a check for interrupt configuration: if the interrupt line for the
pin is already enabled but for the same port that the user asked, it
should not return EBUSY.

Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
2025-02-21 15:14:07 +00:00
Fabio Baltieri
a3bd7efb38 gpio: shell: fix a crash where there's less line names than gpios
Don't try to dereference line_names if the index is beyond
line_names_len, this can happen if there's less line names than the
total amount of supported gpios specified.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-19 18:48:30 +01:00
Fabio Baltieri
323b0d8cd0 gpio: shell: add a missing static qualifier
line_cmp is only used in this file, make it static.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-19 18:48:30 +01:00
Fabio Baltieri
29776b1758 gpio: shell: drop an unnecessary forward declaration
Move SHELL_DYNAMIC_CMD_CREATE after the function, then the forward
declaration is unnecessary.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-19 18:48:30 +01:00
Robin Kastberg
318019e0b3 drivers: gpio: unnamed parameters not allowed
This violates Zephyr Rule 44 and causes error Pe141 on IAR.

Signed-off-by: Robin Kastberg <robin.kastberg@iar.com>
2025-02-17 21:15:35 +01:00
Paul Alvin
d12686269f drivers: gpio: xlnx: Add support for versal2 PS/PMC GPIO
Add driver support for Versal Gen 2 PS/PMC GPIO controller by updating
the logic of bank index calculation.

This logic depends on "register" DT property to identify bank index
instead of depending on node instance ID as Versal Gen 2 GPIO banks
are not in sequential order as Zynqmp.

- Versal Gen 2 PS GPIO: Banks(0,3,4)
- Zynqmp PS GPIO: Banks(0,1,2,3,4,5)

Signed-off-by: Paul Alvin <alvin.paulp@amd.com>
2025-02-14 21:02:53 +01:00
Thao Luong
e139d936cb drivers: gpio: Only configs for VBATT pin when RA MCU support
Update GPIO driver for RA: Only configs for VBATT pin when RA
MCU support.

Signed-off-by: Thao Luong <thao.luong.uw@renesas.com>
2025-02-14 17:15:43 +01:00
Daniel Schultz
e7fb3c6848 drivers: gpio: davinci: Select PINCTRL
This driver includes pin-muxing functions and requires to have
CONFIG_PINCTRL enabled. Automatically set this config when this
driver is enabled.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2025-02-14 10:48:20 +01:00
Wilfried Chauveau
e9f95b7c92 drivers: gpio: mmio32: remove redundant mask field.
The pin mask is already present in the common structure.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-14 10:42:02 +01:00
Wilfried Chauveau
c0139fad06 drivers: gpio: mmio32: update gpio_mmio32 to behave like other divers
The current implementation requires SoCs/Boards to manualy instantiate
the preripherals and initilize them.

The change lets Zephyr rely on the device tree setup to instantiate &
initialize the relevant gpio peripheral.

Signed-off-by: Wilfried Chauveau <wilfried.chauveau@arm.com>
2025-02-14 10:42:02 +01:00
Andrew Featherstone
06be6ebf3a drivers: gpio_rpi_pico: Add gpio_get_config API
Implement the `gpio_get_config`

N.b. adding this API results in a new test failure in
`test_gpio_config_trigger`. This suggests that there is some kind of
dependency between this and the now-enabled `pin_get_config` test cases.
Note that this adds a read-only API, it is unlikely to be the cause of
the failure.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-02-14 03:19:59 +01:00
Andrew Featherstone
c1b69710a1 drivers: gpio_rpi_pico: Add gpio_port_get_direction API
THe driver didn't implement this API, so add it.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-02-14 03:19:59 +01:00
Andrew Featherstone
91c4c4363e drivers: gpio_rpi_pico: Add gpio_get_pending_int API
Implement `gpio_get_pending_int`.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-02-14 03:19:59 +01:00
Andrew Featherstone
608e6a30b1 drivers: gpio_rpi_pico: Disable inputs when not in use
Reorder gpio_rpi_configure to disable input buffers when not in use.
gpio_rpi_get_config can then determine whether a pin is configured as an
input without requiring additional state variables, as well as reducing
input leakage current.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-02-14 03:19:59 +01:00
Andrew Featherstone
27c41b42c1 drivers: gpio_rpi_pico: Support GPIO_DISCONNECTED flag
Out of reset the pads are input enabled, output disabled. Disconnect the
pad's input and output buffers, as well as any pullups. This can reduce
input leakage current.

Signed-off-by: Andrew Featherstone <andrew.featherstone@gmail.com>
2025-02-14 03:19:59 +01:00
Steven Chang
7b3596faaa driver: gpio: ene_kb1200 gpio initial level
Change initial level from POST_KERNEL to PRE_LERNEL_1,
Config suport voltage and driving flags

Signed-off-by: Steven Chang <steven@ene.com.tw>
2025-02-14 00:44:57 +01:00
Tom Hughes
65b4e594d7 drivers: gpio: pca95xx: Remove unused functions
Building with clang warns:

drivers/gpio/gpio_pca95xx.c:256:19: error: unused function
'update_input_reg' [-Werror,-Wunused-function]
static inline int update_input_reg(const struct device *dev, uint8_t pin,
                  ^

drivers/gpio/gpio_pca95xx.c:120:12: error: unused function
'read_port_reg' [-Werror,-Wunused-function]
static int read_port_reg(const struct device *dev, uint8_t reg,
           ^             uint8_t pin,

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-13 16:42:35 +01:00
TOKITA Hiroshi
1db7d3c35a drivers: gpio: renesas_ra: Do not clear pin config in int-configure
In the current implementation, when `gpio_ra_pin_interrupt_configure`
is executed, the existing settings made by `gpio_ra_pin_configure`
are erased.
A read-modify-write method will be used to preserve the settings.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-02-13 06:39:08 +01:00
TOKITA Hiroshi
79130a73be drivers: gpio: renesas_ra: Add support for GPIO_GET_CONFIG option
Enable retrieval of pin configuration information.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-02-13 06:39:08 +01:00
Pieter De Gendt
61bfb4dba4 drivers: gpio: Wrap driver instances in device API macro
Use the device API macro to place the driver API instance into an iterable
section.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2025-02-12 16:06:25 +01:00
Jaro Van Landschoot
0085b34e02 drivers: gpio: gpio_stm32: add gpio speed
The driver already read the speed flags (cfr. ospeed) and called
LL_GPIO_SetPinSpeed, but these flags could not be set yet.

Signed-off-by: Jaro Van Landschoot <jaro.vanlandschoot@basalte.be>
2025-02-12 12:31:40 +01:00
Jérôme Pouiller
4291a6633f drivers: gpio: Introduce support for SiWx91x
Implement GPIO driver for Siliconlab SiWx917 family.

This driver support high Performance (HP), Ultra Low Power (ULP) and
Ultra Ultra Low Power (UULP) GPIOs.

Co-authored-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2025-02-11 22:07:11 +01:00
Lucien Zhao
3636182a0a drivers: gpio: gpio_mcux: remove including fsl_gpio.h file
There is no need to include sdk gpio driver.

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2025-02-10 22:27:34 +01:00
Tim Lin
608d94b869 drivers/gpio: ite: Validate num_pins to prevent untrusted loop bound
Added a build assert to limit num_pins to a maximum allowable value to
prevent potential out-of-bounds access or infinite loops.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-02-08 10:09:20 +01:00
Tim Lin
db0f20c6fb drivers/gpio: ite: Modify the format to comply with check_compliance.py
Modify the format to comply with check_compliance.py.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2025-02-08 10:09:20 +01:00
Jiafei Pan
7a100c9b28 drivers: gpio: add driver for PCA6416 IO expander
The PCA6416A is a 16-bit general purpose I/O expander that provides
remote I/O expansion for most microcontroller families via the I2C-bus
interface.

Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
2025-02-08 00:31:28 +01:00
Vebjorn Myklebust
4b63ef0e5a drivers: gpio: Add support for cc23x0 GPIO
Add support for GPIO to cc23x0 SoC.

Signed-off-by: Lars Thalian Morstad <l-morstad@ti.com>
Signed-off-by: Vebjorn Myklebust <v.myklebust@ti.com>
Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-02-04 11:56:05 +01:00
Fabio Baltieri
3a66b3853e drivers,test: use the new DT_FOREACH_PROP_ELEM_SEP
Use the new DT_FOREACH_PROP_ELEM_SEP macro instead of
DEVICE_DT_GET(DT_PHANDLE_BY_IDX(...)).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2025-02-04 09:18:55 +01:00
TOKITA Hiroshi
460d9fad89 drivers: gpio: rpi_pico: Not support GPIO_DISCONNECTED config
If GPIO_DISCONNECTED is requested with gpio_pin_configure,
it will return -ENOTSUP since rpi_pico does not support it.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2025-02-03 19:50:43 +01:00
Jamie McCrae
560db8509a drivers: kconfig: Fix bleeding options
Fixes a multitude of Kconfigs that wrongly appear on devices
where support is literally impossible

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
2025-01-31 11:50:12 +01:00
Terry Geng
cbcb2d8f12 drivers: adc: ads1x4s0x: Rename files, preparing for adding new devices
Renamed ads114s0x/8 to ads1x4s0x.

Signed-off-by: Terry Geng <terry@terriex.com>
2025-01-31 09:39:07 +01:00
Terry Geng
43079c8086 drivers: adc: ads114s0x: Rename variables, preparing for adding new devices
Renamed ads114s0x/8 to ads1x4s0x.

Signed-off-by: Terry Geng <terry@terriex.com>
2025-01-31 09:39:07 +01:00
Benjamin Cabé
ab9a2f52ba drivers: gpio: npm2100: properly handle I2C write return value
properly check return code from i2c_reg_write_byte_dt effectively
making it possible for gpio_npm2100_port_set_masked_raw to error out since:

if (ret != 0U) {
	return ret;
}

was dead code before this fix.

Fixes CID-444376

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-01-30 16:20:45 +01:00
James Roy
e9a5b48b6c drivers: gpio: Fix uninitialized variable in gpio_pca_series
Fix uninitialized val variables scanned by Coverity.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-01-28 23:41:19 +01:00
Guillaume Gautier
6602896520 drivers: gpio: stm32: add support for stm32n6
Add GPIO support for STM32N6

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2025-01-28 18:14:45 +01:00
Khoa Nguyen
b6b5b6031f drivers: gpio: Fix bug for gpio driver Renesas RA
Get build error when using a gpio port that has port_irq_names
property isn't defined. This commit aim to fix this bug.

Signed-off-by: Khoa Nguyen <khoa.nguyen.xh@renesas.com>
2025-01-28 07:57:03 +01:00
Alain Volmat
5d6101ec4b driver: gpio: mfxstm32l152: add driver for STM32L152 based MFX
Initial commit for a STM32L152 based GPIO expansion chip.
The mfxstm32l152 driver offers GPIO controller fonctions.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2025-01-24 19:15:46 +01:00