Commit graph zephyr/drivers
Author SHA1 Message Date
Benjamin Cabé
b593fbf11a drivers: sensor: pcnt_esp32: enable unit interrupts in init
The init routine enables the high/low limit events, but those only set
the comparator enable in PCNT_Un_CONF0_REG: the event stays masked out
of PCNT_INT_ST_REG until PCNT_INT_ENA_REG is set. The ISR never ran, so
the software accumulator extending the 16-bit counter never advanced and
the reported count silently wrapped. The pending-wrap compensation in
the read path was inert too, as it reads the masked status.

Arm the interrupt for every unit after the ISR is allocated, as
ESP-IDF's pcnt_unit_alloc() does when count accumulation is requested.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:25:06 +02:00
Benjamin Cabé
817e92c518 drivers: sensor: afbr_s50: return after data evaluation error
When Argus_EvaluateData() failed, handle_error_on_result() already
completed the RTIO submission with an error, but the handler fell
through and completed the same submission again with rtio_iodev_sqe_ok(),
double-completing a released SQE. Return right after the error is
handled, matching the other error paths.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:25:04 +02:00
Benjamin Cabé
cb2339472a drivers: sensor: afbr_s50: init timestamp_delta on distance decode
The SENSOR_CHAN_DISTANCE decode path never assigned
readings[0].timestamp_delta, so consumers computing per-sample
timestamps read uninitialized bytes from the caller's buffer. Zero it,
matching the SENSOR_CHAN_AFBR_S50_PIXELS branch.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:25:04 +02:00
Benjamin Cabé
9c36938946 drivers: sensor: wsen_isds_2536030320001: reject zero gyro full scale
The gyroscope full scale list uses 0 as padding for the gaps in the
ISDS_gyroFullScale_t encoding, so a requested scale of 0 dps matched a
reserved entry and programmed an invalid register code, silently zeroing
all further gyro readings. Reject a zero full scale with -EINVAL.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:24:51 +02:00
Benjamin Cabé
fd1d5a5086 drivers: sensor: wsen_isds_2536030320001: fix temp fetch when odr is 0
SENSOR_CHAN_AMBIENT_TEMP shared a case block with SENSOR_CHAN_ALL that
required both the accelerometer and the gyroscope to be enabled, so
fetching the die temperature returned -ENOTSUP whenever either ODR was
set to the power-down entry. Give the temperature channel its own case
that derives the poll step from whichever engine is enabled.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:24:51 +02:00
Benjamin Cabé
769a16c7c3 drivers: sensor: wsen_isds_2536030320001: fix gyro full scale unit
The SENSOR_ATTR_FULL_SCALE getter for SENSOR_CHAN_GYRO_XYZ returned the
raw dps value from the full scale list, while the setter converts its
input with sensor_rad_to_degrees(), so a get-then-set round trip failed
with -EINVAL. Convert the reported range to rad/s to match the setter.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:24:51 +02:00
Benjamin Cabé
dfcf69d90c drivers: sensor: wsen_isds_2536030320001: fix accel full-scale unit
The SENSOR_ATTR_FULL_SCALE getter for the accelerometer returned the
raw range from the full scale list, which is expressed in g, while the
setter expects m/s^2 as mandated by the sensor API. Convert the value
with sensor_g_to_ms2() so the getter is the exact inverse of the
setter.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 14:24:51 +02:00
Benjamin Cabé
c199f92c7e Revert "drivers: timer: native_sim_timer: use the generic timer core"
This reverts commit 0342c930d2.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-20 19:40:13 -07:00
Francois Ramu
3951c15271 drivers: sdhc: stm32: Fix R2 response data order
Fix the Byte order when receiving a R2 response from the SDcard.
It will give the correct Device Size depending on the CSD structure.
For standard capacity SDSC memory cards, CSD struct if Version 1.0.
For high capacity SDHC and SDXC memory cards, CSD struct is Version 2.0.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2026-08-20 08:09:58 -07:00
Flavio Ceolin
5054384e98 drivers: charger: avoid leaking memroy in get_prop
z_vrfy_charger_get_prop() declared an uninitialized union
charger_propval on the kernel stack, passed it to the backend and then
copied it back to the caller unconditionally, ignoring the return code.

