Commit graph zephyr/drivers
Author SHA1 Message Date
Pete Johanson
8a46a12e9c drivers: sensor: Fix multiple streaming requests for ADXL362
Properly clear the watermark IRQ value when handling no active SQE, to
ensure that multiple sequential streaming requests work properly.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-10-09 16:51:29 +02:00
Mikey Sklar
83ae588dbb drivers: wifi: siwx91x: fix sign of reported RSSI
WiSeConnect reports rssi_val as an unsigned magnitude:

    uint8_t rssi_val;      ///< RSSI value of the AP

but struct wifi_scan_result.rssi is int8_t dBm. Assigning straight across
reports every AP as positive, so an AP at -76 dBm surfaces as +76. Any
consumer that sorts or thresholds by signal strength gets the ordering
backwards, and nothing above the driver can recover the sign.

Negate on assignment.

Verified on a SiWx917-DK2605A: scan results now match what a phone reports
at the same spot within a couple of dBm, and move in the right direction as
the board is walked away from the AP.

Assisted-by: Claude:claude-opus-5
Signed-off-by: Mikey Sklar <mikeysklar@gmail.com>
2026-10-09 16:50:42 +02:00
Ryan Erickson
400988e123 drivers: i2s: mcux_sai: fix pointer casts for 64-bit hosts
The mcux_sai driver casts pointers to and from uint32_t in several
places, which truncates on 64-bit hosts (AArch64) and produces
-Wpointer-to-int-cast / -Wint-to-pointer-cast warnings. On i.MX93
all DMA-visible memory and peripheral bases live below 4 GiB so the
truncation is lossless today, but the pattern is unsafe on any
future 64-bit NXP SoC with DRAM above 4 GiB physical.

* Route TDR/RDR peripheral pointers and mem_block pointers through
  uintptr_t before assigning to dma_block_config address fields or
  passing to dma_reload().

* Route the mclk control-register base address through uintptr_t
  before casting to uint32_t *.

* Route the clock_control set_rate value through uintptr_t before
  casting to clock_control_subsys_rate_t (which is void *).

* Use %p with (void *) casts in LOG_DBG for free_list / buffer
  pointers instead of casting them to uint32_t and printing with
  0x%x.

No functional change on 32-bit targets; eliminates the remaining
build warnings from this driver on
nitrogen93_smarc/mimx9352/a55/nx611.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Ryan Erickson
f234b44ce1 drivers: dma: mcux_edma: fix pointer casts for 64-bit hosts
The mcux_edma driver assigns pointers to and from uint32_t in several
places, which truncates on 64-bit hosts (AArch64) and produces
-Wpointer-to-int-cast / -Wint-to-pointer-cast warnings. On i.MX93 all
DMA-visible memory happens to live below 4 GiB so the truncation is
lossless today, but the pattern is unsafe on any future 64-bit NXP
SoC with DRAM above 4 GiB physical.

Route the conversions through uintptr_t so the compiler sees a
matching-width intermediate:

* Cast dma_block_config address fields through uintptr_t before
  handing them to EDMA_PrepareTransfer as void *.

* Cast tcd (edma_tcd_t *) through uintptr_t before truncating to
  uint32_t for comparison against hw_id, which comes from the 32-bit
  EDMA_GetNextTCDAddress() hardware register.

* Cast the src/dst uint32_t arguments of edma_reload_dynamic through
  uintptr_t before feeding them to EDMA_PrepareTransfer as void *.

No functional change on 32-bit targets; eliminates 9 build warnings
on nitrogen93_smarc/mimx9352/a55/nx611.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Ryan Erickson
1783873470 Bluetooth: fix format specifiers for size_t/ssize_t
Several LOG_ and __ASSERT format strings use %u or %d for arguments
that are size_t or ssize_t, which produces -Wformat= warnings on
LP64 targets (e.g. AArch64). Switch to %zu / %zd.

* subsys/bluetooth/host/classic/sdp.c: three format strings that
  compare against sizeof() or use ssize_t counters.

