Commit graph

1572 commits

Author SHA1 Message Date
Mathieu Choplain
988ccae7a5 drivers: intc: stm32: use unsigned types for API
This commit changes the EXTI driver API to use unsigned types
for all parameters previously typed as `int`, as the signedness
is unneeded and unwanted.

Signed-off-by: Mathieu Choplain <mathieu.choplain@st.com>
2024-08-27 10:50:39 -04:00
Pisit Sawangvonganan
2f4ca35105 drivers: gpio: renesas_ra_ioport: simplify pin configuration logic
- Removed zero initialization of `pincfg` structure as all members
  are guaranteed to be set.
- Introduced `pfs_cfg` as an intermediate variable to store data in
  the CPU register instead of stack.
- Simplified pin setting logic by relying on `pfs_cfg` being
  zero-initialized, eliminating the need for explicit bit clearing.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-26 17:23:31 -04:00
Michael Zimmermann
2ab246d17e drivers: gpio: Add initial SiM3U1xx support
This is just the driver for banks 0 to 3. Bank 4 will come via a
separate commit since it needs a different driver.

Signed-off-by: Michael Zimmermann <michael.zimmermann@grandcentrix.net>
2024-08-26 18:51:36 +02:00
Raffael Rostagno
90c6106926 drivers: esp32: Interrupts flags configuration
Allows configuring interrupts flags in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
bb746cdcc5 drivers: esp32: esp_intr_alloc return condition
Add checks to return value of esp_intr_alloc to avoid drivers init
returning 0 when interrupt allocation fails.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Raffael Rostagno
0b3a34cdca drivers: esp32: Interrupts priority configuration
Allows configuring interrupts priority in the device tree for
ESP32 devices.

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-22 14:25:25 -04:00
Pisit Sawangvonganan
6718ba6841 drivers: gpio: renesas_ra_ioport: improve device instantiation macro
Introduced `GPIO_DEVICE_INIT_RA_IF_OKAY` which utilizes `COND_CODE_1`
to reduce the chain of #if DT_NODE_HAS_STATUS(...) #endif

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-22 09:12:52 +02:00
Pisit Sawangvonganan
1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Benedikt Schmidt
d7fa28bf72 drivers: gpio: improve logging of PCAL64XXA
Improve logging of the driver for the port expander PCAL64XXA.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-08-20 10:31:27 +02:00
Ioannis Damigos
782967a1e3 gpio_smartbond: Fix port_set_masked_raw
Writing directly to Px_DATA_REG modifies pins which are not
indicated by mask, causing gpio_basic_api test to fail.

Use Px_SET_DATA_REG and Px_RESET_DATA_REG to modify only
pins indicated by mask.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-08-19 17:23:18 -04:00
Ioannis Damigos
82d17f1f2c gpio_smartbond: Remove pdc entry only if it exists
Remove pdc entry only if index exists when CONFIG_PM
is set.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-08-19 17:23:18 -04:00
Ioannis Damigos
df86860319 gpio_smartbond: Set pin to input when it is configured as GPIO_DISCONNECTED
Set pin to input with no resistors selected when it is configured as
GPIO_DISCONNECTED.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-08-19 17:23:18 -04:00
Duy Phuong Hoang. Nguyen
922ee61b8d drivers: gpio: Update gpio driver for Renesas RA series
Background of this modification is to make gpio driver code
provided by Renesas vendor to be an official support for Renesas
MCU on Zephyr

Signed-off-by: Quy Tran <quy.tran.pz@renesas.com>
Signed-off-by: Duy Phuong Hoang. Nguyen <duy.nguyen.xa@renesas.com>
2024-08-19 09:59:27 -04:00
Raffael Rostagno
cc2e0f2131 drivers: gpio: esp32c2: Add support
Add gpio support to ESP32C2 and ESP8684

Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
2024-08-16 14:08:22 -04:00
Lucien Zhao
ad0a066f4f drivers: gpio: update rgpio driver code
RGPIO model on RT1180 is same with igpio, however,
current driver can't support.

