Commit graph

2,776 commits

Author SHA1 Message Date
Bernhard Reiter
e70d683f86 drivers: sensor: tmag5170: reformat code
Apply code formatting to the TMAG5170 driver sources.

No functional changes intended.

Signed-off-by: Bernhard Reiter <bernhard.reiter@swarovskioptik.com>
2026-02-13 09:48:43 -06:00
Zafer SEN
e6f64330fb drivers: sensor: lps2xdf: add PM device support and power-domain init
Add full power‑management support to the LPS2XDF sensor family
(LPS22DF, LPS28DFW, ILPS22QS). This integrates the drivers with the
Zephyr PM subsystem and allows deferred initialization through
power domains.

Introduce a power_on() callback in lps2xdf_chip_api and track the
current ODR in lps2xdf_data for suspend/resume handling. Implement
a PM control callback that:

- powers on the chip on PM_DEVICE_ACTION_TURN_ON
- enters power‑down mode by setting ODR=0 on SUSPEND
- restores the previous ODR on RESUME
- performs no action on TURN_OFF

Convert initialization to use pm_device_driver_init() and update
the instantiation macros to use PM_DEVICE_DT_INST_DEFINE.

Update each chip driver (lps22df, lps28dfw, ilps22qs) to provide a
.power_on implementation and store the initial ODR in the driver
data.

This enables proper power‑domain control and low‑power operation for
all LPS2XDF‑based pressure sensors.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-02-05 16:52:32 +01:00
Zafer SEN
3797301ca3 drivers: sensor: lis2dw12: add power management support
Add power management (PM) support to the LIS2DW12
accelerometer driver, enabling integration with Zephyr's
PM subsystem and power domains.

Changes:

-Implement lis2dw12_pm_control() callback to handle PM actions:
   PM_DEVICE_ACTION_TURN_ON: Performs full chip initialization
   PM_DEVICE_ACTION_SUSPEND: Puts device into power-down mode (ODR off)
   PM_DEVICE_ACTION_RESUME: Restores previous output data rate
   PM_DEVICE_ACTION_TURN_OFF: Supported (no-op)
- Refactor driver initialization:
  Extract hardware init sequence into lis2dw12_power_up()
  Add lis2dw12_bus_check() for bus readiness verification
  Use pm_device_driver_init() for PM lifecycle management
  Add PM_DEVICE_DT_INST_DEFINE to device instantiation macro

This enables the LIS2DW12 to be controlled via power domains,
allowing deferred initialization until the device is explicitly turned on,
and proper suspend/resume for power savings.

Signed-off-by: Zafer SEN <zafersn93@gmail.com>
2026-02-05 16:51:53 +01:00
Benjamin Cabé
73952ba1b0 drivers: sensor: use proper essential type in boolean variables assignments
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
assigned true/false values, not 1/0.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-05 10:20:22 +00:00
Oleksandr Skopets
7b0d298450 drivers: sensor: bmi270: fix I2C write to use single transaction
Combine register address and data in one buffer and use i2c_write_dt()
instead of i2c_burst_write_dt() so the transfer is a single I2C
transaction. Some I2C controllers (e.g. Infineon) split burst write
into two transactions with a STOP in between, which causes failure.

Signed-off-by: Oleksandr Skopets <skopets.sasha@gmail.com>
2026-02-04 15:33:12 -06:00
Benjamin Cabé
aa99fda10a drivers: sensor: use proper essential type for boolean variables
As per Zephyr coding guideline #59, "operands shall not be of an
inappropriate essential type". This makes sure boolean variables are
initialized and used with proper essential type (true/false).

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-02-04 13:52:38 +01:00
Stefan Schwendeler
a82e5209d8 drivers: sensor: voltage_divider: Improves resolution to sub-millivolt
The calculation of the sensor value uses the intermediate value of the
function `adc_raw_to_microvolts_dt`. This results in a sensor value
with a resolution that is not below `voltage-divider-scaling` millivolts
which can be too rough for some applications.

Using `adc_raw_to_microvolts_dt` and 64-bit-based scaling improves
the resulting voltage resolution.
Therefore, the public function `voltage_divider_scale64_dt()` is
introduced, which performs the same as `voltage_divider_scale_dt()`.
This decision does not affect implementations that use the current
32-bit implementation of `voltage_divider_scale_dt()`.

