Commit graph

1277 commits

Author SHA1 Message Date
Greg Kroah-Hartman 61e331202f Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle.
Core functionality
 * i and q modifiers from quadrature channels.
 * IIO_CHAN_INFO_OVERSAMPLING_RATIO added.
 * High pass filter attributes added to mirror the existing low pass filter
   ones.
 
 Core cleanups
 * Make IIO tools building more cross compiler friendly.
 * Substantial rework of the function __iio_update_buffers to greatly simplify
   a hideously evolved function.
 
 New drivers and support
 * ACPI0008 ambient light sensor driver. This one has been around a long time to
   will be good to finally get it into mainline.
 * Berlin SOC ADC support.
 * BMC150 magnetometer.  The accelerometer in the same package has been supported
   for quite some time, so good to have this half as well.
 * m62332 DAC driver
 * MEMSIC MMC35420 magnetometer.
 * ROHM BH1710 and similar ambient light sensors.
 * Sensortek STK3310 light sensor.
 * Sensortek STK8312 accelerometer.
 * Sensortek STK8BA50 accelerometer.
 * ti-adc128s052 gains support form the adc122s021 2 channel ADC.
 
 Driver cleanups and functionality.
 * Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled.
 * bmc150 - decouple trigger from buffer to allow other triggers to be used.
 * bmg160 - decouple trigger from buffer to allow other triggers to be used.
   Fix a trivial unused field.
 * Constify a load of platform_device_id structures.
 * inv_mpu6050 - device tree bindings.
 * hid-sensors - fix a memory leak during probe if certain errors occur.
 * ltr501 - illuminance channel derived (in an non obvious fashion) from the
   intensity channels.
 * ltr501 - fix a boundary check on the proximity threshold.
 * mlx90614 - drop a pointless return.
 * mma8452 - Debugfs register access and fix a bug that had no effect (by
   coincidence)
 * ti_am335x_adc - add device tree bindings for sample-delay, open-delay and
   averaging.  The ideal settings for these tend to be board design specific.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVYfYpAAoJEFSFNJnE9BaI1ScQAIJ2jsFZdf8fcVnWeq0bYx9I
 VUPfz/bJ/kLQRGm/LDgpMPc5o1mOE+rupwFpp/iQf15vVUN86+CRLt0qd5I/cAEg
 I3qbaieS1H9Qyd2dLTgAcZAh6tH7ZvFJm/hB6T5xQAYFGY2IMq/n3qA4//W37tUb
 2bKTRb67LWbGivOvwbxdSpEkBLtVcUw3UNn9nfqjB8BEAHIesh88gJkVKAAuRYqk
 Tm8AzQ7EGsosz2R7mIvukSBwXBcvRyxyOxCdLBPIWSESeLwMiiat0zCfv3MxrYiD
 FVpdlywoReIjDG6z9ALOm4VMtRF2m2VrjPHclQ3kYgYSgyf0fRmoiyGowv7hkeya
 Z+p9ltOZ8qdis+yH1ci9Ch695HURa1m0seirX4exqiv0Crx8UF+iNIvs9Ai84Rv8
 NNVlscoeEyijUaqoBb1YvG/Fryh2IEiGXTkF4Eld+EhW8AKkFFNIqR+Gwvs1YegT
 02A8kHxD0GyMYJo1uEwd+TnKwCBglwsie8omkxOXqsY860DRtBr7jOxyb/RzkSVi
 jGtq1Y4nxVv7q3nkn+vQDRNgAQTbH1EJfrDilpIxIWK+9onNmKMnhKnSTVNAdld/
 Hhn9g/MHptQtmA+DwMcJ3Aqn0xMUdgoE9GIkMGoKSZku9H0DhWHLdxTa2lxdJFUo
 OiWVvP0eJuvu0E0h4eA2
 =uX2k
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second set of new driver, functionality and cleanups for IIO in the 4.2 cycle.

Core functionality
* i and q modifiers from quadrature channels.
* IIO_CHAN_INFO_OVERSAMPLING_RATIO added.
* High pass filter attributes added to mirror the existing low pass filter
  ones.

