summaryrefslogtreecommitdiff
path: root/drivers/iio/humidity/dht11.c
AgeCommit message (Collapse)AuthorFilesLines
2016-04-10iio: dht11: Improve loggingHarald Geyer1-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>
2016-02-08Merge 4.5-rc3 into staging-nextGreg Kroah-Hartman1-4/+4
We want the upstream staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-01iio: dht11: Use boottimeAbhilash Jindal1-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>
2016-01-30iio: dht11: Simplify decoding algorithmHarald Geyer1-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>
2016-01-30iio: dht11: Improve reliability - be more tolerant about missing start bitsHarald Geyer1-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>
2015-07-20iio: dht11: Use new function ktime_get_resolution_ns()Harald Geyer1-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>
2015-07-20iio: dht11: avoid multiple assignments to make checkpatch.pl --strict happyHarald Geyer1-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>
2015-07-20iio: dht11: add comment to make checkpatch.pl --strict happyHarald Geyer1-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>
2015-07-20iio: dht11: whitespace changes to make checkpatch.pl --strict happyHarald Geyer1-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>
2015-01-10iio: dht11: IRQ fixesRichard Weinberger1-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>
2015-01-10iio: dht11: Add lockingRichard Weinberger1-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>
2015-01-10iio: dht11: Fix out-of-bounds readRichard Weinberger1-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>
2014-08-27iio: remove .owner field for driver using module_platform_driverSanjeev Sharma1-1/+0
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>
2013-12-04iio: Add new driver dht11Harald Geyer1-0/+294
This driver handles DHT11 and DHT22 sensors. Signed-off-by: Harald Geyer <harald@ccbib.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>