Commit graph

1297 commits

Author SHA1 Message Date
Benedikt Schmidt 5a2359332f drivers: gpio: fix build of BD8LB600FS on intel_adl_crb
Fix the build of the gpio driver BD8LB600FS on the
board intel_adl_crb.
Fixes #68219.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-29 10:26:08 -06:00
Aymeric Aillet fd04892322 drivers: gpio: Rename renesas ra driver
Need this rename to be able to target this driver
in the "Renesas RA" maintainer area.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2024-01-29 11:32:46 +01:00
Benedikt Schmidt 23ed31383e drivers: gpio: use gpio_is_ready_dt in TLE9104
Use gpio_is_ready_dt in the driver for the TLE9104 before
actually using the GPIO.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-25 17:52:06 +01:00
Benedikt Schmidt f26da17723 drivers: gpio: make reset of TLE9104 optional
In some hardware designs it might happen that the reset signal
for the TLE9104 is not used only for this purpose, but instead for
instance to reset other devices at the same time. For such a hardware
design it is then necessary to make the reset GPIO optional. The reset
will have to be triggered earlier on.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-25 17:52:06 +01:00
Benedikt Schmidt 5a618057de drivers: gpio: add missing check if GPIO is ready for BD8LB600FS
Add a missing call to gpio_is_ready_dt in the driver of
the BD8LB600FS.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-25 11:50:35 -05:00
Benedikt Schmidt 7b55b99cac drivers: gpio: implement daisy chaining for BD8LB600FS
This implements the daisy chain feature of the low side switch
BD8LB600FS. The daisy chaining is in hardware achieved via
connecting the MISO and MOSI lines of multiple instances of the IC
in a row. It is implemented in the driver through a variable number
of GPIOs on one instance. Therefore, one device tree instance of the
IC will handle multiple daisy chained physical instances.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-25 11:50:35 -05:00
Guillaume Gautier 02ef0c5fb9 drivers: gpio: stm32: do not resume device when flag is DISCONNECTED
Fix a bug where after a standby, it was impossible to reenable a GPIO
clock.

A counter is incremented each time pm_device_runtime_get is called, and
decremented each time pm_device_runtime_put is called. The
clock is only enabled if this counter equals 1.
When configuring a GPIO (as input or output), the timer is incremented, and
when disconnecting it, it is both incremented and decremented. Thus the
next time we try to configuring it, the clock is not enabled (since the
counter will now be equal to 2).

This causes a problem when using low power standby mode: after wakeup all
clocks are disabled and the GPIO clock can not be reenabled.

This commit fixes this bug by not incrementing the counter when disconnect
is asked (or in other words incrementing it only when configuring either
an input or an output).

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2024-01-25 08:55:02 +01:00
Tim Lin 8317f9ea4f ITE: drivers/gpio: Add keyboard-controller property
When set, this GPIO controller has pins associated with the
keyboard controller. In this case the reg_gpcr property is
overloaded and used to write the keyboard GCTRL register

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2024-01-24 21:48:12 +01:00
Gerard Marull-Paretas 9e8bd2f976 drivers: gpio: sifive: remove unnecessary check
The API already asserts for invalid pin based on DT `ngpios` property.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-19 15:13:53 +00:00
Gerard Marull-Paretas 0363b74b38 drivers: gpio: mchp_mss: remove redundant include
<soc.h> is not needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-19 15:13:53 +00:00
Gerard Marull-Paretas d17405f255 drivers: gpio: atcgpio100: remove redundant include
<soc.h> is not needed.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-19 15:13:53 +00:00
Vit Stanicek f0b4e4c88d drivers: gpio_mcux_lpc: Fix xt-clang error
Remove gpio_clock_names and gpio_mcux_lpc_config->clock_ip_name from
drivers/gpio/gpio_mcux_lpc.c.

