Commit graph zephyr/drivers/sensor
Author SHA1 Message Date
Sudarshan Iyengar
a14e3675b9 drivers: sensor: bmi270: convert RTIO path to fully async with SQE chaining
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
2026-08-25 07:56:00 -07:00
Bartosz Meus
056fd5aa54 drivers: sensor: bmi270: add FIFO streaming via sensor_stream()
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>
2026-08-25 07:56:00 -07:00
Sudarshan Iyengar
8e04a5f792 drivers: sensor: ens210: Add RTIO async API support
Add RTIO (Real-Time I/O) asynchronous API support to the ENS210
temperature and humidity sensor driver, covering both single-shot
and continuous measurement modes.

- Add ens210_rtio.c with RTIO submit handler and completion callbacks
- Add single-shot async flow using k_work_delayable for conversion delay
- Add continuous mode async flow with direct RTIO chaining
- Add sensor decoder API for frame decoding (temperature/humidity)
- Integrate MPSC lock-free queue for I/O scheduling
- Define RTIO context and I2C IO device per driver instance
- Update Kconfig to select RTIO-related options when async API is enabled

Signed-off-by: Sudarshan Iyengar <sudarshan.iyengar@alifsemi.com>
Assisted-by: Claude:claude-opus-4.7
2026-08-24 14:02:33 -07:00
Chaogui Deng
d9a5ce26ab drivers: sensor: bmi323: add emulator
Add a register-level BMI323 emulator for I2C and SPI. Model word
transactions, bus-specific dummy bytes, power-on defaults, invalid
sample markers, and soft reset.

Expose raw accelerometer, gyroscope, and temperature setters. Add
native_sim coverage for initialization, attributes, invalid samples,
and converted sensor data on both buses.

Assisted-by: Codex:GPT-5
Signed-off-by: Chaogui Deng <dengchaogui1@gmail.com>
2026-08-24 18:44:25 +02:00
Benjamin Cabé
9d664a7dc4 drivers: sensor: lsm6ds0: fix accel scale factor for 16g range
The accelerometer scale factor was derived mechanically as
full-scale * g, assuming a sensitivity of FS/32767 for every range.
That holds for 2/4/8g but not for 16g, whose datasheet sensitivity is
0.732 mg/LSB, causing readings ~1.5x too small in that mode.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:57 +02:00
Benjamin Cabé
7537c2368b drivers: sensor: lis2du12: read int mode before modifying it
lis2du12_enable_delta_int() called lis2du12_interrupt_mode_set() for
the read step of a read-modify-write, pushing an uninitialised struct
into the INTERRUPT_CFG and CTRL1 registers and randomly corrupting
interrupt polarity and latching. Use lis2du12_interrupt_mode_get()
instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:46 +02:00
Benjamin Cabé
1706b5348c drivers: sensor: adxl345: cache ODR configured at init
adxl345_init() programmed the devicetree ODR but never stored it in
the driver data, so the cached value stayed 0 and the streaming header
carried an invalid rate index. The decoder then derived a zero sample
period, collapsing every timestamp in a FIFO batch to the same instant.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:28 +02:00
Benjamin Cabé
f6e5cd6d3f drivers: sensor: adxl345: clear is_fifo in one-shot RTIO fetch
The one-shot fetch path filled a recycled RTIO buffer without ever
initializing struct adxl345_sample::is_fifo, so a stale bit left by a
previous streaming transaction made the decoder take the FIFO path and
misread the sample. Clear the flag before reading the sample, matching
the other ADI accelerometer drivers.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:28 +02:00
Benjamin Cabé
18591b675e drivers: sensor: adxl345: mask data in read-modify-write helper
adxl345_reg_write_mask() OR'd the data argument into the register
without confining it to mask, so callers passing a complemented value
(the INT_MAP routing idiom in adxl345_trigger.c and adxl345_stream.c)
set every bit outside the mask, clobbering unrelated interrupt routing.
AND data with mask before OR'ing it in.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:28 +02:00
Benjamin Cabé
3451bb1e1e drivers: sensor: adxl345: bound FIFO read loop by buffer length
The streaming callback clamped the read length to the space actually
available in the RTIO buffer but still queued one 6-byte read per
hardware FIFO entry, writing past the end of a truncated allocation.
Bound the loop (and the completion-callback attachment) by the clamped
length, and reset fifo_total_bytes at batch start so an aborted chain
cannot leave a stale write offset behind.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 18:41:28 +02:00
Benjamin Cabé
c80298d51a drivers: sensor: lps2xdf: fix decimal part in 4060 hPa full scale
The pressure fractional part was always scaled with the 3125/128
factor, which is only exact for the 4096 LSB/hPa sensitivity (1260 hPa
full scale). In the 4060 hPa mode (fs = 1, 2048 LSB/hPa) that halved
the decimal part; use 6250/128 there instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 09:39:47 -07:00
Benjamin Cabé
02cdb2f152 drivers: sensor: lis2mdl: reset fetch_sem before single-shot trigger
fetch_sem is given on every DRDY event, including conversions nobody
waits for (a late DRDY after a fetch timeout, or the single-shot
conversion started on PM resume), so k_sem_take() could return
immediately and the driver would report the previous conversion's data
forever. Discard any stale count before starting a new conversion.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 09:39:35 -07:00
Benjamin Cabé
4e85747b45 drivers: sensor: lis2mdl: fix sign mismatch in die temperature
The +25 C offset was added to val1 after the raw sample had already
been split into integer and fractional parts, so readings below 25 C
produced a positive val1 with a negative val2. Build the value in
micro-Celsius and let sensor_value_from_micro() split it so both
fields carry the same sign.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-24 09:39:35 -07:00
Dimitrije Lilic
69604fa30f drivers: sensor: adxl355: fix is_fifo offset mismatch in decoder routing
adxl355_decoder_decode() reinterprets a raw sample buffer as
struct adxl355_fifo_data first, checking is_fifo at byte offset 0 to
decide whether to route to adxl355_decode_stream(). struct
adxl355_sample declared is_fifo last (after x/y/z/range), so offset 0
of a one-shot sample buffer was actually the low byte of x - real
accelerometer data, not a flag.