Signed-off-by: Flavio Ceolin <flavio@hubble.com>
2026-08-20 08:08:40 -07:00
Nicolas Pitre
0342c930d2 drivers: timer: native_sim_timer: use the generic timer core
hwtimer_enable(period) sets the next tick interrupt at now + period, so
it is a reload register and this is a RELOAD backend. The cycle counter
is nsi_hws_get_time(), microseconds since boot, so arming is a plain
forward of what the core computes.

Tickful keeps the period semantics: the driver arms once at init and the
model raises every subsequent tick on its own, which is what the core
expects of a RELOAD driver there. Tickless re-anchors on every announce.

last_tick_time, the ISR elapsed computation, sys_clock_set_timeout(),
sys_clock_elapsed() and both cycle getters move into the core. The ISR is
left with the announce.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-08-20 08:08:17 -07:00
Benjamin Cabé
b3e28bcee4 drivers: sensor: ccs811: report I2C errors from baseline fetch
ccs811_baseline_fetch() tested the i2c_write_read_dt() result with
"rc <= 0", which is also true on failure, so a failed transfer returned
the uninitialised stack value of baseline instead of the negative errno
the API documents. Test for success with "rc == 0".

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 08:07:28 -07:00
Samuel Slesar
75a3edf4f7 drivers: add MCXL LPI2C clocks
Add LPI2C0 and LPI2C1 clock rate handling for MCXL SoCs.

Signed-off-by: Samuel Slesar <samuel.slesar@nxp.com>
2026-08-20 14:16:00 +02:00
Vladislav Pejic
66412a2a21 drivers: adc: AD405x RTIO stream fix
Fix for RTIO streaming. This solves the problem when ADC is
configured for streaming, but adc_stream is not called. If any
interrupt accrues, it will cause an exception because is_streaming is
set in config but sqe in driver data is not.

Signed-off-by: Vladislav Pejic <vladislav.pejic@orioninc.com>
2026-08-20 14:15:15 +02:00
Philipp Steiner
be5e77c5b8 cleanup: remove copyright emails and reformat networking sources
Remove my email address from copyright notices across
board, fuel-gauge, networking, sample, and test files

Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
2026-08-20 14:14:56 +02:00
Benjamin Cabé
d4837e7c62 drivers: sensor: adt7420: don't disable the other trigger's interrupt
adt7420_trigger_set() unconditionally disabled both the INT and CT GPIO
interrupts but only re-enabled the line matching trig->chan, silently
killing a previously registered trigger on the other pin. Each disable
now happens in its own branch, guarded by that pin's presence, and the
trigger type is validated before any GPIO is touched.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 14:14:43 +02:00
Mark Wang
eea27d8e5b drivers: usb: uhc: mcux_ehci: remove nocache memory handling
Remove CONFIG_NOCACHE_MEMORY conditional code and associated nocache
memory allocation/deallocation logic from uhc_mcux_ehci driver.

The setup packet and transfer buffers are now handled by the common
UHC layer with proper cache alignment, making driver-specific nocache
memory management unnecessary.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-08-20 14:13:56 +02:00
Mark Wang
a588298fc3 usb: host: fix setup packet buffer cache align issue
Change setup_pkt to be usb requested address and size aligned,
This allows the setup packet buffer to be cache line size aligned.

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2026-08-20 14:13:56 +02:00
Albort Xue
58c9731489 drivers: flash: restore FlexSPI NOR config on PM TURN_ON
The FlexSPI controller configuration (LUT, per-device FLSHCR/DLLCR)
is lost when the controller power domain is powered down.  On
PM_DEVICE_ACTION_TURN_ON, reset the memc per-port LUT bookkeeping so
the probe re-allocates LUT slots from zero, then re-run the flash
probe to rebuild the device configuration and LUT from the chip.

Re-running the controller init or wiping the whole LUT is not
possible while the CPU executes XIP from the NOR, so the restore
relies on the ROM FCB controller-level state and replaces (not
clears) the LUT entries the driver owns.

