Commit graph

1221 commits

Author SHA1 Message Date
Krzysztof Kozlowski df5e94b482 iio: hid-sensor-magn-3d: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:47 +01:00
Krzysztof Kozlowski 4205086119 iio: light: hid-sensor-prox: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:47 +01:00
Krzysztof Kozlowski 4e617fc1b6 iio: light: hid-sensor-als: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:46 +01:00
Krzysztof Kozlowski 322a3b1ea2 iio: hid-sensor-gyro-3d: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:46 +01:00
Krzysztof Kozlowski e682173f37 iio: adc: axp288: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:46 +01:00
Krzysztof Kozlowski 76ec50a1bc iio: hid-sensor-accel-3d: Constify platform_device_id
The platform_device_id is not modified by the driver and core uses it as
const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:46 +01:00
Tomasz Duszynski 3a11fbb037 iio: light: add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors
Add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light
sensors.

Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:46 +01:00
Daniel Baluta d11715f087 iio: magnetometer: Add ACPI support for MMC35240
We assume that ACPI device tables use MMC35240 to
identify MEMSIC's 3 axis magnetic sensor.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:45 +01:00
Daniel Baluta 553a776b79 iio: magnetometer: mmc35240: Add PM sleep support
We rely on regmap to save the state of the registers at suspend,
and then we do an explicit sync at resume.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:45 +01:00
Daniel Baluta abeb6b1e7b iio: magnetometer: Add support for MEMSIC MMC35240 sensor
Minimal implementation for MMC35240 3-axis magnetometer
sensor. It provides processed readings and possiblity to change
the sampling frequency.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:45 +01:00
Irina Tirdea 5990dc9703 iio: magn: bmc150_magn: add oversampling ratio
Export the oversampling ratio so that the user can change the
number of repetions for x/y/z axis.

The sampling frequency is limited by the oversampling ratio.
The available sampling frequencies might change depending
on the values of oversampling_ratio.

The specification can be downloaded from:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:44 +01:00
Irina Tirdea faaa44955d iio: core: Introduce IIO_CHAN_INFO_OVERSAMPLING_RATIO
Some magnetometers can perform a number of repetitions in HW
for each measurement to increase accuracy. One example is
Bosch BMC150:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.

Introduce an interface to set the oversampling ratio
for these devices.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:44 +01:00
Irina Tirdea c91746a236 iio: magn: Add support for BMC150 magnetometer
Add support for the Bosh BMC150 Magnetometer.
The specification can be downloaded from:
http://ae-bst.resource.bosch.com/media/products/dokumente/bmc150/BST-BMC150-DS000-04.pdf.
The chip contains both an accelerometer and a magnetometer.
This patch adds support only for the magnetometer part.

The temperature compensation formulas are based on bmm050_api.c
authored by contact@bosch.sensortec.com.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:43 +01:00
Geert Uytterhoeven 8493585317 iio: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:43 +01:00
Tiberiu Breana 3dd477acbd iio: light: Add threshold interrupt support for STK3310
Added interrupt support for proximity threshold events
to the stk3310 driver.

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:42 +01:00
Tiberiu Breana be9e6229d6 iio: light: Add support for Sensortek STK3310
Minimal implementation of an IIO driver for the Sensortek
STK3310 ambient light and proximity sensor. The STK3311
model is also supported.

Includes:
- ACPI support;
- read_raw and write_raw;
- reading and setting configuration parameters for gain/scale
  and integration time for both ALS and PS.
