Commit graph

790 commits

Author SHA1 Message Date
Jonathan Cameron
cf890fe8ae iio:adc:ad7280a: Move out of staging
This is a rather unusual device (in IIO anyway).  However, it has
a near to standard userspace ABI.

Note the work to move this out of staging was done against a minimal
QEMU model, which doesn't model all the features of the device.
I have no intention to upstream the QEMU model as it was developed
just to enable this driver cleanup.

https://github.com/jic23/qemu/tree/ad7280a-hacks

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-21-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
48fb57697e staging:iio:adc:ad7280a: Use more conservative delays to allow 105C operation.
The datasheet provides timings for operating this device at up to 105
degrees centigrade. Adopt these more conservative timings.

Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-20-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
6c6bc851d8 staging:iio:adc:ad7280a: Remove shift from cb_mask state cache.
Making the local storage of the Cell Balance mask a simple
bitmap and then shifting it only at time of register write simplifies
several code paths.

Suggested-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-19-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
d2960145b3 staging:iio:adc:ad7280a: Drop buggy support for early termination of AUX alert.
This functionality is intended to allow for a few temperature
sensors to be missing (and hence not worth reading) on the final
device in a chain.  The ones removed are 3 and 5 (unlike for
the ADC channels where it is 4 and 5).

The datasheet includes a foot note 3 to Table 12 that makes this complex
to support.

"(3) To remove AUX5 or AUX5 and AUX3 from the alert detection, conversions
on three auxiliary ADC input channels only must be selected in the
control register."

This mode has never been supported by the driver.

As this support would be complex to add and the rework is being done
against a QEMU model developed for the purposes of verifying nothing
is broken, it is better to drop this support for now.

Reported-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-16-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
219def4475 staging:iio:adc:ad7280a: Use device properties to replace platform data.
Convert all the device specific info that was previously in platform data
over to generic firmware query interfaces.

dt-bindings to follow shortly.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-15-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
dfa258c066 staging:iio:adc:ad7280a: Use a local dev pointer to avoid &spi->dev
We use this a few times already and it is about to get worse, so
introduce a local variable to simplify things.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-14-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
9010ac1c71 staging:iio:ad7280a: Reflect optionality of irq in ABI
Given the irq is optional, let us remove the interfaces related to
events when it is not present.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-13-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
65ba4ab6f0 staging:iio:adc:ad7280a: Cleanup includes
Drop used includes, add a few missing ones and reorder.
The include-what-you-use tool output was considered in making this
change.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-12-jic23@kernel.org
2022-02-21 19:33:05 +00:00
Jonathan Cameron
c5fe2f537b staging:iio:adc:ad7280a: Make oversampling_ratio a runtime control
Oversampling has nothing directly to do with analog circuits or
similar so belongs in the control of userspace as a policy decision.

The only complexity in here was that the acquisition time needs
updating if this setting is changed at runtime (as oversampling
is time consuming).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-11-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
e0a3ae8e42 staging:iio:adc:ad7280a: Trivial comment formatting cleanup
IIO uses the
/*
 * stuff
 * more stuff
 */

multi-line style, so use that here as well.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-10-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
c27e1e1a24 staging:iio:adc:ad7280a: Drop unused timestamp channel.
The driver doesn't support buffered mode, so a timestamp channel that
is entirely hidden from userspace without buffer mode is rather pointless.
Drop it.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-9-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
96ccdbc07a staging:iio:adc:ad7280a: Standardize extended ABI naming
The *_balance_switch_en and *_balance_switch_timer attributes had non
standard prefixes. Use the ext_info framework to automatically
create then with in_voltageX-voltageY_ prefix.

Documentation for these two unusual attributes to follow.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-8-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
112bf4aa4a staging:iio:adc:ad7280a: Switch to standard event control
This driver had a slightly non standard events ABI but there seems
to be no reason for not doing it with the core support for rising and
falling events on the two types of channels.