The drivers/gpio/gpio_mcux_lpc.c file did not compile with xt-clang
RI-2021.8-win32, as the gpio_clock_names was initialised with a
reference to a static const array. The clock_ip_name member was
initialised from this variable, but it isn't used anywhere else.

Signed-off-by: Vit Stanicek <vit.stanicek@nxp.com>
2024-01-18 10:55:05 +01:00
Chekhov Ma e1d495be81 driver: add new gpio driver "gpio_mcux_rgpio"
Add RGPIO gpio driver. This driver is used for i.MX93 and i.MX8ULP.
GPIO pinctrl, read/write and interrupt is supported. Runtime mmio
configuration is enabled, so no need for region definition in
mimx9/mmu_region.c

Signed-off-by: Chekhov Ma <chekhov.ma@nxp.com>
2024-01-16 20:50:11 -05:00
Amrith Venkat Kesavamoorthi 879e3a42b0 drivers: gpio: PCF857x: Modify PCF8574 driver
Modify existing PCF8574 driver as PCF857x for:
PCF8574 - 8 channel I/O expander
PCF8575 - 16 channel I/O expander

Signed-off-by: Amrith Venkat Kesavamoorthi <amrith@mr-beam.org>
2024-01-16 15:19:14 +00:00
Benedikt Schmidt cb2e3a86b4 drivers: gpio: ignore communication faults of TLE9104 during startup
Ignore communication faults of the TLE9104 which are reported
before the communication watchdog is configured.

Fixes #67370

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-01-16 10:00:13 +01:00
Gerard Marull-Paretas 992f25b0c9 drivers: gpio: b91: add missing PLIC header
Driver is using the RISC-V PLIC interrupt controller without including
the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-15 09:58:03 +01:00
Gerard Marull-Paretas 36069b6c9a drivers: gpio: sifive: add missing PLIC header
Driver is using the PLIC API without including the right header.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2024-01-15 09:58:03 +01:00
Pisit Sawangvonganan 6a815d47e2 drivers: gpio: correct spelling
Employ a code spell checking tool to scan and correct spelling errors
in all files within the drivers/gpio directory.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-01-13 00:24:04 +00:00
Dawid Niedzwiecki 1c0302d2fc drivers: gpio: stm32: fix init power state
Set suspended as initial power state, only when the
CONFIG_PM_DEVICE_RUNTIME config is enabled.

The initial state was incorrect, when CONFIG_PM_DEVICE=y and
CONFIG_PM_DEVICE_RUNTIME=n. In that case, the power state was SUSPENDED,
but the device was actually enabled.

Signed-off-by: Dawid Niedzwiecki <dawidn@google.com>
2024-01-08 11:48:58 +01:00
Jakub Zymelka ade49f081d modules: hal_nordic: nrfx: update API version to 3.2.0
Updated API version enables multi-instance GPIOTE driver.
Additionally obsolete symbol that was used to specify
API version in the past was removed.
Affected drivers have been adjusted and appropriate changes
in affected files have been made.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
2024-01-08 11:19:37 +01:00
Henrik Brix Andersen bc2826c1cb drivers: gpio: pca953x: check return values from I2C API functions
Check the return values from the I2C API functions called in init() and
fail driver initialization if unsuccessful.

Fixes: #66827

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2024-01-03 10:21:28 +01:00
Jeremy Bettis 5a727a382a drivers: Add level intrs in gpio_ite_it8xxx2_v2
Implement level based gpio interrupts, by using a worker queue to
repeatedly call the gpio callbacks until the gpio is no longer active.

