Commit graph

2428 commits

Author SHA1 Message Date
Benjamin Cabé
d5af2f7dde drivers: sensors: fxls8974: fix compilation error in fxls8974_transceive
SPI code wasn't tested in CI so this compilation error was missed.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-20 16:23:25 +02:00
Van Petrosyan
04057e15ec sensor: lps22hh: clang-format cleanup
Style-only reformatting, no functional change.

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-06-18 17:50:22 -04:00
Van Petrosyan
1aa07db0ae sensor: lps22hh: add device power management support
Registers driver with pm_device_driver_init(); implements TURN_ON,
SUSPEND and RESUME.  Sets ODR = 0 on suspend per datasheet

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-06-18 17:50:22 -04:00
John Shelton
3b2103f5f7 sensor: dht: Fix multi-instance type handling
The DHT driver incorrectly assumes all sensor instances are the same
type as the first instance (dht@0). The data parsing logic uses a
hardcoded check of the devicetree property for instance 0, which
causes incorrect readings when different sensor models (e.g., DHT11
and DHT22) are used together.

This change stores the model type in each per-instance config struct
during initialization. The data parsing logic is updated to use this
per-instance flag, ensuring each sensor is handled correctly
according to its specific model.

Signed-off-by: John Shelton <moosery@gmail.com>
2025-06-18 17:48:58 -04:00
Benjamin Cabé
0f6b3f066a drivers: sensors: add missing const qualifiers
Ensure conversion tables and the like are marked as const to save on
RAM usage.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 17:47:18 -04:00
Benjamin Cabé
af6209dbcb drivers: sensors: tdk: icp201xx: fix typo in icp201xx_channel_get
s/pressure/temperature/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 17:44:07 -04:00
Benjamin Cabé
e6bd3b4f3e drivers: sensors: icp101xx: add missing error check
add missing variable assignment causing error code to be ignored

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 17:44:07 -04:00
Juraj Lieskovský
7f78eb75dc drivers: sensor: st: qdec_stm32: addition of fractional part
The fractional part of the qdec sensor readout is set to zero (val2 =
0).

Changed the format of the run time data to Q26.6 and adjusted the
assignment of val1 and val2 accordingly.

Signed-off-by: Juraj Lieskovský <lieskovsky.juraj@gmail.com>
2025-06-18 09:26:35 -04:00
Benjamin Cabé
37144c1ffa drivers: sensor: icm42605: fix turn_off_sensor logic
While it would likely not directly cause issues with the current
implementation, the logic of turning off the sensor should be to
actually reset the flags, not to toggle them.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-18 07:39:15 +02:00
Benjamin Cabé
9b1e05b0ab drivers: sensor: tsl2540: fix channel validation logic in attr_set
Use && instead of & in channel validation logic to ensure channel is
either CHAN_IR or CHAN_LIGHT.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-17 07:24:41 +02:00
Benjamin Cabé
a00c901377 drivers: sensor: tdk: remove duplicate entries in ICM42X70_CONFIG_COMMON
Eliminate redundant entries for `accel_pwr_mode` and `apex`.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-17 07:24:29 +02:00
Armando Visconti
a2d230bd88 drivers/sensor/: lis2dux12: support FIFO modes
Support three different FIFO contents which are selectable through
a new DT property, fifo-mode-sel, which may be set to one of the
following values:

    - 0x0 # 1x Accelerometer @12bit and 1x temperature @12bit samples
    - 0x1 # 1x Accelerometer @16bit sample
    - 0x2 # 2x Accelerometer @8bit samples (previous and current)

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-06-17 07:23:23 +02:00
Alexander Apostolu
2e7ec2bc29 drivers: sensor: adi: adxl372: Remove logically dead code
Remove logically dead if and else-if conditions as shown by the static
analysis, replacing with the else statement.

When data_opt is assigned to the MIN of fifo_wmark_cfg and fifo_full_cfg,
both those variables will be non-NULL as an earlier condition ensures the
function returns if either one of the variables is NULL before assigning
to data_opt.

