1
0
Fork 0
Commit Graph

2602 Commits (8ef9ccf81044a1e31d116b5d4972d5b65ae10846)

Author SHA1 Message Date
Jonathan Cameron be3be7814a staging:iio:meter: Drop ADE7759 driver
I announced the intent to drop some of these meter drivers
on the IIO list last cycle. This device is obsolete and not easily
obtained.  No one has come forward with suitable test hardware and
the driver would need a lot of work to move out of staging.

As such I am dropping it.  We can always bring it back again
if a user / tester emerges in the future.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:21:54 +01:00
Jonathan Cameron 1f31ee3508 staging:iio:meter: Drop ADE7758 driver
I announced the intent to drop some of these meter drivers
on the IIO list last cycle. This device is obsolete and not easily
obtained.  No one has come forward with suitable test hardware and
the driver would need a lot of work to move out of staging.

As such I am dropping it.  We can always bring it back again
if a user / tester emerges in the future.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:21:42 +01:00
Jonathan Cameron d15d4be9da staging:iio:meter: Drop ADE7754 driver
I announced the intent to drop some of these meter drivers
on the IIO list last cycle. This device is obsolete and not easily
obtained.  No one has come forward with suitable test hardware and
the driver would need a lot of work to move out of staging.

As such I am dropping it.  We can always bring it back again
if a user / tester emerges in the future.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:21:26 +01:00
Jonathan Cameron cfbcdb6a98 staging:iio:meter: Drop ADE7753 driver
I announced the intent to drop some of these meter drivers
on the IIO list last cycle. This device is obsolete and not easily
obtained.  No one has come forward with suitable test hardware and
the driver would need a lot of work to move out of staging.

As such I am dropping it.  We can always bring it back again
if a user / tester emerges in the future.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:20:26 +01:00
David Veenstra ad28d31554 staging: iio: ad2s1200: Move driver out of staging
Move the iio driver for the ad2s1200 and ad2s1205 resolver-to-digital
converter out of staging, into mainline iio subsystems.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:17:48 +01:00
David Veenstra 9c3e81ab74 staging: iio: ad2s1200: Add copyright
Add David Veenstra as a copyright holders and as an author,
for all of the staging clean ups of the ad2s1200 driver.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:10:58 +01:00
David Veenstra f9db7370be staging: iio: ad2s1200: Add scaling factor for angle channel
A scaling factor of approximately 2 * Pi / (2^12 -1) is added,
to scale the 12-bits angular position to radians.

A return type of IIO_VAL_INT_PLUS_NANO is used, so that the scale of
both the angle channel and angular velocity channel has 7 significant
digits.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:09:47 +01:00
David Veenstra d3e6ed8416 staging: iio: ad2s1200: Add scaling factor for angular velocity channel
The sysfs iio ABI states radians per second is expected as the unit for
angular velocity, but the 12-bit angular velocity register has
revolution per seconds as its unit. So a scaling factor of approximately
2 * Pi is added to the angular velocity channel.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:07:29 +01:00
David Veenstra 2363c010ce staging: iio: ad2s1200: Add dt table
Add device tree table for matching with the vendor ID.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:02:17 +01:00
David Veenstra 1946980b8f staging: iio: ad2s1200: Replace platform data with dt bindings
Remove usage of platform data, and replace it with device tree
facilities.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 12:00:17 +01:00
David Veenstra 5af93e6aa7 staging: iio: ad2s1200: Replace legacy gpio API with modern API
The legacy, integer based gpio API is replaced with the modern
descriptor based API.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 11:57:27 +01:00
David Veenstra 94cdefa81b staging: iio: ad2s1200: Setup spi before iio device register
The spi should be set up before the device is registered as an iio
device.