In theory the events on different daisy chained chips could be at
different levels, but the driver has never supported this and it doesn't
seem likely to be used so let us ignore that option.

Includes reordering so that we only set the software cached value
of the thresholds if the hardware write succeeds.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-7-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
4915c6b3dd staging:iio:adc:ad7280a: Use bitfield ops to managed fields in transfers.
The write and two types of read transfer are sufficiently complex that
they benefit from the clarity of using FIELD_PREP() and FIELD_GET().
This also applies to the handling in ad7280_event_handler() so
use a similar approach there as well.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-6-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
003f1d48de staging:iio:adc:ad7280a: Split buff[2] into tx and rx parts
As the __cacheline_aligned will ensure that the first of these two buffers
is appropriate aligned, there is no need to keep them as a single array
which is confusing given the first element is always tx and the second
rx.  Hence let us just have two parts and name them separately.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-5-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
dd7062fe88 staging:iio:adc:ad7280a: rename _read() to _read_reg()
This avoids possible confusion with read back of the channel conversions.
These two types of reads are of difference sizes with resulting differences
in the data layout of the response from the hardware.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-4-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
4c59aabd9a staging:iio:adc:ad7280a: Register define cleanup.
1. Postfix register addresses with _REG to distinguish them from
   fields within the registers
2. Switch to using FIELD_PREP and masks to aid readability.
3. Shorten a few defines to make the lines remain a sensible length.
4. Fix an issue whether where an CTRL_LB field is set in CTRL_HB.
5. Fix wrong AUX1_3_4 which should be AUX_1_3_5 according to
   table 14 in the datasheet.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-3-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Jonathan Cameron
f281e4ddbb staging:iio:adc:ad7280a: Fix handing of device address bit reversing.
The bit reversal was wrong for bits 1 and 3 of the 5 bits.
Result is driver failure to probe if you have more than 2 daisy-chained
devices.  Discovered via QEMU based device emulation.

Fixes tag is for when this moved from a macro to a function, but it
was broken before that.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes: 065a7c0b1f ("Staging: iio: adc: ad7280a.c: Fixed Macro argument reuse")
Reviewed-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Link: https://lore.kernel.org/r/20220206190328.333093-2-jic23@kernel.org
2022-02-21 19:33:04 +00:00
Alexandru Ardelean
d3be83244c iio: remove explicit IIO device parent assignment
This patch applies the semantic patch:
@@
expression I, P, SP;
@@
   I = devm_iio_device_alloc(P, SP);
   ...
-  I->dev.parent = P;

It updates 302 files and does 307 deletions.
This semantic patch also removes some comments like
'/* Establish that the iio_dev is a child of the i2c device */'

But this is is only done in case where the block is left empty.

The patch does not seem to cover all cases. It looks like in some cases a
different variable is used in some cases to assign the parent, but it
points to the same reference.
In other cases, the block covered by ... may be just too big to be covered
by the semantic patch.

However, this looks pretty good as well, as it does cover a big bulk of the
drivers that should remove the parent assignment.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14 11:49:59 +01:00
Deepak R Varma
4ce2881894 staging: iio: adc: ad7280a: Add comments to clarify stringified arguments
Checkpatch would flash a check message around a stringified macro
argument containing a '-' character. Add comment to indicate the
argument is legitimate and doesn't need fixing.

