Commit graph zephyr/drivers
Author SHA1 Message Date
Anas Nashif
673151bee9 Revert "drivers: sdhc: set SDHC_INIT_PRIORITY to KERNEL_INIT_PRIORITY_DEVICE"
This reverts commit 713cdff118.

Build error:

ERROR: /soc/mmc@ee140000 <rcar_mmc_init> is initialized before its
  dependency /regulator_1p8v <regulator_fixed_init>
ERROR: ... /regulator_3p3v <regulator_fixed_init>

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-06 12:36:04 +02:00
Anas Nashif
322b8c596b Revert "wch: ch32v20x: DT control of internal clock divisor and clock config check"
This reverts commit f9bed91088.

build error:
 Build failure - error: static assertion failed: "cpu0 clock-frequency
 does not match HSE * mul"

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2026-08-06 12:36:04 +02:00
Fin Maaß
713cdff118 drivers: sdhc: set SDHC_INIT_PRIORITY to KERNEL_INIT_PRIORITY_DEVICE
set the default of SDHC_INIT_PRIORITY to
KERNEL_INIT_PRIORITY_DEVICE, just like at the other
driver priorities.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-08-05 23:27:16 +01:00
Perry Naseck
f9bed91088 wch: ch32v20x: DT control of internal clock divisor and clock config check
This commit adds a new DT control `hsi-prediv` for `wch,ch32v20x_30x`
devices and compile-time checks to ensure the clock configuration is valid.
This allows control of the internal clock divisor to be able to reach the
full 144MHz when using the internal clock source (`HSI`).

Assisted-by: Claude:claude-opus-4.8

Signed-off-by: Perry Naseck <pnaseck@media.mit.edu>
2026-08-05 23:26:00 +01:00
Fabrice DJIATSA
6d1cb01c6b drivers: flash: stm32_xspi: invalidate d-cache after write/erase
Writes/erases use the indirect interface and don't update the D-cache, so
memory-mapped reads returned stale data once the cache was enabled.
Invalidate the affected range on write/erase completion.

Assisted-by: GPT-5.3-Codex
Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-08-05 18:42:35 +01:00
Zafer SEN
7a8c10d881 drivers: modem: hl78xx: expose firmware version information
Add HL78XX_MODEM_INFO_FW_VERSION to the public modem API and
return the modem firmware version through get_modem_info().

Also introduce a configurable desired firmware version option
for firmware validation and diagnostics.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-08-05 18:39:51 +01:00
Zafer SEN
4eaaa30802 driver: modem: add targeted script recovery framework
Replace the generic initialization-failure handling path with a
rule-based recovery framework for HL78xx modem chat scripts.

The new recovery mechanism captures script failure context,
including the failed script, command index, request, and result,
and uses this information to select a targeted recovery action.
Successful recovery is tracked and verified before the failure
state is fully cleared.

Key changes include:
- Introduce a dedicated RECOVERY state
- Capture and preserve script failure context
- Add configurable recovery rules and recovery actions
- Track recovery attempts and enforce retry limits
- Add helpers for clearing and confirming recovery state
- Recover corrupted KBNDCFG band configuration automatically
- Recover post-restart KSUP configuration timeouts
- Extend modem chat APIs to expose the active script and command
- Remove the legacy diagnostic-script recovery path
- Simplify restart fallback handling and recovery lifecycle
- Remove the obsolete script failure counter

This improves modem robustness by enabling targeted recovery of
known script failures while avoiding unnecessary modem resets
and full reinitialization sequences.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-08-05 18:39:51 +01:00
Zafer SEN
bf34132dfd drivers: modem: simplify PMC config script leave handler name
Rename the PMC configuration script state leave handler to
better match the associated state and follow existing handler
naming conventions.