This patch moves the setup to before the device registration.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 11:54:43 +01:00
David Veenstra bc683b47c3 staging: iio: ad2s1200: Add kernel docs to driver state
Add missing kernel docs to the ad2s1200 driver state.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 11:53:45 +01:00
David Veenstra c1b6a7d72d staging: iio: ad2s1200: Remove unneeded initializations
Remove 2 initializations which are unneeded, because the
initialized values are never used.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 11:52:49 +01:00
David Veenstra c8e97b62e1 staging: iio: ad2s1200: Remove unneeded newline in license
Remove unneeded newline in license, as it does not improve readability.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 11:51:30 +01:00
Brian Masney c06c4d7935 staging: iio: tsl2x7x/tsl2772: move out of staging
Move the tsl2772 driver out of staging and into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:40:04 +01:00
Brian Masney 4e24c1719f staging: iio: tsl2x7x: rename driver to tsl2772
This patch renames this driver from tsl2x7x to tsl2772 since it is
highly likely that additional devices will be added to this driver that
do not match that wildcard. The tsl2772 driver name was selected since
that is currently the device with the most features that are supported
by this driver.

This patch also adds Brian Masney's copyright to tsl2772.h for all of
the work that has been done to move this driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:24:29 +01:00
Brian Masney da18e89062 staging: iio: tsl2x7x: add range checking to tsl2x7x_write_raw
The CALIBBIAS and INT_TIME masks in tsl2x7x_write_raw did not have any
range checking in place so this patch adds the appropriate range
checking. The defines TSL2X7X_ALS_GAIN_TRIM_{MIN,MAX} are also
introduced by this patch.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:23:06 +01:00
Brian Masney 9861d2daaf staging: iio: tsl2x7x: correct IIO_EV_INFO_PERIOD values
The thresh periods assumed an integration time of 3ms. This patch adds
support for the correct integration time (2.72ms or 2.73ms). The code
had the ALS filter values as going up to 15, however the values actually
went up to 60 since the values scaled in increments of 5 once the
persistence value went above 3.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:21:27 +01:00
Brian Masney 77b69a0e67 staging: iio: tsl2x7x: convert to use read_avail
Make the sysfs attributes in_proximity0_calibscale_available, and
in_intensity0_{calibscale,integration_time}_available be created
using info_mask_separate_available on the channel configuration.

The driver assumed that the ALS increment was 2.72 ms, and the upper
range was 696 ms. Some other supported devices use 2.73 ms - 699 ms.
This patch adds support for the multiple ranges.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:19:27 +01:00
Brian Masney bfdf7f1024 staging: iio: tsl2x7x: use macro to populate tsl2X7X_device_info
This patch creates a macro that populates the tsl2X7X_device_info
structure to reduce duplicated code in the driver.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:17:49 +01:00
Brian Masney cc566e90cb staging: iio: tsl2x7x: turn chip off if IIO device registration fails
This patch turns the chip off if IIO device registration fails so that
the error handling mirrors the device remove to make review easier in
preparation for moving this driver out of staging.

