[PATCH v3 6/8] iio: core: Add IIO_COVERAGE channel type
From: Liviu Stan
Date: Thu May 21 2026 - 13:15:13 EST
Add a new channel type for sensors that report fractional coverage as
a percentage. The sysfs attribute is in_coverageX_raw; after applying
in_coverageX_scale the value is in percent. The first user is the
ADT7604 leak detector, where the value represents the portion of the
sensing element that is wetted.
Signed-off-by: Liviu Stan <liviu.stan@xxxxxxxxxx>
---
Changes in v3:
- Renamed the sysfs attribute from in_coveragepercentX_raw to
in_coverageX_raw
- Added a _scale ABI documentation entry
- Corrected KernelVersion in the ABI documentation from 6.15 to 7.2
- Added IIO_COVERAGE to the event_is_known() switch in
tools/iio/iio_event_monitor.c
Documentation/ABI/testing/sysfs-bus-iio | 17 +++++++++++++++++
drivers/iio/industrialio-core.c | 1 +
include/uapi/linux/iio/types.h | 1 +
tools/iio/iio_event_monitor.c | 2 ++
4 files changed, 21 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
index 925a33fd309a..ca20ad5860dc 100644
--- a/Documentation/ABI/testing/sysfs-bus-iio
+++ b/Documentation/ABI/testing/sysfs-bus-iio
@@ -1980,6 +1980,23 @@ Description:
Raw (unscaled no offset etc.) resistance reading.
Units after application of scale and offset are ohms.
+What: /sys/bus/iio/devices/iio:deviceX/in_coverageX_raw
+KernelVersion: 7.2
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ Raw (unscaled no offset etc.) coverage reading. Used for sensors
+ that report fractional coverage as a percentage, such as leak
+ detectors where the value represents what portion of the sensing
+ element is wetted. Units after application of scale and offset are
+ percent.
+
+What: /sys/bus/iio/devices/iio:deviceX/in_coverageX_scale
+KernelVersion: 7.2
+Contact: linux-iio@xxxxxxxxxxxxxxx
+Description:
+ Scale to be applied to in_coverageX_raw to obtain coverage
+ in percent.
+
What: /sys/bus/iio/devices/iio:deviceX/heater_enable
KernelVersion: 4.1.0
Contact: linux-iio@xxxxxxxxxxxxxxx
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index bd6f4f9f4533..ffe0dc49c4b9 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -98,6 +98,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_CHROMATICITY] = "chromaticity",
[IIO_ATTENTION] = "attention",
[IIO_ALTCURRENT] = "altcurrent",
+ [IIO_COVERAGE] = "coverage",
};
static const char * const iio_modifier_names[] = {
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
index d7c2bb223651..c9295c707041 100644
--- a/include/uapi/linux/iio/types.h
+++ b/include/uapi/linux/iio/types.h
@@ -53,6 +53,7 @@ enum iio_chan_type {
IIO_CHROMATICITY,
IIO_ATTENTION,
IIO_ALTCURRENT,
+ IIO_COVERAGE,
};
enum iio_modifier {
diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
index df6c43d7738d..bc3ef4c77c2b 100644
--- a/tools/iio/iio_event_monitor.c
+++ b/tools/iio/iio_event_monitor.c
@@ -65,6 +65,7 @@ static const char * const iio_chan_type_name_spec[] = {
[IIO_CHROMATICITY] = "chromaticity",
[IIO_ATTENTION] = "attention",
[IIO_ALTCURRENT] = "altcurrent",
+ [IIO_COVERAGE] = "coverage",
};
static const char * const iio_ev_type_text[] = {
@@ -194,6 +195,7 @@ static bool event_is_known(struct iio_event_data *event)
case IIO_CHROMATICITY:
case IIO_ATTENTION:
case IIO_ALTCURRENT:
+ case IIO_COVERAGE:
break;
default:
return false;
--
2.43.0