- Remove SYS_ prefix
- shorten POWER_MANAGEMENT to just PM
- DEVICE_POWER_MANAGEMENT -> PM_DEVICE
and use PM_ as the prefix for all PM related Kconfigs
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move users that are DEVICE_DT_DECLARE(DT_DRV_INST(n, ...)) to
DEVICE_DT_INST_DECLARE(n, ...) and similar for DEVICE_DT_DEFINE.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
When testing the bmi160 I've come across an issue where the readings
didn't make sense to me. The issue comes from reading the
BMI160_SAMPLE_BURST_READ_ADDR which is 0x0C assuming both accelerometer
and gyroscope. At this point we would normally read 12 bytes
(2 bytes per sample * 3 axes * 2 sensors). This reading takes place in
bmi160_sample_fetch and begins writing to data->sample.raw
Without this change, the first byte written is actually to the dummy
byte which effectively gets tossed. The issue is that this is the
GYR_X<7:0>(LSB) according to the BMI160 data sheet. When we later call
either bmi160_gyr_channel_get or bmi160_acc_channel_get we're looking
at sample.gyr and sample.acc (which is effectively shiften by 1 byte).
This change gets rid of the dummy byte which re-alignes gyr with the
start of the raw buffer.
Signed-off-by: Yuval Peress <peress@chromium.org>
Use the devicetree node as the source of object name and other
information used when defining the device structure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Reworks the fxos8700 sensor driver to use DT_INST_FOREACH_STATUS_OKAY.
This allows it to support multiple instances, however only a single
instance was tested with the frdm_k64f board.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Fixes the fxos8700 sensor driver to reflect recent changes in the
generic device driver structure, renaming driver_data and config_info to
data and config respectively. These instances in the fxos8700 sensor
driver were missed because we haven't enabled the magnetic vector
magnitude function in CI.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Converts fxos8700 magnetic vector magnitude options from Kconfigs to
optional device tree properties.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Converts fxos8700 power mode options (normal, low noise low power, high
resolution, low power) from Kconfigs to an optional device tree
property.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
Converts fxos8700 range options (2g, 4g, 8g mode) from Kconfigs to an
optional device tree property.
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
This module needs to format floating point values in shell print
statements, which requires FP format support.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Introduced two per instance booleans, which get set using DT info:
1. is_lsm303agr_dev: if the device is a LSM303AGR_ACCEL, then
the scale values have to be changed.
2. Handle disconnect-sdo-sa0-pull-up if present in ntsnace DT.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Handle interrupts correctly for multi instance, checking per
device DT bindings instead of global Kconfig definitions.
The old interrupt behaviour has been maintained, fixing DRDY to
be on INT1 and Any Motion event on INT2.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Make this driver multi-instance and use the new API.
Notes for sensorhub mode:
In case of multiples devices it is possible that some of them
has i2c slaves attached to it (sensorhub mode) but not the
others. Since the driver is configured in the same way for
all the instances (CONFIG_SENSORHUB=y), the routine that initialize
the sensorhub part does not fail anymore in case no slaves
are found for a particular instance. Instead, those non-sensorhub
driver instances will set the shub_inited flag to false and
will totally ignore the feature.
Notes for triggers:
In case of multiples devices the device pin the interrupt wire is
attached to can be different (INT1 or INT2 pin). So, this
information has been moved in DTS and then stored in the
specific instance config structure.
Currently the driver is able to handle a sngle interrupt line
at a time attached to either INT1 or INT2.
MOreover, the interrupt initialization for a driver instance proceed
only if the drdy has been configured in its DT, else it returns ok.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Obtaining irq_pin from dev leads to disabling interrupts
on unpredictable pin, as dev points to GPIO, not LSM6DSL.
Fixes#29721
Signed-off-by: Yurii Gubin <y.gubin@gmail.com>
For drivers that support CONFIG_DEVICE_POWER_MANAGEMENT there are some
cases that look like:
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
DEVICE_DEFINE()
#else
DEVICE_AND_API_INIT()
#endif
There is no need to special case this as the pm_control_fn argument to
DEVICE_DEFINE will just be ignored in the
!CONFIG_DEVICE_POWER_MANAGEMENT case. So we can cleanup the code a
little and remove the #else cases for the drivers that do this.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
In case of h/w setup with multiples device instances it is possible
that some of them wants to use triggers but not the others (no
interrupt line.
Since Kconfig configuration is the same way for all the instances
(CONFIG_LSM6DSL_TRIGGER=y), the driver behaves differently according
to how the device instance has been configured in the DT.
If irq-gpios is present, then the driver initialize the interrupt
part, else it skip irq init and returns ok, but data->gpio != NULL
xis checked in trigger_set() API.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
At present this driver only supports SPI. Refactor it so that SPI is
just one of the options. This does not change any functionality.
Signed-off-by: Simon Glass <sjg@chromium.org>
This member holds the SPI bus pointer. Change its name to make that
more obvious and so that it can be used for an I2C bus also.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present there are three separate read functions and two write
functions. This makes it harder to provide an interface that can work
with either SPI or I2C.
Use bmi160_read() for all reads and create a new bmi160_write()
function for all writes.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present this driver only supports a single instance. It sets up some
of its config in the init routine. It is better to put config in
constant data so that multiple instances can be supported and RAM space
is minimised.
Update the driver accordingly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Currently a 'bmi160' pointer is used to point to the driver data. This
confusing, as the driver uses both data and config. Rename the variable
to 'data' like the bme280 driver.
Signed-off-by: Simon Glass <sjg@chromium.org>
This driver uses verbose names for the config and data structures, which
makes it harder to see which one we are talking about. Shorten it, like
the bme280 driver.
Signed-off-by: Simon Glass <sjg@chromium.org>
The TACH_XEC_DATA macro was not using its parameter
to retrieve the data structure.
It was working by chance so far.
Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
The IIS2ICLX is a high-accuracy. ultra-low noise, low-power
two-axis linear accelerometer which can be interfaced through
either I2C or SPI bus.
Its high accuracy, stability over temperature and repeatability
make IIS2ICLX particularly suitable for inclination measurement
for industrial applications (inclinometers).
https://www.st.com/resource/en/datasheet/iis2iclx.pdf
This driver is based on stmemsc i/f v1.03.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
Align all sensor drivers that are using stmemsc (STdC) HAL i/f
to new APIs of stmemsc v1.03.
Requires https://github.com/zephyrproject-rtos/hal_st/pull/5
(merged as b52fdbf4b62439be9fab9bb4bae9690a42d2fb14)
Signed-off-by: Armando Visconti <armando.visconti@st.com>
The interrupt enabling routine was called before the
chip enabling routine resulting in a runtime failure
when triggers are set.
Signed-off-by: Armando Visconti <armando.visconti@st.com>
This emulator supports enable functionality to start up the device and
read a few samples. It connects itself to any BMI160 device it finds in
the device tree. The SPI emulation controller driver is used to direct
SPI messages from the BMI160 driver to the BMI160 emulator.
Add a few more definitions to the header file, as needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
At present register access is a mix of constants and open-coded values
in the driver. Add a few more constants to clean this up.
Signed-off-by: Simon Glass <sjg@chromium.org>
The power draw of this magnetometer is significant,
device power management is needed for our use-cases.
Signed-off-by: Emil Hammarstrom <emil.hammarstrom@assaabloy.com>
Change-Id: I71158e629e93b491c6d673aa81001b7a7099f654
The ce0cc3a7 commit (lsm6dsl: make the driver multi-instance) changes
all bus API signature, which now requires a "const struct device *dev"
and not a "struct lsm6dsl_data *data". By mistake the shub part was
left unchanged. Fix: #28565
Signed-off-by: Armando Visconti <armando.visconti@st.com>
HAS_DTS_I2C is now selected by I2C and
always used as I2C && HAS_DTS_I2C.
It could then be purely removed.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
It is necessary to wrap the device pointer into data.
Which was done already on most of them when global trigger is enabled.
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
-Wimplicit-fallthrough=2 requires a fallthrough comment or a compiler
to tells gcc that this happens intentionally.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The magnetometer vector-magnitude function will generate an interrupt
when magnitude is greater than specified threshold value. The user
may program the threshold value to establish the conditions needed
to detect a magnetic vector-magnitude change event. Depending on the
values chosen for the reference values, this function may be
configured to detect a magnetic field magnitude that is above
a preset threshold (with reference values = 0), or a change in magnitude
between two magnetic vectors greater than the preset threshold
(with reference values non-zero).
Default configuration of M_VECM_CFG register (address 0x69) is 0x4e.
Signed-off-by: Matija Tudan <mtudan@mobilisis.hr>