Commit graph

1335 commits

Author SHA1 Message Date
Robert Hancock ca3a3c1783 drivers: gpio: xlnx: Add interrupt support
Added support for interrupt-driven GPIO for this driver if an interrupt
line is defined. Note that interrupt support is optional in the GPIO
core so it may or may not be present.

The core provides a single state change notification whenever any line
changes state on a given bank, so we need to check the states of the
lines ourselves to determine what has actually changed.

Also, the driver treats the first and second GPIO banks as mostly
separate devices, but a single interrupt is shared by both banks, so the
ISR ends up being registered by the first bank which also triggers
handling on the second bank if required.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-26 21:32:23 -04:00
Robert Hancock 1f59cd26be drivers: gpio: xlnx: Fix property reading for second channel
The properties being read for the all-inputs and all-outputs flags in
the driver for the second GPIO channel did not match the ones listed in
the DT schema or the existing device tree files. Fix this.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
2023-05-26 21:32:23 -04:00
Gerard Marull-Paretas 76412f6aa0 drivers: gpio: npm6001: select MFD and adjust init priority
Make sure MFD driver for nPM6001 gets built, and, that GPIO driver comes
later in the init sequence.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-24 19:39:55 -04:00
Andy Sinclair 29d6149ca6 drivers: gpio: npm1300: Added status readback
Status readback has been added in the latest silicon revision.
.port_get_raw and .port_toggle_bits are now supported

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-05-22 10:15:46 +02:00
Mulin Chao 9da9c90639 intc: miwu: npcx: improve interrupt latency of miwu input events
To reduce the interrupt latency of MIWU events, the driver prepares a
dedicated callback function item list for each MIWU group in this PR. We
needn't check the MIWU table and group of the event in ISR. And the
maximum item number of each list is also limited to 8. After applying
this PR, the interrupt latency reduces to ~10us consistently.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2023-05-17 09:48:54 +02:00
Manimaran A 79ee5a876f drivers: gpio: Microchip MEC172x GPIO driver glitch fix
A glitch was observed if a GPIO PIN was configured to a
non-default state by ROM and then Zephyr programs the pin
for the same configuration. Root cause is GPIO hardware
implementing two output bits for each pin. The alternate
output bit is in the pin control register and is r/w by
default. The other bit exists in the GPIO parallel ouput
register and is read-only by default. The hardware actually
reflects the pin's output value into both bits. The fix is
to configure the pin with alternate output bit read-write
and the last step is to disable alternate output which
enabled read-write of the parallel bit. GPIO API's can
then use the GPIO parallel out registers. Add logic to
return an error from the GPIO interrupt configure API if
a pin is not configured as an input. Hardware only performs
interrupt detection if the input pad is enabled.
Hardware supports a pin being configured for both input
and output. Applications should add the GPIO_INPUT flag
to all pin configuration requiring interrupt detection.
The interpretation of input and output flags for the
get configuration API appears to be only one of the
flags can be set. Please refer to the GPIO driver tests.
Updated GPIO interrupt configure to clear the input pad
disable bit due to interrupt detection HW is connected
only to input side of pin.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 18:52:44 -04:00
Benedikt Schmidt ecac441171 drivers: gpio: implement GPIOs in ADS114S08
Implement GPIO exander within the ADC ADS114S08.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-05-11 12:04:15 -04:00
Andriy Gelman 7ed4531dbb dts: arm: infineon: xmc4xxx: Add Port 14/15 to device tree
Add Port 14/15 to device tree. These ports can only be configured as input.
Error out in gpio driver if user sets them as output.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2023-05-02 12:34:55 +02:00
Gerard Marull-Paretas c4c5f57d59 drivers: all: imx: remove conditional support for pinctrl
The iMX platform always uses pinctrl, there's no need to keep
extra macrology around pinctrl. Also updated driver's Kconfig to `select
PINCTRL`.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Gerard Marull-Paretas 989d103d53 drivers: all: mcux: remove conditional support for pinctrl
The MCUX platform always uses pinctrl, there's no need to keep extra
macrology around pinctrl. Also updated driver's Kconfig options to
`select PINCTRL` (note that some already did).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Krzysztof Boronski df7f10422e boards: arm: efr32bg27_brd2602: Initial support
Adds initial support for efr32bg27_brd2602 - Thunderboard-style board.
Supported features are:
* counter
* gpio
* uart

Signed-off-by: Krzysztof Boronski <kboronski@antmicro.com>
2023-04-21 12:55:06 +02:00
Gerard Marull-Paretas 1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Tim Lin 491e3e6477 ITE: drivers/gpio: Add gpio_ite_it8xxx2_v2 driver
This driver is made for it82xx2 series.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2023-04-19 03:48:38 -04:00
Daniel DeGrasse 36cc74e7e8 drivers: gpio: gpio_mcux_lpc: add support for module interrupts
On iMX.RT devices, the number of GPIO pins exceeds the maximum of
64 that the PINT interrupt controller can support. Therefore, two
interrupt lines are now shared between the GPIO modules.

This patch allows the user to set the interrupt source for a GPIO
peripheral. For most LPC devices, this will always be the PINT. For some
RT devices, the PINT cannot use pins on GPIO modules other than 0 and 1
as input, and thus the INTA and INTB sources should be used.

Since Zephyr does not support sharing these interrupt between all GPIO
controllers, the user must configure a subset of all GPIO controllers to
use the shared module interrupts. An example of how to do so is provided
for the RT595 EVK.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Daniel DeGrasse b8a99a27cc drivers: gpio: gpio_mcux_lpc: remove PINT code
Remove PINT management code from the LPC GPIO driver, as this code is
now contained within the PINT interrupt controller driver, which exposes
an interface to install interrupt callbacks.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2023-04-18 16:14:57 -05:00
Andy Sinclair 0d68c86c95 drivers: gpio: npm1300: Initial driver for nPM1300 PMIC
Initial GPIO driver for NPM1300 PMIC

Signed-off-by: Andy Sinclair <andy.sinclair@nordicsemi.no>
2023-04-17 10:14:40 +02:00
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
Mahesh Mahadevan 174824f1cb drivers: gpio: Update NXP GPIO driver for the updated IP Block
1. Move the GPIO mux setting to the soc layer. The GPIO MUX
value may vary based on the SoC Family
2. Enable the digital input buffer if available

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-04-06 14:14:11 -05:00
Sung-Chi Li 532bd562fa drivers: gpio: numicro: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on numicro GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li db379eee6f driver: gpio: npcx: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on npcx GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li ab77ce0cb8 drivers: gpio: stm32: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on stm32 GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li 1f7b0c440d drivers: gpio: it8xxx2: Implement enable/disable pin interrupt
Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on it8xxx2 gpio driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li 21b2d3aa63 drivers: gpio: Implement pin interrupt enable and disable
Implement the driver method pin_interrupt_enable and pin_interrupt_disable.
This commit fixes getting the get_pending_int by updating the interrupts
field in the gpio_emul_data filed when interrupt is triggered. Also,
introduces a new filed enabled_interrupts to better simulate the
behavior of the interrupt pending and whether the interrupt is
enabled/disabled.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Sung-Chi Li b78208960d drivers: gpio: Add APIs for enabling/disabling interrupt
Add pin_interrupt_enable and pin_interrupt_disable in gpio_driver_api,
and add corresponding APIs in gpio.h for application to enable/disable
an interrupt without reconfiguring again.
This CL also Create a new Kconfig option for this feature.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
2023-04-06 11:44:07 -04:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Pawel Czarnecki a56ca2df97 drivers: gpio: gecko: add support for efr32xg24
Add defined() check for EFR32MG24

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2023-04-04 13:34:45 +02:00
Pieter De Gendt cd6fe580b0 drivers: gpio: Add NXP SC18IM704 GPIO support
Implement external GPIO controller driver with NXP's SC18IM704 device.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-03 20:02:51 +02:00
Kumar Gala d82175eadd gpio: fix armclang compiler warnings with is*() functions
We get compile warnings of the form:

error: converting the result of
'<<' to a boolean; did you mean
'((__aeabi_ctype_table_ + 1)[(byte)] << 28) != 0'?
 [-Werror,-Wint-in-bool-context]
                if (!isprint(byte)) {
                     ^

Since isprint (and the other is* functions) return an int, change check
to an explicit test against the return value.

Signed-off-by: Kumar Gala <kumar.gala@intel.com>
2023-04-01 12:31:58 -04:00
Henrik Brix Andersen c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Henrik Brix Andersen e440b023dd drivers: gpio: test: use CONFIG_GPIO_INIT_PRIORITY for init priority
Use the dedicated CONFIG_GPIO_INIT_PRIORITY for vnd,gpio test driver
initialization priority.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 13:20:03 +00:00
Henrik Brix Andersen 2c5d7d78dd drivers: gpio: test: add driver config and data structs
Add config and data structs to the vnd,gpio test driver as these are
required by the GPIO API.

Fixes: #55884

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-27 13:20:03 +00:00
Benedikt Schmidt 1009b9152a drivers: gpio: remove doxygen comments in MCP23S17 driver
Remove the doxygen comments in the driver
for the MCP23S17.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-03-24 09:22:32 +01:00
Benedikt Schmidt a8b2ff88de drivers: gpio: remove not required header
Move the content of the header for the MCP23S17
into the source file.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-03-24 09:22:32 +01:00
Gerson Fernando Budke c77c1cc197 drivers: gpio: sam: Update to use clock control
This update Atmel SAM gpio and pinctrl drivers to use clock control
drivers.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2023-03-21 14:12:25 -07:00
Marc Desvaux 0548584d4d drivers: gpio/exti: stm32: Use st,stm32g0-exti compatible
remove all #ifdef CONFIG_SOC_SERIES_STM32xx
before to add a st,stm32g0-exti compatible
added to the matching targets:
C0/G0/U5/L5/MP1:

Signed-off-by: Marc Desvaux <marc.desvaux-ext@st.com>
2023-03-21 09:37:30 +01:00
Armin Brauns 01e8b3445e drivers: gpio: mcp23xxx: add support for reset pin
This allows the device to be reset to a known state before initialization.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns 07af23c1c6 drivers: gpio: mcp23xxx: support single-edge interrupts
An interrupt is triggered for every edge, but only the desired edges cause
a callback to be called.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns 0db9785892 drivers: gpio: mcp23xxx: support pin interrupts
No single-edge interrupts for now, since they are not supported in
hardware.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Armin Brauns 1a566e6a7f drivers: gpio: mcp23xxx: fix typo
Should be the Output LATch register. "IK" is one key away from "OL" on
QWERTY keyboards.

This define wasn't actually used anywhere.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-20 10:43:12 +01:00
Fabio Baltieri 2815f96440 drivers: move gpio_keys from gpio to input
Port the gpio_keys_zephyr driver from the gpio subsystem with a
dedicated API to the input subsystem reporting input events.

Move the test as well, simplify the cases a bit since the API is simpler
now.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-03-14 17:15:09 -04:00
Benjamin Björnsson cc03cb3790 drivers: gpio: gpio_stm32: Add STM32C0 Support
Add STM32C0 support to gpio driver.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-14 17:35:37 +00:00
Manojkumar Subramaniam f75c5b8c3b drivers: gpio: sifive: Update to use the available common IRQ API and
remove obsolete code.

Fixes issue: #20338

Signed-off-by: Manojkumar Subramaniam <manoj@electrolance.com>
2023-03-10 07:59:42 -06:00
Nazar Palamar bc638f38db drivers: gpio: Add Infineon CAT1 GPIO driver
Added initial version of Infineon CAT1 GPIO driver.
Added initial version of binding file for Infineon CAT1 GPIO driver.

Signed-off-by: Nazar Palamar <nazar.palamar@infineon.com>
2023-03-01 11:44:57 +01:00
Benedikt Schmidt ecafade8ae drivers: gpio: add driver for PCAL6416A
Generalize the driver for PCAL6408A into a more abstract base
and reuse this abstraction to implement a driver for
PCAL6416A.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-28 20:09:19 -05:00
Benedikt Schmidt fd44b2eb2d drivers: gpio: add driver for BD8LB600FS
Add a driver for BD8LB600FS

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2023-02-27 06:44:23 -05:00
Lucas Tamborrino 1eda399c44 drivers: gpio: esp32: fix reset interrupt status on new config
The interrupt status of the GPIO was not cleared when a new
interrupt configuration was set. This prevents the driver from
passsing all the gpio tests.

Fixes #54833

Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
2023-02-27 11:35:26 +01:00
Purdea Andrei 38f554ef4f drivers: gpio_rpi_pico.c: add support for single-ended IO
Note: RP2040 can support single-ended IO, by setting the GPIO_OUT
register to a constant value, and then changing the GPIO_OE register
instead, when the output has to change. To do this, the output-setting
functions need to know which pins have been configured as single-ended,
and for that reason the data structure has been extended to include
this information.

Another change is the PR, is that setting of the pull-ups/pull-downs
now applies to both inputs and outputs as well. Previous solution was
wrong, because if the user wanted to set up an input with a pull
resistor enabled, and then reconfigure it to an output without any
pulls, then the pulls remained in place for the output. Now pulls
are correctly set based on the gpio flags for outputs too, and this
is especially useful for single-ended outputs too.

Signed-off-by: Purdea Andrei <andrei@purdea.ro>
2023-02-26 18:38:08 -05:00
Gerard Marull-Paretas d925c660ed drivers: pinmux: stm32: drop driver
Drop STM32 pinmux driver in favor of pinctrl. Some definitions located
in pinmux headers were used by the pinctrl driver, so they have been
moved there.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-02-23 16:56:04 -05:00
Alexander Wachter 244f623f8c drivers: gpio: emul: replace mutex with spinlock
Replace all mutex with spinlocks to make the driver usable
from ISRs.

Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
2023-02-22 21:48:30 +01:00
Dino Li e442a15c32 gpio/it8xxx2: do not set flag if register does not exist
Since not all GPIOs support voltage selection, voltage flag
is only set if voltage selection register is present.

fixes: #54366

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-02-11 08:20:40 +09:00
Siyuan Cheng 1a5676d338 ARC: boards: hsdk: fix cy8c95xx I2C GPIO port init
cy8c95xx I2C GPIO support was broken in commit 4b30008 due
to wrong i2c bus and addr were wrote during GPIO_PORT_INIT.
Now fix this issue.

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-02-10 10:19:19 +01:00
Fabio Baltieri 47874e2f6e gpio: gpio_keys_zephyr: drop one instance of num_keys
The driver currently stores num_keys in both config and data. Drop the
data copy, save 4 bytes of RAM.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-06 10:06:36 +01:00
Fabio Baltieri 5d9c65fe7f gpio: gpio_keys_zephyr: add missing gpio initialization
The driver is missing the GPIO initialization entirely, meaning that
flags like PULL_UP are not currently being applied. Add the missing
call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-02-01 09:25:40 +00:00
Fabio Baltieri 48a6f160f2 gpio: gpio_keys_zephyr: fix build warning with assertion disables
Fix two "unused variable" warnings when compiling with assertions
disabled. The two variables are used only in the __ASSERT() call.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-31 06:08:02 -05:00
Siyuan Cheng 59130b11dc driver: gpio: Add pin_configure api for creg_gpio driver
Update pin_configure api for creg_gpio driver

Signed-off-by: Siyuan Cheng <siyuanc@synopsys.com>
2023-01-27 19:52:25 -05:00
Henrik Brix Andersen cb274e6a3c drivers: gpio: add GPIO hog support
Add support for automatically configuring GPIO hogs defined in the
devicetree during system initialization.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-01-27 14:38:52 -08:00
Andrei Emeltchenko 63f360c7fc drivers: gpio_nct38xx_port: Fix checking wrong return
Fix error check for previous function return code.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2023-01-21 21:27:38 -05:00
Ruibin Chang d7f482a022 ITE driver/gpio/it8xxx2: add kscan pins gpio driver
Add kscan pins gpio driver for KSI[7:0], KSO[15:0] pins that
they can be configured to gpio mode. These pins registers address,
bit fields and function are different from GPIO group, so I create
a new compatible driver for these pins.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2023-01-14 09:22:39 +01:00
Manuel Arguelles 492e196e8a drivers: gpio: rename S32 to NXP S32
Following updates previously done for other drivers, rename all
occurrences of S32 to NXP S32 to avoid ambiguity.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2023-01-04 16:51:38 +01:00
Al Semjonovs 211e4d276e gpio: Add driver support for software based gpio debounce
Software based GPIO debounce driver implementation.

Signed-off-by: Al Semjonovs <asemjonovs@google.com>
2023-01-04 10:36:00 +01:00
Antonio Tessarolo e614a38cbd nxp/imx: fix imx6sx gpio pull up-down configuration
To enable pin pull up/down with the new pinmux APIs bit 13 must be set.

Signed-off-by: Antonio Tessarolo <anthonytexdev@gmail.com>
2023-01-03 10:46:52 -06:00
Gerard Marull-Paretas 4d9b6c4e2e drivers: gpio: sx1509b: add multi-instance support
The driver only supported one instance. Update it to support multiple
instances.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-12-28 18:47:25 +01:00
Daniel DeGrasse 21c4957cde drivers: gpio: fix gpio-reserved-ranges handling in MCUX iGPIO driver
Fix handling of gpio-reserved-ranges within MCUX iGPIO driver, to ensure
that the configuration IDX will be correctly calculated for pins where
multiple reserved ranges are present on the GPIO controller

Fixes #52506

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-12-22 11:05:52 +01:00
TOKITA Hiroshi bafbc75270 drivers: gpio: sifive: Reset iof_en and iof_sel on init
If the bootloader changes iof_en/iof_sel settings before zephyr launching,
GPIO does not behave correctly.
These values should be 0 initially, Initialize to 0 at GPIO initialize.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2022-12-21 12:19:27 +01:00
Pawel Czarnecki 83b9e53bb6 dts: gpio: silabs: make peripheral-id optional
peripheral-id property should be eventually removed entirely.
For now set it as optional and allow skipping the usage
in GPIO driver.

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Paweł Czarnecki dc153b3bcb drivers: gpio: gecko: stop using deprecated function
change GPIO_IntConfig to GPIO_ExtIntConfig

Signed-off-by: Paweł Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki 067f3766da drivers: gpio: gecko: enable GPIO clock
Enable GPIO clock so that other drivers could
configure their I/O pins

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Pawel Czarnecki 0892293b58 drivers: gpio: gecko: initialize driver earlier
Common GPIO driver needs to be initialized before e.g UART driver
to ensure correct GPIO clock configuration when configuring UART pinout

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-12-20 22:50:19 +01:00
Erwan Gouriou 428700f709 drivers: gpio: stm32: Keep port clock in input configuration
When pin is configured in input mode, clock is also required.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-12-12 15:50:21 -05:00
Andriy Gelman a9481bdbe1 drivers: gpio_xmc4xxx: Use interrupt controller for edge/level interrupts
Use the XMC4XXX interrupt controller for edge/level gpio interrupts.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-12-12 10:51:29 +01:00
Duong Vu Nam b24f4625f0 arch: support nocache for Cortex-R52
Config NOCACHE_MEMORY depend on ARCH_HAS_NOCACHE_MEMORY_SUPPORT. Enable
ARCH_HAS_NOCACHE_MEMORY_SUPPORT for Cortex-R52 to run NXP S32Z/E with
nocache attibute.

Enable nocache in each driver use it.

Signed-off-by: Duong Vu Nam <duong.vunam@nxp.com>
2022-12-12 10:39:31 +01:00
Ravik Hasija 96da6f2234 driver: dw: Use base_addr variable to set dir.
Change Summary:
Update Base addr to set direction to use Aligned IP base address instead
of Port Base Address. Port Base Address + offset to direction register
will set incorrect value for Port B,C & D. For ex: In cases when more than
1 port is configured on the same IP, the DTS node for port B will start
at offset 0xC. Calculating the port using Port Base will yield offset of
PORTB DIR register which is at offset 0x10 from Aligned Base, and as a
result will result in setting DIR register of PORTC instead.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Ravik Hasija 7ba1925d97 driver: gpio: Fixing Pin Direction Setting.
Change Summary:
Moving the setting of Pin direction before setting/clearing the pin
configured as output for the change to correctly take place.

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-12-11 20:37:33 -05:00
Filip Brozovic 8577bb3e84 drivers: gpio: add driver for nuvoton numicro
This commit adds a GPIO driver for the Nuvoton NuMicro family
of processors.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
2022-12-08 18:46:33 +01:00
Maciej Zagrabski e31c0d0ff4 Revert "drivers: gpio: STM32U5 independant IO supply"
This is already fixed in zephyrproject-rtos/hal_stm32#147.

This reverts commit 5b4ad9127f.

Signed-off-by: Maciej Zagrabski <mzi@trackunit.com>
2022-12-08 09:56:35 +00:00
Bartosz Bilas e077fb73ec drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt
`spi_is_ready` function is being deprecated in favor of
`spi_is_ready_dt` so let's replace the old usage in the tree.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-12-07 09:40:23 -06:00
Michał Barnaś 23a04b8b0a gpio: cleanup the nct38xx driver
Reorganize includes and fix the indentation of code.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś 59766b52be gpio: add support for get_config and get_direction in nct38xx
This commit adds support for get_config and get_direction functions
for the nct38xx IO expander family.
Also applies the clang-format changes.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Michał Barnaś c11af96135 gpio: fix the nct38xx driver
This commit fixes the comment and adds the missing assignment of
return value from i2c read byte command in the nct38xx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-12-06 10:10:36 -05:00
Mulin Chao 0893ca8c2f driver: gpio: npcx: correct the usage of npcx voltage flags
In npcx ec series, two detection levels, 3.3V (default) and 1.8V are
supported during gpio configuration. But the current implementation
always selects default detection level whether NPCX_GPIO_VOLTAGE_1P8 is
set. This PR is a fix for this issue.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-11-28 09:56:33 +00:00
Dawid Niedzwiecki 2d93f03c25 driver: gpio: rt1718s: Add RT1718S GPIO driver
RT1718S is an i2c-based TCPC chip that supports 3 additional GPIOs.
The pins can be used for USB-C operations e.g. handling FRS, but they
can also work as usual GPIOs.

Add a driver for the RT1718S GPIO and a handler for an alert signal from
the chip. The handler reads the alert register once asserted and calls
the GPIO interrupt handler if needed(Vendor-defined alert).

gpio_rt1718s.c file and "richtek,rt1718s" node collect common properties
and data for all RS1718S functionalities. The file can be extended for
TCPC driver. rt1718s.h file also defines inline functions with i2c
operations common for all drivers. The common header and source files
can be moved to tcpc directories once the tcpc driver is added since it
is the main functionality.

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
2022-11-28 10:48:53 +01:00
Gerard Marull-Paretas eaadea5508 drivers: gpio: npm6001: initial driver
Add GPIO driver for the GPIO controller embedded in the nPM6001 PMIC.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-22 11:05:19 +01:00
Jason Yuan 6ff0b79d74 drivers: gpio: Add TCA6424A driver
The driver supports 24 gpio pins which are numbered sequentially from
0 to 23.

Signed-off-by: Jason Yuan <jasonyuan@google.com>
2022-11-18 10:10:11 +01:00
Armin Brauns 53a3ff0dff drivers: mcp230xx: make config struct const
`struct device::config` is a `const void *`, so this struct does not need
to be mutable.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Armin Brauns 1cfd54db7e drivers: mcp230xx: fix for multiple instances
Parts of the macro used `inst`, others `n` for the instance number; only
`n` was actually defined (so `inst` expanded to the empty string, causing
name errors with more than one instance).

Unify everything to `inst`.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Armin Brauns 6468a4458b drivers: mcp230xx: formatting
It's a formatting cleanup. Not much to explain here, but CI requires a body
text.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2022-11-15 19:10:14 -05:00
Gerard Marull-Paretas b1552001bf drivers: gpio: npcx: fix usage of deprecated voltage macros
The NPCX driver did use deprecated voltage macros. Define vendor
specific flags instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Gerard Marull-Paretas 109d4e4e78 drivers: gpio: it8xxx2: fix usage of deprecated voltage macros
The pin get function was using deprecated macros. Note that the set
implementation already uses vendor specific flags.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-11-11 11:00:26 +01:00
Daniel Skatt a94263784b gpio_mcp23sxx_fix: spi_msg and multiple inst
Fixed how data is read in mcp23sxx_read_port_regs
The data is now stored in an array to get the
actual data from spi

Signed-off-by: Daniel Skatt <daniel.skatt@gmail.com>
2022-11-09 15:55:39 -05:00
Daniel Skatt f921ff1fc8 gpio_mcp23sxx_fix: spi_msg and multiple inst
Changed SPI message from 2 seperate to 1
Fixed problem using multiple instances

Signed-off-by: Daniel Skatt <daniel.skatt@gmail.com>
2022-11-09 15:55:39 -05:00
TOKITA Hiroshi c5c0a1ae75 drivers: gpio: gd32: add dependency on the EXTI
The GPIO pin interruption depends on the EXTI.
Add "select" to clarify the dependency.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2022-11-09 06:26:41 -05:00
Dat Nguyen Duy da04197fdf drivers: gpio_s32: expose gpio_utils.h
Expose gpio_utils.h to follow updates in #51526

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Dat Nguyen Duy 6664953f12 drivers: gpio: support GPIO input with interrupt for NXP S32Z27
Add support input interrupts for GPIO pins on NXP S32Z27
SoC. The driver will convert GPIO pin to respective
interrupt line that will be processed by External
Interrupt Controller.

Signed-off-by: Dat Nguyen Duy <dat.nguyenduy@nxp.com>
2022-11-04 17:44:08 -04:00
Guy Morand a124203929 drivers: gpio: gpio_mcux_lpc: Use arbitrary amount of IRQ
Zephyr implementation is limited to 4 IRQ per GPIO bank when up to 8 is
theoritically possible.

It is now possible to use until 8 IRQ per GPIO bank. This can be
achieved with minimal effort in a device tree overlay:

&gpio0 {
	interrupts = <4 2>,<5 2>,<6 2>,<7 2>,<32 2>,<33 2>;
};

&gpio1 {
	interrupts = <34 2>,<35 2>;
};

Signed-off-by: Guy Morand <guy.morand@bytesatwork.ch>
2022-11-02 10:34:00 +01:00
Guillaume Gautier 5b4ad9127f drivers: gpio: STM32U5 independant IO supply
Fix the enabling of the independant IO supply.
Function LL_PWR_EnableVddIO2 is called LL_PWR_EnableVDDIO2 on U5.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2022-11-01 12:00:25 +01:00
Balaji Kulkarni 7f1a5cce12 drivers: gpio: expose gpio_utils.h to external GPIO drivers
Expose "gpio_utils.h" header for external GPIO drivers.

Fixes #48609.

Signed-off-by: Balaji Kulkarni <balaji.kulkarni92@gmail.com>
2022-10-27 15:38:51 +02:00
Nick Kraus 48fce027a0 drivers: gpio: Add Open-Drain Support
Adds open drain support to atmel,sam-gpio drivers, by writing to the
PIO_MDER or PIO_MDDR registers during gpio configure.

Signed-off-by: Nick Kraus <nick@nckraus.com>
2022-10-19 16:06:40 +02:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Manuel Arguelles 48c4b93b12 drivers: gpio: add support for NXP S32 devices
Implement GPIO driver minimal API's for NXP S32 devices, based on SIUL2
peripheral. SIUL2 allows to control the pins electrical characteristics
such as internal pull resistors, pin direction and more.

GPIO driver API's for interrupts will be implemented in a future patch.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-14 09:51:14 +02:00
Manuel Arguelles e7384974c8 drivers: gpio: xlnx: add missing headers
Add missing headers for sys_* and IRQ related API's.

Signed-off-by: Manuel Arguelles <manuel.arguelles@nxp.com>
2022-10-12 17:41:11 +09:00
Anas Nashif 3d85ae37b6 arm: add missing includes
Add missing includes that were previously included indirectly.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-10-11 18:37:53 -04:00
Gerard Marull-Paretas 1992699e07 drivers: gpio: it8xxx2: add missing chip_chipregs.h/soc_common.h
Register definition header was missing, SoC common header as well (for
ite_intc_get_irq_num).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas 4649e2347e include: add missing soc.h include
Some SoCs define stuff in soc.h, used in drivers or SoC code. Note that
soc.h is not introduced here as a catch-all header. soc.h optimizations
or removal is out of the scope of this patch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas 6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas acc8cb4bc8 include: add missing irq.h include
Some modules use the IRQ API without including the necessary headers.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas f7a5b47dff include: add missing devicetree.h include
Some files make use of DT APIs without including devicetree.h.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas 34a6848887 include: add missing arch/cpu.h include
The sys* ops like sys_clear_bit are indirectly included via arch CPU
header. Other stuff like find_msb_set end up included via this header as
well.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
David Leach 9e5ee5d998 drivers: gpio: remove pinmux dependency in lpc11u6x Kconfig
Previous commit removed pinmux from the platform but neglected to
remove the dependency in this Kconfig resulting in build failures
when target application configures GPIO support.

Fixes #51144

Signed-off-by: David Leach <david.leach@nxp.com>
2022-10-11 08:25:46 -05:00
Anisetti Avinash Krishna 8df2568a20 soc: x86: Clean up GPIO related defines
Clean up and refactor x86 SoC headers in preparation of adding
new platforms in the future.

Signed-off-by: Anisetti Avinash Krishna <anisetti.avinash.krishna@intel.com>
2022-10-10 19:17:03 +03:00
Gerard Marull-Paretas d1686dfbfb drivers: gpio: it8xxx2: log error instead of printing
printk must not be used to log, we have log API for that.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-06 15:35:00 +02:00
Andrei Emeltchenko 005a4d8a31 gpio: Fix gpio_manage_callback() logic
gpio_manage_callback() returns -EINVAL if it could not remove
callback. However if the list is empty success is returned when trying
to remove callback.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2022-10-04 14:10:05 +00:00
Josia Strack ba7eb1025a drivers: gpio: Add driver for pcf8574
Adds a driver for pcf8574 via i2c.

Signed-off-by: Josia Strack <josia.strack@ithinx.io>
2022-10-03 13:56:32 +02:00
Pieter De Gendt ff8a90b1de drivers: gpio: Add SDL emulated GPIO support
This commit adds a driver to simulate GPIO state and interrupts
using the keyboard when using SDL.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Pieter De Gendt bd71698a66 drivers: gpio: pca953x: select I2C
Select I2C instead of depending on it, following upstream policy.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2022-10-03 10:12:03 +02:00
Dino Li db50a7aca7 drivers: gpio: it8xxx2: add support for GPIO_DISCONNECTED flag
This change was made to support the flag.
fixes: #50681

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2022-09-29 14:33:53 +00:00
Sylvio Alves 82bd341018 drivers: gpio: esp32: fix error when using input only pins
Input pins in ESP32 (34 to 39) have no pull-up / pull-down internally.
Current behavior is that gpio driver fails when "disabling it", which
should not happen. It need to fail only when enabling this feature.

Fixes #50615

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-28 07:52:29 +00:00
Daniel DeGrasse 5980aa0196 drivers: gpio: gpio_mcux_igpio: handle gpio-reserved-ranges property
Add code to handle parsing the gpio-reserved-ranges property present on
iMX GPIO controllers, so that gpio controllers with gaps in their pin
indexing can still have pinmux settings applied correctly.

Fixes #50142

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-09-21 13:50:26 -05:00
Erwan Gouriou e1cb0845b4 drivers: gpio: stm32: Apply GPIOG specific code to U5 series
In STM32U5 as well it is required to enable VDD before use.
Difference is that U5 enables this under PWR_SVMCR_IO2SV flag.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2022-09-20 10:00:02 +00:00
Jeremy Bettis bf845a273b gpio_emul: Fail at build time if ngpios is too big
Add BUILD_ASSERT to check max val of ngpios. If someone sets ngpios to
more than 32, and acts on pin 32 or higher, memory corruption will
result. This is only a problem with the emulator, real hardware
will have limits that are probably much smaller.

Signed-off-by: Jeremy Bettis <jbettis@google.com>
2022-09-16 09:02:01 +01:00
Sylvio Alves b801a83d92 drivers: gpio: esp32: fix missing rtcio pin mapping
PR #49550 missed adding proper RTCIO pin mapping
in a few rtcio functions calls, which causes board
to crash. This fixes it.

Closes #50238

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-09-15 17:26:18 +01:00
Gerard Marull-Paretas 8081d7f2a4 drivers: s/DT_CHILD(DT_DRV_INST(n), ...)/DT_INST_CHILD(n, ...)
Use instance version of DT_CHILD when possible.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-06 08:45:25 -07:00
Gerard Marull-Paretas 455b95b6c2 drivers: gpio,pinctrl: gd32: use clock control API
Use the clock control API to enable peripheral clocks. Note that both
GPIO and pinctrl drivers are updated at once since they share some IP
blocks.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-09-06 09:57:25 +02:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Kumar Gala 3cc8183c52 drivers: gpio: Cleanup Kconfig.test
Use DT_HAS_VND_GPIO_ENABLED for GPIO_TEST similar to what we
do for SPI_TEST, I2C_TEST, etc.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-09-01 10:25:57 +02:00
Andrzej Kaczmarek 6af5533ca5 drivers: gpio: Add driver for smartbond
This adds GPIO driver for Renesas SmartBond(tm) family.

Driver supports pin configuration (input/output) and interrupts on edge.
Interrupts on level are not supported by hardware.

Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@codecoup.pl>
Signed-off-by: Ben Lauret <ben.lauret.wm@renesas.com>
2022-08-31 20:32:03 +02:00
Gerard Marull-Paretas 9c8cd560f0 drivers: gpio: xlnx_ps: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas 1bc794c7d4 drivers: gpio: nct38xx: use DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP
Simplify driver by using DT_INST_FOREACH_CHILD_STATUS_OKAY_SEP (avoids
both DT_DRV_INST and auxiliary macro).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-30 16:19:57 +02:00
Gerard Marull-Paretas 5aa5af8ec2 drivers: gpio: gd32: use reset API
Use the reset API to restore the peripheral to its initial state before
configuring it.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-08-29 10:30:49 +02:00
Sylvio Alves 3c50237460 drivers: gpio: esp32: fix config function to allow changes
Current implementation misses disabling input/output mux
once GPIO has already been configured. It means that after 1st
configuration, if GPIO is reconfigured, it won't disable previous
definitions, causing unexpected behavior.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-08-26 21:27:50 -04:00
Gerard Marull-Paretas ac89fce3be drivers: gpio: sx1509b: select I2C
Select I2C instead of depending on it, following latest upstream policy.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-26 10:06:43 -07:00
Ravik Hasija 4a18e6f581 drivers: gpio: Updating driver to Enable Multiple Interrupts.
Change Summary:
- Updating GPIO_CFG_IRQ define to enable multiple interrupts to
  accomodate for IP configuration where each pin when interrupted
  can trigger CPU interrupt.
- Removing gpio_dw_unmask_int define as it is NO OP

Signed-off-by: Ravik Hasija <ravikh@fb.com>
2022-08-22 19:38:37 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Kumar Gala 5851a7b7de drivers: gpio: xlnx_ps: Fix compiler warning
Recent change to constify struct devices pointers introduced a
compile warning in gpio_xlnx_ps driver.  Update driver to fix a
case that got missed in the constification that fixes the warning.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-20 11:32:37 -05:00
Gerard Marull-Paretas e0125d04af devices: constify statically initialized device pointers
It is frequent to find variable definitions like this:

```c
static const struct device *dev = DEVICE_DT_GET(...)
```

That is, module level variables that are statically initialized with a
device reference. Such value is, in most cases, never changed meaning
the variable can also be declared as const (immutable). This patch
constifies all such cases.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Gerard Marull-Paretas a3b01b00d4 drivers: gpio: npcx: remove redundant declarations
Remove redundant declarations by definining and initializing before
variables are used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-19 11:51:26 +02:00
Fabio Baltieri 8c55073d59 gpio: move gpio_cmsdk_ahb.h from drivers to include/drivers
Move gpio_cmsdk_ahb.h out of drivers/gpio and into include/drivers/gpio.
This is used by few board files so it should be in include.

This allows to remove few odd
"zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)".

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Fabio Baltieri bf47c2a763 drivers: drop few unused pinmux.h include
Drop few unused include pinmux header from drivers that don't seem to be
using it anymore.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-18 12:13:14 +00:00
Gerard Marull-Paretas f3017aa787 drivers: gpio: make gpio_utils.h a self-contained header
gpio_utils.h header relied on other files including its dependencies.
This patch adds all necessary includes to make it self-contained.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-17 08:14:57 +00:00
Navin Sankar Velliangiri 6ed5653365 drivers: gpio: gpio_mcux_lpc: Allocate no of gpio ISR using macro
Allocate no of gpio ISR using macro INPUTMUX_PINTSEL_COUNT.

Signed-off-by: Navin Sankar Velliangiri <navin@linumiz.com>
2022-08-12 16:15:42 -05:00
Francois Ramu cb196fe02b drivers: gpio: stm32F1x serie does not provide the pin get config
The stm32F1x serie does not provide the pin_get_config function,
Even if the CONFIG_GPIO_GET_CONFIG is set, the -ENOSYS error code
is returned by the z_impl_gpio_pin_get_config().

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu 99f8579c0b drivers: gpio: stm32 driver uses a structure to hold the pin configuration
Define a pin structure to carry the pin configuration elements
such as push/pull, opendrain, input/output, high/low.
This structure will give the gpio_flags_t to the gpio_stm32_get_config.
Only the stm32F1x serie does not provide the pin config get function.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Francois Ramu bb299b1194 drivers: gpio stm32 driver also get the pin state
In the stm32 gpio driver, the gpio_stm32_get_config function
also returns the pin state HIGH or LOW) to match gpio_pin_get_config
This is valid with CONFIG_GPIO_GET_CONFIG.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-08-12 14:13:37 +01:00
Henrik Brix Andersen 9c71615f83 drivers: gpio: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Andriy Gelman af6179d567 drivers: gpio: Add xmc4xxx drivers
Adds gpio drivers for xmc4xxx SoCs.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2022-08-05 13:00:21 +02:00
Gerard Marull-Paretas 149fe06341 drivers: arc/designware: remove unused <soc.h>
The <soc.h> header is not required by a few ARC/Designware drivers, so
remove it.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-03 07:46:14 -04:00
Nickolas Lapp 3feebd6571 Nordic nRF GPIO: Fixup race condition in GPIO pin Toggle
This PR fixes up a race condition which could cause GPIO writes to be
dropped when one thread was toggling a gpio on a port, and a different
thread was also modifying a (different) gpio on the same port.

Signed-off-by: Nickolas Lapp <nickolaslapp@gmail.com>
2022-08-03 12:39:02 +02:00
Fabio Baltieri 24d09d363c include: fix the remaining legacy #include paths
Add the "zephyr/" prefix to various #include statements that are
preventing the CI form running with LEGACY_INCLUDE_PATH=n.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-08-02 16:41:41 +01:00
Conor Paxton aba67c3329 drivers: gpio: add Microchip PolarFire SoC GPIO driver
This patch adds driver support for Microchip PolarFire
SoC GPIO.

Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
2022-08-01 10:29:21 +02:00
Simon Hein d0921018fc drivers: Fix coding guidelines MISRAC:2012 Rule 14.4 do-whiles/Zero checks
MISRA C:2012 Rule 14.4 (The controlling expression of an if statement
and the controlling expression of an iteration-statement shall have
essentially Boolean type.)

Use `do { ... } while (false)' instead of `do { ... } while (0)'.
Use comparisons with zero instead of implicitly testing integers.