* drivers/bluetooth/hci/hci_nxp_setup.c: matching V1 and V3
  "Out of sending buffer range" messages (both LOG_ERR and the
  neighbouring __ASSERT that uses the same string).

No functional change; eliminates 5 build warnings on
nitrogen93_smarc/mimx9352/a55/nx611.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Ryan Erickson
be028b2dbe drivers: dma: mcux_edma: imply NOCACHE_MEMORY on cached CPUs
The MCUX eDMA v3 and v4 drivers program the DMA controller to read
transfer control descriptors (TCDs) and buffer chains directly from
memory without any cache-maintenance operations. On SoCs whose CPU
has a data cache and the DMA is not hardware cache-coherent (e.g.
i.MX93 A55), that produces stale reads and dropped writes at both
the TCD and the payload buffer, manifesting as random DMA misbehavior
or silent data corruption.

Add `imply NOCACHE_MEMORY if CPU_HAS_DCACHE` to DMA_MCUX_EDMA_V3 and
DMA_MCUX_EDMA_V4 so the kernel places DMA-visible regions in the
non-cacheable section by default. Users on cache-coherent SoCs can
still disable NOCACHE_MEMORY explicitly.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Ryan Erickson
4e91198ddf drivers: i2s: mcux_sai: retune SAI root clock to sample rate family
The mcux_sai driver programs a fixed 12.288 MHz MCLK at initialization
(48 kHz family). When the application later configures a 44.1 kHz
stream, the SAI has no valid integer bit-clock divider to produce a
44.1 kHz LRCK; the codec receives an out-of-spec clock ratio and
produces silence.

On platforms without CONFIG_I2S_HAS_PLL_SETTING (i.e. those whose
MCLK is fed from a runtime-tunable CCM root rather than a
DT-static anatop PLL as on the i.MXRT series), pick an MCLK that
matches the requested frame_clk_freq's family (11.2896 MHz for the
44.1 kHz family, 12.288 MHz for the 48 kHz family) and re-program the
SAI root clock in i2s_mcux_config() before computing bit-clock
dividers. The platform's clock_control driver is responsible for
retuning the underlying audio PLL when the requested rate crosses
families.

Verified on nitrogen93_smarc (i.MX93 A55) playing 44.1 kHz stereo SBC
audio through a WM8962 codec.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Ryan Erickson
e59808ce3b drivers: clock_control: mcux_ccm_rev2: support 44.1kHz-family SAI clocks
The i.MX93 SAI root clock derives its MCLK by integer division of
AUDIO_PLL1. Programming AUDIO_PLL1 at a fixed 393.216 MHz can only
generate integer-divided MCLKs in the 48 kHz family (12.288 MHz,
24.576 MHz, ...). A request for any 44.1 kHz-family rate (11.2896 MHz,
22.5792 MHz, ...) picks a wrong divider and rounds to a 48 kHz-family
MCLK, silently producing an out-of-spec SYSCLK:LRCK ratio at the codec
and no valid audio.

Select AUDIO_PLL1 based on the requested SAI root rate: 361.2672 MHz
(24 MHz * (150 + 66/125) / 10) for the 44.1 kHz family, keeping the
existing 393.216 MHz for the 48 kHz family. Detection is done by
integer-divisibility of the target rate; unknown rates fall back to
the 48 kHz-family PLL (existing behavior). Wrap the case body in a
compound statement so the new local variable declarations are legal.

Verified on nitrogen93_smarc (i.MX93 A55) with the a2dp_sink sample
requesting 11.2896 MHz for 44.1 kHz stereo SBC audio; the read-back
MCLK matches the requested value exactly.

Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
2026-10-09 16:49:48 +02:00
Tim Lin
c269f70274 drivers/i2c: it8xxx2: Fix spurious IRQ0 with HOSTA readback
The EC peripheral clock runs at 8 MHz, slower than the CPU. Even after
HOSTA status is cleared, the CPU can return from the ISR before the
updated peripheral state is visible to the interrupt controller. This
stale peripheral state can trigger a spurious IRQ0.

