This commit updates the usage of ring_buf to utilize the new
put_ptr/commit/get_ptr/consume pattern instead of the traditional
claim/finish approach. This change is part of a larger refactor aimed at
streamlining the ring_buf API and improving its efficiency.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
This commit updates the usage of ring_buf to utilize the new
put_ptr/commit/get_ptr/consume pattern instead of the traditional
claim/finish approach. This change is part of a larger refactor aimed at
streamlining the ring_buf API and improving its efficiency.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
This commit updates the usage of ring_buf to utilize the new
put_ptr/commit/get_ptr/consume pattern instead of the traditional
claim/finish approach. This change is part of a larger refactor aimed at
streamlining the ring_buf API and improving its efficiency.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
This commit updates the usage of ring_buf to utilize the new
put_ptr/commit/get_ptr/consume pattern instead of the traditional
claim/finish approach. This change is part of a larger refactor aimed at
streamlining the ring_buf API and improving its efficiency.
Signed-off-by: Måns Ansgariusson <mansgariusson@gmail.com>
The streaming path wrote full interrupt-route structs containing only
its own bit, so arming the DRDY stream trigger cleared the FIFO
watermark/full routing and vice versa, silently losing events when both
are requested. Read-modify-write the route as the trigger path already
does. Also honor the trigger disable flag in the DRDY path, which
unconditionally enabled the route even when asked to disable it.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
On sensor_clock_get_cycles() failure, the submit-sample path called
rtio_iodev_sqe_err() and then jumped to the shared err label, which
called rtio_iodev_sqe_err() again on the same (already freed) SQE.
Drop the first call so the err block performs the single completion.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The FIFO decoder mapped the SLAVEn tag index directly onto the
compile-time sensor hub list, ignoring the runtime detected-device
mapping (shub_ext), so frames were decoded as the wrong channel when
a compiled-in external sensor was not populated. Carry shub_ext and
num_ext_dev in the FIFO header and index through them, and fix the
off-by-one bounds check in lsm6dsv16x_shub_type().
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
lsm6dsv16x_hum_convert() stored the entire relative humidity value in
micro-percent in val2, so converting the sensor_value back to a float
roughly doubled the reading. Store only the fractional remainder in
val2, as required by the sensor_value contract.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
data->accel_freq and data->gyro_freq hold the full mode-encoded ODR
byte (mode in the upper nibble, e.g. 0x18 for HA01 500 Hz), so using
them directly as a column index into lsm6dsv16x_odr_map[3][13] reads
out of bounds for high-accuracy devicetree ODRs. Mask to the low
nibble, which is the actual CTRL ODR field; the mode nibble is already
handled via the row index.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The data-ready streaming path stored the raw full-scale register
index in accel_fs_idx, while the decoder tables are ordered by
g-value. On LSM6DSV32X this made decoded accel samples half their
true value. Convert with LSM6DSV16X_ACCEL_FS_VAL_TO_FS_IDX() as the
one-shot and FIFO paths already do.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The I3C instantiation macro used the non-existent UNTIL_AND instead of
UTIL_AND, making IF_ENABLED silently expand to nothing and dropping the
.rtio_ctx, .iodev and .bus_type initializers, so I3C streaming faulted
on the first interrupt via a NULL RTIO context.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
lsm6dsv16x_sample_fetch() accumulated the return value of the
accel/gyro/temp/shub fetch helpers in 'ret' but ended with 'return 0;',
so bus errors during a fetch were reported as success and stale data
could be served by channel_get. Return 'ret' instead, matching the
sibling lsm6dso driver.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
For the NXP MCXE31B mcu there is currently no
driver support for the ethernet controller, add it via
the generic dwc_mac driver.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Fin Maaß <info@finmaass.de>
Advertise support for callback events via capabilities->supported_events
returned by display_get_capabilities() API.
Add the new capas field to drivers using events callback.
Remove events mask validation from drivers, it is now handeled at API
level.
Consider a wrong events mask as an invalid argument and return -EINVAL.
Now -ENOTSUP is only returned upon unsupported cb invocation context.
Signed-off-by: Abderrahmane JARMOUNI <git@jarmouni.me>
Remove local OPERATION() in STM32 I2C non-RTIO and RTIO drivers. Testing
I2C message flags explicitly is enough.
No functional changes.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Indent value of I2C_STM32_IRQ_HANDLER_DECL() and I2C_STM32_IRQ_HANDLER()
macros for consistency inside the Zepĥyr source tree.
Add __unused attribute to argument of the generated
i2c_stm32_irq_config_func_##index() functions.
While at it, replace tabulation with a space char after #endif closing
guard in i2c_stm32.h and split some helper macros definitions with empty
lines to ease readability.
No functional changes.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Reorder header files in STM32 I2C drivers to group Zephyr generic header
files together. For that purpose, remove definition of LOG_LEVEL macro
and provide the log level config as LOG_MODULE_REGISTER() argument
which use is moved after header files inclusions.
Remove #ifdef directives that are not really useful around #include
directives.
Remove several #include directives from local i2c_stm32.h file.
No functional changes.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Factorize i2c_stm32_runtime_configure() between STM32 I2C non-RTIO
and RTIO drivers that implements the same sequence but regarding
SMBus support that is not yet available in the RTIO driver.
No functional changes.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
PM_DEVICE_DT_INST_DEFINE() references dw_i3c_pm_action, but the
callback is named dw_i3c_pm_ctrl. The symbol does not exist anywhere
in the tree, so building with CONFIG_PM_DEVICE=y fails with
'dw_i3c_pm_action' undeclared. Reference the actual name at both
instantiation sites, snps,designware-i3c and microchip,xec-i3c.
Signed-off-by: Corey Wharton <xodus7@cwharton.com>
adxl345_decoder_decode() routes on is_fifo at byte offset 0 to decide
whether to call adxl345_decode_stream(). adxl345_submit_fetch() passes
adxl345_read_sample() a raw RTIO mempool buffer, which is not zeroed,
and adxl345_read_sample() never sets is_fifo, so the flag is whatever
the previous user of that block left behind.
With CONFIG_ADXL345_STREAM=y, a one-shot sensor_read() can therefore be
misrouted into adxl345_decode_stream(), which reads a 12-byte struct
adxl345_fifo_data header out of a buffer sized for the 10-byte struct
adxl345_sample and then iterates on an out-of-bounds fifo_byte_count.
Clear is_fifo explicitly, as adxl362, adxl367 and adxl372 already do.
Assisted-by: Claude:claude-opus-5
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Added pm_action suspend/resume/turn_on routine for Counter
Assisted-by: Claude:claude-opus-4.8
Signed-off-by: Richard Mc Sweeney <Richard.McSweeney@infineon.com>
Update comments, log messages, Kconfig prose, and driver-local
identifiers to use the controller/target terminology ratified by
coding guideline A.2 and already used by the Zephyr I2C API.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
intc_system_apic.c is not an interrupt controller driver: it is the
x86 platform glue that implements arch_irq_enable(),
arch_irq_disable() and the vector programming hook by dispatching
between the IOAPIC and LOAPIC drivers, which expose their own APIs.
Interrupt controller drivers should only expose their own namespaced
API, so move the file to arch/x86/core where the glue belongs,
unchanged apart from a comment stating its role.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The streaming decoder divided the raw temperature code by a rounded,
decoder-local 15 LSB/degC before applying the q31 scale, quantising the
result to whole degrees and disagreeing with adxl362_temp_convert().
Scale with the shared ADXL362_TEMP_MC_PER_LSB first and divide last, so
both paths report the same 0.065 degC resolution.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
adxl362_process_fifo_samples_cb() never set the accel_odr field of the
FIFO header, leaving it with stale RTIO pool contents that the decoder
uses to index accel_period_ns[], yielding wrong sample periods or an
out-of-bounds table read. Set it from the cached output data rate.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Without CONFIG_PM the Wi-Fi SLP IRAM optimization path calls
esp_wifi_internal_update_modem_sleep_default_params(), which is
only provided by the Wi-Fi blobs. Builds on Wi-Fi 6 SoCs with
CONFIG_BUILD_ONLY_NO_BLOBS=y fail to link, so keep the option
default off there until a stub is available.
Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
Neither the link initialization nor the values programmed for a stream are
visible at runtime, which makes any mismatch between the host, the gateway
configuration and the link hard to narrow down.
Log both at debug level.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The link initialization - programming the target BDF and aligning the UAOL
frame counter to the xHCI micro-frame counter - runs only once, guarded by
is_initialized, but the flag is never cleared. The link power domain
retains neither of the two, so on the first runtime PM cycle both are lost
while the driver still believes the link is initialized.
The link then runs with a frame counter that no longer matches the xHCI
one, placing the isochronous data in the wrong micro-frame. The device
receives or produces nothing and no error is reported anywhere.
Clear the flag when the link is powered down, so that the next config()
initializes the link again.
Fixes: b50fcbd6ee ("drivers: uaol: add a driver for Intel UAOL IP")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
The RTIO submit path forces a single measurement via CNTL2 but never
updated the cached mode, so after the device automatically returned to
power-down the blocking fetch path skipped its CNTL2 write and failed
with -EBUSY forever. Update the cached mode to power-down accordingly.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The wake-up threshold was only validated against full scale, but WK_THS
is a 6-bit field, so thresholds just below full scale computed a register
value of 64 that the HAL masked down to an almost-zero threshold. Clamp
the computed value to 63 LSBs instead.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
LIS2DW12_ODR_TO_REG() had no encoding for the power off state, so a
cached ODR of 0 was mapped to 1.6 Hz and PM_DEVICE_ACTION_RESUME
restarted conversions on a sensor configured with odr = <0>. Add an OFF
arm to the macro and keep the cached ODR in sync when a runtime power
off succeeds.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
The ODR map was copied from the LSM6DSO driver and listed 1.66/3.33/
6.66 kHz, but the IIS2ICLX ODR_XL field only encodes 0..7 (up to
833 Hz), so requesting a higher rate programmed a reserved code and
reported success. Truncate the map so such requests return -EINVAL.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
iis2iclx_channel_get() accepted SENSOR_CHAN_ACCEL_Z on this 2-axis
part and discarded the -ENOTSUP returned by its helpers, so callers
got success with an untouched sensor_value. Drop the Z case, return
the helper status, and fill the third slot of ACCEL_XYZ with zero.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
iis2iclx_lps22hh_conf() passed an undeclared identifier 'data' to
iis2iclx_lps22hh_odr_set(), breaking any build with
CONFIG_IIS2ICLX_EXT_LPS22HH enabled. Pass the function's 'dev'
parameter instead, matching the callee signature and the sibling
ST sensor-hub drivers.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Report the station IPv4 address to the Wi-Fi stack from the interface
address events, and from the station connect handler for an address
configured before the association, so that a static address and a DHCP
lease behave the same.
Signed-off-by: Raffael Rostagno <raffael.rostagno@espressif.com>
Enabling the rp1 pinctrl also requires the bcm2712 pinctrl,
so add a minimal stub.
This does not perform any processing, but preserves the register
settings at reset.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
The drdy work loop only exited once every STATUS_REG data-ready bit
was clear, but those bits are only cleared by a registered handler
fetching the corresponding output registers, so an enabled source
without a handler spun the loop forever. Exit as soon as no pending
source has a registered handler.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
Fold the SENSOR_G/SENSOR_PI micro-unit divisor into a per-buffer scale
computed once in bmi270_decoder_decode(), instead of recomputing it on
every frame and dividing again per axis. decode_accel_frame() and
decode_gyro_frame() now convert each axis with a single multiply.
Also group the plain field/macro assignments in bmi270_decoder_decode()
separately from the ones requiring a function call, for readability.
Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
(cherry picked from commit bd1806ba4ed023fd961f76865be5a9853e29ddf4)
Guard #if CONFIG_BMI270_BUS_SPI/I2C checks with defined(), since the
bare macro form silently evaluates false when the bus is unselected.
Mask the register address in bmi270_spi_prep_reg_write_async() before
using it in the SQE.
Gate the one-time FIFO config/INT-map/flush setup in
bmi270_submit_stream() behind a fifo_configured flag so it does not
re-run every RTIO_SQE_MULTISHOT cycle, but keep the GPIO interrupt
re-arm unconditional since bmi270_try_submit_fifo_irq() disables it on
every IRQ. Also make the FIFO poll fallback always reschedule itself,
since returning early while streaming_sqe is momentarily NULL used to
stop it permanently.
Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
(cherry picked from commit a817f78137a160f65f213e006b5b5d618eaad89a)
Rework the RTIO data path to use fully asynchronous execution with
SQE chaining, removing the dependency on the work queue.
This simplifies the flow and aligns the implementation with RTIO
design expectations by:
Executing transactions directly via SQEs
Eliminating intermediate work queue handling
Improving consistency of async behavior
FIFO handling is updated to support streaming use cases, with
draining performed via an MPSC lock-free queue to ensure safe
handoff between ISR and processing context.
Note: Stream behavior, FIFO handling, and drain logic using the
MPSC queue require further validation under concurrent and
high-throughput scenarios.
The new approach reduces latency and avoids context switching
overhead introduced by the previous work queue based model.
Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
Assisted-by: OpenAI:codex-5.5
Add sensor_stream()/RTIO support so the BMI270 collects
accelerometer and gyroscope samples in its hardware FIFO and
raises an interrupt only at the watermark threshold. The host
SoC stays in sleep between batches instead of waking per sample,
reducing power consumption proportionally to the batch size.
Implementation adds three new files:
- bmi270_stream.c: FIFO configuration, watermark/full trigger
mapping, INT pin management, and optional poll fallback
- bmi270_decoder.c/h: sensor_decoder_api converting raw FIFO
batches (header and headerless modes) to Q31
Trigger handling in bmi270_trigger.c is extended to route FIFO
interrupts to a dedicated work queue with permanent-latched mode
for reliable GPIO edge detection.
New Kconfig options control streaming (BMI270_STREAM), FIFO mode
(BMI270_FIFO_HEADERLESS), watermark depth, INT pin routing
(BMI270_FIFO_ON_INT2), poll fallback, and buffer sizing.
Additional Kconfig BMI270_LOW_POWER_MODE forces power-optimized
filter at all ODRs, trading noise for lower current draw.
Also fixed in existing code:
- BMI270_CMD_FIFO_FLUSH typo.
- write_config_file() return type narrowed to int8_t; now int.
- Init path lacked LOG_ERR on most failure branches.
Signed-off-by: Bartosz Meus <bartosz.meus@nordicsemi.no>
Add RCC driver for the STM32WL3x series with CLK_SYS
sources (HSI, RC64MPLL PLL and HSE), peripheral clock gates
and the reset controller, together with the st,stm32wl3-rcc binding.
Signed-off-by: Anders Frandsen <anfran@anfran.dk>
The if/elseif block that selects the per-series clock control source
file sits inside if(CONFIG_CLOCK_CONTROL_STM32_CUBE) but was never
indented, so the CMakeStyle compliance check fails.
Re-indent the block to 2 spaces per level. No functional change.
Signed-off-by: Anders Frandsen <anfran@anfran.dk>