]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: core: Add IIO_COVERAGE channel type
authorLiviu Stan <liviu.stan@analog.com>
Mon, 25 May 2026 16:39:34 +0000 (19:39 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 10:01:50 +0000 (11:01 +0100)
Add a new channel type for sensors that report fractional coverage as
a percentage. The sysfs attribute is in_coverageY_raw; after applying
in_coverageY_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@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Documentation/ABI/testing/sysfs-bus-iio
drivers/iio/industrialio-core.c
include/uapi/linux/iio/types.h
tools/iio/iio_event_monitor.c

index 925a33fd309aff006185b52ec6e31bdd70251467..d8d6d85235b01db450a1809331aa00c72d5ffdf4 100644 (file)
@@ -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_coverageY_raw
+KernelVersion: 7.2
+Contact:       linux-iio@vger.kernel.org
+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_coverageY_scale
+KernelVersion: 7.2
+Contact:       linux-iio@vger.kernel.org
+Description:
+               Scale to be applied to in_coverageY_raw to obtain coverage
+               in percent.
+
 What:          /sys/bus/iio/devices/iio:deviceX/heater_enable
 KernelVersion: 4.1.0
 Contact:       linux-iio@vger.kernel.org
index bd6f4f9f453300eeb4d152bbf57e3f9afbcbc9cc..ffe0dc49c4b929798d6934ff95b001b781650099 100644 (file)
@@ -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[] = {
index d7c2bb2236518a0d6735cd065fcba1ba5a02202c..c9295c707041bb6ebf39d833b18f414ee1c429ce 100644 (file)
@@ -53,6 +53,7 @@ enum iio_chan_type {
        IIO_CHROMATICITY,
        IIO_ATTENTION,
        IIO_ALTCURRENT,
+       IIO_COVERAGE,
 };
 
 enum iio_modifier {
index df6c43d7738d6b5aecfe738fb56553333ace11b7..bc3ef4c77c2b6cf727734fdbcf68be7f63fed962 100644 (file)
@@ -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;