Read back HOSTA on both the FIFO and PIO continuation paths to
synchronize the preceding SMBus register writes before returning from
the ISR. This prevents interrupt handling from resuming with stale
peripheral state and fixes the spurious IRQ0.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-10-09 08:36:13 +02:00
Filip Stojanovic
1c6106ead4 drivers: mspi: stm32: qspi: make chip select high time configurable
The number of clock cycles the chip select stays high between commands
was hardcoded to one cycle, both in the handle initializer and in
mspi_stm32_qspi_hal_init(). The legacy flash_stm32_qspi driver takes it
from the cs-high-time property, which several boards set to meet the
timing required by their flash: at 72 MHz one cycle is about 14 ns,
while those parts require 30 to 50 ns.

Add st,cs-high-time to the controller binding, with the same range and
default of 8 cycles as the legacy binding, and use it when initializing
the handle. A higher value than needed only reduces throughput, so the
default is safe for boards that do not set the property.

Build tested with samples/drivers/mspi/mspi_flash on
arduino_giga_r1/stm32h747xx/m7 and stm32l496g_disco. Not tested on
hardware.

Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
2026-10-09 08:35:57 +02:00
Filip Stojanovic
d828b21129 drivers: mspi: stm32: qspi: derive flash size from devicetree
The QSPI handle was initialized with a hardcoded FlashSize of 0x19,
which describes a 64 MB device regardless of the size declared in
devicetree. The legacy flash_stm32_qspi driver computes the value from
the flash size, and the MSPI OSPI and XSPI drivers derive it from the
child node as well.

Use the same macro here, keeping 0x19 as the fallback when the
controller has no enabled child, so behavior is unchanged in that case.

Build tested with samples/drivers/mspi/mspi_flash on
arduino_giga_r1/stm32h747xx/m7 and stm32l496g_disco. Not tested on
hardware.

Signed-off-by: Filip Stojanovic <filipembedded@gmail.com>
2026-10-09 08:35:57 +02:00
Andrzej Głąbek
80cf3ccc95 drivers: flash_mspi_nor: Fix transfer mode used by sfdp_read()
This is a follow-up to commit eb318914c2.

SFDP reads are not just short control or configuration transfers
and may actually involve transferring significant amounts of data,
so they should use the same transfer mode as normal data reads.
And this is not only a question of efficiency of the transfers.
For example, for the Synopsys DW SSI controller, if a fairly long
transfer is performed in single IO mode without using DMA, it may be
interrupted by the controller when the CPU won't cope with refilling
the controller's TX FIFO on time.
Use then `data_xfer_mode` instead of `control_xfer_mode` for SFDP
transfers.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2026-10-09 08:35:41 +02:00
Aric Radzin
660311db84 drivers: adc: shell: fix periodic read not stopping on key press
The periodic mode of the adc shell read command set a bypass callback
and then looped on the shell thread until the callback flagged a stop.
The shell only invokes bypass callbacks from the shell thread once the
command handler has returned, so the callback never ran and the read
continued indefinitely.

Take the periodic samples from a dedicated thread instead and return
from the command right after setting the bypass, as done by the dmic
shell level meter. The system workqueue is not used because several
ADC drivers complete a read from work they submit to it, which would
deadlock. Any received byte removes the bypass and gives a semaphore
that the thread waits on between samples, so the read stops without
waiting out the period.

Add CONFIG_ADC_SHELL_PERIODIC_READ_STACK_SIZE for the thread's stack.

Fixes #119916

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Aric Radzin <aric.radzin@gmail.com>
2026-10-09 08:35:19 +02:00
Tim Lin
abf0ba1b9a drivers/interrupt_controller: it51xxx: Fix interrupt IRQ bounds check
CONFIG_NUM_IRQS specifies the number of supported IRQs, so the valid
IRQ range ends at CONFIG_NUM_IRQS - 1.