This patch also adds a missing error check in the call to
tsl2x7x_chip_on() in tsl2x7x_probe().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:16:39 +01:00
Brian Masney 7b4db2e3e6 staging: iio: tsl2x7x: use direct returns
This patch changes the functions tsl2x7x_read_event_value() and
tsl2x7x_read_raw() to use direct returns to simplify the code.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:15:47 +01:00
Brian Masney 5cf05135b0 staging: iio: tsl2x7x: remove unnecessary whitespace
This patch removes unnecessary whitespace in preparation for moving this
driver out of staging.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:14:38 +01:00
Greg Kroah-Hartman 6a8b25abf1 1st round of IIO new device support, features and cleanup for the 4.18 cycle
A nice mix this time of excellent cleanups (many to send drivers
 speeding toward staging graduations) and new drivers / device support.
 A good part of this is Brian Masney's never ending task on the tsl2x7x
 driver.  The end is in sight so hopefully we'll get that one out of
 staging very soon!
 
 New device support
 * AD5686
   - Support AD5685R (was wrongly present as AD5685)
   - Support AD5672R, AD5676, AD5676, AD5684R and AD5686R 4 and 8 channel
     SPI DACs with various precisions.
   - Support AD5671R, AD5675R, AD5694, AD5694R, AD5695R, AD5696 and AD5696R
     I2C DACs with various percisions and numbers of channels.
 * Analog front end rescale driver - New driver.
   - Support current sensing usings a shunt resistor.
   - Support simple voltage dividers.
   - support simple current sense amplifiers.
 * TI dac5571
   - New driver and device bindings supporting:
     dac5571, dac6571, dac7571, dac5574, dac6574, dac7574,
     dac5573, dac6573 and dac7573
 * Meson-adc
   - Support for Meson AXG with DT bindings.
 * mpu6050
   - Support the mpu9255 which only requires additional WHOAMI entry and
     compatible string.
 * st_lsm6dsx
   - Support for lsm330dlc combinded accelerometer and gyro sensors with
     DT bindings.
 * stm32_adc
   - Add support for STM32MP1 with bindings.
 
 Staging graduations
 * adis16201 after some excelent cleanup by Himanshu Jha.
 * adis16029 after some excelent cleanup by Shreeya Patel.
 
 New features:
 * ABI docs
   - Add core ABI docs for angle channels.
 * inv_mpu6050
   - Provide support for the full range of interrupts the device
     supports.
 * st_accel
   - Add SMO8840 ACPI ID seen in the wild on some Lenovo machines.
 * stx104
   - Provide a multiple gpio get function.
 
 Cleanups / Minor fixes
 * core
   - Use new nested structure support to improve kernel-doc.
 * ad2s1200
   - Use be16_to_cpup instead of opencoding.
 * ad5686
   - Indentation tidy up.
   - Switch to SPDX
   - Refactor to allow various numbers of channels.
   - Refactor to separate core and SPI specific support, prior to
     addition of i2c equivalent devices.
 * ad7606
   - Use drvdata directly from device rather than boucing via the
     platform_device structure.
 * ad7746
   - Replace opencoded byte swapped i2c calls with _swapped variants.
   - White space and line break readability improvements.
   - Reorder includes and variable declarations where appropriate.
 * ad7791
   - Changes to the AD ADC library used by this driver took in the
     sampling frequency.  This lead to be the wrong path being the one
     tied to the resulting attribute, so it didn't work, and a warning
     to be printed.
 * ad7780
   - Remove apparent support for sampling frequency control on devices
     that don't support changing the sampling attributes.
 * ade7854
   - Fix a read of the wrong number of bits.
   - Improve error handling on i2c read/write errors.
   - Rework i2c and spi code to reduce duplication.
 * adis16201 (staging)
   - Improve meaning inherent in some macro names by adding units etc
     where relevant.
   - Adjust comments to improve detail and drop the irrelevant.
   - Rename register address definitions definitions to add a _REG
     postfix, clearly separating them from field definitions. Reorganize
     the definitions to group register address and fields.
   - Use sign_extend32 rather than open coding.
   - Reverse Xmas tree ordering where appropriate and align function args.
   - Remove unused headers.
   - Use GENMASK where appropriate instead of open coding.
 * adis16209 (staging)
   - Indent field definitions to visually separate them from
     register address definitions.
   - Use reverse xmas tree ordering where appropriate.
   - Add some whitespace where it will help readability.
   - Drop some unused headers.
   - Use GENMASK where appropriate.
 * ad2s1200
   - Drop unnecessary includes and reorder alphabetically.
   - Reverse xmas tree and blank line cleanups.
 * atlas-ph-sensor
   - Use msleep instead of usleep_range where the precise value doesn't
     matter and the delays are long.
 * bcm150
   - Drop transaction splitting as core now handles it.
 * cros_ec
   - Move the shared header to the include/iio/common directory.
     This brings it inline with the other multiple type devices.
   - Use drvdata directly from device rather than boucing via the
     platform_device structure.
 * hid-sensors
   - Use drvdata directly from device rather than boucing via the
     platform_device structure.
 * inv_mpu6050
   - Clear out a second function definition for the same function.
   - Don't flush fifo when the iio buffer is full but just drop excess
     data.
   - Tidy up set_power_itg and ensure it is used in the right places.
   - Use set_power_itg rather than opencoding it again in the i2c mux
     control.
   - Make sure error paths disable the power if undoing power on.
   - Used managed devm_ functions during probe. Delete remove function.
   - Refactor to pull raw data read out of read_raw function.
   - Simplify data reading error paths.
   - Only enable the i2c mux for chips with the i2c aux bus (not icm20608)
   - Fix a potential deadlock due to varying lock ordering.
   - Fix an issue where first sample from gyro after enabling is unstable
     by dropping the first sample.
   - Fix an issue where the user_ctrl register is incorrectly overwritten.
   - Tidy up some grammar and spelling minor issus.
 * mcp320x
   - Use vendor compatible strings.
 * mcp4018
   - Switch to using i2c .probe_new.
 * mcp4351
   - switch to using i2c .probe_new.
 * meson-adc
   - rework handing on common ADC platform data so it can be shared
     across multiple families of SoCs.
 * sca3000
   - Fix an error handling path if the ring configure fails.
 * st_lsm6dsx
   - Fix a wrong fifo threshold mask (no actual effect)
 * stm32-dfsdm
   - Style fixes and cleanups.
   - Check filter ID is in range and check spi-max-frequency.
 * tsl2x7x (staging)
   - Drop some unnecessary function calls, unused variables and
     unnecessary local variables.
   - Fix wrong interrupt type.
   - Avoid unnecessary double clear of interrupt.
   - Simplify proximity calibration call which did various things
     unrelated to actually calibrating.
   - Separate control of the proximity and ALS interrupts.
   - Improve consistency of logging.
   - Separate ALS and proximity persistence settings as they have
     separate hardware controls.
   - Tidy up variable ordering.
   - Add Brian to copyright notice given consider work on this driver.
   - Take advantage of hardware support for I2C address auto increment.
   - Combine individuaal enable and period attributes for the two
     directions on the threshold events into a single value as the
     hardware doesn't separate them.
   - Move integration_time* attributes from light channel to
     intensity value as they effect the intensity readings directly
     and the light reading only indirectly.  Hence this better
     reflects reality. Also move the calibscale_available.
   - Avoid returning an error in the IRQ handler.
   - Hard code the reg value in _clear_interrupts as it only takes
     one value in the code.   Result is the function has little
     purpose so opencode the two remaining i2c_smbus_write_byte
     calls.
   - Drop some unnecessary checking of the chip status register.
   - Tidy up return path in _write_interrupt_config.
   - Tidy up the ID verification code.
   - Move the power and diode settings defines into the header as these
     are needed for platform data configuration.
   - Various renames and comment cleanups for consistency and clarity.
   - Use actual device defaults for default startup settings.
   - SPDX
   - Add some range sanity checking to sysfs attribute writes.
   - Don't provide event interfaces if the interrupt line isn't available.
   - Use IIO_CONST_ATTR macro for calibscale_available as it's a constant
     string.
   - Fix the integration time and lux equations.
   - Make device IDs explicit index values in the device_channel_config array.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlr0uigRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoiRhw//bIv57xenV6WV3+7Xmrp/rG4OBVzt8riD
 d9HczYKZE8/tqfB9cjF5e/xOpfin99eXBqEMWecidh3BxMNKXgnbvvCYCXF+m47D
 3cYlWvGbyZ2lbvqwbYCkk4xKfPNbRHBo5NX9TB08wf7DrAjmaudxmxDSFrRYQCho
 3Z3H2o54z1i/iJud61TApEONxr7H5oFdeb6uwNB5UVlG7XING9mfWbmlSzdlxW4X
 lHG4hC1/Pz/F4WjiLvNKccjhuq1f60CwSppKvfihq1IZKYKyHvSWjOicwrNb3QB2
 Kr0dT8yDqNKcKU1tsfgfR+YFeLKq52Ik4whulk8mkL7E4IWVIkGbL0ewkPwZ0YqO
 Cj9Nv52vzYS7x9Dj7R6f23Lwq30a19WKXixybjdo9zV14S0XKfzTmU7xC/4yhEjh
 yUg9QPjWxE5rAUTSjNF0C6tv786Y3aVYBp2jscIroSutipa6cUyc2rOKssM6GTZs
 vyRElGiUEXbg7uI7GrwN4PJszho47ptkFGn/o88Sy90KjUJ0mP15NTlp4IeSiVc/
 sM4YHHQ7tldcKqsaKeGbH8JwJNvzj9Kh20zniYd9lSZkeZusSkZUvd1FgB5uUocb
 ZZEG2IzCLM/utH49yXyaUkRS/lqoGCcObDkIHbsE1OM8q2bnZxaUYEMumxIpAs7l
 W2LBlr3vGF4=
 =egCX
 -----END PGP SIGNATURE-----

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