The commit is a subset of the original auditable-branch commit:
5d02614e34a86b549c7707d3d9f0984bc3a5f22a

Signed-off-by: Simon Hein <SHein@baumer.com>
2022-07-26 15:30:24 -04:00
Kumar Gala 737b1fa25a drivers: gpio: sam: Fix Kconfig default for SAM4L
In update the Kconfig to depend on devicetree, the SAM4L
driver was missing a 'default y'.

Also remove unnecessary 'depends on GPIO'.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-26 08:49:38 +02:00
Fabio Baltieri c370c0299b drivers: gpio: nrfx: ensure ch variable stays allocated during use
Inside gpio_nrfx_pin_interrupt_configure, the "ch" variable is allocated
inside the "if", but then it gets dereferenced and the pointer saved in
trigger_config, which is used in the outer context.

This works fine right now, but that memory location could possibly be
reused by another automatic variable if the code gets changed.

Moving it in the function context to avoid any potential problem.

Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
2022-07-25 09:40:22 +02:00
Kumar Gala 957e263120 drivers: gpio: Update drivers to use devicetree Kconfig symbol
Update gpio drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-23 09:26:09 -05:00
Mulin Chao 9267655f42 driver: gpio: npcx: Support GPIO_VOLTAGE_1P8 flag
This CL configures low-voltage (1.8V) detection via GPIO driver with
GPIO_VOLTAGE_1P8 flag. It also adds support for this flag in
pin_get_config() function.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Mulin Chao a5fee4c6de driver: scfg: npcx: cleanup low-voltage detection configuration
Cleanup npcx low-voltage (1.8V) detection configuration. It removes
unused soc utilities, macros, and DT node. We will configure this
feature by GPIO driver with GPIO_VOLTAGE_1P8 flag later.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-22 10:33:03 +02:00
Benjamin Björnsson 45adae9118 drivers: gpio: gpio_fxl6408: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-21 06:07:02 -05:00
Benjamin Björnsson f195b910b2 drivers: gpio: gpio_pcal6408a: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-19 22:53:37 +00:00
Benjamin Björnsson 4b30008f5b drivers: gpio: gpio_cy8c95xx.c: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:17 +02:00
Benjamin Björnsson ff327c419d drivers: gpio: gpio_pca953x: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-18 18:43:03 +02:00
Tomasz Duda 5f84be56ae gpio_shell: support for input pull down/up
Add pull up/down in gpio shell.