Update unit test for new interrupts.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2024-01-02 10:10:39 +01:00
Jeremy Bettis 5ceea4fbdd drivers: Use #if
Use #if instead of IS_ENABLED for
CONFIG_SOC_IT8XXX2_GPIO_GROUP_K_L_DEFAULT_PULL_DOWN, otherwise DTS files
are required to provide gpiok and gpiol even if they are not used.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2024-01-02 10:10:39 +01:00
Jeremy Bettis 864b1c57f6 drivers: Wrap register accesses in ECREG
Similar to other ITE drivers, wrap register accesses in ECREG. This will
allow mocking out the registers in tests.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2024-01-02 10:10:39 +01:00
Richard Wheatley a40a8a5f49 boards: arm: apollo4p_evb add connector to apollo4p_evb
Generic Connector for the apollo4p_evb
Ran tests/drivers/gpio/gpio_basic_api
Ambiq does not support DUAL Edged Interrupts.
Added Connector Usages as defined by the Ambiq BSP.

Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
2023-12-15 14:35:32 +01:00
Vudang Thaihai cf5781a148 drivers: gpio: gpio_pca953x: Adding input latch and interrupt mask
The gpio_pca953x gpio driver doesn't have
the input latch and interrupt mask
configuration which causes a lack of accessing
and using those features on an gpio expander
device. Fix it by adding input latch and
interrupt mask configurations in this driver.

Signed-off-by: Vudang Thaihai <vudang.thaihai@brillpower.com>
2023-12-15 12:22:39 +00:00
Jeremy Bettis e268a6ce7d gpio: Add lock around registers and data
Added a spinlock to accesses of registers and struct gpio_ite_data,
except for gpio_ite_isr() function.

Bug #66401

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2023-12-13 09:56:31 +01:00
Aaron Ye 1268251faf drivers: gpio: ambiq: Fix the incorrect IRQ disablement.
For the Ambiq Apollo4x soc, every 32 pins share the same IRQ
number. irq_disable() should not be called for the pin interrupt
disablement, otherwise the interrupt of pins in the same GPIO
group will be disabled as well.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-12-01 16:25:47 +01:00
Aaron Ye 70ce5e4c6b dts: arm: ambiq: Update the GPIO instances
Use the "ambiq,gpio" binding to combine the "ambiq,gpio-bank"
child nodes for Apollo4 Plus soc.
Also update the GPIO driver accordingly.

Signed-off-by: Aaron Ye <aye@ambiq.com>
2023-12-01 16:25:47 +01:00
Mateusz Sierszulski fb016b6843 drivers: gpio: add Ambiq GPIO driver
This commit adds GPIO driver for Apollo4 SoCs.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2023-12-01 16:25:47 +01:00
Tim Lin 08e42b147e ITE: drivers/gpio: Correct the wake up control input
The wake-up control input is IT8XXX2_IRQ_WU66.

Testing the wake-up functionality on GPF6 is normal.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-12-01 12:41:22 +01:00
Aymeric Aillet eb879413be drivers: gpio: rcar: Add R-Car Gen4 support
Renesas Gen4 SoCs GPIO IPs are using one more
register comparing to Gen3 SoCs.

The new "INEN" register is used to enable general input.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2023-11-25 08:50:47 -05:00
Benedikt Schmidt bfb8eda025 drivers: gpio: implement driver for TLE9104
Implement a driver for the powertrain switch TLE9104.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-11-20 10:44:38 +00:00
Nick Ward cd9f307e71 drivers: gpio: shell: add vendor specific flags argument
Allow the optional setting of vendor specific flags in the conf command.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 738a1517b1 drivers: gpio: shell: optimise blink command
Use gpio toggle api instead of manually toggling.
Remove redundant text.
Print error and break from blinking if it occurs.
Only print 'how to exit' text if first toggle is successful.

Saves roughly 40 bytes.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 45509fdc0e drivers: gpio: shell: make blink command optional
Adds CONFIG_GPIO_SHELL_BLINK_CMD symbol.
Saves around 300 bytes when command is disabled.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Nick Ward 695a0ac503 drivers: gpio: shell: add info command
Usage:
gpio info [device]

The new command prints gpio controller information
for a specific device if specified or if no device is specified
it prints out all controller information ordered by line name.

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>
2023-11-17 12:41:14 +01:00
Nick Ward 0df794e316 drivers: gpio: shell: improve tab complete/suggestion support
This commit implements this enhancement:
https://github.com/zephyrproject-rtos/zephyr/issues/63018