Signed-off-by: Stefan Schwendeler <Stefan.Schwendeler@husqvarnagroup.com>
2026-01-29 17:20:02 +01:00
Mathieu Choplain
29f1498257 drivers: sensor: stm32_vref: read calibration data once during init
Instead of reading calibration data (device-unique, but never changing!)
then multiplying the result with a constant as part of each conversion,
perform the read+multiplication once during init and cache the result.

This notably avoids frequently an ICACHE disable/enable cycle on STM32H5,
which is a somewhat slow operation.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-29 14:25:28 +00:00
Mathieu Choplain
98f450029e drivers: sensor: stm32_vref: move constants to instance configuration
Various fields were stored in the instance data despite being initialized
at compile-time to a constant value.
Move these fields to the instance configuration instead.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-29 14:25:28 +00:00
Benjamin Cabé
e7ae93b39f drivers: sensor: tmag5273: fix typo in log message
fixes what seems to be a copy-paste error

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2026-01-28 14:42:50 +01:00
Ryan McClelland
779383e769 drivers: counter: add 64bit apis
Add apis for 64 bits.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
2026-01-27 10:49:43 +00:00
Gaetan Perrot
7af0a2fcdf sensor: adi: adxl372: stream: check return value of adxl372_set_op_mode
Check the return value of adxl372_set_op_mode() in
adxl372_submit_stream() and abort on error.

Fix CID: 516239

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-23 13:54:21 +01:00
Brandon Edmonds
554a765de9 drivers: sensor: shell: Add SENSOR_TRIG_TIMER to the sensor stream shell.
In sensor_shell_stream.c, cmd_sensor_stream() checks for valid trigger
types, but it is missing SENSOR_TRIG_TIMER option.

Signed-off-by: Brandon Edmonds <bedmonds91@gmail.com>
2026-01-22 14:34:17 -06:00
Thomas Lang
109f0e15c4 drivers: sensor: apds9960: Added gesture detection
Created logic to calculate gestures from the APDS9960 sensor

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2026-01-22 14:29:50 -06:00
Thomas Lang
f505d31be6 drivers: sensor: apds9960: Setup gesture sensing configuration
Created sensor specific channels and Kconfig for gesture sensing.

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2026-01-22 14:29:50 -06:00
Thomas Lang
75640be632 drivers: sensor: apds9960: Allow multiple sensor instances
Allow for multiple apds9960s to be present

Signed-off-by: Thomas Lang <thomaslang2003@me.com>
2026-01-22 14:29:50 -06:00
Hanan Arshad
151a9a33e6 drivers: sensor: pms7003: add support for additional PM parameters
The current PMS7003 sensor driver in Zephyr only supports reading the
basic PM1.0, PM2.5, and PM10 concentration values.

This update extends the driver to support additional data provided by the
PMS7003 sensor, including:

- Standard particle concentration values (CF=1) for PM1.0, PM2.5, and PM10
- Particle counts for particles greater than or equal to 0.3 µm, 0.5 µm,
  1.0 µm, 2.5 µm, 5.0 µm, and 10.0 µm per 0.1 liter of air

Adding support for these readings allows applications to access more
detailed particulate data, improving the sensor’s usability in air quality
monitoring and analysis scenarios.

Signed-off-by: Hanan Arshad <hananarshad619@gmail.com>
2026-01-22 14:29:37 -06:00
Mathieu Choplain
4228409128 drivers: sensor: stm32_temp: read calibration data once during init
Instead of reading calibration data (device-unique, but never changing!)
as part of each conversion, perform the read once and cache the value.

This notably avoids frequently an ICACHE disable/enable cycle on STM32H5,
which is a somewhat slow operation.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-22 14:11:20 +00:00
Mathieu Choplain
bc9efec896 drivers: sensor: stm32_temp: use union as calibration info type
Using a union enables accessing the calibration data using member names
instead of an array index, which makes the code more readable.