Add memc_flexspi_reset_lut_alloc() to reset the per-port LUT
bookkeeping after a power-domain power-down.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
2026-08-20 10:52:59 +02:00
Benjamin Cabé
ead4d3c479 drivers: sensor: max30009: reject PLL-off attr writes while events armed
Attributes flagged MAX30009_ATTR_PLL_OFF cycle the PLL, and the
re-enable path polls the clear-on-read STATUS1 register. Running that
poll while streaming or triggers are active eats pending A_FULL /
FIFO_DATA_RDY events (permanently stalling an assert-once FIFO
watermark stream) or lets those readers consume the lock bits, causing
spurious -ETIMEDOUT. Return -EBUSY instead when a stream request is
pending or a trigger handler is registered.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 10:51:23 +02:00
Benjamin Cabé
12ffad5586 drivers: sensor: max30009: track runtime ADC OSR for sample period
The streamed FIFO sample period was computed from the const devicetree
ADC OSR code, so runtime SENSOR_ATTR_MAX30009_ADC_OSR changes were
ignored and decoded per-sample timestamps were wrong. Cache the OSR
code in driver data, update it on attribute writes, and use it when
computing the sample period.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 10:51:23 +02:00
Benjamin Cabé
2abd8f6782 drivers: sensor: max30009: fix NULL deref in flush_rtio error path
max30009_flush_rtio is only called after the streaming request was
already completed with rtio_iodev_sqe_ok and data->sqe was set to
NULL, so calling rtio_iodev_sqe_err(data->sqe, -ENOMEM) on SQE
acquire failure dereferenced NULL. Drop any partially acquired SQE
with rtio_sqe_drop_all instead, matching the other error paths.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 10:51:23 +02:00
Benjamin Cabé
ba8f1abb55 drivers: sensor: max30009: fix decoder writing array of q31_data structs
The decoder wrote a full struct sensor_q31_data per decoded FIFO
sample, striding ~32 bytes per frame, while get_size_info advertises
frame_size = sizeof(struct sensor_q31_sample_data) (8 bytes),
overflowing contract-sized buffers when max_count > 1. Fill a single
header/shift once and append samples to out->readings[] with proper
timestamp deltas, matching the sibling FIFO decoders.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-20 10:51:23 +02:00
Andreas Petter
c899bd73b4 drivers: can: mcp251xfd: throttle SPI clock until the PLL has locked
The driver runs all SPI transfers at the configured spi-max-frequency,
including the reset and oscillator-register accesses performed during
init. When pll-enable is set, SYSCLK is only the raw oscillator until
the PLL locks in mcp251xfd_init_osc_reg(). The datasheet requires
FSCK <= 0.85 * (FSYSCLK / 2) (DS20006624B, Table 9-7 Note 3; §5.0
Note 1) and the silicon errata (DS80000984A, item 4) warns that
exceeding it corrupts RAM writes that coincide with CAN bus activity.
With, for example, a 4 MHz oscillator and an 18 MHz SPI clock the init
transfers run roughly 10x over the limit.

Run the init transfers on a clamped copy of the devicetree SPI config
and switch back to the devicetree config once the PLL has locked. The
active config is exchanged as a pointer rather than modified in place,
since SPI drivers detect configuration changes by pointer comparison
and would ignore an in-place frequency update. Without the PLL, the
devicetree config is used from the start.

Signed-off-by: Andreas Petter <Andreas.Petter@mcnetic.de>
2026-08-20 10:50:16 +02:00
Andreas Petter
f932b2c039 drivers: can: mcp251xfd: account for the 10x PLL in the core clock
mcp251xfd_get_core_clock() returns the raw osc-freq value regardless of
whether the PLL is enabled. When pll-enable is set, the controller's
SYSCLK is the oscillator frequency multiplied by 10 (OSC.PLLEN), and
the driver does enable the PLL in mcp251xfd_init_osc_reg(). The bit
timing is therefore computed against a tenth of the real SYSCLK, so the
actual bus bitrate ends up 10x higher than configured and the node
cannot communicate (it stays error-passive).

Return osc-freq * 10 when pll-enable is set so the timing calculation
uses the real SYSCLK.