Signed-off-by: Tomasz Duda <tomaszduda23@gmail.com>
2022-07-15 17:43:54 -05:00
Benjamin Björnsson a372be6eda drivers: gpio: stmpe1600: move driver to use i2c_dt_spec
Simplify driver by using i2c_dt_spec for bus access.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2022-07-15 10:00:44 +02:00
Kumar Gala 5cdfd12726 drivers: clock_control: beetle: Use devicetree for clock control
Add simple clock control node in devicetree for beetle to handle
relationship between drivers (uart, timers, gpio) and clock controller
device.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:50 +02:00
Kumar Gala 762eadc15d drivers: gpio: dw: rework init to use DT_INST_FOREACH_STATUS_OKAY
Use DT_INST_FOREACH_STATUS_OKAY to reduce duplicated code for each
instance.

We make interrupts optional since they aren't always available.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala 8a97bbd1f5 drivers: gpio: dw: determine instances from devicetree
Remove Kconfig symbols that determine which instances and just use
the number of enabled instance in the devicetree to determine which
instances to build.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala 4773bb45b0 drivers: gpio: dw: Remove dead clock gate code
Remove dead clock gate code and associated PM code as the platforms
that used the clock gate code are no longer supported in Zephyr.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Kumar Gala ef78470e4a drivers: gpio: dw: Remove dead shared IRQ code
The shared IRQ code has been broken for several releases and no one
seems to have noticed.  The platforms that this was used on are not
supported in Zephyr anymore so remove the code.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-14 10:31:42 +02:00
Michał Barnaś 4978717d44 gpio: implement pin_get_config in stm32 driver
This commit adds support for pin_get_config function in stm32 driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś 7a7fdffdfd gpio: implement pin_get_config in gecko driver
This commit adds support for pin_get_config function in gecko driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś 634944ac66 gpio: implement pin_get_config in ite driver
This commit adds support for pin_get_config function in ite driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś 0f60d5ae30 gpio: implement pin_get_config in npcx driver
This commit adds support for pin_get_config function in npcx driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś f9c9d537a8 gpio: implement pin_get_config in emul driver
This commit adds support for pin_get_config function in emul driver.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Michał Barnaś b1ba284b83 gpio: add function to get current configuration
Add gpio_pin_get_config function to gpio_driver_api.
This function is used to read current configuration of pin.
The gpio_pin_get_config checks if driver implements this function and
returns -ENOSYS if it isn't implemented.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2022-07-12 19:19:09 +02:00
Gerard Marull-Paretas 2533b13cd2 drivers: gpio: nrfx: add custom drive flags
Now that we have 8 bits reserved for vendor specific GPIO flags,
introduce a new set of flags for nRF platforms to configure pins drive
mode. These new flags are equivalent to the previous existing ones, but
use a naming scheme the fits better with vendor hardware capabilities.