Core cleanups
* Make IIO tools building more cross compiler friendly.
* Substantial rework of the function __iio_update_buffers to greatly simplify
  a hideously evolved function.

New drivers and support
* ACPI0008 ambient light sensor driver. This one has been around a long time to
  will be good to finally get it into mainline.
* Berlin SOC ADC support.
* BMC150 magnetometer.  The accelerometer in the same package has been supported
  for quite some time, so good to have this half as well.
* m62332 DAC driver
* MEMSIC MMC35420 magnetometer.
* ROHM BH1710 and similar ambient light sensors.
* Sensortek STK3310 light sensor.
* Sensortek STK8312 accelerometer.
* Sensortek STK8BA50 accelerometer.
* ti-adc128s052 gains support form the adc122s021 2 channel ADC.

Driver cleanups and functionality.
* Allow various drivers to compile with !GPIOLIB if COMPILE_TEST enabled.
* bmc150 - decouple trigger from buffer to allow other triggers to be used.
* bmg160 - decouple trigger from buffer to allow other triggers to be used.
  Fix a trivial unused field.
* Constify a load of platform_device_id structures.
* inv_mpu6050 - device tree bindings.
* hid-sensors - fix a memory leak during probe if certain errors occur.
* ltr501 - illuminance channel derived (in an non obvious fashion) from the
  intensity channels.
* ltr501 - fix a boundary check on the proximity threshold.
* mlx90614 - drop a pointless return.
* mma8452 - Debugfs register access and fix a bug that had no effect (by
  coincidence)
* ti_am335x_adc - add device tree bindings for sample-delay, open-delay and
  averaging.  The ideal settings for these tend to be board design specific.
2015-05-24 11:45:21 -07:00
Tiberiu Breana 884ca45613 iio: accel: Add support for Sensortek STK8BA50
Minimal implementation of an IIO driver for the Sensortek
STK8BA50 3-axis accelerometer. Datasheet:
http://szgsensor.com/uploads/soft/141229/STK8BA50%D2%E5%BC%CE.pdf

Includes:
- ACPI support;
- read_raw for x,y,z axes;
- reading and setting the scale (range) parameter.
- power management

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 12:57:11 +01:00
Lars-Peter Clausen 1250186a93 iio: __iio_update_buffers: Leave device in sane state on error
Currently when something goes wrong at some step when disabling the buffers
we immediately abort. This has the effect that the enable/disable calls are
no longer balanced. So make sure that even if one step in the disable
sequence fails the other steps are still executed.

The other issue is that when either enable or disable fails buffers that
were active at that time stay active while the device itself is disabled.
This leaves things in a inconsistent state and can cause unbalanced
enable/disable calls. Furthermore when enable fails we restore the old scan
mask, but still keeps things disabled.

Given that verification of the configuration was performed earlier and it
is valid at the point where we try to enable/disable the most likely reason
of failure is a communication failure with the device or maybe a
out-of-memory situation. There is not really a good recovery strategy in
such a case, so it makes sense to leave the device disabled, but we should
still leave it in a consistent state.

What the patch does if disable/enable fails is to deactivate all buffers
and make sure that the device will be in the same state as if all buffers
had been manually disabled.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 12:44:38 +01:00
Lars-Peter Clausen 623d74e37f iio: __iio_update_buffers: Split enable and disable path into helper functions
__iio_update_buffers is already a rather large function with many different
error paths and it is going to get even larger. This patch factors out the
device enable and device disable paths into separate helper functions.