With CONFIG_ADXL355_STREAM=y, roughly half of all one-shot reads
(whenever bit 0 of the raw X LSB happened to be set) were misrouted
into adxl355_decode_stream(), which then reads fifo_byte_count and
sample_set_size at offsets 20-22 - past the 20-byte (sizeof(struct
adxl355_sample)) buffer - causing an out-of-bounds read.

Fix this by giving adxl355_sample an is_fifo field at offset 0,
matching adxl355_fifo_data's layout, and have adxl355_read_sample()
explicitly clear it rather than relying on zero-initialization.

Signed-off-by: Dimitrije Lilic <dimitrije.lilic@orioninc.com>
2026-08-24 10:35:08 +01:00
Benjamin Cabé
1e3a0723d9 drivers: sensor: bma4xx: pass the operation argument to the SPI iodev
BMA4XX_RTIO_SPI_DEFINE() called SPI_DT_IODEV_DEFINE() with two arguments
where three are required, so the macro could never expand for an instance
on SPI. Pass an operation of 0, matching the SPI_DT_SPEC_INST_GET() call
made for the same node in BMA4XX_CONFIG_SPI().

This went unnoticed because the definition sits behind
COND_CODE_1(DT_INST_ON_BUS(inst, spi), ...) and no in-tree devicetree
describes a bma4xx on a SPI bus.

Assisted-by: Claude:opus-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-08-24 10:28:45 +01:00
Benjamin Cabé
209a7fa6a3 drivers: spi: remove deprecated delay argument in DT macros
The optional delay argument accepted by SPI_CONFIG_DT, SPI_CONFIG_DT_INST,
SPI_DT_SPEC_GET, SPI_DT_SPEC_INST_GET and SPI_CS_CONTROL_INIT was
deprecated in Zephyr 4.3 and is now removed as part of the 4.5 deprecation
removal cycle.

These macros now take a fixed argument list, and the chip select timing is
always derived from the spi-cs-setup-delay-ns and spi-cs-hold-delay-ns
devicetree properties of the SPI device node. The SPI_DEPRECATE_DELAY_WARN
helper and the COND_CODE_0()/IS_EMPTY(__VA_ARGS__) plumbing that only
existed to support the deprecated form are dropped as well.

SPI_DT_IODEV_DEFINE and SPI_DT_INST_IODEV_DEFINE lose their variadic
argument too, since they forwarded it into SPI_DT_SPEC_GET.

The four remaining in-tree callers that still passed the deprecated
argument all passed a delay of 0, so nothing needs to be described in
devicetree for them.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-08-24 10:28:45 +01:00
Hasan Albinsaid
eca404dd26 drivers: sensor: bmm150: restore preset on resume
Suspending the BMM150 resets its registers, which clears the configured
ODR and repetition settings. bmm150_init_chip() suspends the device
before returning, so the settings are already lost by the time the
driver first resumes it.