Signed-off-by: Alexander Apostolu <apostolu240@gmail.com>
2025-06-17 07:22:34 +02:00
Armando Visconti
afe0abea42 sensor: lsm6dsv16x: add SENSOR_TRIG_DATA_READY trigger
Add SENSOR_TRIG_DATA_READY trigger support to RTIO streaming.
Currently it just handle XL drdy.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-06-17 07:21:04 +02:00
Benjamin Cabé
c4ed1c01eb drivers: sensor: tdk: fix double tap trigger handler
Ensure that the appropriate trigger is passed when a double tap is
detected.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-16 14:15:31 -04:00
Van Petrosyan
b12717bee1 sensor: lis2dh: add device runtime PM support
Registers driver with pm_device_driver_init(). Moved
chip init routine into separate function to be called
from PM_DEVICE_ACTION_TURN_ON. Added a delay after
power-up.

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-06-16 14:12:32 +02:00
Benjamin Cabé
3b918cc9da drivers: sensor: adopt SHELL_HELP
Adopt SHELL_HELP macro for sensor shell

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-13 15:41:58 -07:00
Wajdi ELMuhtadi
ea6eade52b drivers: sensor: wsen_itds_2533020201601: fix unhandled returned values
The returned values from function calls should
be ignored since these function calls are dummy reads.
fixes #90480

Signed-off-by: Wajdi ELMuhtadi <wajdi.elmuhtadi@we-online.com>
2025-06-13 11:13:25 +02:00
Jordan Yates
7189ade82d drivers: voltage_divider: handle ADC PM
Some ADC's draw significant power while enabled, so make sure the
driver can handle ADC's that have device runtime PM enabled.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-06-11 08:18:39 +02:00
Maksim Salau
bdd94261a5 modbus: serial: Add non-compliant mode with custom stop-bit settings
The mode is activated by the CONFIG_MODBUS_NONCOMPLIANT_SERIAL_MODE option
and allows any stop-bit setting for the serial port.

Signed-off-by: Maksim Salau <msalau@iotecha.com>
2025-06-10 12:53:23 -04:00
Clément Laigle
b921db6608 driver: sensor: as6212: fix sampling frequency
AS6212 supports 0.25Hz, 1Hz, 4Hz, and 8Hz sampling frequencies, but the
current driver supports 0.25Hz, 1Hz, 4Hz, and 16Hz sampling frequencies.

Signed-off-by: Clément Laigle <c.laigle@catie.fr>
2025-06-10 12:09:51 +02:00
Van Petrosyan
8d2010e1e1 sensor: sht4x: add device power management support
Registers driver with pm_device_driver_init(). Peform
software reset on TURN_ON. Added a small delay after
power-up

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-06-09 16:45:30 -07:00
Benjamin Cabé
5cdcaf7b7c drivers: sensor: veaa_x_3: fix broken config initialization
Fixed typos in the preprocessor macros for pressure range initialization
Unfortunately this particular configuration is not covered in CI since
build_all test has pressue-range "D2" and the broken code was concerning
"D9"

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 15:00:26 -07:00
Benjamin Cabé
3d59a44ab9 drivers: sensor: bma4xx_emul: add missing break statement
Add a missing break statement in set_channel function

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:51:47 -07:00
Benjamin Cabé
ba17577d7c drivers: sensor: adi: adxl362: change return type of ret variable
Updated the return type of the 'ret' variable in the
adxl362_attr_set_thresh function to int

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:47:41 -07:00
Benjamin Cabé
48566d834d drivers: sensor: mmc56x3: add error handling in mmc56x3_chip_init
The return code of several initialization functions was being ignored.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:45:27 -07:00
Benjamin Cabé
5fd565e6b4 drivers: sensor: mmc56x3: add missing return statement
Added a missing return statement in the mmc56x3_decoder_get_size_info
causing incorrect size calculation for single channel data

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:45:27 -07:00
Benjamin Cabé
854713cc88 drivers: sensor: fix sensor_handlers checks
z_vrfy_sensor_reconfigure_read_iodev function was performing a
a K_SYSCALL_MEMORY_READ check using an incorrect structure type.

