Commit graph zephyr/drivers/sensor
Author SHA1 Message Date
Ryan McClelland
0c6aa29aeb drivers: sensor: bmm350: put chip in suspend on pad-drive failure
A failed pad drive-strength write in bmm350_init_chip() returned directly
instead of going through the err_poweroff path, leaving the device in an
indeterminate power state unlike every other init failure. Use the common
error path so the part is returned to suspend mode.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
2e97c06ca0 drivers: sensor: bmm350: check register writes during init
set_powermode() issued the PMU command write and then slept and returned
without inspecting the write result, and bmm350_init_chip() ignored the
return value of the soft-reset command write entirely. Propagate a failed
PMU write instead of sleeping on it, and abort init (returning the part
to suspend) if the soft-reset write fails.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
dc12c54341 drivers: sensor: bmm350: allow disabling the data-ready trigger
bmm350_trigger_set() always wrote the full interrupt configuration,
including the data-ready enable, even when called with a NULL handler.
The Zephyr trigger API uses a NULL handler to request "disable", so
there was previously no way to turn the trigger off. Clear the
data-ready and interrupt-output enables when the handler is NULL.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
2d0d3e00f7 drivers: sensor: bmm350: avoid overflow in compensation math
bmm350_decoder_compensate_raw_data() performed the fixed-point
compensation in int32. The cross-axis stage multiplies the per-axis
value by BMM350_MAG_COMP_COEFF_SCALING (1000) twice, which overflows
int32 once the field exceeds roughly 2 mT (reachable during self-test
excitation or saturation), corrupting the result. Use int64
intermediates for the working values and cast back to int32 only for
the final stored readings.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
e1daad21d9 drivers: sensor: bmm350: check callback SQE acquisition
bmm350_submit_one_shot() and the streaming event handler acquired the
completion-callback RTIO SQE with rtio_sqe_acquire() but used it
without checking for NULL. If the SQE pool is exhausted the acquire
returns NULL and rtio_sqe_prep_callback_no_cqe() then dereferences it.
Check the result, drop any partially-prepared SQEs and fail the
submission with -ENOMEM, matching how the preceding read SQE is already
handled.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
75cc87f12b drivers: sensor: bmm350: add user self-test
Add bmm350_self_test() to the driver's public header, following the
Bosch BMM350 SensorAPI self-test sequence: re-initialise the TMR sensor
(suspend, flux-guide reset, fast bit reset, fast-forced mode) with
per-step PMU command status verification, then measure the response to
a positive and negative excitation on the X and Y axes.

The excited-axis response is read uncompensated and converted to
micro-Tesla using the default sensitivity coefficients, matching the
SensorAPI read_out_raw_data(); OTP compensation is intentionally not
applied since the test evaluates the differential response. Results
(per-axis responses and deltas) are reported through a
bmm350_self_test_result struct, and the prior power mode is restored on
return. Judging the deltas against the datasheet self-test limit is
left to the caller.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Ryan McClelland
2ba40b541f drivers: sensor: bmm350: add I3C bus support
The BMM350 driver only supported I2C. Extend the existing RTIO bus
abstraction to also drive the sensor over I3C, following the same
multi-bus pattern used by the bmp581 driver.

A new BMM350_BUS_TYPE_I3C bus type is selected per devicetree instance
based on the bus the node sits on. The RTIO register read/write helpers
set the I3C stop/restart iodev flags, and bus readiness is checked via
the I3C controller device. Register access, triggering and one-shot/
streaming all flow through the existing bus_io vtable unchanged.

