Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad7768-1: disable IRQ autoenable

The device continuously converts data while powered up, generating
interrupts in the background. Configure the IRQ to be enabled and
disabled manually as needed to avoid unnecessary CPU load.

Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Jonathan Santos and committed by
Jonathan Cameron
68fe7c28 81fdc312

+17 -1
+17 -1
drivers/iio/adc/ad7768-1.c
··· 464 464 int readval, ret; 465 465 466 466 reinit_completion(&st->completion); 467 + enable_irq(st->spi->irq); 467 468 468 469 ret = wait_for_completion_timeout(&st->completion, 469 470 msecs_to_jiffies(1000)); 471 + disable_irq(st->spi->irq); 470 472 if (!ret) 471 473 return -ETIMEDOUT; 472 474 ··· 1341 1339 .predisable = &ad7768_buffer_predisable, 1342 1340 }; 1343 1341 1342 + static int ad7768_set_trigger_state(struct iio_trigger *trig, bool enable) 1343 + { 1344 + struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); 1345 + struct ad7768_state *st = iio_priv(indio_dev); 1346 + 1347 + if (enable) 1348 + enable_irq(st->spi->irq); 1349 + else 1350 + disable_irq(st->spi->irq); 1351 + 1352 + return 0; 1353 + } 1354 + 1344 1355 static const struct iio_trigger_ops ad7768_trigger_ops = { 1345 1356 .validate_device = iio_trigger_validate_own_device, 1357 + .set_trigger_state = ad7768_set_trigger_state, 1346 1358 }; 1347 1359 1348 1360 static int ad7768_set_channel_label(struct iio_dev *indio_dev, ··· 1720 1704 return ret; 1721 1705 1722 1706 ret = devm_request_irq(&spi->dev, spi->irq, &ad7768_interrupt, 1723 - IRQF_TRIGGER_RISING | IRQF_NO_THREAD, 1707 + IRQF_TRIGGER_RISING | IRQF_NO_THREAD | IRQF_NO_AUTOEN, 1724 1708 indio_dev->name, indio_dev); 1725 1709 if (ret) 1726 1710 return ret;