Commit Graph

2726 Commits

Author SHA1 Message Date
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
Marcelo Schmitt
57565828ad staging: iio: ad5933: change attributes to match ABI
Change device attributes' names to match ABI documentation. Names were
chosen such that they tend to be similar to existing ABI so it should
be easier to standardize them when necessary.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:31 +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
Marcelo Schmitt
a816646f08 staging: iio: ad5933: add ABI documentation
Add an ABI documentation for the ad5933 driver.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:13 +01:00
Marcelo Schmitt
8fce3d34d7 staging: iio: ad5933: change help rule message
Remove the previous comment about direct access via sysfs which would
lead one think ad5933 driver has limitations it actually doesn't.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:12 +01:00
Marcelo Schmitt
adb0ef4120 staging: iio: ad5933: add SPDX identifier
Add SPDX identifier of GPL-2.0 for the ad5933 driver.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:11 +01:00
Marcelo Schmitt
700e8911a6 staging: iio: ad5933: organize includes
Organize includes to list them in lexicographic order.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:09 +01:00
Marcelo Schmitt
3204683722 staging: iio: ad5933: change multi-line comment style
Make multi-line comments compliant with the preferred code style.

Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04 20:20:08 +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
Greg Kroah-Hartman
2506abea7f staging: iio: add proper SPDX identifiers to remaining driver files
There are a number of IIO staging drivers that do not have a proper SPDX
identifier on it.  So fix that up and at the same time, remove the "free
form" license text, as that's pretty much impossible for any tool to
parse.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <Michael.Hennerich@analog.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:17 +02:00
Greg Kroah-Hartman
97ed8eab2a staging: add missing SPDX lines to Makefile files
There are a few remaining drivers/staging/*/Makefile files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Greg Kroah-Hartman
99b75a4e32 staging: add missing SPDX lines to Kconfig files
There are a few remaining drivers/staging/*/Kconfig files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Payal Kshirsagar
e7c3d05459 staging: iio: adc: ad7816.c: Replace bit shifting with BIT macro
Challenge suggested by coccinelle.
Prefer using BIT and replace bit shifting with the BIT(x) macro.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02 19:57:11 +02:00
Payal Kshirsagar
6082ac0412 staging: iio: impedance-analyzer: ad5933.c: Replace bit shifting with BIT macro
Challenge suggested by coccinelle.
Prefer using BIT and replace bit shifting with the BIT(x) macro.

Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02 19:57:11 +02:00
Daniela Mormocea
7782c3c93d staging: iio: Line over 80 characters
Fix line over 80 characters, warning by checkpatch

Signed-off-by: Daniela Mormocea <daniela.mormocea@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18 07:05:19 +01:00
Beniamin Bia
8e8040c52e staging: iio: frequency: ad9833: Load clock using clock framework
The clock frequency is loaded from device-tree using clock framework
instead of statically value. The change allow configuration of
the device via device-trees and better initialization sequence.
This is part of broader effort to add device-tree support to this driver
and take it out from staging.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02 17:06:49 +00:00
Beniamin Bia
80109c3234 staging: iio: frequency: ad9833: Get frequency value statically
The values from platform data were replaced by statically values.
This was just a intermediate step of taking this driver out of staging and
load data from device tree.

Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02 16:01:36 +00:00
Alexandru Ardelean
0e4c2da4f0 staging: iio: cdc: ad7152: remove driver completely
The AD7153 part has been obsoleted for some time. The AD7152 part will be
obsolete in the coming future.
Moving it out of staging doesn't make sense anymore. Which makes the driver
enter a limbo state.

This patch removes the driver completely, so that no effort is placed on
it, allowing people to focus on other parts that will still be around.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02 10:01:37 +00:00
Jeremy Fertic
78accaea11 staging: iio: adt7316: fix the dac write calculation
The lsb calculation is not masking the correct bits from the user input.
Subtract 1 from (1 << offset) to correctly set up the mask to be applied
to user input.

The lsb register stores its value starting at the bit 7 position.
adt7316_store_DAC() currently assumes the value is at the other end of the
register. Shift the lsb value before storing it in a new variable lsb_reg,
and write this variable to the lsb register.

Fixes: 35f6b6b86e ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 17:57:06 +00:00
Jeremy Fertic
45130fb030 staging: iio: adt7316: fix the dac read calculation
The calculation of the current dac value is using the wrong bits of the
dac lsb register. Create two macros to shift the lsb register value into
lsb position, depending on whether the dac is 10 or 12 bit. Initialize
data to 0 so, with an 8 bit dac, the msb register value can be bitwise
ORed with data.

Fixes: 35f6b6b86e ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 17:55:23 +00:00
Jeremy Fertic
76b7fe8d6c staging: iio: adt7316: fix handling of dac high resolution option
The adt7316/7 and adt7516/7 have the option to output voltage proportional
to temperature on dac a and/or dac b. The default dac resolution in this
mode is 8 bits with the dac high resolution option enabling 10 bits. None
of these settings affect dacs c and d. Remove the "1 (12 bits)" output from
the show function since that is not an option for this mode. Return
"1 (10 bits)" if the device is one of the above mentioned chips and the dac
high resolution mode is enabled.