This is a non-functional change that improves code clarity and
consistency within the HL78xx state machine implementation.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-08-05 18:39:51 +01:00
Jason Yu
82b1195806 drivers: adc: mcux_gau_adc: Fix buffer size validation unit mismatch
The buffer size validation compared buffer_size (bytes) against
num_channels (sample count), allowing undersized buffers to pass.
The byte count was then stored in results_length and used as a
uint16_t slot count in the sample-reading worker, causing
out-of-bounds 16-bit writes.

Fix by:
- Using the shared adc_sequence_validate_buffer() helper to validate
  buffer_size against num_channels * sizeof(uint16_t), matching the
  common approach introduced for the other ADC drivers
- Storing buffer_size / sizeof(uint16_t) in results_length
- Using post-decrement (length-- > 0) instead of pre-decrement
  (--length > 0) to allow the correct number of writes

Assisted-by: Claude:opus-4.6
Signed-off-by: Jason Yu <zejiang.yu@nxp.com>
2026-08-05 18:39:02 +01:00
Julien Racki
9bd86aaa33 drivers: ethernet: stm32: Add TX context allocation timeout
Prevent infinite loops when hardware becomes unresponsive
by adding a timeout in TX context allocation.
Signals interface is down and returns -ETIMEDOUT on timeout.

Co-authored-by: Alessandro Nuzzi <alesnu96@gmail.com>
Signed-off-by: Julien Racki <julien.racki-ext@st.com>
2026-08-05 18:38:37 +01:00
Mike J. Chen
f4a209c7ea drivers: counter: add support for ARM CRSAS-MA2
This adds support for ARM Corstone System Architecture Specification Ma2
(ARM CRSAS-MA2) System Counter and System Timer.

The HW consists of one 64-byt System Counter, and any number
of System Timers that have match registers to generate interrupts
based on the value of the System Counter.

The timers don't have any counter/timer of their own, meaning that
System Counter can't be started or stopped independently if there is an
enabled System Timer.

Add the crsas-ma2 timer to the test for counters.

Signed-off-by: Mike J. Chen <mjchen@google.com>
Signed-off-by: Krystian Hebel <khebel@antmicro.com>
2026-08-05 18:38:18 +01:00
Mario Paja
dbdc55b417 drivers: i2s: stm32_sai: support shared and separate kernel clocks
Some STM32 SAI nodes may expose a shared kernel clock for both sub-blocks,
while others may provide different kernel clocks for sub-block A and
sub-block B.

These changes allow the driver to handle SAI nodes with different kernel
clock layouts. Nodes with sai_ker_ck use a shared kernel clock for both
sub-blocks, while nodes with sai_a_ker_ck and sai_b_ker_ck use
separate kernel clocks for each sub-block.

Signed-off-by: Mario Paja <mariopaja@hotmail.com>
2026-08-05 18:37:42 +01:00
Manimaran A
db574719b8 drivers: espi: mec: taf v2 driver update for MEC174x/5x/165xB
Modified the Microchip XEC eSPI TAF V2 driver adding support for
MEC174x/5x/165x. We agree with code quality tool analysis the eSPI
TAF register structure is too larger and not maintainable. The driver
now uses Zephyr's system memory mapped register access routines.
quality check tools find the structure too large.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2026-08-05 18:37:10 +01:00
Ryan McClelland
35562f22f4 drivers: i3c: validate nested CCC buffers in do_ccc syscall handler
The do_ccc syscall verifier checked the outer payload and the
ccc/targets arrays but operated on the caller's live structure and
did not validate the per-target data buffers, unlike the i3c_transfer
verifier which snapshots its message array before use.

Make the two paths consistent: introduce copy_ccc_and_do(), which
snapshots the payload, allocates a kernel-side copy of the target
array via k_usermode_alloc_from_copy(), and validates each data
buffer with K_SYSCALL_MEMORY() before calling the implementation.
num_targets is capped at 31 as a sanity bound. The driver-written
num_xfer and err fields are copied back to the caller after the
transfer so results still propagate; data buffers are unaffected
as their pointers still reference user memory.

