Commit graph

67 commits

Author SHA1 Message Date
Lorenzo Bianconi
f3f0ae16f0 iio: humidity: hts221: move drdy enable logic in hts221_trig_set_state()
Move data-ready configuration in hts221_buffer.c since it is only related
to trigger logic

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-25 20:03:04 +01:00
Lorenzo Bianconi
9251f7aaa5 iio: humidity: hts221: support open drain mode
Add open drain support in order to share requested IRQ line between
hts221 device and other peripherals

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-25 20:00:47 +01:00
Lorenzo Bianconi
e7b4b45e1e iio: humidity: hts221: support active-low interrupts
Add support for active low interrupts (IRQF_TRIGGER_LOW and
IRQF_TRIGGER_FALLING). Configure the device as active high or low
according to the requested irq line.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:21:46 +01:00
Lorenzo Bianconi
e3e25446a3 iio: humidity: hts221: squash hts221_power_on/off in hts221_set_enable
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:20:48 +01:00
Lorenzo Bianconi
ffebe74b7c iio: humidity: hts221: avoid useless ODR reconfiguration
Configure sensor ODR just in hts221_write_raw() in order to avoid
to set device sample rate multiple times.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:18:37 +01:00
Lorenzo Bianconi
f6f58d9d93 iio: humidity: hts221: do not overwrite reserved data during power-down
GENMASK(6, 3) in CTRL_REG1 and GENMASK(6, 2) in CTRL_REG2 are marked
reserved. Do not changed the original value (not declared in the
datasheet) during power-down/suspend routines.

Fixes: e4a70e3e7d (iio: humidity: add support to hts221 rh/temp device)
Fixes: b7079eeac5 (iio: humidity: hts221: add power management support)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:18:11 +01:00
Lorenzo Bianconi
2ede27402a iio: humidity: hts221: move BDU configuration in probe routine
Enable Block Data Update in hts221_probe() in order to avoid to reconfigure
it every time the sensor is enabled

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:18:08 +01:00
Lorenzo Bianconi
bd49302a73 iio: humidity: hts221: refactor write_with_mask code
Move bit-shift in hts221_write_with_mask() instead of coding
the shift depth in the configured value. That change will be necessary
to fix an issue in device power-down procedure.
Simplify hts221_avg_list table management

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-22 21:18:04 +01:00
Manivannan Sadhasivam
c43aaa2772 iio: humidity: htu21: Add OF match table
Add of_match_table for Measurement-Specialties htu21 temperature & humidity sensor and humidity part of MS8607 sensor

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01 10:16:59 +01:00
Michael Stecklein
a2d80de873 iio: humidity: hdc100x: add match table and device id's
Add of_match_table and point it to a list of compatible device tree
device id's.

Signed-off-by: Michael Stecklein <m-stecklein@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01 10:16:38 +01:00
Michael Stecklein
8f4c9575a8 iio: humidity: hdc100x: document compatible HDC10xx devices
Include datasheet links, add i2c_device_id entries, and update
kconfig help for compatible HDC10xx devices: HDC1000, HDC1008,
HDC1010, HDC1050, and HDC1080.

Signed-off-by: Michael Stecklein <m-stecklein@ti.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-07-01 10:16:38 +01:00
Lorenzo Bianconi
b7079eeac5 iio: humidity: hts221: add power management support
Add system sleep power management support to hts221 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-14 16:52:33 +01:00
simran singhal
7ae6df68d6 iio: humidity: hts221: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|
- (T*)
  e
)

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-02 09:50:32 +01:00
simran singhal
757cff86a8 iio: humidity: hdc100x: constify attribute_group structures
Check for attribute_group structures that are only stored in the
attrs filed of iio_info structure. As the attrs field of iio_info
structures is constant, so these attribute_group structures can also be
declared constant.
Done using coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct attribute_group i@p = {...};

@ok1@
identifier r1.i;
position p;
struct iio_info x;
@@
x.attrs=&i@p;

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct attribute_group i={...};

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct attribute_group i;

File size before:
   text	   data	    bss	    dec	    hex	filename
   3459	    488	      0	   3947	    f6b	drivers/iio/humidity/hdc100x.o

File size after:
   text	   data	    bss	    dec	    hex	filename
   3507	    424	      0	   3931	    f5b	drivers/iio/humidity/hdc100x.o

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-04-01 11:37:06 +01:00
Song Hongyan
d7ed89d5aa iio: hid: Add humidity sensor support
Environmental humidity sensor is a hid defined sensor,
it shows raw humidity measurement of air.

More information can be found in:
http://www.usb.org/developers/hidpage/HUTRR39b.pdf

According to IIO ABI definition, humidityrelative data output unit is
milli percent. Add the unit convert from percent to milli percent.