Jonathan writes:

1st round of IIO new device support, features and cleanup for the 4.18 cycle

A nice mix this time of excellent cleanups (many to send drivers
speeding toward staging graduations) and new drivers / device support.
A good part of this is Brian Masney's never ending task on the tsl2x7x
driver.  The end is in sight so hopefully we'll get that one out of
staging very soon!

New device support
* AD5686
  - Support AD5685R (was wrongly present as AD5685)
  - Support AD5672R, AD5676, AD5676, AD5684R and AD5686R 4 and 8 channel
    SPI DACs with various precisions.
  - Support AD5671R, AD5675R, AD5694, AD5694R, AD5695R, AD5696 and AD5696R
    I2C DACs with various percisions and numbers of channels.
* Analog front end rescale driver - New driver.
  - Support current sensing usings a shunt resistor.
  - Support simple voltage dividers.
  - support simple current sense amplifiers.
* TI dac5571
  - New driver and device bindings supporting:
    dac5571, dac6571, dac7571, dac5574, dac6574, dac7574,
    dac5573, dac6573 and dac7573
* Meson-adc
  - Support for Meson AXG with DT bindings.
* mpu6050
  - Support the mpu9255 which only requires additional WHOAMI entry and
    compatible string.
* st_lsm6dsx
  - Support for lsm330dlc combinded accelerometer and gyro sensors with
    DT bindings.