Update gpio driver to support gpio pad control

Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
2024-08-15 14:51:02 -04:00
Tahsin Mutlugun
99603e4c38 drivers: gpio: gpio_max32: Fix high-impedance setting
Put disconnected GPIOs to high impedance state by setting their
direction to input and pad control to none.

Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
2024-08-14 12:33:16 -04:00
Jan Peters
b8bef42add device_dt_metadata: handle dt_meta being NULL
Using  DEVICE_DEFINE, a device without a corresponding DT node can be
defined (for example CRYPTO_MTLS), Z_DEVICE_INIT() does not initialize
dt_meta for such devices, leaving the field as NULL.
device_get_dt_nodelabels() and functions calling it have to handle
dev->dt_meta == NULL to prevent fatal errors.

Signed-off-by: Jan Peters <peters@kt-elektronik.de>
2024-08-12 15:54:22 +02:00
Armin Brauns
ede19a4337 drivers: mcp23xxx: add support for open-drain chip variants
Pin definitions should correctly reflect the actual drive mode of the GPIO
controller, either push-pull or open drain.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-09 09:55:30 +02:00
Armin Brauns
054cc09c88 drivers: add bindings for all existing mcp23xxx variants
This allows getting rid of the ngpios property, which is implicit in the
part number. It also prepares for configuring pins as open-drain on
supporting chips in the next commit.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-09 09:55:30 +02:00
Armin Brauns
75b3bf5b6c drivers: remove legacy mcp23s17 driver
This chip is handled by the more generic mcp23xxx driver, which will get a
microchip,mcp23s17 compatible binding in the next commit.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2024-08-09 09:55:30 +02:00
Manuel Argüelles
d2ba31d503 drivers: intc: nxp: convert wkpu to native driver
Convert NXP WKPU to a native driver, all existing functionalities are
retained.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-08-02 15:14:33 -05:00
Manuel Argüelles
6c7d836b0c drivers: nxp: convert SIUL2 drivers to native
Convert pin control, GPIO and external interrupt controller drivers
based on SIUL2 peripheral to native drivers. This must be done in a
single commit to preserve atomicity, as these drivers depend on each
other.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2024-07-31 10:08:24 +02:00
Martin Åberg
7dbc5f09ed drivers/gpio: Add support for GRLIB GRGPIO2
This adds support for the GRLIB GRGPIO2 controller used in
LEON and NOEL-V systems.

Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
2024-07-29 14:27:15 +02:00
Nils Larsen
dcfc3e7872 drivers: gpio: imx rt11xx: fix wrong gpio pull disable mask
Fixes: #75390
A wrong bit mask (wrong: IOMUXC_SW_PAD_CTL_PAD_PUS_MASK = 0x8) was used.
That bit mask is for PUE/PUS-type gpio registers, but this is the
section for registers with alternative PULL (PDRV) type layout.
Right bit mask: IOMUXC_SW_PAD_CTL_PAD_PULL_MASK

Signed-off-by: Nils Larsen <nils.larsen@posteo.de>
2024-07-08 09:30:15 +02:00
Duy Nguyen
f978c69eb4 driver: gpio: Add initial gpio drirver support for RA8M1
This is the initial commit to support for gpio driver
for RA8M1 MCU, the coding is base on renesas fsp hal

Signed-off-by: Duy Nguyen <duy.nguyen.xa@renesas.com>
2024-06-26 13:36:14 -04:00
Alberto Escolar Piedras
9d9cf4d17d drivers/gpio/gpio_rzt2m: Handle trig == GPIO_INT_TRIG_WAKE
Fix a build warning due to the enumerate for the trigger
polarity possibly being (from the point of the compiler)
also GPIO_INT_TRIG_WAKE.
We fix it by simply returning a not valid argument error
which is what most other drivers do if they do something
smart enough.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
2024-06-25 10:25:04 -04:00
Jordan Yates
07870934e3 everywhere: replace double words
Treewide search and replace on a range of double word combinations:
    * `the the`
    * `to to`
    * `if if`
    * `that that`
    * `on on`
    * `is is`
    * `from from`