Add a bosch,bmm350-i3c.yaml binding that reuses the common properties,
make the I2C/I3C Kconfig selects conditional on the instance bus, and
add an I3C node to the sensor build_all test.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-09-08 19:16:40 -04:00
Benjamin Cabé
fef767b584 drivers: sensor: icm4268x: sign-extend FIFO temperature samples
The FIFO temperature is a signed quantity (8-bit at 2.07 LSB/degC in
standard packets, 16-bit at 132.48 LSB/degC in hires packets, both
offset at 25 degC), but the decoder read the bytes as unsigned, so any
temperature below 25 degC decoded as a large bogus positive value and
could trip the whole-degrees range assert. Cast to the signed width
before converting.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
81eaa8b1e0 drivers: sensor: icm4268x: fix sample byte order on big-endian targets
The sensor streams sample registers MSB-first, so assembling the value
as (MSB << 8) | LSB already yields a CPU-order value. Wrapping it in
sys_le16_to_cpu() byte-swapped every sample on big-endian targets; use
sys_get_be16() instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
f914cc6994 drivers: sensor: icm4268x: fix fifo_count when FIFO data is not read
The streaming header unconditionally reported fifo_count as the FIFO
watermark, even on the flush paths (SENSOR_STREAM_DATA_NOP/DROP or
FIFO_FULL trigger) where only a header-sized buffer is allocated and
no FIFO payload is read, causing the decoder to walk past the end of
the buffer. Set fifo_count to 0 unless the watermark trigger requested
the data to be included, matching the read performed in the FIFO event
handler.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
ca13681311 drivers: sensor: icm4268x: apply axis-align in one-shot decoder
The one-shot decoder read edata->readings directly, ignoring the
axis_align remap that icm4268x_encode stores in the header and that
both the FIFO decoder and the sync channel_get path apply. Index and
sign the accel/gyro readings through header->axis_align so async
one-shot reads match the other data paths.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
9d39549c47 drivers: sensor: icm4268x: do not mask configure error on rollback
icm4268x_safely_configure() overwrote the primary configure error
with the rollback result, so a failed reconfigure followed by a
successful rollback returned 0 to callers such as attr_set even
though the requested configuration was never applied. Keep the
original error and only log a rollback failure.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
5709f265d5 drivers: sensor: icm4268x: fix q31 temperature packing for negatives
The FIFO temperature was packed by OR-ing a FIELD_PREP'd whole part
with a fraction term computed via unsigned GENMASK64 arithmetic. For
negative temperatures both pieces are negative, so the unsigned divide
produced garbage and bitwise OR cannot perform the required signed
add. Compute the q31 value with signed 64-bit arithmetic instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
79c1bbcf94 drivers: sensor: icm4268x: fix sign extension of 16-bit FIFO samples
The non-hires FIFO decode path masked with BIT(16), which can never
be set in a 16-bit sample, so negative accel/gyro values were never
sign-extended and decoded as large positive values. Use BIT(15) to
match the 20-bit hires path's BIT(19) idiom.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-08 16:06:39 +02:00
Benjamin Cabé
cef1e50c75 drivers: sensor: icm566xx: propagate attribute configuration errors
icm566xx_attr_set() ignored the return value of the accel/gyro config
helpers and always returned 0, and those helpers discarded the status of
every HAL setter, so unsupported attributes and bus failures were
reported as success. Also fix icm566xx_init() to check the accel LPF
call instead of re-testing the previous gyro LPF result.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Benjamin Cabé
9fc4710a49 drivers: sensor: icm566xx: fix one-shot die temp decode on ICM56686
On ICM56686 builds the one-shot decoder routed SENSOR_CHAN_DIE_TEMP
through get_raw_reading_by_position(), which only handles the six
accel/gyro positions and returned -EINVAL as if it were a sample.
Read the 16-bit temperature straight from the payload instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Benjamin Cabé
f67d34f58c drivers: sensor: icm566xx: track full-scale changes made at runtime
Setting SENSOR_ATTR_FULL_SCALE only reprogrammed the accel/gyro FSR
register while the cached full-scale values used to convert raw samples
kept the devicetree settings, silently scaling every reading by the
wrong factor. Update the cached values on a successful FSR change, and
stamp encoded frames from the driver data instead of the fixed config.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Benjamin Cabé
37ae749c70 drivers: sensor: icm566xx: fix inverted LN/LP mode auto-selection
The ODR register enums decrease as frequency increases, so comparing
the requested ODR with >= ODR_12_5_HZ picked low-noise mode for the
slowest rates and low-power mode for the fastest ones. Invert both the
accel and gyro comparisons so LN is selected for rates of 12.5 Hz and
above, and LP for the slower LP-only rates.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Benjamin Cabé
6841c49535 dt-bindings: sensor: icm566xx: fix gyro 12.5 Hz ODR value
ICM566XX_DT_GYRO_ODR_12_5 was defined as 1 instead of 12, which is
neither a valid hardware ODR encoding nor an accepted value of the
gyro-odr binding enum, and it made the low-noise branch of
ICM566XX_VALID_GYRO_ODR unsatisfiable so every LN devicetree failed
its BUILD_ASSERT. Also relax the ODR range checks to inclusive
comparisons so the documented 400 Hz LP and 12.5 Hz LN rates are
accepted, matching icm45686.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Benjamin Cabé
fdf45aa670 drivers: sensor: icm566xx: fix 10x error in gyro rad/s conversion
The gyroscope sensitivity values are encoded as LSB per dps scaled by
1000, but the rad/s conversion multiplied the raw value by 10000,
making every gyro reading ten times too large for all full-scale
settings. Use a multiplier of 1000 to match the sensitivity scaling.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 21:07:04 -04:00
Fabio Baltieri
e17d4c6c86 device: Add DEVICE_DT_INST_GET_COMMA macro
Add DEVICE_DT_INST_GET_COMMA helper macro to include/zephyr/device.h to
easily get a device pointer followed by a comma when expanding
devicetree foreach iterators like DT_INST_FOREACH_STATUS_OKAY.

