Commit graph

2206 commits

Author SHA1 Message Date
John Brooks
5c113b5e00 iio: dht11: Use usleep_range instead of msleep for start signal
The DHT22 (AM2302) datasheet specifies that the LOW start pulse should not
exceed 20ms. However, observations with an oscilloscope of an RPi Model 2B
(rev 1.1) communicating with a DHT22 sensor showed that the driver was
consistently sending start pulses longer than 20ms:

Kernel 4.7.10-v7+ (n=132):
    Minimum pulse length: 20.20ms
    Maximum:              29.84ms
    Mean:                 24.96ms
    StDev:                2.82ms
    Sensor response rate: 100%
    Read success rate:    76%

On kernel 4.8, the start pulse was so long that the sensor would not even
respond 97% of the time:

Kernel 4.8.16-v7+ (n=100):
    Minimum pulse length: 30.4ms
    Maximum:              74.4ms
    Mean:                 39.3ms
    StDev:                10.2ms
    Sensor response rate: 3%
    Read success rate:    3%

The driver would return ETIMEDOUT and write log messages like this:

[   51.430987] dht11 dht11@0: Only 1 signal edges detected
[   66.311019] dht11 dht11@0: Only 0 signal edges detected

Replacing msleep(18) with usleep_range(18000, 20000) made the pulse length
sane again and restored responsiveness:

Kernel 4.8.16-v7+ with usleep_range (n=123):
    Minimum pulse length: 18.16ms
    Maximum:              20.20ms
    Mean:                 19.85ms
    StDev:                0.51ms
    Sensor response rate: 100%
    Read success rate:    84%

Cc: stable@vger.kernel.org
Signed-off-by: John Brooks <john@fastquake.com>
Reviewed-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22 13:35:40 +00:00
Alison Schofield
d1aaf20ee6 iio: adc: palmas_gpadc: retrieve a valid iio_dev in suspend/resume
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's.  Use dev_get_drvdata()
for a platform device to get the correct iio_dev.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21 14:26:03 +00:00
Matt Ranostay
828f84ee8f iio: health: max30100: fixed parenthesis around FIFO count check
FIFO was being read every sample after the "almost full" state was
reached. This was due to an incorrect placement of the parenthesis
in the while condition check.

Note - the fixes tag is not actually correct, but the fix in this patch
would also be needed for it to function correctly so we'll go with that
one.  Backports should pick up both.

Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Fixes: b74fccad7 ("iio: health: max30100: correct FIFO check condition")
Cc: Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21 14:16:20 +00:00
Alison Schofield
802ecfc113 iio: health: afe4404: retrieve a valid iio_dev in suspend/resume
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's.  Replace it with i2c
functions to get the correct iio_dev.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21 13:12:41 +00:00
Alison Schofield
a5badd1e97 iio: health: afe4403: retrieve a valid iio_dev in suspend/resume
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's.  Replace it with spi
functions to get the correct iio_dev.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-21 13:11:06 +00:00
Greg Kroah-Hartman
890b73af6b First round of IIO fixes for the 4.10 cycle.
* 104-quad-8
   - Fix selecting wrong register when the index control register is desired.
   - Fix an off by one error when addressing the input/output control register.
   - Fix inverted logic on the active high / low control
 * bmi160
   - Sleep for worst case rather than best case amount of time after cmd
   execution begins.
 * max44000
   - typo fix in illuminance_integration_time_available listing.
 * st-sensors
   - Fix channel data passing.  This one took a while to get tested on 24bit
   parts. Definitely one for stable asap as the bug broke quite a few parts.
   - lis3lv02 needs a data alignment bit set and the scaling was wrong.
 * ti_am335x
   - depend on HAS_DMA
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAlhnxPERHGppYzIzQGtl
 cm5lbC5vcmcACgkQVIU0mcT0Fojkwg//TD9jlh6x/Xt7qi0EgC1c8Ie0Dr6iUsQr
 gYgvVMtIsjSlThXGtLWxjDLzLeW1DUpxwjy9Kqnwt5onBgBnQj5PAL/lptH7/e6z
 hxj6lXvz5j1pcjjyXzhMa4JPIZJUU75Jj4airhGoHdvTFQDzqKr9GpLKUnrf4lwt
 HWFtCcT90ckhg/PTTaxfIhI4gEHBHoVx9h1/3Tn4VImhE693rLPSs1nS7+hEQIn2
 LZbCMAtxMh3qcCIK9fYrri3e+28KJ7veiWE8mYynxBd6Wa6OGq/D316Ml616mRgZ
 3SpyDWy05YtM4nVNi1kFwKTHb3v6Ljeyno0lmP0joJlIGLwHJS1qDGL0Wps6RI87
 utrfcZKOI2hcoFm49OMYdV3MJ18umGo0asOFMlH6u0RaLXXAz7hN1l9nyB5VzejT
 8culF/8XgNYuzFhkD65Ecksoz0azfMwXphwyPm3WEt1EE5meMeXt6bVsfI+8vyhp
 e/TfhloVfLUobau5yF2C+ih7xrHkVta+f860jqCkiHqngUgzksLoah53mA2Wh36f
 2+D6RbEFEo6Fx4DoELm55CZKpVFv9Ia1ICkg2kuJCFBXL8aTAAYmyphyPDccXGSs
 G2DZCAUjJ1sP7xPVMGuLD7A/IvggUDbs8m0i2sVq4JRZVLRfBW9khjGaCmjOAWBY
 ijWzzZtUywo=
 =aYfF
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First round of IIO fixes for the 4.10 cycle.

