aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/iio
AgeCommit message (Collapse)AuthorFilesLines
2016-11-13staging: iio: tsl2583: move out of stagingGravatar Brian Masney 4-941/+0
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: add copyright and MODULE_AUTHORGravatar Brian Masney 1-1/+3
Add Brian Masney's copyright to the header and to the MODULE_AUTHOR for all of the staging cleanups that has been done to this driver. The original MODULE_AUTHOR() did not have a space between his name and email address. This patch also adds the missing space. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove unnecessary variable initializationGravatar Brian Masney 1-2/+2
The ret variable in tsl2583_suspend() and tsl2583_resume() was initialized to 0. This is not necessary so this patch removes the initialization. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove unnecessary memset callGravatar Brian Masney 1-3/+0
The entries in the lux table (als_device_lux) can be updated via sysfs through the function in_illuminance_lux_table_store(). The last row in the table must be terminated with values that are zero. The sysfs code already ensures that the last row is all zeros. The call to memset to clear out the table is not needed so this patch removes the unnecessary call. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove comment for tsl2583_probe()Gravatar Brian Masney 1-4/+0
The comment for tsl2583_probe() does not provide any useful value. This patch removes the comment. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: clarified comment about clearing interruptsGravatar Brian Masney 1-2/+3
The comment that describes the code that clears the interrupt bit was vague and didn't provide much value. This patch adds more detail about why that bit needs to be cleared. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: add tsl2583 to list of supported devices in the headerGravatar Brian Masney 1-1/+1
The header only listed the tsl2580 and tsl2581 devices as supported by this driver. This patch adds the tsl2583 since it is also supported by this driver. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: move from a global to a per device lux tableGravatar Brian Masney 1-34/+46
The driver contains a global lux table that can be updated via sysfs. Change this to a per device lux table so that multiple devices can be hooked up to the same system with different lux tables. There are 10 entries, plus 1 for the termination segment, set aside for the entries in the lux table. When updating the lux table via sysfs, only 9 entries, plus the terminator, could be added. This changes the code to allow for the 10 entries, plus the terminator. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: don't assume an unsigned int is 32 bitsGravatar Brian Masney 1-1/+1
in_illuminance_lux_table_store assumes that an unsigned int is 32 bits. Replace this with sizeof(value[1]). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove unnecessary parenthesesGravatar Brian Masney 1-2/+2
in_illuminance_lux_table_store() contains some unnecessary parentheses. This patch removes them since they provide no value. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: change tsl2583_als_calibrate() to return 0 on successGravatar Brian Masney 1-1/+1
tsl2583_als_calibrate() returns the newly computed gain_trim if the calibration was successful. This function is only called by in_illuminance_calibrate_store() and the return value inside that sysfs attribute is only checked to see if an error was returned. This patch changes tsl2583_als_calibrate() to return 0 on success. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: moved code block inside else statementGravatar Brian Masney 1-11/+12
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if the ratio is not equal to zero. Move the code block inside the else statement. This does away with the need to initialize the variables to zero. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: updated code comment to match what the code doesGravatar Brian Masney 1-1/+5
If channel 0 does not have any data, then the code sets the lux to zero. The corresponding comment says that the last value is returned. This updates the comment to correctly reflect what the code does. It also clarifies the comment about why 0 is returned. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: fix multiline comment syntaxGravatar Brian Masney 1-5/+9
The definition of the tsl2583_device_lux struct has a series of single line comments. There are two other cases where the multiline comments did not have an initial blank line. Change these comments to use the proper multiline syntax. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: combine sysfs documentationGravatar Brian Masney 2-21/+15
There are two separate files describing the tsl2583 sysfs attributes. Combine the two files into one. Updated the name of the sysfs attributes to match the current ABI. Signed-off-by: Brian Masney <masneyb@onstation.org> Suggested-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: change newlines to improve readabilityGravatar Brian Masney 1-2/+12
Add and remove newlines to improve code readability in preparation for moving the driver out of staging. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: fix comparison between signed and unsigned integersGravatar Brian Masney 1-3/+4
Fixed warning found by make W=2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: fix alignment of #define valuesGravatar Brian Masney 1-5/+5
Most of the values in the #defines have their values aligned on a single column, but some do not. This changes the remaining defines to use consistent alignment with the majority to improve code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: unify function and variable prefix to tsl2583_Gravatar Brian Masney 1-107/+107
Some functions and variables were prefixed with either taos, tsl258x, taos2583, or tsl2583. Change everything to use the tsl2583 prefix since that is the name of the .c file. The taos_settings member inside the taos_settings struct was renamed to als_settings. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: cleaned up loggingGravatar Brian Masney 1-30/+43
There are several places in the code where the function name is hardcoded in the log message. Use the __func__ constant string to build the log message. This also clarifies some of the error messages to match the code and ensures that the correct priority is used since the message is already being changed. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove the FSF's mailing addressGravatar Brian Masney 1-4/+0
Address warning from checkpatch: CHECK: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove redundant write to the control register in ↵Gravatar Brian Masney 1-8/+0
taos_probe() taos_probe() calls i2c_smbus_write_byte() to select the control register, however there are no subsequent calls to i2c_smbus_read_byte(). The write call is unnecessary and is removed by this patch. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: change current chip state from a tristate to a boolGravatar Brian Masney 1-13/+7
The current chip state is represented as a tristate (working, suspended, and unknown). The unknown state was not used. This patch changes the chip state so that it is now represented as a single boolean value (suspended). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove unnecessary chip status checks in suspend/resumeGravatar Brian Masney 1-13/+3
The device probing and the suspend/resume code checks a flag internal to the driver that determines whether or not the chip is in a working state. These checks are not needed. This patch removes the unnecessary checks. It will do no harm to the hardware if the chip is reinitialized if it is already powered on. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: remove unnecessary chip status check in taos_get_luxGravatar Brian Masney 1-7/+0
taos_get_lux checks to see if the chip is in a working state. This check is not necessary since it is only called from tsl2583_read_raw and in_illuminance_calibrate_store (via taos_als_calibrate). The chip state is already checked by these functions. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13staging: iio: tsl2583: check if chip is in a working state in ↵Gravatar Brian Masney 1-3/+14
in_illuminance_calibrate_store in_illuminance_calibrate_store() did not check to see if the chip is in a working state. This patch adds the proper check. The return value from taos_als_calibrate() was also not checked in this function, so the proper check was also added while changes are being made here. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12staging: iio: tsl2583: fix issue with changes to calibscale and int_time not ↵Gravatar Brian Masney 1-33/+52
being set on the chip When updating the in_illuminance_calibscale and in_illuminance_integration_time sysfs attributes, these values were not actually written to the chip. The chip would continue to use the old parameters. Extracted out tsl2583_set_als_gain() and tsl2583_set_als_time() functions that are now called when these sysfs attributes are updated. The chip initialization also calls these these new functions. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12staging: iio: tsl2583: split out functionality of taos_chip_on()Gravatar Brian Masney 1-64/+58
taos_chip_on() reads an eight member array called taos_config that contains the desired state of the chip's registers. Only four of the registers actually need to be written to. The four that do not need to be written to are for the {low,high} byte of the lower interrupt threshold and the {low,high} byte of the upper interrupt threshold. Interrupts are currently not supported by this driver so there is no need to write to these registers. This patch removes the taos_config array and separates out the i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG registers. This is part of a larger refactor that was split up to make the code review easier. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08staging: iio: tsl2583: fix unused function warningGravatar Arnd Bergmann 1-12/+3
Removing a call to the taos_chip_off() makes it unused when CONFIG_PM is disabled: drivers/staging/iio/light/tsl2583.c:438:12: error: ‘taos_chip_off’ defined but not used [-Werror=unused-function] This removes all the #ifdef in this file, and marks the PM functions as __maybe_unused instead, which is more reliable and gives us better compile time coverage. Fixes: 0561155f6fc5 ("staging: iio: tsl2583: don't shutdown chip when updating the lux table") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08staging: iio: ad9832: allocate data before usingGravatar Arnd Bergmann 1-7/+7
The regulator changes assigned data to an uninitialized pointer: drivers/staging/iio/frequency/ad9832.c: In function 'ad9832_probe': drivers/staging/iio/frequency/ad9832.c:214:11: error: 'st' may be used uninitialized in this function [-Werror=maybe-uninitialized] This moves the allocation of the 'st' structure before its first use, as it should have been. Fixes: 43a07e48af44 ("staging: iio: ad9832: clean-up regulator 'reg'") Fixes: a98461d79ba5 ("staging: iio: ad9832: add DVDD regulator") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-07Merge tag 'iio-for-4.10b' of ↵Gravatar Greg Kroah-Hartman 8-423/+394
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing Jonathan writes: Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle This includes two branch merges for elements that may also go via MFD. New device support * cros_ec - new driver to support these Chrome OS contiguous sensors which are behind the Chrome OS embedded controller. Requires a few minor MFD and chrome platform changes. One follow up fix deals with some dependency issues in Kconfig. * mpu-3050 - new driver and device tree bindings for this venerable device. * st_accel - support for the lng2dm an Driver features * ad7192 - Add DVdd regulator handling * ad9832 - Add DVDD regulator handling * at91 - Suspend and resume support * si7020 - Device tree bindings * ti-am335x - DMA support - uses dma to accelerate short bursts of read back rather than full blown DMA buffer support. Greatly improved performance. Includes an MFD addition to give access to the address needed for DMA. * tsl2583 - Device tree bindings Cleanups and minor fixes * ad7192 - Fix regulator naming to match datasheet - Handle regulator errors correctly (so as to not break deferred probing) - Rename reg variable to reflect which regulator it is * ad5933 - Fix regulator naming to match datasheet - Handle regulator errors correctly (so as to not break deferred probing) * ad7746 - Fix a missing return value (fallout from previous patch set) * ad7780 - Fix regulator naming to match datasheet - Handle regulator errors correctly (so as to not break deferred probing) * ad9832 - Fix regulator naming to match datasheet - Handle regulator errors correctly (so as to not break deferred probing) - Rename reg regulator to reflect which one it is * ad9834 - Fix regulator naming to match datasheet - Handle regulator errors correctly (so as to not break deferred probing) * hts221 - Remove a duplicated include * maxim thermocouple - Handle a wrong storage side in read function. Prevent any problems that might be introduced by additions to this driver in future. * tsl2583 - big set from Brian Masney to drive this towards a staging graduation. - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps) - Improved error handling in various functions - Drop redundant power_state custom sysfs attribute. - Use IIO_*_ATTR* macros for remaining attributes. - Return an error code to userspace on invalid parameters being writen to sysfs files. - Add locking to various attribute accesses to remove possible races. - Add defines for various magic numbers. - Use smbus_read_byte_data instead of a write_byte followed by read_byte. - Query only relevant registers in probe. - Tidy up ordering of code comments. - Remove a pointless power off sequence in taos_chip_on. - Don't bother shutting down the chip when updating the lux table. The table is held entirely in the driver and doesn't effect the chip at all. - Drop a redundant i2c call in taos_als_calibrate where the same register is read twice in a row.
2016-11-06staging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate()Gravatar Brian Masney 1-12/+1
taos_als_calibrate() queries the control register to determine if the unit is powered on and has the ADC enabled. It then queries the same register a second time to determine if the ADC reading is valid. This patch removes the redundant i2c_smbus_read_byte_data() call. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06staging: iio: tsl2583: don't shutdown chip when updating the lux tableGravatar Brian Masney 1-10/+0
in_illuminance_lux_table_store() shuts down the chip, updates the contents of the lux table, and then turns the chip back on. The values in lux table are not used by the chip and are only used internally by the driver. It is not necessary to change the power state on the chip. This patch removes the calls to taos_chip_off() and taos_chip_on() in in_illuminance_lux_table_store(). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06staging: iio: tsl2583: remove redundant power off sequence in taos_chip_on()Gravatar Brian Masney 1-11/+2
taos_chip_on() explicitly turns the sensor power on and then writes the 8 registers that are stored in taos_config. The first register in taos_config is the CONTROL register and the configuration is set to turn the power off. The existing state sequence in taos_chip_on() is: - Turn device power on - Turn device power off (via taos_config) - Configure other 7 registers (via taos_config) - Turn device power on, enable ADC This patch changes the code so that the device is not powered off via taos_config. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06staging: iio: tsl2583: fixed ordering of commentsGravatar Brian Masney 1-6/+13
in taos_defaults() The comments in taos_defaults() appear after the line of code that they apply to. This patch moves the comments so that they appear before the code. Some of the comments were updated to be more informative. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06staging: iio: tsl2583: removed unused code from device probingGravatar Brian Masney 1-24/+13
taos_probe() queries the all of the sensor's registers and loads all of the values into a buffer stored on the stack. Only the chip ID register was actually used. Change the probe function to just query the chip ID register on the device. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-06staging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migrationGravatar Brian Masney 1-69/+16
There were several places where the driver would first call i2c_smbus_write_byte() to select the register on the device, and then call i2c_smbus_read_byte() to get the contents of that register. The code would look roughly like: /* Select register */ i2c_smbus_write_byte(client, REGISTER); /* Read the the last register that was written to */ int data = i2c_smbus_read_byte(client); Rewrite this to use i2c_smbus_read_byte_data() to combine the two calls into one: int data = i2c_smbus_read_byte_data(chip->client, REGISTER); Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. This fixes the following warnings that were found by the kbuild test robot that were introduced by commit 8ba355cce3c6 ("staging: iio: tsl2583: check for error code from i2c_smbus_read_byte()"). drivers/staging/iio/light/tsl2583.c:365:5-12: WARNING: Unsigned expression compared with zero: reg_val < 0 drivers/staging/iio/light/tsl2583.c:388:5-12: WARNING: Unsigned expression compared with zero: reg_val < 0 This also removes the need for the taos_i2c_read() function since all callers were only calling the function with a length of 1. Signed-off-by: Brian Masney <masneyb@onstation.org> Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: ad9832: clean-up regulator 'reg'Gravatar Eva Rachel Retuya 2-13/+11
Rename regulator 'reg' to 'avdd' so as to be clear what regulator it stands for specifically. Additionally, get rid of local variable 'reg' and use direct assignment instead. Update also the goto label pertaining to the avdd regulator during disable. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: ad9832: add DVDD regulatorGravatar Eva Rachel Retuya 2-9/+26
The AD9832/AD9835 is supplied with two power sources: AVDD as analog supply voltage and DVDD as digital supply voltage. Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error occurs. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: ad7192: rename regulator 'reg' to 'avdd'Gravatar Eva Rachel Retuya 1-11/+11
Rename regulator 'reg' to 'avdd' so as to be clear what regulator it stands for specifically. Also, update the goto label accordingly. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: ad7192: add DVdd regulatorGravatar Eva Rachel Retuya 1-1/+18
The AD7190/AD7192/AD7193/AD7195 is supplied with two power sources: AVdd as analog supply voltage and DVdd as digital supply voltage. Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error occurs. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: rework regulator handlingGravatar Eva Rachel Retuya 5-43/+46
Currently, the affected drivers ignore all errors from regulator_get(). The way it is now, it also breaks probe deferral (EPROBE_DEFER). The correct behavior is to propagate the error to the upper layers so they can handle it accordingly. Rework the regulator handling so that it matches the standard behavior. If the specific design uses a static always-on regulator and does not explicitly specify it, regulator_get() will return the dummy regulator. The following semantic patch was used to apply the change: @r1@ expression reg, dev, en, volt; @@ reg = \(devm_regulator_get\|regulator_get\)(dev, ...); if ( - ! IS_ERR(reg)) + return PTR_ERR(reg); ( - { en = regulator_enable(reg); - if (en) return en; } + + en = regulator_enable(reg); + if (en) { + dev_err(dev, "Failed to enable specified supply\n"); + return en; } | + - { en = regulator_enable(reg); - if (en) return en; - volt = regulator_get_voltage(reg); } + en = regulator_enable(reg); + if (en) { + dev_err(dev, "Failed to enable specified supply\n"); + return en; + } + volt = regulator_get_voltage(reg); ) @r2@ expression arg; @@ - if (!IS_ERR(arg)) regulator_disable(arg); + regulator_disable(arg); Hand-edit the debugging prints with the supply name to become more specific. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05staging: iio: set proper supply name to devm_regulator_get()Gravatar Eva Rachel Retuya 5-5/+5
The name passed to devm_regulator_get() should match the name of the supply as specified in the device datasheet. This makes it clear what power supply is being referred to in case of presence of other regulators. Currently, the supply name specified on the affected devices is 'vcc'. Use lowercase version of the datasheet name to specify the supply voltage. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: cdc: ad7746: add additional config definesGravatar Eva Rachel Retuya 1-16/+22
Introduce defines for shifting and mask under the config register for better readability. Also, introduce helper variables for index calculation. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: add locking to sysfs attributesGravatar Brian Masney 1-1/+15
in_illuminance_input_target_show(), in_illuminance_input_target_store(), in_illuminance_calibrate_store(), and in_illuminance_lux_table_store() accesses data from the tsl2583_chip struct. Some of these fields can be modified by other parts of the driver concurrently. This patch adds the mutex locking to these sysfs attributes. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: add error code to sysfs store functionsGravatar Brian Masney 1-6/+4
in_illuminance_input_target_store() and in_illuminance_calibrate_store() validated the data from userspace, however it would not return an error code to userspace if an invalid value was passed in. This patch changes these functions so that they return -EINVAL if invalid data is passed in. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: use IIO_*_ATTR* macros to create sysfs entriesGravatar Brian Masney 1-46/+27
Use the IIO_CONST_ATTR, IIO_DEVICE_ATTR_RW, and IIO_DEVICE_ATTR_WO macros for creating the in_illuminance_calibscale_available, in_illuminance_integration_time_available, in_illuminance_input_target, in_illuminance_calibrate, and in_illuminance_lux_table sysfs entries. Previously these sysfs entries were prefixed with illuminance0_, however they are now prefixed with in_illuminance_ to make these sysfs entries consistent with how the IIO core is creating the other sysfs entries. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use ↵Gravatar Brian Masney 1-64/+25
iio_chan_spec The illuminance0_calibscale sysfs attribute is not currently created by the IIO core. This patch adds the appropriate mask to iio_chan_spec, along with the appropriate data handling in the read_raw() and write_raw() functions, so that the sysfs attribute is created by the IIO core. With this change, this sysfs entry will have its prefix changed from illuminance0_ to in_illuminance_. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: convert to use iio_chan_spec and {read,write}_rawGravatar Brian Masney 1-93/+143
The tsl2583 driver directly creates sysfs attributes that should instead be created by the IIO core on behalf of the driver. This patch adds the iio_chan_spec array, the relevant info_mask elements and the read_raw() and write_raw() functions to take advantage of features provided by the IIO core. These sysfs attributes were migrated with this patch: illuminance0_input, illuminance0_calibbias, illuminance0_integration_time. This also exposes the raw values read from the two channels on the sensor. With this change, these four sysfs entries have their prefix changed from illuminance0_ to in_illuminance_. This is deemed to be acceptable since none of the IIO light drivers in mainline use the illuminance0_ prefix, however 8 of the IIO light drivers in mainline use the in_illuminance_ prefix. Also fix the units of integration_time to meet with the ABI. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01staging: iio: tsl2583: check return values from taos_chip_{on,off}Gravatar Brian Masney 1-8/+18
The return value from taos_chip_on() and taos_chip_off() was not checked in taos_luxtable_store() and taos_probe(). This patch adds proper error checking to these function calls. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>