The patch also re-implements iio_disable_all_buffers() using the new
iio_disable_buffers() function removing a fair bit of redundant code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 12:44:34 +01:00
Lars-Peter Clausen 6e509c4d91 iio: __iio_update_buffers: Verify configuration before starting to apply it
Currently __iio_update_buffers() verifies whether the new configuration
will work in the middle of the update sequence. This means if the new
configuration is invalid we need to rollback the changes already made. This
patch moves the validation of the new configuration at the beginning of
__iio_update_buffers() and will not start to make any changes if the new
configuration is invalid.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 12:44:30 +01:00
Urs Fässler 2a67dfba7f iio:adc128s052: add support for adc122s021
Signed-off-by: Urs Fässler <urs.fassler@bytesatwork.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 12:42:43 +01:00
Lars-Peter Clausen 1ce87f21ed iio: Add I/Q modifiers
I/Q modifiers can be used to denote signals which are represented by a
in-phase and a quadrature component.

The ABI documentation describes the I and Q modifiers for current and
voltage channels for now as those will be the most likely users.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 10:49:55 +01:00
Antoine Tenart 70f1937911 iio: adc: add support for Berlin
This patch adds the support of the Berlin ADC, available on Berlin SoCs.
This ADC has 8 channels available, with one connected to a temperature
sensor.

The particularity here, is that the temperature sensor connected to the
ADC has its own registers, and both the ADC and the temperature sensor
must be configured when using it.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-23 10:47:40 +01:00
Greg Kroah-Hartman 936a0cd52a Merge 4.1-rc4 into staging-next
We want the fixes in here for testing and merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-18 13:52:44 -07:00
Tiberiu Breana 90bad33acb iio: accel: Add support for Sensortek STK8312
Minimal implementation of an IIO driver for the Sensortek
STK8312 3-axis accelerometer. Datasheet:
http://www.syi-group.com/uploadpic/data/201361817562681623.pdf

Includes:
- ACPI support;
- read_raw for x,y,z axes;
- reading and setting the scale (range) parameter.
- power management

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 11:03:31 +01:00
Vlad Dogaru c16bff4844 iio: accel: bmc150: decouple buffer and triggers
If the interrupt pins are not available, we should still be able to use
the buffer with an external trigger.  However, we won't be able to use
the hardware fifo since we have no means of signalling when the
watermark is reached.

I also added a comment to indicate that the timestamps in
bmc150_accel_data are only used for hardware fifo, since initially I was
confused about duplication with pf->timestamp.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:57:27 +01:00
Martin Fuzzey 3f7f642b9b iio: core: add high pass filter attributes
Add a high pass filter attribute for measurements
(like the existing low pass)

Also add both high and low pass attributes for events.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:32:35 +01:00
Martin Fuzzey 2a17698c0e iio: mma8452: Add access to registers via DebugFS
Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:31:09 +01:00
Martin Fuzzey ecabae7131 iio: mma8452: Initialise before activating
Many of the hardware configuration registers may only be modified while the
device is inactive.

Currently the probe code first activates the device and then modifies the
registers (eg to set the scale). This doesn't actually work but is not
noticed since the scale used is the default value.

While at it also issue a hardware reset command at probe time.

Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:29:07 +01:00
Vlad Dogaru 00e0c8e8e8 iio: gyro: bmg160: decouple buffer and triggers
Make it possible to use buffering with an external trigger, such as one
based on sysfs or hrtimer.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:26:54 +01:00
Vlad Dogaru eb2191017e iio: gyro: bmg160: remove redundant field
Replace the 'timestamp' field in struct bmg160_data with the identically
named field in iio_poll_func and with calls to iio_get_time_ns().

The reported timestamps may be slightly different, but the advantage is
that we no longer assume that the buffer of bmg160 is triggered by its
own trigger.

Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:24:36 +01:00
Lars-Peter Clausen fcc1b2f57d iio: __iio_update_buffers: Perform request_update() only for new buffers
We only have to call the request_update() callback for a newly inserted
buffer. The configuration of the already previously active buffers will not
have changed.

This also allows us to move the request_update() call to the beginning of
__iio_update_buffers(), before any currently active buffers are stopped.
This makes the error handling a lot easier since no changes were made to
the buffer list and no rollback needs to be performed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 10:01:45 +01:00
Lars-Peter Clausen 248be5aafc iio: __iio_update_buffers: Slightly refactor scan mask memory management
Add a small helper function iio_free_scan_mask() that takes a mask and
frees its memory if the scan masks for the device are dynamically
allocated, otherwise does nothing. This means we don't have to open-code
the same check over and over again in __iio_update_buffers.