Update drivers, soc, subsys, and tests to use the common definition.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Assisted-by: Antigravity:gemini-1.5-pro
2026-09-07 17:07:48 +01:00
Mathieu Choplain
bb30156819 drivers: sensor: icm4268x_emul: don't use __ASSERT_UNREACHABLE
The `__ASSERT_UNREACHABLE` macro is a PRIVATE helper macro used in the
implementation of the actual `__ASSERT` macros. It should not be used
except by the `__assert.h` header itself; in fact, the macro is never
defined if assertions are not enabled.

Replace this private macro's usage in the aforementioned driver with
`__ASSERT_NO_MSG(0)` which will trigger a proper assertion panic if
reached, which seemed to be the intent here.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-09-07 17:55:47 +02:00
Benjamin Cabé
0b20c505fa drivers: sensor: mpu6050: fix die temperature offset constant
The MPU6050 die-temperature conversion used a 36.00 degC offset, but
the InvenSense register map specifies TEMP_OUT/340 + 36.53 degC, making
every reading 0.53 degC too low. Use 36530000 microdegrees instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:54 +02:00
Benjamin Cabé
55f3c3fe0e drivers: sensor: bmi160: fix PMU status mask in emulator
The PMU command emulation kept only the field being written and
cleared every other sensor's PMU state instead of the opposite.
Invert the mask so the read-modify-write preserves unrelated fields.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
cfc7f29582 drivers: sensor: bmi160: propagate PM suspend/resume errors
bmi160_pm() ignored the return values of bmi160_resume() and
bmi160_suspend(), reporting success to the PM subsystem even when the
underlying PMU register writes failed. Capture and return them.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
0b1174f584 drivers: sensor: bmi160: avoid overflow in anymotion threshold calc
(slope_th_ums2 - 1) * 512 was computed in 32-bit arithmetic and wraps
for thresholds above ~0.855 g, which the range check explicitly allows
on the 2g range and up. Widen to 64-bit before multiplying, and reject
negative and zero threshold inputs which would underflow the
subtraction.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
c7da21f57a drivers: sensor: bmi160: fix sign corruption in gyro offset readback
The 10-bit gyro offset is assembled from the 2 MSBs in OFFSET_EN and an
8-bit LSB byte read into an int8_t array. Integer promotion
sign-extended LSB values >= 0x80, flooding the upper bits and making
the explicit 10-bit sign extension that follows a no-op. Treat the LSB
as unsigned when assembling the raw value.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
c8c73a7c56 drivers: sensor: bmi160: keep die temperature out of the sample union
The cached temperature word overlaid the first gyro/accel sample in
union bmi160_sample, so fetching SENSOR_CHAN_DIE_TEMP clobbered the
cached X-axis raw sample, and a SENSOR_CHAN_ALL fetch overwrote the
temperature with gyro X data that channel_get then converted to a
bogus temperature. Store the temperature in its own struct bmi160_data
field.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
26c2aad5db drivers: sensor: bmi160: fix sign handling of die temperature
The raw temperature register is a signed two's-complement value with
0x0000 = 23 degrees C, but it was multiplied as unsigned, so any die
temperature below 23 C was reported as roughly +23..+151 C. Cast the
sample to int16_t and use signed arithmetic throughout.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-07 10:26:23 +02:00
Benjamin Cabé
4a1a4e844c drivers: sensor: tmp451: use level interrupt for ALERT pin
Per the datasheet, reading the status register does not release the
latched ALERT pin, and the flags themselves only clear once the alert
condition is gone. Re-arming an edge interrupt on a still-asserted pin
therefore lost all further alerts permanently. Use a level interrupt,
as the tmp11x and tmp007 drivers do, so a still-pending alert re-runs
the handler and a stale latch at init recovers.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-04 21:45:15 -04:00
Benjamin Cabé
6e68ac49dc drivers: sensor: tmp451: reject SENSOR_ATTR_OFFSET on non-remote channels
tmp451_attr_set() programmed the remote-diode offset registers for
SENSOR_ATTR_OFFSET regardless of the requested channel, so setting an
offset on SENSOR_CHAN_AMBIENT_TEMP silently shifted die temperature
readings instead. Return -ENOTSUP unless the channel is
SENSOR_CHAN_DIE_TEMP or SENSOR_CHAN_ALL.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-04 21:45:15 -04:00
JaeHwan Jin
431a333708 drivers: sensor: add Plantower PMSA003I driver
Add a driver for the Plantower PMSA003I laser particulate matter sensor.
The sensor exposes PM1.0/PM2.5/PM10 mass concentrations (both CF=1
standard particle and atmospheric environment) and 0.3/0.5/1.0/2.5/5.0/10
um particle counts over I2C, read as a 32-byte fixed frame from register
0x00 with a start-byte, frame-length and checksum validation.