The resume path currently restores the power and operating modes only,
leaving the device with the reset values instead of the selected
CONFIG_BMM150_PRESET_* settings.

Tested on a BMM150 using the regular preset. Before this change,
REP_XY/REP_Z read back as 0x00/0x00 after resume. With this change,
they read back as 0x04/0x07 after resume.

Restore the configured preset before returning the device to normal
mode. This also ensures the settings are restored after runtime
suspend/resume cycles.

Signed-off-by: Hasan Albinsaid <mail@hasanabs.com>
2026-08-23 14:43:24 -04:00
Benjamin Cabé
21349513ed drivers: sensor: rm3100: set read bit on one-shot measurement read
The one-shot RTIO path sent the bare RM3100_REG_MX address, unlike the
bus and streaming paths which OR in REG_READ_BIT. On SPI this clears the
R/W bit, so the device treats the transfer as a write and never shifts
out measurement data, yielding garbage readings.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:46 -04:00
Benjamin Cabé
f9e2414870 drivers: sensor: ms5607: report pressure in kPa instead of mbar
ms5607_compensate() yields pressure in mbar * 100 (i.e. Pa), but
channel_get only divided by 100, returning mbar and thus a value 10x
too large for SENSOR_CHAN_PRESS, which is defined in kilopascal. Scale
by 1000 instead, matching the sibling ms5837 driver.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:41 -04:00
Benjamin Cabé
bb5fdbd68c drivers: sensor: bme280: don't advertise humidity on BMP280 in RTIO
bme280_submit_sync() always set has_humidity, but the fetch helper only
fills comp_humidity when the chip is a BME280, so an RTIO read of a
BMP280 decoded uninitialized buffer bytes as a valid humidity sample.
Gate the flag on the chip ID so the decoder reports -ENOTSUP/-ENODATA,
matching bme280_channel_get() on the synchronous path.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:37 -04:00
Benjamin Cabé
345be80a87 drivers: sensor: bmm350: restore stream state on event error paths
bmm350_event_handler() transitions the stream state to BUSY but the
buffer-allocation and read-SQE preparation error paths returned without
restoring it, so a transient RTIO pool exhaustion left the stream stuck
in BUSY and every later DRDY event was ignored. Restore the ON state
before completing the SQE with an error, as the success path does.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:33 -04:00
Benjamin Cabé
65a18eeece drivers: sensor: bmm350: validate ODR/OSR before suspending device
set_mag_odr_osr() suspended the device before validating the caller's
oversampling value, so an invalid value returned -EINVAL with the chip
left in suspend mode, silently stopping measurements. Validate the
arguments first, and restore normal mode if the ODR/performance write
fails.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:33 -04:00
Benjamin Cabé
ff45ae8509 drivers: sensor: vcnl36825t: don't truncate 16-bit proximity data
channel_get() unconditionally masked the proximity result to 12 bits,
so values read in high-dynamic-output mode (PS_HD = 1), where PS_DATA
is a full 16-bit result, wrapped modulo 4096. Only apply the 12-bit
mask when high dynamic output is disabled.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:28 -04:00
Benjamin Cabé
b5bb6cb244 drivers: sensor: vcnl36825t: fix 8-pulse multi-pulse encoding
VCNL36825T_MPS_PULSES_8 encoded 4 in the 2-bit PS_MPS field at bits
[13:12], which overflowed into the adjacent PS_IT field: the sensor was
programmed for 1 pulse and a doubled integration time. Encode 3 (0b11)
as the datasheet specifies for 8 pulses.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:28 -04:00
Benjamin Cabé
331be29d95 drivers: sensor: bmg160: configure INT pin as input, not interrupt flags
bmg160_trigger_init() passed GPIO_INT_EDGE_TO_ACTIVE to
gpio_pin_configure_dt(), which rejects interrupt flags and never set
the pin as an input. Pass GPIO_INPUT instead; interrupt trigger
configuration is already handled in setup_int().

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:19 -04:00
Benjamin Cabé
dd98124dde drivers: sensor: bmg160: write scaled any-motion threshold to THRES reg
bmg160_slope_config() computed the range-scaled threshold register
value (any_th_reg_val) but wrote the raw dps value to BMG160_REG_THRES,
so the any-motion threshold was wrong by a factor of 2000/range for any
full-scale range other than 2000 dps. Write the computed register value
instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:19 -04:00
Benjamin Cabé
853acb1c1e drivers: sensor: tsl2591: fix threshold overflow check truncation
The threshold conversion was computed in 64-bit arithmetic but
assigned to a uint32_t before the TSL2591_MAX_ADC bounds check, so
results of 2^32 or more wrapped to small values that passed
validation and programmed a wrong interrupt threshold. Keep the
value in a uint64_t until after the check and reject negative
sensor_value inputs, which previously wrapped to huge unsigned
values.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:13 -04:00
Benjamin Cabé
3ec68041e5 drivers: sensor: tsl2591: update cached gain only after register write
tsl2591_set_gain updated the cached gain scale (data->again) before
writing CONFIG, so a failed I2C update left the cache diverged from
hardware, skewing lux conversion and thresholds. Cache the new scale
only after a successful write, matching tsl2591_set_integration.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:13 -04:00
Benjamin Cabé
8931b21e78 drivers: sensor: tsl2591: preserve attr_set error on power restore
The exit path of tsl2591_attr_set() unconditionally overwrote ret with
the result of the power-on register update, so failed or unsupported
attribute writes returned 0. Keep the attribute error and only surface
the power-restore result when the attribute operation succeeded.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:13 -04:00
Benjamin Cabé
9da6555515 drivers: sensor: adxl367: fix FIFO sample count MSB bit
The FIFO watermark is a 9-bit value: 8 LSBs in FIFO_SAMPLES plus one
MSB bit in FIFO_CONTROL, so the MSB of the value is bit 8, not bit 9.
Testing BIT(9) meant watermarks of 256..511 sample sets wrapped modulo
256. Matches the Linux IIO adxl367 driver from ADI.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
ac77a49949 drivers: sensor: adxl367: fix memset size in DIE_TEMP decode branches
The DIE_TEMP branches of the stream decoders cast data_out to
struct sensor_q31_data but zeroed it with
sizeof(struct sensor_three_axis_data), writing 8 bytes past the end
of a correctly sized caller buffer. Use the matching sizeof.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
d7163331ea drivers: sensor: adxl367: support DIE_TEMP in one-shot frame count
The non-FIFO branch of adxl367_decoder_get_frame_count returned
-ENOTSUP for SENSOR_CHAN_DIE_TEMP even though one-shot reads always
encode temperature data and the decoder can decode it. Report one
frame for DIE_TEMP like the other supported channels.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
0627bcec9c drivers: sensor: adxl367: fix truncation in streaming temp Q31 convert
The FIFO decode path divided the raw temperature delta by the 54 LSB/C
sensitivity using integer division before applying the 2^23 Q31 scale,
quantizing streamed temperatures to whole degrees. Scale first with an
int64 intermediate, then divide, so fractional degrees are preserved.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
56ad06895a drivers: sensor: adxl367: use inactivity config for lower threshold
adxl367_attr_set_thresh() always copied activity_th.enable/.referenced
into the threshold passed to the setup helpers, so setting
SENSOR_ATTR_LOWER_THRESH programmed the INACT_EN/INACT_REF bits from
the activity configuration. Select the config source per attribute so
the inactivity path uses cfg->inactivity_th.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
bf9f0644af drivers: sensor: adxl367: fix FIFO byte count in stream read
The FIFO entries register counts individual samples, but the 8B and
14B/12B_CHID byte-count computations used fifo_packet_cnt (entries
divided by samples per set) without multiplying back by the number of
samples per set, so only 1/N of the buffered FIFO data was read each
watermark event. Multiply by sample_numb as the 12B branch already does.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
20fa630dc5 drivers: sensor: adxl367: fix FIFO full trigger check in decoder
The SENSOR_TRIG_FIFO_FULL case in adxl367_decoder_has_trigger()
tested the FIFO watermark status bit, duplicating the watermark case
and misreporting FIFO full events. Check ADXL367_STATUS_FIFO_OVERRUN
instead, matching the trigger mapping used by the stream code.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:07 -04:00
Benjamin Cabé
b49d4fd18b drivers: sensor: bmc150_magn: propagate oversampling attr errors
The SENSOR_ATTR_OVERSAMPLING case discarded the return value of
bmc150_magn_attr_set_rep(), so invalid repetition values, unsupported
channels and bus failures were all reported as success.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:03 -04:00
Benjamin Cabé
5169f1993d drivers: sensor: bmc150_magn: configure DRDY pin as input
gpio_pin_configure_dt() was called with GPIO_INT_EDGE_TO_ACTIVE, which
is an interrupt flag rejected by gpio_pin_configure() (assertion
failure with CONFIG_ASSERT=y) and leaves the pin direction unset.
Configure the pin as a plain input and check the result; edge selection
is already handled by setup_drdy() via
gpio_pin_interrupt_configure_dt().

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-23 14:42:03 -04:00
Jonathan E. Peace
bce510dfc4 drivers: sensor: add Raspberry Pi BCM283x VideoCore thermal sensor
Add a sensor driver for the SoC die temperature on Raspberry Pi
BCM283x devices. The temperature is read through the VideoCore
firmware GET_TEMPERATURE property tag -- the source behind
`vcgencmd measure_temp` -- over the rpi_fw mailbox property
interface, and exposed as SENSOR_CHAN_DIE_TEMP.