The table below shows the equivalence between old and new flag

| Old flags                 | New flags             |
|---------------------------|-----------------------|
| `NRF_GPIO_DS_DFLT_LOW`    | `NRF_GPIO_DRIVE_S0`   |
| `NRF_GPIO_DS_DFLT_HIGH`   | `NRF_GPIO_DRIVE_S1`   |
| `NRF_GPIO_DS_ALT_LOW`     | `NRF_GPIO_DRIVE_H0`   |
| `NRF_GPIO_DS_ALT_HIGH`    | `NRF_GPIO_DRIVE_H1`   |
| `NRF_GPIO_DS_DFLT`        | `NRF_GPIO_DRIVE_S0S1` |
| `NRF_GPIO_DS_ALT`         | `NRF_GPIO_DRIVE_H0H1` |
| `NRF_GPIO_DS_DFLT_LOW \|` | `NRF_GPIO_DRIVE_S0H1` |
| `NRF_GPIO_DS_ALT_HIGH`    |                       |
| `NRF_GPIO_DS_ALT_LOW \|`  | `NRF_GPIO_DRIVE_H0S1` |
| `NRF_GPIO_DS_DFLT_HIGH`   |                       |

Documentation has been written to explain in more detail the meaning of
the flags and how they can be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Gerard Marull-Paretas e29055a225 drivers: gpio: nrfx: remove custom DS flags
The naming of the custom DS flags is not clear for nRF platforms. This
patch removes all the NRF_GPIO_DS* flags. New flags will be
re-introduced in a follow-up commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-07-11 13:22:24 +02:00
Mulin Chao 6f108d7f76 driver: gpio: npcx: Add checking whether pad's configuration is valid
In npcx series, not all GPIO pads support Multi-Input Wake-Up Unit
(MIWU) functionality. Hence, this CL adds checking whether GPIO's pad
configuration is valid first before using it.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2022-07-08 12:05:09 +02:00
Piotr Dymacz 20cb405e17 drivers: adjust cc13xx_cc26xx drivers for hal_ti update
The TI SimpleLink SDK got updated to version '4.40.04.04' in 'hal_ti'.
This introduced renames of some functions in HAL and has to be reflected
in Zephyr drivers which make use of them.

