summaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel
AgeCommit message (Collapse)Author
2016-07-14Merge tag 'iio-for-4.8c' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next 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-05drivers:iio:accel:mma8452: removed unwanted return statementsBijosh Thykkoottathil
Removed unwanted return statements from the function mma8452_set_freefall_mode. Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com> Acked-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-05drivers:iio:accel:mma8452: added cleanup provision in case of failure.Bijosh Thykkoottathil
mma8452_set_freefall_mode can return -ve value in case if i2c_smbus_read_byte_data fails. This function is called from mma8452_probe, and returning -ve value from probe indicates probe failure. Need to call iio_triggered_buffer_cleanup & iio_trigger_cleanup in this case. Signed-off-by: Bijosh Thykkoottathil <bijosh.t@hotmail.com> Acked-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04iio: accel: st_accel: Add lis3l02dq supportJonathan Cameron
Time to finally kill off the venerable (it was one of my first drivers) lis3l02dq driver in favour of adding support in the st sensors framework. This does loose us the event support that driver always had, but I think that will reappear at some point and in the meantime the maintenance advantages of dropping the 'special' driver for this one part outweigh the issues. It's worth noting this part is ancient and I may well be the only person who still has any on hardware running recent kernels. It has a few 'quirks'. - No WAI register so that just became optional. - A BDU option that really does block updates. Completely. Whatever you do, you don't get any more data with it set. It is documented the same as more modern parts but I presume they are actually clearing for updates after a read of both bytes! - Fixed scale. - It's too quick. Even at slowest rate (280Hz) I can't read out fast enough on my board (stargate 2) to beat new data coming in. Linus' repeat read patch doesn't help in this case. It just means I get 10 readings before dying... So in reality this will get used with software triggers only unless someone has this long out of production device on a quick board. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: Denis CIOCCA <denis.ciocca@st.com> Cc: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-04Merge 4.7-rc6 into staging-nextGreg Kroah-Hartman
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie
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-29Merge tag 'iio-for-4.8b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second round of new iio device support, features and cleanups in the 4.8 cycle Firstly some contact detail updates: * NXP took over freescale. Update the mma8452 header to reflect this. * Martin Kepplinger email address change in mma8452 header. * Adriana Reus has changed email address. Update .mailmap. * Matt Ranostay has changed email address. Update .mailmap. New Device Support * max1363 - add the missing i2c_device_ids for a couple of parts so they can actually be used. * ms5867 - add device ids for ms5805 and ms5837 parts. New Features * ad5755 - DT support. This one was a bit controversial and under review for a long time. Still no one could come up with a better solution. * stx104 - add gpio support * ti-adc081c - Add ACPI device ID matching. Core changes * Refuse to register triggers with duplicate names. There is no way to distinguish between them so this makes no sense. A few drivers do not generate unique names for each instance of the device present. We can't fix this without changing ABI so leave them and wait for someone to actually take the rare step of two identical accelerometers on the same board. * buffer-dma - use ARRAY_SIZE in a few appropriate locations. Tools * Fix the fact that the --trigger-num option in generic_buffer didn't allow 0 which is perfectly valid in the ABI. Cleanups * as3935 - improve error reporting. - remove redundant zeroing of a field in iio_priv. * gp2ap020a00f - use the iio_device_claim_*_mode helpers rather than open coding locking around mode changes. * isl29125 - use the iio_device_claim_*_mode helpers rather than open coding locking. * lidar - use the iio_device_claim_*_mode helpers rather than open coding locking. * mma8452 - more detail in devices supported description in comments (addresses and similar) * sca3000 - add a missing error check. * tcs3414 - use the iio_device_claim_*_mode helpers rather than open coding locking. * tcs3472 - use the iio_device_claim_*_mode helpers rather than open coding locking.
2016-06-26iio: accel: kxsd9: fix the usage of spi_w8r8()Linus Walleij
These two spi_w8r8() calls return a value with is used by the code following the error check. The dubious use was caused by a cleanup patch. Fixes: d34dbee8ac8e ("staging:iio:accel:kxsd9 cleanup and conversion to iio_chan_spec.") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-20Merge 4.7-rc4 into staging-nextGreg Kroah-Hartman
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: mma8452: update Freescale company informationMartin Kepplinger
NXP took over Freescale, so add NXP to the driver descriptions Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-11iio: mma8452: update device description in header commentsMartin Kepplinger
Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-11iio: mma8452: update contact information for Martin KepplingerMartin Kepplinger
Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-09Merge tag 'iio-for-4.8a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next 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-05-29iio: st_sensors: switch to a threaded interruptLinus Walleij
commit 98ad8b41f58dff6b30713d7f09ae3834b8df7ded ("iio: st_sensors: verify interrupt event to status") caused a regression when reading ST sensors from a HRTimer trigger rather than the intrinsic interrupts: the HRTimer may trigger faster than the sensor provides new values, and as the check against new values available as a cause of the interrupt trigger was done in the poll function, this would bail out of the HRTimer interrupt with IRQ_NONE. So clearly we need to only check the new values available from the proper interrupt handler and not from the poll function, which should rather just read the raw values from the registers, put them into the buffer and be happy. To achieve this: switch the ST Sensors over to using a true threaded interrupt handler. In the interrupt thread, check if new values are available, else yield to the (potential) next device on the same interrupt line to check the registers. If the interrupt was ours, proceed to poll the values. Instead of relying on iio_trigger_generic_data_rdy_poll() as a top half to wake up the thread that polls the sensor for new data, have the thread call iio_trigger_poll_chained() after determining that is is the proper source of the interrupt. This is modelled on drivers/iio/accel/mma8452.c which is already using a properly threaded interrupt handler. In order to get the same precision in timestamps as previously, where samples would be timestamped in the poll function pf->timestamp when calling iio_trigger_generic_data_rdy_poll() we introduce a local timestamp in the sensor data, set it in the top half (fastpath) of the interrupt handler and provide that to the core when calling iio_push_to_buffers_with_timestamp(). Additionally: if the active scanmask is not set for the sensor no IRQs should be enabled and we need to bail out with IRQ_NONE. This can happen if spurious IRQs fire when installing the threaded interrupt handler. Tested with hard interrupt triggers on LIS331DL, then also tested with hrtimers on the same sensor by creating a 75Hz HRTimer and using it to poll the sensor. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Reported-by: Crestez Dan Leonard <cdleonard@gmail.com> Tested-by: Crestez Dan Leonard <cdleonard@gmail.com> Tested-by: Jonathan Cameron <jic23@kernel.org> Fixes: 97865fe41322 ("iio: st_sensors: verify interrupt event to status") Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29iio:st_sensors: fix power regulator usageGregor Boirie
Ensure failure to enable power regulators is properly handled. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-21iio: accel: Add triggered buffer support for BMA220Tiberiu Breana
Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-14iio: accel: Add support for Bosch BMA220Tiberiu Breana
This commit adds basic support for the Bosch Sensortec BMA220 digital triaxial acceleration sensor. The device datasheet can be found here: http://www.mouser.com/pdfdocs/BSTBMA220DS00308.PDF Includes: - raw readings - ACPI detection - power management Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: mma8452: add support for oversampling ratioMartin Kepplinger
This adds the following sysfs files according to the iio ABI: -rw-r--r-- 4096 in_accel_oversampling_ratio -r--r--r-- 4096 in_accel_oversampling_ratio_available Internally, the device knows about 4 different power modes that differ in oversampling ratio (and power consumption). We just show the user what oversampling ratio(s) is/are available, depending on the current frequency. The referenced table in the datasheets makes it easier to understand. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-04iio: accel: Add support for Freescale MMA7660FCConstantin Musca
Minimal implementation of an IIO driver for the Freescale MMA7660FC 3-axis accelerometer. Datasheet: http://www.nxp.com/files/sensors/doc/data_sheet/MMA7660FC.pdf Includes: - ACPI support; - read_raw for x,y,z axes; - reading and setting the scale (range) parameter. - power management Signed-off-by: Constantin Musca <constantin.musca@intel.com> Reviewed-by: Martin Klepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-26Merge tag 'iio-for-4.7b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing 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-19iio: accel: bmc150: use regmap to retrieve struct deviceAlison Schofield
Driver includes struct regmap and struct device in its global data. Remove the struct device and use regmap API to retrieve device info. Patch created using Coccinelle plus manual edits. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Reviewed-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19iio: st_sensors: support open drain modeLinus Walleij
Some types of ST Sensors can be connected to the same IRQ line as other peripherals using open drain. Add a device tree binding and a sensor data property to flip the right bit in the interrupt control register to enable open drain mode on the INT line. If the line is set to be open drain, also tag on IRQF_SHARED to the IRQ flags when requesting the interrupt, as the whole point of using open drain interrupt lines is to share them with more than one peripheral (wire-or). Cc: devicetree@vger.kernel.org Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Acked-by: Rob Herring <rob@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-19iio: st_sensors: verify interrupt event to statusLinus Walleij
This makes all ST sensor drivers check that they actually have new data available for the requested channel(s) before claiming an IRQ, by reading the status register (which is conveniently the same for all ST sensors) and check that the channel has new data before proceeding to read it and fill the buffer. This way sensors can share an interrupt line: it can be flaged as shared and then the sensor that did not fire will return NO_IRQ, and the sensor that fired will handle the IRQ and return IRQ_HANDLED. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-11Merge 4.6-rc3 into staging-nextGreg Kroah-Hartman
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-10iio: accel: mma7455: use regmap to retrieve struct deviceAlison Schofield
Driver includes struct regmap and struct device in its global data. Remove the struct device and use regmap API to retrieve device info. Patch created using Coccinelle plus manual edits. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Joachim Eastwood <manabian@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: bmc150: use common definition for regmap confIrina Tirdea
bmc150_i2c_regmap_conf is defined three times (in bmc150-accel-core.c, bmc150-accel-i2c.c and and bmc150-accel-spi.c), although the definition is the same. Use one common definition for bmc150_i2c_regmap_conf in all included files. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: bmc150: fix endianness when reading axesIrina Tirdea
For big endian platforms, reading the axes will return invalid values. The device stores each axis value in a 16 bit little endian register. The driver uses regmap_read_bulk to get the axis value, resulting in a 16 bit little endian value. This needs to be converted to cpu endianness to work on big endian platforms. Fix endianness for big endian platforms by converting the values for the axes read from little endian to cpu. This is also partially fixed in commit b6fb9b6d6552 ("iio: accel: bmc150: optimize transfers in trigger handler"). Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: remove gpio interrupt probing from drivers that use a single interruptIrina Tirdea
Commit 845c877009cf014b ("i2c / ACPI: Assign IRQ for devices that have GpioInt automatically") automatically assigns the first ACPI GPIO interrupt in client->irq, so we can remove the probing code from drivers that use only one interrupt. Commit 0f0796509c07c1c7 ("iio: remove gpio interrupt probing from drivers that use a single interrupt") removes gpio interrupt probing from most drivers. This patch cleans the remaining ones. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: remove unused gpio consumer.h includeIrina Tirdea
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-04-03iio: accel: kxcjk-1013: optimize i2c transfers in trigger handlerAdriana Reus
Some i2c busses (e.g.: Synopsys DesignWare I2C adapter) need to enable/disable the bus at each i2c transfer and must wait for the enable/disable to happen before sending the data. When reading data in the trigger handler, the kxcjk-1013 accel driver does one i2c transfer for each axis. This has an impact on the frequency of the accelerometer at high sample rates due to additional delays introduced by the i2c bus at each transfer. Reading all axis values in one i2c transfer reduces the delays introduced by the i2c bus. Uses i2c_smbus_read_i2c_block_data_or_emulated that will fallback to reading each axis as a separate word in case i2c block read is not supported. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: kxcjk-1013: use available_scan_masksAdriana Reus
Use available_scan_masks to allow the iio core to select the data to send to userspace depending on which axes are enabled, instead of doing this in the driver's interrupt handler. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: bmc150: optimize transfers in trigger handlerIrina Tirdea
Some i2c busses (e.g.: Synopsys DesignWare I2C adapter) need to enable/disable the bus at each i2c transfer and must wait for the enable/disable to happen before sending the data. When reading data in the trigger handler, the bmc150 accel driver does one bus transfer for each axis. This has an impact on the frequency of the accelerometer at high sample rates due to additional delays introduced by the bus at each transfer. Reading all axis values in one bus transfer reduces the delays introduced by the bus. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-03iio: accel: bmc150: use available_scan_masksIrina Tirdea
Use available_scan_masks to allow the iio core to select the data to send to userspace depending on which axes are enabled, instead of doing this in the driver's interrupt handler. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: mma8452: use runtime pm instead of device specific autosleepMartin Kepplinger
What is this autosleep? ----------------------- It slows down the device after x seconds of inactivity. The thing is, we have really achieved almost the same by runtime pm. differnces are: autosleep * uses more power during inactivity * the first read after inactivity slightly faster * complicated to understand for the user * no documented sysfs interface (afaik) * complicated to read and maintain runtime pm * already merged in mma8452 * uses less power during inactivity * first read after inactivity slower * easy to use. well documented. * easy to maintain and understand The two approaches solve the same problem. runtime pm has more advantages than autosleep and comes quite close to it's behaviour anyways. As I see it, autosleep, even if somehow supported, would never be used anyways. So resolve this issue by "ignoring" autosleep. Signed-off-by: Martin Kepplinger <martink@posteo.de> Reviewed-by: Martina Kepplinger <martina.novakovic@zoho.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: mma8452: add i2c_device_id for mma8451Martin Kepplinger
This was forgotten about and is added for consistency now Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-12iio: mma8452: add support for FXLS8471QMartin Kepplinger
This adds support for Freescale's (now NXP's) FXLS8471Q accelerometer. We use MMA8451Q's configuration because for what the driver supports, FXLS8471Q is the same. Support for FXLS8471Q's features (fast SPI interface and a larger FIFO, among others) can be added to this driver anytime. See it's datasheet for the details: http://cache.nxp.com/files/sensors/doc/data_sheet/FXLS8471Q.pdf Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-12iio: accel: Add support for the h3lis331dl accelerometerTiberiu Breana
This commit adds support for STMicroelectronics h3lis331dl high-g accelerometer. The datasheet for this device can be found here: http://www.st.com/web/en/resource/technical/document/ datasheet/DM00053090.pdf Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Reviewed-by: Denis Ciocca <denis.ciocca@st.com> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05iio: mma8452: add support for runtime power managementMartin Kepplinger
This adds support for runtime power management and, if configured, activates automatic standby after 2 seconds of inactivity. Inactivity means no read of acceleration values and no events triggered or activated. If CONFIG_PM is not set, this doesn't change anything for existing users. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05iio: mma8452: avoid switching to active because of config changeMartin Kepplinger
The devices' config registers can only be changed in standby mode. Up until now the driver just held the device *always* active, so for changing a config it was *always* necessary to switch to standby. For upcoming support for runtime pm, the device can as well be in standby mode. Instead of putting runtime pm functions in there, just keep the device in standby if it already is. This section is protected by a lock after all. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-05iio: mma8452: coding style fixesMartin Kepplinger
fix checkpatch issues like "space before tabs", too long lines or alignment. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-07Merge 4.5-rc3 into staging-nextGreg Kroah-Hartman
We want the upstream staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-01Merge tag 'iio-fixes-for-4.5a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: First set of IIO fixes for the 4.5 cycle. This set comprises those not dependent on patches in the 4.5 merge cycle. A second set will follow shortly with ones that are. * core in kernel interfaces - fix a possible NULL dereference that is a theoretical possibility via odd usage of iio_channel_release. Pretty much a hardening of the interface, but observed in the wild with the twl4030_charger driver. * acpi-als - report the data as processed as it is in lux. This fixes a wrong use of the IIO ABI. However, old _raw version retained to avoid breaking any userspace in the wild that is relying on that (none known but it doesn't hurt us much to retain it) * ade7753 - fix some error handling to avoid use of unitialized data. * ltr501 - use a signed return type for ltr501_match_samp_freq so as to allow returning of an error code. * mcp4725 - set name field of struct iio_dev to ensure the sysfs name attribute doesn't give NULL. * mpl115 - temperature offset sign is wrong. * stk8ba50 - IIO_TRIGGER dependency added * ti_am335x_adc - Label buffer as a software buffer. It's actually a hybrid of a true hardware buffer feeding a kfifo, but the meaning of these fields has changed a little recently and in this case it should be labeled a software buffer ensure it is allowed to use the kfifo. * vf610_adc - HAS_IOMEM dependency
2016-01-23iio: mma8452: add support for MMA8451QMartin Kepplinger
This adds support for this series' 14 bit accelerometer chip, MMA8451Q. It's datasheet is available at the vendor's website: https://cache.freescale.com/files/sensors/doc/data_sheet/MMA8451Q.pdf Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-23iio: mma8452: whitespace cleanupMartin Kepplinger
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-23iio: mma8452: add freefall detection for Freescale's accelerometersMartin Kepplinger
This adds freefall event detection to the supported devices. It adds the in_accel_x&y&z_mag_falling_en iio event attribute, which activates freefall mode. In freefall mode, the current acceleration magnitude (AND combination of all axis values) is compared to the specified threshold. If it falls under the threshold (in_accel_mag_falling_value), the appropriate IIO event code is generated. This is what the sysfs "events" directory for these devices looks like after this change: -rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_falling_period -rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_falling_value -rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_rising_period -rw-r--r-- 4096 Oct 23 08:45 in_accel_mag_rising_value -r--r--r-- 4096 Oct 23 08:45 in_accel_scale -rw-r--r-- 4096 Oct 23 08:45 in_accel_x&y&z_mag_falling_en -rw-r--r-- 4096 Oct 23 08:45 in_accel_x_mag_rising_en -rw-r--r-- 4096 Oct 23 08:45 in_accel_y_mag_rising_en -rw-r--r-- 4096 Oct 23 08:45 in_accel_z_mag_rising_en Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-10iio: st_sensors: support active-low interruptsLinus Walleij
Most ST MEMS Sensors that support interrupts can also handle sending an active low interrupt, i.e. going from high to low on data ready (or other interrupt) and thus triggering on a falling edge to the interrupt controller. Set up logic to inspect the interrupt line we get for a sensor: if it is triggering on rising edge, leave everything alone, but if it triggers on falling edges, set up active low, and if unsupported configurations appear: warn with errors and reconfigure the interrupt to a rising edge, which all interrupt generating sensors support. Create a local header for st_sensors_core.h to share functions between the sensor core and the trigger setup code. Cc: Giuseppe Barba <giuseppe.barba@st.com> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-04iio: add IIO_TRIGGER dependency to STK8BA50Vegard Nossum
Ran into this on UML: drivers/iio/accel/stk8ba50.c: In function ‘stk8ba50_data_rdy_trigger_set_state’: drivers/iio/accel/stk8ba50.c:163:9: error: implicit declaration of function ‘iio_trigger_get_drvdata’ [-Werror=implicit-function-declaration] iio_trigger_get_drvdata() is defined only when IIO_TRIGGER is selected. Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19iio: mma8452: use enum for channel indexMartin Kepplinger
This gets rid of some magic numbers by adding an enum. Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-19iio: mma8452: remove unused register descriptionMartin Kepplinger
Signed-off-by: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-12-01Merge tag 'iio-for-4.5a' of ↵Greg Kroah-Hartman
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.