As long as the layout of struct { T m1; ... T mN; } and array A[N] is the
same (implementation-specific?), usage of the union type as done should
be Standard-compliant: accessing through either member of the union will
use an lvalue with compatible type to the same underlying object, which
is one of the allowed aliasing situations listed in §6.5.7 of N1548.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-22 14:11:20 +00:00
Mathieu Choplain
32260932f6 drivers: sensor: stm32_temp: move constants to instance configuration
Various fields were stored in the instance data despite being initialized
at compile-time to a constant value.
Move these fields to the instance configuration instead.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-22 14:11:20 +00:00
Mathieu Choplain
c9c23bef54 drivers: sensor: stm32_temp: use CAL_RES everywhere
The raw "12" constant was used in a place where the "CAL_RES" define should
have been used instead.

Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
2026-01-22 14:11:20 +00:00
Peter van der Perk
40d79b1f64 sensor: bmm150: fix init when no trigger is selected
When no trigger was chosen case statement fell through to
default which causes the return code to -ENOTSUPP

Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
2026-01-22 14:08:56 +00:00
Armando Visconti
af6264e4b9 drivers/sensor: lsm6dsv16x: add device self test
Add device Self Test procedure. It is required to enable the
per device self-test DT property as well as the LSM6DSV16X_SELF_TEST
configuration.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-21 20:08:05 +01:00
Karol Werner
c84a5eb24f drivers: sensor: ina3221: fix measurement wait time calculation
INA3221 performs measurements sequentially for all enabled channels (see
datasheet chapter 7.3.1), but the driver was not accounting for this
when calculating the wait time. Additionally, when measuring both bus
and shunt voltages, conversion times should be summed rather than taking
greater value.

Fix by counting enabled channels and multiplying them with per-channel
conversion time. For combined measurement, sum both conversion times
instead of using MAX().

Signed-off-by: Karol Werner <karol@ppkt.eu>
2026-01-21 20:07:46 +01:00
Jimmy Johnson
abeca66759 sensor: shell: battery: Update support for battery shell queries
Added a `supported` flag to battery status query so if the
charger does not support the query (returns -ENOTSUP) the
command still returns any other supported queries and
doesn't error out without reporting anything. Any other
errors than -ENOTSUP still cause the request to return
immediately, as was the case before the changes. Tested
on nordic npm 13xx.

Signed-off-by: Jimmy Johnson <catch22@fastmail.net>
2026-01-21 20:07:36 +01:00
Gaetan Perrot
8340e8c264 drivers: sensor: ina2xx: get: remove redundant channel NULL checks
The ina2xx channel get helpers assume that channel descriptors are
valid when the driver exposes a given sensor channel.

Checking for NULL channel pointers after they are already
dereferenced does not provide any real safety and can hide
configuration errors.

Drop the late NULL checks and rely on the driver contract that
supported channels must be properly defined.

No functional change intended.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-21 17:06:19 +01:00
Gaetan Perrot
ae44e1e7b7 drivers: sensor: ina2xx: fetch: remove redundant channel NULL checks
The INA2xx fetch path assumes valid channel descriptors for all
supported sensor channels.

NULL checks performed after channel data is accessed are ineffective
and misleading, as invalid channel definitions indicate a
configuration error rather than a runtime condition.

Remove the redundant checks and keep the channel handling consistent
with the driver expectations.

No functional change intended.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-21 17:06:19 +01:00
Aditya Ganesh
f9de2777d9 drivers: sensor: i3g4250d: migrate SPI support to stmemsc
Convert the i3g4250d driver to use the ST MEMS SC API for SPI

Signed-off-by: Aditya Ganesh <adga5133@colorado.edu>
2026-01-21 17:05:13 +01:00
Martin Moya
dd2dedf343 sensor: bosch: bma4xx: add attr_get to device API
This feature allows the user to get the chip's id
from the sensor's API easily

Signed-off-by: Martin Moya <moyamartin1@gmail.com>
2026-01-19 16:21:11 -06:00
TOKITA Hiroshi
717bc816b9 drivers: sensor: liteon: ltr553: Add support for LTR553
Extends the LTR329 driver to support the LTR553.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-16 11:42:27 +00:00
TOKITA Hiroshi
ab6699c03a dts: bindings: liteon: ltr329: deprecate legacy ALS props
To add support for LTR553, we will migrate device-tree
properties to new ones and mark the old ones as deprecated.
We will also refactor variable names accordingly.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-16 11:42:27 +00:00
TOKITA Hiroshi
0f40d36f6b drivers: sensor: liteon: ltr55x: Split definitions to header
ADd ltr55x.h to split definitions from .c file.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-16 11:42:27 +00:00
TOKITA Hiroshi
69bee427ba drivers: sensor: liteon: Rename ltr329 to ltr55x
The LTR329 is a functional subset of the LTR55X series,
lacking the proximity sensor functionality.