This renames 'PRCMPowerDomainStatus' to 'PRCMPowerDomainsAllOn' in all
affected 'cc13xx_cc26xx' drivers.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2022-07-08 09:37:43 +02:00
Anas Nashif 49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Matthias Freese 938eae3372 drivers: gpio: ti: add gpio extender sn74hc595
Add driver for spi based gpio extender ti sn74hc595.

Signed-off-by: Matthias Freese <m.freese@web.de>
2022-07-04 16:10:37 +02:00
Maureen Helm 627c253cab drivers: gpio: Change DW driver to use depends on instead of select
In prepration for configuring I2C/SPI defaults at the board level,
change the DesignWare GPIO driver's clock gate option to depend on clock
control instead of selecting clock control. This breaks a Kconfig
dependency loop when adding the following to a board's
Kconfig.defconfig:

config SPI
	default y if SENSOR

There aren't any in-tree users that enable the clock gate option, so
there aren't any places in-tree that now need to enable the clock
control driver. Out-of-tree users that set CONFIG_GPIO_DW_CLOCK_GATE=y
will now also need to set CONFIG_CLOCK_CONTROL=y.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-07-02 06:03:33 -04:00
Maxim Adelman c9ad6dbc7e drivers: gpio: gpio_mcux_lpc: fix lost interrupts
if ISR is called for an event on pin X but
another event occurs on pin Y in between the call
to GetStatus() and ClrStatus(), pin Y event wil get
cleared without being processed

