To avoid assuming that ZVFS_O_RDONLY matches O_RDONLY, compile the
Linux file access code directly with the host libc.
This also removes the need for the nsi_host file operation wrappers and
makes the host-side code easier to read.
Signed-off-by: Bayrem Gharsellaoui <bayrem.gharsellaoui@gmail.com>
Add a native_sim driver to read a Linux host temperature using the
Zephyr sensor API.
Signed-off-by: Bayrem Gharsellaoui <bayrem.gharsellaoui@gmail.com>
Stream Sensor HUB data in FIFO and decode them properly.
Currently two channels are handled:
- SENSOR_CHAN_MAGN_XYZ
- SENSOR_CHAN_PRESS
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Set the read number of operation to 0 at the end of
lsm6dsv16x_shub_read_target_reg(), just to avoid issues
when reading data from FIFO.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Add a sensor decoder for the MAX30009 streaming path, decoding the I and
Q BioZ channels from the FIFO sample sets pushed by the RTIO submit
path.
The decoder is compiled in with the streaming path via
CONFIG_MAX30009_STREAM.
Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
Add RTIO streaming of the I and Q BioZ channels. The submit path reads
the FIFO on a watermark/data-ready interrupt and pushes sample sets into
the RTIO buffer; one-shot (non-streaming) reads are rejected.
Streaming is compiled in via CONFIG_MAX30009_STREAM.
Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
Add own-thread and global-thread trigger support for the MAX30009.
Handlers are provided for the FIFO watermark, data-ready and DC
lead-off / range status events, dispatched from the interrupt GPIO.
The trigger source is compiled in via CONFIG_MAX30009_TRIGGER.
Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
Add a driver for the Analog Devices MAX30009 bioimpedance analog
front-end. The device is supported over both SPI and I2C.
This base commit provides the core acquisition-path driver:
- Full BioZ acquisition-path configuration from devicetree (clock/PLL,
drive, receive channel, digital filters, thresholds, mux, DC leads and
lead bias), with a dt-bindings header of MAX30009_DT_* constants for
the enumerated properties.
- Runtime attribute access (attr_set / attr_get) for the meaningful BioZ
parameters via a descriptor table, cycling the PLL where the datasheet
requires the acquisition path to be quiesced.
- Power management (suspend / resume) following the datasheet's
bandgap / PLL / channel enable sequence.
Trigger and RTIO streaming support are added in follow-up commits; the
full Kconfig describing those options is included here so the driver's
configuration surface is complete.
Signed-off-by: Francis Roi Manabat <francisroi.manabat@analog.com>
The echo-timeout defines the maximum range of the ultrasonic sensor and
was hardcoded to 10ms (~1.5m).
This commit creates a dts property for the timeout,
so users can configure the maximum range per sensor instance.
The default setting of the property is 10ms for compatibility.
Signed-off-by: Nils Harder <harder@metratec.com>
Header file include/zephyr/sys_clock.h is deprecated and will be removed
someday. Update the whole file tree to include zephyr/sys/clock.h
straight instead of zephyr/sys_clock.h.
This change was made running the sed shell command below:
$ sed -i 's/zephyr\/sys_clock\.h/zephyr\/sys\/clock\.h/' \
`grep -rsl "zephyr/sys_clock\.h" drivers/`
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
There is no 'config UART' base definition in the tree; the only
definition was an accidental bare declaration in the
cy8cproto_062_4343w board Kconfig.defconfig, so every
'select UART' resolved against a phantom bool that gates nothing.
- bluetooth: hci: BT_AIROC: drop the select. BT_H4 already selects
BT_UART, which selects SERIAL and UART_INTERRUPT_DRIVEN, so the
H4 transport is fully covered.
- sensor: explorir_m, fcx_mldx5, s3km1110: drop the select. These
drivers already have 'depends on UART_INTERRUPT_DRIVEN', which
requires SERIAL; replacing the select with 'select SERIAL' would
create a Kconfig dependency loop through UART_INTERRUPT_DRIVEN.
- input: ch9350l: drop the select for the same reason (it depends
on SERIAL_SUPPORT_INTERRUPT and selects UART_INTERRUPT_DRIVEN).
- stepper: adi_tmc: STEPPER_ADI_TMC_UART: replace with
'select SERIAL', matching the sibling STEPPER_ADI_TMCM_RS485
symbol, so enabling the UART bus variant actually enables the
serial drivers.
Found by a full-tree Kconfig audit cross-referencing every defined
symbol against its uses.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
The charge calibration extracted its two LSBs with the discharge mask
(bits 1:0) instead of the charge mask (bits 3:2), skewing charging
current readings.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
(tmp & A) != 0 || (tmp & B) != 0 is equivalent to (tmp & (A | B)) != 0.
Collapse the temperature and humidity threshold status tests into single
masked checks.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
The default "bosch,bmi270" compatible selects the max_fifo feature set,
whose anymo_1/anymo_2 registers are NULL. Enabling SENSOR_TRIG_MOTION then
made bmi270_anymo_config() pass those NULL pointers to
bmi270_feature_reg_write(); on Cortex-M address 0 is readable, so the write
silently targeted an unintended feature page and returned success, leaving
the trigger a no-op.
Return -ENOTSUP when the configured feature set does not provide the
any-motion registers, so the condition is reported instead of failing
silently.
Fixes#112938
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
The channel guard combined its checks with &&, accepting any channel
type with index 0. Use ||, matching sb_tsi_emul_get_sample_range().
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The 2586 Ohm point was listed at 64 degC in a table that steps by
exactly 10 degC, skewing interpolation between 55 and 75 degC. Use
65 degC.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Operator precedence applied the scale factor to the high byte before
OR-ing in the low byte, and the 16-bit sign was lost. Assemble and
sign-extend the raw value first, as the magnetometer path does.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
set_iir_config() overwrote the whole DSP_IIR register with the raw
temperature coefficient instead of programming it through the
BMP5_SET_IIR_TEMP bitfield, corrupting the pressure IIR setting.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The heartbeat error case fell through into default and returned
-ENOTSUP, so fetching the channel always failed. Add the missing
break.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
sizeof(temp_buffer) on a pointer parameter truncated the UART receive
to the pointer size. Pass MTCH9010_INTERNAL_BUFFER_SIZE.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The accel and magn full-scale setters used an undeclared data pointer
when the respective FULL_SCALE_RUNTIME options are enabled. Declare
it from dev->data.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
lsm9ds0_gyro_set_fs_raw() used an undeclared data pointer when
CONFIG_LSM9DS0_GYRO_FULLSCALE_RUNTIME is enabled. Declare it from
dev->data.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
lsm9ds0_mfd_magn_set_odr() iterated the accelerometer ODR map instead
of the dedicated magnetometer map, producing out-of-range M_ODR codes
for frequencies above 100 Hz.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The sample rate was shifted with the bandwidth field shift, so the
value never intersected the DR mask and the requested ODR was always
programmed as zero. Use the DR field shift.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Add a driver for the Hamamatsu S9706 digital RGB sensor using plain
GPIOs. All parameters (e.g. integration time and sensor range) are
runtime-configurable via sensor attributes.
Signed-off-by: Anton Puppe <anton-noel-flynn.puppe@zeiss.com>
Setting the gender attribute wrote sub-index 0x08, which belongs to
age (height 0x06, weight 0x07, age 0x08), overwriting the age
setting. Use sub-index 0x09.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The full-scale attribute passed MAX31875_DATA_FORMAT_SHIFT (a bit
position) as the register mask, clearing the conversion-rate bits and
never setting the data format. Use BIT(MAX31875_DATA_FORMAT_SHIFT).
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
buffer_size was set to the size of the whole data struct instead of
the uint16_t buffer member. Use sizeof of the member.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The SPI read command buffer was 2 bytes but described with a length
of 3, reading past the stack array and clocking out an indeterminate
byte. Size the buffer to match.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The trigger setup wrote the FF_MT_THS register address (0x17) as the
threshold instead of the maximum. Write FXOS8700_FF_MT_THS_MASK as
the comment describes.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
adxl345_submit_fetch() requests sizeof(struct adxl345_dev_data) bytes
from the RTIO buffer pool, but only writes sizeof(struct adxl345_sample)
into it. The decoder also casts the buffer to struct adxl345_sample *.
This over-allocation wastes memory and prevents callers from using
reasonably-sized read buffers (e.g. 128 bytes) since adxl345_dev_data
can exceed 200 bytes when triggers or streaming are enabled.
Assisted-by: Claude:claude-opus-4-6
Signed-off-by: Maureen Helm <maureen.helm@analog.com>
icm40627_init() logged a failed bus check through an undeclared
'config' pointer and a nonexistent bus.bus member, breaking the build
when the driver is compiled. Point LOG_ERR_DEVICE_NOT_READY at the
underlying I2C bus device.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The SENSOR_CHAN_DIE_TEMP case sat inside the CONFIG_MPU9250_MAGN_EN
guard, so temperature reads returned -ENOTSUP with the magnetometer
disabled even though the register is always fetched.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The angle conversion divided by 65635 instead of the 16-bit full
scale 65535, and raw_val * 36000 overflows signed 32-bit for large
readings. Use 65535 and widen to uint32_t.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
CFG2 was written with the CFG1 bit pattern so the AGAINMAX/AGAINL
bits were never programmed, and the 128x case loaded the CFG2
register value (20) into the lux gain instead of TSL2540_AGAIN_S128
(140).
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The 2000G A3-A5 OTP addresses jumped from 0x29 to 0x30-0x32 instead
of continuing at 0x2A-0x2C, pointing at the wrong registers.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The reconfigure path detected an auto_sr change but programmed the
old value, so the attribute never took effect. Pass the new value.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
The dual-frequency assertion placed '== 0' inside the DT_INST_PROP
property-name argument. Move the comparison outside the macro call,
matching the assertion below it.
Assisted-by: Claude:fable-5
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
So it is only built when needed, and we avoid a compiler warning:
bmp581.c:59:19: error: unused function 'bmp581_pm_busy_check'
The issue was there since c68a25e4d5
but only became apparent in CI when its test was added in
f0802b645b
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Add a bus emulator for the BMP581 so the driver can be exercised on
native_sim without hardware. It models the register file, the soft-reset
power-on-complete handshake, the chip-id and NVM-ready status, and the
temperature/pressure data registers, and implements the emul_sensor
backend (set_channel / get_sample_range) for the pressure and ambient
temperature channels.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add driver for the ADIS16477 6-axis IMU sensor family.
Supports polling, trigger (DRDY interrupt), RTIO async, and
streaming modes. Includes SPI bus access, burst read, decoder,
temperature and inertial data channels, decimation rate
configuration via devicetree, hardware reset, and diagnostic
status checking.
Signed-off-by: Iustin Stolniceanu <iustin.stolniceanu@analog.com>
The syscall handler functions forward parameters with identical casts
that are redundant since the variables already have those types. Drop
the casts to let the compiler type-check the arguments unobstructed.
Signed-off-by: Flavio Ceolin <flavio@hubble.com>
The BMI270 exposes an on-chip temperature sensor in registers
TEMPERATURE_0/1 (0x22/0x23). Add support for SENSOR_CHAN_DIE_TEMP so
applications can read it through the standard sensor API.
bmi270_init() now sets PWR_CTRL.temp_en, bmi270_sample_fetch() reads
the 16-bit value, and bmi270_channel_get() converts it using the
datasheet formula T = raw / 512 + 23 degrees C, returned in micro-
degrees through val1/val2.
Signed-off-by: Vignesh Pandian <vignesh@aerlync.com>
Adjust base_timestamp_ns backward from the trigger timestamp by
(N-1)*period so it reflects the time of the first FIFO sample,
matching the lsm6dsv16x reference implementation.
Fixes: #98720
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
(cherry picked from commit f73d9b122431cd7bcfeb24b67c170241a1a61d98)
Pre-count FIFO frames for the requested channel and adjust
base_timestamp_ns backward from trigger time by (N-1)*period so it
reflects the time of the first sample, matching the lsm6dsv16x
reference implementation.
Fixes: #98720
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
(cherry picked from commit 750d08206d5ec13a7c171ede9cea00dcc8aab9f6)
adxl362 hardcoded reading_count = 1 despite its decode loop being
capable of filling multiple readings[] entries up to max_count.
The memset and header initialization were also inside the loop body,
which zeroed previously decoded readings on each iteration. Split the
decode into separate SENSOR_CHAN_DIE_TEMP and accel loops, moving the
memset and header setup (base_timestamp_ns, shift) before each loop and
setting reading_count to the actual decoded sample count afterwards.
While here, fix two coupled bugs exposed once multiple readings are
reported:
- the temperature path memset used sizeof(struct sensor_three_axis_data)
on a struct sensor_q31_data buffer, zeroing past the end of the
smaller struct; use sizeof(struct sensor_q31_data) instead.
- sample_num was never incremented in the loop, so every reading was
given an identical timestamp_delta; increment it per decoded sample.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
adxl372 hardcoded reading_count = 1 despite its decode loop being
capable of filling multiple readings[] entries up to max_count.
Set reading_count to the actual decoded sample count after the loop
completes.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
adxl355 hardcoded reading_count = 1 despite its decode loop being
capable of filling multiple readings[] entries up to max_count.
Set reading_count to the actual decoded sample count after the loop
completes.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
adxl345 hardcoded reading_count = 1 despite its decode loop being
capable of filling multiple readings[] entries up to max_count.
Set reading_count to the actual decoded sample count after the loop
completes.
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>