Commit graph

2428 commits

Author SHA1 Message Date
Ruibin Chang
cbe1932a20 drivers/sensor/ite/tach_ite_it8xxx2: don't clear both tach status at once
When two tach use simultaneously, I find that the both tach status will
be cleared at once, which causes one of tach not to get rpm speed.
So I change it to clear status only one tach at a time.

This issue is reported by Huaqin:
https://partnerissuetracker.corp.google.com/issues/404067663?pli=1

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2025-03-21 09:53:22 +01:00
Maximilian Deubel
878ab53698 drivers: sensor: add Bosch BMM350 magnetometer driver
Add driver for Bosch BMM350 magnetometer sensor.

Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
2025-03-20 12:17:41 +01:00
Benjamin Cabé
c1531b24e7 drivers: sensors: adxl367: fix clang compilation error
Added missing braces to case statements causing clang compilation errors

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-03-19 20:25:20 +01:00
Christophe Tournery
2ba3bbe0d9 drivers: sensor: tdk: icm42688: fix wrap-around
When converting raw values to integer and fractional (micro) parts, the
fractional part must be a signed integer.

- Fix prototypes where the fractional part was declared as unsigned.
- Fix comments which did not match the declared type.

Signed-off-by: Christophe Tournery <christophe.tournery@freshape.com>
2025-03-18 19:52:42 +01:00
Luis Ubieda
8258cba2c6 sensor: icm45686: Add Streaming Mode
Enable Streaming mode with the following modes:
- DRDY
- FIFO Watermark
- FIFO Full

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-17 13:56:41 +01:00
Luis Ubieda
356480c4cb sensor: icm45686: Simplify decoder to directly receive fs
Instead of requiring the edata struct, just receive full-scale
parameter. This simplifies the decoding process for FIFO data
during streaming.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-17 13:56:41 +01:00
Jeppe Odgaard
6c627df62e drivers: sensor: explorir_m: add calibration
Add calibration via a known gas concentration. This is the recommended way
of calibrating the sensor according to the datasheet.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-14 17:54:39 +01:00
Andreas Klinger
72b2f01298 drivers: sensor: add vishay veml6031 ambient light sensor
- add driver for Vishay VEML6031 High Accuracy Ambient Light Sensor.
- add new compatible "vishay,veml6031".
- read and write consecutive 8 bit registers as bulk operation.
- add driver to build all test of sensors.
- support fetch and get.
- triggered mode and interrupt is not yet supported.

Signed-off-by: Andreas Klinger <ak@it-klinger.de>
2025-03-14 14:40:12 +01:00
Luis Ubieda
df1d3b8ef3 sensor: paa3905: Add streaming mode
Working through either Motion detection or through Data-Ready.

Data-ready has a back-up timer to trigger worst case, if no motion
occurs within 10X data-rate.

On every streaming event, the driver checks for the sensor health, and
attempts recoverying its state if it detects issues.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-13 16:56:07 +00:00
Luis Ubieda
53bb372980 sensor: PA3905: Add basic functionality
- Add bus support for SPI (based on RTIO).
- Support read/decode API for one-shot reads on the following channels:
    - SENSOR_CHAN_POS_DX.
    - SENSOR_CHAN_POS_DY.
    - SENSOR_CHAN_POS_DXYZ.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-13 16:56:07 +00:00
Ioannis Damigos
a7c0ec2c55 drivers: sensor: hs400x: Soft reset HS400x during initialization
Soft reset HS400x during initialization to make sure that
device is at a known state and writeable registers have the
default values.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2025-03-13 07:22:36 +01:00
Ioannis Damigos
dcd8c611aa drivers: sensor: hs400x: Fix measurement time
According to the datasheet, maximum conversion time for both
humidity and temperature at 14 bits resolution is 1.7 ms.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2025-03-12 14:05:33 +00:00
Jeppe Odgaard
8b8d56a5ca drivers: sensor: explorir_m: increase max response delay
The sensor does not always finish responding within 200 ms.
This is the sometimes the case when using the sensor calibrate command `X`.
Response delay up to 212 ms has been measured with a logic analyzer.