Signed-off-by: Maxim Adelman <imax@fb.com>
2022-06-30 15:19:53 -05:00
Andrzej Głąbek 0a9a638f09 drivers: gpio_nrfx: Fix handling of GPIO_DISCONNECTED
The driver returns -EIO when a pin to be disconnected was not earlier
configured as input or output, what is not in line with the GPIO API.
This commit changes the driver to return 0 in such case.
Also -EIO is incorrectly returned when an interrupt trigger cannot be
configured in the nrfx_gpiote driver. This commit corrects this value
to -EINVAL.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:27:33 +02:00
Andrzej Głąbek 22f524d874 drivers: gpio_nrfx: Add support for gpio_port_get_direction
Add implementation of this new GPIO API function.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-06-30 18:12:54 +02:00
Kumar Gala 93f2fedc12 drivers: gpio: lpc11u6x: Remove DT_LABEL usage
Remove DT_LABEL usage that is needed for device_get_binding, replace
this with DEVICE_DT_GET.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-30 10:32:33 +02:00
Aymeric Aillet 9a7040303a drivers: clock: rcar: Rename global includes file
Rename r-car clock driver global include file
in order to match other files names.

Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
2022-06-28 18:11:44 +02:00
Christopher Friedt f88264d7ca drivers: gpio: mcux: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 00004fb976 drivers: gpio: sifive: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 1d823c77c9 drivers: gpio: litex: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 22d2fc1e64 drivers: gpio: eos_s3: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 3f96752005 drivers: gpio: cc13xx_cc26xx: support port_get_direction
Support querying the direction of GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 9526437e64 drivers: gpio_emul: support gpio_port_get_direction
Support querying the direction of emulated GPIO.

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Christopher Friedt 27c431ff7e api: gpio: add gpio direction query functions and driver api
Some services require the ability to query whether a GPIO pin
is configured as an input, output, both, or neither prior to
performing any operations at the service level. This is done
in order to reduce state tracking within the service.

