summaryrefslogtreecommitdiffstats
path: root/drivers/iio/humidity
Commit message (Collapse)AuthorAgeFilesLines
* Merge 4.8-rc5 into staging-nextGreg Kroah-Hartman2016-09-053-21/+10Star
|\ | | | | | | | | | | We want the staging fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: humidity: hdc100x: fix sensor data reads of temp and humidityAlison Schofield2016-08-151-20/+7Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * iio: add Kconfig selects needed for triggered buffer compilesAlison Schofield2016-08-151-0/+2
| | | | | | | | | | | | | | | | | | 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>
| * iio: humidity: am2315: set up buffer timestamps for non-zero valuesAlison Schofield2016-08-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | iio: humidity: hdc100x: add HDC1000 and HDC1008 to KconfigAlison Schofield2016-08-151-4/+4
|/ | | | | | | | | | 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>
* Merge 4.7-rc4 into staging-nextGreg Kroah-Hartman2016-06-202-13/+11Star
|\ | | | | | | | | | | | | 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>
| * iio: hudmidity: hdc100x: fix incorrect shifting and scalingMatt Ranostay2016-06-031-8/+8
| | | | | | | | | | | | | | | | | | | | | | 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>
| * iio: humidity: hdc100x: fix IIO_TEMP channel reportingMatt Ranostay2016-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
| * iio: humidity: am2315: Remove a stray unlockDan Carpenter2016-05-211-3/+1Star
| | | | | | | | | | | | | | | | | | We haven't taken the lock yet so we don't need to unlock here. Fixes: 0d96d5ead3f7 ('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>
| * iio: humidity: hdc100x: correct humidity integration time maskAlison Schofield2016-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | iio: Export I2C module alias informationJavier Martinez Canillas2016-05-212-0/+2
|/ | | | | | | | | | | | | 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>
* iio: humidity: Add triggered buffer support for AM2315Tiberiu Breana2016-04-241-3/+78
| | | | | Signed-off-by: Tiberiu Breana <tiberiu.a.breana@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: humidity: Add support for AM2315Tiberiu Breana2016-04-243-0/+239
| | | | | | | | | | | | 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>
* iio: dht11: Improve loggingHarald Geyer2016-04-101-6/+34
| | | | | | | | | | | | * 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>
* iio: convert to common i2c_check_functionality() return valueMatt Ranostay2016-02-274-4/+4
| | | | | | | | | 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>
* Merge 4.5-rc3 into staging-nextGreg Kroah-Hartman2016-02-081-4/+4
|\ | | | | | | | | | | We want the upstream staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: dht11: Use boottimeAbhilash Jindal2016-02-011-4/+4
| | | | | | | | | | | | | | | | | | | | 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>
* | iio: si7020: add support for Hoperf th06Cristina Moraru2016-01-302-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* | iio: si7005: add support for Hoperf th02Cristina Moraru2016-01-302-1/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* | iio: dht11: Simplify decoding algorithmHarald Geyer2016-01-301-22/+42
| | | | | | | | | | | | | | | | | | | | 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>
* | iio: dht11: Improve reliability - be more tolerant about missing start bitsHarald Geyer2016-01-301-6/+9
|/ | | | | | | | | | | 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>
* Merge tag 'iio-fixes-for-4.4a' of ↵Greg Kroah-Hartman2015-11-181-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * iio: si7020: Swap data byte orderChris Lesiak2015-11-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | iio: hdc100x: correct IIO_CHAN_INFO_OFFSET valueMatt Ranostay2015-10-111-2/+3
| | | | | | | | | | | | | | | | | | 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>
* | Add ms8607 meas-spec driver supportLudovic Tancerel2015-10-112-3/+32
| | | | | | | | | | | | | | | | | | 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>
* | Add htu21 meas-spec driver supportLudovic Tancerel2015-10-113-0/+238
| | | | | | | | | | | | | | Support for HTU21 temperature & humidity sensor Signed-off-by: Ludovic Tancerel <ludovic.tancerel@maplehightech.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: humidity: add HDC100x supportMatt Ranostay2015-09-233-0/+330
| | | | | | | | | | | | | | | | 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>
* | iio: humidity: si7020: replaced bitmask on humidity values with range checkNicola Corna2015-08-241-1/+5
|/ | | | | | | | | | | | 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>
* iio: dht11: Use new function ktime_get_resolution_ns()Harald Geyer2015-07-201-20/+22
| | | | | | | | | | | | | | | | | | | This cleans up the most ugly workaround in this driver. There are no functional changes yet in the decoding algorithm, but we improve the following things: * Get rid of spurious warning messages on systems with fast HRTIMER. * If the clock is not fast enough for decoding to work, we give up immediately. * In that case we return EAGAIN instead of EIO, so it's easier to discriminate causes of failure. Returning EAGAIN is somewhat controversial: It's technically correct as a faster clock might become available. OTOH once all clocks are enabled this is a permanent error. There is no ECLOCKTOOSLOW error code. Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: dht11: avoid multiple assignments to make checkpatch.pl --strict happyHarald Geyer2015-07-201-1/+2
| | | | | | | We just do the assignments in two steps. Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: dht11: add comment to make checkpatch.pl --strict happyHarald Geyer2015-07-201-0/+1
| | | | | | | Explain why the driver needs a mutex. Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: dht11: whitespace changes to make checkpatch.pl --strict happyHarald Geyer2015-07-201-12/+13
| | | | | | | | | | | * add spaces around binary operators in cases where it reduces readability * align multiline statements around opening parenthesis Reported-by: Hartmut Knaack <knaack.h@gmx.de> in Message-ID: <55919E72.3010807@gmx.de> Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: Drop owner assignment from i2c_driverKrzysztof Kozlowski2015-07-111-1/+0Star
| | | | | | | | i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: Allow compile test of GPIO consumers if !GPIOLIBGeert Uytterhoeven2015-05-101-1/+1
| | | | | | | | | | | | | | The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer functionality only, can still be compiled if GPIOLIB is not enabled. Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where appropriate. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* IIO: si7020: Allocate correct amount of memory in devm_iio_device_allocAndrey Smirnov2015-02-141-1/+1
| | | | | | | | | | | | | Since only a pointer to struct i2c_client is stored in a private area of IIO device created by the driver there's no need to allocate sizeof(struct i2c_client) worth of storage. Pushed to stable as this is linked to the revert patch previously. Without this followup the original patch looks sensible. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Revert "iio:humidity:si7020: fix pointer to i2c client"Jonathan Cameron2015-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e0922e5e3ccb78aa0152e93dfbd1755ac39c8582. Requested by Andrey Smirnov. It incorrectly assumes that the level of indirection is not needed which is not true(probably because the driver incorrectly allocates sizeof(*client) instead of sizeof(*data) via devm_iio_device_alloc). If you look at the code of the probe function(see below) it is easy to see that what is being stored in the private memory of the IIO device instance is not a copy of a 'struct i2c_client' but a pointer to an instance passed as an argument to the probe function. struct i2c_client **data; int ret; < Some code skipped > indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*client)); if (!indio_dev) return -ENOMEM; data = iio_priv(indio_dev); *data = client; Without reverting this change any read of a raw value of this sensor leads to a kernel oops due to a NULL pointer de-reference on my hardware setup. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Stable@vger.kernel.org
* iio: dht11: IRQ fixesRichard Weinberger2015-01-101-27/+35
| | | | | | | | | | | Since setting irq-enabled GPIOs into output state is not supported by all GPIO controllers, we need to disable the irq while requesting sensor data. As side effect we lose a tiny bit of functionality: Some wiring problems can't be concluded from log messages anymore. Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: dht11: Add lockingRichard Weinberger2015-01-101-0/+5
| | | | | | | | | Make sure that the read function is not interrupted... Signed-off-by: Richard Weinberger <richard@nod.at> Acked-by: Harald Geyer <harald@ccbib.org> Reviewed-by: Sanjeev Sharma <sanjeev_sharma@mentor.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: dht11: Fix out-of-bounds readRichard Weinberger2015-01-101-1/+1
| | | | | | | | | | As we access i-1 we must not start with i=0. Signed-off-by: Richard Weinberger <richard@nod.at> Acked-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Harald Geyer <harald@ccbib.org> Reviewed-by: Sanjeev Sharma <sanjeev_sharma@mentor.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:humidity:si7020: fix pointer to i2c clientHartmut Knaack2014-10-251-2/+2
| | | | | | | | In si7020_read_raw() the pointer to the i2c client was obtained as second level pointer, although a simple pointer is appropriate. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:humidity:si7020: cleanup read_raw and probeHartmut Knaack2014-10-251-5/+3Star
| | | | | | | | | | | When reading temperature or humidity values, a shift of two bits to the right needs to be applied, and only for the humidity channel a mask of the lower 12 bits needs to be applied. This reduces code repetition. During probe, i2c_set_clientdata() was used, although its counterpart was not, so drop it. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* IIO: add si7020 driverDavid Barksdale2014-10-043-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support to the Industrial IO subsystem for the Silicon Labs Si7013/20/21 Relative Humidity and Temperature Sensors. Website: http://www.silabs.com/products/sensors/humidity-sensors/Pages/si7013-20-21.aspx These are i2c devices which measure relative humidity and temperature and all use the same protocol. The Si7013 has an additional input with programmable linearization which is not supported because that's complicated and I didn't need it. Signed-off-by: David Barksdale <dbarksdale@uplogix.com> -- Changes since v1: * Renamed to si7020 and replaced Si701x/2x with Si7013/20/21. * Removed unneeded mutex. * Pre-computed floating-point constant expressions. * Removed address_list and I2C_CLASS_HWMON. Changes since v2: * Return correct raw sensor values. * Rename dev variable to indio_dev. * Issue a software reset command during probe. * Un-broke string literal. Changes since v3: * enum changed to #define Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: remove .owner field for driver using module_platform_driverSanjeev Sharma2014-08-261-1/+0Star
| | | | | | | | | This patch removes the .owner field for drivers which use the platform_driver_register api because this is overriden in _platform_driver_register. Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: Add si7005 relative humidity and temperature sensor driverPeter Meerwald2014-01-113-0/+200
| | | | | | | | | | | | | | | | | | | | | sensor provides 12-bit relative humidity and 14-bit temperature via I2C interface; temperature and linearity compensation is not implemented (yet) driver also supports the Si7015, but not the 2nd generation sensors Si7013/Si7020/Si7021 datasheet is here http://www.silabs.com/Support%20Documents/TechnicalDocs/Si7005.pdf v2: (thanks to Lars-Peter Clausen) * fix coding style * use devm_iio_device_register() * change copyright year to 2014 Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: Add new driver dht11Harald Geyer2013-12-033-0/+314
This driver handles DHT11 and DHT22 sensors. Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>