Signed-off-by: Jordan Yates <jordan@embeint.com>
2024-06-22 05:40:22 -04:00
Andy Sinclair
7f0f0a4f97 drivers: gpio: shell: Fixed gpio info crash bug
When getting gpio info for a specific device with no line
names, invalid memory was accessed.
The check for the length of the line name array has been
corrected to avoid this.

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2024-06-20 08:59:49 +02:00
Lucas Tamborrino
a62423f391 drivers: Update to add support for esp32c6
Changes to bring support for esp32c6 SoC.
- clock control
- gpio
- pinctrl
- serial
- timer

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2024-06-14 18:51:46 -04:00
Declan Snyder
801028b763 dts: nxp,lpc-gpio: Fix binding to group ports
LPC GPIO binding was wrong in that the reg address
on the simple soc bus was given as an index of the gpio ports
within a gpio controller. Fix this by putting the GPIO node
on the simple bus as a single node with the correct base address,
and make the ports children of this node.

Change the driver to get the port number from the reg address
instead of a custom property, and get base address from DT instead
of the SDK macro definition.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2024-06-14 11:13:05 +02:00
Martí Bolívar
48a14dc17e gpio: add support for node label based lookup in the shell
Use some new kernel features to make the experience of finding and
dealing with GPIO devices much more ergonomic by allowing the use of
devicetree node labels to identify GPIO devices by default.

Users who wish to avoid the associated footprint penalty can set
CONFIG_DEVICE_DT_METADATA=n by hand, but I think the convenience is
worth the price as a default. If we're running a shell, then we've
already paid a heavy footprint penalty.

Example output for qemu_cortex_m3:

    uart:~$ gpio devices
    Device           Other names
    gpio@40004000    gpio0
    gpio@40005000    gpio1
    gpio@40006000    gpio2
    gpio@40007000    gpio3
    gpio@40024000    gpio4
    gpio@40025000    gpio5
    gpio@40026000    gpio6

Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
2024-06-12 18:49:54 +02:00
Pisit Sawangvonganan
748367d118 drivers: gpio: stm32: clean up unnecessary code
Removed the unnecessary initialization of the `ret` variable in
`gpio_stm32_clock_request` where its value is guaranteed to be
overwritten by subsequent operations, then simply returned `ret`.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-11 19:44:19 -04:00
Pisit Sawangvonganan
944305dc3a drivers: gpio: stm32: improve device instantiation macro
Introduced `GPIO_DEVICE_INIT_STM32_IF_OKAY` which utilizes `COND_CODE_1`
to reduce the chain of #if DT_NODE_HAS_STATUS(...) #endif

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-06-11 19:44:19 -04:00
Vincent Geneves
e21a021ed6 drivers: gpio: pcal64xxa: give semaphore in case of error
In function pcal64xxa_process_input, lock was not released in case of
error when calling inputs_read.
This was causing an infinite wait in the following calls of functions
using I2C bus.

Signed-off-by: Vincent Geneves <vgeneves@kalray.eu>
2024-06-07 19:06:42 -04:00
Adrien Ricciardi
9f6451d086 drivers: gpio: gecko: Use SIZEOF_FIELD() macro
Use the utility macro instead of bare code.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2024-06-07 21:43:07 +02:00
Francois Ramu
bde663f484 drivers: gpio: stm32 gpio driver supporting the stm32H7RS
Introduce the stm32h7RS serie to the gpio driver,
based on the stm32h7
The SBS controller is used to configure the EXTI line among
the different GPIO port.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-06-06 00:41:43 -07:00
Abderrahmane Jarmouni
efc209b47f drivers: gpio: stm32: support wkup pins configuration
Introduce a custom STM32_GPIO_WKUP GPIO flag.
Use the newly introduced stm32_pwr_wkup_pin_cfg_gpio() public
function to configure GPIO pins, that have the STM32_GPIO_WKUP
flag in DT, as sources for STM32 PWR wake-up pins, on the condition
that there is a wake-up pin that corresponds to each of them.
These GPIO pins can then be used to power on the system after Poweroff
like a reset pin.

Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
2024-06-05 17:35:55 -05:00
Pisit Sawangvonganan
75165050f7 drivers: gpio: remove '&' when assigning gpio_xxx_init function
Remove address-of operator ('&') when assigning `gpio_xxx_init`
function pointer in `DEVICE_DT_INST_DEFINE` macro.

