aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/iio/imu (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-3/+3
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-07-22iio: imu: st_lsm6dsx: reset hw ts after resumeLorenzo Bianconi3-11/+17
Reset hw time samples generator after system resume in order to avoid disalignment between system and device time reference since FIFO batching and time samples generator are disabled during suspend. Fixes: 213451076bd3 ("iio: imu: st_lsm6dsx: add hw timestamp support") Tested-by: Sean Nyekjaer <sean@geanix.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: st_lsm6dsx: st_lsm6dsx: Mark 'st_lsm6dsx_accel_ext_info' as __maybe_unusedLee Jones1-1/+2
It doesn't make sense to move it into '*core*' as it's co-located with other, similar definitions which are used in multiple locations. Fixes the following W=1 kernel build warning(s): In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c:17: drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=] 497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c:17: drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=] 497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c:16: drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=] 497 | static const struct iio_chan_spec_ext_info st_lsm6dsx_accel_ext_info[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~~ Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: st_lsm6dsx: st_lsm6dsx_shub: Demote obvious misuse of kerneldoc to standard comment blocksLee Jones1-4/+4
No attempt has been made to document any of the demoted functions here. Fixes the following W=1 kernel build warning(s): drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:174: warning: Function parameter or member 'hw' not described in 'st_lsm6dsx_shub_read_output' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:174: warning: Function parameter or member 'data' not described in 'st_lsm6dsx_shub_read_output' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:174: warning: Function parameter or member 'len' not described in 'st_lsm6dsx_shub_read_output' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:205: warning: Function parameter or member 'hw' not described in 'st_lsm6dsx_shub_write_reg' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:205: warning: Function parameter or member 'addr' not described in 'st_lsm6dsx_shub_write_reg' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:205: warning: Function parameter or member 'data' not described in 'st_lsm6dsx_shub_write_reg' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:205: warning: Function parameter or member 'len' not described in 'st_lsm6dsx_shub_write_reg' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:285: warning: Function parameter or member 'sensor' not described in 'st_lsm6dsx_shub_read' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:285: warning: Function parameter or member 'addr' not described in 'st_lsm6dsx_shub_read' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:285: warning: Function parameter or member 'data' not described in 'st_lsm6dsx_shub_read' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:285: warning: Function parameter or member 'len' not described in 'st_lsm6dsx_shub_read' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:335: warning: Function parameter or member 'sensor' not described in 'st_lsm6dsx_shub_write' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:335: warning: Function parameter or member 'addr' not described in 'st_lsm6dsx_shub_write' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:335: warning: Function parameter or member 'data' not described in 'st_lsm6dsx_shub_write' drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_shub.c:335: warning: Function parameter or member 'len' not described in 'st_lsm6dsx_shub_write' Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: inv_mpu6050: inv_mpu_ring: Demote seemingly unintentional kerneldoc headerLee Jones1-1/+1
This is the only use of kerneldoc in the source file and no descriptions are provided. Fixes the following W=1 kernel build warning(s): drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c:118: warning: Function parameter or member 'irq' not described in 'inv_mpu6050_read_fifo' drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c:118: warning: Function parameter or member 'p' not described in 'inv_mpu6050_read_fifo' Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: inv_mpu6050: inv_mpu_core: Demote obvious misuse of kerneldoc to standard comment blocksLee Jones1-7/+7
No attempt has been made to document any of the demoted functions here. Fixes the following W=1 kernel build warning(s): drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:444: warning: Function parameter or member 'st' not described in 'inv_mpu6050_set_lpf_regs' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:444: warning: Function parameter or member 'val' not described in 'inv_mpu6050_set_lpf_regs' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:480: warning: Function parameter or member 'indio_dev' not described in 'inv_mpu6050_init_config' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:862: warning: Function parameter or member 'st' not described in 'inv_mpu6050_set_lpf' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:862: warning: Function parameter or member 'rate' not described in 'inv_mpu6050_set_lpf' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:893: warning: Function parameter or member 'dev' not described in 'inv_mpu6050_fifo_rate_store' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:893: warning: Function parameter or member 'attr' not described in 'inv_mpu6050_fifo_rate_store' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:893: warning: Function parameter or member 'buf' not described in 'inv_mpu6050_fifo_rate_store' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:893: warning: Function parameter or member 'count' not described in 'inv_mpu6050_fifo_rate_store' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:954: warning: Function parameter or member 'dev' not described in 'inv_fifo_rate_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:954: warning: Function parameter or member 'attr' not described in 'inv_fifo_rate_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:954: warning: Function parameter or member 'buf' not described in 'inv_fifo_rate_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:975: warning: Function parameter or member 'dev' not described in 'inv_attr_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:975: warning: Function parameter or member 'attr' not described in 'inv_attr_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:975: warning: Function parameter or member 'buf' not described in 'inv_attr_show' drivers/iio/imu/inv_mpu6050/inv_mpu_core.c:1282: warning: Function parameter or member 'st' not described in 'inv_check_and_setup_chip' Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: st_lsm6dsx: st_lsm6dsx: Reorder 'inline' declarationLee Jones1-1/+1
Fixes the following W=1 kernel build warning(s): drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:487:1: warning: ‘inline’ is not at beginning of declaration [-Wold-style-declaration] drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h:497:44: warning: ‘st_lsm6dsx_accel_ext_info’ defined but not used [-Wunused-const-variable=] Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-20iio: imu: kmx61: Fix formatting in kerneldoc function headersLee Jones1-7/+7
Kerneldoc expects attributes/parameters to be in '@*.: ' format. Fixes the following W=1 kernel build warning(s): drivers/iio/imu/kmx61.c:327: warning: Function parameter or member 'data' not described in 'kmx61_set_mode' drivers/iio/imu/kmx61.c:327: warning: Function parameter or member 'mode' not described in 'kmx61_set_mode' drivers/iio/imu/kmx61.c:327: warning: Function parameter or member 'device' not described in 'kmx61_set_mode' drivers/iio/imu/kmx61.c:327: warning: Function parameter or member 'update' not described in 'kmx61_set_mode' drivers/iio/imu/kmx61.c:731: warning: Function parameter or member 'data' not described in 'kmx61_set_power_state' drivers/iio/imu/kmx61.c:731: warning: Function parameter or member 'on' not described in 'kmx61_set_power_state' drivers/iio/imu/kmx61.c:731: warning: Function parameter or member 'device' not described in 'kmx61_set_power_state' Cc: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-07-07iio: adis16480: Use irq types instead of flagsNuno Sá1-3/+3
The value retrieved by `irqd_get_trigger_type()` is not an irq flag. While the values are the same, the meaning is different. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add accurate timestampingJean-Baptiste Maneyrol8-15/+396
Add a timestamping mechanism for buffer that provides accurate event timestamps when using watermark. This mechanism estimates device internal clock by comparing FIFO interrupts delta time and device elapsed time computed by parsing FIFO data. Take interrupt timestamp in hard irq handler and add IIO device specific timestamp structures in device private allocation. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add buffer support in iio devicesJean-Baptiste Maneyrol8-2/+1033
Add all FIFO parsing and reading functions. Add accel and gyro kfifo buffer and FIFO data parsing. Use device interrupt for reading data FIFO and launching accel and gyro parsing. Support hwfifo watermark by multiplexing gyro and accel settings. Support hwfifo flush. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add device interruptJean-Baptiste Maneyrol4-4/+105
Add INT1 interrupt support. Support interrupt edge and level, active high or low. Push-pull or open-drain configurations. Interrupt will be used to read data from the FIFO. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: add Kconfig and Makefile for inv_icm42600 driverJean-Baptiste Maneyrol4-0/+43
Add 3 modules: inv-icm42600, inv-icm42600-i2c, inv-icm42600-spi. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add temperature sensor supportJean-Baptiste Maneyrol4-2/+134
Add temperature channel in gyroscope and accelerometer devices. Temperature is available in full 16 bits resolution when reading register and in low 8 bits resolution in the FIFO. Return full precision raw temperature with corresponding scale and offset. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add accelerometer IIO deviceJean-Baptiste Maneyrol3-0/+600
Add IIO device for accelerometer sensor with data polling interface. Attributes: raw, scale, sampling_frequency, calibbias. Accelerometer in low noise mode. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add gyroscope IIO deviceJean-Baptiste Maneyrol3-0/+613
Add IIO device for gyroscope sensor with data polling interface. Attributes: raw, scale, sampling_frequency, calibbias. Gyroscope in low noise mode. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add SPI driver for inv_icm42600 driverJean-Baptiste Maneyrol1-0/+99
Add SPI driver for InvenSense ICM-426xxx devices. Configure bus signal slew rates as indicated in the datasheet. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add I2C driver for inv_icm42600 driverJean-Baptiste Maneyrol1-0/+100
Add I2C driver for InvenSense ICM-426xxx devices. Configure bus signal slew rates as indicated in the datasheet. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: imu: inv_icm42600: add core of new inv_icm42600 driverJean-Baptiste Maneyrol2-0/+1006
Core component of a new driver for InvenSense ICM-426xx devices. It includes registers definition, main probe/setup, and device utility functions. ICM-426xx devices are latest generation of 6-axis IMU, gyroscope+accelerometer and temperature sensor. This device includes a 2K FIFO, supports I2C/I3C/SPI, and provides intelligent motion features like pedometer, tilt detection, and tap detection. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: remove left-over parent assignmentsAlexandru Ardelean1-1/+0
These were found by doing some shell magic: ------------ for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq) ; do if grep 'parent =' $file | grep -v trig | grep -vq devm_; then echo "$file -> $(grep "parent =" $file)" fi done ----------- The output is bearable [after the semantic patch is applied]. There is a mix of trigger assignments with some iio device parent assignments that are removed via this patch. JC: A few more added via inspection of all parent = statements in drivers/iio. Some of these may just have crossed with this series, others were less obvious to scripting due to some cross file / module boundary calls. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: remove explicit IIO device parent assignmentAlexandru Ardelean9-9/+0
This patch applies the semantic patch: @@ expression I, P, SP; @@ I = devm_iio_device_alloc(P, SP); ... - I->dev.parent = P; It updates 302 files and does 307 deletions. This semantic patch also removes some comments like '/* Establish that the iio_dev is a child of the i2c device */' But this is is only done in case where the block is left empty. The patch does not seem to cover all cases. It looks like in some cases a different variable is used in some cases to assign the parent, but it points to the same reference. In other cases, the block covered by ... may be just too big to be covered by the semantic patch. However, this looks pretty good as well, as it does cover a big bulk of the drivers that should remove the parent assignment. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: imu: bmi160: added mount-matrix supportJonathan Albrieux2-0/+21
Add mount-matrix binding support. As chip could have different orientations a mount matrix support is needed to correctly translate these differences. Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: imu: bmi160: added regulator supportJonathan Albrieux2-0/+26
Add vdd-supply and vddio-supply support. While working on an msm8916 device and having explicit declarations for regulators, without setting these regulators to regulators-always-on it happened those lines weren't ready because they could have been controlled by other components, causing failure in module's probe. This patch aim is to solve this situation by adding regulators control during bmi160_chip_init() and bmi160_chip_uninit(), assuring power to this component. Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: imu: bmi160: fix typoJonathan Albrieux1-1/+1
Fix a typo in MODULE_AUTHOR() argument. Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: imu: inv_mpu6050: Drop double check for ACPI companion deviceAndy Shevchenko1-5/+1
acpi_dev_get_resources() does perform the NULL pointer check against ACPI companion device which is given as function parameter. Thus, there is no need to duplicate this check in the caller. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-05-25Merge 5.7-rc7 into staging-nextGreg Kroah-Hartman1-2/+5
We need the staging/iio fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-15Merge tag 'iio-for-5.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman10-38/+1528
Jonathan writes: Second set of new device support, cleanups and features for IIO in the 5.8 cycle Usual mixed back but with a few subsystem wide or device type wide cleanups. New device support * adis16475 - New driver supporting adis16470, adis16475, adis16477, adis16465, adis16467, adis16500, adis16505 and adis16507. Includes some rework of the adis library to simplify using it for this new driver. * ak8974 - Add support for Alps hscdt008a. ID only. Related patches add support for scale. * atlas-sensor - Add support for RTD-SM OEM temperature sensor. * cm32181 - Add support for CM3218 including support for SMBUS alert via ACPI resources. * ltc2632 - Add support for ltc2634-12/10/8 DACS including handling per device type numbers of channels. Major Features * cm32181 - ACPI bindings including parsing CPM0 and CPM1 custom ACPI tables. Includes minor tidy ups and fixes. * vcnl4000 - Add event support - Add buffered data capture support - Add control of sampling frequency Cleanups and minor fixes. * core - Trivial rework of iio_device_alloc to use an early return and improve readability. - Precursors to addition of multiple buffer support. So far minor refactoring. * subsystem wide - Use get_unaligned_be24 slightly improve readability over open coding it. * adis drivers - Use iio_get_debugfs_dentry access function. * bh1780, cm32181, cm3232, gp2ap02a00f, opt3001, st_uvis25, vl6180, dmard06, kxsd9 - Drop use of of_match_ptr to allow ACPI based probing via PRP0001. Part of clear out of this to avoid cut and paste into new drivers. * ad5592r, ad5593r - Fix typos * ad5933 - Use managed interfaces to automate error handling and remove. * ak8974 - Fix wrong number of 'real bits' for buffered data. - Refactor to pull measurement code out as separate function. bmp280 - Fix lack of clamp on range during data capture. * at91-sama5d2_adc - Handle unfinished conversions correctly. - Allow use of triggers other than it's own. - Reorganize buffer setup and tear down as part of long running subsystem wide rework. * ccs811 - Add DT binding docs and match table. - Support external reset and wakeup pins. * hid-sensors - Reorganize buffer setup and tear down as part of long running subsystem wide rework. * ltr501 - Constify some structs. * vcnl4000 - Fix an endian issue by using explicit byte swapped i2c accessors. * tag 'iio-for-5.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (74 commits) iio: light: ltr501: Constify structs staging: iio: ad5933: attach life-cycle of kfifo buffer to parent device and use managed calls throughout iio: bmp280: fix compensation of humidity iio: light: cm32181: Fix integartion time typo iio: light: cm32181: Add support for parsing CPM0 and CPM1 ACPI tables iio: light: cm32181: Make lux_per_bit and lux_per_bit_base_it runtime settings iio: light: cm32181: Use units of 1/100000th for calibscale and lux_per_bit iio: light: cm32181: Change reg_init to use a bitmap of which registers to init iio: light: cm32181: Handle CM3218 ACPI devices with 2 I2C resources iio: light: cm32181: Clean up the probe function a bit iio: light: cm32181: Add support for the CM3218 iio: light: cm32181: Add some extra register defines iio: light: cm32181: Add support for ACPI enumeration iio: light: cm32181: Switch to new style i2c-driver probe function iio: hid-sensors: move triggered buffer setup into hid_sensor_setup_trigger iio: vcnl4000: Add buffer support for VCNL4010/20. iio: vcnl4000: Add sampling frequency support for VCNL4010/20. iio: vcnl4000: Add event support for VCNL4010/20. iio: vcnl4000: Factorize data reading and writing. iio: vcnl4000: Fix i2c swapped word reading. ...
2020-05-03iio: imu: adis16xxx: use helper to access iio core debugfs dirAlexandru Ardelean4-31/+20
The IIO core provides a iio_get_debugfs_dentry() helper. It seems that the ADIS IMU drivers access that field directly. This change converts them to use iio_get_debugfs_dentry() instead. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Acked-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-05-03iio: imu: st_lsm6dsx: enable 833Hz sample frequency for tagged sensorsLorenzo Bianconi1-7/+14
Enable 833Hz ODR for sensors that supports tagged hw FIFO: - LSM6DSO/LSM6DSOX - LSM6DSR/LSM6DSRX - ASM330LHH Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-05-03iio: imu: Add support for adis16475Nuno Sá3-0/+1355
Support ADIS16475 and similar IMU devices. These devices are a precision, miniature MEMS inertial measurement unit (IMU) that includes a triaxial gyroscope and a triaxial accelerometer. Each inertial sensor combines with signal conditioning that optimizes dynamic performance. The driver adds support for the following devices: * adis16470, adis16475, adis16477, adis16465, adis16467, adis16500, adis16505, adis16507. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-27Merge 5.7-rc3 into staging-nextGreg Kroah-Hartman5-16/+74
We need the staging fixes in here too, and this resolves a merge issue with the vt6656 driver. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-25iio: imu: st_lsm6dsx: unlock on error in st_lsm6dsx_shub_write_raw()Dan Carpenter1-2/+5
We need to release a lock if st_lsm6dsx_check_odr() fails, we can't return directly. Fixes: 76551a3c3df1 ("iio: imu: st_lsm6dsx: specify slave odr in slv_odr") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-25iio: adis: Support different burst sizesNuno Sá2-5/+10
Add burst_max_len to `adis_burst`. This is useful for devices which support different burst modes with different sizes. The buffer to be used in the spi transfer is allocated with this variable making sure that has space for all burst modes. The spi transfer length should hold the "real" burst length depending on the current burst mode configured in the device. Moreover, `extra_len` in `adis_burst` is made const and it should contain the smallest extra length necessary for a burst transfer. In `struct adis` was added a new `burst_extra_len` that should hold the extra bytes needed depending on the device instance being used. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-25iio: adis: Add adis_update_bits() APIsNuno Sá1-0/+25
This patch adds a `regmap_update_bits()` like API to the ADIS library. It provides locked and unlocked variant. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-25iio: imu: adis: Add irq flag variableNuno Sá1-2/+31
There are some ADIS devices that can configure the data ready pin polarity. Hence, we cannot hardcode our IRQ mask as IRQF_TRIGGER_RISING since we might want to have it as IRQF_TRIGGER_FALLING. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-25iio: imu: adis: Add Managed device functionsNuno Sá2-3/+83
This patch adds support for a managed device version of adis_setup_buffer_and_trigger. It works exactly as the original one but it calls all the devm_iio_* functions to setup an iio buffer and trigger. Hence we do not need to care about cleaning those and we do not need to support a remove() callback for every driver using the adis library. Signed-off-by: Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: inv_mpu6050: fix suspend/resume with runtime powerJean-Baptiste Maneyrol1-1/+10
Suspend/resume were not working correctly with pm runtime. Now suspend check if the chip is already suspended, and resume put runtime pm in the correct state. Issues seen prior to this were: When entering suspend, there was an error in logs because we were disabling vddio regulator although it was already disabled. And when resuming, the chip was pull back to full power but the pm_runtime state was not updated. So it was believing it was still suspended. Fixes: 4599cac84614 ("iio: imu: inv_mpu6050: use runtime pm with autosuspend") Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: st_lsm6dsx: flush hw FIFO before resetting the deviceLorenzo Bianconi1-1/+23
flush hw FIFO before device reset in order to avoid possible races on interrupt line 1. If the first interrupt line is asserted during hw reset the device will work in I3C-only mode (if it is supported) Fixes: 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") Fixes: 43901008fde0 ("iio: imu: st_lsm6dsx: add support to LSM6DSR") Reported-by: Mario Tesi <mario.tesi@st.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Reviewed-by: Vitor Soares <vitor.soares@synopsys.com> Tested-by: Vitor Soares <vitor.soares@synopsys.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio:imu:mpu6050: Tidy up parameters to regmap_bulk functions.Jonathan Cameron1-2/+2
A mixture of: * Casts to u8 * for the val parameter which is void * and so needs no cast. * Explicit sizes when we can use sizeof on the destination / source variable. Not broken in anyway, I'm just trying to tidy up the is in the subsystem to avoid it getting cut and paste into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
2020-04-19iio: imu: st_lsm6dsx: drop huge include in sensor-hub driverLorenzo Bianconi1-2/+1
st_lsm6dsx is a standalone driver for STM IMU sensors and does not rely on st_sensor common framework, so it does not include st_sensor common definitions. In st_lsm6dsx_shub driver st_sensors.h is used just to introduce the default wai address for LIS3MDL sensor. Drop this largely unconnected include file and introduce the default wai address for LIS3MDL in st_lsm6dsx_ext_dev_settings register map Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: adis: Add a missing '\n' in a log messageChristophe JAILLET1-1/+1
Message logged by 'dev_xxx()' or 'pr_xxx()' should end with a '\n'. Fixes: 1fd456702692 ("iio: imu: adis: add support product ID check in adis_initial_startup") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: st_lsm6dsx: Add sensor hub device LIS3MDLJimmy Assarsson1-0/+64
Add LIS3MDL register map to sensor hub device table. Tested with LSM6DSM. Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: st_lsm6dsx: Increase ODR_LIST_SIZEJimmy Assarsson1-1/+1
Support for sensor with up to 8 different ODR settings. Required for supporting LIS3MDL as sensor hub slave device. Signed-off-by: Jimmy Assarsson <jimmyassarsson@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: adis16460: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTERohit Sarkar1-12/+15
debugfs_create_file_unsafe does not protect the fops handed to it against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of the file lifetime and thus protects it against removal. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Tested-by Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: adis16400: use DEFINE_DEBUGFS_ATTRIBUTE instead of DEFINE_SIMPLE_ATTRIBUTERohit Sarkar1-9/+10
debugfs_create_file_unsafe does not protect the fops handed to it against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of the file lifetime and thus protects it against removal. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Tested-by Nuno Sá <nuno.sa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: st_lsm6dsx: configure full scale on slave device if supportedLorenzo Bianconi1-0/+33
Introduce st_lsm6dsx_shub_set_full_scale routine in order to configure the i2c slave device sensitivity Tested-by: Jimmy Assarsson <jimmyassarsson@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: inv_mpu6050: add debugfs register r/w interfaceRohit Sarkar1-0/+19
The debugfs interface provides direct access to read and write device registers if debugfs is enabled. Signed-off-by: Rohit Sarkar <rohitsarkar5398@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: inv_mpu6050: convert to use i2c_new_client_device()Wolfram Sang1-3/+5
Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: inv_mpu6050_spi: Use vsprintf extension %pe for symbolic error nameNishant Malpani1-2/+2
Utilize %pe format specifier from vsprintf while printing error logs with dev_err(). Discards the use of unnecessary explicit casting and prints symbolic error name which might prove to be convenient during debugging. Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19iio: imu: inv_mpu6050_i2c: Use vsprintf extension %pe for symbolic error nameNishant Malpani1-2/+2
Utilize %pe format specifier from vsprintf while printing error logs with dev_err(). Discards the use of unnecessary explicit casting and prints symbolic error name which might prove to be convenient during debugging. Signed-off-by: Nishant Malpani <nish.malpani25@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>