aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-04-04iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensorAngus Ainslie (Purism)1-8/+43
The VCNL4040 is almost identical to the VCNL4200 as far as register layout goes but just need to check a different ID register location. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: light: vcnl4000 add devicetree hooksAngus Ainslie (Purism)1-0/+22
Add an of_match table for devicetree probing. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: light: vcnl4000 use word writes instead of byte writesAngus Ainslie (Purism)1-2/+2
The VCNL4200 datasheet says that word read and writes should be used to access the registers. Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca> Tested-by: Tomas Novotny <tomas@novotny.cz> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Switch to SPDX identifier.Enric Balletbo i Serra1-9/+1
Adopt the SPDX license identifier headers to ease license compliance management. Also fix MODULE_LICENSE for cros_ec_accel_legacy to match the SPDX and boiler plate license. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Drop unnecessary include filesGuenter Roeck1-2/+0
The cros_ec sensors drivers do not call any sysfs functions or use any sysfs defines, and thus do not need to include linux/sysfs.h. Also, some cros_ec drivers include linux/delay.h and is not used. Signed-off-by: Guenter Roeck <groeck@chromium.org> [remove linux/delay.h] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04drivers: iio: Kconfig: pedantic cleanupEnrico Weigelt, metux IT consult1-137/+137
Formatting of Kconfig files doesn't look so pretty, so just take damp cloth and clean it up. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02iio: light: add driver for MAX44009Robert Eshleman3-0/+566
The MAX44009 is a low-power ambient light sensor from Maxim Integrated. It differs from the MAX44000 in that it doesn't have proximity sensing and that it requires far less current (1 micro-amp vs 5 micro-amps). The register mapping and feature set between the two are different enough to require a new driver for the MAX44009. Developed and tested with a BeagleBone Black and UDOO Neo (i.MX6SX) Supported features: * Reading lux (processed value) * Rising and falling illuminance threshold events * Configuring integration time https://datasheets.maximintegrated.com/en/ds/MAX44009.pdf Signed-off-by: Robert Eshleman <bobbyeshleman@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-12iio: light: isl29018: add vcc regulator operation supportAnson Huang1-1/+45
The light sensor's power supply could be controllable by regulator on some platforms, such as i.MX6Q-SABRESD board, the light sensor isl29023's power supply is controlled by a GPIO fixed regulator, need to make sure the regulator is enabled before any operation of sensor, this patch adds vcc regulator operation support. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-03Merge 4.20-rc5 into staging-nextGreg Kroah-Hartman2-6/+10
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-22Merge tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testingGreg Kroah-Hartman3-0/+690
Jonathan writes: First set of new device support, features and cleanups for IIO in the 4.21 cycle Along with the headline feature of 5 new drivers, we have the substantial addition of auxilliary sensor support on the lsm6sdx parts for ST. There has also been a good set of staging cleanup in this period with more underway. An ever increasing number of devices supported with just a new ID which is a good sign that at least some manufacturers are continuing to stabilise their interfaces. New device support, * ad7124 - New driver supporting Analog Devices' ad7124-4 and ad7124-8 parts with the inevitable DT binding. * ad7949 - New driver supporting Analog Devices' ad7949, AD7682 and AD7689 ADCs. * rm3100 - New driver supporting PNIs RM3100 magnometer with bindings and vendor prefix. * ti-dac7311 - New driver supporting DAC7311, DAC6311 and DAC5311 TI DACs, with DT bindings. * vcnl5035 - New driver supporting the light sensor part of the VCNL4035, with DT bindings Features, * bindings - Add a generic ADC channel binding as we keep reinventing this wheel. * adc128s052 - Add IDs for additional pin compatible parts. - Add APCI ID seen on E3940 UP squared boards. * ad_sigma_delta - Allow for custom data register overiding default. * kxcjk1013 - Add KIOX0009 ACPI ID as seen on the Acer One 10. * lsm6dsx - Rework leading to... - External sensor support using the built in I2C master. - Initial support for a slave lis2mdl magnetometer. * meson-saradc - Add temperature sensor support and bindings. * st_magn - New ID for lsm9dsl_magn with bindings - New ID for lis3de accelerometer * tpl0102 - Add supprot for IIO_AVAIL_RANGE to report the range available from this device to userspace and in kernel users. Cleanups and minor fixes * tools - Allow outside specification of CFLAGS * ad2s90 - Handle and spi_read error. - Handle spi_setup failure - Drop a pointless assignment. - Prevent a potentail race by moving device registration to after all other setup. - Add missing scale attribute. - Add a sanity check on channel type before trying to read it. * ad2s1210 - Move to modern gpio descriptors. - Drop a gpioin flag which made no sense as far as we can tell. - Add dt table (bindings doc to follow when this is ready for moving out of staging). * ad5933 - Drop camel-case naming of ext_clk_hz. - White space fixes. * ad7150 - Local variable to shorten overly long line. - Alignment and line break fixes. * ad7280a - Handle an error path that was previously ignored. - Use crc8.h to build the crc table replacing custom code. - Avoid unecessary cast. - Power down the device if an error happens in probe - Use devm routines to simplify probe and remove. * ad7606 - Alignment fixes. * ad7780 - This worked as long as by coincidence an uninitialized value was 0. Lets not rely on that. - Ensure gain update is only used with the ad778x chips that actually support it. - Tidy up pattern mask generation. - Read regulator when scale is requested (which should be infrequent) as it might have changed from initialization. * ad7816 - Move to modern gpio descriptors - Don't use a busy_pin for ad7818 as there isn't one. - Ensure RD/WR and CONVST pins are outputs (previously they were brought up as inputs which doesn't seem to make any sense) - DT id table. * adc128s052 - SPDX * adt7316 - Alignment fix. - Fix data reading. When using I2C the driver never actually used the value read. This has been broken a very long time hence no rush to fix it now + the driver is undergoing a lot of cleanup. - Sanity check that the i2c read didn't fail to actually read anything. * dpot-dac - Mark a switch full through with slightly different text so that gcc doesn't warn on it. * gyro-adc - Fix a wrong file in the MAINTAINERS entry and add binding doc to the listed files. * ina2xx - Add some early returns to clarify error paths in switch. * lsm6dsx - MAINTAINERS entry. * max11100 - SPDX * max9611 - SPDX * mcp4131 - use of_device_get_match_data in preference to spi_get_device_id approach. * rcar-adc - SPDX * sc27xx - Add ADC conversion timeout support to avoid possible fault. * ssp_sensors - Don't free managed resources manually. * st-magn - Add a comment to avoid future confusion over when to use -magn postfix (on multi chip in package parts) - Add BDU register for LIS3MDL where it seems to have been missed. * st-sensors - Minor spelling, grammar etc fixes. * tpl0102 - Use a pointer rather than an index of an array to improve conciseness. * tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (80 commits) Staging: iio: adt7316: Add an extra check for 'ret' equals to 0 Staging: iio: adt7316: Fix i2c data reading, set the data field dt-bindings: iio: adc: Add docs for ad7124 iio: adc: Add ad7124 support dt-bindings: iio: adc: Add common ADCs properties to a separate file iio: ad_sigma_delta: Allow to provide custom data register address staging: iio: ad7816: Add device tree table. iio: imu: st_lsm6dsx: add entry in MAINTAINERS file iio: potentiometer: mcp4131: use of_device_get_match_data() staging: iio: adc: ad7280a: use devm_* APIs staging: iio: adc: ad7280a: power down the device on error in probe dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine iio: imu: st_lsm6dsx: add i2c embedded controller support iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap iio: imu: st_lsm6dsx: introduce locked read/write utility routines ...
2018-11-16iio: light: Add support for vishay vcnl4035Parthiban Nallathambi3-0/+690
Add support for VCNL4035, which is capable of Ambient light sensing (ALS) and proximity function. This patch adds support only for ALS function Signed-off-by: Parthiban Nallathambi <pn@denx.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-11-16iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbersHans de Goede2-6/+10
Before this commit sensor_hub_input_attr_get_raw_value() failed to take the signedness of 16 and 8 bit values into account, returning e.g. 65436 instead of -100 for the z-axis reading of an accelerometer. This commit adds a new is_signed parameter to the function and makes all callers pass the appropriate value for this. While at it, this commit also fixes up some neighboring lines where statements were needlessly split over 2 lines to improve readability. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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>