Skip to content

Commit 622775d

Browse files
leaveyoustunjic23
authored andcommitted
iio: core: Add IIO_COVERAGE channel type
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>
1 parent b46696a commit 622775d

4 files changed

Lines changed: 21 additions & 0 deletions

File tree

Documentation/ABI/testing/sysfs-bus-iio

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,6 +1980,23 @@ Description:
19801980
Raw (unscaled no offset etc.) resistance reading.
19811981
Units after application of scale and offset are ohms.
19821982

1983+
What: /sys/bus/iio/devices/iio:deviceX/in_coverageY_raw
1984+
KernelVersion: 7.2
1985+
Contact: linux-iio@vger.kernel.org
1986+
Description:
1987+
Raw (unscaled no offset etc.) coverage reading. Used for sensors
1988+
that report fractional coverage as a percentage, such as leak
1989+
detectors where the value represents what portion of the sensing
1990+
element is wetted. Units after application of scale and offset are
1991+
percent.
1992+
1993+
What: /sys/bus/iio/devices/iio:deviceX/in_coverageY_scale
1994+
KernelVersion: 7.2
1995+
Contact: linux-iio@vger.kernel.org
1996+
Description:
1997+
Scale to be applied to in_coverageY_raw to obtain coverage
1998+
in percent.
1999+
19832000
What: /sys/bus/iio/devices/iio:deviceX/heater_enable
19842001
KernelVersion: 4.1.0
19852002
Contact: linux-iio@vger.kernel.org

drivers/iio/industrialio-core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static const char * const iio_chan_type_name_spec[] = {
9898
[IIO_CHROMATICITY] = "chromaticity",
9999
[IIO_ATTENTION] = "attention",
100100
[IIO_ALTCURRENT] = "altcurrent",
101+
[IIO_COVERAGE] = "coverage",
101102
};
102103

103104
static const char * const iio_modifier_names[] = {

include/uapi/linux/iio/types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ enum iio_chan_type {
5353
IIO_CHROMATICITY,
5454
IIO_ATTENTION,
5555
IIO_ALTCURRENT,
56+
IIO_COVERAGE,
5657
};
5758

5859
enum iio_modifier {

tools/iio/iio_event_monitor.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ static const char * const iio_chan_type_name_spec[] = {
6565
[IIO_CHROMATICITY] = "chromaticity",
6666
[IIO_ATTENTION] = "attention",
6767
[IIO_ALTCURRENT] = "altcurrent",
68+
[IIO_COVERAGE] = "coverage",
6869
};
6970

7071
static const char * const iio_ev_type_text[] = {
@@ -194,6 +195,7 @@ static bool event_is_known(struct iio_event_data *event)
194195
case IIO_CHROMATICITY:
195196
case IIO_ATTENTION:
196197
case IIO_ALTCURRENT:
198+
case IIO_COVERAGE:
197199
break;
198200
default:
199201
return false;

0 commit comments

Comments
 (0)