Signed-off-by: Ryan McClelland <rymcclel@gmail.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-08-05 18:36:42 +01:00
Holt Sun
670c903517 drivers: rtc: rv8263: Fix calibration get decoding
rv8263c8_calibration_get() decodes the offset register with the
mode-to-step mapping reversed relative to rv8263c8_calibration_set()
and the application manual: it multiplies fast mode (MODE = 1) by
the 4340 ppb normal mode step and normal mode by the 4069 ppb fast
mode step, so every readback is scaled by the wrong step size.

The signed 7-bit decode is also broken. The register byte is read
into an int8_t, so the MODE bit acts as the sign during integer
promotion, and the branch for a set bit 6 ORs in bit 7 of an
already-positive value: a stored offset of -64 (0x40 with MODE = 0)
reads back as +192 steps. Mask the 7-bit offset field and use
sign_extend(), as rtc_rv8803 does for the same register layout.

With both fixes a set()/get() sequence returns the effective
programmed value at hardware resolution.

Built tests/drivers/build_all/rtc (i2c_devices.overlay) for
qemu_cortex_m3 with CONFIG_RTC_CALIBRATION=y. No hardware run;
register-level analysis against the RV-8263-C8 application manual.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-08-05 13:57:35 +01:00
Holt Sun
afcddd0864 drivers: rtc: rv8263: Fix offset register write in calibration set
rv8263c8_calibration_set() masks the mode candidates with
GENMASK(7, 0), so bit 7 of a negative two's complement candidate
lands in the MODE bit of the offset register: every negative
calibration request silently switches the device into fast mode
even when normal mode was selected. Mask with the signed 7-bit
offset field (bits 6..0) instead so the MODE bit is controlled
only by the selected mode.

The function also accepts any int32_t request. Out-of-range values
now return -EINVAL per the rtc_set_calibration() API contract
instead of silently wrapping in the register field. In addition,
the fast mode candidate is only selected when it fits the 7-bit
field: fast mode has the smaller step, so near the range limits
its candidate can exceed the field even though the request itself
is representable in normal mode.

Values previously accepted beyond +/-64 offset steps now fail with
-EINVAL, which is a user-visible conformance fix.

Built tests/drivers/build_all/rtc (i2c_devices.overlay) for
qemu_cortex_m3 with CONFIG_RTC_CALIBRATION=y. No hardware run;
register-level analysis against the RV-8263-C8 application manual.

Signed-off-by: Holt Sun <holt.sun@nxp.com>
2026-08-05 13:57:35 +01:00
Adam BERLINGER
3bf5d67254 dts: stm32c5: Move CK48 multiplexer to separate node
CK48 is now moved to separate mode.
It is shared by RNG and USB peripherals. This avoids
collision and also allows checking in RNG driver.

Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
2026-08-05 13:55:17 +01:00
Fabrice DJIATSA
38c2eb84bc drivers: disk: stm32: enable by default Hardware flow control
It might be required to prevent FIFO underrun and overrun
errors during disk access.

Signed-off-by: Fabrice DJIATSA <fabrice.djiatsa-ext@st.com>
2026-08-05 13:54:47 +01:00
Aaron Kim
781e974030 drivers: sensor: icm566xx: Add ICM56622 and ICM56686 support
Use official TDK Invensense driver for ICM566xx sensor in tdk_hal module.

Signed-off-by: Aaron Kim <aaron.kim@tdk.com>
2026-08-05 13:54:23 +01:00
Etienne Carriere
0b3c5de775 drivers: usb: Use diamond include for non-local header files
Use #include <> instead of #include "" to include a header file which path
is not relative to the directory path of the file emitting the #include
directive.