Signed-off-by: Deepak R Varma <mh12gx2825@gmail.com>
Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
Link: https://lore.kernel.org/r/469bf8db1c228913e72841367182fba2168fe795.1584904896.git.mh12gx2825@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-23 11:45:20 +01:00
Alexandru Tachici
b581f748cc staging: iio: adc: ad7192: move out of staging
Move ad7192 ADC driver out of staging into mainline.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08 17:28:33 +00:00
Alexandru Tachici
66614ab2be staging: iio: adc: ad7192: removed spi_device_id
This patch removes spi_device_id table and moves the
init data (id of the chip) in the .data field
of of_device_id table.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08 17:28:32 +00:00
Alexandru Tachici
893ac1a02b staging: iio: adc: ad7192: modify iio_chan_spec array
This patch changes the static const struct iio_chan_spec arrays
in a way that all the necessary attributes are set at
compile time. Now ad7192_channels_config only makes the
channels attribute of iio_dev point to the right array depending
on the chip.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08 17:28:32 +00:00
Alexandru Tachici
ab0afa65bb staging: iio: adc: ad7192: fail probe on get_voltage
This patch makes the ad7192_probe fail in case
regulator_get_voltage will return an error or voltage
is set to 0.

Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-03-08 17:28:32 +00:00
Mircea Caprioru
42776c14c6 staging: iio: adc: ad7192: Add system calibration support
This patch will add a system calibration attribute for each channel. Using
this option the user will have the ability to calibrate each channel for
zero scale and full scale. It uses the iio_chan_spec_ext_info and IIO_ENUM
to implement the functionality.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-09-08 10:35:56 +01:00
Mircea Caprioru
77f6a23092 staging: iio: adc: ad7192: Add low_pass_3db_filter_frequency
By adding this option we are able to remove the sync3 field and dt binding.
When setting the required cutoff frequency we also determine the ADC
configuration for chop and sync filter.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18 19:33:51 +01:00
Mircea Caprioru
4be27c2a18 staging: iio: adc: ad7192: Remove platform data
This patch removes the reference voltage entry from the platform_data
structure. This is no longer needed since the reference voltage is obtained
from the device tree. With this we also remove the entire ad7192.h file.

The undefined reference voltage warning is promoted to an error signaling a
problem with the device tree.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-08-18 19:23:00 +01:00
Bárbara Fernandes
0eec1f38c7 staging: iio: ad7192: create of_device_id array
Create list of compatible device ids to be matched with those stated in
the device tree.

Signed-off-by: Bárbara Fernandes <barbara.fernandes@usp.br>
Signed-off-by: Wilson Sales <spoonm@spoonm.org>
Co-developed by: Wilson Sales <spoonm@spoonm.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-07-27 20:11:17 +01:00
Vatsala Narang
c57c54bc97 staging: iio: adc: Add paragraph to describe Kconfig symbol
This patch updates Kconfig with paragraph that describe config symbol
fully.Issue addressed by checkpatch.