Reject IRQ numbers greater than or equal to CONFIG_NUM_IRQS in IT51XXX
interrupt controller implementations to prevent out-of-bounds register
access.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-10-09 08:34:34 +02:00
Tim Lin
ecbec3e4d6 drivers/interrupt_controller: it8xxx2: Fix interrupt IRQ bounds check
CONFIG_NUM_IRQS specifies the number of supported IRQs, so the valid
IRQ range ends at CONFIG_NUM_IRQS - 1.

Reject IRQ numbers greater than or equal to CONFIG_NUM_IRQS in IT8XXX2
interrupt controller implementations to prevent out-of-bounds register
access.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2026-10-09 08:34:34 +02:00
YunHung Hua
e2dd5346bb drivers: serial: stm32: keep the UART running when configure fails
uart_stm32_configure() disables the USART, applies the new parameters
and returns -ENOTSUP if the baud rate is rejected. The USART is left
disabled with the new framing already applied, so on a console UART
the next poll_out() waits forever for TXE.

Set the baud rate before any other field, and check its range before
writing any register, so a rejected configuration leaves the registers
untouched. configure() then only re-enables the USART and the previous
configuration keeps working.

Fixes #121176

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
2026-10-08 15:10:26 +02:00
YunHung Hua
d0fd0a9a5b drivers: serial: stm32: reject baud rates beyond the BRR range
On the USART path, uart_stm32_set_baudrate() only rejects a USARTDIV
below 16. BRR is 16 bits wide and LL_USART_SetBaudRate() writes the
divider truncated to uint16_t, so a rate whose divider exceeds 0xFFFF
is programmed as a faster rate and the call still returns 0: 1200 baud
from an 84 MHz clock needs a divider of 70000, which is written as 4464
(18817 baud). Reject those rates as well.

Fixes #121176

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: YunHung Hua <oliverhua.us@gmail.com>
2026-10-08 15:10:26 +02:00
Liam Ogletree
8fd293a76e drivers: haptics: Fix timeout register addresses for CS40L26
Corrects active/standby timeout register addresses for both
Peart A1 and B0 ROM.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-10-08 15:04:14 +02:00
Liam Ogletree
3708c2c444 drivers: haptics: Refactor and unify timeout configurations
Timeout configuration shouldn't be gated by runtime power
management in the CS40L5x driver, and the CS40L26/27 driver
should use milliseconds like CS40L5x. Simplify the CS40L5x
implementation and update CS40L26/27 to match the CS40L5x
implementation. Update the default standby and active
timeouts to be consistent with the Linux implementation
for CS40L26/27.

Signed-off-by: Liam Ogletree <liam.ogletree@cirrus.com>
2026-10-08 15:04:14 +02:00
Max Campbell
143c79b4d6 drivers: usb_c: tcpc: make PD message header byte order explicit
The tcpci, ps8xxx, fusb307, and rt1715 drivers do not consistently
convert the PD Message header to and from little endian (LE) byte
order.

Update the drivers to use sys_get_le16() and sys_put_le16() when
reading and writing the PD Message header, adding these helpers where
they are missing and replacing hand-rolled shift operations.

Signed-off-by: Max Campbell <git@0m.ax>
2026-10-08 15:03:56 +02:00
Hsiu-Chi Tsai
88c54b2864 drivers: gpio: emul: apply the mask in the masked output getter
gpio_emul_output_get_masked() validates its mask and then never applies
it: the value it stores is every output pin on the port, while the
doxygen says it holds the value of the pins asked for.

Nothing in tree reads a wrong value today, because the only caller is
gpio_emul_output_get(), which applies BIT(pin) to the result itself. A
test reading several lines back through the masked getter does see the
other outputs, which is how this turned up.

