Commit graph zephyr/drivers
Author SHA1 Message Date
Jose Alberto Meza
486a442bb0 drivers: i3c: npcx: fix NULL deref of target_config in ISR
data->target_config is NULL until i3c_target_register() is called by
the application layer. The I3C bus master can assert a STOP condition
during board init before registration occurs, firing the ISR while
target_config is still NULL.

Both npcx_i3c_target_isr() and npcx_i3c_target_xfer_end_handle()
unconditionally dereferenced data->target_config->callbacks, causing
an MPU Instruction Access Violation when the resulting garbage pointer
was used as a function pointer.

Guard the callbacks pointer derivation with a NULL check on
target_config in both sites. Existing per-callback NULL guards
downstream already handle the NULL case correctly.

Signed-off-by: Jose Alberto Meza <jose.a.meza.arellano@intel.com>
2026-06-17 08:03:58 +02:00
Sylvio Alves
59bf0091b5 drivers: serial: esp32: clear all uhci escape bits
The escape_conf bits reset to 1 and were left set, escaping 0xC0 and
0xDB on the async path even with SLIP off. Clear them, then enable.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-17 08:03:15 +02:00
Jilay Pandya
b70f8bf048 drivers: max30101 replace a bunch of BUILD_ASSERTs
use min-len/max-len for asserting the correct length of the
array, drop corresponding build asserts

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2026-06-17 08:02:10 +02:00
Andreas Petter
52da13e0ea drivers: led_strip: ws2812_rpi_pico_pio: fix SM start offset
The driver discarded the load offset returned by pio_add_program() and
started the state machine with pio_sm_init(pio, sm, -1, ...). The -1 is
silently masked to PC 31 by pio_encode_jmp(), which only works by
accident while the ws2812 program is the sole program in the PIO
instance: top-down placement puts it at offsets 28..31, and PC 31 then
happens to hit the program's final jmp back to its start.

As soon as another program is loaded into the same PIO instance first
(lower init priority), the ws2812 program is placed at a lower offset.
The SM then starts inside foreign code, falls through into empty
instruction memory and loops there forever, so the data pin stays
silent without any error being reported.

Store the offset in a data struct of the parent PIO program device and
pass it to pio_sm_init() as the initial PC, with error handling for
exhausted instruction memory. Parent-before-child init order is given
by the devicetree dependency ordinals; a device_is_ready() guard is
added as a safety net.

Signed-off-by: Andreas Petter <andreas@ibpetter.de>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-17 08:01:37 +02:00
Fabio Baltieri
ec003017df drivers: led: add a Linux LED native_sim driver
Add a native_sim driver to control a Linux LED on the host using the
Zephyr LED APIs.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-06-16 23:16:34 +02:00
Peter Mitsis
794134a5ab drivers: timer: simplify intel_adsp_timer
Simplifies the sys_clock_set_timeout() calculation used to determine
the next correct cycle at which to trigger the timer interrupt. There
is no risk that number of cycles we are adding will exceed MAX_CYCLES.

--

Furthermore, should the current cycle count match the 'last_count',
it prevents the timer from firing one tick too early. That firing
would not lead to miscount of ticks, nor mis-execution of handlers.
However it could lead to one extra timer interrupt being processed
unnecessarily.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
2026-06-16 23:16:20 +02:00
Armando Visconti
2b61140427 drivers: sensors: st: fix shub using 8-bit i2c_addr
Init the sensorhub targets using 8-bit i2c_addr for those drivers
when their STMEMSC API requires it.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-06-16 23:15:38 +02:00
a3e079872c drivers: serial: wch: only report TX ready if the interrupt is enabled
`uart_irq_tx_ready` should report true if transmit is empty
and the transmit interrupt is enabled. This isn't documented in
drivers/uart.h but is required by code such
`subsys/modules/modbus_serial.c` and implemented in drivers such as
`uart_sam.c` and `uart_stm32.c`.

Fix.

