aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-05-20staging:iio:meter: Drop ADE7759 driverJonathan Cameron3-569/+0
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 Cameron6-1439/+0
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 Cameron3-676/+0
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 Cameron3-641/+0
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 Veenstra3-223/+0
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 Veenstra1-0/+2
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 Veenstra1-0/+6
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 Veenstra1-26/+45
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 Veenstra1-0/+8
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 Veenstra1-17/+15
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 Veenstra1-7/+8
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 Veenstra1-6/+7
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 Veenstra1-0/+8
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 Veenstra1-2/+2
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 Veenstra1-1/+0
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 Masney6-1922/+0
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 Masney4-366/+368
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 Masney1-1/+12
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 Masney2-20/+25
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 Masney1-17/+76
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 Masney1-45/+16
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 Masney1-1/+4
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 Masney1-33/+16
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 Masney2-12/+11
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 git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman14-1771/+649
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 Masney1-10/+10
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 Masney2-98/+79
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 Masney1-42/+4
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 channelBrian Masney1-13/+10
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 configuredBrian Masney1-18/+112
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-06staging: iio: tsl2x7x: add range checking to three sysfs attributesBrian Masney1-17/+11
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-06staging: iio: tsl2x7x: use GPL-2.0+ SPDX license identifierBrian Masney2-24/+2
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-04-28staging: iio: ad2s1200: Improve readability with be16_to_cpupDavid Veenstra1-7/+4
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-28staging: iio: ad2s1200: Add blank linesDavid Veenstra1-0/+7
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-28staging: iio: ad2s1200: Reverse Christmas tree orderingDavid Veenstra1-2/+2
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-28staging: iio: ad2s1200: Sort includes alphabeticallyDavid Veenstra1-6/+6
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-28staging: iio: ad2s1200: Remove unneeded includeDavid Veenstra1-1/+0
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-28staging: iio: tsl2x7x: rename prox_config to als_prox_configBrian Masney2-5/+7
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-28staging: iio: tsl2x7x: various comment cleanupsBrian Masney2-56/+51
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-28staging: iio: tsl2x7x: use device defaults for als_time, prox_time and wait_timeBrian Masney1-3/+3
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-28staging: iio: tsl2x7x: rename prx to prox for consistencyBrian Masney2-9/+9
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-28staging: iio: tsl2x7x: move power and diode settings into header fileBrian Masney2-12/+12
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-28staging: iio: tsl2x7x: simplify device id verificationBrian Masney1-6/+5
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-28staging: iio: tsl2x7x: simplify tsl2x7x_write_interrupt_config returnBrian Masney1-6/+1
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-28staging: iio: tsl2x7x: remove unnecessary chip status checks in suspend/resumeBrian Masney1-14/+2
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-28staging: iio: tsl2x7x: simplify tsl2x7x_clear_interrupts functionBrian Masney1-17/+15
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-28staging: iio: tsl2x7x: don't return error in IRQ handlerBrian Masney1-4/+2
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-28staging: iio: tsl2x7x: move integration_time* attributes to IIO_INTENSITY channelBrian Masney1-10/+10
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-28staging: iio: adc: simplify getting .drvdataWolfram Sang1-4/+2
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-23staging: iio: Augment TODO file with GPIO work itemLinus Walleij1-1/+8
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>