The regression test drives one pin high and asks for a different one.
It fails on the unfixed driver, reporting 0x1 outside the mask, and
passes with the fix. gpio_basic_api and the gpio_kbd_matrix input test,
which uses the single-pin wrapper, both still pass.

Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
2026-10-08 10:53:27 +02:00
Manimaran A
3d015693dc drivers: espi: xec: taf: get QMSPI GIRQ from qspi0 node label
The TAF v2 driver takes the QMSPI0 GIRQ from the first instance of
the microchip,xec-qmspi-ldma compatible. The TAF block is tied to
QMSPI0 and only needs the node's girqs property, which every QMSPI
binding has. Selecting qspi0 with the microchip,xec-qmspi-controller
compatible (MSPI driver) breaks the TAF build with an undefined
DT_INST(0, microchip_xec_qmspi_ldma).

Use DT_NODELABEL(qspi0). All SoC dtsi files with a TAF v2 node
define this label.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2026-10-08 10:53:12 +02:00
Jinming Zhao
dba36b6024 drivers: timer: hpet: guard early counter reads on 64-bit
Spinlock time-limit checks may read the cycle counter before the HPET
registers have been mapped. The unmapped-MMIO guard currently only
covers 32-bit builds, so early reads on x86_64 dereference address 0xf0.
Move the existing guard before the word-size split so both counter
read paths return zero until the mapping is available.

Signed-off-by: Jinming Zhao <jinmzhao@qti.qualcomm.com>
2026-10-08 10:47:23 +02:00
Mathieu Choplain
d0a8a8d2f8 drivers: dma: stm32u5: add build error workaround for STM32WBA2x SoCs
The LL_DMA_SetDestIncMode() function is wrongfully gated behind
`#ifdef GPDMA1` inside STM32CubeWBA v1.10.0's LL DMA header.
Since this condition is never satisfied on STM32WBA2x line SoCs,
which only contain an LPDMA, attempting to use the DMA driver fails
with a build error... even though the function SHOULD be available
since the underlying hardware feature does exist; in fact, the function
LL_DMA_GetDestIncMode() is not gated to GPDMA in that same header...

Implement the missing function by ourselves when the target is one of
the affected SoCs such that the driver can build, and redirect to the
original function on all other targets to prevent regressions. This
approach avoids need for a patch on the hal_stm32 side and an update
to zephyr.yml on the Zephyr side. This will be replaced after the
release with a proper patch on the HAL side.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-10-08 10:45:48 +02:00
Mathieu Choplain
8f58ae71fa drivers: dma: stm32u5: add WBA2x to burst-less hardware #ifdef
The STM32WBA2x SoC line contains only an LPDMA which doesn't support
the burst transfer feature. As temporary workaround to enable building
the DMA driver on this SoC line, add it to the same #ifdef which
prevented compilation of burst-related code on STM32C5 series for the
same reason.

This is temporary; a better approach shall replace this in the future.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-10-08 10:45:48 +02:00
Tobias Meyer
4c2dc25ac1 drivers: disk: sdmmc_stm32: allow missing sleep state
A board may omit the sleep pinctrl state when its card power-off path
only needs to disable the power GPIO. pinctrl_apply_state() reports
this absence as -ENOENT, so comparing against positive ENOTSUP emits a
warning for a supported configuration.

Ignore -ENOENT while retaining warnings for other pinctrl errors.

Assisted-by: OpenCode:gpt-5.6-sol
Signed-off-by: Tobias Meyer <tobias.meyer@hula.earth>
2026-10-08 10:43:01 +02:00
Johan Hedberg
7056ec0b5a Bluetooth: HCI: nxp: Size each vendor command buffer for its command
nxp_bt_send_vs_command() framed every vendor command in one buffer
sized for the longest of them, the calibration data, with a length
check for the others. Every platform reserved that buffer, although
only those with CONFIG_HCI_NXP_SET_CAL_DATA send the command, and a
longer command added later would have had to change the constant the
buffer is sized by.

Each caller now defines a buffer from the size of its own parameters
and passes it to the helper, so there is no shared size to maintain
and a build frames only the commands it sends. Measured with
-fstack-usage, bt_nxp_open() on frdm_mcxw71, which sends the address
command only, needs 24 bytes less stack; on frdm_rw612, which sends
three of the commands, the compiler now inlines their callers into it
and the stack use grows by 8 bytes.