Increase the max response delay to 300 ms to fix the issue.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-11 18:54:34 +01:00
Jeppe Odgaard
e575eea233 drivers: sensor: explorir_m: improve transceive
During calibration feature development the following loop was used for
testing:

```shell
CMD="sensor attr_set explorir_m co2 calibration 1234"
while : ; do echo "$CMD" > /dev/ttyACM0; sleep .8; done
```

At some point calibration would fail and all following calibration commands
would fail.

Reset buffer and semaphore just before terminating the command to better
mitigate disturbance from previous failed command.

Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
2025-03-11 18:54:34 +01:00
Luis Ubieda
4aef791a0e sensor: icm45686: Add Triggers functionality
Only working with SENSOR_TRIG_DATA_READY so far.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-11 05:37:06 +01:00
Luis Ubieda
05e8a65ba0 sensor: icm45686: Add low-pass filter configuration options
Both for Gyro and Accelerometer.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-11 05:37:06 +01:00
Luis Ubieda
25793fe33c sensor: icm45686: Add basic sensor functionality
- Add support for Fetch/Get API.
- Add support for Read/Decode API.
- Add config settings through device-tree.
- Add bus support for SPI (although easily extensible to others as
based on RTIO).

Fetch/Get API tested with accel_polling sample.
Read/Decode API tested with sensor_shell sample.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-03-11 05:37:06 +01:00
Jilay Pandya
d26396c556 drivers: sensor: shell: fix logically deadcode issue
sca finds the code to be logically dead considering the size of long
to be 4 bytes.
- Solution: use uint64_t type for the variable `value`.

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2025-03-07 20:22:10 +01:00
Hank Wang
09d6197003 drivers: sensor: tmp1075: remove redundant module name in log message
The tmp1075 driver already registers a log module using
LOG_MODULE_REGISTER(TMP1075, CONFIG_SENSOR_LOG_LEVEL).
This ensures that all log messages are prefixed with "TMP1075".
The existing LOG_ERR message redundantly includes "tmp1075",
which is unnecessary.

Signed-off-by: Hank Wang <wanghanchi2000@gmail.com>
2025-03-07 20:20:46 +01:00
Dan Collins
464abe7a25 sensor: st: lis3mdl: Add support for device power management
This commit adds support for device power management to the LIS3MDL
magnetometer driver.

Signed-off-by: Dan Collins <dan@collinsnz.com>
2025-03-07 19:56:45 +01:00
Emilio Benavente
5e35836922 boards: nxp: mcxw7x: Add FXLS8964 Sensor Support
Added FXLS8964 Accel Sensor Support for the
mcxw71 and mcxw72 devices.

Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
2025-03-07 19:48:18 +01:00
Margherita Milani
c7b65cb4e0 apds9253: Add measurement rate set attribute
Allow to set attribute of the measurement rate of the apds9253. This
must be done setting the sampling frequency (in Hz).

Signed-off-by: Margherita Milani <margherita.milani@amarulasolutions.com>
2025-03-07 19:47:51 +01:00
Michael Trimarchi
4e296ab7c9 apds9253: Add gain set attribute
Allow to set attribute of the gain of the apds9253. The gain
is applied to all the channels.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Margherita <margherita.milani@amarulasolutions.com>
2025-03-07 19:47:51 +01:00
Florian Weber
91af849cfb drivers: sensor: ak09918c use RTIO
make usage of the RTIO in the ak09918c driver

Signed-off-by: Florian Weber <Florian.Weber@live.de>
2025-03-07 19:43:22 +01:00
Fabian Barraez
746ea32edc drivers: sensor: bosch: bme680: fix: possible overflowed value return value
- Check if value exceeds limits of the variable

Signed-off-by: Fabian Barraez <fabianbarraez@gmail.com>
2025-03-05 09:58:35 +00:00
Jordan Yates
a0d22be980 sensor: adxl345: add missing Kconfig dependency
Add a missed dependency to all sub-symbols of `ADXL345`.

Signed-off-by: Jordan Yates <jordan@embeint.com>
2025-03-04 21:56:05 +01:00
Fabian Barraez
3295f7c5e2 drivers: sensor: si7060: fix: insecure data handling caught by coverity
- Checking each retval from read register before continue