z_vrfy_sensor_get_decoder wasn't properly checking output
parameter `decoder`

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:44:36 -07:00
Benjamin Cabé
fd7c3b4c1c drivers: sensor: paa3905: fix condition in SQE acquisition check
Corrected the logical operator (||, not |) in the condition that checks
for successful acquisition of RTIO SQEs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:43:42 -07:00
Benjamin Cabé
df2179f2a4 drivers: sensor: icm45686: fix condition in SQE acquisition check
Corrected the logical operator (||, not |) in the condition that checks
for successful acquisition of RTIO SQEs.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-09 14:43:42 -07:00
Benjamin Cabé
98ba754013 drivers: sensor: infineon: fix typo in calibration gain assertion
Corrected a typo in the calibration gain assertion

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-07 15:39:15 +01:00
Benjamin Cabé
0a2b92c21f drivers: sensor: memsic: fix typos in Kconfig
Corrected spelling errors in the Kconfig file for the MC3419
accelerometer driver

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-06-07 13:30:13 +01:00
Ivan Wagner
e571f8bab4 drivers: sensor: lsm6dso: added comments in preproc endif
Added comments ad the end of preprocessor if else endif blocks

Signed-off-by: Ivan Wagner <ivan.wagner@tecinvent.ch>
2025-06-06 20:11:46 +01:00
Ivan Wagner
4aa4ee1256 drivers: sensor: lsm6dso: improvements on tilt and tap triggers
Improvements include: check error codes, log level adjustments,
removed unreachable code, disable tilt when not used, call optimized
interrupt handler when tilt and tap are not used.

Signed-off-by: Ivan Wagner <ivan.wagner@tecinvent.ch>
2025-06-06 20:11:46 +01:00
Ivan Wagner
b9cd08b2ea drivers: sensor: lsm6dso: add support for tilt and tap triggers
Tilt or Tap can be selected via config and further tap parameters can be
configured via DT.

Signed-off-by: Ivan Wagner <ivan.wagner@tecinvent.ch>
2025-06-06 20:11:46 +01:00
Armando Visconti
a10f807994 drivers/lis2dux12: add read_and_decode APIs support
Add RTIO async and RTIO stream functionalities that enables,
among all the other things, the sensor data streaming from FIFO.

RTIO stream supports following triggers:

  - SENSOR_TRIG_FIFO_WATERMARK
  - SENSOR_TRIG_FIFO_FULL
  - SENSOR_TRIG_DATA_READY

Following FIFO parameters has to be defined in device tree to
correctly stream sensor data:

  - fifo-watermark
  - accel-fifo-batch-rate

Currently the driver can decode FIFO content with Accelerometer
16-bit samples.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-06-06 09:11:04 -07:00
Jilay Pandya
6cc35eea81 tests: adltc2990: introduce mock_i2c_error function
Introduce mock_i2c_error function in emulator in order to emulate i2c
errors for various registers

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-06-06 09:08:22 -07:00
Jilay Pandya
529029e4e3 tests: adltc2990: increase coverage
increase test coverage for adltc2990 and fix a bug found during testing

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-06-06 09:08:22 -07:00
Florijan Plohl
e0bd460de0 drivers: sensor: Add icm40627 6-axis accelerometer driver
Initial driver for the icm40627 from Invensense/TDK, a 6-axis
accelerometer with gyroscope and temperature sensing capabilities.

Signed-off-by: Florijan Plohl <florijan.plohl@norik.com>
2025-06-06 10:10:23 +02:00
James Roy
d8b3775306 drivers: sensor: renesas: Fix unchecked return value in hs400x
Fix unchecked return value scanned by Coverity.