The sensor owns no MMIO of its own, so it is modelled as a child of
the raspberrypi,bcm283x-firmware node.

Wire up the VideoCore mailbox (brcm,bcm2711-mbox) on the BCM2710, and
put the firmware (raspberrypi,bcm283x-firmware) node with its
shared-memory property buffer on the board, matching where rpi_4b
keeps them. Enable the sensor on the Zero 2 W and the Pi 4 B.

Signed-off-by: Jonathan E. Peace <jep@alphabetiq.com>
2026-08-21 13:35:55 -07:00
Benjamin Cabé
3f197f0cc7 drivers: sensor: adxl355: fix INT_MAP bit selection in stream submit
adxl355_submit_stream() read route_to_int2 from the driver data
struct, which is never initialized and thus always false, so boards
wired to INT2 toggled the FIFO_FULL_EN1 bit instead of EN2. Use the
devicetree-derived value from the config struct, as the trigger code
does, and drop the dead data-struct member.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
94619d1410 drivers: sensor: adxl355: call stream IRQ handler in all trigger modes
The call to adxl355_stream_irq_handler() was nested inside an
unrelated CONFIG_ADXL355_TRIGGER_OWN_THREAD guard, so with STREAM
enabled and the trigger mode at NONE or GLOBAL_THREAD the GPIO
callback disabled the interrupt and never completed the pending
stream request, hanging streaming forever. Guard the call only by
CONFIG_ADXL355_STREAM, matching the ADXL367/ADXL362 drivers.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
850ec523fd drivers: sensor: adxl355: fix inverted stream guard in has_trigger
adxl355_decoder_has_trigger() returned false unconditionally when
CONFIG_ADXL355_STREAM was enabled, the only configuration in which the
buffer carries a struct adxl355_fifo_data header with status1. Invert
the guard to #ifndef, matching get_frame_count in the same file, so
streaming builds report FIFO trigger events and non-streaming builds
return false.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
9d67fd8acc drivers: sensor: adxl355: fix IRQ flag clobbering cached FIFO watermark
adxl355_submit_stream() compared and stored the 0/1 FIFO-watermark IRQ
enable flag in data->fifo_watermark, the cached FIFO_SAMPLES watermark
count, corrupting the value reported by attr_get and triggering
spurious INT_MAP rewrites and FIFO flushes. Use the dedicated
data->fifo_watermark_irq field instead, as sibling drivers do.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
2909b06543 drivers: sensor: adxl355: restore measurement mode on error paths
attr_set and trigger_set unconditionally place the device in standby
but returned directly on unsupported attribute/channel/trigger or
register errors, silently halting conversions (and leaving the GPIO
interrupt disabled). Restore MEASURE mode and re-enable the interrupt
on all error paths.