Signed-off-by: Vatsala Narang <vatsalanarang@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-05 13:10:51 +01:00
Greg Kroah-Hartman
817de6b859 Merge 5.1-rc6 into staging-next
We want the fixes in here as well as this resolves an iio driver merge
issue.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-21 23:18:44 +02:00
Greg Kroah-Hartman
932f98922f First set of new device support, features and fixes for IIO in the 5.2 cycle
Staging graduations
 * ad7780
   - Move this ADC driver out of staging.  Included adding some new features
     along the way (see below). Also added DT bindings.
 
 New device support
 * adis16480
   - Support the ADIS16495 and ADIS16497 IMU devices making
     heavy use of refactoring of various aspects of the driver in precursor
     patches.
 * lsm6dsx
   - Support for the ASM330LHH 6-axis (accelerometer + gyro) sensor.
   - Support for the LSM6DS0X
 * matbotix mb1232
   - New driver for this ultrasound ranging device family. Including bindings.
   - Supports mb1202, mb1212, mb1222, mb1232, mb1242, mb7040 and mb7137.
 * max31856
   - New driver for this thermocouple temperature sensor.
 * meson saradc
   - Support the Meson-G12A (ID addition only).
 * stmpe-adc
   - New driver supporting generic ADC alongside touchscreen support which
     previously existed. Includes DT bindings.
 * vcnl4000
   - Support for the vcln4040 proximity and light sensor, including adding
     DT bindings for this and parts previously supported.
 
 Features
 * core
   - Allow reading of mount matrices from ACPI in addition to DT.
   - Common binding for theromcouple types.
 * ad5933
   - Add ABI docs as there are a few 'unsual' elements about this
     device - perhaps because it's our only impedance analyser.
 * ad7780
   - Add gain and filter gpio support + readback of current gain and filter.
 * adis16480
   - Allow selection fo the dataready pin to be used.
   - Device tree ID table and binding documentation.
   - Support external clock modes, including new bindings.
 * bma180
   - Mount matrix support.
 * bmc150
   - Mount matrix support.
 * bmg160
   - Mount matrix support.
   - DT id table and bindings doc.
 * bmp280
   - Put calibration data into the entropy pool.
 * hmc5843
   - Mount matrix support.
 * itg3200
   - Mount matrix support.
 * kxcjk1013
   - Device tree id table, and binding docs.
 * lpc32xx
   - Add scale when regulator specified including DT docs for regulator.
 * pms7003
   - Add device IDs for all supported parts to driver and binding.
 * stm32-dfsdm
   - Enable hw consumer support, scan mode control and a complex set of
     triggered buffer modes.
   - Power management.
 * stm32-lptimer-counter
   - power management.
   - Document the pinctrl sleep state binding.
 * ti-ads7950
   - GPIO pin support.
 
 Cleanups, minor fixes
 * core
   - Use bitmap_zalloc to make it explicit that is what we are doing.
   - Tidy up all the Kconfig files (which had slowly gotten messy)
   - Fix a forwards definition missing issue in iio/driver.h
 * ad sigma delta core
   - Improve handling of SPI bus locking vs CS assertion.  This has been
     wrong a long time so not rushing this in.
 * ad5064
   - Mlock to local lock.
 * ad5933 (staging cleanup)
   - Multiline comment fixes.
   - Include ordering.
   - SPDX.
   - Tidy up Kconfig help which was a bit missleading.
   - Change some non standard attributes to ABI defined ones.
 * ad7124
   - White space fix.
 * ad7192
   - White space.
   - Use DT clock binding.
   - Improve error reporting.
   - Platform data to DT conversion.
   - Use read_avail callback, mostly to avoid the endless series of
     patches from new contributors trying to falsely put spaces around
     the negative sign.
 * ad7280a
   - Add brackets to macros to avoid potential precedence isseus.
   - Add temp vars for event codes to reduce indent and improved readability.
   - Clean out som CamelCase notation.
   - White space.
 * ad7606
   - Fix broken file naming in MAINTAINERS.
 * ad7780
   - Missing switch defaults to supress warnings and harden the code slightly.
   - Set pattern masks more directly.
   - Add ID values and masks for all supported chips.
   - SPDX + add Renato as a copyright holder as he has done a lot of work on
     this driver.
   - Add brackets to macros to avoid potential precedence issues.
 * ad7923
   - White space fixes.
   - Use BIT macro to improve readability.
   - Add brackets to macros to avoid potential precedence issues.
   - Tidy up a null comparisom.
 * ad9523
   - Fix a typo in naming of variables.
 * adis16400
   - Combine trigger file into main code as no advantage in separate files.
     Rename core file to just adis16400.
   - Squash the header into the c file now there is only one file.
   - Generalize burst mode to support new variants.
 * ak8975
   - Local variable to improve readability around mount matrix support.
 * as3935
   - Avoid potential race by ensuring remove does exact opposite of
     probe rather than a slightly different order.
 * cross_ec
   - Drop some unnecessary includes.
   - Fix some warning and the slightly 'unusual' code.
   - Add some docs for non obvious function.
   - SPDX
 * hmc5843
   - Potential unhandled error case.
 * iio trigger core
   - Print an error if there is no available irq due to max consumers per
     trigger being set to low.
 * iio loop trigger
   - Drop an unlikely on IS_ERR as IS_ERR already has the annotation.
 * ingenic-adc
   - Drop a redundant dev_err call as devm_ioremap_resource reports the same
     internally.
 * lmp91000
   - Drop some unncessary parentheses and white space tidy up.
   - Invert and if statement to improve readability.
   - Fix a wrong error message.
 * lpc32xx
   - Header sorting + drop some unused ones.
 * mma8542
   - Mark a switch fallthrough.
 * mpu6050
   - Add a local variable to improve code readability around mount matrix
     support.
 * mxs-lradc-adc
   - Handle devm_iio_trigger_alloc failure.
 * sps30
   - Fix up a kernel version in the ABI docs.
 * srf04
   - DT binding doc converted to yaml.
 * ssp_sensors
   - Supress a clang build warning due to lack of visibility of conditional
     within a iio_push_to_buffers_with_timestamp.  (reasonable false warning!)
 * st_accel
   - Drop pointless less than 0 comparisom of unsigned int.
 * stm32-dfsdm
   - Improve accuracy of spi_master_frequency calculation.
   - Improve calculation fo sampling frequency.
   - Rework various internals to simplify adding triggered buffer support.
   - Claim direct mode to avoid racing around read_raw and being in buffered
     mode.
 * stmpe
   - Fix a clang false positive warning.
 * ti-ads7950
   - Use local lock rather than using the core mlock when not locking around
     the device mode.
 * vcnl4000
   - Use word writes instead of byte writes.  It seems byte writes are fine
     for some parts (undocument) but not others that the driver will shortly
     support.
 
 Other
 * mailmap
   - Add email address change for Sean Nyekjaer.  Update in relevant drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlymX7ERHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogLdw//TC1JMzZMly5KsPc+kBj+sgStPrCs933B
 dCmxaae0dd5Kr3MYzy3EQ2Nl95CxjemYt7/Bj+eSsAA0coDnqnc5aIgwQWIl36oS
 tDAxtYO6zsqLputmymSpiKXE/SRONwmYXcv2XdopBDnE2V9rEAx7Ihu6yxpqCMVt
 HDu0ArwtAxkPqZREAyPI/GjCWAbqS7Nlzp8cyiPpEzrByVJA0+M6a0V+aNWblL/U
 i0NQRrzb8UfaRiCE+/UqBaiBWUXM4NHGoAj6DRYn0YLX7ryswdZ8kYnNbkc3Nlvm
 eZLZykL0xqijBRHLkSppkT4MdY15XOB6/d1BRSWcg4Yk2nJwBbqfg3p6ROEJj0nG
 H6wF09P5sbo42lFEZZAQkd5j2mvTl/94Y/GhA5OxjmUQWSGmtKxW7XK/CPu/FrcR
 6f3xMV0qm/RfmFG/YwpV8GvMYnNWwG4uHN7oFNCC8Gza9RyNYmXyeJillwwHRwEu
 CHpc/sL76U707m5WBhLKgvBFrzemQDH11Z+3hYuro1TkWQVEhs/JvACvazDs6LGj
 5u2Q99U0/0XaygHO4mfr9vQAmIgRqQstu8rq85lzAxQ1xCmmomfWBq32cu/gaBIw
 swpPuAIVbJEH0u/avfikbSAX/YH890ynWvhXjjjJ6j6Zika8mucW0aNbe7wDyjdL
 I1cj5/1kXFU=
 =GnjE
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new device support, features and fixes for IIO in the 5.2 cycle