Signed-off-by: Michael Hope <michaelh@juju.nz>
2026-06-16 23:15:28 +02:00
Alain Volmat
64f35afdcf drivers: clock_control: stm32: add stm32h5 handling
Allow PLL1 to PLL3 for the STM32H5 family.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2026-06-16 12:58:12 -05:00
Gaston Donikian
d25ce05021 drivers: gnss: u-blox: add M10 GNSS driver
Add a driver for the u-blox M10 GNSS receiver.
It is heavily modeled on the F9P implementation.

Signed-off-by: Gaston Donikian <gastondonikian@gmail.com>
2026-06-16 12:56:31 -05:00
Alexandra Covaci
abae121477 drivers: rtc: microchip: Add RTC MSS drivers
Add RTC MSS driver for Microchip mpfs_icicle.

Signed-off-by: Alexandra Covaci <Alexandra.Covaci@microchip.com>
2026-06-16 12:55:58 -05:00
Andrej Butok
cda67435f2 drivers: crc: nxp: add CRC-32/MPEG-2 support
Adds CRC-32/MPEG-2 support to the NXP CRC drivers.

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-06-16 17:50:14 +02:00
Andrej Butok
8c5eb06bfa crc: add CRC-32/MPEG-2 implementation
- Adds the CRC-32/MPEG-2 variant
  (ISO/IEC 13818-1 Annex A, ITU-T H.222.0)
  to both the software CRC subsystem and the CRC device API.
- Adds crc32_mpeg2() and crc32_mpeg2_update().

Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
2026-06-16 17:50:14 +02:00
Sylvio Alves
3166069477 drivers: flash: esp32: install flash funcs at driver level
Install flash functions at driver init, once the scheduler
is running, since early boot leaves the chip on the no-OS path.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-16 17:47:22 +02:00
Guillaume Gautier
d4972dc2ed drivers: spi: stm32: fix for stm32h7 in rtio
For STM32H7, disable IRQ in RTIO when tranfer is completed to prevent
spurious IRQ to stall the system.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
f35c46b7be drivers: spi: stm32: remove fifo-enable
For st,stm32h7-spi compatible, always use the TSIZE register and the FIFO
for polling and interrupt mode. This increases performance compared to not
using it, and it reduces code complexity. This removes the need for the
fifo-enable property.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
1628f86398 drivers: spi: stm32: simplify the use of fifo for st,stm32h7-spi compat
For st,stm32h7-spi compatibles, when fifo-enable property is set, the
driver was setting the TSIZE register with the size of each buffer in the
transaction, leading to several disable/enable of the SPI instance.
Now, it sets the complete size of the transaction without intempestive
disabling of the SPI.

To add flexibility, the FIFO threshold is now configurable from a dts
property.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
7e23b63959 drivers: spi: stm32: rework dma transfer
This commit simplifies the flow of the STM32 SPI DMA transfer.

For the "st,stm32h7-spi" compatible, do not set the TSIZE register for a
DMA transfer (to define the size of the transfer). This setting was
leading to several disable/enable of the SPI instance in case multiple
buffers were used in the transaction, and it didn't bring noticeable
performance benefit. At the same time, do not use the SPI FIFO because
it's a hurdle to use without the TSIZE.

Rework the flow of initial operation to better match the procedure
described in the Reference Manuals.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Guillaume Gautier
ab34f00777 drivers: spi: stm32: wait for both dma tx and rx done
When waiting for DMA transfer done, wait for both TX and RX, instead of
only one of them.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-06-16 17:45:15 +02:00
Nicolas Pitre
860bbbcbdb drivers: timer: nrf_rtc_timer: switch to absolute tick-aligned deadlines
sys_clock_set_timeout() computed the compare value as

    cyc = ticks * CYC_PER_TICK + unannounced;
    cyc = DIV_ROUND_UP(cyc, CYC_PER_TICK) * CYC_PER_TICK;
    target = last_count + cyc;

The DIV_ROUND_UP forces the fire onto the next tick boundary *after*
the requested point, but the driver never subtracts the unannounced
sub-tick offset back out. When the caller arms partway through a tick
(the common case), the timer therefore fires one tick later than the
kernel asked for -- k_timer_start(K_TICKS(N), ...) ends up firing at
roughly N+2 ticks instead of N+1.