To that end, this change adds
* `gpio_port_get_direction()`
* `gpio_pin_is_input()`, and
* `gpio_pin_is_output()`

Signed-off-by: Christopher Friedt <cfriedt@fb.com>
2022-06-24 16:19:58 +02:00
Gerard Marull-Paretas 4946a15f15 soc: arm: gigadevice: use common API headers
Stop relying on <soc.h> to access HAL APIs. Use generic, per-API headers
instead. Note that <soc.h> has been left as is for now, since ARM MPU
relies on a fragile chain of includes/type definitions.

This change should improve compilation efficiency, as we no longer pull
APIs that are not needed. A similar approach is followed by STM32
drivers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2022-06-22 18:41:19 +09:00
Stephanos Ioannidis 11d27f12ad drivers: gpio_esp32: Drop IRAM_ATTR from forward declarations
This commit drops the `IRAM_ATTR` macro from the function declarations
because:

1. `IRAM_ATTR` macro makes use of the `__COUNTER__` preprocessor macro,
   which increments for every macro invocation and causes the section
   specified in the forward declaration to not match that of the
   function definition.

2. Section attributes need not be specified for forward declarations.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-20 10:28:06 +02:00
Kumar Gala bb03af637c drivers: gpio: remove unused HAS_DTS_GPIO Kconfig symbol
All the gpio drivers are based on devicetree and thus we always set
HAS_DTS_GPIO, thus we don't need this Kconfig option anymore.  Remove
uses as its safe to assume DTS is supported for GPIO.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-10 09:47:31 +02:00
Daniel DeGrasse 2675fb4ce3 drivers: gpio: pca95xx: do not write to output regs if pin is input
Remove unconditional write to PCA95xx output registers in setup_pin_dir,
and only write to output registers if selected pin is configured as
an output.