Staging graduations
* ad7780
  - Move this ADC driver out of staging.  Included adding some new features
    along the way (see below). Also added DT bindings.

New device support
* adis16480
  - Support the ADIS16495 and ADIS16497 IMU devices making
    heavy use of refactoring of various aspects of the driver in precursor
    patches.
* lsm6dsx
  - Support for the ASM330LHH 6-axis (accelerometer + gyro) sensor.
  - Support for the LSM6DS0X
* matbotix mb1232
  - New driver for this ultrasound ranging device family. Including bindings.
  - Supports mb1202, mb1212, mb1222, mb1232, mb1242, mb7040 and mb7137.
* max31856
  - New driver for this thermocouple temperature sensor.
* meson saradc
  - Support the Meson-G12A (ID addition only).
* stmpe-adc
  - New driver supporting generic ADC alongside touchscreen support which
    previously existed. Includes DT bindings.
* vcnl4000
  - Support for the vcln4040 proximity and light sensor, including adding
    DT bindings for this and parts previously supported.

Features
* core
  - Allow reading of mount matrices from ACPI in addition to DT.
  - Common binding for theromcouple types.
* ad5933
  - Add ABI docs as there are a few 'unsual' elements about this
    device - perhaps because it's our only impedance analyser.
* ad7780
  - Add gain and filter gpio support + readback of current gain and filter.
