.. | .. |
---|
15 | 15 | #include <linux/iio/trigger.h> |
---|
16 | 16 | #include <linux/iio/imu/adis.h> |
---|
17 | 17 | |
---|
18 | | -static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, |
---|
19 | | - bool state) |
---|
| 18 | +static int adis_data_rdy_trigger_set_state(struct iio_trigger *trig, bool state) |
---|
20 | 19 | { |
---|
21 | 20 | struct adis *adis = iio_trigger_get_drvdata(trig); |
---|
22 | 21 | |
---|
.. | .. |
---|
36 | 35 | |
---|
37 | 36 | static int adis_validate_irq_flag(struct adis *adis) |
---|
38 | 37 | { |
---|
| 38 | + unsigned long direction = adis->irq_flag & IRQF_TRIGGER_MASK; |
---|
| 39 | + |
---|
| 40 | + /* We cannot mask the interrupt so ensure it's not enabled at request */ |
---|
| 41 | + if (adis->data->unmasked_drdy) |
---|
| 42 | + adis->irq_flag |= IRQF_NO_AUTOEN; |
---|
39 | 43 | /* |
---|
40 | 44 | * Typically this devices have data ready either on the rising edge or |
---|
41 | 45 | * on the falling edge of the data ready pin. This checks enforces that |
---|
42 | 46 | * one of those is set in the drivers... It defaults to |
---|
43 | | - * IRQF_TRIGGER_RISING for backward compatibility wiht devices that |
---|
| 47 | + * IRQF_TRIGGER_RISING for backward compatibility with devices that |
---|
44 | 48 | * don't support changing the pin polarity. |
---|
45 | 49 | */ |
---|
46 | | - if (!adis->irq_flag) { |
---|
47 | | - adis->irq_flag = IRQF_TRIGGER_RISING; |
---|
| 50 | + if (direction == IRQF_TRIGGER_NONE) { |
---|
| 51 | + adis->irq_flag |= IRQF_TRIGGER_RISING; |
---|
48 | 52 | return 0; |
---|
49 | | - } else if (adis->irq_flag != IRQF_TRIGGER_RISING && |
---|
50 | | - adis->irq_flag != IRQF_TRIGGER_FALLING) { |
---|
| 53 | + } else if (direction != IRQF_TRIGGER_RISING && |
---|
| 54 | + direction != IRQF_TRIGGER_FALLING) { |
---|
51 | 55 | dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n", |
---|
52 | 56 | adis->irq_flag); |
---|
53 | 57 | return -EINVAL; |
---|
.. | .. |
---|
88 | 92 | |
---|
89 | 93 | return devm_iio_trigger_register(&adis->spi->dev, adis->trig); |
---|
90 | 94 | } |
---|
91 | | -EXPORT_SYMBOL_GPL(devm_adis_probe_trigger); |
---|
| 95 | +EXPORT_SYMBOL_NS_GPL(devm_adis_probe_trigger, IIO_ADISLIB); |
---|
92 | 96 | |
---|