iio: adc: ti-ads1015: Add edge trigger support
authorMarek Vasut <marex@denx.de>
Thu, 31 Aug 2023 18:25:02 +0000 (20:25 +0200)
committerJonathan Cameron <jonathan.cameron@huawei.com>
Tue, 12 Sep 2023 09:42:04 +0000 (10:42 +0100)
The comparator generates an edge on the IRQ like and stays in the
configured state until cleared. Support edge triggered IRQs as well
as not all controllers do support level triggered IRQ.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230831182502.154899-1-marex@denx.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-ads1015.c

index 075c75a875449e7c47b149f8a820c9fd4d2df973..addee45ed40addebd39f85cbde53c02fd9621a8c 100644 (file)
@@ -1047,11 +1047,13 @@ static int ads1015_probe(struct i2c_client *client)
                        1 << ADS1015_CFG_COMP_LAT_SHIFT;
 
                switch (irq_trig) {
+               case IRQF_TRIGGER_FALLING:
                case IRQF_TRIGGER_LOW:
                        cfg_comp |= ADS1015_CFG_COMP_POL_LOW <<
                                        ADS1015_CFG_COMP_POL_SHIFT;
                        break;
                case IRQF_TRIGGER_HIGH:
+               case IRQF_TRIGGER_RISING:
                        cfg_comp |= ADS1015_CFG_COMP_POL_HIGH <<
                                        ADS1015_CFG_COMP_POL_SHIFT;
                        break;