summaryrefslogtreecommitdiffstats
path: root/drivers/iio
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'iio-for-v4.2c' of ↵Greg Kroah-Hartman2015-06-1012-96/+829
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Third round of new IIO drivers, cleanups and functionality for the 4.2 cycle. Given Linus announced a 4.8rc coming up, hopefully time for one more lot of IIO patches this cycle. Some of these are actually improvements / fixes for patches earlier in the cycle. New device support * st_accel driver - support devices with 8 bit channels. Cleanup * A general cleanup of the iio tools under /tools/ from Hartmut. I'm more than a little embarassed by how bad some of these were! Are well, much more refined and less bug prone now. These cover lots of stuff like unhandled error returns, memory leaks as well as general refactoring to tidy the code up. * iio_simple_dummy - fix memory leaks in the init functions, drop some pointless error returns from functions that never generate errors and make the module parameter explicitly unsigned. * More buffer handling reworks from Lars-Peter, this time targetting hardware buffers (a little used corner that looks likely to get more use in the near future). Specifically: - Always compute the masklength as inkernel buffer users may need it. - Add a means of labeling which buffer modes a given buffer implementation supports. - In the case of hardware buffers, require strict scan matching rather than matching to a superset. Currently the demux is bypassed by these drivers (this may well not change for efficiency reasons) so allowing a superset of channels to be selected would otherwise lead to more data than requested confusing userspace. Driver funcationality improvments * mmc35240 - adds a compensation to the raw values as borrowed form Memsic's own input driver. * mma8452 - event support - event debouncing - high pass filter configuration - triggers * vf610 - allow conversion mode to be adjusted Fixlets * mmc35240 - Off by one error that by coincidence had no real effect. - i2c_device_name should be lowercase. - Lack of null terminator at end of attributes array. - Avoid computing the fractional part of the magnetic field by moving the scaling into userspace where floating point is available to simplify the maths. - Use a smaller sleep before assuming the measurement is done. This is safe and improves the possible polling rate. - Fix sensitivity on z-axis - datasheet disagrees with Memsic's releasedd code and the value used in the code seems to be correct. * stk3310 - make a local variable signed to ensure error handling works. * twl4030 - fix calculation of the temperature sense current - bug unlikely to have ever been noticed as the difference is small. - Fix errors in descriptions.
| * iio: st_accel: support the LIS331DL sensorLinus Walleij2015-06-083-0/+75
| | | | | | | | | | | | | | | | | | This adds support for the LIS331DL sensor version. This is a simple 8bit-only accelerometer. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: st_accel: support 8bit channel dataLinus Walleij2015-06-072-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | Some sensors like the LIS331DL only support 8bit data by a single register per axis. These utilize the MSB byte. Make it possible to register these apropriately. A oneliner change is needed in the ST sensors core to handle 8bit reads as this is the first supported 8bit sensor. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: adc: vf610: implement configurable conversion modesStefan Agner2015-06-071-42/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support configurable conversion mode through sysfs. So far, the mode used was low-power, which is enabled by default now. Beside that, the modes normal and high-speed are selectable as well. Use the new device tree property which specifies the maximum ADC conversion clock frequencies. Depending on the mode used, the available resulting conversion frequency are calculated dynamically. Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: adc: twl4030_madc: Fix description of twl4030_madc_set_current_generator()H. Nikolaus Schaller2015-06-071-4/+2
| | | | | | | | | | | | | | | | The @chan parameter can be 0 or 1 and not a bit mask. Fix wrong description. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: adc: twl4030_madc: Fix calculation of the temperature sense currentH. Nikolaus Schaller2015-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | The bit mask to read the setting of the constant current source for measuring the NTC voltage was the wrong one. Since default value is initialized to the lowest level (000 = 10uA) the difference was probably never noticed in practice. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: mma8452: Add support for interrupt driven triggers.Martin Fuzzey2015-06-071-6/+91
| | | | | | | | | | | | | | | | Implement interrupt driven trigger for data ready. This allows more efficient access to the sample data. Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: mma8452: Add highpass filter configuration.Martin Fuzzey2015-06-071-4/+136
| | | | | | | | | | | | | | Allow the cutoff frequency of the high pass filter to be configured. Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: mma8452: Add support for transient event debouncingMartin Fuzzey2015-06-071-11/+65
| | | | | | | | | | | | | | | | Allow the debouce counter for transient events to be configured using the sysfs attribute events/in_accel_thresh_rising_period Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: mma8452: Basic support for transient events.Martin Fuzzey2015-06-071-1/+211
| | | | | | | | | | | | | | | | The event is triggered when the highpass filtered absolute acceleration exceeds the threshold. Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: Add compensation for raw valuesDaniel Baluta2015-06-071-4/+58
| | | | | | | | | | | | | | | | This patch adds compensation formula to raw readings, borrowed from Memsic's input driver. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: Fix sensitivity on z-axisDaniel Baluta2015-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Datasheet says (Page 2) that typical value for sensitivity for 16 bits mode on Z-axis is 770. Anyhow, looking at the input driver provided by Memsic the value for MMC35240 is 1024. Also, testing shows that using 1024 for Z-axis senzitivity offers better results. Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: Use a smaller sleep valueDaniel Baluta2015-06-071-1/+2
| | | | | | | | | | | | | | | | | | | | According to datasheet, Page 8, minimum wait time to complete measurement is 10ms. Adjusting this value will increase the userspace polling rate. Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: Fix broken processed valueDaniel Baluta2015-06-071-16/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The current computation for fractional part of the magnetic field is broken. This patch fixes it by taking a different approach. We expose the raw reading in milli Gauss (to avoid rounding errors) with a scale of 0.001. Thus the final computation is done in userspace where floating point operation are more relaxed. Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: NULL terminate attribute arrayDaniel Baluta2015-06-071-0/+1
| | | | | | | | | | | | | | | | This avoid nasty crashes when registering the IIO device. Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: mmc35240: i2c device name should be lower caseDaniel Baluta2015-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | This is the standard convention for i2c device name and also this is the name used in some Intel platforms DT files. Fixes: abeb6b1e7b ("iio: magnetometer: Add support for MEMSIC MMC35240") Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: light: signedness bug in stk3310_write_raw()Dan Carpenter2015-06-011-1/+1
| | | | | | | | | | | | | | | | "index" needs to be signed for the error handling to work. Fixes: be9e6229d676 ('iio: light: Add support for Sensortek STK3310') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: magnetometer: correct a harmless off by one checkDan Carpenter2015-06-011-1/+1
| | | | | | | | | | | | | | | | | | The line before limits i to 0-3 so the existing code works fine but the check is still off by one and >= is intended instead of >. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Require strict scan mask matching in hardware modeLars-Peter Clausen2015-06-011-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | In hardware mode we can not use the software demuxer, this means that the selected scan mask needs to match one of the available scan masks exactly. It also means that all attached buffers need to use the same scan mask. Given that when operating in hardware mode there is typically only a single buffer attached to the device this not an issue. Add a sanity check to make sure that only a single buffer is attached in hardware mode nevertheless. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Specify supported modes for buffersLars-Peter Clausen2015-06-013-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For each buffer type specify the supported device modes for this buffer. This allows us for devices which support multiple different operating modes to pick the correct operating mode based on the modes supported by the attached buffers. It also prevents that buffers with conflicting modes are attached to a device at the same time or that a buffer with a non-supported mode is attached to a device (e.g. in-kernel callback buffer to a device only supporting hardware mode). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: Always compute masklengthLars-Peter Clausen2015-06-011-6/+9
| | | | | | | | | | | | | | | | | | | | Even if no userspace consumer buffer is attached to the IIO device at registration we still need to compute the masklength, since it is possible that a in-kernel consumer buffer is going to get attached to the device at a later point. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: buffer: remove unneeded testLaurent Navet2015-06-011-2/+0
| | | | | | | | | | | | | | | | | | The same code is executed regardless ret value, so this test can be removed. Also fix coverity scan CID 1268786. Signed-off-by: Laurent Navet <laurent.navet@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge 4.1-rc7 into staging-testingGreg Kroah-Hartman2015-06-084-21/+50
|\ \ | | | | | | | | | | | | | | | | | | We want the staging tree fixes in here too to help with testing and merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | iio: adc: twl6030-gpadc: Fix modaliasAxel Lin2015-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Remove extra space between platform prefix and DRIVER_NAME in MODULE_ALIAS. Signed-off-by: Axel Lin <axel.lin@ingics.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: adis16400: Fix burst transfer for adis16448Lars-Peter Clausen2015-05-163-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Fix burst modePaul Cercueil2015-05-161-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few issues with the burst mode support. For one we don't setup the rx buffer, so the buffer will never be filled and all samples will read as the zero. Furthermore the tx buffer has the wrong type, which means the driver sends the wrong command and not the right data is returned. The final issue is that in burst mode all channels are transferred. Hence the length of the transfer length should be the number of hardware channels * 2 bytes. Currently the driver uses indio_dev->scan_bytes for this. But if the timestamp channel is enabled the scan_bytes will be larger than the burst length. Fix this by just calculating the burst length based on the number of hardware channels. 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: Compute the scan mask from channel indicesPaul Cercueil2015-05-162-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge tag 'iio-for-v4.2b' of ↵Greg Kroah-Hartman2015-05-2439-248/+4874
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle. Core functionality * i and q modifiers from quadrature channels. * IIO_CHAN_INFO_OVERSAMPLING_RATIO added. * High pass filter attributes added to mirror the existing low pass filter ones. Core cleanups * Make IIO tools building more cross compiler friendly. * Substantial rework of the function __iio_update_buffers to greatly simplify a hideously evolved function. New drivers and support * ACPI0008 ambient light sensor driver. This one has been around a long time to will be good to finally get it into mainline. * Berlin SOC ADC support. * BMC150 magnetometer. The accelerometer in the same package has been supported for quite some time, so good to have this half as well. * m62332 DAC driver * MEMSIC MMC35420 magnetometer. * ROHM BH1710 and similar ambient light sensors. * Sensortek STK3310 light sensor. * Sensortek STK8312 accelerometer. * Sensortek STK8BA50 accelerometer. * ti-adc128s052 gains support form the adc122s021 2 channel ADC. Driver cleanups and functionality. * Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled. * bmc150 - decouple trigger from buffer to allow other triggers to be used. * bmg160 - decouple trigger from buffer to allow other triggers to be used. Fix a trivial unused field. * Constify a load of platform_device_id structures. * inv_mpu6050 - device tree bindings. * hid-sensors - fix a memory leak during probe if certain errors occur. * ltr501 - illuminance channel derived (in an non obvious fashion) from the intensity channels. * ltr501 - fix a boundary check on the proximity threshold. * mlx90614 - drop a pointless return. * mma8452 - Debugfs register access and fix a bug that had no effect (by coincidence) * ti_am335x_adc - add device tree bindings for sample-delay, open-delay and averaging. The ideal settings for these tend to be board design specific.
| * | iio: accel: Add support for Sensortek STK8BA50Tiberiu Breana2015-05-233-0/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minimal implementation of an IIO driver for the Sensortek STK8BA50 3-axis accelerometer. Datasheet: http://szgsensor.com/uploads/soft/141229/STK8BA50%D2%E5%BC%CE.pdf Includes: - ACPI support; - read_raw for x,y,z axes; - reading and setting the scale (range) parameter. - power management Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: __iio_update_buffers: Leave device in sane state on errorLars-Peter Clausen2015-05-231-36/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when something goes wrong at some step when disabling the buffers we immediately abort. This has the effect that the enable/disable calls are no longer balanced. So make sure that even if one step in the disable sequence fails the other steps are still executed. The other issue is that when either enable or disable fails buffers that were active at that time stay active while the device itself is disabled. This leaves things in a inconsistent state and can cause unbalanced enable/disable calls. Furthermore when enable fails we restore the old scan mask, but still keeps things disabled. Given that verification of the configuration was performed earlier and it is valid at the point where we try to enable/disable the most likely reason of failure is a communication failure with the device or maybe a out-of-memory situation. There is not really a good recovery strategy in such a case, so it makes sense to leave the device disabled, but we should still leave it in a consistent state. What the patch does if disable/enable fails is to deactivate all buffers and make sure that the device will be in the same state as if all buffers had been manually disabled. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: __iio_update_buffers: Split enable and disable path into helper functionsLars-Peter Clausen2015-05-231-88/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __iio_update_buffers is already a rather large function with many different error paths and it is going to get even larger. This patch factors out the device enable and device disable paths into separate helper functions. The patch also re-implements iio_disable_all_buffers() using the new iio_disable_buffers() function removing a fair bit of redundant code. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: __iio_update_buffers: Verify configuration before starting to apply itLars-Peter Clausen2015-05-231-63/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently __iio_update_buffers() verifies whether the new configuration will work in the middle of the update sequence. This means if the new configuration is invalid we need to rollback the changes already made. This patch moves the validation of the new configuration at the beginning of __iio_update_buffers() and will not start to make any changes if the new configuration is invalid. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio:adc128s052: add support for adc122s021Urs Fässler2015-05-232-8/+26
| | | | | | | | | | | | | | | Signed-off-by: Urs Fässler <urs.fassler@bytesatwork.ch> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: Add I/Q modifiersLars-Peter Clausen2015-05-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I/Q modifiers can be used to denote signals which are represented by a in-phase and a quadrature component. The ABI documentation describes the I and Q modifiers for current and voltage channels for now as those will be the most likely users. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: adc: add support for BerlinAntoine Tenart2015-05-233-0/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the support of the Berlin ADC, available on Berlin SoCs. This ADC has 8 channels available, with one connected to a temperature sensor. The particularity here, is that the temperature sensor connected to the ADC has its own registers, and both the ADC and the temperature sensor must be configured when using it. Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: accel: Add support for Sensortek STK8312Tiberiu Breana2015-05-173-0/+403
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Minimal implementation of an IIO driver for the Sensortek STK8312 3-axis accelerometer. Datasheet: http://www.syi-group.com/uploadpic/data/201361817562681623.pdf Includes: - ACPI support; - read_raw for x,y,z axes; - reading and setting the scale (range) parameter. - power management Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: accel: bmc150: decouple buffer and triggersVlad Dogaru2015-05-171-20/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the interrupt pins are not available, we should still be able to use the buffer with an external trigger. However, we won't be able to use the hardware fifo since we have no means of signalling when the watermark is reached. I also added a comment to indicate that the timestamps in bmc150_accel_data are only used for hardware fifo, since initially I was confused about duplication with pf->timestamp. Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Reviewed-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: core: add high pass filter attributesMartin Fuzzey2015-05-172-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a high pass filter attribute for measurements (like the existing low pass) Also add both high and low pass attributes for events. Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: mma8452: Add access to registers via DebugFSMartin Fuzzey2015-05-171-0/+25
| | | | | | | | | | | | | | | Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: mma8452: Initialise before activatingMartin Fuzzey2015-05-171-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many of the hardware configuration registers may only be modified while the device is inactive. Currently the probe code first activates the device and then modifies the registers (eg to set the scale). This doesn't actually work but is not noticed since the scale used is the default value. While at it also issue a hardware reset command at probe time. Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: gyro: bmg160: decouple buffer and triggersVlad Dogaru2015-05-171-24/+32
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to use buffering with an external trigger, such as one based on sysfs or hrtimer. Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: gyro: bmg160: remove redundant fieldVlad Dogaru2015-05-171-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the 'timestamp' field in struct bmg160_data with the identically named field in iio_poll_func and with calls to iio_get_time_ns(). The reported timestamps may be slightly different, but the advantage is that we no longer assume that the buffer of bmg160 is triggered by its own trigger. Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: __iio_update_buffers: Perform request_update() only for new buffersLars-Peter Clausen2015-05-171-11/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only have to call the request_update() callback for a newly inserted buffer. The configuration of the already previously active buffers will not have changed. This also allows us to move the request_update() call to the beginning of __iio_update_buffers(), before any currently active buffers are stopped. This makes the error handling a lot easier since no changes were made to the buffer list and no rollback needs to be performed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: __iio_update_buffers: Slightly refactor scan mask memory managementLars-Peter Clausen2015-05-171-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a small helper function iio_free_scan_mask() that takes a mask and frees its memory if the scan masks for the device are dynamically allocated, otherwise does nothing. This means we don't have to open-code the same check over and over again in __iio_update_buffers. Also free compound_mask as soon a we are done using it. This constrains its usage to a specific region of the function will make further refactoring and splitting the function into smaller sub-parts more easier. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: Replace printk in __iio_update_buffers with dev_dbgLars-Peter Clausen2015-05-171-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While more verbose error messages are useful for debugging we should really not put those error messages into the kernel log for normal errors that are already reported to the application via the error code, when running in non-debug mode. Otherwise application authors might expect that this is part of the ABI and to get the error they should scan the kernel log. Which would be rather error prone itself since there is no direct mapping between a operation and the error message so it is impossible to find out which error message belongs to which error. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: add m62332 DAC driverDmitry Eremin-Solenikov2015-05-173-0/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | m62332 is a simple 2-channel DAC used on several Sharp Zaurus boards to control LCD voltage, backlight and sound. The driver use regulators to control the reference voltage and enabling/disabling the DAC. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: ltr501: Add light channel supportKuppuswamy Sathyanarayanan2015-05-171-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added support to calculate lux value from visible and IR spectrum adc count values. Also added IIO_LIGHT channel to enable user read the lux value directly from device using illuminance input ABI. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * | iio: pressure: hid-sensor-press: Fix memory leak in probe()Fabio Estevam2015-05-171-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'channels' is allocated via kmemdup and it is never freed in the subsequent error paths. Use 'indio_dev->channels' directly instead, so that we avoid such memory leak problem. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>