hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/iio/imu/adis_trigger.c
....@@ -15,8 +15,7 @@
1515 #include <linux/iio/trigger.h>
1616 #include <linux/iio/imu/adis.h>
1717
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)
2019 {
2120 struct adis *adis = iio_trigger_get_drvdata(trig);
2221
....@@ -36,18 +35,23 @@
3635
3736 static int adis_validate_irq_flag(struct adis *adis)
3837 {
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;
3943 /*
4044 * Typically this devices have data ready either on the rising edge or
4145 * on the falling edge of the data ready pin. This checks enforces that
4246 * 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
4448 * don't support changing the pin polarity.
4549 */
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;
4852 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) {
5155 dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n",
5256 adis->irq_flag);
5357 return -EINVAL;
....@@ -88,5 +92,5 @@
8892
8993 return devm_iio_trigger_register(&adis->spi->dev, adis->trig);
9094 }
91
-EXPORT_SYMBOL_GPL(devm_adis_probe_trigger);
95
+EXPORT_SYMBOL_NS_GPL(devm_adis_probe_trigger, IIO_ADISLIB);
9296