Adopt the absolute tick-aligned deadline pattern already proven in
arm_arch_timer.c and riscv_machine_timer.c:

  - Track last_elapsed: the tick count the kernel last observed via
    sys_clock_elapsed(). Reset to 0 in the handler at announce.
  - sys_clock_set_timeout() computes the target as
      target = last_count + (last_elapsed + ticks) * CYC_PER_TICK
    and clamps the cycle delta from last_count at MAX_CYCLES so the
    24-bit compare register is satisfied relative to the current
    counter.
  - The handler reads the current counter (not the scheduled expire
    time) to compute dticks, advancing last_count to the actual tick
    boundary just past now in one shot. This subsumes the previous
    "wrap protection" branch: a large unannounced delta naturally
    produces a target in the past, compare_set forces an immediate
    IRQ, and the handler catches up in a single invocation.
  - sys_clock_elapsed() records the delta in last_elapsed.

A v1 of this change (commit 67a29d7f98 ("drivers: timer:
nrf_rtc_timer: switch to absolute tick-aligned deadlines"), since
reverted) kept a separate "if unannounced >= COUNTER_HALF_SPAN,
target = last_count" branch. That broke the handler invariant:
dticks evaluated to zero, last_count never advanced, and the ISR
re-pended in an infinite loop once the counter naturally crossed
COUNTER_HALF_SPAN (~4m17s on nrf52). The structural change above
removes the need for any such recovery branch.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-06-16 17:44:04 +02:00
Fin Maaß
7aec7f2bde drivers: ethernet: dwmac: add support for the stm32f series
add support for the stm32 f series in the
dwmac driver.

Assisted-by: Github Copilot:Claude Haiku 4.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-16 10:28:11 +02:00
Fin Maaß
3e2831ac18 drivers: ethernet: dw: add support for dwc_ether_mac10_100_1000_universal
add support for the dwc_ether_mac10_100_1000_universal,
that is used, f.e. on the stm32 f series.

Assisted-by: Github Copilot:Claude Haiku 4.5
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-16 10:28:11 +02:00
Fin Maaß
c9835defa4 drivers: ethernet: dwmac: put in its own dir
put the dwmac driver into a separate dir.

Signed-off-by: Fin Maaß <info@finmaass.de>
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-16 10:28:11 +02:00
Fin Maaß
8f9cd431af drivers: ethernet: dwmac: select CACHE_MANAGEMENT
If we have a Dcache select CACHE_MANAGEMENT

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-16 10:28:11 +02:00
Vincent Tardy
7401a1259a bluetooth: stm32wbax: add BT_STM32WBA_BASIC_PLUS_LIB KConfig
Add new KConfig BT_STM32WBA_BASIC_PLUS_LIB specifying the
configuration of the stm32wba ble library for bluetooth
basic plus features.

Signed-off-by: Vincent Tardy <vincent.tardy@st.com>
2026-06-16 10:27:55 +02:00
Sylvio Alves
de5f5a9fd0 drivers: ieee802154: esp32: handle rx queue-full case
Replace a leftover placeholder in the rx queue-full branch with an
error log.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-06-16 10:27:27 +02:00
Zayne Stites
96270c6d7d drivers: pinctrl: Add cfgout3 to infineon driver
Add CY_GPIO_DM_CFGOUT3_STRONG_PULLUP_HIGHZ support to pinctrl
driver for Infineon

Assisted-by: Claude:claude-opus-4.7

Signed-off-by: Zayne Stites <Zayne.Stites@infineon.com>
2026-06-16 08:37:05 +02:00
Felix Wang
6f99e307f1 drivers: counter: mcux_lptmr: make re-arm check and stop atomic
The alarm ISR read data->alarm_active under the spinlock into a local
"rearmed" snapshot, released the lock, and only then acted on it by
stopping and reprogramming the LPTMR. That split the check from the
action: on SMP (or a nested context) a concurrent
counter_set_channel_alarm() could re-arm the alarm in the window
between the unlock and LPTMR_StopTimer(), and its freshly programmed
period/run state would be clobbered by the restore here.

Hold the lock across both the re-arm check and the stop/restore so the
decision and the HW action are atomic with respect to other lock
holders. Whichever context sets alarm_active under the lock owns the
timer configuration; the ISR only stops/restores when it observes
alarm_active == false while holding the lock, so it can no longer
overwrite a concurrent re-arm.

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-06-16 08:36:18 +02:00
Felix Wang
2f091737dd drivers: counter: mcux_lptmr: defer alarm stop until after callback
The alarm ISR was stopping and reprogramming the LPTMR before
invoking the user callback. Because LPTMR_StopTimer() resets the
counter back to zero, counter_get_value() called from inside the
callback observed 0 while the ticks argument still reflected the
pre-stop count. The single_shot_alarm scenarios in
tests/drivers/counter/counter_basic_api caught this as a large
diff between reported alarm and observed counter on
frdm_imxrt1186/mimxrt1186/cm7.

Move LPTMR_StopTimer() and LPTMR_SetTimerPeriod() to run after the
callback, skip them when the callback re-armed a new alarm via
counter_set_channel_alarm(): the counter API documents that the
channel becomes available inside the expiration handler and that
re-arming is allowed there.

Verified by building tests/drivers/counter/counter_basic_api for
frdm_imxrt1186/mimxrt1186/cm7 with armgcc.

Fixes #110250

Signed-off-by: Felix Wang <fei.wang_3@nxp.com>
2026-06-16 08:36:18 +02:00
Henrik Brix Andersen
d393623364 drivers: can: bosch: m_can: switch to macro for declaring data struct
Switch to using a macro for declaring the Bosch M_CAN driver data struct
and have the macro statically initialize the k_mutex structures at build
time.

The "lock" mutex can be used by the vendor-specific driver front-ends
before the can_mcan_init() function is called (e.g. for configuring the
Message RAM), which will result in attempts to lock an unitialized k_mutex.

Fixes: #111031

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2026-06-15 18:37:04 -04:00
Marek Matej
8aaabb2a94 drivers: ieee802154: ESP32 buffered receiver path and HW caps
Add frame buffering before delivering packets to speed up HAL frame
release.
Update IEEE802154 hw capabilities.

Signed-off-by: Marek Matej <marek.matej@espressif.com>
2026-06-15 18:35:57 -04:00
Daniele Aimo
dd74e09411 drivers: audio: dmic_stm32_dfsdm: added DMA support to the driver
- DMA presence is detected from the definition in the device tree
and properties are added in the filter configuration structure
- DMA buffer is internally allocated depending on a configuration parameter
runtime checks are performed to ensure that kslab user allocation is not
too large respect to the internal buffer
- in the configure function the DMA is now configured
- start and stop functions are changed to support DMA if defined
in device tree

Signed-off-by: Daniele Aimo <d.aimo@arduino.cc>
2026-06-15 18:35:39 -04:00
Jérôme Pouiller
f9d47a775f drivers: watchdog: siwx91x: Fix typo
Obviously, siwx91x_WDT_INIT() should be spelled SIWX91X_WDT_INIT()

Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
2026-06-15 12:15:58 -04:00
Thomas Lang
2198bd83c8 drivers: ethernet: lan865x allow internal reset pullup
Fixes bug when using an internal pull up resistor on the reset pin

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2026-06-15 12:14:04 -04:00
Etienne Carriere
0dbc1ecf25 drivers: clock_control: stm32: H7/H7RS PLL1 DIVP can be 1 or even
Add a build assertion to ensure PLL1 DIVP division factor is not
an odd value different from 1 since not allowed as per SoCs reference
manuals.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:13:26 -04:00
Julien Panis
25874ade6f drivers: gpio_rcar: Make driver usable with Gen5
For Gen5 SoCs:
- Register offsets are different.
- The direction (either input or output) must be selected.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2026-06-15 12:13:17 -04:00
Adrien Ricciardi
7d59a66eb3 drivers: gpio: Add pinctrl support to the R-Car GPIO driver
This is required on modern Zephyr to configure appropriately the pins
for GPIO operations.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2026-06-15 12:13:17 -04:00
Adrien Ricciardi
31b577827f drivers: gpio: Add generic clock support to the R-Car GPIO driver
Convert the driver clock accesses to use the new generic API, so the
driver can be used on R-Car boards generations 3, 4 and 5 without changes.

Signed-off-by: Adrien Ricciardi <aricciardi@baylibre.com>
2026-06-15 12:13:17 -04:00
Etienne Carriere
b157387039 drivers: i2c: stm32: Add PM in RTIO drivers controller mode
Add PM support support to STM32 I2C RTIO drivers in controller mode.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
46cc518300 drivers: i2c: stm32: Ensure RTIO sequence is processed in sync operation
Synchronous RTIO I2C operations (RTIO_OP_I2C_CONFIGURE) and unsupported
or invalid RTIO I2C operations do call i2c_rtio_complete() but do not
trigger next message processing. Fix that ensuring synchronous operations
are each related to an RTIO completion notification.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
f1b81c8629 drivers: i2c: stm32: Unused i2c_stm32_start() return code in RTIO drivers
Cleanup i2c_stm32_start() and i2c_stm32_msg_start() regarding their
return values. The return value of the former was not handled and
the later always succeeds.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
b7855d806e drivers: i2c: stm32: Factorize RTIO sequence completion
Factorize STM32 I2C RTIO sequence completion instructions into a
common i2c_stm32_rtio_complete() helper function that applies to both
I2C STM32 v1 and v2 driver flavors.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
63d739b4e5 drivers: i2c: stm32: Test successful PM runtime get
Report error returned by pm_device_runtime_get() in STM32 I2C drivers.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
b2d02fa29e drivers: i2c: stm32: Add PM runtime management in target modes
Add PM runtime support to I2C STM32 v1 driver in target mode in both
RTIO and non-RTIO drivers.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
0e5013ab9b drivers: i2c: stm32: Fix unbalanced PM runtime state in driver v2
Correct unbalanced PM runtime device state in STM32 I2C v2 RTIO
and non-RTIO drivers in target client registering/unregistering.

In the target register sequence, put device runtime PM resources upon
on failure to register.

In the target un-registering sequence, put device runtime PM resources
when there remain a target as when 2 targets are registered, each has
get the device runtime PM resources, hence related reference counter
was incremented twice.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
4835256a55 drivers: i2c: stm32: Don't set target config upon failure
Correct target registering sequence to not store target config upon
registration failure in I2C STM32 v2 drivers as suggested by Copilot [1].

Link: https://github.com/zephyrproject-rtos/zephyr/pull/110623#discussion_r3362750896 [1]
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Etienne Carriere
1832ea0b75 drivers: i2c: stm32: don't leave I2C enable on config failure
Filter out unsupported 10 bit address modes in STM32 I2C v1
driver in target mode before bus is enabled, preventing to leave
it enabled upon such configuration failure.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-06-15 12:12:48 -04:00
Krzysztof Chruściński
92b25f7ea4 drivers: serial: nrfx_uarte: Fix instance initialization priority
If UARTE instance is using GPPI during the initialization and GPPI is
using Ironside then that instance need to be initialized once Ironside
and GPPI is initialized. Delay initialization to POST_KERNEL and
derive init priority from Ironside call init priority (+2 as +1 is
used by GPPI).

Signed-off-by: Krzysztof Chruściński <krzysztof.chruscinski@nordicsemi.no>
2026-06-15 12:10:58 -04:00
Fin Maaß
8d201ae75a drivers: ethernet: remove logs for link up and down
Inside the work that is scheduled by net_eth_carrier_on
and net_eth_carrier_off there is already a log message,
when the carrier changes, we don't need to log the same
info in the ethernet drivers.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-06-15 10:32:01 +01:00
Carlo Caione
eb092b0f40 drivers: input: add virtio input device driver
Add a driver for VIRTIO input devices. Events are forwarded to the input
subsystem as-is since the event codes match the Linux ones. ABS_X/ABS_Y
values can optionally be scaled to the resolution of a referenced display.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
2026-06-15 10:24:27 +02:00