To maintain symbol consistency, we will use LTR55X as the base name.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
2026-01-16 11:42:27 +00:00
Matin Lotfaliei
8dbaca4131 drivers: sensor: bosch: bma4xx: Update RTIO callbacks with result arg
drivers: sensor: bosch: bma4xx: Update RTIO callbacks with result argument

Commit bc8d66d538931e650dd2855fabe768720dcb4b02 introduced
a result argument to some RTIO callback handlers.
Update for the BMA4XX sensor.

Signed-off-by: Matin Lotfaliei <matinlotfali@gmail.com>
2026-01-14 09:57:16 +01:00
Armando Visconti
56b85ea61a drivers/sensor: lsm6dsvxxx: add ism6hg256x support
Add support to ism6hg256x sensor variant of LSM6DSVXXX driver.

More information:
https://www.st.com/resource/en/datasheet/ism6hg256x.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Armando Visconti
310457448a drivers/sensor: lsm6dsvxxx: add High-g data support in FIFO
Add support for High-g data in FIFO. The HG data wiil be marked in
FIFO with LSM6DSV80X_XL_HG_TAG.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Armando Visconti
b66fc31c95 drivers/sensor: lsm6dsvxxx: add lsm6dsv80x support
Add support to lsm6dsv80x sensor variant of LSM6DSVXXX driver.

More information:
https://www.st.com/resource/en/datasheet/lsm6dsv80x.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Armando Visconti
3c16d599b1 drivers/sensor: lsm6dsvxxx: add streaming capabality
Add read_and_decode streaming APIs support.

Triggers supported:
    - SENSOR_TRIG_FIFO_WATERMARK
    - SENSOR_TRIG_FIFO_FULL
    - SENSOR_TRIG_DATA_READY

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Armando Visconti
d6eaae4d53 drivers/sensor/st: add support to LSM6DSVXXX IMU family
This driver is currently only supporting the polling-mode read_and_decode
APIs (both blocking and non-blocking).

The driver implements a chip_api structure which has to be used to
provide device specific callbacks. The only lsm6dsvxxx family device
currently supported is lsm6dsv320x.

More information about LSM6DSV16X:
https://www.st.com/resource/en/datasheet/lsm6dsv320x.pdf

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Armando Visconti
5372b41979 sensor/lsm6dsvxxx: change DT common prop names
The Device Tree property names that are common to lsm6dsv16x and
lsm6dsv32x drivers are now prefixed with LSM6DSVXXX_ (and not
LSM6DSV16X_) just for the sake of clarity.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2026-01-12 12:26:41 -06:00
Henrik Brix Andersen
0949f8a52a drivers: sensor: adi: max30210: Fix build with Clang/LLVM
drivers/sensor/adi/max30210/max30210_trigger.c:144:3: error: label followed
by a declaration is a C23 extension [-Werror,-Wc23-extensions]
  144 |                 uint8_t temp_hi_setup[2];
      |                 ^

drivers/sensor/adi/max30210/max30210_trigger.c:175:3: error: label followed
by a declaration is a C23 extension [-Werror,-Wc23-extensions]
  175 |                 uint8_t temp_inc_fast_thresh;
      |                 ^

drivers/sensor/adi/max30210/max30210_trigger.c:196:3: error: label followed
by a declaration is a C23 extension [-Werror,-Wc23-extensions]
  196 |                 uint8_t temp_dec_fast_thresh;
      |                 ^

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2026-01-12 12:26:27 -06:00
Francis Roi Manabat
c6a0444f50 drivers: sensor: add MAX30210 Temperature Sensor Support
Add Support for MAX30210, a low-power,
high-accuracy digital temperature sensor
operating from a 1.7 V to 2.0 V supply.

Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
2026-01-12 11:53:15 +01:00
Pete Johanson
9dc8161870 drivers: sensor: Add missing get_size_info to ADXL362 decoder
Properly report size info for the ADXL362 decoder for streaming data
properly from that sensor.