The optional reset and set pins are internally pulled up on the sensor,
so they are handled only when wired in the devicetree.

Signed-off-by: JaeHwan Jin <jaehwan.jin@rakwireless.com>
2026-09-04 13:41:20 -04:00
JaeHwan Jin
275576c8f0 drivers: sensor: move pms7003 under plantower vendor directory
Group the Plantower PMS7003 driver under a dedicated plantower/ vendor
directory, matching the per-vendor layout used elsewhere in
drivers/sensor. No functional change.

Signed-off-by: JaeHwan Jin <jaehwan.jin@rakwireless.com>
2026-09-04 13:41:20 -04:00
Guillaume Gautier
5b130f6343 drivers: sensor: st: qdec_stm32: update driver for L0 and WB0
The macro IS_TIM_32B_COUNTER_INSTANCE doesn't exist on STM32L0 and WB0.
These series don't have any 32 bits counter.
Add an ifdef to make the driver compatible with these series.

Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
2026-09-04 06:22:30 -04:00
Benjamin Cabé
377e68a162 drivers: sensor: st: fix sensor hub humidity value conversion
The shub humidity converters stored the whole relative humidity scaled
by 1e6 in val2 instead of only the fractional part, so consumers using
val1 + val2/1000000 saw roughly double the actual reading. Use
sensor_value_from_float() to split the value correctly.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-03 18:48:00 -04:00
Benjamin Cabé
3977d7274f drivers: sensor: lsm6dso: bound the data-ready drain loop
The drain loop exited only once every STATUS_REG data-ready bit was
clear, but those bits are cleared as a side effect of a registered
handler reading the output registers, so a source with no handler (e.g.
temperature) spun the loop forever. Qualify the exit condition by
handler presence and cap the number of iterations in both variants.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-03 18:48:00 -04:00
Benjamin Cabé
34e8176935 drivers: sensor: lsm6dso: fix uninitialised embedded sensor struct
lsm6dso_enable_tilt_int() assigned only the tilt bit of an
uninitialised lsm6dso_emb_sens_t, and lsm6dso_embedded_sens_set()
writes all six bits into EMB_FUNC_EN_A/B, so stack residue could
enable the pedometer, significant motion or FSM engines. Read the
current state first and modify only the tilt bit.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-03 18:48:00 -04:00
Aaron Kim
fa55c5c08c drivers: sensor: icm566xx: Add ICM56622 and ICM56686 support
Use official TDK Invensense driver for ICM566xx sensor in tdk_hal module.