Build-tested with the peripheral_hr sample on frdm_mcxw71 (public
address) and frdm_rw612 (calibration data and automatic sleep). Not
run on hardware.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2026-10-08 08:05:59 +02:00
Guillaume Gautier
ef37420fe3 drivers: spi: stm32: disable interrupts before transfer start
Move the disabling of interrupts from the transceive function to the
spi_stm32_msg_start function to also cover RTIO case.

This change fixes an issue seen on WBA with RTIO: with a short transfer
(1 byte), the EOT interrupt would be raised as soon as the data was sent,
leaving no time to decrease the internal tx_len. The driver was then unable
to properly complete the transaction.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-10-08 08:04:20 +02:00
Paulo Santos
cde9ab5fd9 modem: cellular: rearm the periodic timer when its script can't start
Rearm the timer in await dial and await registered when the periodic
script cannot start, as registered already does.

Signed-off-by: Paulo Santos <pauloxrms@gmail.com>
2026-10-08 08:02:54 +02:00
Richard Maina
bd78bb90c0 drivers: can: fix Kconfig line spacing
Align Kconfig spacing with the style guide in #95132.

Part of #7272

Signed-off-by: Richard Maina <richardmaina3@gmail.com>
2026-10-08 08:01:05 +02:00
Richard Maina
8b5d953bc0 drivers: can: fix Kconfig prompts
Update CAN driver Kconfig prompts to match the style guide
detailed in #95132.

Part of #7272

Signed-off-by: Richard Maina <richardmaina3@gmail.com>
2026-10-08 08:01:05 +02:00
Benjamin Cabé
d32964712e drivers: dma: esp32: do not give m2m pairs a peripheral's ID
A memory-to-memory pair always selected the first ID of the M2M mask,
0 on the ESP32-S3, which is SPI2's. SPI2's DMA handshake then also
reached that pair and SPI2 TX ran dry.

Pick the highest ID no other channel selects. On the ESP32-S3 and
ESP32-C3 every ID of the mask is a real peripheral, and the ADC and
RMT drivers configure their channel on first use, so move a pair off
its ID when a peripheral channel is configured on it later. A pair in
the middle of a transfer selects its new ID at its next start, and a
spinlock keeps concurrent dma_config() calls from taking the same ID.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-08 08:00:47 +02:00
Roman Leonov
344faa7127 drivers: usb: uhc_dwc2: remove redundant lock on enqueue and dequeue
We don't need to explicit lock the uhc_dwc2 mutex on
enqueue and dequeue, as it was already done via higher
calls uhc_ep_enqueue() and uhc_ep_dequeue().

Signed-off-by: Roman Leonov <jam_roma@yahoo.com>
2026-10-08 08:00:34 +02:00
Chingbin Li
a3fe18219d drivers: gpio: remove unused gpio_sifive_plic_to_pin function
Remove the static inline function gpio_sifive_plic_to_pin() from the
SiFive GPIO driver, as it is no longer called anywhere in the codebase.
The pin calculation is now handled directly within the interrupt
handler, making this legacy function dead code.

Signed-off-by: Chingbin Li <liqb365@163.com>
2026-10-07 09:36:14 +02:00
Camille BAUD
bf3134a37b pwm: bflb: Fix K_MSEC and timing header when log is disabled
Fix K_MSEC and other timing functions and macros being undefined
in the pwm driver when logging is disabled (CONFIG_LOG=n).

Signed-off-by: Camille BAUD <mail@massdriver.space>
2026-10-07 09:34:45 +02:00
Manimaran A
988c8aadf8 drivers: espi: xec: fix Port 80 multibyte byte lane map
With CONFIG_ESPI_XEC_P80_MULTIBYTE the I/O width was ORed into
evt_details bits [19:16], which also hold the byte lane map, so the
reported lanes were wrong for most writes. For example an 8-bit write
to byte lane 1 was reported with lanes 0 and 1.

