mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
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>
This commit is contained in:
parent
81fdc3127d
commit
68fe7c28fa
|
|
@ -464,9 +464,11 @@ static int ad7768_scan_direct(struct iio_dev *indio_dev)
|
|||
int readval, ret;
|
||||
|
||||
reinit_completion(&st->completion);
|
||||
enable_irq(st->spi->irq);
|
||||
|
||||
ret = wait_for_completion_timeout(&st->completion,
|
||||
msecs_to_jiffies(1000));
|
||||
disable_irq(st->spi->irq);
|
||||
if (!ret)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
|
|
@ -1339,8 +1341,22 @@ static const struct iio_buffer_setup_ops ad7768_buffer_ops = {
|
|||
.predisable = &ad7768_buffer_predisable,
|
||||
};
|
||||
|
||||
static int ad7768_set_trigger_state(struct iio_trigger *trig, bool enable)
|
||||
{
|
||||
struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
|
||||
struct ad7768_state *st = iio_priv(indio_dev);
|
||||
|
||||
if (enable)
|
||||
enable_irq(st->spi->irq);
|
||||
else
|
||||
disable_irq(st->spi->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct iio_trigger_ops ad7768_trigger_ops = {
|
||||
.validate_device = iio_trigger_validate_own_device,
|
||||
.set_trigger_state = ad7768_set_trigger_state,
|
||||
};
|
||||
|
||||
static int ad7768_set_channel_label(struct iio_dev *indio_dev,
|
||||
|
|
@ -1704,7 +1720,7 @@ static int ad7768_probe(struct spi_device *spi)
|
|||
return ret;
|
||||
|
||||
ret = devm_request_irq(&spi->dev, spi->irq, &ad7768_interrupt,
|
||||
IRQF_TRIGGER_RISING | IRQF_NO_THREAD,
|
||||
IRQF_TRIGGER_RISING | IRQF_NO_THREAD | IRQF_NO_AUTOEN,
|
||||
indio_dev->name, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user