aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light (follow)
AgeCommit message (Collapse)AuthorFilesLines
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>
2017-05-21iio: light: rpr0521 sample_frequency read/writeMikko Koivunen1-0/+117
Add sysfs read/write sample frequency. 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 whitespace fixesMikko Koivunen1-0/+3
Just whitespace change, no functional changes. 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 magic number to sizeof() on value readMikko Koivunen1-1/+1
Changed magic number to sizeof() on value read. 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 on-off sequence change for CONFIG_PMMikko Koivunen1-24/+46
Refactor _set_power_state(), _resume() and _suspend(). Enable measurement only when needed, not in _init(). System can suspend during measurement and measurement is continued on resume. Pm turns off measurement when both ps and als measurements are disabled for 2 seconds. During off-time the power save is 20-500mA, typically 180mA. 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 poweroff for probe failsMikko Koivunen1-2/+15
Set sensor measurement off after probe fail in pm_runtime_set_active() or iio_device_register(). Without this change sensor measurement stays on even though probe fails on these calls. This is maybe rare case, but causes constant power drain without any benefits when it happens. Power drain is 20-500uA, typically 180uA. 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 disable sensor -bugfixMikko Koivunen1-2/+8
Sensor was marked enabled on each call even if the call was for disabling sensor. 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: ltr501 Fix interchanged als/ps register fieldFranziska Naepelt1-2/+2
The register mapping for the IIO driver for the Liteon Light and Proximity sensor LTR501 interrupt mode is interchanged (ALS/PS). There is a register called INTERRUPT register (address 0x8F) Bit 0 represents PS measurement trigger. Bit 1 represents ALS measurement trigger. This two bit fields are interchanged within the driver. see datasheet page 24: http://optoelectronics.liteon.com/upload/download/DS86-2012-0006/S_110_LTR-501ALS-01_PrelimDS_ver1%5B1%5D.pdf Signed-off-by: Franziska Naepelt <franziska.naepelt@idt.com> Fixes: 7ac702b3144b6 ("iio: ltr501: Add interrupt support") Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-20iio: light: isl29018: Only declare ACPI table when ACPI is enabledMatthias Kaehlcke1-0/+2
This fixes the following warning when building with clang: drivers/iio/light/isl29018.c:808:36: error: variable 'isl29018_acpi_match' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-16iio: tsl2583: add runtime power management supportBrian Masney1-30/+76
This patch adds runtime power management support to the tsl2583 driver. The device is powered off after two seconds of inactivity. 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>
2017-04-30iio: isl29028: add isl29030 supportSebastian Reichel1-0/+6
isl29030 is basically the same chip. The only difference is the chip's first pin. For isl29028 its named ADDR0 and can be used to change the chip's i2c address. For isl29030 on the other hand that pin is named Ials and is an analog current output proportional to ALS/IR. This change is irrelevant for the Linux driver. This has been tested on Motorola Droid 4. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-26staging: iio: isl29028: move out of stagingBrian Masney3-0/+734
Move ISL29028 ALS / Proximity Sensor out of staging and into mainline. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-14iio: light: apds9960: add system-wide suspendMatt Ranostay1-0/+2
APDS9960 can safely force runtime suspend if the system wants to enter system-wide suspend Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02iio: light: lm3533-als: constify attribute_group structuressimran singhal1-2/+2
Check for attribute_group structures that are only stored in the event_attrs filed of iio_info structure. As the event_attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.event_attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; As the attrs field of iio_info structures is also constant, so these attribute_group structures can also be declared constant. Done manually. File size before: text data bss dec hex filename 5798 2376 0 8174 1fee drivers/iio/light/lm3533-als.o File size after: text data bss dec hex filename 5926 2248 0 8174 1fee drivers/iio/light/lm3533-als.o Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-01iio: light: apds9960: constify attribute_group structuressimran singhal1-1/+1
Check for attribute_group structures that are only stored in the attrs filed of iio_info structure. As the attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; File size before: text data bss dec hex filename 8503 488 0 8991 231f drivers/iio/light/apds9960.o File size after: text data bss dec hex filename 8567 424 0 8991 231f drivers/iio/light/apds9960.o Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-01iio: light: bh1750: constify attribute_group structuressimran singhal1-1/+1
Check for attribute_group structures that are only stored in the attrs filed of iio_info structure. As the attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; File size before: text data bss dec hex filename 2276 352 0 2628 a44 drivers/iio/light/bh1750.o File size after: text data bss dec hex filename 2340 320 0 2660 a64 drivers/iio/light/bh1750.o Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25iio:light: Add support for STMicro VL6180 sensorManivannan Sadhasivam3-0/+554
This patch adds support for STMicro VL6180 - ALS, range and proximity sensor. Sensor is capable of measuring the light intensity as well as object distance using TOF (Time of Flight) technology. Signed-off-by: Manivannan Sadhasivam <manivannanece23@gmail.com> Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19iio: light: apds9960: Add OF device ID tableJavier Martinez Canillas1-0/+7
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19iio: light: tsl2563: Add OF device ID tableJavier Martinez Canillas1-0/+10
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-19iio: light: us5182d: Add OF device ID tableJavier Martinez Canillas1-0/+7
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-25hid: hid-sensor-prox: Add more data field for hysteresis parsingSong Hongyan1-0/+7
Add HID_USAGE_SENSOR_HUMAN_PRESENCE support for Human Presence sensitivity parsing, in case some implementation uses it as sensitivity modifier. Signed-off-by: Song Hongyan <hongyan.song@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-04iio: cros_ec_light_prox: add ChromeOS EC Light and Proximity SensorsGwendal Grignou3-0/+300
Handle Light and Proximity sensors presented by the ChromeOS EC Sensor hub. Creates an IIO device for each functions. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-23Merge tag 'iio-for-4.11b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-nextGreg Kroah-Hartman2-2/+3
Jonathan writes: Second round of IIO new device support, cleanups and features for the 4.11 cycle New device support: * lsm6dsx imu - new driver and bindings. * max11100 adc - new driver and bindings. * tlc4541 - new driver * tmp007 thermopile - new driver. Core * in kernel interfaces - pass through raw values if no scaling provided and a processed value is requested. * trigger - close a race condition in acquiring trigger reference. - constify device_type structures. - rework the viio_trigger_alloc function to be much neater and easier to read. - free trigger resources correctly on some error paths. Avoids putting a module we don't have. Documentation * ABI - specify a unit for proximity measurements. Cleanups and features * ads1015 - constify iio_info structure. * ads7950 cleanups following merge in previous pull - Add device tree bindings - Drop the ti prefix from the module name in common with other drivers. - Change regulator name to vref to match datasheet and other drivers. * ak8974 - remove a redundant zero timeout check. * bmi160 - use variable names for sizeof instead of types. * cm3605 - mark PM functions as __maybe_unused to avoid a build warning. * isl29028 (on it's way towards moving out of staging). - alignment fixes and newline improvements. - combine proxim_get and read_proxim for simpler code. - drop unused ISL29028_DEV_ATTR macro - move some error logging into functions to cut out repitition. - make error messages more consistent. - tidy up some brackets. - drop the enable flag that nothing uses. - only set proximity rate and ALS scale when relevant channel type is enabled. - runtime pm support. * lsm6dsx - fix wrong values for gyro sensitivitiy. * mag3110 - claim direct mode during sysfs reads to avoid a race condition. * max1363 - export OF device table IDs as module aliases. * max30100 - use msleep for long uncritical delays. * mcp4531 - export OF device table as module aliases. * ms5611 - claim direct mode during sysfs reads to avoid a race condition. * opt3001 - export OF device table as module aliases. * sx9500 - claim direct mode during oversampling changes to avoid a race condition.
2017-01-22iio: light: opt3001: Export OF device ID table as module aliasesJavier Martinez Canillas1-0/+1
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the device was registered via OF, this means that exporting the OF device ID table device aliases in the module is not needed. But in order to change how the core reports modaliases to user-space, it's better to export it. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21iio: light: cm3605: mark PM functions as __maybe_unusedArnd Bergmann1-2/+2
When CONFIG_PM_SLEEP is disabled, we get a harmless warning drivers/iio/light/cm3605.c:292:12: error: 'cm3605_pm_resume' defined but not used [-Werror=unused-function] drivers/iio/light/cm3605.c:281:12: error: 'cm3605_pm_suspend' defined but not used [-Werror=unused-function] Marking the functions as possibly unused avoids the warning without needing to add an #ifdef. Fixes: 8afa505c1230 ("iio: light: add driver for Capella CM3605") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-19Merge tag 'iio-for-4.11a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman5-4/+363
Jonathan writes: First round of new device support, features and cleanups for IIO in the 4.11 cycle. It's shaping to be another fairly busy cycle. Lots more on the way! New device support * ads7950 - new driver supporting ads7950, ads7951, ads7952, ads7953, ads7954, ads7955, ads7956, ads7957, ads7958, ads7959, ads7960, and ads7961 ADCs. * cm3605 - New driver for this light sensor and proximity sensor which is an analog part with some additional digital controls. * hx711 - New driver. Core new stuff * Gravity sensor type. This is a processed datastream in which the device will try to work out which way is down. * Split the buffer.h file into two parts. One provides the interface to 'use' a buffer, the second provides the internals of the buffer functionality as needed by implementations of buffers. - Move documentation inline so as to allow use of private: tag when generating documentation. - Add some utility functions for the few things that are directly done with the buffers. - Stop exporting functions that no-one uses outside of the core code. - Push docs down by the code in the c file where they should have always been. - Fix typo in kernel-doc for buffer. - push down some includes that were previously happening implicitly. - stop enabling the timestamp of the dummy device. Features and cleanups * ad5592r - ACPI support * ad5593r -ACPI support. * ad5933 - Fix a false comment about size of a particular register. * ad7150 - replace S_IRUGO | S_IWUSR with 0644. I'm not that keen on these patches in general, but as it was nicely presented I took this one anyway. As a general rule will only take these as part of a larger driver cleanup. - don't eat an error but rather reutnr it in the write_event_config callback. * ad7606 - replace non standard range attibute with _scale * ade7753 - use usleep_range for short sleeps * ade7754 - use usleep_range for short sleeps * ade7758 - use usleep_range for short sleeps * ade7759 - use usleep_range for short sleeps * ade7854 - use usleep_range for short sleeps * adis16201 - fix description * adis16203 - fix description - fix copyright year * adis16209 - fix description * adt7316 - Add braces to arms of if else statement (for consistency) - Alignment fixes. * axp288 - Fix up an issue with accidental overwrites of data. * bmi160 - add deivce tables for i2c and spi to support correctly identifying the full dt name (including manufacturer). - device tree binding. * bmp280 - use usleep_range for short sleeps. * cm3232 - return error from cm3232_reg_init rather than eating it if the last write fails. * dummy driver - remove a semicolor found at end of a function defintition. * exynos-adc - use usleep_range for short sleeps. * hid-sensor (accel) - Add timestamp support. The hardware can provide timestamps so lets support them. If not fall back to timestamps estimated in kernel. * hid-sensor (light) - Add a duplicate ID for the light channels so as to keep existing interface whilst also using the more standard IIO interface. * hts221 - acpi probing * imx25-gcq - Add a macro call to allow this driver to be automatically loaded. * isl29028 - reorganise code to avoid deep nesting of if statements. - move chip test and default regs into a function suitable or sharing with power management code. - tidy up some code alignment. * lidar-lite-v3 - introduce compatible strings that make it clear Garmin have consideral friends. * mma8452 - avoid returning signed value when unsigned is appropriate * spmi-vadc - Update function for generic voltage conversion to take into account that different channels on this device should be handled differently. - Rework code to allow per channel voltage scaling and support the standard options for this hardware. - Fixup three minor issues with the above patches for this part. These all effect test builds rather than the native builds for the part, but good to clean them up anyway. * st_sensors - support device matching from the ACPI DST tables. - acpi based probing for accelerometers - acpi based probing for pressure sensors - Allow pressure sensors to read negative values. - Export sampling frequency for lps25h and lps331ap. - Add support for the old DT bindings from the period when these deivces were often supported through windows. Docs fixup: * typo in sysfs-bus-iio
2016-12-30iio: max44000: correct value in illuminance_integration_time_availableAkinobu Mita1-1/+1
According to the datasheet, the shortest available integration time for ALS ADC conversion is 1.5625ms but illuminance_integration_time_available sysfs file shows wrong value. Cc: Crestez Dan Leonard <leonard.crestez@intel.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Fixes: d5d8f49b6 ("max44000: Expose ambient sensor scaling") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>