Set only the peripheral in evt_details before adding the lane map and
the width, as documented for the event.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2026-10-07 09:34:08 +02:00
Benjamin Cabé
9ee1b19905 drivers: usb: uhc_dwc2: tear down a device that reconnects in debounce
The core disables the port on a disconnect, but when the line read
connected again by the end of the debounce, the driver only logged an
error and left the port disabled, so nothing was enumerated again. Tear
down in both cases; a device still attached is detected again after the
reset.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-07 09:33:30 +02:00
Benjamin Cabé
3c16709015 drivers: usb: uhc_dwc2: give back the channels of a device that is gone
Channels held by transfers still running when a device disconnected were
never released. ch_claim() then dereferences their dangling transfer
pointers, and the free channel count never recovers. Release them when
the port reports the device gone.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-10-07 09:33:30 +02:00
Fabio Baltieri
3d3d4573d6 drivers: espi: npcx: read KBC A2 flag before the input buffer
The KBC IBF ISR currently reads HIKMDI first and samples the A2
(command/data) bit from HIKMST afterwards. Reading HIKMDI clears IBF,
so the host is free to write the next byte as soon as that read is
done. If the ISR is delayed between the two accesses, for example by a
higher priority interrupt, the next host write can update A2 before the
ISR samples it. The byte that was just read then gets the type of the
next byte.

This can happen in sequences such as a 0x60 command on port 0x64
followed by a data byte on port 0x60. The command gets reported as
data, and the protocol handler goes out of sync.

Sample HIKMST before reading HIKMDI so that the type always matches
the byte being read. This is the same order the other eSPI KBC drivers
already use (it8xxx2, rts5912, mchp xec). It also matches the fix that
was applied to the legacy ChromeOS EC NPCX driver in:

https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2341090

Assisted-by: Gemini:gemini-3.1-pro
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2026-10-07 05:05:59 +02:00
Benjamin Cabé
34b6eca8ba drivers: spi: esp32: fail on unsupported clock configuration
spi_hal_cal_clock_conf() fails without writing the timing configuration
when a full-duplex transfer routed through the GPIO matrix would need
dummy cycle compensation, e.g. at 40 MHz on the ESP32. The result was
ignored, so transfers silently went out with a stale clock setting.

Fail with -ENOTSUP and an error message instead, and clear the cached
configuration so that the next transfer does not skip the check.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-07 05:05:25 +02:00
Shreehari HK
97494e0ffb drivers: i3c: dw: discard IBI payload when dropping a SIR
On IC_HAS_IBI_DATA=1, IBI status and payload are separate queue
entries. Returning from handle_tir() without reading DATA_LEN leaves
payload in the buffer, so IBI_THLD stays asserted. A later CNT=0
and BLR>0 read can then treat leftover data as status.

Pop only the DATA_LEN that belongs to the status already taken.

Assisted-by: Cursor:grok-4.6
Signed-off-by: Shreehari HK <shreehari.hk@alifsemi.com>
2026-10-07 05:01:31 +02:00
Shreehari HK
4c3efd6db3 drivers: i3c: dw: pop IBI status when IC_HAS_IBI_DATA is unset
IBI_STATUS_CNT is reserved and reads as 0 when the IP is synthesized
without IC_HAS_IBI_DATA. Using only that field then leaves the IBI
queue undrained, IBI_THLD stuck, and the ISR spinning.

When IBI_STATUS_CNT is zero, treat IBI_BUF_BLR as the status count
and do not pop a separate payload. When it is non-zero, keep using
it as the status count and IBI_BUF_BLR as leftover data.