Signed-off-by: Andreas Petter <Andreas.Petter@mcnetic.de>
2026-08-20 10:50:16 +02:00
Zhaoxiang Jin
882bd491f0 drivers: timer: nxp_os_timer: add generic low-power companion support
On SoCs that power off the OS Timer in deep low-power states, the driver
can now delegate low-power timekeeping to the generic system-timer
low-power companion framework (CONFIG_SYSTEM_TIMER_LPM_COMPANION_*).

Select SYSTEM_TIMER_HAS_LPM_COMPANION_SUPPORT and add a new
"handoff-power-states" devicetree property: when entering one of the listed
states the driver arms the companion counter chosen via
/chosen/zephyr,system-timer-companion and recovers the elapsed time on
wakeup.

The legacy deep-sleep-counter path is unchanged; boards on it do not set
handoff-power-states and keep handing off in PM_STATE_STANDBY as before.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-08-20 08:53:51 +02:00
Nicolas Pitre
1d32fe9153 kernel: inline k_sleep() and k_usleep() over a tick primitive
k_sleep() and k_usleep() resolve to an out of line implementation living in
another translation unit, a system call under CONFIG_USERSPACE and a plain
call otherwise.  Either way the compiler sees neither whether the requested
duration is a constant nor whether the caller cares about the returned
value, so it always emits the tick to millisecond and microsecond
conversions.  Those conversions are the only thing that drags the 64 bit
division helper into many small builds: CONFIG_SYS_CLOCK_TICKS_PER_SEC
defaults to 10000 on tickless platforms, which lands in the integer
division path and divides a 64 bit value by ten, something GCC will not
strength reduce on a 32 bit target.

Promote the former z_tick_sleep() helper to a k_sleep_ticks() system call
that reports the remaining time in ticks, and rebuild k_sleep() and
k_usleep() as inlines on top of it.  The conversions now live at the call
site where the compiler can fold or discard them.  Nearly every caller
discards them: of the 4036 sleep call sites in the tree, exactly six use
the returned value, and only three of those are outside of tests.

What this removes is best seen in the two out of line entry points that
disappear, which on a nucleo_f030r8 (Cortex-M0, 10000 ticks/s) were the
only two callers of the 64 bit division helper in the whole image:

  08002594 <z_impl_k_sleep>:
        bl      8001... <z_tick_sleep>
        ...
        movs    r0, #9            /* the ceil() bias, 10 - 1 */
        adds    r0, r0, r2
        adcs    r1, r3
        movs    r2, #10           /* ticks / 10 -> milliseconds */
        bl      8000180 <__aeabi_uldivmod>

  080025c0 <z_impl_k_usleep>:
        movs    r0, #99           /* the ceil() bias, 100 - 1 */
        ...
        movs    r2, #100          /* microseconds / 100 -> ticks */
        bl      8000180 <__aeabi_uldivmod>
        bl      8001... <z_tick_sleep>

Both are gone, and so are __aeabi_uldivmod and __udivmoddi4, which are no
longer referenced anywhere.  A k_usleep(250) call site now passes the
literal 3 ticks the compiler worked out on its own, where it used to pass
250 microseconds to a helper that divided by 100 at runtime.  For a loop
calling k_msleep(100), k_sleep(K_SECONDS(1)) and k_usleep(250) without
using the results, FLASH drops from 11028 to 10600 bytes.

No trace point is emitted here.  The existing sleep hooks take a duration
in milliseconds or microseconds, which no longer describes what this
function is handed, and tracing cannot live in the inlines either: every
tracing backend header includes kernel.h, so a translation unit reaching a
backend header first would expand SYS_PORT_TRACING_* before those macros
exist.  The following commit gives k_sleep_ticks() a hook of its own.

The duration goes through Z_TIMEOUT_US() rather than an open coded
conversion.  That clamps a negative argument to zero, which k_usleep()
never did: it used to truncate the 64 bit conversion into an int32_t
first, which hid the worst of it, and passing it through whole would turn a
negative duration into a sleep of roughly 1.8e17 ticks rather than a bogus
absolute deadline.  The macro also carries the cast to k_ticks_t that C++
needs, since Z_TIMEOUT_TICKS_INIT() is a braced initializer there and an
unsigned to signed conversion inside one is a narrowing error.