Signed-off-by: Fabian Barraez <fabianbarraez@gmail.com>
2025-02-26 07:40:00 +01:00
Luis Ubieda
cc7a151f52 sensor: lsm6ds: Do not enable Streaming for buses with no RTIO support
Ensure the corresponding bus enables RTIO (I2C, I3C or SPI) before
instantiating rtio-dependent elements. Otherwise, enabling it for
another bus (e.g: SPI_RTIO when the LSM6DS is also on I3C with no
I3C_RTIO) will cause a build-time failure.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-21 18:02:32 +00:00
Zach Thomas
7e23a18980 drivers: sensor: scd4x: fix int overflow on val2 for temp and hum
The scd4x_channel_get function converts raw word values to
struct sensor_value's per the datasheet. The calculation for val2 of a
struct sensor_value `val->val2 = ((tmp_val % 0xFFFF) * 1000000) / 0xFFFF;`
can overflow the max of int32_t, resulting in an incorrect
sensor_value.
Fix it by changing the type of tmp_val to int64_t.

Signed-off-by: Zach Thomas <zach.thomas1.zt@gmail.com>
2025-02-21 04:39:42 +01:00
Luis Ubieda
6e897ccd69 sensor: adxl372: Fix build time issue due to shift variable namespace
Change `data->header.shift` to `data->shift`, as it is not contained
within the header struct.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-21 04:39:16 +01:00
Luis Ubieda
5847680e1e sensor: adxl367 and adxl372: fix build-failure with streaming mode
These two sensors do not build with asserts enabled as they're
referencing a non-existent variable `pkt_size`.

Replaced for what (AFAIK) is the intended variable.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-21 04:39:16 +01:00
Benjamin Cabé
4417fdb128 drivers: sensor: fix "Celsius" spelling
s/Celcius/Celsius/  -- preserved original case

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:51:13 +01:00
Nabil Elqatib
b2ec12edc8 drivers: sensor: bosch: bmg160: replace deprecated datasheet link
Use an internetarchive link instead

Signed-off-by: Nabil Elqatib <nabilelqatib@gmail.com>
2025-02-14 17:07:12 +01:00
Van Petrosyan
2a250b0d65 sensor: scd4x: Fix ID for power down command
Fixed command ID for power down command in SCD4X sensor driver