- power management

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:42 +01:00
Greg Kroah-Hartman 5ccca15567 First round of new drivers, functionality and cleanups for the 4.2 cycle
New drivers / device support
 * st sensors driver, lsm303dlh magnetometer support.
 * ltr501 - support ltr301 and ltr559 chips.
 
 New functionality
 * IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors.
 * kxcjk1013 - make driver operational with external trigger.
 * Add iio targets to the tools Makefile.
 
 Cleanups
 * st sensors - more helpful error message if device id wrong or irq request
   fails, explicitly make the Block Data Update optional rather
   than relying on writes to address 0 not doing anything, make interrupt
   support optional (Not always wired, and not all devices actually have
   an interrupt line.)
 * kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI
   id as seen in the wild.
 * sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power
   management, optimize power usage by powering down when possible, rename
   the gpio interrupt pin to be more useful, trivial return path simplification,
   trivial formatting fixes.
 * isl29018 -  move towards ABI compliance with a view to moving this driver
   out of staging, add some brackets to ensure code works as expected.  Note
   there is no actual bug as the condition being tested is always true
   (with current devices).
 * ltr501 - add regmap support to get caching etc for later patches,
   fix a parameter sanity check that always fails (bug introduced
   earlier in this series), ACPI enumeration support,
   interrupt rate control support, interrupt support in general and
   integration time control support, code alignment cleanups.
 * mma9553 - a number of little cleanups following a review from Hartmut
   after I'd already applied the original driver patch.
 * tmp006 - prefix some defines with TMP006 for consistency.
 * tsl4531 - cleanup some wrong prefixes, presumably from copy and paste.
 * mlx90614 - check for errors in read values, add power management,
   add emissivity setting, add device tree binding documentation,
   fix a duplicate const warning.
 * ti_am335x_adc - refactor the DT parsing into a separate function.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVSzO0AAoJEFSFNJnE9BaIf5wP/imKKOOISkT+0VdjxrR0GRfZ
 DfkxzlQ7wwDm0MUk76paSldDJPJUdzEstiqTFESIow1Ws/3gpiCsjWVEe+eg1Y/e
 H7/ezIAl/liBiaNyN0EI4MSizEJ8pHDmLSxB+HrzBOuJ08b12fTPKhNNSKvJn8+B
 AAs7Joq+O69qe9OrtVcb6xEM+Qrlvx7KhdVbceZv3xoW4DBaiZnzGsBoF2HCQHdA
 Bi/TgHNT7lbUGIuPAOPuf76X+tGbUhm1eUBh0+RdFRCO3V8zggAtu+ZolDvBIPp1
 MlK41e6whNZKa3Y4yX3eC5Wh2+ka9EW7OjvtsbbU9rf3026hatorh9wIaJi1dru1
 CNxOSE0nuUCbyUWy/P1/DRpS2ysEb6NrOP2suqTIOfPbMankVv8WX1uh+BqndE7p
 EZC8c00kXVyZFyXNEq04vAvz0bduM4Gh8acTYK0ogfGncAgQPu/4kEWzGUBFJNRq
 WaKIgDL5tbJUU0G7pjhXho5VNEonE/2RtoSRPOWzmLY2HCCgCFkXKKwfhgjR9KT1
 j1isov6HeeINpAfvk/mAkx37R+87WOahaeqdC2iZskX5JyqRSbydYwajKpP8AI8E
 s+58uwCANmf1qL2yXwIO7or0gkDQxgwKOBGVRmnOSiDW3dx4MrKAPIPwrM1DdPOH
 K66EknSVZ1wgVGehZzK3
 =wyz7
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of new drivers, functionality and cleanups for the 4.2 cycle

New drivers / device support
* st sensors driver, lsm303dlh magnetometer support.
* ltr501 - support ltr301 and ltr559 chips.

New functionality
* IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors.
* kxcjk1013 - make driver operational with external trigger.
* Add iio targets to the tools Makefile.

Cleanups
* st sensors - more helpful error message if device id wrong or irq request
  fails, explicitly make the Block Data Update optional rather
  than relying on writes to address 0 not doing anything, make interrupt
  support optional (Not always wired, and not all devices actually have
  an interrupt line.)
* kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI
  id as seen in the wild.
* sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power
  management, optimize power usage by powering down when possible, rename
  the gpio interrupt pin to be more useful, trivial return path simplification,
  trivial formatting fixes.
* isl29018 -  move towards ABI compliance with a view to moving this driver
  out of staging, add some brackets to ensure code works as expected.  Note
  there is no actual bug as the condition being tested is always true
  (with current devices).
* ltr501 - add regmap support to get caching etc for later patches,
  fix a parameter sanity check that always fails (bug introduced
  earlier in this series), ACPI enumeration support,
  interrupt rate control support, interrupt support in general and
  integration time control support, code alignment cleanups.
* mma9553 - a number of little cleanups following a review from Hartmut
  after I'd already applied the original driver patch.
* tmp006 - prefix some defines with TMP006 for consistency.
* tsl4531 - cleanup some wrong prefixes, presumably from copy and paste.
* mlx90614 - check for errors in read values, add power management,
  add emissivity setting, add device tree binding documentation,
  fix a duplicate const warning.