This change was made running scripts/check_quoted_includes.py script
proposed in https://github.com/zephyrproject-rtos/zephyr/pull/112135
with the Linux shell command below and manually selecting the applicable
changes:
$ ./scripts/check_quoted_includes.py -w drivers/usb/

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-05 13:54:13 +01:00
Aleksandr Senin
2bb241bed8 drivers: net: ppp: accept frames without Address and Control fields
A peer that negotiated ACFC could not talk to us at all. The HDLC
receiver rejected such a frame twice: STATE_HDLC_FRAME_ADDRESS
resynchronised on any first octet other than 0xff, and ppp_process_msg()
dropped whatever survived unless the frame started with 0xff 0x03.
RFC 1662 ch. 3.2 requires accepting both forms.

Let STATE_HDLC_FRAME_ADDRESS fall through into STATE_HDLC_FRAME_DATA for
any non-delimiter octet, which also gives an ACFC frame the 0x7d
unescaping it needs when the Protocol field starts with 0x00, and make
the header removal peek before pulling.

The FCS needs no adjustment: it is computed over the frame as
transmitted, so an ACFC frame simply has fewer octets covered. The
Address and Control fields must not be synthesized back in.

Frames damaged by line noise are no longer rejected on the Address octet
and are now caught by the FCS check alone, which is why
NET_PPP_VERIFY_FCS defaults to y.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Aleksandr Senin <al@meshium.net>
2026-08-05 09:31:30 +02:00
Aleksandr Senin
c1142e344d drivers: net: ppp: clear escape state at HDLC frame boundaries
ppp->next_escaped is set when a 0x7d escape octet is received and cleared
only when the escaped octet itself arrives. A frame aborted mid-escape
(0x7d 0x7e, RFC 1662 ch. 4.2) therefore leaves the flag set, and the first
octet of the following frame that reaches STATE_HDLC_FRAME_DATA gets XORed
with 0x20.

Today the damage is limited because STATE_HDLC_FRAME_ADDRESS stores the
Address octet without consulting the escape state, so the corruption lands
on the Protocol field and the frame is dropped on an unknown protocol.

Clear the flag whenever a 0x7e delimiter is seen, in all three states that
can observe one.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Aleksandr Senin <al@meshium.net>
2026-08-05 09:31:30 +02:00
Etienne Carriere
707efc46fe drivers: i2c: stm32: k_work_submit() may fail
Consider k_work_submit() return value in STM32 I2C RTIO driver. If
failing the bus recovery sequence is not started in which case the
error must but reported to the caller and the RTIO queue should not
stall.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
2026-08-05 09:31:06 +02:00
Muhammad Waleed Badar
f6457d5e82 drivers: serial: remove BCM2711 auxiliary UART driver
Remove the dedicated BCM2711 auxiliary UART driver and its associated
Kconfig entry now that support has been integrated into the generic
NS16550 driver.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-08-05 09:28:40 +02:00
Muhammad Waleed Badar
d7c5d59863 drivers: serial: ns16550: add BCM283x auxiliary UART support
Add support for the Broadcom BCM283x auxiliary UART variant to the
NS16550 driver by introducing a dedicated Kconfig option and variant-
specific register definitions required for the extended register set.

This enables the generic NS16550 driver to support the auxiliary UART
found on Broadcom BCM283x SoCs.

Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
2026-08-05 09:28:40 +02:00
Saksham Gupta
575560f14d adc: it8xxx2: properly complete context on buffer size error
When check_buffer_size() fails, the driver was returning early
without calling adc_context_complete(). This caused the caller
to hang indefinitely waiting for the context to complete. We now
properly complete the context with the -ENOMEM error code.

Fixes #115091