This also removes a potential link error.  k_usleep() had no
implementation at all with CONFIG_MULTITHREADING=n, since nothread.c only
ever provided z_impl_k_sleep(), so any caller failed to link.  Nothing in
the tree happens to call it in that configuration, which is presumably why
it went unnoticed; a single z_impl_k_sleep_ticks() now serves both.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-08-20 08:52:31 +02:00
Roman Leonov
6bfc3047c2 driver: usb: uhc_dwc2: use generic base getter in suspend/resume
Use the uhc_dwc2_get_base() in port_suspend()
and port_resume() as the base member is available
via helper, that calls DEVICE_MMIO_NAMED_GET as a
follow-up for 528a0627ed.

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
2026-08-19 18:43:00 -04:00
Gaofeng Zhang
b8e688ae18 module: Kconfig: extend WIFI_RECOVERY support to IW61X and IW416
WIFI_RECOVERY was only available for RW610 and IW610,
extend the depends to also support IW61X
and IW416 which use SDIO interface and can leverage
the same command-timeout-based recovery mechanism.

Signed-off-by: Gaofeng Zhang <gaofeng.zhang@nxp.com>
2026-08-19 18:41:28 -04:00
Bo Sun
c02a99fa56 drivers: serial: ns16550: add automatic DLF calculation
The static 'dlf' property is valid only for a specific PCLK/baud rate
combination. The current calculation accounts for this fixed value when
selecting the integer divisor, but cannot adapt to runtime baud rate
changes.

A low fixed PCLK may require a fractional divisor to reduce baud rate
error for the requested baudrate.

Add an opt-in 'dlf-auto' property to calculate the integer divisor and
DLF value together whenever the baud rate changes, using 1/64-resolution
fixed-point arithmetic. When enabled, 'dlf-auto' overrides 'dlf'.

Also enable DLF support when an instance uses either 'dlf' or
'dlf-auto'. Existing 'dlf' users are unaffected.

Signed-off-by: Bo Sun <bo.sun@kernel.li>
2026-08-19 18:40:54 -04:00
Fiona Behrens
a36a77e9b8 drivers: reset: add ch32 reset controller
Add reset driver for the reset part of the ch32 rcc.

Use this new reset driven in `wch,usart` to reset the usart peripheral
before use.

Signed-off-by: Fiona Behrens <me@kloenk.dev>
2026-08-19 18:40:22 -04:00
Benjamin Cabé
d97541ecf2 drivers: gpio: add VIRTIO GPIO driver
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>
2026-08-19 18:40:12 -04:00
Benjamin Cabé
7bdd9031b4 drivers: led: lp5562: fix off states using maximum brightness
Commit 62c1fb2097 replaced both minimum-brightness uses with
LED_BRIGHTNESS_MAX, so turning an LED off and the off phase of a blink
program set full brightness instead. Use 0, the minimum brightness the
LED API defines.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 18:39:50 -04:00
Aksel Skauge Mellbye
2b060333bf drivers: comparator: silabs: Use sl_hal_acmp instead of emlib
Update driver to use new HAL library that supports both
Series 2 and Series 3 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-19 17:14:14 +01:00
Aksel Skauge Mellbye
005539a151 drivers: spi: silabs: Use sl_hal_eusart instead of emlib
Update EUSART driver to use new HAL library that supports both
Series 2 and Series 3 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-19 17:12:37 +01:00
Aksel Skauge Mellbye
5c8ea82aa9 drivers: serial: silabs: Use sl_hal_eusart instead of emlib
Update driver to use new HAL library that supports both
Series 2 and Series 3 SoCs.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-19 17:12:37 +01:00
Sylvio Alves
2c3a8d29d5 drivers: sdhc: esp32: fix sd card init hang on command write
The sdmmc_ll_set_command helper writes the command register
through memcpy, which the compiler expands into four byte
stores. The peripheral bus only accepts 32-bit accesses, so
the command never reached the card interface unit and the
driver spun forever waiting for it to be taken.