Fixes #45774

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-06-05 14:47:41 +02:00
Fabio Baltieri e24314f10f include: add more missing zephyr/ prefixes
Adds few missing zephyr/ prefixes to leftover #include statements that
either got added recently or were using double quote format.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2022-05-27 15:20:27 -07:00
Daniel DeGrasse f7986835e8 drivers: gpio: gpio_mcux_igpio: add workaround for non contiguous pins
some iMX RT SOCs have non contiguous sets of gpio pins available, which
caused issues when selecting appropriate pinmux for these parts. Add
workaround code to adjust offset of pinmux settings when configuring
these pins.

Fixes #44391

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-18 10:55:22 +02:00
Wael Barakat 4b3fe99b83 drivers: gpio: nrf: fix pin number used in getting GPIOTE channel
Incorrect GPIOTE channel was being freed because the pin number
being used is not the absolute pin but the pin within the port.

Signed-off-by: Wael Barakat <waelsbarakat@gmail.com>
2022-05-16 09:41:04 +02:00
Daniel DeGrasse 0f7145e037 drivers: gpio_imx: Add pin control support
Add pin control support to gpio_imx driver, so that GPIO pin muxes will
be selected when the use configures a pin as GPIO.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse a4ad9d4c60 drivers: gpio_mcux_igpio: add additional SOC pin control settings
Add additional pin controller settings for iMX application core SOCs, as
well as a "fallback" pin control setting.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00
Daniel DeGrasse bc841e1fb7 drivers: pinctrl: refactor pin control support for imx rt
Refactor iMX RT pin control support to use more generic names, as the
IOMUXC peripheral is present on non RT iMX application cores.
Additionally, make selection of the pin control driver occur at the SOC
level.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-05-12 16:57:17 -05:00