Enable multiple platform-level defaults to make video receiver work without
the need to configure every sample.
Also supports shared-multi-heap to be turned off and use memory region
names instead as an option.
Signed-off-by: Josuah Demangeon <me@josuah.net>
The wrapper driver posts and waits for k_event objects, but relied on the
USB device or host controller driver to select EVENTS. When the wrapper
node is enabled and REGULATOR is set without a USB stack, the driver is
built on its own and fails to link. Select EVENTS in the driver itself.
Assisted-by: Claude:claude-fable-5.1
Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
i2s.h marks config_get as a mandatory driver op and i2s_config_get()
calls it without a NULL check, so on these two drivers it calls through
a NULL pointer. Return the stream's stored configuration, or NULL when
the stream was never configured, following the stm32_sai driver.
Fixes#120501.
Signed-off-by: Sai Bontha <saibontha18@gmail.com>
Fractional scaling can overflow the 32-bit intermediate even when the
final PLL frequency fits in 32 bits. With a 1 MHz reference and a
160 MHz target, the calculation incorrectly reports about 25.8 MHz.
Widen the multiplication to 64 bits before removing the fractional
scaling. This preserves existing rates and correctly reports higher
PLL frequencies.
Verified 120, 160 and 200 MHz rates and fractional ratios, and built
the sam_e54_xpro zperf sample.
Assisted-by: Copilot:gpt-6.1-sol
Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
crypto_mchp_sha_get_unused_session() looked for a session whose in_use
flag was clear, but never set it. The flag was therefore always false
and every caller of hash_begin_session() was handed the same session,
regardless of how many were configured.
Set the flag while the session semaphore is held, so the scan and the
claim cannot be interleaved. mchp_sha_free_session() already clears it
by memset()ing the session under the same semaphore.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Reported-by: Asif Nadaf <postasif@protonmail.com>
ataes132a_session_setup() tested ataes132a_state[key_id].in_use and set
it further down without holding any lock, so two threads could both find
the slot free and both claim the same key slot.
The claim was also made before the remaining parameters were validated,
and none of the -ENOTSUP paths below it cleared the flag, leaving the
key slot permanently marked as in use.
Move the claim after all the validation and do the test and the update
under the device semaphore, which already serializes the rest of the
driver. Release the slot under the same semaphore.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Reported-by: Asif Nadaf <postasif@protonmail.com>
npcx_get_unused_session_index() scanned the session pool for a free slot
and marked it in use without holding any lock, so two threads calling
hash_begin_session() concurrently could both be handed the same slot.
Guard the scan, the claim and the release with a mutex, matching what
the other crypto drivers with a session pool already do.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Reported-by: Asif Nadaf <postasif@protonmail.com>
intel_sha_get_unused_session_idx() scanned the session pool for a free
slot and marked it in use without holding any lock. Two threads calling
hash_begin_session() concurrently could both pick the same slot and end
up sharing one session context.
Guard the scan, the claim and the release with a mutex, matching what
the other crypto drivers with a session pool already do.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Reported-by: Asif Nadaf <postasif@protonmail.com>
nrf_ecb_session_setup() tested drv_state.in_use and set it in two
separate, unsynchronized steps. Two threads could both observe the
peripheral as free, both claim it.
Claim the peripheral with atomic_cas() so the test and the update
cannot be interleaved. A failed claim keeps returning -EBUSY, so the
API behaviour is unchanged.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
Reported-by: Asif Nadaf <postasif@protonmail.com>
adc_silabs_adc and adc_silabs_iadc drivers rely on pinctrl to configure
the ADC pins. This patch fixes the build error when no other module
selects PINCTRL.
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
In case of BLE usage, flash driver initialization requires kernel
services to setup workqueue resources hence it must be executed
after kernel is alive.
OTP_STM32_NVM_PROGRAMMING_SUPPORT is disabled for STM32WBAX series
since it currently requires the flash driver to be initialized at
PRE_KENREL_1 initcall level.
Fixes: #120988
Signed-off-by: Alessandro Manganaro <alessandro.manganaro@st.com>
Previously, the driver stored a reverse mapping between channels
and devices which does not work properly, at least on stm32g0b1.
Fix that by passing the device reference to the DMA callback function
using its user data argument.
Signed-off-by: Paul Wedeck <paulwedeck@gmail.com>
Do not reprogram the LPTIM auto-reload value when entering the idle state.
The exit latency is 0 and the timer has already been programmed.
This avoids a case where the board enters STOP mode and immediately exits
because the ARROK interrupt is raised as expected. Preserve the behavior
that existed before commit 7fab907cf1.
Tested on NUCLEO-WBA25CE1, NUCLEO-WBA55CG, and NUCLEO-WBA65RI
with the affected PM workload.
Signed-off-by: Ali Hozhabri <ali.hozhabri@st.com>
Until the first input buffer is parsed, set_format accepted any request
without storing it or filling the pitch and size, so a caller sizing its
buffers from the returned format got whatever its struct held. Reject an
input format other than JPEG and an output format the decoder cannot
produce, estimate the pitch and size for the requested format and keep it
as the current one, as the other m2m codec drivers do. The JPEG header
still replaces the output format on the first enqueue.
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
While reading spi_nxp_kinetis_l_configure() I noticed what happens when
the requested frequency is lower than the slowest the SPI block can
generate (module clock / 4096). The divisor loop only accepts values
that do not exceed the request, so nothing gets picked and
best_sppr/best_spr stay at their initial 0. That is the fastest
setting, divide by 2, so asking for 1 kHz on a 24 MHz clock ends up
running at 12 MHz, and configure() still returns 0.
Run the divisor search first, before any register is written, and
return -EINVAL if no divisor fits, like spi_cc13xx_cc26xx does for the
frequencies it can't generate. Requests the hardware can meet get the
same divisor as before. A requested frequency of 0 is now rejected too.
I don't have an FRDM-KL25Z, so this is not tested on hardware. I
checked the loop on a PC with a small standalone program for 24 MHz and
48 MHz clocks: same result as before for every reachable frequency, and
-EINVAL for the ones below the limit.
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Prathamesh Sachin Sapkal <prathameshssapkal@gmail.com>
WIFI_MFP_UNKNOWN is a Zephyr sentinel (not 0/1/2). Casting it into
sl_wifi_set_mfp() stored an invalid mode. Map an unknown request from
the security type instead: optional/capable for WPA2 and transition,
required for SAE, and disabled otherwise.
Assisted-by: Cursor:Grok-4.6
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Scan reports WPA3 as WIFI_SECURITY_TYPE_SAE. Connect only handled
SAE_AUTO, so Matter's reused scan metadata returned -ENOTSUP. Treat
SAE, SAE-H2E, and SAE_AUTO as WPA3.
Assisted-by: Cursor:Grok-4.6
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Scan used to advertise WPA2/WPA3 transition APs as SAE, so Matter reused
that metadata and tried a WPA3-only join. Map both WPA3 transition and
WPA/WPA2 mixed scan results to WPA auto-personal so connect can use
the matching WiseConnect security mode.
Assisted-by: Cursor:Grok-4.6
Signed-off-by: Martin Hoff <martin.hoff@silabs.com>
Configuring packet timestamp filters while enabling the ENET QoS clock
in coarse-update mode can leave RX timestamp capture inactive, even
though MAC_TIMESTAMP_CONTROL reads back with the capture bits set.
On FRDM-MCXN947 this allows Announce reception and time-transmitter
selection, but Sync and Pdelay messages lack RX timestamps. Peer-delay
measurement and clock synchronization therefore cannot complete.
Configure the packet timestamp filters only after initializing system
time, switching to fine-update mode, setting the subsecond increment,
and completing the nominal addend update. Keep the existing capture
filters and propagation delay unchanged.
Assisted-by: Oh-My-Pi:gpt-6-astra
Signed-off-by: Philipp Steiner <philipp.steiner1987@gmail.com>
Both drivers armed their WUU route when the instance was the chosen
system-timer companion, OR'd ahead of pm_device_wakeup_is_enabled().
That made /chosen/zephyr,system-timer-companion an implicit wake-enable
the application cannot decline, and its documented contract is only
"keep time while the primary system timer is inactive in low-power
states".
The generic companion hook now enables the counter as a wake source
itself, so the flag is the single control point and the special case
can go.
Without CONFIG_PM_DEVICE, pm_device_wakeup_is_enabled() is a stub that
returns false and pm_device_wakeup_enable() cannot set the flag, so the
devicetree wakeup-source property is the only control. Arm the route
from that alone in that configuration, matching the guard already used
in sys_lpm_hooks_counter.c.
Depends on #117274 for the generic hook to set the flag.
Signed-off-by: Richard Wheatley <richard.wheatley@ambiq.com>
eDMA is not coherent with the D-cache and nothing else in the path does
cache maintenance. A TX buffer in cached RAM is still in the D-cache
when the DMA reads main memory, so the peripheral transmits whatever RAM
held beforehand: zeroes for a .bss buffer, stale bytes for one on the
stack. The transfer reports success either way.
Clean the TX buffers before starting and clean-and-invalidate the RX
buffers from the completion callback. The invalidate cannot go after
spi_context_wait_for_completion(), which does not wait for an
asynchronous transfer.
RX is cleaned as well as invalidated so that a plain invalidate cannot
discard dirty bytes a neighbour owns. Note this does not make the
partial lines at the two ends safe either way; only a buffer aligned to
and padded out to the cache line size avoids both hazards. Fixing that
in general needs a bounce buffer and a copy on every transfer.
Fixes: #81125
Assisted-by: Claude:claude-opus-5
Signed-off-by: Hashimoto Kenichi <hashimoto.kenichi@genetec.co.jp>
The FXLS8974 only latches writes to its configuration registers
(including CTRL_REG3, which holds the wake/sleep ODR fields) while the
device is in STANDBY mode. Writes performed while the device is ACTIVE
are silently ignored by the part.
fxls8974_set_odr() only wrote CTRL_REG3 directly. This worked during
init(), where the device is still in standby after the software reset,
but not at runtime: when the application changes the sampling frequency
via sensor_attr_set(SENSOR_ATTR_SAMPLING_FREQUENCY), the device is
already ACTIVE, so the register update was dropped without any error.
The reported ODR stayed at its init value (6.25 Hz) regardless of the
requested rate, producing duplicate samples when polled faster.
Save the current active state, drop to standby, update the ODR, then
restore the previous active state. During init the device is already in
standby, so the behaviour there is unchanged.
Signed-off-by: Florian Quinart <florian.quinart@nxp.com>
The LPUART driver for NXP devices did not support
the single-wire mode for the UART peripheral.
This has been fixed by switching the TXDIR bit to TX mode upon entry of
function: mcux_lpuart_poll_out() and switching it back to RX mode
at the end of the function when single-wire mode is selected.
Signed-off-by: Luis Casas <luis.casas@nxp.com>
The MCXW driver updates its internal tx_frame.sec_processed and
tx_frame.hdr_updated flags after the NBU completes a transmission,
but never writes them back to the net_pkt. The OT platform layer
(radio.c) reads these flags from the net_pkt to report them to
OpenThread via otPlatRadioTxDone().
Without the write-back, the net_pkt retains the pre-TX flag values.
On MAC-layer retries, OpenThread re-submits the frame with stale
flags (mIsHeaderUpdated still false), and the driver requests a
fresh Frame Counter from the NBU — which is the correct behavior.
However, the mismatch means OpenThread cannot accurately track the
security state of transmitted frames.
More critically, if the TX Done callback sets hdr_updated=true (as
it does after writing the Frame Counter), this value is invisible
to radio.c. A future code change that relies on accurate flag
propagation would silently break.
Add net_pkt_set_ieee802154_frame_secured() and
net_pkt_set_ieee802154_mac_hdr_rdy() calls after the TX semaphore
is released, mirroring the Nordic nRF5 driver (ieee802154_nrf5.c).
Signed-off-by: Baptiste Coffin <baptiste.coffin_1@nxp.com>
With CONFIG_UART_EXCLUSIVE_API_CALLBACKS, setting the callback of one
API must remove the callback of the other.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The transceiver must be manually shut down prior to going to
deep sleep, otherwise the state will be inconsistent on wakeup.
Register a PM notifier to disable and reenable the transceiver.
In the future, this should be implemented as a power management
TURN_ON/TURN_OFF callback called from a power domain driver.
Since no such driver exists yet for Series 2, deal with it ad-hoc
from the UART driver itself.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
For interrupt-driven transfers, PM must be locked until data has
been fully shifted out. Postpone releasing the PM lock until TXC
is reported.
Split handling of TXFL and TXC such that TXFL maps to the user-facing
callback, while TXC is only used internally in the driver.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The interrupt-driven and async APIs share TXC and RXOF. When the
driver had DMA channels, the ISR handled every enabled TXC and RXOF as
an async event, producing spurious UART_TX_DONE and UART_RX_STOPPED
events.
Handle RXTO and RXOF as async events only while async RX is enabled,
and TXC only while an async TX is outstanding.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
When the RX DMA buffer was filled and no next buffer was provided, the
DMA callback stopped RX and reported UART_RX_DISABLED, but left the RXOF
and RXTO interrupts enabled. A later overrun or receive timeout then
raised async events for a receiver that was already disabled.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Aksel Skauge Mellbye <aksel.mellbye@silabs.com>
The driver waits for the vendor event with which the controller reports
its start: in open() when the node has reset-event, and with SPI
protocol v1 after an HCI Reset. An event that no wait had taken, such
as one that came after a wait had timed out, stayed in its semaphore
and ended the next wait at once, before the controller had reported
its new start.
Clear the semaphore ahead of both waits: before the reset line is
released, and once the HCI Reset has gone out, while the bus is still
held so that the event that follows cannot have been read yet. The
wait after an HCI Reset now requires reset-event too, as the one in
open() does, so that no wait goes without the clear.
Not tested on hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
An error from send() says that a command was not submitted: the Host
fails the command, restores the command credit and sends the next one,
and the lockstep helper, which the driver uses in open(), documents the
same for its send function. The driver also returned an error after
part of a command had gone out, when a later chunk failed, and after a
complete HCI Reset when the controller did not report its start in
time. The controller may still answer in both cases. Its response then
completes a retry of the same command, or its credit lets the next
command out while another one is unanswered.
Return 0 once a command has been on the bus and treat it as sent, which
for an HCI Reset includes the wait for the start of the controller.
What becomes of it shows in its response or, through the command
timeout, in the lack of one. Data packets and commands of which nothing
was sent are reported as before, and that includes a transfer for which
the controller had no room yet. The wait for the start of the
controller after an HCI Reset now checks the packet type too: it took
two bytes of any packet for the opcode.
Not tested on hardware.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
scan_done_handler() ignored the status carried by WIFI_EVENT_SCAN_DONE
and always completed the scan request with status 0, so a scan the
Wi-Fi stack reported as failed looked successful to the caller.
Pass the event data to the handler and complete the request with -EIO
when the stack reports a failure.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
esp32_wifi_scan() stored the callback in the runtime data of the
interface the request arrived on, while scan_done_handler() only reads
esp32_data.scan_cb. With CONFIG_ESP32_WIFI_AP_STA_MODE a scan issued on
the softAP interface therefore looked like an internally triggered scan
to the handler, which returned without draining the results, without
calling esp_wifi_clear_ap_list() and without reporting completion. The
AP record list allocated by the Wi-Fi stack stayed in memory until the
next scan replaced it, and the stale scan_cb made every further scan on
that interface fail with -EINPROGRESS.
Scanning always runs on the station, so keep the callback on esp32_data
regardless of the requesting interface. Remember the requesting
interface next to it and report the results and the scan completion
through that interface instead of the station interface, so a caller
waiting on the softAP interface sees the completion rather than timing
out.
Tested on doit_esp32_devkit_v1 with samples/net/wifi/shell,
CONFIG_ESP32_WIFI_AP_STA_MODE=y and
CONFIG_WIFI_NM_MAX_MANAGED_INTERFACES=2. With the softAP enabled,
"wifi scan -i <softAP index>" never completed and the next request
failed; with this change both requests complete and report results,
and station scans keep working.
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Muhammad Waleed Badar <walid.badar@gmail.com>
BL616CL limits were flipped
Robustness against libc/libgcc call in XIP
Fix one busy bit mode
IRQ lock when change offset
JEDEC ID algorithm
Signed-off-by: Camille BAUD <mail@massdriver.space>
When MSIK is not enabled, get_msik_frequency() is not called by
stm32_clock_control_get_subsys_rate(). Consequently the compiler emits
a warning:
clock_stm32_ll_u3.c:47:17: warning: 'get_msik_frequency' defined
but not used [-Wunused-function]
Do not build get_msik_frequency() if MSIK is not enabled.
Fixes#122050
Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
Normal write mode corrupts a word that isn't erased first, even if
the write only clears bits. Erase non-erased words with the hardware
erase before writing. One ERASEWORD write erases the whole 16 byte
word.
Non-secure builds can't reach the MRAMC erase, so they write in
direct write mode instead.
Signed-off-by: David Jewsbury <david.jewsbury@nordicsemi.no>
dma_reload() reset the channel but kept the events its previous transfer
had latched. One not handled yet, such as an RX EOF whose interrupt is
still pending, then completed the reloaded transfer as soon as it
started. Clear them, as dma_stop() does.
Assisted-by: Claude:claude-opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
On RW6xx, MCUX_ENET_CLK reported CLOCK_GetTddrMciEnetClkFreq(), the
fixed 50 MHz TDDR ENET clock that serves as the PTP time base. The
ENET MAC and MDIO drivers use this rate to compute the MDC divider,
but the ENET module runs from the main clock (260 MHz). MDC therefore
ran at about 13 MHz, above the 10 MHz MDIO limit of PHYs such as the
KSZ8081, and the PHY never answered.
Report the main clock instead, which is what the MCUXpresso SDK ENET
examples pass to ENET_SetSMI(). The PTP clock uses the separate
MCUX_ENET_PLL subsystem and is not affected.
Signed-off-by: Tobias Frauenschläger <t.frauenschlaeger@me.com>
commit fe5660138c ("drivers: ethernet: dwc_mac: let pps pin one pulse
per second") reads DWMAC_MACVERR and writes DWMAC_PTP_PPSCR_PPSCTRL,
which are only defined for the ether_1000 core, so the PTP clock no
longer builds for the QoS core.
Fix compilation for QoS cores, which were missing these defines. The
QoS core selects the PPS output bit from the sub-second field the
same way, so apply the fix there too: add DWMAC_VERSION_REG pointing at
the version register of each core, share DWMAC_VERSION_SNPSVER,
DWMAC_CORE_3_70 and DWMAC_PTP_PPSCR_PPSCTRL between both cores, and use
them in the PPS setup.
Signed-off-by: Tim Pambor <tim.pambor@codewrights.de>
A one-shot read returns -EBUSY when the sensor has no new sample since
the previous read, which is expected when reading faster than the
output data rate. The RTIO path logged an error for each such read,
while sensor_sample_fetch() returns -EBUSY without logging. Only log
the other errors.
Tested with the icm42688 tests on native_sim.
Assisted-by: Claude:opus-5.5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Return I2C and runtime power management failures from sample fetch and
resume. Correct the sign bit used for 12-bit temperature values.
Signed-off-by: Hake Huang <hake.huang@nxp.com>
Replace hard-coded buffer lengths with sizeof() and ARRAY_SIZE()
and add checks for handling invalid buf and len.
Signed-off-by: Madhab Sharma <madhabsharma94@gmail.com>
Wire the flash driver get_size callback for the SiWx91x SoC flash
driver. The value is cfg->size from devicetree, matching the bounds
used for read, write, and erase and consistent with other Silicon
Labs SoC flash drivers.
Signed-off-by: Arun Padakanti <arpadaka@silabs.com>
TOVAL and WIN are 16-bit registers, but the driver computed the tick
count with 32-bit arithmetic and assigned it to the 16-bit config
fields, so a value above 65535 was truncated without any error. On an
MCXW71 the SoC node runs the watchdog from the 32.768 kHz RTCOSC with
clk-divider 1, so the counter can hold at most 1999 ms; a task watchdog
configured for 2000 + 100 ms asked for 68812 ticks and got 3276, a
100 ms window. Every long interrupt-locked flash erase then reset the
SoC (an MCUboot image upload, first chunk, every time).
Compute the ticks in 64 bits, so that a megahertz-class clock times a
multi-second timeout cannot wrap either, and return -EINVAL with a log
line naming the largest window this clock and divider allow.
Tested on a u-blox NINA-B506 (MCXW716C): the 2100 ms request at
divider 1 is now refused at install time; at divider 256 it programs
TOVAL 268 and a starved task watchdog channel resets the SoC 2.1 s
after its trip, as configured.
Fixes#121398
Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Joern Ihlenburg <ihlenburg@ihlems.de>