aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-10-29Merge tag 'staging-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds3-15/+205
Pull staging/IIO driver updates from Greg KH: "Here is the big staging and IIO driver pull request for 4.20-rc1. There are lots of things here, we ended up adding more lines than removing, thanks to a large influx of Comedi National Instrument device support. Someday soon we need to get comedi out of staging... Other than the comedi drivers, the "big" things here are: - new iio drivers - delete dgnc driver (no one used it and no one had the hardware anymore) - vbox driver updates and fixes - erofs fixes - tons and tons of tiny checkpatch fixes for almost all staging drivers All of these have been in linux-next, with the last few happening a bit "late" due to them getting stuck on my laptop during travel to the Mantainers summit" * tag 'staging-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (690 commits) staging: gasket: Fix sparse "incorrect type in assignment" warnings. staging: gasket: remove debug logs for callback invocation staging: gasket: remove debug logs in page table mapping calls staging: rtl8188eu: core: Use sizeof(*p) instead of sizeof(struct P) for memory allocation staging: ks7010: Remove extra blank line staging: gasket: Remove extra blank line staging: media: davinci_vpfe: Fix spelling mistake in enum staging: speakup: Add a pair of braces staging: wlan-ng: Replace long int with long staging: MAINTAINERS: remove obsolete IPX staging directory staging: MAINTAINERS: remove NCP filesystem entry staging: rtl8188eu: cleanup comparsions to false staging: gasket: Update device virtual address comment staging: gasket: sysfs: fix attribute release comment staging: gasket: apex: fix sysfs_show staging: gasket: page_table: simplify gasket_components_to_dev_address staging: gasket: page_table: fix comment in components_to_dev_address staging: gasket: page table: fixup error path allocating coherent mem staging: gasket: page_table: rearrange gasket_page_table_entry staging: gasket: page_table: remove unnecessary PTE status set to free ...
2018-09-29iio: light: bh1750: Add device tree supportryang1-0/+11
Add device tree support for ROHM BH1750 series ambient light sensors. Signed-off-by: ryang <decatf@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-09-08iio: light: bh1750: simplify setting PM opsTomasz Duszynski1-7/+2
Relying on CONFIG_PM_SLEEP to set PM ops is not necessary since core will handle everything internally. One have to only make sure that functions that can go unused are marked with __maybe_unused. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-09-08iio: light: bh1750: switch to SPDX identifierTomasz Duszynski1-4/+1
Drop boilerplate license text and use SPDX identifier instead. Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-09-07regmap: split up regmap_config.use_single_rwDavid Frey2-12/+14
Split regmap_config.use_single_rw into use_single_read and use_single_write. This change enables drivers of devices which only support bulk operations in one direction to use the regmap_bulk_*() functions for both directions and have their bulk operation split into single operations only when necessary. Update all struct regmap_config instances where use_single_rw==true to instead set both use_single_read and use_single_write. No attempt was made to evaluate whether it is possible to set only one of use_single_read or use_single_write. Signed-off-by: David Frey <dpfrey@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-19iio: max44000: remove unused variable max44000_alstim_shiftColin Ian King1-1/+0
Variable max44000_alstim_shift is defined but is never used hence it is redundant and can be removed. This variable has been like this since the driver was added back in 2016. Cleans up clang warning: warning: 'max44000_alstim_shift' defined but not used [-Wunused-const-variable=] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-08-19iio: tsl2772: add support for regulator frameworkBrian Masney1-1/+94
This patch adds support for the regulator framework to the tsl2772 driver. Driver was tested using a LG Nexus 5 (hammerhead) phone with the two regulators and on a Raspberry Pi 2 without any regulators controlling the power to the sensor. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-08-18iio: tsl2772: add support for avago,apds9930Brian Masney1-2/+16
The Avago APDS9930 has the same register set as the TAOS/AMS TSL2772 so this patch adds the correct bindings and the appropriate LUX table values derived from the values in the datasheet. Driver was tested on a LG Nexus 5 (hammerhead) phone. avago,apds9930 datasheet: https://www.mouser.com/datasheet/2/678/avago_AV02-3190EN_DS_APDS-9930_2014-03-25[1]-1217273.pdf tsl2772 datasheet: https://ams.com/eng/content/download/291503/1066377/file/TSL2772_DS000181_2-00.pdf Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-08-18iio: tsl2772: add support for reading proximity led settings from device treeBrian Masney1-0/+81
This patch adds support for optionally reading the proximity led diode and current settings from device tree. This was tested using a LG Nexus 5 (hammerhead) which requires a different diode than the driver default for the IR LED. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-08-01iio: light: si1133: fix uninitialized resp variableMaxime Roussin-Bélanger1-0/+3
Read response register to detect any error. Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-08-01Merge branch 'fixes-togreg' into togregJonathan Cameron1-1/+1
2018-07-30iio: light: si1133 fix test for val being not zero or not one.Colin Ian King1-1/+1
The current check on val always results in true and so the call to sii1133_update_adcsens never gets called. Fix this check so it returns with -EINVAL only when val is not zero and not one. Detected by CoverityScan, CID#1472099 ("Logically dead code") Fixes: e01e7eaf37d8 ("iio: light: introduce si1133") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-29iio: vcnl4000: add support for VCNL4200Tomas Novotny2-10/+109
VCNL4200 is an integrated long distance (up to 1500mm) proximity and ambient light sensor. The support is very basic. There is no configuration of proximity and ambient light sensing yet. Only the reading of both measured values is done. The reading of ambient light and proximity values is blocking. If you request a new value too early, the driver waits for new value to be ready. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-29iio: vcnl4000: warn on incorrectly specified device idTomas Novotny1-1/+13
We can detect incorrectly specified device id for some chips, so warn user in that case. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-29iio: vcnl4000: add VCNL4010 and VCNL4020 device idTomas Novotny1-0/+9
The driver already supports VCNL4010/20 devices. The currently supported features and detectable product id are the same, so add shared id for them. This is a groundwork to extend the driver by detecting incorrectly specified device id. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-29iio: vcnl4000: make the driver extendableTomas Novotny1-18/+67
There are similar chips in the vcnl4xxx family. The initialization and communication is a bit different for members of the family, so this patch makes the driver extendable for different chips. There is no functional change. Signed-off-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-07-25Merge tag 'iio-for-4.19b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman3-0/+1081
Jonathan writes: Second set of IIO new device support, features and cleanups. There are also a couple of fixes that can wait for the coming merge window. Core new features * Support for phase channels (used in time of flight sensors amongst other things) * Support for deep UV light channel modifier. New Device Support * AD4758 DAC - New driver and dt bindings. * adxl345 - Support the adxl375 +-200g part which is register compatible. * isl29501 Time of flight sensor. - New driver * meson-saradc - Support the Meson8m2 Socs - right now this is just an ID, but there will be additional difference in future. * mpu6050 - New ID for 6515 variant. * si1133 UV sensor. - New driver * Spreadtrum SC27xx PMIC ADC - New driver and dt bindings. Features * adxl345 - Add calibration offset readback and writing. - Add sampling frequency control. Fixes and Cleanups * ad5933 - Use a macro for the channel definition to reduce duplication. * ad9523 - Replace use of core mlock with a local lock. Part of ongoing efforts to avoid confusing the purpose of mlock which is only about iio core state changes. - Fix displayed phase which was out by a factor of 10. * adxl345 - Add a link to the datasheet. - Rework the use of the address field in the chan_spec structures to allow addition of more per channel information. * adis imu - Mark switch fall throughs. * at91-sama5d2 - Fix some casting on big endian systems. * bmp280 - Drop some DT elements that aren't used and should mostly be done from userspace rather than in DT. * hx711 - add clock-frequency dt binding and resulting delay to deal with capacitance issue on some boards. - fix a spurious unit-address in the example. * ina2xx - Avoid a possible kthread_stop with a stale task_struct. * ltc2632 - Remove some unused local variables (assigned but value never used). * max1363 - Use device_get_match_data to remove some boilerplate. * mma8452 - Mark switch fall throughs. * sca3000 - Fix a missing return in a switch statement (a bad fallthrough previously!) * sigma-delta-modulator - Drop incorrect unit address from the DT example. * st_accel - Use device_get_match_data to drop some boiler plate. - Move to probe_new for i2c driver as second parameter not used. * st_sensors library - Use a strlcpy (safe in this case). * st_lsm6dsx - Add some error logging. * ti-ads7950 - SPDX - Allow simultaneous buffered and polled reads. Needed on a Lego Mindstorms EV3 where some channels are used for power supply monitoring at a very low rate. * ti-dac5571 - Remove an unused variable. * xadc - Drop some dead code.
2018-07-23iio: light: introduce si1133Maxime Roussin-Bélanger3-0/+1081
e-mail received from Silicon Lab to confirm that the licensing isn't a problem. " Dear Maxime Roussin-Belanger, The LUX calculation code only works with Si1133. As long as the software is used with Silicon Lab's sensor product, I don't see any problem. Regards, Tony " Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Reviewed-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-24iio: tsl2x7x/tsl2772: avoid potential division by zeroColin Ian King1-0/+2
It may be possible for tsl2772_get_lux to return a zero lux value and hence a division by zero can occur when lux_val is zero. Check for this case and return -ERANGE to avoid the division by zero. Detected by CoverityScan, CID#1469484 ("Division or modulo by zero") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20iio: tsl2583: correct values in integration_time_availableBrian Masney1-1/+1
The times reported by the in_illuminance_integration_time_available sysfs attribute are actually in milliseconds, not microseconds. This patch corrects the times with the correct unit. The fixes tag is inaccurate as the issue existed when the driver was still in staging. However, lots of changes occured before it graduated so this is as a good a point as any for backports. Signed-off-by: Brian Masney <masneyb@onstation.org> Fixes: f44d5c8ac399 ("staging: iio: tsl2583: move out of staging") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12staging: iio: tsl2x7x/tsl2772: move out of stagingBrian Masney3-0/+1809
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-03-17iio: cros_ec: Move cros_ec_sensors_core.h in /includeGwendal Grignou1-2/+1
Similar to other common iio frameworks, move cros_ec_sensors_core.h from drivers/iio/common/cros_ec_sensors/ to include/linux/iio/common. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAWRodrigo Siqueira2-2/+2
Usually, functions responsible for reading raw data typically relies on values from iio_chan_info_enum to correctly identify the type of data to be read. There is a set of a device driver that uses the magic number 0 instead of IIO_CHAN_INFO_RAW. This patch improves the readability by replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW in six devices driver in the IIO subsystem. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03iio: light: lv0104cs: Add support for LV0104CS light sensorJeff LaBundy3-0/+542
This patch adds support for the On Semiconductor LV0104CS ambient light sensor. Signed-off-by: Jeff LaBundy <jeff@labundy.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03iio: cros_ec: Relax sampling frequency before suspendingGwendal Grignou1-0/+1
If an application set a tight sampling frequency, given the interrupt use is a wakeup source, suspend will not happen: the kernel will receive a wake up interrupt and will cancel the suspend process. Given cros_ec sensors type is non wake up, this patch adds prepare and complete callbacks to set 1s sampling period just before suspend. This ensures the sensor hub will not be a source of interrupt during the suspend process. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-18iio: add SPDX identifier for various driversMatt Ranostay1-12/+4
Add GPLv2+ SPDX identifier and update email for author's drivers. Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-08iio: light: make a couple of config structures staticColin Ian King2-2/+2
Structures st_uvis25_i2c_regmap_config and st_uvis25_spi_regmap_config are local to the source and do not need to be in global scope, so make them both static. Cleans up sparse warnings: warning: symbol 'st_uvis25_i2c_regmap_config' was not declared. Should it be static? warning: symbol 'st_uvis25_spi_regmap_config' was not declared. Should it be static? Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-02iio: light: add support for UVIS25 sensorLorenzo Bianconi6-0/+560
add support for STMicroelectronics UVIS25 uv sensor http://www.st.com/resource/en/datasheet/uvis25.pdf - continuos mode support - i2c support - spi support - trigger mode support - system PM support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: light: Add driver for IDT ZOPT2201 ambient light and UVB sensorPeter Meerwald-Stadler3-0/+579
Driver for 20-bit ALS and UV B sensor with I2C interface exposing the following API: in_uvindex_input in_illuminance_raw in_illuminance_scale in_illuminance_scale_available in_intensity_uv_raw in_intensity_uv_scale in_intensity_uv_scale_available integration_time integration_time_available Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: cros_ec: Remove unused variablesPaolo Cretaro1-2/+0
Fix gcc warnings about variable 'ec_device' being set but not used in these files: common/cros_ec_sensors/cros_ec_sensors.c:194:25 light/cros_ec_light_prox.c:184:25 Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-11-13Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds37-112/+323
Pull staging and IIO updates from Greg KH: "Here is the "big" staging and IIO driver update for 4.15-rc1. Lots and lots of little changes, almost all minor code cleanups as the Outreachy application process happened during this development cycle. Also happened was a lot of IIO driver activity, and the typec USB code moving out of staging to drivers/usb (same commits are in the USB tree on a persistent branch to not cause merge issues.) Overall, it's a wash, I think we added a few hundred more lines than removed, but really only a few thousand were modified at all. All of these have been in linux-next for a while. There might be a merge issue with Al's vfs tree in the pi433 driver (take his changes, they are always better), and the media tree with some of the odd atomisp cleanups (take the media tree's version)" * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits) staging: lustre: add SPDX identifiers to all lustre files staging: greybus: Remove redundant license text staging: greybus: add SPDX identifiers to all greybus driver files staging: ccree: simplify ioread/iowrite staging: ccree: simplify registers access staging: ccree: simplify error handling logic staging: ccree: remove dead code staging: ccree: handle limiting of DMA masks staging: ccree: copy IV to DMAable memory staging: fbtft: remove redundant initialization of buf staging: sm750fb: Fix parameter mistake in poke32 staging: wilc1000: Fix bssid buffer offset in Txq staging: fbtft: fb_ssd1331: fix mirrored display staging: android: Fix checkpatch.pl error staging: greybus: loopback: convert loopback to use generic async operations staging: greybus: operation: add private data with get/set accessors staging: greybus: loopback: Fix iteration count on async path staging: greybus: loopback: Hold per-connection mutex across operations staging: greybus/loopback: use ktime_get() for time intervals staging: fsl-dpaa2/eth: Extra headroom in RX buffers ...
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman1-0/+1
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-09iio: light: vl6180: Correct ALS scale for non-default gain/integration timeStefan Brüns1-3/+6
The reported scale was only correct for the default settings of 100 ms integration time and gain 1. This aligns the reported scale with the behaviour of any other IIO driver and the documented ABI, but may require userspace changes if someone uses non-default settings. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09iio: light: vl6180: Cleanup als_gain lookup, avoid register readbackStefan Brüns1-41/+44
Instead of manually iterating the array of allowed gain values, use find_closest. Storing the current gain setting avoids accessing the hardware on each query. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09iio: light: vl6180: Avoid readback of integration time registerStefan Brüns1-6/+9
Instead of reading the value from the register on each query, store the set value. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-10-09iio: light: vl6180: Move range check to integration time setter, cleanupStefan Brüns1-7/+10
This improves code uniformity (range checks for als_gain are also done in the setter). Also unmangle rounding and calculation of register value. The calculated integration time it_ms is required in the next patch of the series. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-09-03iio: light: tcs3472: support out-of-threshold eventsAkinobu Mita1-8/+254
The TCS3472 device provides interrupt signal for out-of-threshold events with persistence filter. This change adds interrupt support for the threshold events and enables to configure the period of time by persistence filter. Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-22iio:light: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron37-47/+0
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-08-20Merge tag 'iio-for-4.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman2-2/+2
Jonathan writes: Second set of IIO new device support, features and cleanup for the 4.14 cycle. New device support: * ak8974 - support the AMI306. * st_magnetometer - add support for the LIS2MDL with bindings. * rockchip-saradc - add binding for rv1108 SoC (no driver change). * srf08 - add srf02 (i2c only) and srf10 support. * stm32-timer - support for the STM32H7 to existing driver. Features: * tools - move over to the tools buildsystem rather than hand rolling. - add an install section to the build. * ak8974 - use serial number to add device randomness. - add AMI306 calibration data output. * ccs811 - triggered buffer support. * srf08 - add a device tree table as the old style i2c probing is going away, - add triggered buffer support * st32-adc - add optional st,min-sample-time-nsecs binding to allow control of sampling against analog circuitry. * stm32-timer - add output compare triggers. * ti-ads1015 - add threshold event support. * ti-ads7950 - Allow use on ACPI platforms including providing a default reference voltage as there is no way to obtain this on ACPI currently. Cleanup and fixes: * ad7606 - fix an error return code in probe. * ads1015 - fix incorrect data rate setting update when capture in progress, - fix wrong scale information for the ADS1115, - make conversions work when CONFIG_PM is not set, - make sure we don't get a stale result after a runtime resume by ensuring we wait long enough, - avoid returning a false error form the buffer setup callbacks, - add enough wait time to get the correct conversion, - remove an unnecessary config register update, - add a helper to set conversion mode reducing repeated boilerplate, - use devm_iio_triggered_buffer_setup to simplify error and remove paths, - use iio_device_claim_direct_mode instead of opencoding the same. * ak8974 - mark the INT_CLEAR register as precious to prevent debugfs access. * apds9300 - constify the i2c_device_id. * at91-sama5 adc - add missing Kconfig dependency. * bma180 accel - constify the i2c_device_id. * rockchip_saradc - explicitly request exclusive reset control as part of the reset rework on going throughout the kernel. * st_accel - fix drdy configuration for a load of accelerometers that only have the int1 line. Fix is unimportant as presumably no deviec tree actually used the non existent hardware line. * st_pressure - fix drdy configuration for LPS22HB and LPS25H by dropping int2 support as they don't have this. Fix is unimportant as presumably no device tree actually used the non existent hardware line. * stm32-dac - explicitly request exclusive reset control (part of reset being reworked). * tsl2583 - constify the i2c_device_id. * xadc - coding style fixes.
2017-08-20iio: light: tsl2583: constify i2c_device_idArvind Yadav1-1/+1
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-20iio: light: apds9300: constify i2c_device_idArvind Yadav1-1/+1
i2c_device_id are not supposed to change at runtime. All functions working with i2c_device_id provided by <linux/i2c.h> work with const i2c_device_id. So mark the non-const structs as const. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-14Merge 4.13-rc5 into staging-nextGreg Kroah-Hartman1-1/+1
We need it here for iio fixes. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-07-23Merge tag 'iio-fixes-for-4.13a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linusGreg Kroah-Hartman1-1/+1
Jonathan writes: First set of IIO fixes for the 4.13 cycle. * ad2s1210 - Fix negative angular velocity reads (identified by a gcc 7 warning) * aspeed-adc - Wait for initialization sequence to finish before enabling channels. Without it no channels work. * axp288 - Revert a patch that dropped some bogus register mods. No one is entirely sure why but it breaks charging on some devices. - Fix GPADC pin read returning 0. Turns out a small sleep is needed. * bmc150 - Make sure device is restored to normal state after suspend / resume cycle. Otherwise, simple sysfs reads are broken. * tsl2563 - fix wrong event code. * st-accel - add spi 3-wire support. Needed to fix the lsm303agr accelerometer which only had 3 wires in all cases. Side effect is to enable optional 3-wire support for other devices. * st-pressure - disable multiread by default for LPS22HB (only effects SPI) * sun4i-gpadc-iio - fix unbalanced irq enable / disable * vf610 - Fix VALT slection for REFSEL bits - ensures we are using the right reference pins.
2017-07-04iio: light: rpr0521 triggered bufferMikko Koivunen1-7/+329
Set up and use triggered buffer if there is irq defined for device in device tree. Trigger producer triggers from rpr0521 drdy interrupt line. Trigger consumer reads rpr0521 data to scan buffer. Depends on previous commits of _scale and _offset. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01iio: light: tcs3472: add link to datasheetAkinobu Mita1-0/+2
Add a link to the TCS3472 datasheet in the AMS's website. Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01iio: light: tcs3472: fix ATIME register writeAkinobu Mita1-1/+1
The integration time is controlled by the ATIME register only. However, this register is written by i2c_smbus_write_word_data() in write_raw(). We actually don't need to write a subsequent register. So just use i2c_smbus_write_byte_data() instead. Cc: Peter Meerwald <pmeerw@pmeerw.net> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-24iio: light: tsl2563: use correct event codeAkinobu Mita1-1/+1
The TSL2563 driver provides three iio channels, two of which are raw ADC channels (channel 0 and channel 1) in the device and the remaining one is calculated by the two. The ADC channel 0 only supports programmable interrupt with threshold settings and this driver supports the event but the generated event code does not contain the corresponding iio channel type. This is going to change userspace ABI. Hopefully fixing this to be what it should always have been won't break any userspace code. Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-06-12Merge 4.12-rc5 into staging-nextGreg Kroah-Hartman1-2/+2
We want the IIO fixes and other staging driver fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-21iio: light: rpr0521 channel numbers reorderedMikko Koivunen1-20/+20
Move proximity channel from last to first in structs to avoid confusion later with buffered triggers. Proximity data output is first in rpr0521 register map. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 proximity offset read/writeMikko Koivunen1-0/+52
Add sysfs read/write proximity offset feature. Offset is read/write from sensor registers. Values are proximity raw 10-bit values. After applying offset value, output values will be (measured_raw - offset_value). Output values are unsigned so offset value doesn't make output negative. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>