From 2c5b0fb9dbe9d3ef8a14eeab529cac581bc6bc72 Mon Sep 17 00:00:00 2001 From: Jason Zhang Date: Tue, 7 Jun 2022 11:39:34 +0800 Subject: [PATCH] iio: Add FIFO event for LSM6DSR sensor HUB Add FIFO event type: * IIO_EV_TYPE_FIFO_FLUSH This change also adds FIFO event directions: * IIO_EV_DIR_FIFO_EMPTY (indicates the FIFO is empty) * IIO_EV_DIR_FIFO_DATA (indicates the FIFO is not empty) A FIFO flush event is triggered after the HW FIFO is flushed, and indicates that whether the HW FIFO is empty or not. Signed-off-by: Jason Zhang Change-Id: Idb21bc271c7fd8def63f2cb29440ebf0677688d5 --- drivers/iio/industrialio-event.c | 9 ++++++++- include/uapi/linux/iio/types.h | 7 +++++++ scripts/headers_install.sh | 1 + tools/iio/iio_event_monitor.c | 9 ++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/iio/industrialio-event.c b/drivers/iio/industrialio-event.c index 99ba657b8568..c0e346dc5dbf 100644 --- a/drivers/iio/industrialio-event.c +++ b/drivers/iio/industrialio-event.c @@ -228,12 +228,19 @@ static const char * const iio_ev_type_text[] = { [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", [IIO_EV_TYPE_CHANGE] = "change", +#ifdef CONFIG_NO_GKI + [IIO_EV_TYPE_FIFO_FLUSH] = "fifo_flush", +#endif }; static const char * const iio_ev_dir_text[] = { [IIO_EV_DIR_EITHER] = "either", [IIO_EV_DIR_RISING] = "rising", - [IIO_EV_DIR_FALLING] = "falling" + [IIO_EV_DIR_FALLING] = "falling", +#ifdef CONFIG_NO_GKI + [IIO_EV_DIR_FIFO_EMPTY] = "empty", + [IIO_EV_DIR_FIFO_DATA] = "data", +#endif }; static const char * const iio_ev_info_text[] = { diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h index 48c13147c0a8..21be68dace1d 100644 --- a/include/uapi/linux/iio/types.h +++ b/include/uapi/linux/iio/types.h @@ -104,12 +104,19 @@ enum iio_event_type { IIO_EV_TYPE_THRESH_ADAPTIVE, IIO_EV_TYPE_MAG_ADAPTIVE, IIO_EV_TYPE_CHANGE, +#ifdef CONFIG_NO_GKI + IIO_EV_TYPE_FIFO_FLUSH, +#endif }; enum iio_event_direction { IIO_EV_DIR_EITHER, IIO_EV_DIR_RISING, IIO_EV_DIR_FALLING, +#ifdef CONFIG_NO_GKI + IIO_EV_DIR_FIFO_EMPTY, + IIO_EV_DIR_FIFO_DATA, +#endif IIO_EV_DIR_NONE, }; diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh index dd554bd436cc..92ee71445e34 100755 --- a/scripts/headers_install.sh +++ b/scripts/headers_install.sh @@ -70,6 +70,7 @@ configs=$(sed -e ' # # The format is : in each line. config_leak_ignores=" +include/uapi/linux/iio/types.h:CONFIG_NO_GKI arch/alpha/include/uapi/asm/setup.h:CONFIG_ALPHA_LEGACY_START_ADDRESS arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c index bb03859db89d..5504e5661130 100644 --- a/tools/iio/iio_event_monitor.c +++ b/tools/iio/iio_event_monitor.c @@ -67,12 +67,19 @@ static const char * const iio_ev_type_text[] = { [IIO_EV_TYPE_THRESH_ADAPTIVE] = "thresh_adaptive", [IIO_EV_TYPE_MAG_ADAPTIVE] = "mag_adaptive", [IIO_EV_TYPE_CHANGE] = "change", +#ifdef CONFIG_NO_GKI + [IIO_EV_TYPE_FIFO_FLUSH] = "fifo_flush", +#endif }; static const char * const iio_ev_dir_text[] = { [IIO_EV_DIR_EITHER] = "either", [IIO_EV_DIR_RISING] = "rising", - [IIO_EV_DIR_FALLING] = "falling" + [IIO_EV_DIR_FALLING] = "falling", +#ifdef CONFIG_NO_GKI + [IIO_EV_DIR_FIFO_EMPTY] = "empty", + [IIO_EV_DIR_FIFO_DATA] = "data", +#endif }; static const char * const iio_modifier_names[] = {