* stm32_adc
  - Add support for STM32MP1 with bindings.

Staging graduations
* adis16201 after some excelent cleanup by Himanshu Jha.
* adis16029 after some excelent cleanup by Shreeya Patel.

New features:
* ABI docs
  - Add core ABI docs for angle channels.
* inv_mpu6050
  - Provide support for the full range of interrupts the device
    supports.
* st_accel
  - Add SMO8840 ACPI ID seen in the wild on some Lenovo machines.
* stx104
  - Provide a multiple gpio get function.

Cleanups / Minor fixes
* core
  - Use new nested structure support to improve kernel-doc.
* ad2s1200
  - Use be16_to_cpup instead of opencoding.
* ad5686
  - Indentation tidy up.
  - Switch to SPDX
  - Refactor to allow various numbers of channels.
  - Refactor to separate core and SPI specific support, prior to
    addition of i2c equivalent devices.
* ad7606
  - Use drvdata directly from device rather than boucing via the
    platform_device structure.
* ad7746
  - Replace opencoded byte swapped i2c calls with _swapped variants.
  - White space and line break readability improvements.
  - Reorder includes and variable declarations where appropriate.
* ad7791
  - Changes to the AD ADC library used by this driver took in the
    sampling frequency.  This lead to be the wrong path being the one
    tied to the resulting attribute, so it didn't work, and a warning
    to be printed.
* ad7780
  - Remove apparent support for sampling frequency control on devices
    that don't support changing the sampling attributes.
* ade7854
  - Fix a read of the wrong number of bits.
  - Improve error handling on i2c read/write errors.
  - Rework i2c and spi code to reduce duplication.
* adis16201 (staging)
  - Improve meaning inherent in some macro names by adding units etc
    where relevant.
  - Adjust comments to improve detail and drop the irrelevant.
  - Rename register address definitions definitions to add a _REG
    postfix, clearly separating them from field definitions. Reorganize
    the definitions to group register address and fields.
  - Use sign_extend32 rather than open coding.
  - Reverse Xmas tree ordering where appropriate and align function args.
  - Remove unused headers.
  - Use GENMASK where appropriate instead of open coding.
* adis16209 (staging)
  - Indent field definitions to visually separate them from
    register address definitions.
  - Use reverse xmas tree ordering where appropriate.
  - Add some whitespace where it will help readability.
  - Drop some unused headers.
  - Use GENMASK where appropriate.
* ad2s1200
  - Drop unnecessary includes and reorder alphabetically.
  - Reverse xmas tree and blank line cleanups.
* atlas-ph-sensor
  - Use msleep instead of usleep_range where the precise value doesn't
    matter and the delays are long.