The forms of the gpio commands are now:

        gpio conf device pin ol0
        gpio set device pin 1
        gpio get device pin
        gpio blink device pin

Device name and pin subcommands now are
suggested/completed when tab is used.

Pin names are suggested with numbers and line names if
available from the gpio controller’s Devicetree node.

GPIO pin command is now limited to pins that are not assigned
as reserved.

Signed-off-by: Nick Ward <nix.ward@gmail.com>
2023-11-17 12:41:14 +01:00
Jakub Michalski 9265d2de0c drivers: gpio: add rzt2m gpio driver
Add Renesas rzt2m gpio driver with basic functionality.
It supports pin mode configuration and writing/reading to/from gpio ports.
Includes dts changes to build blinky sample.

Signed-off-by: Jakub Michalski <jmichalski@internships.antmicro.com>
2023-11-15 11:41:35 +01:00
Daniel Schultz fbd2b84e0e drivers: gpio: davinci: Add pinctrl
Add pinctrl to the Davinci GPIO driver to allow muxing pins dirctly
in this driver.

Also aligned the macro backslashes as line continuation character at
the end of each line with each at the same position and removed the
GPIO_DAVINCI_DEVICE_INIT macro which seems to be not used.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
2023-11-13 09:42:11 +01:00
Bartosz Bilas 0689d3dc11 drivers: gpio: add driver for AD5592
Add MFD subdriver for the built-in GPIO controller
in AD5592 chip.

Signed-off-by: Bartosz Bilas <b.bilas@grinn-global.com>
2023-11-08 10:07:41 +01:00
Mike J. Chen 054f9d7a82 drivers: gpio: gpio_mcux_lpc: fix bug disabling pulls
If the gpio had pull previous enabled, but new config
request wants the pull disabled, the code was failing
to clear the previous pull setting.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-11-07 09:54:15 +01:00
Anas Nashif a08bfeb49c syscall: rename Z_OOPS -> K_OOPS
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 1a9de05767 syscall: rename Z_SYSCALL_DRIVER_ -> K_SYSCALL_DRIVER_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 9c4d881183 syscall: rename Z_SYSCALL_ to K_SYSCALL_
Rename internal API to not use z_/Z_.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
Anas Nashif 4e396174ce kernel: move syscall_handler.h to internal include directory
Move the syscall_handler.h header, used internally only to a dedicated
internal folder that should not be used outside of Zephyr.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-11-03 11:46:52 +01:00
TOKITA Hiroshi 3292c36115 drivers: gpio: Add GPIO driver for Renesas RA series
Add initial support for Renesas RA GPIO.

To avoid complicating the initial code for supporting the SoC,
I have implemented only the bare minimum for now.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-11-01 10:56:46 +00:00
Yong Cong Sin df2c0681d3 devicetree: encode multi-level interrupt number in C devicetree magic
The multi-level encoding of the interrupt number currently
happens in the `gen_defines.py`, which is called in the
`dts.cmake` module after `kconfig.cmake`. However, the number
of bits used by each level is defined in Kconfig and this means
that `gen_defines.py` will not be able to get that information
during build.

To fix this, do the multi-level encoding in C devicetree macro
magic instead of the python script. This ticks one of a
long-standing TODO item from the `gen_defines.py`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Yong Cong Sin d7302f417e irq: relocate multi-level irq out of irq.h
Relocate multi-level interrupts APIs out of `irq.h` into
a new file named `irq_multilevel.h` to provide cleaner
separation between typical irq & multilevel ones.

Added preprocessor versions of `irq_to_level_x` as `IRQ_TO_Lx`.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2023-10-30 11:43:39 -04:00
Bartosz Bilas 66f5fce68f drivers: mfd: gpio: adjust init priority
Take into account the SPI bus init priorirty
that can be used for MFD drivers.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2023-10-26 09:50:31 +02:00