Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: add hardware triggered operating mode

Devices, like stm32 timer, could be triggered by hardware events which
are not buffer or software events. However it could be necessary to
validate the triggers like it is done for buffer or event triggered modes.
This patch add a new INDIO_HARDWARE_TRIGGERED operating mode for this
kind of devices and allow this mode to register trigger consumer.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>

authored by

Benjamin Gaignard and committed by
Jonathan Cameron
d89e119a 4e36a8ad

+8 -2
+2 -2
drivers/iio/industrialio-core.c
··· 1423 1423 static void iio_dev_release(struct device *device) 1424 1424 { 1425 1425 struct iio_dev *indio_dev = dev_to_iio_dev(device); 1426 - if (indio_dev->modes & (INDIO_BUFFER_TRIGGERED | INDIO_EVENT_TRIGGERED)) 1426 + if (indio_dev->modes & INDIO_ALL_TRIGGERED_MODES) 1427 1427 iio_device_unregister_trigger_consumer(indio_dev); 1428 1428 iio_device_unregister_eventset(indio_dev); 1429 1429 iio_device_unregister_sysfs(indio_dev); ··· 1705 1705 "Failed to register event set\n"); 1706 1706 goto error_free_sysfs; 1707 1707 } 1708 - if (indio_dev->modes & (INDIO_BUFFER_TRIGGERED | INDIO_EVENT_TRIGGERED)) 1708 + if (indio_dev->modes & INDIO_ALL_TRIGGERED_MODES) 1709 1709 iio_device_register_trigger_consumer(indio_dev); 1710 1710 1711 1711 if ((indio_dev->modes & INDIO_ALL_BUFFER_MODES) &&
+6
include/linux/iio/iio.h
··· 352 352 #define INDIO_BUFFER_SOFTWARE 0x04 353 353 #define INDIO_BUFFER_HARDWARE 0x08 354 354 #define INDIO_EVENT_TRIGGERED 0x10 355 + #define INDIO_HARDWARE_TRIGGERED 0x20 355 356 356 357 #define INDIO_ALL_BUFFER_MODES \ 357 358 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE) 359 + 360 + #define INDIO_ALL_TRIGGERED_MODES \ 361 + (INDIO_BUFFER_TRIGGERED \ 362 + | INDIO_EVENT_TRIGGERED \ 363 + | INDIO_HARDWARE_TRIGGERED) 358 364 359 365 #define INDIO_MAX_RAW_ELEMENTS 4 360 366