• Eugen Hristev's avatar
    iio: adc: at91-sama5d2_adc: update for other trigger usage · abb7e84d
    Eugen Hristev authored
    This change will allow the at91-sama5d2_adc driver to use other triggers
    than it's own.
    In particular, tested with the sysfs trigger.
    To be able to achieve this functionality, some changes were required:
    1) Do not enable/disable channels when enabling/disabling the trigger.
    This is because the trigger is enabled/disabled only for our trigger
    (obviously). We need channels enabled/disabled regardless of what trigger is
    being used.
    2) Cope with DMA : DMA cannot be used when using another type of trigger.
    Other triggers work through pollfunc, so we get polled anyway on every trigger.
    Thus we have to obtain data at every trigger.
    3) When to start conversion? The usual pollfunc (store time from subsystem)
    would be in hard irq and this would be a good way, but current iio subsystem
    recommends to have it in the threaded irq. Thus adding software start
    code in this handler.
    4) Buffer config: we need to setup buffer regardless of our own device's
    trigger. We may get one attached later.
    5) IRQ handling: we use our own device IRQ only if it's our own trigger
    and we do not use DMA . If we use DMA, we use the DMA controller's IRQ.
    Signed-off-by: default avatarEugen Hristev <eugen.hristev@microchip.com>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    abb7e84d
at91-sama5d2_adc.c 55.7 KB