Signed-off-by: James Roy <rruuaanng@outlook.com>
2025-06-05 12:34:01 +02:00
Tom Deconinck
e25147647c drivers: sensor: ntc-thermistor-generic: add missing mutex
The ntc-thermistor-generic is not thread safe when calling
sensor_channel_get() due to the mutex not being used in
ntc_thermistor_channel_get() when the sampled data is accessed.
Add the thermistor_data mutex around the data access to fix.

Signed-off-by: Tom Deconinck <t.deconinck@gmail.com>
2025-06-05 12:33:39 +02:00
Borislav Kereziev
10e5753d20 drivers: sensor: Add support for BH1730 ambient light sensor
This commit adds support for BH1730 ambient light sensor.

Signed-off-by: Borislav Kereziev <b.kereziev@gmail.com>
2025-06-02 20:22:42 +02:00
Daniel Kampert
a673871970 drivers: sensor: Remove broken reset from apds9306 driver
The reset may cause initialization issues because of a missing
ACK from the sensor. The error check for the I2C communication
is removed to avoid issues during the initialization.

Closes #89850

Signed-off-by: Daniel Kampert <DanielKampert@kampis-elektroecke.de>
2025-05-31 06:54:52 -04:00
John Shelton
7af55237da driver: sensor: aosong,dht: fix sensor protocol broken since change #83192
A recent change 9eeb60c improperly removed a critical line in the driver.

This commit replaces that line and moves an irq_lock to above any pin

value manipulation since the timing is sensitive with the DHT protocol.

This should also fix the timing issue 9eeb60c attempted to fix.

Signed-off-by: John Shelton <moosery@gmail.com>
2025-05-31 03:35:47 +02:00
Loic Domaigne
a8eace10b3 drivers: sensor: bme280: fix "config" register intialization issue
A write to the "ctrl_meas" register can cause the sensor to transition
from sleep to normal mode (which is default Kconfig settings). As per
BME280 datasheet, writes to the "config" register in normal mode may be
ignored. This can lead to use BME280_STANDBY_05MS and BME280_FILTER_OFF
instead of the values set by the application. To fix this, write to the
"config" register before "ctrl_meas" in the sensor init function.

Signed-off-by: Loic Domaigne <tech@domaigne.com>
2025-05-29 12:06:39 +02:00
Luis Ubieda
5cd3a7e79c sensor: afbr_s50: Add DTS configuration bindings
The following parameters are exposed through DTS bindings:
- ODR.
- Dual Frequency Mode.
- Measurement Mode.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-28 21:29:13 +02:00
Luis Ubieda
820975a409 sensor: afbr_s50: Add private channel to obtain pixel matrix
Each time this sensor gets a reading, it contains a matrix of 4 x 32
pixels containing distance readings, from which the 1-D result is
calculated. The private channel would expose this array through
Sensor APIs.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-28 21:29:13 +02:00
Luis Ubieda
f9d9e5bb6d modules: afbr: Add basic functionality
- Add AFBR module as a HAL.
- Platform layer to support running AFBR API using Zephyr.
- Ability to instantiate on device-tree.
- Samples in the module proving foundations works.
- Zephyr Sensor API support, by introducing:
    - Read/Decode for SENSOR_CHAN_DISTANCE (1-D results).
    - Streaming mode for DATA_READY (1-D results).

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-05-28 21:29:13 +02:00
Benjamin Cabé
fdf713ab51 drivers: sensor: icp101xx: update channel check condition
Removed a logically dead else by doing sensor channel check
in a way that's more aligned with how other drivers do it.

Fixes: CID 505949
Fixes: zephyrproject-rtos/zephyr#90558
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-05-28 17:49:50 +02:00
Brandon Allen
979933cfb4 drivers: current_sense_amplifier: add zero-current-voltage binding
some current sense amplifiers have a non zero offset voltage
that correlates to zero current. adding this offset voltage binding
allows the driver to be used with this type of circuitry.

Signed-off-by: Brandon Allen <brandon.allen@exacttechnology.com>
2025-05-28 17:48:47 +02:00