Restore the single word store to the command register. This
is a regression from f4c7092ad6.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2026-08-19 17:11:57 +01:00
Aksel Skauge Mellbye
2cdeab0a59 drivers: debug: silabs_pti: Use RAIL 3.0 API
Use the RAIL 3.0 HAL API to configure Packet Trace.

Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
2026-08-19 17:11:48 +01:00
Baptiste Coffin
668a508c31 drivers: ieee802154: mcxw: restore channel after CSL RX
Channel restore was only performed for failed CSL receptions
(gPlmeTimeoutInd_c in plme_mac_sap_handler). Successful CSL
receptions (gPdDataInd_c in pd_mac_sap_handler) were missing
the rf_restore_main_channel() call, leaving the PHY on the
temporary CSL channel after a successful reception.

Add rf_restore_main_channel() call in pd_mac_sap_handler so
that the main network channel is always restored after any
CSL RX slot, regardless of the outcome.

Signed-off-by: Baptiste Coffin <baptiste.coffin_1@nxp.com>
2026-08-19 17:11:11 +01:00
Baptiste Coffin
e4df18e41f drivers: ieee802154: mcxw: fix selective txchannel
Two bugs are fixed:

1. IEEE802154_HW_SELECTIVE_TXCHANNEL capability was always advertised
   regardless of CONFIG_IEEE802154_SELECTIVE_TXCHANNEL. Guard it behind
   the Kconfig option as required by the driver API documentation.

2. The selective TX channel feature was not implemented. When
   CONFIG_IEEE802154_SELECTIVE_TXCHANNEL is enabled, use the per-packet
   TX channel (set by the upper layer for CSL timed transmissions) for
   TXTIME and TXTIME_CCA modes. The txchannel field is only valid for
   timed TX modes as it shares storage with the lqi/rssi fields.

Fixes: https://github.com/zephyrproject-rtos/zephyr/issues/111211

Signed-off-by: Baptiste Coffin <baptiste.coffin_1@nxp.com>
2026-08-19 17:11:08 +01:00
Marvin Gnad
adfe1dc581 drivers: gpio: mcux_igpio: serialize DR and GDIR read-modify-writes
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>
2026-08-19 17:10:54 +01:00
Corey Wharton
d8e2fccbb9 drivers: sensor: ti: tmp114: add PM support
Add device power management so the sensor can sit under a power domain
that may be unpowered at init. Bring-up moves to a PM_DEVICE_ACTION_TURN_ON
handler, and RESUME/SUSPEND toggle the config register shutdown bit.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2026-08-19 17:08:04 +01:00
Jose Morales
c93a8e0685 drivers: sensor: akm09918c: condition fetch delay
The akm09918c driver imposes and unconditional wait time on fetch. This
is only neccesary for single-shot sampling. If the sensor is configured in
continuous mode, an application can time the fetch to align with the sensor
ODR. For continous mode operation it does not make sense to have an
artificial delay added - if the application is trying to fetch values at a
higher frequency than the ODR it can just handle the -EBUSY by adding
its own delay and retrying the fetch or reading the old values.
Verified this change testing parallel sampling with an LSM6DSO IMU,
Fetching all channels on DRDY of the IMU with the same ODR configured
for both IMU and magnetometer.

Signed-off-by: Jose Morales <josfemova@gmail.com>
2026-08-19 17:07:30 +01:00
Jonathan E. Peace
aafd4a1585 drivers: entropy: add Broadcom BCM2835 RNG driver
Add a driver for the simple hardware RNG block on the BCM2835 /
BCM2836 / BCM2837 / BCM2710 SoCs (Raspberry Pi 1/2/3/Zero family).
The block is a small four-register FIFO, distinct from the iProc
RNG200 on the BCM2711 (Raspberry Pi 4).

Enable it on the Raspberry Pi Zero 2 W as the board entropy source.

Signed-off-by: Jonathan E. Peace <jep@alphabetiq.com>
2026-08-19 17:06:53 +01:00
CHEN Xing
53cd2e23be driver: usb: udc: add support for sama7g5 UDPHS
Add driver for sama7g5 UDPHS

Signed-off-by: CHEN Xing <xing.chen@microchip.com>
2026-08-19 17:06:42 +01:00
Fabio Baltieri
25040cac20 drivers: serial: stm32: declare few lock functions as maybe unused
This fixes a potential build warning introduced in 7b2a3c0cca, where
the static functions would get declard but not used if the board has:
- CONFIG_PM=y
- CONFIG_UART_ASYNC_API=y
- CONFIG_DMA=y
- the dma node enabled in devicetree

