Instead of performing series check, use the new common Kconfig option
CONFIG_HAS_STM32_UNCACHED_ACCESS_ONLY_OTP in drivers which access the
internal NVM's OTP/read-only area.
While at it, use the public `sys_cache_xxx()` API in flash_stm32 instead
of the internal `cache_xxx()` API.
Signed-off-by: Mathieu Choplain <mathieu.choplain-ext@st.com>
config->adc is of type 'const struct device *', assigned via
DEVICE_DT_GET(). It has no '.dev' member — that field exists only
in 'struct adc_dt_spec'.
The LOG_ERR_DEVICE_NOT_READY() call in lpadc_temp40_init() was
using config->adc.dev, causing a compile error on all platforms
that select NXP_PMC_TMPSNS:
error: 'config->adc' is a pointer; did you mean to use '->'?
Remove the spurious '.dev' dereference. LOG_ERR_DEVICE_NOT_READY()
accepts 'const struct device *' directly, so passing config->adc
is correct and consistent with the device_is_ready() call on the
line above.
Signed-off-by: Bartlomiej Fijal <StaryAnoda@Gmail.com>
config->adc is of type 'const struct device *', assigned via
DEVICE_DT_GET(). It has no '.dev' member — that field exists only
in 'struct adc_dt_spec'.
The LOG_ERR_DEVICE_NOT_READY() call in lpadc_temp40_init() was
using config->adc.dev, causing a compile error on all platforms
that select NXP_LPADC_TEMP40:
error: 'config->adc' is a pointer; did you mean to use '->'?
Remove the spurious '.dev' dereference. LOG_ERR_DEVICE_NOT_READY()
accepts 'const struct device *' directly, so passing config->adc
is correct and consistent with the device_is_ready() call on the
line above.
Signed-off-by: Bartlomiej Fijal <StaryAnoda@Gmail.com>
Add a die temperature sensor driver for Bouffalo Lab SoCs using
the internal TSEN peripheral integrated into the GPADC.
The driver uses the ADC subsystem for hardware initialization and
raw sample acquisition via adc_bflb_tsen_read_phase(). Temperature
is computed from two ADC measurement phases (TSVBE_LOW toggle)
using the formula: temp = (|v0 - v1| - tsen_offset) / 7.753
The TSEN calibration offset is read from efuse when available,
falling back to the default value of 2042.
Includes:
- Sensor driver at drivers/sensor/bflb/bflb_tsen/
- DT binding for compatible "bflb,tsen"
- TSEN nodes (disabled) in bl60x, bl61x, bl70x, bl70xl dtsi files
Tested on BL602, BL616, BL706, and BL704L hardware.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Add QDEC driver support for Realtek Bee series SoCs,
including RTL87x2G (AON QDEC) and RTL8752H (Basic QDEC).
This driver supports:
- X, Y, and Z axis count reading
- Hardware interrupt-based event trigger
Signed-off-by: Yuzhuo Liu <yuzhuo_liu@realsil.com.cn>
Fix multiple minor issues which trigger build warnings with clang,
including:
* label followed by a declaration is a C23 extension
* duplicate 'const' declaration specifier (DEVICE_API already has const)
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add a comprehensive driver for the Microchip PAC194x/195x family of
multi-channel power monitors. This driver supports VBUS, VSENSE,
and power accumulation measurements.
Key features and implementation details:
- Support for PAC1941/42/43/44 (9V FSR) and PAC1951/52/53/54 (32V FSR).
- Efficient I2C handling: uses per-channel burst reads to optimize
bus bandwidth based on enabled channels.
- Flexible Refresh Modes: introduced SENSOR_ATTR_REFRESH_MODE to
allow users to choose between AUTO_WAIT (synchronous),
AUTO_NOWAIT (asynchronous/latched), and MANUAL modes.
- Broadcast Support: added a force refresh command using I2C
General Call (0x00) to synchronize snapshots across multiple
sensors (up to 16 instances) simultaneously.
- Configurable range: support for Unipolar, Bipolar, and Bipolar
Half FSR modes via Devicetree.
Tested on RISC-V (ESP32-C3) with 16 PAC1944 instances.
Signed-off-by: Wojciech Macek <wmacek@google.com>
Unify all "device not ready" error messages across sensor drivers with
the LOG_ERR_DEVICE_NOT_READY macro, following the pattern established
for input drivers in commit 31b5866.
This improves consistency and makes device readiness errors easier to
grep across the codebase. Using the standardized macro ensures device
names are properly formatted with null-safety checks.
Image size impact (tests/drivers/build_all/sensor on native_sim,
building 211 sensor drivers):
- Before: 1,033 KB (text: 961 KB)
- After: 1,036 KB (text: 964 KB)
- Change: +2.5 KB (+0.25%), text: +2.5 KB
The small size increase is due to the macros adding null-safety checks
and dynamic device name formatting, which generates slightly more code
than some of the simpler static log strings used by drivers previously.
Assisted-by: Claude:claude-sonnet-4.5
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Several sensor drivers were logging device readiness failures as LOG_DBG
rather than LOG_ERR, making initialization failures harder to diagnose.
These readiness checks occur during device initialization and return error
codes, so they should be logged as errors rather than debug messages.
This change affects drivers that check for bus or GPIO device readiness
and ensures consistent error reporting across the sensor subsystem.
Assisted-by: Claude:claude-sonnet-4.5
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.13.2
Requires https://github.com/zephyrproject-rtos/hal_st/pull/35
Signed-off-by: Armando Visconti <armando.visconti@st.com>
In adxl362_set_interrupt_mode(), the LINKLOOP field is first cleared
from the register value, but then the original uncleared register
value is OR'd back in on the next line, restoring the old LINKLOOP
bits. This makes it impossible to change the interrupt mode from its
current value.
Remove the erroneous OR of old_act_inact_reg so the cleared field is
properly set to the new mode value.
Fixes: 11295c190b ("drivers: sensor: Add ADXL362 interrupt handling")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
The get_resolution function returns 13 when the resolution bit is set
and 16 when it is clear. Per the ADT7420 datasheet, bit 7 of the
config register set to 1 means 16-bit resolution and 0 means 13-bit.
This is also confirmed by the driver's own set_resolution and init
code which sets the bit when 16-bit mode is desired.
Swap the return values so that 16 is returned when the resolution bit
is set and 13 when it is clear.
Fixes: d07b8a20f6 ("sensor: adt7420: Extend ADT7420 Driver Support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
This reverts commit 1643904ac4.
This change introduced a regression: A build warning when building
with clang, which is visible in the clang workflow in main
causing it to fail. The issue is in the HAL itself and the fix
is not evident.
Let's revert this commit until the issue is fixed in the HAL.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Soft reset is largely equivalent to power cycle. Add dummy read of chip ID
after soft reset in BMI270 initialization function. Dummy read is
performed via bus initialization.
Signed-off-by: Szymon Antkowiak <szymon.antkowiak@nordicsemi.no>
When a request is performed on a single accelerometer axis
(e.g. SENSOR_CHAN_ACCEL_X) the driver must return a single
scalar q31 data.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
In a IMU there might be multiple concurrent asynchronous requests
active at the same time. Increase the size of the RTIO queues.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Expose mode 3 (ODR-triggered) in gyro_set_mode and gyro_get_mode for
lsm6dsv320x, lsm6dsv80x, and ism6hg256x so gyro mode matches accel mode
as required by datasheet section 6.1.5.
Fixes#106389
Signed-off-by: Nancy Sangani <9d.24.nancy.sangani@gmail.com>
To access the OTP area on STM32C5, the instruction cache needs to be
disabled to prevent a bus fault.
Do it for the OTP driver, as well as the temperature and Vref sensor.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v2.13.1
Requires https://github.com/zephyrproject-rtos/hal_st/pull/33
Signed-off-by: Armando Visconti <armando.visconti@st.com>
When setting SFLP game gbias the accel/gyro data rate must be temporarily
changed and then restored back to original values. But in the process the
saved rates got mistakenly corrupted.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
If gpio level gets immediately at high level after sensor is started,
then call interrupt stream handler in order to avoid losing it. As a
side effect no data would be ever read.
Co-authored-by:Brenden Adamczak <cerebralasylum1@gmail.com>
Signed-off-by: Brenden Adamczak <cerebralasylum1@gmail.com>
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The HTU21D is register-compatible with the SHT21 and uses the same
measurement commands. Add it as another DT_DRV_COMPAT entry in the
existing Si7006 driver rather than a standalone driver.
Signed-off-by: William Markezana <william.markezana@gmail.com>
Some of the sensore channels (e.g. SENSOR_CHAN_GRAVITY_VECTOR and/or
SENSOR_CHAN_GBIAS_XYZ) are returning three axis values. The current
code was passing a single value and was actually crashing.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Add SENSOR_ATTR_CHIP_ID entry (last one) in sensor_attribute_name
declaration/initialization. This is fixing a sensor_shell crash.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The need to monitor battery voltage on nordic devices and nRF7120
in particular is required among other metrics such as die temperature.
Creating a sensor to measure battery voltage allows to easily monitoring
of all required metrics in a consistent way.
This commit adds a new sensor driver to monitor battery.
Signed-off-by: Robert Robinson <robert.robinson@nordicsemi.no>
Utilize a code spell-checking tool to scan for and correct spelling errors
in all files within:
- `drivers/rtc`
- `drivers/sdhc`
- `drivers/sensor`
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
If a prescaler is set in the DTS, it should be used also by the qdec
driver, as it is by the counter and the pwm drivers.
Signed-off-by: Ole Morten Haaland <omh@ixys.no>
This patch adds a new driver for the ADXL355 three-axis digital
accelerometer, implementing configuration, sampling,
and full-scale range controls according to the
ADXL355 datasheet (Analog Devices).
Features:
- I2C and SPI register access
- Sampling frequency (ODR) configuration
- Full-scale range selection (±2g/±4g/±8g)
- Standby/measure power modes
- Optional FIFO streaming support via RTIO
- Basic trigger and interrupt handling
Power management is supported via PM_DEVICE callbacks
to place the sensor in standby mode when suspended
and resume continuous measurement on resume.
References:
- ADXL354/ADXL355 Datasheet (Analog Devices)
https://www.analog.com/media/en/technical-documentation/data-sheets/adxl354_adxl355.pdf
Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
The lower ALS interrupt threshold (SENSOR_ATTR_LOWER_THRESH) was being
converted twice with sys_cpu_to_le16(), effectively canceling the
conversion on big-endian systems. The upper threshold
(SENSOR_ATTR_UPPER_THRESH) correctly uses a single conversion.
This causes the lower threshold register to be written in incorrect
byte order on big-endian architectures.
Signed-off-by: Andre Viegas <andreviegas@piscodeluz.org>
Assisted-by: Claude:claude-opus-4.6 forgeql
Add injected mode support for STM32 Vref sensor.
When in injected mode, this configures the sensor channel and sensor enable
bit at start to prevent any conflict later: some registers can't be written
while a conversion is on-going.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Add injected mode support for STM32 Vbat sensor.
When in injected mode, this configures the sensor channel and sensor enable
bit at start to prevent any conflict later: some registers can't be written
while a conversion is on-going.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Add injected mode support for STM32 temperature sensor.
When in injected mode, this configures the sensor channel and sensor enable
bit at start to prevent any conflict later: some registers can't be written
while a conversion is on-going.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
All trigger related variables will be defined only if pinctrl has name
`trigger`. This can save some RAM when having multiple hx711 configured
but only using trigger for some of them.
Signed-off-by: Terry Geng <terry@terriex.com>
HX711 pulls DOUT low when data is ready. This commit enabled pin config
to switch from SPI to GPIO and set up GPIIO interrupts for the falling
edge.
The implementation is similar to the `infineon,airoc-wifi` driver, by
using pinctrl.
Signed-off-by: Terry Geng <terry@terriex.com>
HX711 is a specialized 24-bit ADC for load cell and strain gauge sensors.
It uses a two-wire (PD_SCK and DOUT) serial protocol that
- first 24 clock cycles reads out the sample
- last 1 to 3 clock cycles set the PGA gain for the next sample
The requirement of control the exact number of clock cycles makes the
SCK for SPI unsuitable for clocking HX711. Instead, in this commit, the
clock is implemented as a series of 0xAA on the MOSI.
Signed-off-by: Terry Geng <terry@terriex.com>
Add Power Management Subsystem to ADT7420 driver for
suspending and resuming device operations.
Signed-off-by: Jan Carlo Roleda <jancarlo.roleda@analog.com>
Extended ADT7420 driver to support:
- extend dtbindings for comprehensive configuration control
- Support 13-bit and 16-bit ADC resolution
- extend Sensor API support
- extend interrupt support to include CT pin
Signed-off-by: Jan Carlo Roleda <jancarlo.roleda@analog.com>
Fix I2C transaction len using the correct size of the data to be sent
and not the returned length of the allocated buffer. This change is
applied to iis3dwb, lis2dux12 and lsm6dsv16x drivers, and mimic what
is also done for lsm6dsvxxx driver.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Nordic's nPM10 Series PMIC Sensor Devicetree bindings and minimal driver
supporting only battery current, voltage and temperature measurements.
Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>