Failures during the restore are logged but do not override the
original error, so the root cause still reaches the caller.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
e45db1ab9b drivers: sensor: adxl355: read sample data in async one-shot fetch
adxl355_submit_fetch() acquired the RTIO RX buffer and immediately
completed the SQE without any bus access, so sensor_read() returned
uninitialized memory. Read XDATA3..ZDATA1 into the buffer as a
struct adxl355_sample (raw register bytes as the decoder expects),
set the range, and size the buffer for a single sample.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-21 17:50:18 +02:00
Benjamin Cabé
e2427155e8 dts: bindings: comparator: drop deprecated nxp,kinetis-acmp props
Remove the seven "nxp,"-prefixed properties of the nxp,kinetis-acmp
binding, deprecated in Zephyr 4.0 in favour of the un-prefixed
enable-pin-out, use-unfiltered-output, enable-high-speed-mode,
filter-enable-sample, filter-count, filter-period and enable-window-mode
properties declared in the same binding.

The MCUX_ACMP_DT_INST_PROP()/_OR() compatibility shims in the sensor-class
driver existed only to fall back to the old names, so they collapse to
plain DT_INST_PROP()/DT_INST_PROP_OR() at the instance definition. The
comparator-class driver already used the new names only.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5
2026-08-21 14:42:16 +02:00
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