Program the CY_GPIO_DM_*_IN_OFF drive-mode variants and enable the input
buffer only when GPIO_INPUT is requested. The input-buffer control bit
(bit 3) is set on CAT1 and cleared on CAT2/PSoC4, so a pure output now
reads back without GPIO_INPUT and configure() stays consistent with the
pin_get_config() readback.
Apply the same input-buffer-off single-ended drive modes in gpio_psoc6,
rejecting the pull-up/pull-down combinations the open-drain and
open-source modes cannot represent.
Assisted-by: AI (GitHub Copilot)
Signed-off-by: Bill Waters <bill.waters@infineon.com>
On SoCs that route the DesignWare GPIO signals through a pin
controller, the pins must be muxed to their GPIO function before
the controller can drive them. Add an optional "default" pinctrl
state to the binding and apply it during initialization. Everything
is conditional on at least one enabled instance having a pinctrl-0
property, so existing users that do not describe pin muxing are
unaffected.
Signed-off-by: Aravind Krishnan <aravind.krishnan@alifsemi.com>
Signed-off-by: Silesh C V <silesh@alifsemi.com>
Manually trigger GPIO_IRQn after waking up from backup mode. Do not
disable retention ldo after waking up from backup mode as it causes
resets in standby mode.
Signed-off-by: Tahsin Mutlugun <Tahsin.Mutlugun@analog.com>
Any gpio can be used to wakeup device from sleep/deepsleep modes
This commit add this feature inside driver.
Signed-off-by: Sadik Ozer <sadik.ozer@analog.com>
The nrf54l has high speed pad ctrl (slew rate) of the fast GPIO port
(P2), configurable through registers sharing the address space of the
GPIO port.
Extend the nordic,nrf-gpio devicetree binding with a property
indicating if hspadctrl is available for a port, and add an optional
property for setting the optional HSBIAS value of the GPIOHSPADCTRL
BIAS register. The datasheet recommends always setting HSBIAS to its
highest value (3), which will now be set by the nrf gpio device
driver on init, unless the user specifies otherwise in the
devicetree.
Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Add a driver for the VIRTIO GPIO device (virtio spec 1.3, section 5.18),
letting a Zephyr guest drive GPIO lines exposed by a hypervisor or a
vhost-user backend.
The number of lines is read from the device configuration space at init,
and interrupts use the event virtqueue when the device offers
VIRTIO_GPIO_F_IRQ. Every operation is a round trip to the device, so the
GPIO API can only be used from a thread.
Assisted-by: Claude Code:opus-4.8
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The port writers update the data register with an unlocked read-modify-
write. port_set_masked_raw() reads and writes DR directly, and on parts
without the DR_SET/DR_CLEAR/DR_TOGGLE aliases the HAL degrades
GPIO_PortSet/Clear/Toggle() to "DR |= mask" and friends. Pin
configuration is affected too: GPIO_PinWrite() falls back the same way,
and the GDIR update is a read-modify-write on every part.
Two contexts touching different pins of the same port therefore race:
each reads the register, changes its own bits and writes the whole value
back, so the last writer reverts the other's pin.
Serialize the accesses with a spinlock, which unlike irq_lock() also
covers a concurrent write from another CPU on an SMP build. The lock
cannot be limited to the parts that lack the set/clear aliases, because
port_set_masked_raw() read-modify-writes DR everywhere: an atomic DR_SET
from another context would still be clobbered by it.
While here, use GPIO_PinWrite() instead of the deprecated
GPIO_WritePinOutput() wrapper.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Marvin Gnad <marvin.gnad@gmail.com>
gpio drivers need to have struct gpio_driver_config and
struct gpio_driver_data at the first position of the data
and config struct.
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
The implementation of EM4 wakeup pin support assumed all ports
have at least one EM4WU capable pin. Support the case where
EM4WU pins may not be available on every port.
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
Now that all series (with wake-up pins) have been migrated to the new
binding, drop the old driver.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
Add a new STM32 SoC-specific driver for management of wake-up pins at
Power Controller level. The more generic terminology "wake-up lines" is
used for consistency across all series, but the driver currently focuses
only on wake-up lines connected to GPIO pins. This driver is designed to
handle nodes with the new `st,stm32-pwr-wkupctrl` compatible as well as
derivatives (`st,stm32f1-pwr-wkupctrl` and `st,stm32f7-pwr-wkupctrl`).
The old driver is retained for backward compatibility; selection is done
automatically based on whether a node with the new compatible is present
and active in the Devicetree or not.
While at it, also update the STM32 GPIO driver to use the new driver
when appropriate by introducing a new (private) API. The old driver is
considered as deprecated and will be removed in a future commit.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
The pue_mux register layout check indexed the pinmux array with the
raw pin number, while all other accesses use the gap-compensated
cfg_idx. On a port with gpio-reserved-ranges and a compacted pinmux
map this reads the wrong entry, or past the end of the array.
Signed-off-by: Lucien Zhao <lucien.zhao@nxp.com>
The patch ad42613252 added GPIO_DISCONNECTED support
for gpio_mcux_port_configure, but port_get_direction was not updated
accordingly.
port_get_direction() only checks PDDR to determine pin direction,
so a disconnected pin (PDDR cleared) is incorrectly reported as an
input. This causes the gpio_get_direction.test_disconnect test to
fail on boards using the PORT-based gpio_mcux driver.
Check PORT PCR and PDDR state to identify disconnected pins and
exclude them from direction results, so they are reported as
neither input nor output per the Zephyr GPIO API contract.
Fixes: #114432
Assisted-by: Claude:opus-4.6
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
On ESP32-H2, the analog comparator (ana_cmpr) unit shares its
interrupt source (GPIO_INTR_SOURCE) with the GPIO peripheral, but uses
its own separate status/enable/clear registers (GPIO_EXT.*). Register
the GPIO driver's own interrupt via esp_intr_alloc_intrstatus() with
ESP_INTR_FLAG_SHARED, scoped to the GPIO status register/mask, so both
drivers can coexist on the same line independently.
Only takes effect when the new ana_cmpr driver is enabled, so this is
a no-op otherwise.
Signed-off-by: Tiago Medicci <tiago.medicci@espressif.com>
Add GPIO driver support for the CH5xx series with the required bindings.
This enables the blinky sample to run by default, and the basic/button
sample when a device tree overlay is provided.
Signed-off-by: Elie Carrot <elie.carrot@smile.fr>
Add the initial GPIO driver support for the ELAN EM32 SoC family.
The driver provides basic GPIO input/output control, pin configuration,
and interrupt handling. Device instances are created from devicetree.
Signed-off-by: Johnny Chuang <johnny.chuang@emc.com.tw>
Add the CH32H41X SoC series under the ch32v family. The CH32H417 is
an asymmetric dual-core (AMP) RISC-V part with a QingKe V3F boot
core and a QingKe V5F application core.
Model the two cores as cpuclusters with separate CPU descriptions,
runtime-idle power states, interrupt entry, vector handling, and
non-overlapping memory. Keep the external HSE frequency
board-specific.
The optional SOC_CH32H417_BOOT_V5F setting lets the V3F early-init
hook wake the V5F image at its real flash address, 0x08010000, while
allowing standalone V3F applications to disable that behavior.
Signed-off-by: Liu Changjie <liucj1228@outlook.com>
- Some of the lut values are missing in the datasheet. In these places,
use UINT8_MAX to denote that this pin does not support being used as
GPIO.
- Tested using blinky sample in beagleconnect_zepto.
Signed-off-by: Ayush Singh <ayush@beagleboard.org>
(flags & A) || (flags & B) is equivalent to flags & (A | B). Collapse
the pull-up/pull-down, output-init, and input/output bias tests into a
single masked check.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
WRITE_BIT takes a bit index but was passed BIT(pin), applying the
GPIO-function enable to the wrong bit. Pass the pin index.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
LP IO wakeup sampling needs the independent LP IO clock enabled
when programming pin wakeup. Without it, the first deep sleep
cycle can draw excess current until sleep prepare force-enables
the clock. Enable/disable the clock with EXT1/GPIO wakeup setup.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
The memcpy used sizeof(pin_cfg), reading a whole pinctrl_soc_pin from
a single pinmux array element and past the end for the last pin. Use
sizeof(pin_cfg.pinmux).
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The GPIO_INPUT branch wrote adp5585_pin_output into the direction
register, so pins requested as inputs were driven as outputs.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The PORT-based gpio_mcux_port_configure() rejects any configuration
that sets neither GPIO_INPUT nor GPIO_OUTPUT with -ENOTSUP. This makes
it impossible to release a pin with gpio_pin_configure(dev, pin,
GPIO_DISCONNECTED), which applications such as debug probes and
programmers need in order to tri-state shared target pins (SWD, ICSP,
UPDI) when a protocol is deactivated.
Handle GPIO_DISCONNECTED by clearing the pin's direction bit in PDDR
and setting the PCR MUX field to 0 (pin disabled / Alternative 0),
disconnecting the pin from the GPIO module. This also disables the
digital input buffer (cleared explicitly via IBE on parts that have
it), so the released pad is high impedance and draws no current when
left floating.
Signed-off-by: Leonardo José Consoni <leonardo@binho.io>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This API was never intended to be "public" in the sense now documented
in the Glossary, as said in 559c72d7a6:
"Introduce public functions for GPIO pins configuration [...] in
stm32 drivers & routines such gpio_stm32 & poweroff."
Remove the header from the public API directory and move the definitions
to a private header in SoC-specific includes. Update all previous users
of the header (which are as expected only those documented in the commit
message quoted above: gpio_stm32 and SoC poweroff.c).
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
DEVICE_API already includes const, with another const,
clang warns us about the double specifier.
Remove it to avoid the warning.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Adds support for the TI TLA2528 I2C ADC with GPIOs.
The TLA2528 is a 12-bit 8-channel ADC, where each channel can also be
configured as a GPIO in- or output in push-pull or open-drain.
Signed-off-by: Oliver Schmidhauser <oliver.schmidhauser@leica-geosystems.com>
Fix gpio_sam_port_toggle_bits() and gpio_sam_port_set_masked_raw()
PIO_MSKR need to be set before configure PIO_ODSR.
Signed-off-by: CHEN Xing <xing.chen@microchip.com>
Add standard Zephyr GPIO driver for Allwinner H618 SoC.
This driver supports pin configuration, reading/writing,
and basic external interrupt configuration.
Signed-off-by: Khai Do <dovankhai97@gmail.com>