Assisted-by: Cursor:grok-4.6
Signed-off-by: Shreehari HK <shreehari.hk@alifsemi.com>
2026-10-07 05:01:31 +02:00
Benjamin Cabé
895abe1abc drivers: usb: uhc_renesas_ra: report a device once its speed is known
An attach was reported at the speed the line state suggests, which is
full speed for a high-speed device until the port reset switches it over.
The host stack then read the device descriptor over a full-speed control
pipe, which fails on the high-speed bus, and enumerated the device again
only after the speed poll reported it removed and reconnected.

Reset the port first and report the device once, at the speed the reset
settled on.

Tested on an EK-RA8P1 with a Pixel 9 Pro XL: every attach enumerates on
the first descriptor read.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-07 05:00:47 +02:00
Benjamin Cabé
f66facd975 drivers: usb: uhc_renesas_ra: release the transfers of a gone device
Nothing queued for a device that detached ever completes. The controller
withdraws a pending setup stage on a detach, so a control transfer caught
there was only handed back by the host stack's 5 s timeout, and transfers
left on a released pipe stayed at the head of its list, where the next
device's transfers queued behind them and a stale one was restarted.

On a detach, hand back every queued transfer with -ECONNRESET, as the
other UHC drivers do, so that its owner can release it. Do the same
before resetting a newly attached device, for what was queued after the
detach was handled.

Tested on an EK-RA8P1 with a Pixel 9 Pro XL and an Android Open
Accessory host application: after a reset with the phone attached, the
control transfer caught by the detach comes back at once rather than
after the 5 s timeout, and the session starts 2 to 3 s after the reset
instead of 7 s.

Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-07 05:00:47 +02:00
Alain Volmat
2f7dd3269b drivers: display: rm67162: optionally use timings from DT
Optionally retrieve the display timings information from a
child node.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
2026-10-07 05:00:28 +02:00
Benjamin Cabé
5a7efa7d8c hardening: storage: add storage shell rules
Add hardening rules for the shell command modules that give raw read
and write access to persistent storage. These are base profile rules:
unlike CONFIG_SHELL itself, which only the strict profile flags, dumping or
rewriting flash, EEPROM, settings and files is not appropriate even for
products that deliberately ship a shell.

- CONFIG_EEPROM_SHELL: n (base)
- CONFIG_FILE_SYSTEM_SHELL: n (base)
- CONFIG_FLASH_SHELL: n (base)
- CONFIG_SETTINGS_SHELL: n (base)

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-10-07 05:00:11 +02:00
Benjamin Cabé
0e5906d32c drivers: audio: da7212: set the MCLK input divider
PLL_CTRL was cleared, which selects the input divider for a 2 to 10 MHz
MCLK, whatever the clock given. The datasheet asks for the divider to
match the MCLK rate in PLL bypass mode too, and the usual 12.288 MHz
falls in the 10 to 20 MHz range. Select it from the configured MCLK
frequency.

Tested on an EK-RA8P1 with a 12.5 MHz MCLK, where playback also works
without it.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-07 04:59:18 +02:00
Benjamin Cabé
0dafea9879 drivers: audio: da7212: enable the line output for playback
Playback only enabled the headphone amplifiers. Enable the line
amplifier as well, which drives the SP_P/SP_N speaker outputs fed by the
right output mixer, at its 0 dB reset gain. VDD_SP may be left
unconnected on boards that do not use it.

Tested on an EK-RA8P1, whose speaker connector J33 is on these outputs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-07 04:59:18 +02:00
Benjamin Cabé
fae1cb6533 drivers: audio: da7212: set the frame length as a clock target
The number of bit clocks per word clock period was only programmed when
the codec drives the clocks, and stayed at the reset default of 64 when
it is the target. That field is also the frame length the codec decodes,
so a 16 bit stereo controller sending 32 bit clocks per frame was never
heard. Program it from the word size in both modes.

Tested on an EK-RA8P1 with the SSIE as clock controller.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5
2026-10-07 04:59:18 +02:00
Ali Hozhabri
155478faa3 drivers: adc: Fix PM for STM32 ADC driver
Resume ADC properly according to the changes introduced in commit
6d8da6d0a3.

Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
2026-10-07 04:59:01 +02:00