* ti_am335x_adc - refactor the DT parsing into a separate function.
2015-05-09 18:15:50 +02:00
Linus Walleij 1038a68728 iio: magnetometer: support for lsm303dlh
The LSM303DLH accelerometer/magnetometer has a different
device identification method than using register 0x0f, instead
three registers contain a magic value. We rely on WhoAmI
to be zero for this variant.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:34 +01:00
Linus Walleij 5e02bac317 iio: st_sensors: make detection more helpful
The ST sensors are detected by reading a WhoAmI register and
matching the number found to a sensor name string. To make it
easier to figure out what happens when things go wrong, print
the WhoAmI value and the device name we're trying to match.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:33 +01:00
Linus Walleij bb60646c8b iio: st_sensors: make BDU optional
Not all sensors support BDU (block data update) and in fact a
bunch of the in-kernel sensor settings do not specify the
BDU address field. Make this optional.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:33 +01:00
Linus Walleij d2bc431868 iio: st_sensors: make interrupt optional
Some sensors such as magnetometers and pressure sensors doesn't
have interrupts at all, and thus no DRDY setting applies. Make
the assignment of an interrupt optional, and do not call
st_sensors_set_drdy_int_pin() if there is no drdy (data ready)
pin specified.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:32 +01:00
Linus Walleij 3337c9ff17 iio: st_sensors: print error when failing to get IRQ
Print a proper error message if we're missing the trigger
IRQ.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:32 +01:00
Antonio Ospite e693e15e86 iio: accel: kxcjk-1013: add some blank lines for readability
Some extra blank lines between if checks don't hurt and improve
readability.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:31 +01:00
Antonio Ospite 61e2c70da9 iio: accel: kxcjk-1013: add the "KXCJ9000" ACPI id
This id has been seen in the DSDT of the Teclast X98 Air 3G tablet based
on Intel Bay Trail.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Cc: Bastien Nocera <hadess@hadess.net>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-07 10:42:31 +01:00
Jonathan Cameron 1a30295a09 iio:prox:sx9500 trivial simplification of return path in init function.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Vlad Dogaru <vlad.dogaru@intel.com>
2015-05-07 10:42:31 +01:00
Jonathan Cameron 2fdaf3f4f8 iio:light:ltr501 bug in parameter sanity check.
Clearly the intent was to error if the value was not 0 or 1.
As implemented we have (A != 0 || A != 1) which is always true
as A is never both 0 and 1 at the same time.

As the autobuilder suggested, && makes more sense for this error
check.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Acked-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-03 19:59:25 +01:00
Irina Tirdea ef8307a21a iio: accel: mma9553: fix gpio bitnum init value
Initial value of gpio bitnum is set to -1, but
the variable is declared as unsigned.

Use a positive invalid value for initial gpio
bitnum.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:52:35 +01:00
Irina Tirdea 334efd076d iio: accel: mma9553: refactor mma9553_read_raw
Refactor code for simplicity and clarity.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:52:31 +01:00
Irina Tirdea 996ba51459 iio: accel: mma9553: prefix naming fixes
Add mma9553_ prefix to all local functions/declarations.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:49:46 +01:00
Irina Tirdea 43c30937c3 iio: accel: mma9553: use GENMASK
Use GENMASK instead of BIT or direct value to
define a mask.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:49:27 +01:00
Irina Tirdea c105ac6a03 iio: accel: mma9553: comment and error message fixes
Use "GPIO" instead of "gpio" and "ACPI" instead of "acpi".

Includes a couple of small style fixes in comments
(missing full stop, whitespace, paranthesis).

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:48:11 +01:00
Irina Tirdea 04aff96ad4 iio: accel: mma9553: return 0 as indication of success
Use return 0 instead of return ret to mark
clearly the success return path.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Suggested-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:47:41 +01:00
Irina Tirdea 1d052931c6 iio: accel: mma9553: check for error in reading initial activity and stepcnt
When configuring gpio, we need to read initial values for activity and
step count. This function may fail due to i2c read errors.

Check the error code returned by mma9553_read_activity_stepcnt
and return the appropriate error in gpio config function.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:46:39 +01:00
Irina Tirdea 476c41a73e iio: accel: mma9551_core: typo fix in RSC APP ID
Fix typo in Reset/Suspend/Clear Application ID definition.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:46:17 +01:00
Irina Tirdea b39f0c945c iio: accel: mma9551_core: wrong doc fixes
Fix docummentation for mma9553_read_* functions.

Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Reported-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 19:45:08 +01:00
Daniel Baluta 035ebb1510 iio: ltr501: Add support for ltr301 chip
Added support for Liteon 301 Ambient light sensor. Since
LTR-301 and LTR-501 are register compatible(and even have same
part id), LTR-501 driver has been extended to support both
devices. LTR-501 is similar to LTR-301 in ALS sensing, But the
only difference is, LTR-501 also supports proximity sensing.

LTR-501 - ALS + Proximity combo
LTR-301 - ALS sensor.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 16:53:44 +01:00
Daniel Baluta 8592a7eefa iio: ltr501: Add support for ltr559 chip
This device is register compatible with LTR501, with a minor difference for
ALS control register as showed below:

ALS Control register for LTR501:

    7      6      5      4      3      2      1      0