Signed-off-by: Aaron Kim <aaron.kim@tdk.com>
2026-09-02 19:18:15 +01:00
Benjamin Cabé
f24575bee0 drivers: sensor: mtch9010: guard OUT_STATE fetch on missing GPIO
The SENSOR_CHAN_MTCH9010_OUT_STATE fetch path called gpio_pin_get_dt()
unconditionally, dereferencing a NULL port when the optional
output-gpios property is absent (e.g. UART-only configurations). Return
-ENOTSUP in that case, mirroring the guard used by the other fetch path.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-02 15:29:21 +02:00
Benjamin Cabé
cdb36f90ce drivers: sensor: mtch9010: fix sleep period timeout computation
config->sleep_time holds the devicetree enum index used as the UART
command argument, but the fetch timeout math treated it as seconds, so
any sleep period of 4 s or more timed out early. Store the period in
seconds separately and widen the timeout values to uint32_t, since
256 s no longer fits in uint16_t once converted to milliseconds.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-02 15:29:21 +02:00
Benjamin Cabé
f4065d4bc3 drivers: sensor: mtch9010: accept negative values in DELTA format
The decode entry guard rejected any buffer whose first character was
not a digit, so DELTA-only packets carrying a negative delta (e.g.
"-99\n\r") always failed with -EINVAL. Allow a leading minus sign; the
per-format range checks still reject negative measurements.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-09-02 15:29:21 +02:00
Benjamin Cabé
fdf2af1d8c drivers: sensor: use inclusive SPI terminology
Use controller/peripheral and SDO/SDI terminology in sensor drivers,
following coding guideline rule A.2: switch the SPI configuration
constants to SPI_OP_MODE_CONTROLLER and update SPI wiring comments.

For the Broadcom AFBR-S50 sensor, the spi-sdi-gpios/spi-sdo-gpios
devicetree properties (named from the sensor's own perspective per
the OSHWA resolution) replace spi-mosi-gpios/spi-miso-gpios. The old
property names are still accepted, marked as deprecated in the
binding, and used as fallbacks; the Zephyr platform glue in
modules/hal_afbr is updated to the renamed fields. The Broadcom
Argus API names (s2pi_slave_t, S2PI_*) come from the vendor library
and keep their names.

Occurrences that concern I2C rather than SPI (I2C controller ACK
behavior comments in NXP drivers, the lsm6dso sensor-hub I2C master
code using ST HAL APIs and application note quotes) and vendor
register names (TDK MPUREG_MASTER_LOCK) are out of scope and keep
their wording.

Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-09-01 21:04:50 -04:00
Corey Wharton
7443efd4e3 drivers: sensor: tmp112: add PM support
Add device power management so the sensor can sit under a power domain
that may be unpowered at init. Bring-up moves to a PM_DEVICE_ACTION_TURN_ON
handler, and RESUME/SUSPEND toggle the config register shutdown bit.

One-shot mode keeps the sensor shut down between fetches, so RESUME
leaves the shutdown bit set in that configuration.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2026-09-01 16:26:23 -04:00
Parthiban Nallathambi
870e496811 license: fix malformed SPDX-FileCopyrightText headers
Two-line copyright notices were wrapped in the SPDX "<text>...</text>"
construct, which is only valid in an SPDX document, not a file header.
The REUSE tool then folds the literal "<text>" into the holder name
and drops the second line from the SBOM.

