summaryrefslogtreecommitdiff
path: root/drivers/iio/imu
AgeCommit message (Collapse)Author
2019-11-03iio: imu: adis16480: prefer `unsigned int` over `unsigned`Alexandru Ardelean
This is a typical checkpatch warning. The change just renames the type of the `freq` var to `unsigned int`. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-11-03iio: imu: adis16480: fix indentation of return statementAlexandru Ardelean
This is just a minor indentation/alignment fix for the default case of a switch statement. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-11-03iio: imu: adis: check ret val for non-zero vs less-than-zeroAlexandru Ardelean
The ADIS library functions return zero on success, and negative values for error. Positive values aren't returned, but we only care about the success value (which is zero). This change is mostly needed so that the compiler won't make any inferences about some about values being potentially un-initialized. This only triggers after making some functions inline, because the compiler can better follow return paths. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-11-03iio: imu: adis16480: check ret val for non-zero vs less-than-zeroAlexandru Ardelean
The ADIS library functions return zero on success, and negative values for error. Positive values aren't returned, but we only care about the success value (which is zero). This change is mostly needed so that the compiler won't make any inferences about some about values being potentially un-initialized. This only triggers after making some functions inline, because the compiler can better follow return paths. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-11-03iio: imu: adis16460: check ret val for non-zero vs less-than-zeroAlexandru Ardelean
The ADIS library functions return zero on success, and negative values for error. Positive values aren't returned, but we only care about the success value (which is zero). This change is mostly needed so that the compiler won't make any inferences about some about values being potentially un-initialized. This only triggers after making some functions inline, because the compiler can better follow return paths. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-11-03iio: imu: adis16400: check ret val for non-zero vs less-than-zeroAlexandru Ardelean
The ADIS library functions return zero on success, and negative values for error. Positive values aren't returned, but we only care about the success value (which is zero). This change is mostly needed so that the compiler won't make any inferences about some about values being potentially un-initialized. This only triggers after making some functions inline, because the compiler can better follow return paths. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-27iio: imu: st_lsm6dsx: add support to LSM6DSRXLorenzo Bianconi
Add support to STM LSM6DSRX 6-axis (acc + gyro) Mems sensor https://www.st.com/resource/en/datasheet/lsm6dsrx.pdf Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-22iio: imu: inv_mpu6050: fix no data on MPU6050Jean-Baptiste Maneyrol
Some chips have a fifo overflow bit issue where the bit is always set. The result is that every data is dropped. Change fifo overflow management by checking fifo count against a maximum value. Add fifo size in chip hardware set of values. Fixes: f5057e7b2dba ("iio: imu: inv_mpu6050: better fifo overflow handling") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-22iio: imu: Add support for the FXOS8700 IMURobert Jones
FXOS8700CQ is a small, low-power, 3-axis linear accelerometer and 3-axis magnetometer combined into a single package. The device features a selectable I2C or point-to-point SPI serial interface with 14-bit accelerometer and 16-bit magnetometer ADC resolution along with smart-embedded functions. FXOS8700CQ has dynamically selectable accelerationfull-scale ranges of ±2 g/±4 g/±8 g and a fixed magnetic measurement range of ±1200 μT. Output data rates (ODR) from 1.563 Hz to 800 Hz are selectable by the user for each sensor. Interleaved magnetic and acceleration data is available at ODR rates of up to 400 Hz. FXOS8700CQ is available in a plastic QFN package and it is guaranteed to operate over the extended temperature range of –40 °C to +85 °C. TODO: Trigger and IRQ configuration support Datasheet: http://cache.freescale.com/files/sensors/doc/data_sheet/FXOS8700CQ.pdf Signed-off-by: Robert Jones <rjones@gateworks.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: add support to LSM6DS0Lorenzo Bianconi
Add support to STM LSM6DS0 6-axis (acc + gyro) Mems sensor Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: fix gyro gain definitions for LSM9DS1Lorenzo Bianconi
Fix typos in gyro gain definitions for LSM9DS1 sensor Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: add odr calibration featureMario Tesi
On LSM6DSO/LSM6DSR/LSM6DSOX/ASM330LHH and ISH330DHCX devices it is possible to trim the hardware timestamp resolution through the FREQ_FINE[7:0] bits of the INTERNAL_FREQ_FINE register, which contains the difference in percentage of the effective ODR (and timestamp rate) with respect to the typical value. The formula for calculating the effective ODR reported in the application notes has been linearized to the first order to simplify the calculation (pls. see note on source code). This change may be useful in the outcome of CTS tests regarding the SingleSensorTests and the SensorTest#testSensorTimeStamps for high ODRs Signed-off-by: Mario Tesi <mario.tesi@st.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: enable drdy-mask if availableLorenzo Bianconi
Enable drdy mask if available in order to mark invalid samples during sensor bootstrap phase Tested-by: Mario Tesi <mario.tesi@st.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: enable wake-up event for LSM6DSOLorenzo Bianconi
Add missing wake-up register info for LSM6DSO/LSM6DSOX sensor Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: add missing kernel documenationLorenzo Bianconi
Add missing kernel doc for st_lsm6dsx_hw data structure Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: add wakeup_source in st_sensors_platform_dataLorenzo Bianconi
Add the possibility to enable/disable wakeup source through st_sensors_platform_data and not only through device tree Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: fix checkpatch warningLorenzo Bianconi
Fix following checkpatch warnings: CHECK: Alignment should match open parenthesis +static int st_lsm6dsx_read_event(struct iio_dev *iio_dev, + const struct iio_chan_spec *chan, CHECK: Alignment should match open parenthesis +static int st_lsm6dsx_write_event(struct iio_dev *iio_dev, + const struct iio_chan_spec *chan, CHECK: Alignment should match open parenthesis +static int st_lsm6dsx_read_event_config(struct iio_dev *iio_dev, + const struct iio_chan_spec *chan, CHECK: Alignment should match open parenthesis +static int st_lsm6dsx_write_event_config(struct iio_dev *iio_dev, + const struct iio_chan_spec *chan, WARNING: line over 80 characters + if (dev->of_node && of_property_read_bool(dev->of_node, "wakeup-source")) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: grab conf mutex in st_lsm6dsx_write_event_configLorenzo Bianconi
Always grub conf mutex in st_lsm6dsx_write_event_config since it can run concurrently with FIFO configuration Fixes: b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: rely on st_lsm6dsx_update_bits_locked configuring eventsLorenzo Bianconi
Rely on st_lsm6dsx_update_bits_locked in st_lsm6dsx_write_event and st_lsm6dsx_event_setup routines since they can run concurrently with sensor hub configuration Fixes: b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: always check enable_reg in st_lsm6dsx_event_setupLorenzo Bianconi
Check if enable_reg of event_settings data structure is defined before writing on it Fixes: b5969abfa8b8 ("iio: imu: st_lsm6dsx: add motion events") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: move bdu/boot and reset register info in hw_settingsLorenzo Bianconi
Move bdu, boot and reset register definitions in hw_settings register map since not all supported sensors (e.g lsm9ds1) rely on the same definitions Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: do not access active-low/open-drain regs if not supportedLorenzo Bianconi
Move active low and open drain register definitions in hw_settings register map since not all supported sensors (e.g lsm9ds1) rely on the same definitions Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: move irq related definitions in irq_configLorenzo Bianconi
Group irq related definition in irq_config structure in st_lsm6dsx_settings. This is a preliminary patch to move OpenDrain/Active low registers in st_lsm6dsx_settings. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: add sanity check for read_fifo pointerLorenzo Bianconi
Check read_fifo pointer before using it since we can't assume it is always set adding new sensors. This patch fixes the following crash: irq 277: nobody cared (try booting with the "irqpoll" option) CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.3.0-rc5-00322-g792b824-dirty #7 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [<c0112750>] (unwind_backtrace) from [<c010d018>] (show_stack+0x10/0x14) [<c010d018>] (show_stack) from [<c0c2bfc8>] (dump_stack+0xd8/0x10c) [<c0c2bfc8>] (dump_stack) from [<c01923fc>] (__report_bad_irq+0x24/0xc0) [<c01923fc>] (__report_bad_irq) from [<c0192820>] (note_interrupt+0x27c/0x2dc) [<c0192820>] (note_interrupt) from [<c018f174>] (handle_irq_event_percpu+0x54/0x7c) [<c018f174>] (handle_irq_event_percpu) from [<c018f1d4>] (handle_irq_event+0x38/0x5c) [<c018f1d4>] (handle_irq_event) from [<c0193664>] (handle_level_irq+0xc8/0x154) [<c0193664>] (handle_level_irq) from [<c018df58>] (generic_handle_irq+0x20/0x34) [<c018df58>] (generic_handle_irq) from [<c053c348>] (mxc_gpio_irq_handler+0xc4/0xf8) [<c053c348>] (mxc_gpio_irq_handler) from [<c053c3e0>] (mx3_gpio_irq_handler+0x64/0xb8) [<c053c3e0>] (mx3_gpio_irq_handler) from [<c018df58>] (generic_handle_irq+0x20/0x34) [<c018df58>] (generic_handle_irq) from [<c018e550>] (__handle_domain_irq+0x64/0xe0) [<c018e550>] (__handle_domain_irq) from [<c0529610>] (gic_handle_irq+0x4c/0xa0) [<c0529610>] (gic_handle_irq) from [<c0101a70>] (__irq_svc+0x70/0x98) Exception stack(0xc1301f10 to 0xc1301f58 1f00: 00000001 00000006 00000000 c130c340 1f20: c1300000 c1308928 00000001 c1308960 00000000 c12b9db0 c1308908 00000000 1f40: 00000000 c1301f60 c0182010 c0109508 20000013 ffffffff [<c0101a70>] (__irq_svc) from [<c0109508>] (arch_cpu_idle+0x20/0x3c) [<c0109508>] (arch_cpu_idle) from [<c015ed70>] (do_idle+0x1bc/0x2bc) [<c015ed70>] (do_idle) from [<c015f204>] (cpu_startup_entry+0x18/0x1c) [<c015f204>] (cpu_startup_entry) from [<c1200e68>] (start_kernel+0x440/0x504) [<c1200e68>] (start_kernel) from [<00000000>] (0x0) handlers: [<62052c0d>] st_lsm6dsx_handler_irq threaded [<f2004b92>] st_lsm6dsx_handler_thread Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Tested-by: Bobby Jones <rjones@gateworks.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15iio: imu: st_lsm6dsx: use st_lsm6dsx_read_locked in ↵Lorenzo Bianconi
st_lsm6dsx_report_motion_event Rely on st_lsm6dsx_read_locked in st_lsm6dsx_report_motion_event since it can run concurrently with sensor hub configuration. Move event related code in st_lsm6dsx_report_motion_event Fixes: 1aabad1fb5e9 ("iio: imu: st_lsm6dsx: add motion report function and call from interrupt") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-15spi: make `cs_change_delay` the first user of the `spi_delay` logicAlexandru Ardelean
Since the logic for `spi_delay` struct + `spi_delay_exec()` has been copied from the `cs_change_delay` logic, it's natural to make this delay, the first user. The `cs_change_delay` logic requires that the default remain 10 uS, in case it is unspecified/unconfigured. So, there is some special handling needed to do that. The ADIS library is one of the few users of the new `cs_change_delay` parameter for an spi_transfer. The introduction of the `spi_delay` struct, requires that the users of of `cs_change_delay` get an update. This change also updates the ADIS library. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Link: https://lore.kernel.org/r/20190926105147.7839-4-alexandru.ardelean@analog.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-14Merge 5.4-rc3 into staging-nextGreg Kroah-Hartman
We want the staging driver fixes in here as well to build on and test with. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-10-12iio: imu: adis16480: make sure provided frequency is positiveAlexandru Ardelean
It could happen that either `val` or `val2` [provided from userspace] is negative. In that case the computed frequency could get a weird value. Fix this by checking that neither of the 2 variables is negative, and check that the computed result is not-zero. Fixes: e4f959390178 ("iio: imu: adis16480 switch sampling frequency attr to core support") Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-09iio: imu: st_lsm6dsx: fix waitime for st_lsm6dsx i2c controllerLorenzo Bianconi
i2c controller available in st_lsm6dsx series performs i2c slave configuration using accel clock as trigger. st_lsm6dsx_shub_wait_complete routine is used to wait the controller has carried out the requested configuration. However if the accel sensor is not enabled we should not use its configured odr to estimate a proper timeout Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-09iio: imu: adis16400: fix memory leakNavid Emamdoost
In adis_update_scan_mode_burst, if adis->buffer allocation fails release the adis->xfer. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-09iio: imu: adis16400: release allocated memory on failureNavid Emamdoost
In adis_update_scan_mode, if allocation for adis->buffer fails, previously allocated adis->xfer needs to be released. Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: st_lsm6dsx: add motion report function and call from interruptSean Nyekjaer
Report iio motion events to iio subsystem and filter motion events. Wakeup will still be on all channels as it's not possible to do the filtering in hw. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: st_lsm6dsx: always enter interrupt threadSean Nyekjaer
The interrupt source can come from multiple sources, fifo and wake interrupts. Enter interrupt thread to check which interrupt that has fired. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: st_lsm6dsx: add wakeup-source optionSean Nyekjaer
This add ways for the SoC to wake from accelerometer wake events. In the suspend function we skip disabling the sensor if wakeup-source and events are activated. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: st_lsm6dsx: add motion eventsSean Nyekjaer
Add event channels that controls the creation of motion events. Tested on ISM330DLC Signed-off-by: Sean Nyekjaer <sean@geanix.com> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: st_lsm6dsx: move interrupt thread to coreSean Nyekjaer
This prepares the interrupt to be used for other stuff than fifo reading + event readings. Signed-off-by: Sean Nyekjaer <sean@geanix.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: add fifo support for magnetometer dataJean-Baptiste Maneyrol
Put read magnetometer data by mpu inside the fifo. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: add MPU925x magnetometer supportJean-Baptiste Maneyrol
Add support of driving MPU9250 magnetometer connected on i2c auxiliary bus using the MPU i2c master. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: helpers for using i2c master on auxiliary busJean-Baptiste Maneyrol
Add helper functions to use the i2c auxiliary bus with the MPU i2c master block. Support only register based chip, reading and 1 byte writing. These will be useful for initializing magnetometers inside MPU9x50 chips. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: fix objects syntax in MakefileJean-Baptiste Maneyrol
Use the correct syntax *-y for declaring object files. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: add defines for supporting 9-axis chipsJean-Baptiste Maneyrol
Add registers defines required for driving chip i2c master ip. Add MPU9xxx magnetometer scan elements and update data bytes size. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: add header include protection macroJean-Baptiste Maneyrol
Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-10-05iio: imu: inv_mpu6050: disable i2c mux for MPU925xJean-Baptiste Maneyrol
Disable i2c mux for supported 9xxx chips. This is a pre-requesite for controling 9xxx magnetometer using the i2c master of the chip. Check in device-tree that there is no i2c-gate device declared for ensuring backward compatibility with existing setups. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-15iio: imu: st_lsm6dsx: enable clear on read for latched interruptsLorenzo Bianconi
Enable clear on read feature for latched interrupts. This bit allows immediately clearing the latched interrupts of an event detection upon the read of the corresponding status register. It must be set to 1 together with LIR. This feature is available just on LSM6DS0/LSM6DSR/ASM330LHH Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-15iio: imu: st_lsm6dsx: enable LIR for sensor eventsLorenzo Bianconi
Enable Latched interrupt by default for sensor events Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-08iio: imu: st_lsm6dsx: forbid 0 sensor sensitivityLorenzo Bianconi
Do not allow configuring null sensor gain since it will force to 0 device outputs Fixes: c8d4066c7246 ("iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-03iio: imu: st_lsm6dsx: rely on IIO_G_TO_M_S_2 for gain definition for LSM9DS1Lorenzo Bianconi
Rely on IIO_G_TO_M_S_2 macro for LSM9DS1 accelerometer gain definitions Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-03iio: imu: st_lsm6dsx: remove invalid gain value for LSM9DS1Lorenzo Bianconi
Get rid of invalid sensitivity value for LSM9DS1 gyro sensor Fixes: 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-03iio: imu: st_lsm6dsx: Fix FIFO diff mask for tagged fifomario tesi
According to the latest version of datasheet the mask for number of unread sensor data in FIFO_STATUS registers has been extended to 10 bits The devices involved are: - LSM6DSO - LSM6DSOX - ASM330LHH - LSM6DSR - ISM330DHCX Signed-off-by: mario tesi <mario.tesi@st.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-03iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1Martin Kepplinger
The LSM9DS1's accelerometer / gyroscope unit and it's magnetometer (separately supported in iio/magnetometer/st_magn*) are located on a separate i2c addresses on the bus. For the datasheet, see https://www.st.com/resource/en/datasheet/lsm9ds1.pdf Treat it just like the LSM6* devices and, despite it's name, hook it up to the st_lsm6dsx driver, using it's basic functionality. accelerometer and gyroscope are not independently clocked. It runs at the gyro frequencies if both are enabled, see chapter 7.12 of the datasheet. We could have handled this as a single IIO device but we have split it up to be more consistent with the other more flexible devices. Despite supporting and testing the LSM9DS1, we call the gyro channels iio_chan_spec struct "st_lsm6ds0_gyro_channels" because the register description is equal. This suggests that supporting LSM6DS0 should be trivial to do. Signed-off-by: Martin Kepplinger <martin.kepplinger@puri.sm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>