In the store function, the driver currently allows the user to write to the
ADT7316_DA_HIGH_RESOLUTION bit regardless of the device in use. Add a check
to return an error in the case of an adt7318 or adt7519. Remove the else
statement that clears the ADT7316_DA_HIGH_RESOLUTION bit. Instead, clear it
before conditionally enabling it, depending on user input. This matches the
typical pattern in the driver when an attribute is a boolean.

Fixes: 35f6b6b86e ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 17:52:17 +00:00
Jeremy Fertic
e9de475723 staging: iio: adt7316: fix dac_bits assignment
The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(),
and it should be either 8, 10, or 12 bits depending on the device in use. The
driver currently only assigns a value to dac_bits in
adt7316_store_da_high_resolution(). The purpose of the dac high resolution
option is not to change dac resolution for normal operation. Instead, it
is specific to an optional feature where one or two of the four dacs can
be set to output voltage proportional to temperature. If the user chooses
to set dac a and/or dac b to output voltage proportional to temperature,
the da_high_resolution attribute can optionally be enabled to use 10 bit
resolution rather than the default 8 bits. This is only available on the
10 and 12 bit dac devices. If the user attempts to read or write dacs a
or b under these settings, the driver's current behaviour is to return an
error. Dacs c and d continue to operate normally under these conditions.
With the above in mind, remove the dac_bits assignments from this function
since the value of dac_bits as used in the driver is not dependent on this
dac high resolution option.

Since the dac_bits assignments discussed above are currently the only ones
in this driver, the default value of dac_bits is 0. This results in incorrect
calculations when the dacs are read or written in adt7316_show_DAC() and
adt7316_store_DAC(). To correct this, assign a value to dac_bits in
adt7316_probe() to ensure correct operation as soon as the device is
registered and available to userspace.

Fixes: 35f6b6b86e ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver")
Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 17:48:39 +00:00
Stefan Popa
2985a5d884 staging: iio: adc: ad7606: Move out of staging
Move ad7606 ADC driver out of staging and into the mainline.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:59 +00:00
Stefan Popa
54160ae3b2 staging: iio: adc: ad7606: Misc style fixes (no functional change)
* Placed includes in alphabetical order
* Added brackets around num and mask through out for AD760X_CHANNEL
* Used single line comments where needed
* Removed extra lines and spaces

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:52 +00:00
Stefan Popa
cc49bd1652 staging: iio: adc: ad7606: Add support for threaded irq
This patch replaces the use of a polling ring buffer with a threaded
interrupt.

Enabling the buffer sets the CONVST signal to high. When the rising edge
of the CONVST is applied, BUSY signal goes logic high and transitions low
at the end of the entire conversion process. The falling edge of the BUSY
signal triggers the interrupt.

ad7606_trigger_handler() is used as bottom half of the poll function.
It reads data from the device and stores it in the internal buffer.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:52 +00:00
Stefan Popa
ca5b4637d7 staging: iio: adc: ad7606: Use SPDX identifier
This patch replaces the license text at the top of ad7606 driver files
and instead adds SPDX GPL-2.0 license identifier.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:51 +00:00
Stefan Popa
2bbf53e3e5 staging: iio: adc: ad7606: Simplify the Kconfing menu
There is no point in having three menu entries that can be selected
individually. Instead, the SPI and parallel interfaces should select
AD7606.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05 16:10:51 +00:00
Stefan Popa
43f9b204ed staging: iio: adc: ad7606: Add OF device ID table
The driver does not have a struct of_device_id table, but supported
devices are registered via Device Trees. This patch adds and OF device
ID table.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22 16:58:14 +00:00
Stefan Popa
6620585a0c staging: iio: adc: ad7606: Use vendor prefix for DT properties
The 'adi' vendor prefix needs to be added to conversion-start, range,
first-data and oversampling-ratio properties.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22 16:58:13 +00:00
Stefan Popa
41f71e5e7d staging: iio: adc: ad7606: Use find_closest() macro
When looking for the available scale or oversampling ratio, it is better
to use the find_closest() macro. This simplifies the code and also does
not require an exact value to be entered from the user space.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22 16:58:13 +00:00
Stefan Popa
c0683bfd37 staging: iio: adc: ad7606: Use devm functions in probe
Switch to devm version of request_irq, iio_triggered_buffer_setup,
iio_device_register. To avoid potential ordering issues in probe,
devm_add_action_or_reset() is used for the regulator_disable(). This
simplifies the code and decreases the chance of bugs.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22 16:58:13 +00:00
Stefan Popa
557e585c3f staging: iio: adc: ad7606: Use wait-for-completion handler
This patch replaces the use of wait_event_interruptible() with
wait_for_completion_timeout() when reading the result of a single
conversion. In this way, if the interrupt never occurs, the program will
not remain blocked.

Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22 16:58:12 +00:00
Hardik Singh Rathore
f1b753a0f8 staging: iio: ad7816: drop unnecessary initialization of variables
Initialization is unnecessary when the variable is written before it is
read. There were some occasions in which the driver would initialize `ret'
during declaration without need.

Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16 14:05:57 +00:00