Remove the markers and tag the continuation line. Holder, year and
e-mail are left unchanged; only the syntax is fixed.

Signed-off-by: Parthiban Nallathambi <parthiban@linumiz.com>
2026-09-01 16:25:23 -04:00
Lukasz Wiecaszek
409573c276 drivers: sensor: ina219: Simplify signed conversion via int16_t cast
I belive that

  tmp = (int16_t)data->current

is more descriptive and straightforward than

  if (INA219_SIGN_BIT(data->current)) {
      data->current = ~data->current + 1;
      sign = -1;
  }
  tmp = sign * data->current

Thus to make it consistent with signed conversion which is already
done for SENSOR_CHAN_VSHUNT I propose such cosmetic fix.

Signed-off-by: Lukasz Wiecaszek <lukasz.wiecaszek@gmail.com>
2026-09-01 16:25:08 -04:00
Lukasz Wiecaszek
f68c12a39b drivers: sensor: ina219: Add support for shunt voltage readouts
Implementation of ina219 was missing support for
shunt voltage readouts (SENSOR_CHAN_VSHUNT).
This commit fixes that issue.

Signed-off-by: Lukasz Wiecaszek <lukasz.wiecaszek@gmail.com>
2026-09-01 16:25:08 -04:00
Benjamin Perseghetti
3a5d4ddee1 drivers: sensor: afbr_s50: bound and harden the recovery path
Cap the reinitialization retries in the recovery path: after a fixed
number of consecutive failures, with a growing backoff between
attempts, fail the submission with -EIO instead of retrying forever,
so a detached or dead device cannot spin the RTIO work queue.

Guard the hand-off points the recovery flow relies on: submitting a
work item without a checked-out submission is rejected, and an error
reported with no submission in progress returns the driver to idle so
the next submission can recover. Complete a successful recovery with
rtio_iodev_sqe_ok() instead of an error completion carrying result 0.

Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2026-08-31 21:35:02 -04:00
Luis Ubieda
4fe747374b drivers: sensor: afbr_s50: rework error recovery to reinitialize the device
Stopping and restarting the measurement timer does not bring the device
back once it reports an error: the data stream stays dead until the
board is rebooted. Argus_StopMeasurementTimer() also blocks, and it was
called for every data-ready trigger seen while the device was in error,
delaying the data evaluation that frees the internal buffer and holding
the device in the failed state.

Track the error and the recovery as explicit states so the stop is done
once per error occurrence and an in-progress recovery is distinguishable
from a new failure. Recover by tearing the Argus handle down and
initializing it again through a shared reinitialization sequence, which
restores the stream in place. The initialization and configuration steps
that afbr_s50_init open-coded are factored into that shared sequence so
the recovery path and the initial bring-up run the same code.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
2026-08-31 21:35:02 -04:00
Benjamin Cabé
6e40d2478e drivers: sensor: lsm6dso16is: bound the data ready drain loop
The interrupt handler only exited its drain loop once every data ready
flag in STATUS_REG was clear, but those flags are cleared by reading the
output registers, which only happens from a registered handler. A flag
set for a source with no handler (or a handler deferring the fetch) made
the loop spin forever and never re-enable the GPIO interrupt. Only
consider sources that have a handler registered, cap the number of
iterations, and re-arm the interrupt on a status read error as well.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-31 13:09:25 -04:00
Benjamin Cabé
b3d599a3ec drivers: sensor: lsm6dso16is: honor enable arg in int routing
The enable_{t,xl,g}_int() helpers hardcoded the data-ready route bit
to 1, so a sensor_trigger_set() with a NULL handler never cleared
INT1_CTRL/INT2_CTRL and the sensor kept asserting the interrupt line.
Assign the enable parameter to the route bit instead.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:fable-5
2026-08-31 13:09:25 -04:00