summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-08-08tools: iio: Set caller's ci_array pointer to NULL after freeJoo Aun Saw1-0/+2
On error, caller's ci_array is freed and set to NULL to avoid potential double free if some other user of this code is not sufficiently careful. Counter is reset to zero for consistency. Signed-off-by: Joo Aun Saw <jasaw@dius.com.au> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: Fix typos in ABI documentationVladimir Barinov1-3/+3
Fix typos in ABI documentation Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: reorder Kconfig entryHartmut Knaack1-12/+12
Move the entry in Kconfig to its alphabetically correct position. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: coding style cleanupHartmut Knaack1-38/+68
Some coding style cleanups, mainly indicated by checkpatch.pl, which includes indentation changes, drop spaces after casts and befor tabs. Also insert empty lines after logical blocks and before unconditional returns. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: rework register definitionsHartmut Knaack1-48/+45
Rework register definitions to be sorted by register and bit number, with bit definitions cascaded under the appropriate register, use GENMASK for consecutive bitmasks and realign properly. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: check values to be writtenHartmut Knaack1-3/+5
Check values to be written to the device for valid lower and upper bounds. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: pass up real error codeHartmut Knaack1-3/+3
Pass up the error code provided by functions. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: drop double includeHartmut Knaack1-1/+0
One inclusion of linux/iio/trigger_consumer.h is sufficient. Fixes: ae6d9ce05691b ("iio: mma8452: Add support for interrupt driven triggers.") Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:mma8452: fix _get_hp_filter_indexHartmut Knaack1-1/+1
To iterate through the available frequencies of mma8452_hp_filter_cutoff[], the array size of a row of that table needs to be provided to _get_int_plus_micros_index(). Fixes: 1e79841a00e46 ("iio: mma8452: Add highpass filter configuration.") Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:bmc150-accel: Use the chip ID to detect sensor variantBastien Nocera1-27/+19
Instead of using the I2C or ACPI ID to determine which variant of the chipset to use, determine that from the chip ID. Under Windows, the same driver is used for those variants and, despite incorrect ACPI data, it is able to load and operate the accelerometer. Fixes the accelerometer failing with: bmc150_accel i2c-BMA250E:00: Invalid chip f8 on the WinBook TW100 Signed-off-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:bmc150-accel: Move bmc150_accel_chip_init()Bastien Nocera1-57/+57
Move bmc150_accel_chip_init() so that we can use bmc150_accel_chip_info_tbl[] in it. Signed-off-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08staging: iio_simple_dummy: Fix indentation errorsLars Svensson1-2/+2
Fixing indentation errors in drivers/staging/iio/iio_simple_dummy_events.c. Signed-off-by: Lars Svensson <lars1.svensson@sonymobile.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: adis16136: Add ADIS16137 supportLars-Peter Clausen1-0/+6
The ADIS16137 is register map compatible to the ADIS16136, but has a different scale factor for the gyroscope output. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: adis16400: Add ADIS16445 supportLars-Peter Clausen1-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>
2015-08-08iio: adis16400: Add ADIS16367 supportLars-Peter Clausen1-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>
2015-08-08iio: adis16260: Add ADIS16266 supportLars-Peter Clausen1-39/+98
The ADIS16266 is mostly register compatible to the ADIS16260. The difference is a different gyroscope scale factor as well not having the relative angular displacement channel. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: adis16400: Add ADIS16305 supportLars-Peter Clausen1-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>
2015-08-08iio: adis16400: adis16300 has product ID and serial numberLars-Peter Clausen1-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>
2015-08-08iio: adis16480: Fix scale factorsLars-Peter Clausen1-6/+33
The different devices support by the adis16480 driver have slightly different scales for the gyroscope and accelerometer channels. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: Add inverse unit conversion macrosLars-Peter Clausen1-0/+17
Add inverse unit conversion macro to convert from standard IIO units to units that might be used by some devices. Those are useful in combination with scale factors that are specified as IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will contain the maximum raw value the sensor will generate and the numerator the value it maps to in a specific unit. Sometimes datasheets specify those in different units than the standard IIO units (e.g. degree/s instead of rad/s) and so we need to do a unit conversion. From a mathematical point of view it does not make a difference whether we apply the unit conversion to the numerator or the inverse unit conversion to the denominator since (x / y) / z = x / (y * z). But as the denominator is typically a larger value and we are rounding both the numerator and denominator to integer values using the later method gives us a better precision (E.g. the relative error is smaller if we round 8000.3 to 8000 rather than rounding 8.3 to 8). This is where in inverse unit conversion macros will be used. Marked for stable as used by some upcoming fixes. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: adis16400: Fix adis16448 gyroscope scaleLars-Peter Clausen1-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>
2015-08-08iio: trigger: Add missing fields in kernel docsCristina Opriceana1-3/+24
Fix kernel docs warnings by adding the missing description for each of the existing function parameters. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: Documentation: Add trigger name attribute ABI documentationCristina Opriceana1-0/+9
This patch adds an entry in ABI Documentation for the name attribute issued when a trigger is created. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08DocBook: Add initial documentation for IIODaniel Baluta2-1/+698
This is intended to help developers faster find their way inside the Industrial I/O core and reduce time spent on IIO drivers development. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Acked-by: Crt Mori <cmo@melexis.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio: declare struct to fix warningPengyu Ma1-0/+3
When compile iio related driver the following warning shown: include/linux/iio/trigger.h:35:34: warning: 'struct iio_trigger' declared inside parameter list int (*set_trigger_state)(struct iio_trigger *trig, bool state); include/linux/iio/trigger.h:38:18: warning: 'struct iio_dev' declared inside parameter list struct iio_dev *indio_dev); 'struct iio_dev' and 'struct iio_trigger' was used before declaration, forward declaration for these structs to fix warning. Signed-off-by: Pengyu Ma <pengyu.ma@windriver.com> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:stk8312: drop local bufferHartmut Knaack1-5/+1
Drop the local buffer in stk8312_trigger_handler() and use data->buffer instead for bulk reads. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:stk8312: code style cleanupHartmut Knaack1-3/+2
Adjust some indentation issues to make checkpatch.pl happy in strict mode. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:stk8312: use appropriate variable typesHartmut Knaack1-4/+4
Adapt some variable types to reduce unnecessary casting. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:stk8312: rework macro definitionsHartmut Knaack1-12/+13
Make use of BIT to describe register bits, GENMASK for consecutive bitmasks, rename and sort existing definitions, replace magic value with an expressive definition, drop an unused definition. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-08iio:accel:stk8312: improve error handlingHartmut Knaack1-22/+38
Improve error handling in the following ways: - set return value on error condition to an appropriate error code - return error code immediately in case of an error (slightly changes code structure) - pass up real error code - add missing error handling - return 0 when error have been caught already - put device back in active mode after error occurs Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:accel:stk8312: check for invalid valueHartmut Knaack1-0/+2
Revision 1.2 of the datasheet recommends on page 22 to only write non-zero values read from OTP register 0x70 into AFECTRL register. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:accel:stk8312: add triggered buffer dependencyHartmut Knaack1-0/+2
Add the still missing dependencies for triggered buffer support. Fixes: 95c12bba51c37 ("iio: accel: Add buffer mode for Sensortek STK8312") Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Reviewed-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: use channel-array size directlyHartmut Knaack1-2/+1
Drop the otherwise unused definition of the channel-array size and use it directly in _probe - makes it a bit more obvious. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: use short operator formatHartmut Knaack1-3/+2
Use augmented assignment to subtract the offset for negative temperature values. Specify the amount of private data to be allocated through devm_iio_device_alloc() with sizeof(*priv), as it is shorter and common practice in IIO. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: constify iio_chan_specHartmut Knaack1-1/+1
Mark berlin2_adc_channels array as constant. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:adc:berlin2-adc: pass up real error codeHartmut Knaack1-2/+2
Pass up the real error code returned by platform_get_irq_byname(). Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02tools: iio: iio_utils: Make calc_digits staticJoo Aun Saw1-1/+1
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02tools: iio: iio_utils: remove unnecessary define guardJoo Aun Saw1-5/+0
Signed-off-by: Joo Aun Saw <jasaw@dius.com.au> Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02tools: iio: print error message when buffer enable failsIrina Tirdea1-1/+4
Running generic_buffer without enabling any channel of the sensor will fail without printing any error message. Add an error message that indicates buffer enable failed. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02tools: iio: fix mask for 32 bit sensor dataIrina Tirdea1-1/+1
When the the sensor data uses 32 bits out of 32, generic_buffer prints the value 0 for all data read. In this case, the mask is shifted 32 bits, which is beyond the size of an integer. This will lead to the mask always being 0. Before printing, the mask is applied to the raw value, thus generating a final value of 0. Fix the mask by shifting a 64 bit value instead of an integer. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02include: linux: iio: Add missing kernel doc fieldCristina Opriceana1-1/+2
Fix kernel doc for the iio_dev_attr structure by adding its missing field. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02include: linux: iio: Fix function parameter name in kernel docCristina Opriceana1-1/+1
Fix buffer name from kernel doc according to the function parameter. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: event: Add missing fields in kernel docsCristina Opriceana1-0/+6
Fix kernel docs warnings by adding the missing fields, each with its associated description. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: buffer: Fix kernel docs warningsCristina Opriceana1-1/+14
Fix kernel docs for structures and functions in order to remove some warnings when the documentation gets generated. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: core: Add function params for kernel docsCristina Opriceana1-5/+20
This patch adds the missing fields in kernel docs to remove some warnings that appear when the IIO Documentation DocBook is generated. Signed-off-by: Cristina Opriceana <cristina.opriceana@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: magn: bmc150_magn: do not set power state twice when setting trigger stateIrina Tirdea1-8/+2
When setting the trigger state, the device power state is set through buffer preenable and postdisable hooks. There is no need to also set it in the trigger set state call. Remove duplicate set power state from the trigger set state call. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: magn: bmc150_magn: add locking comment for runtime resumeIrina Tirdea1-0/+3
Runtime resume function is called with the data->mutex lock held. Add a comment to indicate this. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:magnetometer:bmc150_magn: use descriptive name for maskHartmut Knaack1-2/+3
Define and use a descriptive name for the repetition registers data mask, instead of a 'magic' value. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio:magnetometer:bmc150_magn: expand mutex in trigger_handlerHartmut Knaack1-1/+1
Keep the mutex locked, until the content of data->buffer has been pushed out. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: mlx90614: Define magic numbersCrt Mori1-6/+14
Translates the magic constant numbers to named macros and add some additional comments about their meaning. The diff is made towards togreg branch as that branch seems to have the most recent updates of mlx90614 driver (many are yet to be merged). Signed-off-by: Crt Mori <cmo@melexis.com> Acked-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>