aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-07-14Merge tag 'iio-for-4.8c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman7-6/+17
Jonathan writes: Third set of IIO new device support, features and cleanups for the 4.8 cycle. New core features - Selection of the clock source for IIO timestamps. This is done per device as it makes little sense to have events in one timebase and data timestamped on another. Biggest reason for this is that we currently use a clock source which is non monotonic which can result in 'interesting' data sets. (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind in an earlier version.) - MAINTAINERS add the git tree to the list for IIO. New device support + a kind of indirect staging graduation. * Broadcom iproc-static-adc - new driver * mcp4531 - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers * mpu6050 - support the IC20608 6 axis motion tracking device * st-sensors - support the lis3l02dq + drop the lis3l02dq driver from staging. The general purpose driver is missing event support, but good to get rid of this driver which was rather long in the tooth. New driver features * ak8975 - Add vid regulator support and refactor handling in general. - Allow a delay after enabling regulators. - Runtime and system PM. * bmg160 - filter frequency control support. * bmp280 - SPI device support. - EOC interrupt support for the BMP085 - power management support. - supply regulator support. - reset gpio support - dt bindings for reset gpio and regulators. - of table to support device tree registration * max1363 - Device tree bindings. * mcp4531 - Device tree bindings. * st-pressure - temperature channels as part of triggered buffer (previously not due probably to alignment issues - see below). - lps22hb open drain interrupt support. - lps22hb temperature channel support Cleanups and reworkings. * numerous ADC drivers - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so as to allow client bindings to find the device. * ak8975 - Fix incorrect handling of missing regulator - make sure power is down and remove. * bmp280 - read the calibration data only once as it doesn't change. * isl29125 - Use a few macros to make code a touch more readable. * mma8452 - fix a memory leak on error. - drop an unecessary bit of return value handling. * potentiometer kconfig - typo fix. * st-pressure - drop some uninformative default assignments of elements of the channel array structure (aids readability). * st-sensors - Harden interrupt handling considerably. These are actually all using level interrupts, but at least two known boards have them wired to edge only interrupt chips. Hence a slightly interesting bit of handling is needed in which we first allow for the easy option (level triggered) and secondly check the status registers before reenabling edge interrupts and fall back to a tight loop in the thread until we successfully clear the interrupt. No harm is done if we never succeed in doing so. It's an odd patch that has been through a lot of revisions to reach a consensus on how to handle what is basically broken hardware (which the previous defaults allowed to kind of work). - Fix alignment to defined storagebytes boundaries. - Ensure alignment of power of 2 byte boundaries. This has always in theory been part of the ABI of IIO, but we missed a few that snuck in that need fixing. The effect was minor as they were only followed by timestamp channels which were correctly aligned, - Add some docs to explain the gain calculations.
2016-07-04Merge 4.7-rc6 into staging-nextGreg Kroah-Hartman1-2/+3
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-03iio:imu:mpu6050: icm20608 initial supportGregor Boirie5-4/+14
Introduce support for Invense ICM20608 IMU, a 6-axis motion tracking device that combines a 3-axis gyroscope and a 3-axis accelerometer: http://www.invensense.com/products/motion-tracking/6-axis/icm-20608-2 Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie2-2/+3
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow userspace to select a particular POSIX clock for buffered samples and events timestamping. Following clocks, as listed in clock_gettime(2), are supported: CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and CLOCK_TAI. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-20Merge 4.7-rc4 into staging-nextGreg Kroah-Hartman1-8/+8
We want the fixes in here, and we can resolve a merge issue in drivers/iio/industrialio-trigger.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-11iio: inv_mpu6050: Fix use-after-free in ACPI codeCrestez Dan Leonard1-2/+3
In some cases this can result in incorrectly returning a negative value from asus_acpi_get_sensor_info and the AK8963 magnetometer failing to show up. Note cpm is an alias for buffer.pointer which isn't apparent in this patch on it's own. Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-09Merge tag 'iio-for-4.8a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman1-0/+27
Jonathan writes: First round of IIO new device support, features and cleanups for the 4.8 cycle. New device support * ads1015 - add ads1115 support * bma220 accelerometer - new driver - triggered buffer support. * bmc150 - add bmm150 support. * bmp280 - bme280 support with addition of humidity channel. * max5487 potentiometer - new driver * MMA7660FC accelerometer. - New driver * st-pressure - support for the lps22hb * loop trigger. - This one is *nasty* but we have real applications (parrot drones) where it is useful. The trigger basically spins as hard as it can firing off a new trigger each time all triggered devices come back to say they are done. It doesn't hang a machine even when doing it on a dummy driver. A lot nicer than having this implemented within lots of device drivers anyway. Core stuff * Add support to create IIO devices via configfs (similar to we did for triggers a while back) + docs. * New channel types - IIO_ELECTRICAL_CONDUCTIVITY * Couple of MAINTAINERS patches to list the device tree bindings. * Make trigger ops structure non optional (comment fix). It hasn't been for an awful long time, but that's not what the description said. New features * ak8975 - support adapters that are limited to byte data only by allowing the emulated block read i2c function that was recently introduced. * atlas-ph - support atlas-ec (electrical conductivity sensor) * bmi160 - add available frequency and scale attributes to make the driver more user friendly (and avoid having to read the datasheet to know what will work). * dummy - move creation to configfs interface. It's not real hardware so we are not that worried about the ABI breakage ;) * mma8452 - oversampling ration support * nau7802 - expose available gains to make life easier for userspace. * st-sensors - allow use of emulation for SMBus block reads as all the st parts support it. * ti-ads1015 - list datasheet names to allow their use by inkernel consumers. * Various module alias additions to help auto probing. Drop one redundant one as well. Cleanups * ad7266, ad7476, ad7887, ad7923, ad799x - use direct mode claim function rather than open coding it during sensor read (prevents switching on buffers mid read). * ad7793, ad7791 - use direct mode claim to prevent frequency changes when buffers running. * afe440x - These are ABI breaking but the driver requires custom userspace code to do anything useful anyway and that is still being written and under control of TI. Ultimately we may have other libraries to do pulse oximetry with these devices but we aren't aware of any yet. - kernel-doc format fixes - drop ifdef fun around of_match_ptr - it's not worth the mess to save a tiny amount of space. - drop some unnecessary register initializations. - drop the weird locked gain modes as they gain us nothing (can just set all gains separately). - remove handling of offset attributes seeing as no channels actually have them (oops) - Drop the LED3 input channel as it's an alias for ALED2. - *big one* remove channel names - an experiment that turned out to not make sense - see patch for details. - use regmap fields to clean up code. - tie the tia gain stages to appropriate channels in the ABI as that is what they really effect. Same with the LED currents. - cleanout some unused defines and fix a missnamed one. * atlas-ph - reorganise to allow support of other similar parts. * bmc150 - document supported chips in kconfig help. * jsa1212 - drop an unneeded i2c functionality check for functionality the driver doesn't use. * mxs-lradc - simply touch screen registration code. - remove the touch screen unregister as all devm based now. - disable only those channels that are masked in hardware stop (others are already dealt with elsewhere) * st-sensors - unexport st_sensors_get_buffer_element as nothing outside the st-sensors core driver uses it. - fix handling of failure to start up regulators. * tpl0102 - drop an i2c functionality test for features that aren't needed. * ti-am335x - use variable name rather than type in sizeof for clarity. - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit. Tools * Add install / uninstall to makefile. Someone cares, so presumably some people will find it useful! * generic_buffer - rename to iio_generic_buffer to line up with other tools. - handle cleanup when receiving signals - Add a --device-num option and a --trigger-num option rather than relying on naming which doesn't work if you have two of the same part.
2016-06-07Merge tag 'iio-fixes-for-4.7a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman1-8/+8
Jonathan writes: First round of iio fixes for the 4.7 cycle. A slightly bumper set due to travel delaying the pull request and a fair few issues with the recent merge window patches. Patches all over the place. The st-sensors one is probably the most involved, but definitly solves the issues seen. Note there are some other issues around that handler (and the fact that a lot of boards tie a level interrupt chip to an edge interrupt only irq chip). These are not regressions however, so will turn up the slow route. * core - iio_trigger_attach_pollfunc had some really badly wrong error handling. Another nasty triggered whilst chasing down issues with the st sensors rework below. * ad5592r - fix an off by one error when allocating channels. * am2315 - a stray mutex unlock before we ever take the lock. * apds9960 - missing a parent in the driver model (which should be the i2c device). Result is it doesn't turn up under /sys/bus/i2c/devices which some userspace code uses for repeatable device identification. * as3935 - ABI usage bug which meant a processed value was reported as raw. Now reporting scale as well to ensure userspace has the info it needs. - Don't return processed value via the buffer - it doesn't conform to the ABI and will overflow in some cases. - Fix a wrongly sized buffer which would overflow trashing part of the stack. Also move it onto the heap as part of the fix. * bh1780 - a missing return after write in debugfs lead to an incorrect read and a null pointer dereference. - dereferencing the wrong pointer in suspend and resume leading to unpredictable results. - assign a static name to avoid accidentally ending up with no name if loaded via device tree. * bmi160 - output data rate for the accelerometer was incorrectly reported. Fix it. - writing the output data rate was also wrong due to reverse parameters. * bmp280 - error message for wrong chip ID gave the wrong expected value. * hdc100x - mask for writing the integration time was wrong allowin g us to get 'stuck' in a particular value with no way back. - temperature reported in celsius rather than millicelsius as per the ABI. - Get rid of some incorrect data shifting which lead to readings being rather incorrect. * max44000 - drop scale attribute for proximity as it is an unscaled value (depends on what is in range rather than anything knowable at the detector). * st-pressure - ABI compliance fixes - units were wrong. * st-sensors - We introduced some nasty issues with the recent switch over to a a somewhat threaded handler in that we broke using a software trigger with these devices. Now do it properly. It's a larger patch than ideal for a fix, but the logic is straight forward. - Make sure the trigger is initialized before requesting the interrupt. This matters now the interrupt can be shared. Before it was ugly and wrong but short of flakey hardware could not be triggered. - Hammer down the dataready pin at boot - otherwise with really unlucky timing things could get interestingly wedged requiring a hard power down of the chip.
2016-05-20Merge tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds15-22/+890
Pull staging and IIO driver updates from Greg KH: "Here's the big staging and iio driver update for 4.7-rc1. I think we almost broke even with this release, only adding a few more lines than we removed, which isn't bad overall given that there's a bunch of new iio drivers added. The Lustre developers seem to have woken up from their sleep and have been doing a great job in cleaning up the code and pruning unused or old cruft, the filesystem is almost readable :) Other than that, just a lot of basic coding style cleanups in the churn. All have been in linux-next for a while with no reported issues" * tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (938 commits) Staging: emxx_udc: emxx_udc: fixed coding style issue staging/gdm724x: fix "alignment should match open parenthesis" issues staging/gdm724x: Fix avoid CamelCase staging: unisys: rename misleading var ii with frag staging: unisys: visorhba: switch success handling to error handling staging: unisys: visorhba: main path needs to flow down the left margin staging: unisys: visorinput: handle_locking_key() simplifications staging: unisys: visorhba: fail gracefully for thread creation failures staging: unisys: visornic: comment restructuring and removing bad diction staging: unisys: fix format string %Lx to %llx for u64 staging: unisys: remove unused struct members staging: unisys: visorchannel: correct variable misspelling staging: unisys: visorhba: replace functionlike macro with function staging: dgnc: Need to check for NULL of ch staging: dgnc: remove redundant condition check staging: dgnc: fix 'line over 80 characters' staging: dgnc: clean up the dgnc_get_modem_info() staging: lustre: lnet: enable configuration per NI interface staging: lustre: o2iblnd: properly set ibr_why staging: lustre: o2iblnd: remove last of kiblnd_tunables_fini ...
2016-05-19Merge branch 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linuxLinus Torvalds4-59/+26
Pull i2c updates from Wolfram Sang: - Peter Rosin did some major rework on the locking of i2c muxes by seperating parent-locked muxes and mux-locked muxes. This avoids deadlocks/workarounds when the mux itself needs i2c commands for muxing. And as a side-effect, other workarounds in the media layer could be eliminated. Also, Peter stepped up as the i2c mux maintainer and will keep an eye on these changes. - major updates to the octeon driver - add a helper to the core to generate the address+rw_bit octal and make drivers use it - quite a bunch of driver updates * 'i2c/for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (84 commits) i2c: rcar: add DMA support i2c: st: Implement bus clear i2c: only check scl functions when using generic recovery i2c: algo-bit: declare i2c_bit_quirk_no_clk_stretch as static i2c: tegra: disable clock before returning error [media] rtl2832: regmap is aware of lockdep, drop local locking hack [media] rtl2832_sdr: get rid of empty regmap wrappers [media] rtl2832: change the i2c gate to be mux-locked [media] si2168: change the i2c gate to be mux-locked iio: imu: inv_mpu6050: change the i2c gate to be mux-locked i2c: mux: document i2c muxes and elaborate on parent-/mux-locked muxes i2c: mux: relax locking of the top i2c adapter during mux-locked muxing i2c: muxes always lock the parent adapter i2c: allow adapter drivers to override the adapter locking i2c: uniphier: add "\n" at the end of error log i2c: mv64xxx: remove CONFIG_HAVE_CLK conditionals i2c: mv64xxx: use clk_{prepare_enable,disable_unprepare} i2c: mv64xxx: handle probe deferral for the clock i2c: mv64xxx: enable the driver on ARCH_MVEBU i2c: octeon: Add workaround for broken irqs on CN3860 ...
2016-05-04iio: imu: inv_mpu6050: change the i2c gate to be mux-lockedPeter Rosin1-42/+10
The root i2c adapter lock is then no longer held by the i2c mux during accesses behind the i2c gate, and such accesses need to take that lock just like any other ordinary i2c accesses do. So, declare the i2c gate mux-locked, and zap the code that makes the unlocked i2c accesses and just use ordinary regmap_write accesses. This also happens to fix the deadlock described in http://patchwork.ozlabs.org/patch/584776/ authored by Adriana Reus <adriana.reus@intel.com> and submitted by Daniel Baluta <daniel.baluta@intel.com> ----------8<---------- iio: imu: inv_mpu6050: Fix deadlock between i2c adapter lock and mpu lock This deadlock occurs if the accel/gyro and the sensor on the auxiliary I2C (in my setup it's an ak8975) are working at the same time. Scenario: T1 T2 ==== ==== inv_mpu6050_read_fifo aux sensor op (eg. ak8975_read_raw) | | mutex_lock(&indio_dev->mlock) i2c_transfer | | i2c transaction i2c adapter lock | | i2c adapter lock i2c_mux_master_xfer | inv_mpu6050_select_bypass | mutex_lock(&indio_dev->mlock) When we operate on an mpu sensor the order of locking is mpu lock followed by the i2c adapter lock. However, when we operate the auxiliary sensor the order of locking is the other way around. ... ----------8<---------- The reason this patch fixes the deadlock is that T2 does not grab the i2c adapter lock until the very end (and grabs the newfangled i2c mux lock where it previously grabbed the i2c adapter lock). Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Tested-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-05-04imu: bmi160: Add avail frequency and scale attributesDaniel Baluta1-0/+27
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: bmi160: Fix ODR settingDaniel Baluta1-2/+2
mask and val parameters of regmap_update_bits were reveresed. Fixes: 77c4ad2d6a9 ("iio: imu: Add initial support for Bosch BMI160") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: bmi160: Fix output data rate for accelDaniel Baluta1-6/+6
Format is INT_PLUS_MICRO and micro odr part of ODR should be parts of a micro. Also s/8000/800 this is obviously a typo. Fixes: 77c4ad2d6a9 ("iio: imu: Add initial support for Bosch BMI160") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: imu: mpu6050: Fix name/chip_id when using ACPIDaniel Baluta1-3/+26
When using ACPI, id is NULL and the current code automatically defaults name to NULL and chip id to 0. We should instead use the data provided in the ACPI device table. Fixes: c816d9e7a57b ("iio: imu: mpu6050: fix possible NULL dereferences") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Reviewed-By: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: imu: mpu6050: fix possible NULL dereferencesMatt Ranostay2-2/+4
Fix possible null dereferencing of i2c and spi driver data. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-26Merge tag 'iio-for-4.7b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testingGreg Kroah-Hartman14-21/+890
Jonathan writes: 2nd set of new device support, features and cleanup for IIO in the 4.7 cycle. Bit of a bumper set for new drivers but plenty of other stuff here as well! New device support * ad5592R ADC/DAC - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips. * Aosong am2315 relative humidity - new driver with triggered buffer support in follow up patch. * bmi160 imu - new driver * bmp280 - bmp180 support - note there is support in the misc/bmp085 driver. Intent is to remove that driver long term. * invensense mpu6050 - cleanup leading to explicit support of mpu9150 with a good few cleanups along the way. * Hope RF hp03 pressure and temperature sensor. - new driver * maxim DS1803 potentiometer - new driver * maxim max44000 light and proximity sensor - new driver built in a series of steps to support pretty much everything. * ROHM BH1780 light sensor - new driver. There is an existing driver in misc that this is pretty much intended to replace. The discussion on whether to support the non standard interface of that driver is some way is continuing. * st-gyro - lsm9ds0-gyro. The accel/magn side of this will take a while longer as extensions to the st library are needed for cases where two types of sensor share a single i2c address. * ti-adc081c - support the adc101c and adc121c * Vishay VEML6070 UV sensor - new driver. New features * core - devm_ APIs for channel_get and channel_get_all. The first user of these is the generic ADC based thermal driver. As it is going through the thermal tree these will be picked up as a patch to that next cycle as that is how the author preferred to do it. - mounting matrix support. This new core support allows devices to provide to userspace (typically from the device tree) allowing compensation for how the sensor is mounted on the device. First examples are on UAVs but it has a more mundane use on typical phone where the chip may be on the front or the back of the circuit board and soldered at any angle. Includes support for this ABI in ak8975 (which has an older interface, now deprecated) and mpu6050. * tools - add a -a option to enable all available channels in generic_buffer sample. Makes it somewhat easier to use. * adis library and drivers - support manual self test flag clearing. This has technically been broken for a very long time - result is an offset on readings as the applied field is on all the time. * ak8975 - triggered buffer support * bmc150 - spi support (including splitting the driver into core and i2c parts) * bmp280 - oversampling support. * dht11 - improved logging - useful to debug timing issues on this quirky device. * st-sensors - read each channel invidivually as not all support the optimization of reading in bulk. This is technically a fix, but will need to be backported if desired. - support open drain and shared interrupts. * ti-adc081c - triggered buffer support. Cleanups * inkern - white space fix. * ad7606 - use the iio_device_claim_direct_mode call rather than open coding equiv. * ad799x - white space fix. * ad9523 - unsigned -> unsigned int * apds9660 - brace location tidying up. - silence an uninitialized variable warning. * ak8975 - else and brace on same line fix. * at91_adc - white space fixes. * bmc150 - use regmap stored copy of the device pointer rather than having an additional copy. * bmg160 - use regmap stored copy of the device pointer rather than having an additional copy. * hid-sensors - white space fixes. * mcp3422 - white space fix. * mma7455 - use regmap to retrieve the device struct rather than carrying another copy in the private data. * ms_sensors - white space fix. * mxs-lradc - move current bindings out of staging - some will be shortly deprecated but the reality is that we have device trees out there using them so they will need to be supported for some time. They accidentally got left behind when the driver graduated from staging. - white space cleanup. - set INPUT_PROP_DIRECT. - move ts config into a better function. - move the STMP reset out of the ADC init. * vf610_adc - case label indenting fix.
2016-04-25iio: inv_mpu6050: Add explicit support for MPU9150Crestez Dan Leonard5-6/+14
This device is a package containing a MPU6050-like sensor and an AK8975 magnetometer. The magnetometer component is supported by the existing ak8975 driver. This patch also rephrases the Kconfig descriptions. Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Ge Gao <ggao@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25iio: inv_mpu6050: Add spi_device_id for INV_MPU6500Crestez Dan Leonard1-0/+1
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Ge Gao <ggao@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25iio: inv_mpu6050: Check WHO_AM_I register on probeCrestez Dan Leonard2-0/+23
This can be used to distinguish mpu6500. This is a warning rather than an error because the differences are mostly irrelevant and it's nice to avoid breaking users with slightly incorrect ACPI/DT. Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Ge Gao <ggao@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25iio: inv_mpu6050: Remove inv_mpu6050_hw.num_regCrestez Dan Leonard2-5/+0
This field was unused and incorrect for mpu6500. Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-25iio: inv_mpu6050: Cleanup hw_info mappingCrestez Dan Leonard3-6/+29
The hw_info array was indexed by enum inv_devices chip_type despite the fact that the enumeration had more members than the array and was ordered differently. The patch cleans this up and adds explicit chip_types to i2c/spi/acpi IDs. It also adds some stricter checks inside the driver core. This happened to work so far because the differences between the supported models are very minor. Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Acked-by: Ge Gao <ggao@invensense.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-23iio:imu:mpu6050: enhance mounting matrix supportGregor Boirie2-4/+36
Add a new rotation matrix sysfs attribute compliant with IIO core mounting matrix API. Matrix is retrieved from "in_anglvel_mount_matrix" and "in_accel_mount_matrix" sysfs attributes. It is declared into mpu6050 DTS entry as a "mount-matrix" property. Old interface is kept for backward userspace compatibility and may be retrieved from legacy platform_data mechanism only. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-22iio: imu: inv_mpu6050: convert to use an explicit i2c mux corePeter Rosin4-20/+19
Allocate an explicit i2c mux core to handle parent and child adapters etc. Update the select/deselect ops to be in terms of the i2c mux core instead of the child adapter. Acked-by: Jonathan Cameron <jic23@kernel.org> Tested-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2016-04-16iio:adis: Add support for manual self-test flag clearLars-Peter Clausen1-1/+6
Some variants of the devices from the ADIS family don't auto-clear the self-test bit after the self-test has completed. Instead we have to manually clear. Add support for this to the ADIS library. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-16iio: imu: Add initial support for Bosch BMI160Daniel Baluta8-0/+782
BMI160 is an Inertial Measurement Unit (IMU) which provides acceleration and angular rate measurement. It also offers a secondary I2C interface for connecting a magnetometer sensor (usually BMM160). Current driver offers support for accelerometer and gyroscope readings via sysfs or via buffer interface using an external trigger (e.g. hrtimer). Data is retrieved from IMU via I2C or SPI interface. Datasheet is at: http://www.mouser.com/ds/2/783/BST-BMI160-DS000-07-786474.pdf Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-11Merge 4.6-rc3 into staging-nextGreg Kroah-Hartman1-2/+1
This resolves a lot of merge issues with PAGE_CACHE_* changes, and an iio driver merge issue. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-03iio: remove unused gpio consumer.h includeIrina Tirdea1-1/+0
GPIO handling code has been removed from the drivers (since this is now handled by the ACPI core) in commit 0f0796509c07 ("iio: remove gpio interrupt probing from drivers that use a single interrupt"). Remove the include for linux/gpio/consumer.h since it is no longer used. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-28iio: imu: Fix inv_mpu6050 dependenciesRichard Weinberger1-2/+1
Not all archs have io memory. Instead of selecting I2C_MUX (and bypassing the HAS_IOMEM dependency) depend directly on it. Fixes the following kconfig warning: warning: (MEDIA_SUBDRV_AUTOSELECT && VIDEO_CX231XX && INV_MPU6050_I2C) selects I2C_MUX which has unmet direct dependencies (I2C && HAS_IOMEM) And this build error: ERROR: "devm_ioremap_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined! ERROR: "of_address_to_resource" [drivers/i2c/muxes/i2c-mux-reg.ko] undefined! Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: imu: mpu6050: Fix name/chip_id when using ACPIDaniel Baluta1-3/+26
When using ACPI, id is NULL and the current code automatically defaults name to NULL and chip id to 0. We should instead use the data provided in the ACPI device table. Fixes: c816d9e7a57b ("iio: imu: mpu6050: fix possible NULL dereferences") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Reviewed-By: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05iio: imu: mpu6050: fix possible NULL dereferencesMatt Ranostay2-2/+4
Fix possible null dereferencing of i2c and spi driver data. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27iio: convert to common i2c_check_functionality() return valueMatt Ranostay1-1/+1
Previously most drivers that used a i2c_check_functionality() check condition required various error codes on failure. This patchset converts to a standard of -EOPNOTSUPP Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add mpu6500 register settingsMatt Ranostay4-6/+34
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add calibration offset supportMatt Ranostay2-2/+59
Allow setting of the x/y/z axes calibration offsets for the gyroscope and accelerometer. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: add missing docstring for int_pin_cfgMatt Ranostay1-0/+1
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delayMatt Ranostay3-3/+10
replace msleep(INV_MPU6050_REG_UP_TIME) with usleep_range calls due to fact the wait time is under 20 milliseconds. Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-25iio: imu: mpu6050: use inv_mpu6050_sensor_show return codeMatt Ranostay1-1/+1
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: mpu6050: remove trailing whitespacesMatt Ranostay1-4/+4
removed several trailing whitespaces before assignment operations Signed-off-by: Matt Ranostay <matt.ranostay@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix alignment with open parenthesisDaniel Baluta4-49/+49
This makes code consistent around inv_mpu6050 driver and fixes the following checkpatch.pl warning: CHECK: Alignment should match open parenthesis Note that there were few cases were it was not possible to fix this due to making the line too long, but we can live with that. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix code indent for if statementDaniel Baluta1-2/+2
This fixes the following checkpatch.pl warning: WARNING: suspect code indent for conditional statements (8, 24) + if (kfifo_len(&st->timestamps) > [...] + goto flush_fifo; Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Delete space before commaDaniel Baluta1-1/+1
This fixes the following checkpatch.pl warning: ERROR: space prohibited before that ',' (ctx:WxE) .shift = 0 , Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Remove unnecessary parenthesesDaniel Baluta1-2/+2
Fixes the following checkpatch warning: CHECK: Unnecessary parentheses around cpm->package.elements[i] Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix newlines to make code easier to readDaniel Baluta2-1/+2
This fixes the following checkpatch.pl warnings: * WARNING: Missing a blank line after declarations * CHECK: Blank lines aren't necessary before a close brace '}' Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix Yoda conditionsDaniel Baluta2-4/+4
This fixes the following checkpatch warning: * WARNING: Comparisons should place the constant on the right side of the test Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Acked-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-24iio: imu: inv_mpu6050: Fix multiline comments styleDaniel Baluta1-14/+23
The preffered style for long (multi-line) comments is: /* * this is a multiline * comment */ This also fixes checkpatch.pl warning: WARNING: Block comments use * on subsequent lines Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13iio: imu: inv_mpu6050: Add SPI support for MPU6000Adriana Reus6-3/+123
The only difference between the MPU6000 and the MPU6050 is that the first also supports SPI. Add SPI driver for this chip. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13iio: imu: inv_mpu6050: Separate driver into core and i2c functionality.Adriana Reus8-203/+265
Separate this driver into core and i2c functionality. This is in preparation for adding spi support. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13iio: imu: inv_mpu6050: Use regmap instead of i2c specific functionsAdriana Reus5-53/+57
Use regmap instead of i2c specific functions. This is in preparation of splitting this driver into core and i2c specific functionality. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Acked-by: Crt Mori <cmo@melexis.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-13iio: imu: inv-mpu6050: Fix interrupt pin configurationAdriana Reus2-2/+3
The select/deselect_bypass duo writes the irq number into the interrupt configuration register. If there is a i2c slave device connected to the mpu (eg. a magnetometer) then this can hinder interrupt delivery for the accelerometer and gyroscope. Set this register to the default configuration. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-01Merge tag 'iio-for-4.6a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman1-3/+2
Jonathan writes: First round of new IIO device support, features and cleanups for the 4.6 cycle. Device Support * ad5761 - new driver * at91_sama5d2 ADC. - new driver and MAINTAINERS entry. - minor cleanups followed. * atlas pH-SM - new driver (this has possibly the prettiest data sheet I've ever seen) * mcp3422 - mcp3425 ADC added. * mcp4725 - mcp4726 DAC added. * mma8452 - mma8451q accelerometer added. * mpl115 - mpl115a1 added (a lot bigger than it seems as this is an SPI part whereas previous parts were i2c). * si7005 - Hoperf th02 (seems to be a repackaged part) * si7020 - Hoperf th06 (seems to be a repackaged part) New features * Core - IIO_PH type. Does what it says on the tin. * max30100 - LED current configuration support. * mcp320x - more differential measurement combinations. * mma8452 - free fall deteciton - opt3001 - enable operation without a IRQ line. - device tree docs. Somehow the original docs have disappeared down a rabbit hole, so here is a new set. * st-sensors - Support active-low interrupts. Cleanups and minor / not so minor reworks * Documentation - drop some defunct ABI from the docs in staging. * presure / Kconfig - white space cleanup. * ad7150 - BIT macro usage - Alignment fixes * ad7192 - false indent fixed. * ak8975 - constify the ak_def structures * axp288 - drop a redundant double const. * dht11 - substantial reliability improvements by being more tolerant of missing start bits. - simplify the decoding algorithm * mma8452 - whitespace cleanup * mpl115 - don't bother setting i2c_client_data as nothing uses it. * mpu6050 - drop unused function parameter. * opt3001 - extract integration time as constants. - trivial refactoring.