* 104-quad-8
  - Fix selecting wrong register when the index control register is desired.
  - Fix an off by one error when addressing the input/output control register.
  - Fix inverted logic on the active high / low control
* bmi160
  - Sleep for worst case rather than best case amount of time after cmd
  execution begins.
* max44000
  - typo fix in illuminance_integration_time_available listing.
* st-sensors
  - Fix channel data passing.  This one took a while to get tested on 24bit
  parts. Definitely one for stable asap as the bug broke quite a few parts.
  - lis3lv02 needs a data alignment bit set and the scaling was wrong.
* ti_am335x
  - depend on HAS_DMA
2017-01-02 16:59:44 +01:00
Linus Walleij
65e4345c8e iio: accel: st_accel: fix LIS3LV02 reading and scaling
The LIS3LV02 has a special bit that need to be set to get the
read values left aligned. Before this patch we get gibberish
like this:

iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.010042 -0.642688 19155832931907
0.000000 -0.010042 -0.642688 19155858751073

Which is because we read a raw value for 1g as 64 which is
the nominal 1024 for 1g shifted 4 bits to the left by being
right-aligned rather than left aligned.

Since all other sensors are left aligned, add some code to
set the special DAS (data alignment setting) bit to 1 so that
the right value is now read like this:

iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.147095 -10.120135 24761614364956
-0.029419 -0.176514 -10.120135 24761631624540

The scaling was weird as well: we have a gain of 1000 for 1g
and 3000 for 6g. I don't even remember how I came up with the
old values but they are wrong.

Fixes: 3acddf74f8 ("iio: st-sensors: add support for lis3lv02d accelerometer")
Cc: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Cc: Giuseppe Barba <giuseppe.barba@st.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-31 14:35:04 +00:00
Lorenzo Bianconi
65c8aea07d iio: common: st_sensors: fix channel data parsing
Using realbits as i2c/spi read len, when that value is not byte aligned
(e.g 12 bits), lead to skip msb part of out data registers.
Fix this taking into account scan_type.shift in addition to
scan_type.realbits as read length:

read_len = DIV_ROUND_UP(realbits + shift, 8)

This fix has been tested on 8, 12, 16, 24 bit sensors

Fixes: e7385de529 ("iio:st_sensors: align on storagebits boundaries")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-31 14:32:09 +00: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
Geert Uytterhoeven
b1448ea9cd iio: adc: TI_AM335X_ADC should depend on HAS_DMA
If NO_DMA=y:

    ERROR: "bad_dma_ops" [drivers/iio/adc/ti_am335x_adc.ko] undefined!