Reproduced with:

west build -p -b stm32f4_disco samples/hello_world -DCONFIG_PM=y
-DCONFIG_UART_ASYNC_API=y -DCONFIG_DMA=y

zephyrproject/zephyr/drivers/serial/uart_stm32.c:218:13: warning:
'uart_stm32_rx_wakeup_lock_get' defined but not used

Found this downstream, finding the specific combination of option and
dt override to reproduce this was a big mess, there's no benefit chasing
down the specific combination of ifdeffery here so let's just mark them
as maybe unused and if that combo hits the compiler can just drop them.
Between ifdefs form Kconfig and the HAL this driver is already VERY hard
to follow.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-08-19 17:06:13 +01:00
Benjamin Cabé
12759875f6 drivers: timer: assert the tick against the counter, not the alarm
TIMER_CORE_MAX_UNANNOUNCED_CYCLES is the smaller of what the counter can
resolve and what the alarm register holds, and those two bound different
things. Outrunning the counter leaves the masked delta ambiguous, which
no amount of re-arming recovers. Outrunning the alarm only means the
deadline takes more than one arm to reach.

Asserting on the pair therefore rejects configurations that keep time
correctly, such as the kernel benchmarks at one tick per second on a
25 MHz SysTick: a tick is 25000000 cycles against a 24-bit LOAD, yet
sits well inside the counter's span. Assert on the counter alone.

The arm path still clamps to the pair, so no alarm is programmed out of
range. A tick past the alarm's reach costs extra interrupts, as it did
before the assert existed.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 09:01:08 -05:00
Benjamin Cabé
4dc75cca50 drivers: timer: only build-assert the tick span where it is constant
The tick-versus-span BUILD_ASSERT sits in the branch where cycles per
tick is a macro, but that branch also covers
CONFIG_SYSTEM_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_UPDATE, whose rate is a
function call. The assertion expression is then not constant and the
build fails, as it does for sample.cpu_freq.thermal_cap on frdm_mcxn236.

Emit it only where TIMER_CORE_CHECK_CYC_PER_TICK_AT_INIT is unset, the
same guard the neighbouring cycles-per-tick != 0 assert already uses.
timer_core_init() runs the check at run time for the remaining cases.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-19 09:01:08 -05:00
Hashimoto Kenichi
c0bba90c36 drivers: ethernet: nxp_enet: mask the interrupt status with EIMR
eth_nxp_enet_isr() branches on ENET_GetInterruptStatus(), a plain read
of EIR, which is not the set of pending interrupts: "EIR[RXF] reflects
the state of the interrupt signal even if the corresponding EIMR field
is cleared", and an interrupt is raised only "if the corresponding bit
in the interrupt mask register (EIMR) is also set" (i.MX RT1170 RM rev
5, sections 60.5.1.2 and 60.5.1.3).

So a branch is taken for an event the driver has masked off. The receive
path relies on masking: it disables kENET_RxFrameInterrupt, submits
work, and re-enables only once the handler has drained the ring. Until
then every transmit interrupt re-enters the receive branch and resubmits
work that is already queued.

Masking the status loses nothing, since the interrupt line is itself EIR
qualified by EIMR.

Signed-off-by: Hashimoto Kenichi <hashimoto.kenichi@genetec.co.jp>
Assisted-by: Claude:claude-opus-5
2026-08-19 11:28:53 +02:00
Nicolas Pitre
19f807a9df drivers: timer: do not spell the driver primitives inline
The core describes timer_driver_cycle_get() and the arming primitives as
static inline, which reads as a requirement. It is not one: they have a
single call site each, and the compiler folds them in at -Os without the
keyword. Checked on kit_psc3m5_evk, where neither
timer_driver_set_reload() nor the lptimer_delay() it calls leaves a
symbol behind.

Thirteen of the drivers converted so far declare the arming primitive
plain static already, the split falling by size rather than by intent, so
say static and leave inline to whoever writes the driver.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2026-08-19 11:28:43 +02:00