* bcm150
  - Drop transaction splitting as core now handles it.
* cros_ec
  - Move the shared header to the include/iio/common directory.
    This brings it inline with the other multiple type devices.
  - Use drvdata directly from device rather than boucing via the
    platform_device structure.
* hid-sensors
  - Use drvdata directly from device rather than boucing via the
    platform_device structure.
* inv_mpu6050
  - Clear out a second function definition for the same function.
  - Don't flush fifo when the iio buffer is full but just drop excess
    data.
  - Tidy up set_power_itg and ensure it is used in the right places.
  - Use set_power_itg rather than opencoding it again in the i2c mux
    control.
  - Make sure error paths disable the power if undoing power on.
  - Used managed devm_ functions during probe. Delete remove function.
  - Refactor to pull raw data read out of read_raw function.
  - Simplify data reading error paths.
  - Only enable the i2c mux for chips with the i2c aux bus (not icm20608)
  - Fix a potential deadlock due to varying lock ordering.
  - Fix an issue where first sample from gyro after enabling is unstable
    by dropping the first sample.
  - Fix an issue where the user_ctrl register is incorrectly overwritten.
  - Tidy up some grammar and spelling minor issus.
* mcp320x
  - Use vendor compatible strings.
* mcp4018
  - Switch to using i2c .probe_new.
* mcp4351
  - switch to using i2c .probe_new.
* meson-adc
  - rework handing on common ADC platform data so it can be shared
    across multiple families of SoCs.
* sca3000
  - Fix an error handling path if the ring configure fails.
* st_lsm6dsx
  - Fix a wrong fifo threshold mask (no actual effect)
* stm32-dfsdm
  - Style fixes and cleanups.
  - Check filter ID is in range and check spi-max-frequency.
* tsl2x7x (staging)
  - Drop some unnecessary function calls, unused variables and
    unnecessary local variables.
  - Fix wrong interrupt type.
  - Avoid unnecessary double clear of interrupt.
  - Simplify proximity calibration call which did various things
    unrelated to actually calibrating.
  - Separate control of the proximity and ALS interrupts.
  - Improve consistency of logging.
  - Separate ALS and proximity persistence settings as they have
    separate hardware controls.
  - Tidy up variable ordering.
  - Add Brian to copyright notice given consider work on this driver.
  - Take advantage of hardware support for I2C address auto increment.
  - Combine individuaal enable and period attributes for the two
    directions on the threshold events into a single value as the
    hardware doesn't separate them.
  - Move integration_time* attributes from light channel to
    intensity value as they effect the intensity readings directly
    and the light reading only indirectly.  Hence this better
    reflects reality. Also move the calibscale_available.
  - Avoid returning an error in the IRQ handler.
  - Hard code the reg value in _clear_interrupts as it only takes
    one value in the code.   Result is the function has little
    purpose so opencode the two remaining i2c_smbus_write_byte
    calls.
  - Drop some unnecessary checking of the chip status register.
  - Tidy up return path in _write_interrupt_config.
  - Tidy up the ID verification code.
  - Move the power and diode settings defines into the header as these
    are needed for platform data configuration.
  - Various renames and comment cleanups for consistency and clarity.
  - Use actual device defaults for default startup settings.
  - SPDX
  - Add some range sanity checking to sysfs attribute writes.
  - Don't provide event interfaces if the interrupt line isn't available.
  - Use IIO_CONST_ATTR macro for calibscale_available as it's a constant
    string.
  - Fix the integration time and lux equations.
  - Make device IDs explicit index values in the device_channel_config array.
2018-05-11 09:50:04 +02:00
Brian Masney 9701b6e2c5 staging: iio: tsl2x7x: add device ids for code readability
This patch adds the device IDs to the device_channel_config array to
improve code readability.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:25:21 +01:00
Brian Masney 498efcd081 staging: iio: tsl2x7x: correct integration time and lux equation
The integration_time sysfs attribute did not report the correct
time. Changing the integration time would cause the reported lux to
change wildly. Once the integration time was corrected, all of the
equations, and lux tables needed to be corrected to match what the
data sheets expected. This patch corrects all of this, and adds some
more comments about how some of the constants were derived. Here are
the results from testing a TSL2772 hooked up to a Raspberry Pi 2:

# cat in_intensity0_integration_time
0.002730
# watch -n .1 cat in_illuminance0_input
; Lux hovers around 55
# echo 0.65 > in_intensity0_integration_time
# cat in_intensity0_integration_time
0.649740
# watch -n .1 cat in_illuminance0_input
; Lux hovers around 55 with noticeable lag to lux changes in watch
; process.

; Now test the ALS calibration routine.
# cat in_intensity0_calibbias
1000
# cat in_illuminance0_target_input
150
# echo 1 > in_illuminance0_calibrate
# cat in_intensity0_calibbias
2777
# watch -n .1 cat in_illuminance0_input
; Lux now hovers around 150-155

The returned lux values were tested on a TSL2772 in various lighting
conditions and the results are within the lux ranges described at
https://en.wikipedia.org/wiki/Lux.

The driver was primarily tested using a TSL2772, however some quick tests
were also ran against the devices TSL2771, TSL2572, and TMD2772.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:10:36 +01:00
Brian Masney 11031d7df0 staging: iio: tsl2x7x: use IIO_CONST_ATTR for calibscale_available
The in_intensity0_calibscale_available sysfs attribute has code that
checks the device type to determine which calibration scales are
available. This check is not necessary since all of the supported
ALS device types use the scales 1 8 16 120. This patch converts the
sysfs attribute to use IIO_CONST_ATTR. The following device datasheets
were checked: tsl2571, tsl2771, tmd2771, tsl2572, tsl2772, tmd2772.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:06:46 +01:00
Brian Masney 7775e1d1e7 staging: iio: tsl2x7x: move calibscale_available attribute to IIO_INTENSITY channel
The calibscale_available attribute is currently associated with the
IIO_LIGHT channel but should be associated with the IIO_INTENSITY
channel. This patch corrects that association and it also corrects
lines that were unnecessarily split for the
in_intensity0_integration_time sysfs attribute.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:05:37 +01:00
Brian Masney 95d22154d6 staging: iio: tsl2x7x: don't setup event handlers if interrupts are not configured
The driver would expose to userspace the events directory even if the
interrupts were not configured. This patch changes the driver so that
the events directory is not exposed to user space if interrupts are
not configured. This patch also corrects the indentation of the
chan_table_elements and info structure members.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:05:00 +01:00
Brian Masney 2a74090249 staging: iio: tsl2x7x: add range checking to three sysfs attributes
The sysfs attributes in_illuminance0_target_input,
in_illuminance0_calibrate, and in_proximity0_calibrate did not have
proper range checking in place so this patch adds the correct range
checks.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 19:01:14 +01:00
Brian Masney 5a1f2de133 staging: iio: tsl2x7x: use GPL-2.0+ SPDX license identifier
The summary text for the GPL is not needed since the SPDX identifier
is a legally binding shorthand that can be used instead.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-06 18:57:57 +01:00
David Veenstra 0bd3d338f6 staging: iio: ad2s1200: Improve readability with be16_to_cpup
The manual states that the data is contained in the upper 12 bits
of the 16 bits read by spi. The code that extracts these 12 bits
is correct for both be and le machines, but this is not clear
from a first glance.