Add a dependency on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: f438b9da (" drivers: iio: ti_am335x_adc: add dma support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 16:37:48 +00:00
Marcin Niestroj
01d1f7a99e iio: bmi160: Fix time needed to sleep after command execution
Datasheet specifies typical and maximum execution times for which CMD
register is occupied after previous command execution. We took these
values as minimum and maximum time for usleep_range() call before making
a new command execution.

To be sure, that the CMD register is no longer occupied we need to wait
*at least* the maximum time specified by datasheet.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-30 10:52:00 +00:00
Thomas Gleixner
8b0e195314 ktime: Cleanup ktime_set() usage
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
2016-12-25 17:21:22 +01:00
William Breathitt Gray
e91c3dfcd3 iio: 104-quad-8: Fix active level mismatch for the preset enable option
The set_to_preset_on_index sysfs attribute provides a boolean
configuration option to enable a preset operation on the respective
channel's counter when Index occurs. However, the corresponding
configuration bit on the Input/Output Control register must be set low
to enable the preset operation.

This patch inverts the internal driver boolean logic exposed via the
set_to_preset_on_index attribute in order to correctly configure the
device which expects an active low bit.

Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 10:08:09 +00:00
William Breathitt Gray
7e1c4058e7 iio: 104-quad-8: Fix off-by-one errors when addressing IOR
The Input/Output Control register (IOR) is offset by 1 from the
respective channel data register. This patch fixes off-by-one errors
when attempting to write to a channel IOR where the base address was not
properly offset.

Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 10:03:07 +00:00
William Breathitt Gray
47af2c676a iio: 104-quad-8: Fix index control configuration
The LS7266R1 requires bits 5 & 6 to be high in order to select the Index
Control Register. This patch fixes a typo that incorrectly selects the
Input/Output Control Register where the Index Control Register was
desired.

Fixes: 28e5d3bb03 ("iio: 104-quad-8: Add IIO support for the ACCES 104-QUAD-8")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 10:00:24 +00:00
Ooi, Joyce
6f771d0b33 iio: magnetometer: separate the values of attributes based on their usage type for HID compass sensor
There are 2 usage types (Magnetic Flux and Heading data field) for HID
compass sensor, thus the values of offset, scale, and sensitivity should
be separated according to their respective usage type. The changes made
are as below:
1. Hysteresis: A struct hid_sensor_common rot_attributes is created in
struct magn_3d_state to contain the sensitivity for IIO_ROT.
2. Scale: scale_pre_decml and scale_post_decml are separated for IIO_MAGN
and IIO_ROT.
3. Offset: Same as scale, value_offset is separated for IIO_MAGN and
IIO_ROT.

For sensitivity, HID_USAGE_SENSOR_ORIENT_MAGN_FLUX and
HID_USAGE_SENSOR_ORIENT_MAGN_HEADING are used for sensivitity fields based
on the HID Sensor Usages specifications. Hence, these changes are added on
the sensitivity field.

Signed-off-by: Ooi, Joyce <joyce.ooi@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-24 20:41:30 +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
Linus Walleij
9049531c91 iio: accel: st_accel: inline per-sensor data
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-19 12:25:36 +00:00
Fabrice Gasnier
0f883b223a iio: adc: Add support for STM32 ADC
This patch adds support for STMicroelectronics STM32 MCU's analog to
digital converter.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-19 12:18:33 +00:00
Fabrice Gasnier
1add698802 iio: adc: Add support for STM32 ADC core
Add core driver for STMicroelectronics STM32 ADC (Analog to Digital
Converter). STM32 ADC can be composed of up to 3 ADCs with shared
resources like clock prescaler, common interrupt line and analog
reference voltage.
This core driver basically manages shared resources.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-19 12:17:45 +00:00
Greg Kroah-Hartman
2c52b1efd6 Third set of IIO new device support, features and cleanup for the 4.10 cycle.
Includes Peter Rosin's interesting drivers for a comparator. First complex
 use we have had with an analog front end made from discrete components.
 
 Brian Masney's work on moving the tsl2583 driver out of staging also
 feature extensively!
 
 New Drivers
 * DAC based on a digital potentiometer
   - New driver for the use of a dpot as a DAC. Includes bindings and Axentia
   entry in vendor prefixes.
 * Envelope detector baed on DAC and a comparator including device tree
   bindings.
 
 Staging Graduation
 * tsl2583.
 
 Core new features
 - Core provision for _available attributes.   This one had been stalled for
   a long time until Peter picked it up and ran with it!
 - In kernel interface helpers to retrieve available info from channels.
 
 Driver new features
 * mcp4531
   - Add range of available raw values (used for the dpot dac driver).
 
 Driver cleanups and fixes for issues introduced
 * ad7766
   - Testing the wrong variable following devm_regulator_bulk_get introduced
   with the driver earlier in this cycle.
 * ad9832
   - Fix a wrong ordering in the probe introduced in the previous set of
     patches.  A use before allocation bug.
 * cros_ec_sensors
   - Testing for an error in a u8 will never work.
 * mpu3050
   - Remove duplicate initializer for the module owner.
   - Add missing i2c dependency.
   - Inform the i2c mux core how it is used - step one in implifying device
   tree bindings.
 * st-sensors
   - Get rid of large number of uninformative defines in favour of putting the
   constants where they are relevant. It is clear what they are from where
   they are used.
 * tsl2583
   - Fix unused function warning when CONFIG_PM disabled and remove the
   ifdefs in favour of __maybe_unused.
   - Refactor taos_chip_on  to only read relevant registers.
   - Make sure calibscale and integration time are being set.
   - Verify chip is in ready to be used before calibration.
   - Remove some repeated checks for chip status (it's protected by a mutex
   so can't change until it's released)
   - Change current state storage from a tristate enum to a boolean seeing as
   only two values are actually used now.
   - Drop a redundant write to the control regiser in taos_probe (it's a noop)
   - Drop the FSF mailing address.
   - Clean up logging to not use hard coded function names (use __func__
   instead).
   - Cleanup up variable and function name prefixes.
   - Alignment of #define fixes.
   - Fix comparison between signed and unsigned integer warnings.
   - Add some newlines in favour of readability.
   - Combine the two sysfs ABI docs that somehow ended up in different places.
   - Fix multiline comment syntax.
   - Move a code block to inside an else statement as it makes more sense there.
   - Change tsl2583_als_calibrate to return 0 rather than a value nothing
   reads.
   - Drop some pointless brackets
   - Don't assume 32bit unsigned int.
   - Change to a per device instance lux table.
   - Add missing tsl2583 to the list of supported devices in the intro comments.
   - Improve commment on clearing of interrupts.
   - Drop some uninformative comments.
   - Drop a memset call that doesn't do anything useful any more.
   - Don't initialize some return variables that are always set.
   - Add Brian Masney as a module author after all these changes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJYKMYhERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIiNMP
 /00ZTTfPR/I5VtriTchGTgXN6lDTnypFk9Z4niynK3EIdF6Mw5XphQjtUzg7sJl4
 U7yH89lzt0PxAJHylW5x0YOwrr6fyau+rNA2Kj26psaQpf5Yva0UDRexsomTZaad
 P005cf0yc4fuG/7KvjeONeLeaRXf9Qfs20r8htECLFhIGSE0qsGtfzUMn6tdbyn/
 r/hxHR7oE2YThuFytX2sNJEJVmCDz+tTOz7kJv5L0e6Cg6cvMFizYUsoFYcZYGOQ
 DNicdRfW5FOidBMCqXzYLDBn+oY+a35g90hFV3CvYsfEm+X6BzTgr3FI3PHmtXHT
 RRAmRdgxg2z/rqp475f5EamRtZxEg0uktbqcs9bH8Bx7IDe8KtoNKLdPdxIT3T1D
 ZYb0RkpPmfnBq3bDGh7DJVWl+Ht9Fj0jaKRNyWgiyopA9c6zN4MKRA+HNSxKRvD7
 Qizw0QIPbtEGkw6WbQrrOSSwzNY/dq51vrT0eBmMaGpjmdDpRKrK53/k7uwk3/Wv
 hjGWD5kdLRCAHL+EQKFssN/RgLS5PRhXsJQFeIYbH8VJFlEZ28j09gXJnjcpDucK
 CXv37q8CX6wJ2NB+i+skOvKpxArgv+Mr4oE9LNYZie65EUyN28/Ii1n9vYmTPTlG
 KXGKPynaR0sfrl+ir6+FCtuFXJnYC5WUqJH/yMRjA2z8
 =mPkb
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Third set of IIO new device support, features and cleanup for the 4.10 cycle.

Includes Peter Rosin's interesting drivers for a comparator. First complex
use we have had with an analog front end made from discrete components.

Brian Masney's work on moving the tsl2583 driver out of staging also
feature extensively!

New Drivers
* DAC based on a digital potentiometer
  - New driver for the use of a dpot as a DAC. Includes bindings and Axentia
  entry in vendor prefixes.
* Envelope detector baed on DAC and a comparator including device tree
  bindings.

Staging Graduation
* tsl2583.

Core new features
- Core provision for _available attributes.   This one had been stalled for
  a long time until Peter picked it up and ran with it!
- In kernel interface helpers to retrieve available info from channels.

Driver new features
* mcp4531
  - Add range of available raw values (used for the dpot dac driver).

Driver cleanups and fixes for issues introduced
* ad7766
  - Testing the wrong variable following devm_regulator_bulk_get introduced
  with the driver earlier in this cycle.
* ad9832
  - Fix a wrong ordering in the probe introduced in the previous set of
    patches.  A use before allocation bug.
* cros_ec_sensors
  - Testing for an error in a u8 will never work.
* mpu3050
  - Remove duplicate initializer for the module owner.
  - Add missing i2c dependency.
  - Inform the i2c mux core how it is used - step one in implifying device
  tree bindings.
* st-sensors
  - Get rid of large number of uninformative defines in favour of putting the
  constants where they are relevant. It is clear what they are from where
  they are used.
* tsl2583
  - Fix unused function warning when CONFIG_PM disabled and remove the
  ifdefs in favour of __maybe_unused.
  - Refactor taos_chip_on  to only read relevant registers.
  - Make sure calibscale and integration time are being set.
  - Verify chip is in ready to be used before calibration.
  - Remove some repeated checks for chip status (it's protected by a mutex
  so can't change until it's released)
  - Change current state storage from a tristate enum to a boolean seeing as
  only two values are actually used now.
  - Drop a redundant write to the control regiser in taos_probe (it's a noop)
  - Drop the FSF mailing address.
  - Clean up logging to not use hard coded function names (use __func__
  instead).
  - Cleanup up variable and function name prefixes.
  - Alignment of #define fixes.
  - Fix comparison between signed and unsigned integer warnings.
  - Add some newlines in favour of readability.
  - Combine the two sysfs ABI docs that somehow ended up in different places.
  - Fix multiline comment syntax.
  - Move a code block to inside an else statement as it makes more sense there.
  - Change tsl2583_als_calibrate to return 0 rather than a value nothing
  reads.
  - Drop some pointless brackets
  - Don't assume 32bit unsigned int.
  - Change to a per device instance lux table.
  - Add missing tsl2583 to the list of supported devices in the intro comments.
  - Improve commment on clearing of interrupts.
  - Drop some uninformative comments.
  - Drop a memset call that doesn't do anything useful any more.
  - Don't initialize some return variables that are always set.
  - Add Brian Masney as a module author after all these changes.
2016-11-16 17:20:40 +01:00
Greg Kroah-Hartman
ce0347c2b0 Merge 4.9-rc5 into staging-next
We want the staging/iio fixes in here as well to resolve issues and
merge problems.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-14 08:53:56 +01: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
Peter Rosin
b475f80b35 iio: envelope-detector: ADC driver based on a DAC and a comparator
The DAC is used to find the peak level of an alternating voltage input
signal by a binary search using the output of a comparator wired to
an interrupt pin. Like so:
                          _
                         | \
    input +------>-------|+ \
                         |   \
           .-------.     |    }---.
           |       |     |   /    |
           |    dac|-->--|- /     |
           |       |     |_/      |
           |       |              |
           |       |              |
           |    irq|------<-------'
           |       |
           '-------'

Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:17 +00:00
Peter Rosin
7fde1484af iio: dpot-dac: DAC driver based on a digital potentiometer
It is assumed that the dpot is used as a voltage divider between the
current dpot wiper setting and the maximum resistance of the dpot. The
divided voltage is provided by a vref regulator.

                  .------.
   .-----------.  |      |
   | vref      |--'    .---.
   | regulator |--.    |   |
   '-----------'  |    | d |
                  |    | p |
                  |    | o |  wiper
                  |    | t |<---------+
                  |    |   |
                  |    '---'       dac output voltage
                  |      |
                  '------+------------+

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 13:07:15 +00:00
Peter Rosin
2704e30014 iio: mcp4531: provide range of available raw values
Example:

$ cat '/sys/bus/iio/devices/iio:device0/out_resistance_raw_available'
[0 1 256]

Meaning: min 0, step 1 and max 256.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 11:40:26 +00:00
Peter Rosin
00c5f80c2f iio: inkern: add helpers to query available values from channels
Specifically a helper for reading the available maximum raw value of a
channel and a helper for forwarding read_avail requests for raw values
from one iio driver to an iio channel that is consumed.

These rather specific helpers are in turn built with generic helpers
making it easy to build more helpers for available values as needed.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 11:40:26 +00:00
Jonathan Cameron
5123960007 iio:core: add a callback to allow drivers to provide _available attributes
A large number of attributes can only take a limited range of values.
Currently in IIO this is handled by directly registering additional
*_available attributes thus providing this information to userspace.

It is desirable to provide this information via the core for much the same
reason this was done for the actual channel information attributes in the
first place.  If it isn't there, then it can only really be accessed from
userspace.  Other in kernel IIO consumers have no access to what valid
parameters are.

Two forms are currently supported:
* list of values in one particular IIO_VAL_* format.
	e.g. 1.300000 1.500000 1.730000
* range specification with a step size:
	e.g. [1.000000 0.500000 2.500000]
	equivalent to 1.000000 1.5000000 2.000000 2.500000

An addition set of masks are used to allow different sharing rules for the
*_available attributes generated.

This allows for example:

in_accel_x_offset
in_accel_y_offset
in_accel_offset_available.

We could have gone with having a specification for each and every
info_mask element but that would have meant changing the existing userspace
ABI.  This approach does not.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[forward ported, added some docs and fixed buffer overflows /peda]
Acked-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-13 11:40:25 +00:00
Arnd Bergmann
d70674eeaa iio: maxim_thermocouple: detect invalid storage size in read()
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:

drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.

Fixes: 231147ee77 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
(cherry picked from commit 32cb7d27e6)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-13 10:08:32 +01:00
Linus Walleij
91a86a3b89 iio: pressure: st_pressure: inline per-sensor data
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 15:50:10 +00:00
Linus Walleij
57d0355451 iio: magn: st_magn: inline per-sensor data
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 15:45:37 +00:00
Linus Walleij
d8594fa22a iio: gyro: st_gyro: inline per-sensor data
We have #defines for all the individual sensor registers and
value/mask pairs #defined at the top of the file and used at
exactly one spot.

This is usually good if the #defines give a meaning to the
opaque magic numbers.

However in this case, the semantic meaning is inherent in the
name of the C99-addressable fields, and that means duplication
of information, and only makes the code hard to maintain since
you every time have to add a new #define AND update the site
where it is to be used.

Get rid of the #defines and just open code the values into the
appropriate struct elements. Make sure to explicitly address
the .hz and .value fields in the st_sensor_odr_avl struct
so that the meaning of all values is clear.

This patch is purely syntactic should have no semantic effect.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 15:38:09 +00:00
Peter Rosin
08f3ffce6e iio: imu: inv_mpu6050: inform the i2c mux core about how it is used
The i2c mux core can then take appropriate action depending on if it is
used for an actual i2c mux, or for an arbitrator or gate. In this case
it is used as a gate.

This will make devicetree bindings simpler when they are eventually
added.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 14:44:45 +00:00
Colin Ian King
6c02e33fac iio: cros_ec_sensors_core: fix unsigned compared less than zero on status
status is a u8 hence the check if status is less than zero has no effect.
Fix this by replacing status with int ret so the less than zero compare
will correctly detect errors.

Issue found with static analysis with CoverityScan, CID 1375919

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Fixes: 974e6f02e2 ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub")
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 14:38:38 +00:00
Dan Carpenter
0d8391f3d6 iio:adc: ad7766: testing the wrong variable in probe
We should be testing "ret" here.

Fixes: aa16c6bd0e ("iio:adc: Add support for AD7766/AD7767")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12 14:35:21 +00:00
Arnd Bergmann
b548674ea7 iio: gyro: mpu3050: add I2C dependency
The new mpu3050 driver fails to build if I2C is disabled:

drivers/iio/built-in.o: In function `mpu3050_i2c_driver_exit':
mpu3050-i2c.c:(.exit.text+0x17f): undefined reference to `i2c_del_driver'
drivers/iio/built-in.o: In function `mpu3050_i2c_driver_init':
mpu3050-i2c.c:(.init.text+0x215): undefined reference to `i2c_register_driver'

This adds a Kconfig dependency to ensure we only build it when I2C
is available.

Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:29:33 +00:00
Arnd Bergmann
630e7ab470 iio: gyro: mpu3050: remove duplicate initializer
The newly added mpu3050 driver has two initializations for the
module owner, which causes a warning for 'make W=1':

include/linux/export.h:37:21: error: initialized field overwritten [-Werror=override-init]
drivers/iio/gyro/mpu3050-core.c:749:19: note: in expansion of macro 'THIS_MODULE'

This removes one of the two.

Fixes: 3904b28efb ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-08 20:28:25 +00:00
Greg Kroah-Hartman
7970b9e6a5 Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle
This includes two branch merges for elements that may also go via MFD.
 
 New device support
 * cros_ec
   - new driver to support these Chrome OS contiguous sensors which are behind
     the Chrome OS embedded controller.  Requires a few minor MFD and chrome
     platform changes.  One follow up fix deals with some dependency issues in
     Kconfig.
 * mpu-3050
   - new driver and device tree bindings for this venerable device.
 * st_accel
   - support for the lng2dm an
 
 Driver features
 * ad7192
   - Add DVdd regulator handling
 * ad9832
   - Add DVDD regulator handling
 * at91
   - Suspend and resume support
 * si7020
   - Device tree bindings
 * ti-am335x
   - DMA support - uses dma to accelerate short bursts of read back rather
   than full blown DMA buffer support.  Greatly improved performance.
   Includes an MFD addition to give access to the address needed for DMA.
 * tsl2583
   - Device tree bindings
 
 Cleanups and minor fixes
 * ad7192
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
   - Rename reg variable to reflect which regulator it is
 * ad5933
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * ad7746
   - Fix a missing return value (fallout from previous patch set)
 * ad7780
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * ad9832
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
   - Rename reg regulator to reflect which one it is
 * ad9834
   - Fix regulator naming to match datasheet
   - Handle regulator errors correctly (so as to not break deferred probing)
 * hts221
   - Remove a duplicated include
 * maxim thermocouple
   - Handle a wrong storage side in read function.  Prevent any problems that
   might be introduced by additions to this driver in future.
 * tsl2583 - big set from Brian Masney to drive this towards a staging
   graduation.
   - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
   - Improved error handling in various functions
   - Drop redundant power_state custom sysfs attribute.
   - Use IIO_*_ATTR* macros for remaining attributes.
   - Return an error code to userspace on invalid parameters being writen to
     sysfs files.
   - Add locking to various attribute accesses to remove possible races.
   - Add defines for various magic numbers.
   - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
   - Query only relevant registers in probe.
   - Tidy up ordering of code comments.
   - Remove a pointless power off sequence in taos_chip_on.
   - Don't bother shutting down the chip when updating the lux table.
   The table is held entirely in the driver and doesn't effect the chip at all.
   - Drop a redundant i2c call in taos_als_calibrate where the same register
   is read twice in a row.
 -----BEGIN PGP SIGNATURE-----
 
 iQIuBAABCAAYBQJYH22HERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIUg4P
 /1GRFGpTbqyzDOX6KZKAdBRsRMn3XPL0XslvbKpupY4T9WFEJbZi01z4P/x+uRIk
 6TtRlhdWBLdzVQ6sLpVAZVXR2/FxGj+nsc2ONgHJXm02/fDBmjI89Ed9WVS1HR73
 D2yLAFhflvE6mDMExvAnUVBh9ClR2SXoGL0N1k+VQM08Rs+F6IzBAg2albiPkct/
 7UQB9apn4VCCaRY02gllvWrUiJV3w8jsSikwDACZsprQGIxKjLiH4evtRfSOI8bg
 Z7UoJYaYNMiQtn6+rFaNUjFQtzlnWcjB92RUy/MqnpXmkuAvw3+CbXYteYnailO1
 eTsIjKpwssKaQh5HHALrxIwP/a/9a+Wyrd8iheygUQvzSNx3gcxXrtNrUk8eI/9W
 N8pBRBbu+2pzSzVLQb+7SR5wJG1zQ5NEXI1gpZuyed94g30Be0vQpeiZRNCUL+J0
 ta28Xa25cREzHrXGXrhfyxNJuriav/8A5PTtnGJSZZ8RhuHZq24TcC8h6KVOWR+3
 BBiehupFcIErbrGcMKuhq01q8A9+Vj/1z6hQaZzfIpXFjEEUvkBo3OMiNtgpkQYM
 XYdaF2bH25t8wx020z4FrmN48nxg2HDTLtKissP/6bInh4kYyGneKhf6QQVnG2IX
 41XLE/fw4QoAnLuTBXD3boydC08uJmVkXeOH2sfaCYwG
 =ptGw
 -----END PGP SIGNATURE-----

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

Jonathan writes:

Second round of new device support, cleanups and fixes for IIO in the 4.10 cycle

This includes two branch merges for elements that may also go via MFD.

New device support
* cros_ec
  - new driver to support these Chrome OS contiguous sensors which are behind
    the Chrome OS embedded controller.  Requires a few minor MFD and chrome
    platform changes.  One follow up fix deals with some dependency issues in
    Kconfig.
* mpu-3050
  - new driver and device tree bindings for this venerable device.
* st_accel
  - support for the lng2dm an

Driver features
* ad7192
  - Add DVdd regulator handling
* ad9832
  - Add DVDD regulator handling
* at91
  - Suspend and resume support
* si7020
  - Device tree bindings
* ti-am335x
  - DMA support - uses dma to accelerate short bursts of read back rather
  than full blown DMA buffer support.  Greatly improved performance.
  Includes an MFD addition to give access to the address needed for DMA.
* tsl2583
  - Device tree bindings

Cleanups and minor fixes
* ad7192
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg variable to reflect which regulator it is
* ad5933
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad7746
  - Fix a missing return value (fallout from previous patch set)
* ad7780
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* ad9832
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
  - Rename reg regulator to reflect which one it is
* ad9834
  - Fix regulator naming to match datasheet
  - Handle regulator errors correctly (so as to not break deferred probing)
* hts221
  - Remove a duplicated include
* maxim thermocouple
  - Handle a wrong storage side in read function.  Prevent any problems that
  might be introduced by additions to this driver in future.
* tsl2583 - big set from Brian Masney to drive this towards a staging
  graduation.
  - Convert to iio_chan_spec and read_raw / write_raw (in a couple of steps)
  - Improved error handling in various functions
  - Drop redundant power_state custom sysfs attribute.
  - Use IIO_*_ATTR* macros for remaining attributes.
  - Return an error code to userspace on invalid parameters being writen to
    sysfs files.
  - Add locking to various attribute accesses to remove possible races.
  - Add defines for various magic numbers.
  - Use smbus_read_byte_data instead of a write_byte followed by read_byte.
  - Query only relevant registers in probe.
  - Tidy up ordering of code comments.
  - Remove a pointless power off sequence in taos_chip_on.
  - Don't bother shutting down the chip when updating the lux table.
  The table is held entirely in the driver and doesn't effect the chip at all.
  - Drop a redundant i2c call in taos_als_calibrate where the same register
  is read twice in a row.
2016-11-07 09:14:03 +01:00
Song Hongyan
6f77199e9e iio: hid-sensors: Increase the precision of scale to fix wrong reading interpretation.
While testing, it was observed that on some platforms the scale value
from iio sysfs for gyroscope is always 0 (E.g. Yoga 260). This results
in the final angular velocity component values to be zeros.

This is caused by insufficient precision of scale value displayed in sysfs.
If the precision is changed to nano from current micro, then this is
sufficient to display the scale value on this platform.
Since this can be a problem for all other HID sensors, increase scale
precision of all HID sensors to nano from current micro.

Results on Yoga 260:

name		scale before	scale now
--------------------------------------------
gyro_3d		0.000000	0.000000174
als			0.001000	0.001000000
magn_3d		0.000001	0.000001000
accel_3d		0.000009	0.000009806

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 17:50:56 +00:00
Song Hongyan
8af644a7d6 iio: orientation: hid-sensor-rotation: Add PM function (fix non working driver)
This fix makes newer ISH hubs work. Previous ones worked by lucky
coincidence.

Rotation sensor function does not work due to miss PM function.
Add common hid sensor iio pm function for rotation sensor.

Further clarification from Srinivas:

If CONFIG_PM is not defined, then this prevents this sensor to
function. So above commit caused this.

This sensor was supposed to be always on to trigger wake up in prior
external hubs. But with the new ISH hub this is not the case.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Fixes: 2b89635e9a ("iio: hid_sensor_hub: Common PM functions")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 17:47:47 +00:00
Jonathan Cameron
25acb3986f Merge branch 'ib-iio-mfd-ti335x_dma' into togreg
A local branch created as Lee requested these two patches were applied
in a fashion that would later let him merge the same branch into MFD
if needed.
2016-11-05 17:38:00 +00:00
Mugunthan V N
f438b9da75 drivers: iio: ti_am335x_adc: add dma support
This patch adds the required pieces to ti_am335x_adc driver for
DMA support

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 17:32:05 +00:00
Wenyou Yang
bc3ae982e2 iio: adc: at91: add suspend and resume callback
Add suspend/resume callback, support the pinctrl sleep state when
the system suspend as well.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-05 16:33:00 +00:00
Song Hongyan
ab54163190 iio: hid-sensor-attributes: Check sample_frequency/hysteresis write data legitimacy
Neither sample frequency value nor hysteresis value can be set to be a
negative number, check and return "Invalid argument" if they are negative.

If not do this change, sample_frequency will be set into some unknown
value, read hysteresis value after write negative number will return
"Invalid argument".

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>
2016-11-05 16:25:33 +00:00
Jonathan Cameron
7f2d496b5e Merge branch 'ib-iio-mfd-4.9rc1' into togreg
Immutable branch to allow mfd changes to also be available in Lee's MFD tree.
2016-11-01 18:53:11 +00:00
Lorenzo Bianconi
dcdb0a78ca iio: accel: st_accel: add support to lng2dm
add support to STMicroelectronics LNG2DM accelerometer to
st_accel framework

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:50:02 +00:00
Paul Kocialkowski
b0d8019854 iio: si7020: Add devicetree support and trivial bindings
This adds devicetree support for the si7020 iio driver. Since it works
well without requiring any additional property, its compatible string is
added to the trivial i2c devices bindings list.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:49:53 +00:00
Wei Yongjun
d1c6753412 iio: humidity: remove duplicated include from hts221_buffer.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01 18:43:46 +00:00
Jonathan Cameron
b4d2192e6f iio:cros_ec_sensors: Swap from a select to a depends in Kconfig
Would have merged this into the original patch as a fixup but I've already
pushed that out as an immutable branch for others to use so it'll have
to be a separate patch.  The original select had a typo as well.

Trying to do this via a select was opening a can of worms due to
a tree of other elements that would also have needed selecting.
A simple depends seems much mroe straight forward and appropriate in this
case.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2016-11-01 17:59:23 +00:00
Lorenzo Bianconi
d304286abb iio: st_sensors: fix scale configuration for h3lis331dl
fix scale configuration/parsing for h3lis331dl accel driver
when sensitivity is higher than 1(m/s^2)/digit

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Fixes: 1e52fefc9b ("iio: accel: Add support for the h3lis331dl accelerometer")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-30 16:46:46 +00:00