Change license owner to Prevas due to initially wrong owner due to company
mix-up during co-development.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
There were a lot of places where the return value was sum'ed up
which can be slightly easier to read, but can give an odd return
value in the end. This changes it to just return immediately if
an error is seen.
There was also runtime NULL checking of input arguments that are
rather programmer clown prevention. Change these to asserts.
The return value didn't have a consistant type through the file,
make it consistently an int.
This changes the name of the return value of fix_sign to be
signed_value differenating it from the ret name used elsewhere.
Use the sizeof(buffer) as the argument for reg reads and writes
rather than a hard number.
Some log messages ended with '\n'. Remove all these.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add configurations for setting the pad drive strength and the
interrupt active high/low and od/pp.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
There is a race condition where an interrupt can fire before the
drdy_handler is registered. The drdy_handler will tradionaly
callback the sample get clearing the interrupt... but if it's not
configured and NULL, the interrupt will stay forever latched. Read
the interrupt status to clear the interrupt flag allowing it to
trigger again.
Also, move the serial api function helpers in to the header
allowing them to be used from other c files.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Fix the oversampling value to be 1 from 0 for no oversampling to be
consistant with other sensor drivers.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Add the attr_get api. Also rename functions where they implied
accelerometer to imply magnetometer.
Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This driver supports the magnetometer in the ST lsm9ds1 sensor, on the
I2C bus.
This driver does not support the triggers.
This driver use the stmemsc HAL.
link: https://www.st.com/resource/en/datasheet/lsm9ds1.pdf
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
The bq27xx driver incorrectly uses the 'val' variable in a switch()
statement that should operate on 'chem_id'. This leads to incorrect
behavior for fuel gauges such as the BQ27427, where the chemical ID
determines how properties are interpreted.
This commit replaces 'switch(val)' with 'switch(chem_id)' to ensure
proper handling of fuel gauge behavior across supported devices.
Signed-off-by: Oleksii Shcherbyna <oleksii.shcherbyna@droid-technologies.com>
Fix the following build warnings highlighted in this driver while
building with clang targeting native_sim:
- exp() expects a double, so passing a float would cause type promotion
- variable declarations within C switch statements are a C23 specific
extension
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
Use a local signed variable to store negative return values instead of
unsigned previously so that errors are actually detected/returned.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
SENSOR_XBR818_CLOCKRATE / val->val1 is getting assigned
to uint8_t variable which is causing the logically
dead issue, this commit is a fix for it.
Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
cb_sqe could have been NULL before being passed into the callback function,
which expects cb_sqe to be non-NULL.
Add NULL check before the callback function with cb_sqe is called. The
reordering of the callback function after the sqe drop is okay as the
sqe drop is called when cb_sqe is NULL and the callback function isn't
expected to work when cb_sqe is NULL.
Signed-off-by: Alexander Apostolu <apostolu240@gmail.com>
Allow setting fifo-highres from DT, also unify the
naming of all registers and expand to a more complete list.
Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Add support for nPM1304 in the npm13xx drivers. The nPM1304 supports
different voltage and current ranges which are handled through the
initialization macros.
Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
Rename npm1300 to npm13xx in function names, documentation, etc. where
applicable for all the npm13xx drivers
Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
Rename npm1300 drivers and header files to npm13xx to allow for usage
with other nPM13xx product variants.
Signed-off-by: Sergei Ovchinnikov <sergei.ovchinnikov@nordicsemi.no>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>