To improve readability the relevant expressions are replaced
with equivalent expressions that use be16_to_cpup.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 18:12:03 +01:00
David Veenstra d99066e60c staging: iio: ad2s1200: Add blank lines
Add blank lines to improve readability.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
David Veenstra 0598225542 staging: iio: ad2s1200: Reverse Christmas tree ordering
Reorders the variable declarations to prefer a reverse Christmas tree
order to improve readability.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
David Veenstra 972c0c3a73 staging: iio: ad2s1200: Sort includes alphabetically
This patches sorts all the includes in alphabetic order.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
David Veenstra 0c261a912b staging: iio: ad2s1200: Remove unneeded include
This patches removes unneeded slab.h header.

Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney e1f3592634 staging: iio: tsl2x7x: rename prox_config to als_prox_config
The configuration register on the device is represented with the
prox_config member on the tsl2x7x_settings structure. According to the
TSL2772 data sheet, this register can hold: 1) the proximity drive
level, 2) ALS/Proximity long wait, and 3) the ALS gain level. This
patch renames prox_config to als_prox_config since ALS settings can
be stored here as well.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney ffb036a083 staging: iio: tsl2x7x: various comment cleanups
This patch removes several unnecessary comments, changes some comments
so that the use as much of the allowable 80 characters as possible, adds
the proper whitespace, removes some structure members from the kernel
docs that are no longer present, and improves the existing kernel doc
information for some existing structure members.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 09d0bfae7b staging: iio: tsl2x7x: use device defaults for als_time, prox_time and wait_time
This patch changes the defaults of the als_time, prox_time and
wait_time to match the defaults according to the TSL2772 datasheet.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney dc6ebdd347 staging: iio: tsl2x7x: rename prx to prox for consistency
The driver mostly uses the 'prox' naming convention for most of the
proximity settings, however prx_time and tsl2x7x_prx_gain was present.
This patch renames these to prox_time and tsl2x7x_prox_gain for
consistency with everything else in the driver.

The kernel documentation for prx_gain is corrected to prox_gain so that
it matches what is actually in the structure.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 96c44e2e61 staging: iio: tsl2x7x: move power and diode settings into header file
The power and diode defines are needed for the platform data so this
patch moves the defines out of the .c file and into the header file. A
comment for the diode is also cleaned up while this code is touched.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney dbc6cd1b0b staging: iio: tsl2x7x: simplify device id verification
This patch renames tsl2x7x_device_id() to tsl2x7x_device_id_verif(),
removes the unnecessary pointer on the id parameter, and only calls
the verification function once.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 8d0cc09058 staging: iio: tsl2x7x: simplify tsl2x7x_write_interrupt_config return
tsl2x7x_write_interrupt_config() has an unnecessary return value check
at the end of the function. This patch changes the function to just
return the value from the call to tsl2x7x_invoke_change().

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 0ba50bef8f staging: iio: tsl2x7x: remove unnecessary chip status checks in suspend/resume
tsl2x7x_suspend() and tsl2x7x_resume() both check to see what the
current chip status is. These checks are not necessary so this patch
removes those checks.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney d8e24a31cc staging: iio: tsl2x7x: simplify tsl2x7x_clear_interrupts function
tsl2x7x_clear_interrupts() takes a reg argument but there are only
two callers to this function and both callers pass the same value.
Since this function was introduced, interrupts are now working
properly for this driver, and several unnecessary calls to
tsl2x7x_clear_interrupts() were removed. This patch removes the
tsl2x7x_clear_interrupts() function and replaces the two callers
with the i2c_smbus_write_byte() call instead.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 3605dfb851 staging: iio: tsl2x7x: don't return error in IRQ handler
tsl2x7x_event_handler() could return an error and this could cause the
interrupt to remain masked. We shouldn't return an error in the
interrupt handler so this patch always returns IRQ_HANDLED. An error
will be logged if one occurs.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Brian Masney 2f58efa963 staging: iio: tsl2x7x: move integration_time* attributes to IIO_INTENSITY channel
The integration_time* attributes are currently associated with the
IIO_LIGHT channel but should be associated with the IIO_INTENSITY
channel. Directory listing of the sysfs attributes for a TSL2772
with this patch applied:

dev
events
in_illuminance0_calibrate
in_illuminance0_calibscale_available
in_illuminance0_input
in_illuminance0_lux_table
in_illuminance0_target_input
in_intensity0_calibbias
in_intensity0_calibscale
in_intensity0_integration_time
in_intensity0_integration_time_available
in_intensity0_raw
in_intensity1_raw
in_proximity0_calibrate
in_proximity0_calibscale
in_proximity0_calibscale_available
in_proximity0_raw
name
of_node
power
subsystem
uevent

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Wolfram Sang dae013afa7 staging: iio: adc: simplify getting .drvdata
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28 16:17:59 +01:00
Linus Walleij 1be5b22e1d staging: iio: Augment TODO file with GPIO work item
To make sure that these drivers do not leave staging before they
are properly converted to use the new GPIO descriptor API,
augment the TODO file with this work item.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 14:36:10 +02:00