Skip to content

Commit

Permalink
Merge tag 'iio-fixes-for-4.10b' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/jic23/iio into staging-linus

Jonathan writes:

Second set of IIO fixes for the 4.10 cycle.
* afe4403
  - retrieve valid iio_dev in suspend / resume. Previously using the wrong
    dev for a call to dev_to_iio_dev.
* afe4404
  - retrieve valid iio_dev in suspend / resume. Previously using the wrong
    dev for a call to dev_to_iio_dev.
* dht11
  - Something seems to have caused a regression in timing on the raspberry pi
    2B.  However, the bug that it threw up was real. msleep was occasionally
    resulting in very long sleeps, over the limit possible to read from this
    chip. Switch to usleep_range to avoid this.  The timing needed by this
    part is very fiddly.
* max30100
  - wrong parenthesis around fifo count check meant it always read after the
    almost_full state had been reached. I've tagged this with a fixes tag which
    covers the last patch that it will not need precursor patches.  The bug
    predates that but will need backporting.
* palmas_gpadc.
  - retrieve valid iio_dev in suspend / resume. Previously using the wrong
    dev for a call to dev_to_iio_dev.
  • Loading branch information
gregkh committed Jan 23, 2017
2 parents a121103 + 5c113b5 commit 9579c4d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/adc/palmas_gpadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc)

static int palmas_gpadc_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct palmas_gpadc *adc = iio_priv(indio_dev);
int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
int ret;
Expand All @@ -798,7 +798,7 @@ static int palmas_gpadc_suspend(struct device *dev)

static int palmas_gpadc_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct palmas_gpadc *adc = iio_priv(indio_dev);
int wakeup = adc->wakeup1_enable || adc->wakeup2_enable;
int ret;
Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/health/afe4403.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(of, afe4403_of_match);

static int __maybe_unused afe4403_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
struct afe4403_data *afe = iio_priv(indio_dev);
int ret;

Expand All @@ -443,7 +443,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev)

static int __maybe_unused afe4403_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev));
struct afe4403_data *afe = iio_priv(indio_dev);
int ret;

Expand Down
4 changes: 2 additions & 2 deletions drivers/iio/health/afe4404.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ MODULE_DEVICE_TABLE(of, afe4404_of_match);

static int __maybe_unused afe4404_suspend(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct afe4404_data *afe = iio_priv(indio_dev);
int ret;

Expand All @@ -449,7 +449,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev)

static int __maybe_unused afe4404_resume(struct device *dev)
{
struct iio_dev *indio_dev = dev_to_iio_dev(dev);
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
struct afe4404_data *afe = iio_priv(indio_dev);
int ret;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/health/max30100.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static irqreturn_t max30100_interrupt_handler(int irq, void *private)

mutex_lock(&data->lock);

while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
while (cnt || (cnt = max30100_fifo_count(data)) > 0) {
ret = max30100_read_measurement(data);
if (ret)
break;
Expand Down
6 changes: 4 additions & 2 deletions drivers/iio/humidity/dht11.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
* a) select an implementation using busy loop polling on those systems
* b) use the checksum to do some probabilistic decoding
*/
#define DHT11_START_TRANSMISSION 18 /* ms */
#define DHT11_START_TRANSMISSION_MIN 18000 /* us */
#define DHT11_START_TRANSMISSION_MAX 20000 /* us */
#define DHT11_MIN_TIMERES 34000 /* ns */
#define DHT11_THRESHOLD 49000 /* ns */
#define DHT11_AMBIG_LOW 23000 /* ns */
Expand Down Expand Up @@ -228,7 +229,8 @@ static int dht11_read_raw(struct iio_dev *iio_dev,
ret = gpio_direction_output(dht11->gpio, 0);
if (ret)
goto err;
msleep(DHT11_START_TRANSMISSION);
usleep_range(DHT11_START_TRANSMISSION_MIN,
DHT11_START_TRANSMISSION_MAX);
ret = gpio_direction_input(dht11->gpio);
if (ret)
goto err;
Expand Down

0 comments on commit 9579c4d

Please sign in to comment.