This change aims to maintain consistency among the drivers in
`drivers/gpio`, ensuring that all function pointer assignments
follow the same pattern.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-05-29 07:32:17 +02:00
Sadik Ozer
d6e1753125 drivers: Add MAX32690 gpio driver
GPIO driver for MAX32690

Co-authored-by: Okan Sahin <okan.sahin@analog.com>
Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
2024-05-29 07:30:12 +02:00
Yong Cong Sin
bbe5e1e6eb build: namespace the generated headers with zephyr/
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Yong Cong Sin
af450ea3cc drivers: gpio: add Broadcom iProc GPIO controller driver
Add device driver, bindings and build-only test for
Broadcom iProc GPIO controller.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 09:59:20 +02:00
Sreeram Tatapudi
f96e6ccbc0 boards: arm: Introduce Infineon CYW920829M2EVK-02 board
- Add initial version of CYW920829M2EVK-02 board
- [drivers: clock_control] Make it possible to set up both iho and imo
  clocks instead of just one or the other

Signed-off-by: Sreeram Tatapudi <sreeram.praveen@infineon.com>
2024-05-24 18:05:11 -04:00
Jérémy LOCHE - MAKEEN Energy
0af906a533 gpio: imx: Added IRQ lock for RMW operations
The GPIO API performs unprotected RMW operations that
can cause glitching and race conditions when GPIOs are used by
different threads or ISRs.

Signed-off-by: Jérémy LOCHE - MAKEEN Energy <jlh@makeenenergy.com>
2024-05-23 11:51:51 -04:00
Emilio Benavente
24c1d3ed70 drivers: gpio_mcux: Support shared interrupts
Updating the driver to support multiple
ports sharing a single interrupt.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2024-05-22 15:42:48 -04:00
Hao Luo
a64b069785 drivers: gpio: Add support for Apollo3 SoCs GPIO
This commit adds support for the GPIO which
can be found in Apollo3 SoCs

Signed-off-by: Hao Luo <hluo@ambiq.com>
2024-05-15 16:08:29 +02:00
Jerzy Kasenberg
f2e3d3f951 soc: smartbond: Move PM_DEVICE dependency to soc
For DA1469x if PM config is selected PM_DEVICE must also
be selected for GPIO to work when device enters/exists
deep sleep.

Previously GPIO and regulator drivers selected PM_DEVICE
when PM was enabled.
Now it is moved to SOC instead.

PM_DEVICE selection in GPIO could result in circular dependency
for mcux if MEMC_MCUX_FLEXSPI (which is already dependent on PM_DEVICE)
was to be additionally dependent on GPIO.

Signed-off-by: Jerzy Kasenberg <jerzy.kasenberg@codecoup.pl>
2024-05-14 17:05:03 +02:00
cyliang tw
796fc9d54f drivers: gpio: Update Numaker driver init function
To update Numaker driver to turn on clock in init function.

Signed-off-by: cyliang tw <cyliang@nuvoton.com>
2024-05-10 11:52:22 +03:00
Chekhov Ma
ad2745471c drivers: mfd: add new driver "mfd_adp5585"
Add mfd_adp5585 and gpio_adp5585 driver. This driver enables ADP5585
as an GPIO expander.
This chip is used as an GPIO expander on i.MX93 EVK. GPIO pinctrl,
read/write and interrupt is supported.
Note that ADP5585 has 2 GPIO banks with 5 pins each. The driver combines
two group into a 16-bit port. Index 0~4 correspond to R0~R4 lines, index
8~12 correspond to C0~C4 lines. Index 5~7 is reserved unavailable.

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2024-05-08 16:09:08 -04:00
Nick Ward
7602c4f386 drivers: gpio: shell: add toggle command
Usage:
gpio toggle [device] [pin]

Also added Kconfig option so this command can be removed if
resources need to be conserved.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2024-05-08 09:24:20 -04:00
Benjamin Cabé
003f145314 drivers: gpio: fix bug with Px15 pins
Fix condition in pin number check so that PA15, PB15, etc. can be properly
accessed..

Co-authored-by: Денис <baden.i.ua@gmail.com>
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-05-03 07:29:13 -04:00