* adis16480
  - Allow selection fo the dataready pin to be used.
  - Device tree ID table and binding documentation.
  - Support external clock modes, including new bindings.
* bma180
  - Mount matrix support.
* bmc150
  - Mount matrix support.
* bmg160
  - Mount matrix support.
  - DT id table and bindings doc.
* bmp280
  - Put calibration data into the entropy pool.
* hmc5843
  - Mount matrix support.
* itg3200
  - Mount matrix support.
* kxcjk1013
  - Device tree id table, and binding docs.
* lpc32xx
  - Add scale when regulator specified including DT docs for regulator.
* pms7003
  - Add device IDs for all supported parts to driver and binding.
* stm32-dfsdm
  - Enable hw consumer support, scan mode control and a complex set of
    triggered buffer modes.
  - Power management.
* stm32-lptimer-counter
  - power management.
  - Document the pinctrl sleep state binding.
* ti-ads7950
  - GPIO pin support.

Cleanups, minor fixes
* core
  - Use bitmap_zalloc to make it explicit that is what we are doing.
  - Tidy up all the Kconfig files (which had slowly gotten messy)
  - Fix a forwards definition missing issue in iio/driver.h
* ad sigma delta core
  - Improve handling of SPI bus locking vs CS assertion.  This has been
    wrong a long time so not rushing this in.
* ad5064
  - Mlock to local lock.
* ad5933 (staging cleanup)
  - Multiline comment fixes.
  - Include ordering.
  - SPDX.
  - Tidy up Kconfig help which was a bit missleading.
  - Change some non standard attributes to ABI defined ones.
* ad7124
  - White space fix.
* ad7192
  - White space.
  - Use DT clock binding.
  - Improve error reporting.
  - Platform data to DT conversion.
  - Use read_avail callback, mostly to avoid the endless series of
    patches from new contributors trying to falsely put spaces around
    the negative sign.
* ad7280a
  - Add brackets to macros to avoid potential precedence isseus.
  - Add temp vars for event codes to reduce indent and improved readability.
  - Clean out som CamelCase notation.
  - White space.
* ad7606
  - Fix broken file naming in MAINTAINERS.
* ad7780
  - Missing switch defaults to supress warnings and harden the code slightly.
  - Set pattern masks more directly.
  - Add ID values and masks for all supported chips.
  - SPDX + add Renato as a copyright holder as he has done a lot of work on
    this driver.
  - Add brackets to macros to avoid potential precedence issues.
* ad7923
  - White space fixes.
  - Use BIT macro to improve readability.
  - Add brackets to macros to avoid potential precedence issues.
  - Tidy up a null comparisom.
* ad9523
  - Fix a typo in naming of variables.
* adis16400
  - Combine trigger file into main code as no advantage in separate files.
    Rename core file to just adis16400.
  - Squash the header into the c file now there is only one file.
  - Generalize burst mode to support new variants.
* ak8975
  - Local variable to improve readability around mount matrix support.
* as3935
  - Avoid potential race by ensuring remove does exact opposite of
    probe rather than a slightly different order.
* cross_ec
  - Drop some unnecessary includes.
  - Fix some warning and the slightly 'unusual' code.
  - Add some docs for non obvious function.
  - SPDX
* hmc5843
  - Potential unhandled error case.
* iio trigger core
  - Print an error if there is no available irq due to max consumers per
    trigger being set to low.
* iio loop trigger
  - Drop an unlikely on IS_ERR as IS_ERR already has the annotation.
