summaryrefslogtreecommitdiffstats
path: root/drivers/iio/imu/adis16400_core.c
Commit message (Collapse)AuthorAgeFilesLines
* iio:imu: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron2017-08-221-1/+0Star
| | | | | | | | | The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
* iio: adis16400: Change unsigned to unsigned intReno Farnesi2017-07-021-2/+2
| | | | | | | | | This patch fixes the following checkpatch warnings: Prefer 'unsigned int' to bare use of 'unsigned Signed-off-by: Reno Farnesi <nfarnesi4@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-4.5a' of ↵Greg Kroah-Hartman2015-12-011-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new device support, features and cleanups for IIO in the 4.5 cycle Usual mixed bag, but the big item perhaps in this series is the DMA buffer support added by Lars-Peter Clausen. It's been in the works for a long time and it will be interesting to see what hardware support shows up now that this is available. New core features + associate cleanup. * Add generic DMA buffer infrastructure * Add a DMAengine framework based buffer Also associated minor changes. - Set the device buffer watermark based on the minimum watermark for all attached buffers rather than just the 'primary' one. - iio_buffer_init - only set the watermark default if one hasn't already been provided. This allows simple support for devices with a fixed watermark. - read only attribute for watermark on fixed watermark devices. - add explicit buffer enable/disable callbacks to allow the buffer to do more than trivial actions when it is being turned on and off. * IIO_VAL_INT support in write_raw_get_fmt function. New device support * Freescale MMA7455/7456L accelerometers * Memsic MXC6255XC accelerometer * ST lis2dh12 accelerometer * TI ADS8688 ADC * TI Palamas (twl6035/7) gpadc New driver features * mma8452 - support either of the available interrupt pins to cope with the case where board layout has lead to a particular one being connected. Staging graduation * Dummy driver - this driver acts as both an example and a test device for those with out hardware to develop userspace code against. Cleanups and minor bits and bobs. * treewide - Sort out the ordering of iio_device_register/unregister vs runtime pm function calls so that it's all nice and consistent and not race prone. - Check sscanf return values. None of the cases will actually happen as the strings are supplied internally, but best to be consistent on this. * ad7780 - switch over to the gpio descriptor interface and remove the now unused platform data which gets rid of a header entirely. * ad7793 - drop a pointless else statement. * at91_adc - Swap kmalloc_array in for a kmalloc doing the same job. * dummy - get rid of some commented out lines that snuck in during the move of the driver. * lm3533-als - Print an error message on provision of an invalid resistance. * mcp320x - Add compatible strings with vendor prefix and deprecate those with no vendor prefix. * mxs-lradc - Use BIT macro in various places rather than shifted ones. * pa12203001 - Power off the chip if the registration fails. * pulsedlight-lidar-lite - add runtime PM support. * xilinx XADC - constify an iio_buffer_setup_ops structure.
| * iio: imu: check sscanf return valueIoana Ciornei2015-11-081-1/+5
| | | | | | | | | | | | | | | | | | This patch fixes the following checkpatch warning: WARNING: unchecked sscanf return value Signed-off-by: Ioana Ciornei <ciorneiioana@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | spi: Drop owner assignment from spi_driversAndrew F. Davis2015-10-281-1/+0Star
|/ | | | | | | | | An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* iio: adis16400: Add ADIS16445 supportLars-Peter Clausen2015-08-081-0/+26
| | | | | | | | | The ADIS16445 is similar to the ADIS16448, but without the magnetometer and pressure channels as well as different scale factors for the gyroscope and accelerometer outputs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Add ADIS16367 supportLars-Peter Clausen2015-08-081-0/+14
| | | | | | | | The ADIS16367 is mostly register compatible to the ADIS16360. The only difference is the scale factor for the gyroscope output. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Add ADIS16305 supportLars-Peter Clausen2015-08-081-0/+1
| | | | | | | The ADIS16305 is fully register map compatible to the ADIS16300. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: adis16300 has product ID and serial numberLars-Peter Clausen2015-08-081-1/+2
| | | | | | | | The ADIS16300 has the product ID and serial number registers, they are just not documented. Set the appropriate flags so the driver makes use of them. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Fix adis16448 gyroscope scaleLars-Peter Clausen2015-08-081-1/+1
| | | | | | | | Use the correct scale for the adis16448 gyroscope output. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Fix burst transfer for adis16448Lars-Peter Clausen2015-05-161-1/+2
| | | | | | | | | | | | The adis16448, unlike the other chips in this family, in addition to the hardware channels also sends out the DIAG_STAT register in burst mode before them. Handle that case by skipping over the first 2 bytes before we pass the received data to the buffer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Fixes: 76ada52f7f5d ("iio:adis16400: Add support for the adis16448") Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Compute the scan mask from channel indicesPaul Cercueil2015-05-161-7/+18
| | | | | | | | | | | | | We unfortunately can't use ~0UL for the scan mask to indicate that the only valid scan mask is all channels selected. The IIO core needs the exact mask to work correctly and not a super-set of it. So calculate the masked based on the channels that are available for a particular device. Signed-off-by: Paul Cercueil <paul.cercueil@analog.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Fixes: 5eda3550a3cc ("staging:iio:adis16400: Preallocate transfer message") Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Use != channel indices for the two voltage channelsPaul Cercueil2015-05-161-4/+4
| | | | | | | | | | | | Previously, the two voltage channels had the same ID, which didn't cause conflicts in sysfs only because one channel is named and the other isn't; this is still violating the spec though, two indexed channels should never have the same index. Signed-off-by: Paul Cercueil <paul.cercueil@analog.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adis16400: Report pressure channel scaleLars-Peter Clausen2015-05-161-0/+5
| | | | | | | | | Add the scale for the pressure channel, which is currently missing. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Fixes: 76ada52f7f5d ("iio:adis16400: Add support for the adis16448") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: imu: adis16400: Fix sign extensionRasmus Villemoes2015-01-261-1/+2
| | | | | | | | | | | The intention is obviously to sign-extend a 12 bit quantity. But because of C's promotion rules, the assignment is equivalent to "val16 &= 0xfff;". Use the proper API for this. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: imu: adis16400 switch sampling frequency attr to core support.Jonathan Cameron2014-07-071-53/+25Star
| | | | | | | | | | By using the info_mask_shared_by_all element of the channel spec, access to the sampling frequency becomes available to in kernel users of the driver. It also shortens and simplifies the code. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
* Merge tag 'iio-for-3.15a' of ↵Greg Kroah-Hartman2014-02-111-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new drivers and cleanups for IIO in the 3.15 cycle. New drivers: * si7005 relative humidity and temperature sensor * Lite-on ltr501 ambient light and proximity sensor Cleanups * Clean up some dead comments in max1363 * Drop some obsolete variables in adjd_s311 and tcs3472 left over from the introduction of iio_push_to_buffers_with_timestamp. * Drop some unneeded linux/init.h includes * Squish a sparse warning in mpl3115 by correctly specifying a be32 variable. * A number of cleanups and fixes for sca3000 * Drop an unneed checks in mxs-lradc, ad7303 and adis16400. * Drop a platform_set_drvdata in viperboard after the only use of it was removed during a devm conversion. * Add a missing device name for ak8975 to comply with the ABI. * Put mpu6050 into the IMU menu as it slipped out into the main menu. * Fix a typo and some comment formatting in mpu6050. * Document at91 ADC clock properties.
| * iio:imu:adis16400 remove an unneeded checkDan Carpenter2014-02-031-1/+1
| | | | | | | | | | | | | | | | We know "ret" is zero here so there is no need to check. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: adis16400: Set timestamp as the last element in chan_specMarcus Folkesson2014-02-081-5/+5
|/ | | | | | | | | | | | | This is necessary since timestamp is calculated as the last element in iio_compute_scan_bytes(). Without this fix any userspace code reading the layout of the buffer via sysfs will incorrectly interpret the data leading some nasty corruption. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:imu:adis16400 fix pressure channel scan typeJonathan Cameron2013-12-171-1/+6
| | | | | | | | | | | | A single channel in this driver was using the IIO_ST macro. This does not provide a parameter for setting the endianness of the channel. Thus this channel will have been reported as whatever is the native endianness of the cpu rather than big endian. This means it would be incorrect on little endian platforms. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: stable@vger.kernel.org
* iio: imu: adis16400: Use devm_iio_device_allocSachin Kamat2013-08-031-7/+3Star
| | | | | | | | Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Manuel Stahl <manuel.stahl@iis.fraunhofer.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:imu:adis16400 move to info_mask_(shared_by_type/separate)Jonathan Cameron2013-03-171-24/+25
| | | | | | | The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
* iio:adis16400: Add support for the adis16448Lars-Peter Clausen2013-01-261-0/+36
| | | | | | | | | | The adis16448 is more or less from the same family of devices as supported by this driver. It features three acceleration channels, three angular velocity channels, three magnetometer channels, one temperature channels and one barometric pressure channel. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:adis16400: Expose some debug information in debugfsLars-Peter Clausen2013-01-261-4/+109
| | | | | | | | | Expose some information useful for debugging a device in debugfs. This includes for now the flash count, the product id and the serial number and raw register access. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:adis16400: Add support for the 52.85 Hz base sampling rateLars-Peter Clausen2013-01-261-4/+12
| | | | | | | | | | | | | | | | The adis16400 and similar have two different base sampling rate available, from which the actual sampling rate is derived. 1638 Hz and 52.85 Hz, switching to the lower base sampling rate allows to support lower sampling rates. This patch adds support for switching to the lower base sampling rate if the requested sampling frequency is outside of the range which can be supported by the higher base sampling rate. The function which is used to read the current sampling rate already has support for the lower sampling rate, so no changes are required there. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:adis16400: Increase samplerate precessionLars-Peter Clausen2013-01-261-14/+18
| | | | | | | | | The devices supported by this drivers support sample rates with less than one sample per second. To support this increase the samplerate precession to allow setting (and reading) the samplerate with a milli-HZ precession. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio: Move adis16400 out of stagingLars-Peter Clausen2013-01-261-0/+812
This adis16400 driver is in pretty good shape now, so move it out of staging. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>