Also free compound_mask as soon a we are done using it. This constrains its
usage to a specific region of the function will make further refactoring
and splitting the function into smaller sub-parts more easier.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:45:22 +01:00
Lars-Peter Clausen 63223c5f5c iio: Replace printk in __iio_update_buffers with dev_dbg
While more verbose error messages are useful for debugging we should really
not put those error messages into the kernel log for normal errors that are
already reported to the application via the error code, when running in
non-debug mode.

Otherwise application authors might expect that this is part of the ABI and
to get the error they should scan the kernel log. Which would be rather
error prone itself since there is no direct mapping between a operation and
the error message so it is impossible to find out which error message
belongs to which error.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:41:43 +01:00
Dmitry Eremin-Solenikov b87b0c0f81 iio: add m62332 DAC driver
m62332 is a simple 2-channel DAC used on several Sharp Zaurus boards to
control LCD voltage, backlight and sound. The driver use regulators to
control the reference voltage and enabling/disabling the DAC.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:37:45 +01:00
Kuppuswamy Sathyanarayanan c06cee8d08 iio: ltr501: Add light channel support
Added support to calculate lux value from visible
and IR spectrum adc count values. Also added IIO_LIGHT
channel to enable user read the lux value directly
from device using illuminance input ABI.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:14:10 +01:00
Fabio Estevam c24e7daf82 iio: pressure: hid-sensor-press: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:10:33 +01:00
Fabio Estevam 2bd0462843 iio: orientation: hid-sensor-rotation: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:10:25 +01:00
Fabio Estevam 32ee56e306 iio: orientation: hid-sensor-incl-3d: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:10:14 +01:00
Fabio Estevam 9ecdbed790 iio: light: hid-sensor-als.c: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:10:05 +01:00
Fabio Estevam d8c9d23e29 iio: gyro: hid-sensor-gyro-3d: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:09:49 +01:00
Fabio Estevam b136faff9b iio: accel: hid-sensor-accel-3d: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed in the
subsequent error paths.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-17 09:09:05 +01:00
Kuppuswamy Sathyanarayanan 01e537f733 iio: ltr501: Fix proximity threshold boundary check
Currently, proximity sensor boundary check is done
inside the switch block but outside the case
statement.Since this code will never get executed,
moved the check outside the switch case statement.

   867          case IIO_PROXIMITY:
   868                  switch (dir) {
   // Following line has been moved outside the switch block.
   869                  if (val > LTR501_PS_THRESH_MASK)
   870                          return -EINVAL;
   871                  case IIO_EV_DIR_RISING:

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-16 11:09:06 +01:00
Greg Kroah-Hartman ec94efcdad The usual mixed bag of fixes for IIO in the 4.1 cycle.
Second version of this pull request as a small fix to a fix turned
 up before Greg pulled it for a cc10001 patch near the top of the tree.
 
 One core fix
 
 * Set updated for a iio kfifo was incorrectly set to false during a failed
   update, resulting in atttempts to repeat the failed operation appearing
   to succeed.
 
 This time I've decided to list the driver fixes in alphabetical order rather
 than 'randomly'.
 
 * axp288_adc - a recent change added a check for valid info masks when
   reading channels from consumer drivers.
 * bmp280 - temperature compensation was failing to read the tfine value, hence
   causing a temperature of 0 to always be returned and incorrect presure
   measurements.
 * cc10001 - Fix channel number mapping when some channels are reserved for
   remote CPUs. Fix an issue with the use of the power-up/power-down register
   (basically wrong polarity). Fix an issue due to the missinterpretting the
   return value from regulator_get_voltage. Add a delay before the start bit
   as recommended for the hardware to avoid data corruption.
 * hid pressure - fix channel spec of modfiied, but no modifier (which makes no
   sense!)
 * hid proximity - fix channel spec of modified, but no modifier (which makes
   no sense!). Fix a memory leak in the probe function.
 * mcp320x - occasional incorrect readings on dma using spi busses due to
   cacheline corruption. Fixed by forcing ___cacheline_aligned for the buffers.
 * mma9551 - buffer overrun fix (miss specified maximum length of buffers)
 * mma9553 - endian fix on status message. Add an enable element for activity
   channel. Input checking for activity period to avoid rather unpredictable
   results.
 * spmi-vadc - fix an overflow in the output value normalization seen on some
   boards.
 * st-snesors - oops due to use of a mutex that is not yet initialized during
   probe.
 * xilinx adc - Some wrong register addresses, a wrong address for vccaux
   channel, incorrect scale on VREFP and incorrect sign on VREFN.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVUllEAAoJEFSFNJnE9BaIq7MP/1BLv6u7MWh1FITay4aBSR16
 o8x7fmqbXoVSNz44cU3aZ//MJOfGNZQM220iA+e01PjmS3Jqr3HxSBLI/XosVEq8
 om40h7/esiYWP61u8yZeSXr74K25dUpaz9c4Zl+/2BRYlUAPEh3b9DraXN9dE8Rs
 u0AoGnYxnPAAYEbNUinKQLDw2BoQoTBX3QgRPNJsWL2BapAAyg9JNxm7JMKJateb
 dMP0LyJ7puVqfeDLb2XzNq8eaMbBrRMIj7LNJGOO8EvzCZEC029kSWlGUAgeXYgW
 XJdj0WZ8fmYw8OVzvgci5ODVS7RXqb22j2hjA2cx/20tFDt2WjGaQAwbQckWmVJx
 cZXzPY89wvqm5jpEey79GSAP8rx7PGy7SxFl0zmuqrdXte81W7ArvGwERJBQgEWa
 VR7WA3MnJjPQtyRRC0Y/6jwe+SdbmM50JmRzB7ApMf3G3sbAdEFp0rcNe181+S9V
 AmQK4OyBP9xVgnlNlglAKeDgNuG7w/2Bp8TFXaDX+1JQP4eM1GmoDyje4/x9WOsx
 hH+Ord9Vbyy8UjFq5tHS3444bmg8mYtYnWIH7+8XImvwhhyzDx82MVkqX2S37n+T
 tMQA04ntt/r68i6KsKVGP8QFftSNJcnFxXUMr4SPigomdaooe0v6Vl7w82kxFL5o
 Im6bayZ29fOuJWJ2Rslb
 =PiG+
 -----END PGP SIGNATURE-----

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

Jonathan writes:

The usual mixed bag of fixes for IIO in the 4.1 cycle.

Second version of this pull request as a small fix to a fix turned
up before Greg pulled it for a cc10001 patch near the top of the tree.

One core fix

* Set updated for a iio kfifo was incorrectly set to false during a failed
  update, resulting in atttempts to repeat the failed operation appearing
  to succeed.

This time I've decided to list the driver fixes in alphabetical order rather
than 'randomly'.

* axp288_adc - a recent change added a check for valid info masks when
  reading channels from consumer drivers.
* bmp280 - temperature compensation was failing to read the tfine value, hence
  causing a temperature of 0 to always be returned and incorrect presure
  measurements.
* cc10001 - Fix channel number mapping when some channels are reserved for
  remote CPUs. Fix an issue with the use of the power-up/power-down register
  (basically wrong polarity). Fix an issue due to the missinterpretting the
  return value from regulator_get_voltage. Add a delay before the start bit
  as recommended for the hardware to avoid data corruption.
* hid pressure - fix channel spec of modfiied, but no modifier (which makes no
  sense!)
* hid proximity - fix channel spec of modified, but no modifier (which makes
  no sense!). Fix a memory leak in the probe function.
* mcp320x - occasional incorrect readings on dma using spi busses due to
  cacheline corruption. Fixed by forcing ___cacheline_aligned for the buffers.
* mma9551 - buffer overrun fix (miss specified maximum length of buffers)
* mma9553 - endian fix on status message. Add an enable element for activity
  channel. Input checking for activity period to avoid rather unpredictable
  results.
* spmi-vadc - fix an overflow in the output value normalization seen on some
  boards.
* st-snesors - oops due to use of a mutex that is not yet initialized during
  probe.
* xilinx adc - Some wrong register addresses, a wrong address for vccaux
  channel, incorrect scale on VREFP and incorrect sign on VREFN.
2015-05-13 11:51:14 -07:00
Jonathan Cameron f2c714a0a2 iio:temp:mlx90614 trivial drop of unnecessary ret return from write_raw.
This is mostly part of an effort to clean out our current warnings
and make the autobuilder build reports more useful.

Still a worthwhile if trivial cleanup!

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
2015-05-13 18:40:31 +01:00
Vignesh R 5dc11e8106 iio: adc: ti_am335x_adc: make sample delay, open delay, averaging DT parameters
Add optional DT properties to set open delay, sample delay and number
of averages per sample for each adc step. Open delay, sample delay
and averaging are some of the parameters that affect the sampling rate
and accuracy of the sample. Making these parameters configurable via
DT will help in balancing speed vs accuracy.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-13 18:37:22 +01:00
Fabio Estevam f0828ba96d iio: light: hid-sensor-prox: Fix memory leak in probe()
'channels' is allocated via kmemdup and it is never freed.

Use 'indio_dev->channels' directly instead, so that we avoid such
memory leak problem.

Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-12 20:01:13 +01:00
Naidu Tellapati f29b212edb iio: adc: cc10001: Add delay before setting START bit
According to hardware team there should be some delay after
setting channel number, start mode and before setting START.
Add a one microsecond delay for this purpose.

Fixes: 1664f6a5b0 ("iio: adc: Cosmic Circuits 10001 ADC driver")
Signed-off-by: Naidu Tellapati <naidu.tellapati@imgtec.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-12 20:01:13 +01:00
Naidu Tellapati 65a761bf8d iio: adc: cc10001: Fix regulator_get_voltage() return value check
regulator_get_voltage() returns a non-negative value in case of success,
and a negative error in case of error. Let's fix this.

Fixes: 1664f6a5b0 ("iio: adc: Cosmic Circuits 10001 ADC driver")
Signed-off-by: Naidu Tellapati <naidu.tellapati@imgtec.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-12 20:01:12 +01:00
Naidu Tellapati 713276ea88 iio: adc: cc10001: Fix incorrect use of power-up/power-down register
At present we are incorrectly setting the register to 0x1 to power up
the ADC. Since it is an active high power down register, we need to set
the register to 0x0 to actually power up. Conversely, writing 0x1 to the
register powers it down.

This commit adds a couple of helpers to make the code clearer and then
use them to do the power-up/power-down properly.

Fixes: 1664f6a5b0 ("iio: adc: Cosmic Circuits 10001 ADC driver")
Signed-off-by: Naidu Tellapati <naidu.tellapati@imgtec.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-12 20:00:58 +01:00
Gabriele Mazzotta feca56ff40 iio: acpi: Add support for ACPI0008 Ambient Light Sensor
This driver adds the initial support for the ACPI Ambient Light Sensor
as defined in Section 9.2 of the ACPI specification (Revision 5.0) [1].

Sensors complying with the standard are exposed as ACPI devices with
ACPI0008 as hardware ID and provide standard methods by which the OS
can query properties of the ambient light environment the system is
currently operating in.

This driver currently allows only to get the current ambient light
illuminance reading through the _ALI method, but is ready to be
extended extended to handle _ALC, _ALT and _ALP as well.

[1] http://www.acpi.info/DOWNLOADS/ACPIspec50.pdf

Signed-off-by: Martin Liska <marxin.liska@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-10 20:31:48 +01:00
Krzysztof Kozlowski 85b4ba7055 iio: hid-sensor-press: 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 6b490c6c67 iio: hid-sensor-rotation: 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 5dd86df009 iio: hid-sensor-incl-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 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