* ingenic-adc
  - Drop a redundant dev_err call as devm_ioremap_resource reports the same
    internally.
* lmp91000
  - Drop some unncessary parentheses and white space tidy up.
  - Invert and if statement to improve readability.
  - Fix a wrong error message.
* lpc32xx
  - Header sorting + drop some unused ones.
* mma8542
  - Mark a switch fallthrough.
* mpu6050
  - Add a local variable to improve code readability around mount matrix
    support.
* mxs-lradc-adc
  - Handle devm_iio_trigger_alloc failure.
* sps30
  - Fix up a kernel version in the ABI docs.
* srf04
  - DT binding doc converted to yaml.
* ssp_sensors
  - Supress a clang build warning due to lack of visibility of conditional
    within a iio_push_to_buffers_with_timestamp.  (reasonable false warning!)
* st_accel
  - Drop pointless less than 0 comparisom of unsigned int.
* stm32-dfsdm
  - Improve accuracy of spi_master_frequency calculation.
  - Improve calculation fo sampling frequency.
  - Rework various internals to simplify adding triggered buffer support.
  - Claim direct mode to avoid racing around read_raw and being in buffered
    mode.
* stmpe
  - Fix a clang false positive warning.
* ti-ads7950
  - Use local lock rather than using the core mlock when not locking around
    the device mode.
* vcnl4000
  - Use word writes instead of byte writes.  It seems byte writes are fine
    for some parts (undocument) but not others that the driver will shortly
    support.

Other
* mailmap
  - Add email address change for Sean Nyekjaer.  Update in relevant drivers

* tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (129 commits)
  iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
  iio: adc: stm32-dfsdm: add PM support
  iio: adc: stm32-dfsdm: improve sampling frequency accuracy
  staging: iio: adc: ad7280a: Tab alignment
  MAINTAINERS: Fix the link to ad7606 dt-bindings
  iio:temperature: Add MAX31856 thermocouple support
  iio:temperature:max31856:Add device tree bind info
  dt-bindings: iio/temperature: Add thermocouple types (and doc)
  devantech-srf04.yaml: transform DT binding to YAML
  iio: frequency: ad9523: Fix typo in ad9523_platform_data
  iio: Make possible to include driver.h first
  dt-bindings: iio: add Bosch BMG160 gyroscope sensor
  iio: gyro: bmg160: add device tree compatibility table
  staging: iio: adc: ad7192: Use read_avail for available attributes
  dt-bindings: iio: light: add vcnl4040 devicetree bindings
  iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor
  dt-bindings: iio: light: add vcnl4000 devicetree bindings
  iio: light: vcnl4000 add devicetree hooks
  iio: light: vcnl4000 use word writes instead of byte writes
  iio: adc: stm32-dfsdm: claim direct mode for raw read and settings
  ...
2019-04-04 22:25:29 +02:00
Cristian Sicilia
65500c53aa staging: iio: adc: ad7280a: Tab alignment
Aligned some parameters.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:21:09 +01:00
Mircea Caprioru
2b0d1c6f12 staging: iio: adc: ad7192: Use read_avail for available attributes
This patch removes the in_voltage-voltage_scale_available and
in_voltage_scale_available attributes. These are replaced with available
attributes added in info_mask_shared_by_type_available.

With this modification the iio core will be responsible with naming the
attributes thus removing the checkpatch warning related to
in_voltage-voltage_scale_available naming.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:50 +01:00
Cristian Sicilia
9bf1468e9d staging: iio: adc: ad7280a: Remove CamelCase notation
Fix CamelCase naming.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:22 +01:00
Cristian Sicilia
6c249591ee staging: iio: adc: ad7280a: Adding temp var to improve readability
Creating a temporary variable to improve readability

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:21 +01:00
Cristian Sicilia
d04411c2a6 staging: iio: adc: ad7280a: Avoid precedence issues in macro
Enclosing parameter with parenthesis due to avoid
possible precedence issue.

Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:19 +01:00
Renato Lui Geh
9fb27f807e staging: iio: ad7780: moving ad7780 out of staging
Move ad7780 ADC driver out of staging and into the mainline.