Signed-off-by: Van Petrosyan <van.petrosyan@sensirion.com>
2025-02-14 10:43:29 +01:00
Camille BAUD
ee37a94aa8 sensor: xbr818: struct sensor... to DEVICE_API
This makes static const struct sensor_driver_api into DEVICE_API(sensor

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-02-14 08:45:13 +01:00
Camille BAUD
637686695c sensor: Introduce Phosense XBR818 Driver
This Introduces a driver for the i2c interface of Phosense XBR818.
XBR818 is a 10.525Ghz Radar chip with builtin detection algorithm.

Signed-off-by: Camille BAUD <mail@massdriver.space>
2025-02-14 03:03:22 +01:00
Tom Hughes
337ca4e478 drivers: sensor: Remove unused function
Building with clang warns:

drivers/sensor/st/ism330dhcx/ism330dhcx.c:107:19: error: unused function
'ism330dhcx_reboot' [-Werror,-Wunused-function]
static inline int ism330dhcx_reboot(const struct device *dev)

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-13 03:27:43 +01:00
Tom Hughes
a887fe1607 drivers: sensor: Fix unused function warning
Building with clang warns:

drivers/sensor/st/lis2dw12/lis2dw12.c:194:23: error: unused
function 'sensor_ms2_to_mg' [-Werror,-Wunused-function]
static inline int32_t sensor_ms2_to_mg(const struct sensor_value *ms2)
                      ^

Move the function to include/zephyr/drivers/sensor.h with the other
sensor_ms2_to* functions.

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 07:52:36 +01:00
Tom Hughes
19ec804ed1 drivers: sensor: Remove unused function
Building with clang warns:

drivers/sensor/st/iis2iclx/iis2iclx.c:68:19: error: unused function
'iis2iclx_reboot' [-Werror,-Wunused-function]
static inline int iis2iclx_reboot(const struct device *dev)
                  ^

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:25:21 +01:00
Tom Hughes
31be869672 drivers: sensor: Fix unused function warning
Building with clang warns:

drivers/sensor/st/lsm9ds0_mfd/lsm9ds0_mfd.c:42:19: error: unused
function 'lsm9ds0_mfd_accel_set_odr_raw' [-Werror,-Wunused-function]
static inline int lsm9ds0_mfd_accel_set_odr_raw(const struct device *dev,
                  ^

lsm9ds0_mfd_accel_set_odr_raw is only used by code that was guarded by
defined(CONFIG_LSM9DS0_MFD_ACCEL_SAMPLING_RATE_RUNTIME) in addition to
!defined(LSM9DS0_MFD_ACCEL_DISABLED).

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:25:10 +01:00
Tom Hughes
d46fa0ba69 drivers: sensor: Remove unused function
Building with clang warns:

drivers/sensor/st/lsm6dso/lsm6dso.c:89:19: error: unused function
'lsm6dso_reboot' [-Werror,-Wunused-function]
static inline int lsm6dso_reboot(const struct device *dev)
                  ^

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:24:57 +01:00
Tom Hughes
ce1bc3353c drivers: sensor: Remove unused function
Building with clang warns:

drivers/sensor/st/lsm6dso16is/lsm6dso16is.c:83:19: error: unused
function 'lsm6dso16is_reboot' [-Werror,-Wunused-function]
static inline int lsm6dso16is_reboot(const struct device *dev)
                  ^

Signed-off-by: Tom Hughes <tomhughes@chromium.org>
2025-02-12 02:24:45 +01:00
Corey Wharton
9d262d0698 drivers: sensor: lsm6dsv16x: support setting and getting wake attributes
Adds support for the SENSOR_ATTR_SLOPE_TH and SENSOR_ATTR_SLOPE_DUR
attributes These set the sensitivity for the SENSOR_TRIG_DELTA trigger
which uses the sensor's wakeup feature.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-02-11 10:11:59 +01:00
Corey Wharton
557eb478ef drivers: sensor: lsm6dsv16x: support SENSOR_TRIG_DELTA trigger
The enables the SENSOR_TRIG_DELTA trigger using the wakeup interrupt
feature of the sensor.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-02-11 10:11:59 +01:00
Corey Wharton
3fef72a430 drivers: sensor: lsm6dsv16x: add device PM support
Adds a device PM handling which will ensure acc/gyro channels are off
when the device is suspended.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
2025-02-11 10:11:59 +01:00
Luis Ubieda
4e4ec9c1e2 sensor: icm42688: fix One-shot decoder to only return requested fields
Otherwise clients will get the impression there are frames for values
that have not been retrieved.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-11 07:44:12 +01:00
Luis Ubieda
f8506347cd sensor: icm42688: change single-axis data reported as sensor_q31_data
When individual axis is retrieved, it does not require the other values.
Simplify one-shot decoder to follow this pattern.

Signed-off-by: Luis Ubieda <luisf@croxel.com>
2025-02-11 07:44:12 +01:00
Armando Visconti
89b24bdc85 drivers/sensor: st: fix ASSERT in fetch API
Many drivers use a wrong __ASSERT in the fetch API, where they just
use SENSOR_CHAN_ALL, while it is more common fetching the specific
sensor channel (i.e. SENSOR_CHAN_PRESS, SENSOR_CHAN_ACCEL_XYZ, ...).

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2025-02-10 11:31:06 +01:00
Aurelie Fontaine
5213c2cba3 drivers: sensor: icm42670: add icm42370-P support
To support icm42370-p sensor, we renamed icm42670 to icm42x70
 as the driver is similar to ICM-42670-P/S in hal_tdk module.
Keep icm42670 source and header for dedicated code.

Signed-off-by: Aurelie Fontaine <aurelie.fontaine@tdk.com>
2025-02-08 00:31:43 +01:00
Remi Buisson
a4d863163b drivers: sensor: icp101xx: Add icp101xx support
Use official TDK Invensense driver for icp101xx sensor in tdk_hal module.

Signed-off-by: Remi Buisson <remi.buisson@tdk.com>
2025-02-07 07:38:06 +01:00