+------+------+------+------+------+------+------+------+
|                           |      |      |             |
|        Reserved           | Gain |  SW  |    ALS Mode |
|                           |      | Reset|             |
+------+------+------+------+------+------+------+------+

ALS Control register for LTR559:

    7      6      5      4      3      2      1      0
+------+------+------+------+------+------+------+------+
|                    |                    |      |      |
|     Reserved       |        Gain        |  SW  | ALS  |
|                    |                    | Reset| Mode |
+------+------+------+------+------+------+------+------+

We handle this difference by introducing ltr501_chip_info.

Datasheet for LTR559 is at:
http://optoelectronics.liteon.com/upload/download/DS86-2013-0003/S_110_LTR-559ALS-01_DS_V1.pdf

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26 14:53:14 +01:00
Kuppuswamy Sathyanarayanan 772154d0dd iio: ltr501: Add ACPI enumeration support
Added ACPI enumeration support for LTR501 chip.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-19 13:44:28 +01:00
Kuppuswamy Sathyanarayanan eea53b4a25 iio: ltr501: Add interrupt rate control support
Added rate control support for ALS and proximity
threshold interrupts.Also, Added support to modify
and read ALS & proximity sensor sampling frequency.

LTR-501 supports interrupt rate control using persistence
register settings. Writing <n> to persistence register
would generate interrupt only if there are <n> consecutive
data values outside the threshold range.

Since we don't have any existing ABI's to directly
control the persistence register count, we have implemented
the rate control using IIO_EV_INFO_PERIOD. _period event
attribute represents the amount of time in seconds an
event should be true for the device to generate the
interrupt. So using _period value and device frequency,
persistence count is calculated in driver using following
logic.

count =  period / measurement_rate

If the given period is not a multiple of measurement rate then
we round up the value to next multiple.

This patch also handles change to persistence count whenever
there is change in frequency.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-19 13:43:33 +01:00
Kuppuswamy Sathyanarayanan 7ac702b314 iio: ltr501: Add interrupt support
This patch adds interrupt support for Liteon 501 chip.

Interrupt will be generated whenever ALS or proximity
data exceeds values given in upper and lower threshold
register settings.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-19 13:42:24 +01:00
Kuppuswamy Sathyanarayanan 844b47027d iio: ltr501: Add integration time support
Added support to modify and read ALS integration time.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-19 13:40:36 +01:00
Peter Meerwald 49064b5a61 iio:tmp006: Prefix #defines with TMP006_
just cleanup, no functional change

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:36:15 +01:00
Peter Meerwald 6fa273c1aa iio:tsl2563: Use tsl2563_ prefix for driver's functions
just cleanup, no functional change

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:35:31 +01:00
Peter Meerwald 6b57573bd0 iio:tsl4531: Fix leftover TCS3472_ prefix in tsl4531 driver
just cleanup, no functional change

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:31:35 +01:00
Vlad Dogaru 45fd5f8e10 iio: sx9500: add GPIO reset pin
If a GPIO reset pin is listed in ACPI or Device Tree, use it to reset
the device on initialization.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:14:54 +01:00
Vlad Dogaru 821ace2929 iio: sx9500: refactor GPIO interrupt code
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:14:14 +01:00
Vlad Dogaru 59bd0427c0 iio: sx9500: optimize power usage
In the interest of lowering power usage, we only activate the proximity
channels and interrupts that we are currently using.

For raw reads, we activate the corresponding channel and the data ready
interrupt and wait for the interrupt to trigger.  If no interrupt is
available, we wait for the documented scan period, as specified in the
datasheet.

The following types of usage patterns may overlap:

* raw proximity reads (need a single data ready interrupt)
* trigger usage (needs data ready interrupts as long as active)
* proximity events (need near/far interrupts)
* triggered buffer reads (don't need any interrupts, but are usually
coupled with our own trigger.

To mitigate all possible patterns, we implement usage counting for all
the resources used: data ready interrupts, near/far interrupts and
individual channels.

The device enters sleep mode as documented in the data sheet when its
buffer, trigger and events are disabled, and no raw reads are currently
running.

Because of this new usage pattern, it is important that we give the
device a chance to perform an initial compensation for all its channels
at probe time.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 20:11:52 +01:00
Vianney le Clément de Saint-Marcq 6069f47f08 iio: mlx90614: Fix duplicate const warning
Fix a typo triggering a duplicate const warning on some compilers.

Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 19:57:47 +01:00
Kuppuswamy Sathyanarayanan 2f2c96338a iio: ltr501: Add regmap support.
Added regmap support. It will be useful to handle
bitwise updates to als & ps control registers.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 19:57:46 +01:00
Vlad Dogaru a40c0ac108 iio: sx9500: fix formatting
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18 19:57:46 +01:00