Signed-off-by: Song Hongyan <hongyan.song@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25 16:32:24 +00:00
Greg Kroah-Hartman
a769f30c7b Merge 4.10-rc7 into staging-next
This resolves the merge errors that were reported in linux-next and it
picks up the staging and IIO fixes that we need/want in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-06 09:36:10 +01:00
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
Shrirang Bagul
25fc503e2d iio: humidity: Support acpi probe for hts211
Support driver probe by reading unique HID on systems based on ACPI instead
of DT compatible strings.

Signed-off-by: Shrirang Bagul <shrirang.bagul@canonical.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-03 08:56:28 +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
Alison Schofield
16bf793f86 iio: humidity: hdc100x: add triggered buffer support for HDC100X
Triggered buffer support uses the HDC100X's dual acquisition mode
to read both humidity and temperature in one shot.

This patch depends on
	447136effbf4 ("iio: humidity: hdc100x: fix sensor data reads of
		       temp and humidity")

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:25 +01:00
Lorenzo Bianconi
e4a70e3e7d iio: humidity: add support to hts221 rh/temp combo device
Add support to STM HTS221 humidity + temperature sensor

http://www.st.com/resource/en/datasheet/hts221.pdf

- continuous mode support
- i2c support
- spi support
- trigger mode support

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-23 19:34:09 +01:00
Greg Kroah-Hartman
9c2edd8b5b Merge 4.8-rc5 into staging-next
We want the staging fixes in here as well to handle merge issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-05 08:13:24 +02:00
Alison Schofield
ca1902ff98 iio: humidity: hdc100x: add HDC1000 and HDC1008 to Kconfig
hdc100x supports Texas Instruments HDC1000 and HDC1008 relative
humidity and temperature sensors. Add these product names to
Kconfig.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 17:10:56 +01:00
Alison Schofield
0d9dcf8523 iio: humidity: hdc100x: fix sensor data reads of temp and humidity
Replace the i2c_smbus_read_byte commmands used to retrieve the sensor
data with an i2c_master_recv command.

The smbus read byte method fails because the device does not expect a
stop condition after sending the first byte. When we issue the second
read, we are getting the first byte again. Net effect is that of the 14
bits used for the measurement, the 8 most significant bits are correct,
the lower 6 are not.

None of the smbus read protocols follow the pattern this device requires
(S Addr Rd [A] Data [A] Data NA P), hence the switch to an i2c receive
transaction.

Applicable from original introduction of this driver, but will require
backporting due to churn in the code.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 17:01:53 +01:00
Alison Schofield
193e2d4fd9 iio: add Kconfig selects needed for triggered buffer compiles
Select IIO_BUFFER and IIO_TRIGGERED_BUFFER to compile.
Remove IIO_TRIGGER if present since IIO_BUFFER selects it.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 15:42:04 +01:00
Alison Schofield
3c68858df7 iio: humidity: am2315: set up buffer timestamps for non-zero values
Use the iio_pollfunc_store_time parameter during triggered buffer
set-up to get valid timestamps.

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-By: Tiberiu Breana <tiberiu.a.breana@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-08-15 15:39:23 +01:00
Greg Kroah-Hartman
af52739b92 Merge 4.7-rc4 into staging-next
We want the fixes in here, and we can resolve a merge issue in
drivers/iio/industrialio-trigger.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-20 08:25:44 -07:00
Matt Ranostay
94bef000f1 iio: hudmidity: hdc100x: fix incorrect shifting and scaling
Shifting sensor data to the right 2 bits was incorrect and caused the
scaling values + offsets to be invalid.

Reported-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Tested-by: Alison Schofield <amsfield22@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-03 13:25:33 +01:00
Matt Ranostay
09bc0ddaab iio: humidity: hdc100x: fix IIO_TEMP channel reporting
IIO_TEMP channel was being incorrectly reported back as Celsius when it
should have been milliCelsius. This is via an incorrect scale value being
returned to userspace.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-29 19:45:54 +01:00
Javier Martinez Canillas
cdd469ad9e iio: Export I2C module alias information
The I2C drivers have an i2c_device_id array but that information isn't
exported to the modules using the MODULE_DEVICE_TABLE() macro. So the
modules autoloading won't work if the I2C device is registered using
OF or legacy board files due missing alias information in the modules.

The issue was found using Kieran Bingham's coccinelle semantic patch:
https://lkml.org/lkml/2016/5/10/520

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-21 20:08:14 +01:00
Dan Carpenter
1cb0d06a00 iio: humidity: am2315: Remove a stray unlock
We haven't taken the lock yet so we don't need to unlock here.

Fixes: 0d96d5ead3 ('iio: humidity: Add triggered buffer support for AM2315')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-21 17:47:14 +01:00
Alison Schofield
0e35cf5ce0 iio: humidity: hdc100x: correct humidity integration time mask
Apply the correct mask to enable all available humidity integration
times.  Currently, the driver defaults to 6500 and all is okay with that.
However, if 3850 is selected we get a stuck bit and can't change back
to 6500 or select 2500.  (Verified with HDC1008)

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Matt Ranostay <mranostay@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-05-21 17:23:32 +01:00
Tiberiu Breana
0d96d5ead3 iio: humidity: Add triggered buffer support for AM2315
Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-24 10:00:20 +01:00
Tiberiu Breana
366a3270c1 iio: humidity: Add support for AM2315
Add basic support for the Aosong AM2315 relative humidity
and ambient temperature sensor.
Includes support for raw readings and ACPI detection.

Datasheet:
http://www.aosong.com/asp_bin/Products/en/AM2315.pdf

Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-24 09:56:07 +01:00
Harald Geyer
ab4b6496a2 iio: dht11: Improve logging
* Unify log messages
* Add more DEBUG messages

Apparently this driver is working unreliably on some platforms that I can't
test. Therefore I want an easy way for bug reporters to provide useful
information without making the driver too chatty by default.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-04-10 17:40:06 +01:00
Matt Ranostay
f8d9d3b434 iio: convert to common i2c_check_functionality() return value
Previously most drivers that used a i2c_check_functionality() check
condition required various error codes on failure. This patchset
converts to a standard of -EOPNOTSUPP

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27 17:17:43 +00:00
Greg Kroah-Hartman
5ba907a949 Merge 4.5-rc3 into staging-next
We want the upstream staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07 17:34:04 -08:00
Abhilash Jindal
17a2f46c3d iio: dht11: Use boottime
Wall time obtained from ktime_get_real_ns is susceptible to sudden jumps due to
user setting the time or due to NTP.  Boot time is constantly increasing time
better suited for comparing two timestamps.

Signed-off-by: Abhilash Jindal <klock.android@gmail.com>
Reviewed-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-01 20:16:13 +00:00
Cristina Moraru
920dad0ce3 iio: si7020: add support for Hoperf th06
This patch adds support for Hoperf th06 humidity and
temperature sensor as it uses same register definitions
as si7020

th06 Datasheet: http://www.hoperf.com/upload/sensor/TH06.pdf

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:27:15 +00:00
Cristina Moraru
3f4202652e iio: si7005: add support for Hoperf th02
This patch adds support for Hoperf th02 humidity and
temperature sensor as it uses same register definitions
as si7005

th02 Datasheet: http://www.anglia-live.com/netalogue/pdfs/hrf/datasheets/TH02_V1.1.pdf

Signed-off-by: Cristina Moraru <cristina.moraru09@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:27:15 +00:00
Harald Geyer
155a57593d iio: dht11: Simplify decoding algorithm
The new algorithm uses a 'one size fits em all' threshold, which should
be easier to understand and debug. I believe there are no regressions
compared to the old adaptive threshold algorithm. I don't remember why
I chose the old algorithm when I initially wrote the driver.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:27:13 +00:00
Harald Geyer
22acc120a1 iio: dht11: Improve reliability - be more tolerant about missing start bits
Instead of guessing where the data starts, we now just try to decode from
every possible start position. This causes no additional overhead if we
properly received the full preamble and only costs a few extra CPU cycles
in the case where the preamble is corrupted. This is much more efficient
than to return an error to userspace and start over again.

Signed-off-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 16:27:13 +00:00
Greg Kroah-Hartman
819db468b2 First set of IIO fixes for the 4.4 cycle.
This set does not include those for issues introduced during the merge
 window.  Fixes of those will follow in a future series.
 
 * ad5064
   - Make sure the local i2c_write returns 0 on success rather than the
     number of bytes transfered.  Otherwise we report an error on all writes.
   - Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
     these parts.
 * ad7793
   - The product ID on the datasheet is wrong.  Fix it in the driver.
 * IIO_DUMMY_EVGEN
   - select IRQ_WORK as a dependency.
 * lpc32xx
   - make sure clock is prepared before enabling.
 * si7020
   - data byte order was reversed. Fix it.
 * vf610
   - Internal temperature calculation was wrong if a different
     reference voltage was used.  Now use a linear interpolation
     function to make it work over the full range.
   - Fix a division by zero in the case of a device tree property
     not being present (same issue two fixes).
 * xilinx XADC
   - VREFN scale was wrong - fix it.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJWSH0iAAoJEFSFNJnE9BaILcYP/Rb70yJE23oTx6iyMDLip/Im
 7yG+TMh/mFJCrwmpvloRX4IxQ20WApQPEQRaO6ivcoykQ/8eGDK3hrHWiHwYNs9z
 P+q1qxz0F0pnvWHPZ2UZ+p8ZNzuy9ovTSeeuAHQWMVSsPCgiQR3kq0hBVrvV4mVn
 4AQejD0M/x69TWdisZtGJqKBZs44mXHbgqC6Xw/6u0MLpA8ZLHO2XAr9vaSA042T
 PsYXbEMmb/ElRKwadbX4JCqrMsA3FhPx+qD7qPu14bsC8WR4tlNLIBzEmBQJotWf
 8wjK7AF7Af/HMO5KjO6uJe+EdypMq1UjlmqeRWUZIGUlLtmjmkhnRzO4Qahsbx2K
 6TEO1uNhOjg7JQGfeuL9fKMHI6QKkeFIJ/cl2ekRWRwbxS2kOmXA9HTCsxynrdAR
 qC49Eqkbfr/F1vdgDx61JAWgWuZNdxFg3tiD3wP2BMjOipKBuKRt9CvHuOORW7Tp
 aUPruyJduIpcVQBL+wbSElAc4XsjgL4+/KROcfG3x3zWKUjOux73G8WsgaSSQ4Fe
 rP2stYFmZUigIpSW/vTwbdcN8tIT9S/XZjxF/mlP7azIQHyafWTVl6CUlphtewtY
 YZVT2K+t07zQV2NgOi9J+H5yCPG39d1Fb1R4OsWF1Brq2QsQJwqR9Y1ERXiPEJzZ
 DvylTHu0lxP+xgE/Xjuz
 =362F
 -----END PGP SIGNATURE-----

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

Jonathan writes:

First set of IIO fixes for the 4.4 cycle.

This set does not include those for issues introduced during the merge
window.  Fixes of those will follow in a future series.

* ad5064
  - Make sure the local i2c_write returns 0 on success rather than the
    number of bytes transfered.  Otherwise we report an error on all writes.
  - Fix a shift for ad5629 and ad5669 which gives incorrect DAC output on
    these parts.
* ad7793
  - The product ID on the datasheet is wrong.  Fix it in the driver.
* IIO_DUMMY_EVGEN
  - select IRQ_WORK as a dependency.
* lpc32xx
  - make sure clock is prepared before enabling.
* si7020
  - data byte order was reversed. Fix it.
* vf610
  - Internal temperature calculation was wrong if a different
    reference voltage was used.  Now use a linear interpolation
    function to make it work over the full range.
  - Fix a division by zero in the case of a device tree property
    not being present (same issue two fixes).
* xilinx XADC
  - VREFN scale was wrong - fix it.
2015-11-18 13:15:50 -08:00
Chris Lesiak
0d2f6fd3ff iio: si7020: Swap data byte order
The Silicon Labs Si7013, Si7020, and Si7021 family of I2C humidity and
temperature sensors deliver 16 bit data high byte first.

See the datasheet available at:
https://www.silabs.com/Support%20Documents%2fTechnicalDocs%2fSi7020-A20.pdf

But as documented in Documentation/i2c/smbus-protocol,
i2c_smbus_read_word_data() expects the low byte first.

Change the driver to use i2c_smbus_read_word_swapped to get correct byte
order.

Signed-off-by: Chris Lesiak <chris.lesiak@licor.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-15 12:36:19 +00:00
Matt Ranostay
d3a21ce0c6 iio: hdc100x: correct IIO_CHAN_INFO_OFFSET value
Previous offset wasn't applied in the correct order and invalid.
This patchset fixes this issue, and also has the correct scale value
applied to the offset.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 13:53:20 +01:00
Ludovic Tancerel
1b75ce6587 Add ms8607 meas-spec driver support
Support for MS8607 temperature, pressure & humidity sensor.
This part is using functions from MS5637 for temperature and pressure
and HTU21 for humidity

Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 10:21:21 +01:00
Ludovic Tancerel
2b5c53d2c9 Add htu21 meas-spec driver support
Support for HTU21 temperature & humidity sensor

Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-11 10:21:20 +01:00
Matt Ranostay
4839367d99 iio: humidity: add HDC100x support
Add support for the HDC100x temperature and humidity sensors
including the resistive heater element.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-23 20:23:19 +01:00
Nicola Corna
ecf7e207a5 iio: humidity: si7020: replaced bitmask on humidity values with range check
The maximum possible value for the relative humidity is 55575 (100%RH).
This value, if shifted right by 2 bits, uses 14 bits and masking it with
a 12 bit mask removes 2 meaningful bits.
The masking has been replaced with a range check that sets the minimum
value at 786 (0%RH) and the maximum at 13893 (99.998%RH).

Signed-off-by: Nicola Corna <nicola@corna.info>
Reviewed-by: Hartmut Knaack <knaack.h@gmx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-24 19:41:16 +01:00