1
0
Fork 0
Commit Graph

412 Commits (redonkable)

Author SHA1 Message Date
Thomas Gleixner ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Thomas Gleixner 09c434b8a0 treewide: Add SPDX license identifier for more missed files
Add SPDX license identifiers to all files which:

 - Have no license information of any form

 - Have MODULE_LICENCE("GPL*") inside which was used in the initial
   scan/conversion to ignore the file

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:45 +02:00
Angus Ainslie (Purism) 5a441aade5 iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor
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-04 20:20:47 +01:00
Angus Ainslie (Purism) ebd457d559 iio: light: vcnl4000 add devicetree hooks
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-04 20:20:43 +01:00
Angus Ainslie (Purism) 78ed050dd2 iio: light: vcnl4000 use word writes instead of byte writes
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-04 20:20:42 +01:00
Enric Balletbo i Serra 37aa055c41 iio: cros_ec: Switch to SPDX identifier.
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-04 20:19:58 +01:00
Guenter Roeck b921d928a3 iio: cros_ec: Drop unnecessary include files
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-04 20:19:58 +01:00
Enrico Weigelt, metux IT consult d626be00e8 drivers: iio: Kconfig: pedantic cleanup
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-04-04 20:19:56 +01:00
Robert Eshleman 6aef699a7d iio: light: add driver for MAX44009
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-02-02 15:47:46 +00:00
Anson Huang 1a02d12393 iio: light: isl29018: add vcc regulator operation support
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>
2019-01-12 19:02:00 +00:00
Greg Kroah-Hartman d5d12ce229 Merge 4.20-rc5 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-03 07:55:28 +01:00
Greg Kroah-Hartman 7c0bc65c84 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlv1wDARHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fohf9Q//fzNk9RoY98awaEmHRW7PLnHe1WKyQTV5
 M13EaFwm/NeWfT1kaNd/heZDnwucB34ONrcueNcM8MfwzPwWaL9UvSqEnSWIuTae
 hKdn/BMTfy168xhu95YPjHw4X42HwcXYlHL9XFsA0WERgaWsQu2EwIy1/3XRgIrt
 QPQVyJNUkLZmBuGcd2UhxzdTiLuh/hs7FFBg037hxaR77slWYKqAzwVa6eyz/jvo
 tRT9RE50O1FT3eDkBSw91nkamFcmFyyA2j4HQ33Aitjs5O1ML95xEJ0tMAznZfKn
 zAGCCUJjFYBvWPOpQ8xBA3tplFRGIyVhPJ5ZU+B2vZcxVXQ3IFZNqKRXfrUkAXpf
 PK2+05+HjHk1g7Ms1Tj4lF5AtP/nEQ8dvmGk6/nDU7Gt4Ytrpb0DhAuMGmN4S5ih
 zwwh+c6fLGCMz7KE8AoegOn3WF/FW1ZppTRjOWgqt7OP6lgoChPuTV5HGzxiZgr+
 MzY/fytbXTnmfTL1ZvZYPdOSjkHcS9+8rwu1Jirmb1Y5Qt3qpNAUsdsnt965mQaE
 bHmuqw8QJN31goTEsqvjnsFhH57dJ1HbmG0MSrF8XB0bQB5Xzbkd+RV4fls1J+SG
 XwpIzQLhPxF5da6G+I/SIgLX6nASacJp9hHEN/ZuM3IKr2UW8FCpCH6JmyX0i6OU
 dPjHsXrGTuI=
 =78Y3
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing

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-22 09:39:45 +01:00
Parthiban Nallathambi 55707294c4 iio: light: Add support for vishay vcnl4035
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-16 18:32:29 +00:00
Hans de Goede 0145b50566 iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers
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-11-16 11:42:12 +00:00
Linus Torvalds 738b04fba1 Staging/IIO patches for 4.20-rc1
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.
 
 When merging with your tree, there will be 2 merge conflicts, both files
 will be simple to resolve, just delete them :)
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCW9bSGA8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yk5eACfYp73m9tLO22rnBcXJ73bWAYSTOMAn2GEL4Nc
 LZBXs8QvvJIwfqmi7ofn
 =UWJn
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

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-10-29 10:38:10 -07:00
ryang 5851b499de iio: light: bh1750: Add device tree support
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-29 12:26:07 +01:00
Tomasz Duszynski daae7861a6 iio: light: bh1750: simplify setting PM ops
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-08 16:01:40 +01:00
Tomasz Duszynski 53d3ae20a6 iio: light: bh1750: switch to SPDX identifier
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-08 15:04:02 +01:00
David Frey 1c96a2f67c
regmap: split up regmap_config.use_single_rw
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-09-07 13:03:55 +01:00
Colin Ian King eb2e188817 iio: max44000: remove unused variable max44000_alstim_shift
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-19 18:28:26 +01:00
Brian Masney 7c14947e4d iio: tsl2772: add support for regulator framework
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-19 12:06:58 +01:00
Brian Masney 75de3b570b iio: tsl2772: add support for avago,apds9930
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-18 18:11:47 +01:00
Brian Masney 94cd1113aa iio: tsl2772: add support for reading proximity led settings from device tree
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-18 18:11:47 +01:00
Maxime Roussin-Bélanger 496fb59e12 iio: light: si1133: fix uninitialized resp variable
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-01 19:01:35 +01:00
Jonathan Cameron 2b4ec22d36 Merge branch 'fixes-togreg' into togreg 2018-08-01 18:56:17 +01:00
Colin Ian King 1e96e93a35 iio: light: si1133 fix test for val being not zero or not one.
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: e01e7eaf37 ("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-30 19:28:47 +01:00
Tomas Novotny be38866fbb iio: vcnl4000: add support for VCNL4200
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-29 12:19:28 +01:00
Tomas Novotny 58bf9ace8c iio: vcnl4000: warn on incorrectly specified device id
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-29 11:03:55 +01:00
Tomas Novotny 50c50b975d iio: vcnl4000: add VCNL4010 and VCNL4020 device id
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-29 09:41:53 +01:00
Tomas Novotny 1ebc787ae5 iio: vcnl4000: make the driver extendable
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-29 08:58:33 +01:00
Greg Kroah-Hartman 3ceefa3ffd 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAltXZAkRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohYZQ//VAjpDBYjLzYTvTJy5bDt61fbh8KabhBf
 oxLIpwYrCeleLnpbrY7nU8shdIL7Vm755jtsHbTtQPCKSQ0RGnhLLDoqoWcmn70J
 rF9iVaSv+S2lZO+9+hv2eeqyX+kSM+74fkWRuLmDbaSZWYO4Jt9zFER1zizmPypY
 DnxLcViw1kwOLbiZKwmcaK0MqlWHRPhEEcNVKy7VGZHznbylujh8evkzzQNVWOol
 QrR2NG7V8BcLTflmsYCErQDvgciGjscnVZUAyY3yNLIpceGCSHZfUsE8ld6iPrS+
 aPeuiIxDhHAKyoOTQwsGi9ex7KEOUOkoDHhKdR3Jr74mtfcPF5B+TxgXU0p5UZ9g
 GummuvSX0izYjUZ9P4keVgu3W4bvmR9Kd8oJUHNByWI1iecoXP9bQf33tEyb26R6
 G1zvGSDXPNK1V7OEaGvzGkgxOY0ZAIWLRX/+wasErdJnt3lmOV9+cCSkJAFSNrk3
 jQ922q2ZWLfYAL6nNIAx2dIiJirxTQ2JIq/bys2BHiYvkuvqNcKoBIDAGlQ4xBKm
 /c5z9Dm/DxQpdlKFQugHmc5awLEZxpq2LCTBLlgM8z6+uRWXui+slPfIrfX5RWun
 BHaLmPNm6tKQLadjwWCoxXYjKqgK0wm35Yq5d5He7d45d3QWKvtUgZAj33pcIgTE
 wKmwF5oaLiU=
 =T+hS
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.19b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

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-25 10:12:07 +02:00
Maxime Roussin-Bélanger e01e7eaf37 iio: light: introduce si1133
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-07-23 19:18:11 +01:00
Colin Ian King 288320f6e9 iio: tsl2x7x/tsl2772: avoid potential division by zero
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-06-24 14:22:38 +01:00
Brian Masney 4833dc4bb9 iio: tsl2583: correct values in integration_time_available
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: f44d5c8ac3 ("staging: iio: tsl2583: move out of staging")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-20 10:29:28 +01:00
Brian Masney c06c4d7935 staging: iio: tsl2x7x/tsl2772: move out of staging
Move the tsl2772 driver out of staging and into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-12 12:40:04 +01:00
Gwendal Grignou 5a0b8cb466 iio: cros_ec: Move cros_ec_sensors_core.h in /include
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-17 19:59:20 +00:00
Rodrigo Siqueira 67464a54e5 iio: Replace occurrences of magic number 0 by IIO_CHAN_INFO_RAW
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-07 20:14:36 +00:00
Jeff LaBundy 0f07954715 iio: light: lv0104cs: Add support for LV0104CS light sensor
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-03 15:16:57 +00:00
Gwendal Grignou 0dad1eceeb iio: cros_ec: Relax sampling frequency before suspending
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-03-03 15:02:58 +00:00
Matt Ranostay d6ad805844 iio: add SPDX identifier for various drivers
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-02-18 11:55:19 +00:00
Colin Ian King debbbbef06 iio: light: make a couple of config structures static
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>
2018-01-08 16:03:41 +01:00
Lorenzo Bianconi 3025c8688c iio: light: add support for UVIS25 sensor
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-02 10:41:25 +00:00
Peter Meerwald-Stadler 8556f51498 iio: light: Add driver for IDT ZOPT2201 ambient light and UVB sensor
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-02 10:39:48 +00:00
Paolo Cretaro 5f045af0b5 iio: cros_ec: Remove unused variables
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-12-02 10:39:44 +00:00
Linus Torvalds 449fcf3ab0 Staging/IIO patches for 4.15-rc1
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).
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWgnFrg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymxbwCgtNlBkqD2JJYpLRKvI/C4w1vzZsEAnA2THRkt
 g3ioPBqmqC/2DSbldr2o
 =/ebw
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

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-13 20:53:28 -08:00
Greg Kroah-Hartman b24413180f License cleanup: add SPDX GPL-2.0 license identifier to files with no license
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-11-02 11:10:55 +01:00
Stefan Brüns 3525d7cfb7 iio: light: vl6180: Correct ALS scale for non-default gain/integration time
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-09 20:50:21 +01:00
Stefan Brüns e794bf6751 iio: light: vl6180: Cleanup als_gain lookup, avoid register readback
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-09 20:50:15 +01:00
Stefan Brüns df698c0402 iio: light: vl6180: Avoid readback of integration time register
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-09 20:50:10 +01:00
Stefan Brüns 1e2ed3d0d2 iio: light: vl6180: Move range check to integration time setter, cleanup
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-10-09 20:50:08 +01:00
Akinobu Mita 9d2f715d59 iio: light: tcs3472: support out-of-threshold events
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-09-03 18:10:29 +01:00
Jonathan Cameron 4166b47c2b iio:light: drop assign iio_info.driver_module and iio_trigger_ops.owner
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-22 21:31:57 +01:00
Greg Kroah-Hartman 5e47adb906 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlmZpCcRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FohlmQ/6A9FAI0wPGeEQCXDiLtIAWI1/DByYsHDk
 P3U6sFS17y56KAQcLS34HVR5lLreHya3hsUmPl4gCsjXZsGWAinyXy74BNtBbPmx
 LtzVsyLdjBP3Nxl/OGgNWG+kiq7Op+uw0/OZohtEqzurG0142S6CVvxteFlmhQNH
 pLlmPGnwk6Z4GsasHma/f2FkDD8oRVgvQSP7dJ9HIwq49qQ76cT/+20X1xODHLGw
 qpXfQiLUFW8E1JBTDDcXZD3M23TWG4DZcVlNnWf8fja/bk4WaLBKqVrI9gGZpZsQ
 xXfrSDRwc216w6tzVWjsNV/M0ZuSdm/VCBeyQa17XQVNelkO4dVrCqFMLCh5i/t5
 p4qhhV9mrbweIgDj++6c+4qMzWSAznWybAKMMlcucmwxHKefcrlgUniE03OzyPpG
 gpMS94enlVW8WpE/iYkxb/d6EqTM9CH2CJH6W4Ve/Xr4aQHkF5/P23k+nsW113of
 T1q1SCKegV9p7hIzqDqDmOQC7iNTcBcu+/7RYtkDn9jmmhiQAxwoPJZunkR1cxD8
 hA04x5W9HuPFdbNRlH1MozClbyRUtk0L/XLTKwA9T0VyRUKV1P6Szcp9wYRw+6G8
 QiA5NNrNPf17L6slLZ06N1auu6vO7BhTmYNKnd6VBO+vi7kF/FM2UdZGHof4WT/4
 zPE/BO8IwTk=
 =b6g8
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.14b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

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-20 10:42:42 -07:00
Arvind Yadav 3282fa3c0a iio: light: tsl2583: constify i2c_device_id
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-20 10:17:23 +01:00
Arvind Yadav a6e5de9375 iio: light: apds9300: constify i2c_device_id
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-20 10:16:48 +01:00
Greg Kroah-Hartman 8652892ed4 Merge 4.13-rc5 into staging-next
We need it here for iio fixes.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-14 13:35:22 -07:00
Greg Kroah-Hartman 055655a9f0 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAll0lYgRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoipzRAAk7wO9hvfl8UwgS6FTLVwQQHjP6MQSZ51
 USP2YN0hkBgDLKPQ2PbTt6t5jwboYPhOsd1n6iHWuAkje+W6Ie4JlXJBux/Gp9Wb
 GuZLLdFG+3Z1ZYcdDWRKs3u95vdku/5hFg63bxloPcpwkLzb82ykyQ4i9BjbGfv8
 jrig+l3eghkGp1kl1ChGdeegTcHAVIS/lPm8Ls0BwpWM30tW2Ip4XSkkm+T6IHvT
 8gPr1JMEJ5WaKEpDWKmitZQAr8jLAZ0dp9iLGh9qa2o0+OtX8gMYIas0bMHRR+UG
 3EM0wWaaeSaOuqYs8ZnqUQE2RcqP6plZWRmLR98rFLrAXPATX/HGMtZ+JQpKwEKm
 1H3XZAovwcppJ8X+XI7z6dZnpTCmQwwILYBpWvM/WWQCk2HZLZkFPOlkQyWCI4al
 3OhV+6o3XIl/M8aHepcRh3tpwYFDToNhLpo85EC6H7YtwaReY8tfXqNtlO8MMIKm
 1ZNVcA6NT8sdFwvyGtqg4yRIcQbx4Uarp11GgW5SSq13EgJ1LHEYC3lFrfn36pes
 D0oa01pA8hT6e7dPgqmFg6+J2XdWn8R1NVLRn+z+hjimr/BJlsxaZtk1JEJyS/ul
 qJS8UIEiwELUuze31uuz4QJJQHnPxuHlvM8EIf2c6vxg+l1CeMthXv7Hc9ht1vKg
 W/xgABUp/EY=
 =BApO
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-4.13a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

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-23 20:54:31 -07:00
Mikko Koivunen e12ffd241c iio: light: rpr0521 triggered buffer
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-04 20:46:28 +01:00
Akinobu Mita ea5c6e262c iio: light: tcs3472: add link to datasheet
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-01 10:23:06 +01:00
Akinobu Mita 53d7d8139f iio: light: tcs3472: fix ATIME register write
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-07-01 10:16:49 +01:00
Akinobu Mita a3507e48d3 iio: light: tsl2563: use correct event code
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-24 20:42:49 +01:00
Greg Kroah-Hartman 7bf1e44f86 Merge 4.12-rc5 into staging-next
We want the IIO fixes and other staging driver fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-12 08:20:47 +02:00
Mikko Koivunen 9ece370b02 iio: light: rpr0521 channel numbers reordered
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-21 15:06:15 +01:00
Mikko Koivunen 734c442303 iio: light: rpr0521 proximity offset read/write
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-21 15:06:15 +01:00
Mikko Koivunen c91a88ef84 iio: light: rpr0521 sample_frequency read/write
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-21 15:06:14 +01:00
Mikko Koivunen 624c389e10 iio: light: rpr0521 whitespace fixes
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-21 15:06:13 +01:00
Mikko Koivunen ae5916501b iio: light: rpr0521 magic number to sizeof() on value read
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-21 15:06:12 +01:00
Mikko Koivunen 484c314b90 iio: light: rpr0521 on-off sequence change for CONFIG_PM
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-21 15:06:12 +01:00
Mikko Koivunen 12d7494913 iio: light: rpr0521 poweroff for probe fails
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-21 15:06:11 +01:00
Mikko Koivunen f87fa26177 iio: light: rpr0521 disable sensor -bugfix
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-21 15:06:10 +01:00
Franziska Naepelt 7cc3bff4ef iio: light: ltr501 Fix interchanged als/ps register field
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: 7ac702b314 ("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-21 14:47:39 +01:00
Matthias Kaehlcke 14b39dce37 iio: light: isl29018: Only declare ACPI table when ACPI is enabled
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-20 17:07:09 +01:00
Brian Masney 371894f5d1 iio: tsl2583: add runtime power management support
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-05-16 19:39:41 +01:00
Sebastian Reichel e530cc8408 iio: isl29028: add isl29030 support
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-30 17:26:04 +01:00
Brian Masney 105c3de1eb staging: iio: isl29028: move out of staging
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-26 06:28:25 +01:00
Matt Ranostay d454ae2edb iio: light: apds9960: add system-wide suspend
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-14 16:43:32 +01:00
simran singhal 98b6d2b676 iio: light: lm3533-als: constify attribute_group structures
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-02 09:08:55 +01:00
simran singhal 3ca437c052 iio: light: apds9960: constify attribute_group structures
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-01 11:36:22 +01:00
simran singhal c2869498d0 iio: light: bh1750: constify attribute_group structures
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-04-01 11:27:22 +01:00
Manivannan Sadhasivam 5e7f47e495 iio:light: Add support for STMicro VL6180 sensor
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-25 16:20:46 +00:00
Javier Martinez Canillas ae4e825b88 iio: light: apds9960: Add OF device ID table
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-19 10:55:42 +00:00
Javier Martinez Canillas 9d3922b236 iio: light: tsl2563: Add OF device ID table
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-19 10:52:56 +00:00
Javier Martinez Canillas 152abf3770 iio: light: us5182d: Add OF device ID table
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-19 10:52:03 +00:00
Song Hongyan b010500281 hid: hid-sensor-prox: Add more data field for hysteresis parsing
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-25 16:43:18 +00:00
Gwendal Grignou 48458b0c19 iio: cros_ec_light_prox: add ChromeOS EC Light and Proximity Sensors
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-02-04 12:29:52 +00:00
Greg Kroah-Hartman 08cad739ba 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAliFK5sRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FoixSQ/+PrWf4PWdYSy+YlxxVzWMkJ3QhHYvDxpz
 mmH5GmsUB0RGi205VqAsvEF55Gcp5tzMYPXkjoxD1nXtuZ8sbVzkTSvrEGIqgA8b
 QUDdu76ntzJYWHVqouh8SywCJJbR/ssjZbIMzHvpYL/pty7+ICnaevauQf6n93Hh
 51yaPdtDNu4hq/lQdUz0QySGn9UJG7HUUKIfSDgZCh9q8VcQ8bmCf8MaRilJTzo9
 q8ONaziyB77w07JVeQLR/W8WO+KCRor0qqlokNtGDNAE2EOre6ul64Ded6TXLEez
 9ag/IYkECN3tImuHHJ9AKlCPOl39viZeP6sjvJc4glujZ0WKVuT76tlVP5XknuCE
 myy74d9Jt5/N43SYiQpRRm4Eadje56kCZtZhFidhRaEV74eQaOYG6fMNJ9Q/HJ4B
 d9Ykw7ZjU08DDOdQNtfQ5DGH72bKu94DSImqjmxXskUL6quZbxCnKPvI/vm//9xb
 7jSHtORTT8WxX/Ut9MTE59S0FS5x/8ivNxWxzqLDS0phcA4e1cLXJyFh0npxxYeu
 XdvJb+BefcfsPNbhhPl/anz577TJPTgNL4P2j1ano0duVCNV33p3y9Z2YNCkgaI1
 PtRVCBzMhaV60EQGBzBheNmN1+jeGu7q8o3UDhaoc4sX4ILut0oDE4PIDROmuItc
 QPLTmZkG20o=
 =Wvje
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.11b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-next

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-23 09:23:23 +01:00
Javier Martinez Canillas b1450ae9b6 iio: light: opt3001: Export OF device ID table as module aliases
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-22 13:21:29 +00:00
Arnd Bergmann d1242acc56 iio: light: cm3605: mark PM functions as __maybe_unused
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: 8afa505c12 ("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-21 12:34:54 +00:00
Greg Kroah-Hartman 4463c3e72d 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
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlh2bhcRHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0FogdSQ/9Hyd3ic5AgWyDKr9JI1vJPj3kT0PIYHLk
 4ucbQ8HUJQBBLnsausTb+UwuGV277DkVjGVsI4epn59H3CvkNh3Egl3XCmbhIpt2
 oyl9Pw9dSon6n/7I5pNSwmqD45O+aB7qFLigIfLmciwpMHZly3ExzGBMpqUkgjf9
 bVzndDqrfoNIrU7UaMD6QgrSxrgYJJJJwBDig/0zjAkGvu9L8a8ghrKkrRzMy62O
 nGP5mmEagivFF9lpGzzrw2pYBQWY4AFbsNvuLElE7nUz0PKKG+9J0oaBiglTYv2p
 mkNlYl7iTZfI3eFOXa+7HdSmeNhYX2dvbEM2jAA/Mr6ojWg2mSRu7Y19Kl2KP7K7
 BDRKBw+Cp0wkVvJ8LU/6PiDSmqp09VfjjqevzVGJi/BmWLzG0Mi2OsQmmynbw2SV
 hxiGETRV7vBoyJWDJuwJoftZaRnHWJbiQ6ftEUbWOFA9RIBMgOJBiL+RtxerJkHv
 FWlCFpv/618TUB/uM15+EOLVJAT5b7K+6+l6EGEjWdjiS/7vL7QM5DL8w4zV43zz
 cQ98UeIlqCkvoFmx9uHbl44COLQgzNtxAjytLxqbsOmEb40wlzoNzgSoUGu73SaG
 8qwznH0w0p8P1nyzwe9qKKK6SmFhj/tF6jKVmIi/H7wJdA1J5dAAmwFUBSxLs2DX
 u1eM3ikCl/M=
 =yjUA
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.11a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

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
2017-01-19 10:40:44 +01:00
Akinobu Mita b4e8a0eb71 iio: max44000: correct value in illuminance_integration_time_available
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>
2016-12-30 20:20:23 +00:00
Linus Walleij 8afa505c12 iio: light: add driver for Capella CM3605
This adds a driver for the Capella Microsystems CM3605 Ambient
Light Sensor and proximity sensor. This is a pretty simple entirely
analog device that is interfaced with the target system using
the POUT (proximity out) and AOUT (ambient light out) signals.

The POUT signal is a simple high/low signal that indicates whether
an object is in proximity, most typically used to detect a face
in front of a mobile device. The signal requires that an infrared
LED is mounted next to the device, making IR light reflect off
the object in proximity and triggering the POUT signal. We grab
a GPIO pin to handle the POUT signal as an interrupt line and
register this as an event channel for the sensor.

Since the proximity sensor requires an IR LED, we add a LED trigger
named "cm3605" so that the infrared LED can just associate with
this trigger to be sure it is always on when the proximity sensor
needs it.

The AOUT is an analog voltage between 0 and 1550 mV that indicate
the LUX value in the ambient light: this is orthogonal to the
proximity sensor functionality. Since this analog voltage needs
to be converted into a digital value, the driver grabs an IIO
channel named "aout" associated with the device.

This patch created a combined ALS and proximity sensor driver.
The former supports raw reads of the LUX value and the latter
will generate proximity events.

To integrate this properly with Linux we also add a supply
regulator for the VDD pin (driving both functions) and add device
tree bindings to define the RSET resistor that in turn configures
the luminosity range of the ALS sensor.

Since the sensor needs to be on more or less constantly, we
restrict the power management to system suspend/resume: we
disable the IR LED and disable the regulator for VDD on suspend
and take them back up on resume.

Tests:
cd /sys/bus/iio/devices/iio:device1
cat in_illuminance_raw
304
(hold hand over sensor)
cat in_illuminance_raw
17
iio_event_monitor cm3605
Found IIO device with name cm3605 with device number 1
(hold hand over sensor)
Event: time: 2444842301447, type: proximity, channel: 0,
  evtype: thresh, direction: falling
(remove hand over sensor)
Event: time: 2445583440706, type: proximity, channel: 0,
  evtype: thresh, direction: rising

Cc: Capella Microsystems <capellamicro@gmail.com>
Cc: Kevin Tsai <ktsai@capellamicro.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 17:17:39 +00:00
Kweh, Hock Leong 578f8d7708 iio: light: hid-sensor-als: Add duplicate IIO_LIGHT channel
There is one light sensor type defined in the sensor hub specification,
which has one Illuminance field. It doesn't distinguish between ambient
light sensor or color sensor. Currently it is presented as IIO_INTENSITY
channel. There are some user spaces specifically looking for IIO_LIGHT
channel.
To satisfy such user spaces this change also add a duplicate IIO_LIGHT
channel. The units of measurement of Illuminance field is Lux, so it is
still compatible to IIO ABI.

Signed-off-by: Kweh, Hock Leong <hock.leong.kweh@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 17:06:34 +00:00
Pan Bian db4e5376d0 iio: light: fix improper return value
In function cm3232_reg_init(), it returns 0 even if the last call to
i2c_smbus_write_byte_data() returns a negative value (indicates error).
As a result, the return value may be inconsistent with the execution
status, and the caller of cm3232_reg_init() will not be able to detect
the error. This patch fixes the bug.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188641

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-04 10:56:26 +00:00
Dan Carpenter 0e8d2b0f74 iio: tsl2583: make array large enough
This array is supposed to have 10 elements.  Smatch complains that with
the current code we can have n == max_ints and read beyond the end of
the array.

Fixes: ac4f6eee8f ("staging: iio: TAOS tsl258x: Device driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-24 20:09:55 +00:00
Brian Masney f44d5c8ac3 staging: iio: tsl2583: move out of staging
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:33 +00:00
Alison Schofield 4aee987380 iio: light: ltr501: claim direct mode during raw writes
Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during all raw write operations.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:08 +01:00
Alison Schofield 218e95e976 iio: light: ltr501: claim direct mode during select raw reads
Driver was checking for direct mode but not locking it.  Use
claim/release helper functions to guarantee the device stays
in direct mode during required raw read cases.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:07 +01:00
Brian Masney a57504144c staging: iio: isl29018: move out of staging
Move ISL29018/ISL29023/ISL29035 driver out of staging into mainline.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:33:56 +01:00
Sandhya Bankar 2a20af722d drivers: iio: light: Fix sparse warnings
Fixing below warnings:

drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16
drivers/iio/light/max44000.c:217:18: warning: cast to restricted __be16

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-27 20:33:01 +01:00
Peter Meerwald-Stadler ac45e57f15 iio: light: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors
The si114x supports x=1,2,3 IR LEDs for proximity sensing together with
visible and IR ambient light sensing (ALS).

Newer parts (si1132, si1145/6/7) can measure UV light and compute an UV
index
This was tested on si1143 and si1145

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-09-18 19:56:39 +01:00