aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
AgeCommit message (Collapse)Author
2023-05-17staging: iio: resolver: ads1210: fix config modeNuno Sá
commit 16313403d873ff17a587818b61f84c8cb4971cef upstream. As stated in the device datasheet [1], bits a0 and a1 have to be set to 1 for the configuration mode. [1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf Fixes: b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup") Cc: stable <stable@kernel.org> Signed-off-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20230327145414.1505537-1-nuno.sa@analog.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-15staging:iio:adc:ad7280a: Fix handing of device address bit reversing.Jonathan Cameron
[ Upstream commit f281e4ddbbc0b60f061bc18a2834e9363ba85f9f ] 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: 065a7c0b1fec ("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-03staging: iio: cdc: ad7746: avoid overwrite of num_channelsLucas Stankus
commit 04f5b9f539ce314f758d919a14dc7a669f3b7838 upstream. AD7745 devices don't have the CIN2 pins and therefore can't handle related channels. Forcing the number of AD7746 channels may lead to enabling more channels than what the hardware actually supports. Avoid num_channels being overwritten after first assignment. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> Fixes: 83e416f458d53 ("staging: iio: adc: Replace, rewrite ad7745 from scratch.") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-27staging: iio: ad2s1210: Fix SPI readingDragos Bogdan
commit 5e4f99a6b788047b0b8a7496c2e0c8f372f6edf2 upstream. If the serial interface is used, the 8-bit address should be latched using the rising edge of the WR/FSYNC signal. This basically means that a CS change is required between the first byte sent, and the second one. This change splits the single-transfer transfer of 2 bytes into 2 transfers with a single byte, and CS change in-between. Note fixes tag is not accurate, but reflects a point beyond which there are too many refactors to make backporting straight forward. Fixes: b19e9ad5e2cb ("staging:iio:resolver:ad2s1210 general driver cleanup.") Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-13Staging: iio: adt7316: Fix i2c data reading, set the data fieldShreeya Patel
[ Upstream commit 688cd642ba0c393344c802647848da5f0d925d0e ] adt7316_i2c_read function nowhere sets the data field. It is necessary to have an appropriate value for it. Hence, assign the value stored in 'ret' variable to data field. This is an ancient bug, and as no one seems to have noticed, probably no sense in applying it to stable. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-07-14staging:iio:ad7150: fix threshold mode config bitMelissa Wen
[ Upstream commit df4d737ee4d7205aaa6275158aeebff87fd14488 ] According to the AD7150 configuration register description, bit 7 assumes value 1 when the threshold mode is fixed and 0 when it is adaptive, however, the operation that identifies this mode was considering the opposite values. This patch renames the boolean variable to describe it correctly and properly replaces it in the places where it is used. Fixes: 531efd6aa0991 ("staging:iio:adc:ad7150: chan_spec conv + i2c_smbus commands + drop unused poweroff timeout control.") Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-05-08staging: iio: adt7316: fix the dac write calculationJeremy Fertic
commit 78accaea117c1ae878774974fab91ac4a0b0e2b0 upstream. 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: 35f6b6b86ede ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08staging: iio: adt7316: fix the dac read calculationJeremy Fertic
commit 45130fb030aec26ac28b4bb23344901df3ec3b7f upstream. 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: 35f6b6b86ede ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-08staging: iio: adt7316: allow adt751x to use internal vref for all dacsJeremy Fertic
commit 10bfe7cc1739c22f0aa296b39e53f61e9e3f4d99 upstream. With adt7516/7/9, internal vref is available for dacs a and b, dacs c and d, or all dacs. The driver doesn't currently support internal vref for all dacs. Change the else if to an if so both bits are checked rather than just one or the other. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27staging: iio: ad7192: Fix ad7193 channel addressMircea Caprioru
commit 7ce0f216221856a17fc4934b39284678a5fef2e9 upstream. This patch fixes the differential channels addresses for the ad7193. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27Staging: iio: meter: fixed typoLeonard Pollak
commit 0a8a29be499cbb67df79370aaf5109085509feb8 upstream. This patch fixes an obvious typo, which will cause erroneously returning the Peak Voltage instead of the Peak Current. Signed-off-by: Leonard Pollak <leonardp@tr-host.de> Cc: <Stable@vger.kernel.org> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-12staging: iio: ad7780: update voltage on readRenato Lui Geh
[ Upstream commit 336650c785b62c3bea7c8cf6061c933a90241f67 ] The ad7780 driver previously did not read the correct device output, as it read an outdated value set at initialization. It now updates its voltage on read. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Acked-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12staging:iio:ad2s90: Make probe handle spi_setup failureMatheus Tavares
[ Upstream commit b3a3eafeef769c6982e15f83631dcbf8d1794efb ] Previously, ad2s90_probe ignored the return code from spi_setup, not handling its possible failure. This patch makes ad2s90_probe check if the code is an error code and, if so, do the following: - Call dev_err with an appropriate error message. - Return the spi_setup's error code. Note: The 'return ret' statement could be out of the 'if' block, but this whole block will be moved up in the function in the patch: 'staging:iio:ad2s90: Move device registration to the end of probe'. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12staging: iio: adc: ad7280a: handle error from __ad7280_read32()Slawomir Stepien
[ Upstream commit 0559ef7fde67bc6c83c6eb6329dbd6649528263e ] Inside __ad7280_read32(), the spi_sync_transfer() can fail with negative error code. This change will ensure that this error is being passed up in the call stack, so it can be handled. Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-11-21staging:iio:ad7606: fix voltage scalesAlexandru Ardelean
[ Upstream commit 4ee033301c898dd0835d035d0e0eb768a3d35da1 ] Fixes commit 17be2a2905a6ec9aa27cd59521495e2f490d2af0 ("staging: iio: ad7606: replace range/range_available with corresponding scale"). The AD7606 devices don't have a 2.5V voltage range, they have 5V & 10V voltage range, which is selectable via the `gpio_range` descriptor. The scales also seem to have been miscomputed, because when they were applied to the raw values, the results differ from the expected values. After checking the ADC transfer function in the datasheet, these were re-computed. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-30staging:iio:impedance-analyzer:ad5933: Macro replacement Cleanups.Karim Eshapa
Doing some macro replacement to start an array of structures so it can be reused by manipulating it with different values. Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-24staging:iio:accel:adis16240: sign extend function replace hard code duplicationKarim Eshapa
Use sign_extend32 kernel function instead of code duplication, Safe also for 16 bit. and remove declaration of bits variable not needed. Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-16staging:iio:accel:adis16203: sign extend function rather code duplicationKarim Eshapa
Use sign_extend32 kernel function instead of code duplication. This function is also safe for 16 bits. Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10staging: iio: adc: ad7606: fix function pointer parameter names missing.Giulio Benetti
Checkpatch.pl complains about function pointer parameter names missing. Add parameter names. Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com> Reviewed-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-10staging: iio: Drop ADIS16060 driver from stagingJonathan Cameron
This part has been declared "not for new designs". It is now difficult to obtain and we have had no-one come forward with hardware making it difficult to proceed with the necessary work to move this driver out of staging. The device uses two separate chip selects and would require locking between them which is thought to be difficult to enforce without non trivial changes in the SPI subsystem. This work simply isn't worth doing given the status of the part and the fact no one seems to have gone for a similar hardware design since this one. If anyone does have access to one of these and is willing to contribute the time necessary then we can reevaluate dropping the driver. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20staging:iio:meter: Drop ADE7759 driverJonathan Cameron
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-20staging:iio:meter: Drop ADE7758 driverJonathan Cameron
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-20staging:iio:meter: Drop ADE7754 driverJonathan Cameron
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-20staging:iio:meter: Drop ADE7753 driverJonathan Cameron
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-20staging: iio: ad2s1200: Move driver out of stagingDavid Veenstra
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-20staging: iio: ad2s1200: Add copyrightDavid Veenstra
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-20staging: iio: ad2s1200: Add scaling factor for angle channelDavid Veenstra
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-20staging: iio: ad2s1200: Add scaling factor for angular velocity channelDavid Veenstra
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-20staging: iio: ad2s1200: Add dt tableDavid Veenstra
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-20staging: iio: ad2s1200: Replace platform data with dt bindingsDavid Veenstra
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-20staging: iio: ad2s1200: Replace legacy gpio API with modern APIDavid Veenstra
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-20staging: iio: ad2s1200: Setup spi before iio device registerDavid Veenstra
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-20staging: iio: ad2s1200: Add kernel docs to driver stateDavid Veenstra
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-20staging: iio: ad2s1200: Remove unneeded initializationsDavid Veenstra
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-20staging: iio: ad2s1200: Remove unneeded newline in licenseDavid Veenstra
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-12staging: iio: tsl2x7x/tsl2772: move out of stagingBrian Masney
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-12staging: iio: tsl2x7x: rename driver to tsl2772Brian Masney
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-12staging: iio: tsl2x7x: add range checking to tsl2x7x_write_rawBrian Masney
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-12staging: iio: tsl2x7x: correct IIO_EV_INFO_PERIOD valuesBrian Masney
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-12staging: iio: tsl2x7x: convert to use read_availBrian Masney
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-12staging: iio: tsl2x7x: use macro to populate tsl2X7X_device_infoBrian Masney
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-12staging: iio: tsl2x7x: turn chip off if IIO device registration failsBrian Masney
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-12staging: iio: tsl2x7x: use direct returnsBrian Masney
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-12staging: iio: tsl2x7x: remove unnecessary whitespaceBrian Masney
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-11Merge tag 'iio-for-4.18a' of ↵Greg Kroah-Hartman
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-06staging: iio: tsl2x7x: add device ids for code readabilityBrian Masney
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-06staging: iio: tsl2x7x: correct integration time and lux equationBrian Masney
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-06staging: iio: tsl2x7x: use IIO_CONST_ATTR for calibscale_availableBrian Masney
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-06staging: iio: tsl2x7x: move calibscale_available attribute to IIO_INTENSITY ↵Brian Masney
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-06staging: iio: tsl2x7x: don't setup event handlers if interrupts are not ↵Brian Masney
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>