The ad7780 is a sigma-delta analog to digital converter. This driver provides
reading voltage values and status bits from both the ad778x and ad717x series.
Its interface also allows writing on the FILTER and GAIN GPIO pins on the
ad778x.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:06 +01:00
Renato Lui Geh
69fdf26f6f staging: iio: ad7780: add new copyright holder
This patch adds a new copyright holder to the ad7780 driver.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:05 +01:00
Renato Lui Geh
bb4af619a6 staging: iio: ad7780: add SPDX identifier
Add SPDX identifier (GPL-2.0) to the AD7780 driver.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:05 +01:00
Renato Lui Geh
5bb30e7daf staging: iio: ad7780: move regulator to after GPIO init
To maintain consistency between ad7780_probe and ad7780_remove orders,
regulator initialization has been moved to after GPIO initializations.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:04 +01:00
Renato Lui Geh
4812a14a78 staging:iio:ad7780: add chip ID values and mask
The ad7780 supports both the ad778x and ad717x families. Each chip has
a corresponding ID. This patch provides a mask for extracting ID values
from the status bits and also macros for the correct values for the
ad7170, ad7171, ad7780 and ad7781.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:04 +01:00
Renato Lui Geh
33e1f90204 staging: iio: ad7780: set pattern values and masks directly
The AD7780 driver contains status pattern bits designed for checking
whether serial transfers have been correctly performed. Pattern macros
were previously generated through bit fields. This patch sets good
pattern values directly and masks through GENMASK.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:03 +01:00
Renato Lui Geh
0ee6d5ebe1 staging: iio: ad7780: add filter reading to ad778x
This patch adds the new feature of reading the filter odr value for
ad778x chips. This value is stored in the chip's state struct whenever a
read or write call is performed on the chip's driver.

This feature requires sharing SAMP_FREQ. Since the ad717x does not have
a filter option, the driver only shares the relevant info mask for the
ad778x family.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:03 +01:00
Renato Lui Geh
0149ba2d5b staging: iio: ad7780: add gain reading to ad778x
This patch adds a new functionality of reading gain values from the
ad778x chips. This value is stored in the chip's state struct and is
updated whenever a read or write call is performed on the driver.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:03 +01:00
Renato Lui Geh
ae9f86feb4 staging: iio: ad7780: add missing switch default case
This patch simply adds a missing switch default case in read_raw.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:02 +01:00
Renato Lui Geh
9085daa4ab staging: iio: ad7780: add gain & filter gpio support
Previously, the AD7780 driver only supported gpio for the 'powerdown'
pin. This commit adds suppport for the 'gain' and 'filter' pin.

Signed-off-by: Renato Lui Geh <renatogeh@gmail.com>
Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:02 +01:00
Mircea Caprioru
eb4f07a5ba staging: iio: adc: ad7192: Convert platform data to DT properties
This patch will remove platform data members and replace them with device
tree properties. These properties will be subject to further modifications
and probably replaced with other functionalities at some point in time.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:01 +01:00
Mircea Caprioru
753a9870e0 staging: iio: adc: ad7192: Report error directly in ad7192_setup
This patch removes the goto out statement and uninformative
print message. This improves readability.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:00 +01:00
Mircea Caprioru
3ad7a939c9 staging: iio: adc: ad7192: Use DT clock binding
This patch replaces the platform data clock select member with DT clock
binding. Through the DT the external clock binding is specified. If this is
not provided then the device will use the internal clock source.

With the external clock binding there is the option to use a clock or a
crystal as the clock source. When an external crystal is used it is
connected to MCLK1 and MCLK2 pins. If the external clock is used only MCLK2
pin will be connected.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:00 +01:00
Mircea Caprioru
17b90e6a0d staging: iio: adc: ad7192: Fix identation
This patch fixes the odd indentation inside function ad7192_calibrate_all.

Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:19:59 +01:00