Signed-off-by: Pete Johanson <pete.johanson@analog.com>
2026-01-09 17:12:08 -06:00
Fin Maaß
27068ed58e drivers: sensor: i2c: replace use of i2c_burst_write
i2c_burst_write is not portable,
as it is not supported by some drivers,
replace its use with i2c_write.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
2026-01-07 17:30:32 +01:00
Gaetan Perrot
61dcab72a5 drivers: sensor: bosh: bmp581: fix redundant NULL check
set_iir_config() dereferences the device pointer before checking it
against NULL, making the defensive check ineffective.

Remove the redundant check.

Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
2026-01-06 19:16:27 +00:00
Martin Meyer
95b0c72bf2 drivers: sensor: ti: opt300x: extend support to otp3004 sensors
The ti,opt3004 ambient light sensor is having same I2C interface
as ti,opt3001.

Signed-off-by: Martin Meyer <meyer.m90@gmail.com>
2026-01-05 17:16:13 +00:00
Zhaoxiang Jin
510253d12a drivers: sensor: mcux_lpcmp: Removed redundant help information
Removed redundant help information

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-01-05 16:06:37 +01:00
Zhaoxiang Jin
af536abe7d dts: drivers: remove nxp,sensor-lpcmp.yaml
1. Removed nxp,sensor-lpcmp.yaml and merged its
properties into nxp,lpcmp.yaml. Now a single
dt-binding (compatible: nxp,lpcmp) is shared
by two drivers: the sensor API-based LPCMP
driver and the comparator API-based LPCMP driver.

2. Updated the driver and samples accordingly.

Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
2026-01-05 16:06:37 +01:00
Ivan Iushkov
0436b8abd8 drivers: sensor: fix possible unaligned access icm45686
icm45686_encoded_fifo_payload is defined as packed struct,
while the nested structures are not. It causes an issue of
potential unaligned access to accel and gyro members.
The issue was detected by clang compiling with
-Wunaligned-access flag:

```
icm45686.h:52:6: error: field accel within 'struct icm45686.h:46:3)'
is less aligned than 'struct icm45686.h:48:4)' and is usually due
to 'struct icm45686.h:46:3)' being packed,
which can lead to unaligned accesses [-Werror,-Wunaligned-access]

icm45686.h:57:6: error: field gyro within 'struct icm45686.h:46:3)'
is less aligned than 'struct icm45686.h:53:4)' and is usually due
to 'struct icm45686.h:46:3)' being packed,
which can lead to unaligned accesses [-Werror,-Wunaligned-access]
```

Small C code snippet to demonstrate the reported issue:
```
struct icm45686_encoded_fifo_payload icm45686;
// prints 1:
printf("%lu\n", __alignof__(icm45686));
// prints 1:
printf("%lu\n", __alignof__(icm45686.accel));
// prints 2:
printf("%lu\n", __alignof__(typeof(icm45686.accel)));
```

This commit resolves the following Zephyr issue:
https://github.com/zephyrproject-rtos/zephyr/issues/101142
by adding `packed` attribute to accel and gyro members.

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2026-01-01 21:28:12 +01:00
Ivan Iushkov
bd6a228911 drivers: sensor: fix possible unaligned access bmi08x
bmi08x_accel_frame is defined as packed struct,
while the nested structures are not. It causes an issue of
potential unaligned access to accel member.
The issue was detected by clang compiling with
-Wunaligned-access flag:

```
bmi08x.h:605:2: error: field  within 'struct bmi08x_accel_frame'
is less aligned than 'union bmi08x.h:605:2)' and is usually due
to 'struct bmi08x_accel_frame' being packed,
which can lead to unaligned accesses [-Werror,-Wunaligned-access]
```

This commit resolves the following Zephyr issue:
https://github.com/zephyrproject-rtos/zephyr/issues/101142
by adding `packed` attribute to accel member.

Signed-off-by: Ivan Iushkov <ivan.iushkov@nordicsemi.no>
2026-01-01 21:28:12 +01:00