Signed-off-by: Saksham Gupta <saksham77779@gmail.com>
2026-08-05 09:28:11 +02:00
Liam Ogletree
d8b9d44d10 drivers: uaol: Unify runtime PM log messages
Propagates #113545 to UAOL drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:27:16 +02:00
Liam Ogletree
3aebd685b4 drivers: sensor: Unify runtime PM log messages
Propagates #113545 to sensor drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:27:01 +02:00
Liam Ogletree
026bdb2003 drivers: gpio: Unify runtime PM log messages
Propagates #113545 to GPIO drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:26:47 +02:00
Liam Ogletree
a58de06b5e drivers: i2c: Unify runtime PM log messages
Propagates #113545 to I2C drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:26:36 +02:00
Liam Ogletree
a74c1af6dd drivers: dma: Unify runtime PM log messages
Propagates #113545 to DMA drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:26:14 +02:00
Liam Ogletree
f15701ed7a drivers: crypto: Unify runtime PM log messages
Propagates #113545 to crypto drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:25:55 +02:00
Liam Ogletree
d3e50bfcb3 drivers: adc: Unify runtime PM log messages
Propagates #113545 to ADC drivers.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-08-05 09:25:36 +02:00
Benjamin Cabé
75926ea323 drivers: pinctrl: numicro: Fix DINOFF read-modify-write
The DINOFF update read back SMTEN instead of DINOFF, so the write
seeded the input-disable register from Schmitt-trigger state and
destroyed the other pins' DINOFF bits. Read DINOFF, matching every
other read-modify-write in the function.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-05 09:23:21 +02:00
Ibrahim Abdalkader
ae44cc2f2b drivers: serial: uart_bridge: forward modem control lines to the peer
The bridge already forwards the port configuration (baudrate,
parity, etc...) to the peer, but not the modem control lines.
Forward DTR RTS state to the peer port as well, so a bridged
serial port carries the control lines through like a USB-serial
adapter does.

Note the forwarding is compiled in only if CONFIG_UART_LINE_CTRL
is enabled.

Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
2026-08-04 18:47:52 +01:00
Cesar Vandevelde
cd671e946d drivers: wifi: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
7a41b3b9f3 drivers: usb: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
793fddcad5 drivers: sdhc: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
8a72c9d8af drivers: mipi_dbi: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
0614624b14 drivers: ieee802154: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
1ef8abae05 drivers: i2s: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
0c6ba491d0 drivers: display: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
4c12b462d8 drivers: can: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
178f5065fc drivers: bluetooth: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Cesar Vandevelde
638778526d drivers: audio: use K_MSGQ_DEFINE_STATIC_TYPE
This macro eliminates manual size/alignment management and prevents
namespace collisions by moving internal queues to file-private scope.

Signed-off-by: Cesar Vandevelde <cesar.vandevelde@gmail.com>
2026-08-04 18:46:53 +01:00
Pierrick Guillaume
5328cc8008 drivers: hwspinlock: nxp: sema42: add new common driver config struct
Use the new hwspinlock_driver_config struct.

Signed-off-by: Pierrick Guillaume <pguillaume@fymyte.com>
2026-08-04 16:39:51 +01:00
Pierrick Guillaume
95bc28baf2 drivers: hwspinlock: sqn_hwspinlock: add new common driver config struct
Use the new hwspinlock_driver_config struct.

Signed-off-by: Pierrick Guillaume <pguillaume@fymyte.com>
2026-08-04 16:39:51 +01:00
Benjamin Cabé
7666505172 drivers: spi: gd32: Fix TX data load for 16-bit frames
The 16-bit branch of spi_gd32_frame_exchange() read the TX buffer
through a uint8_t pointer, copied from the 8-bit branch, so the high
byte of every 16-bit frame was transmitted as zero. Read a full
16-bit word, matching the RX side.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-04 16:39:24 +01:00
Seppo Takalo
d806fc861f drivers: modem: Add nRF91 Serial Modem V2 driver
Add modem driver for Nordic nRF91 series running the
Serial Modem application v2.0.0 or later. This includes the nRF91M1 module.

Signed-off-by: Seppo Takalo <seppo.takalo@nordicsemi.no>
2026-08-04 14:10:55 +01:00
Giovanni Piccari
d2ed3f98b8 drivers: modem: quectel_bc66x: fix default priority init
Fix BC66x initialization priorities, to run before the readiness
check in offloaded_if_api.

Signed-off-by: Giovanni Piccari <giopiccari@outlook.com>
2026-08-04 14:10:36 +01:00