iio: core: introduce trough info element for minimum values
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 11 Dec 2023 12:27:47 +0000 (20:27 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 11 Dec 2023 19:37:10 +0000 (19:37 +0000)
The IIO_CHAN_INFO_PEAK info element is used for maximum values and
currently there is no equivalent for minimum values. Instead of
overloading the existing peak info element, a new info element can
be added.

In principle there is no need to add a _TROUGH_SCALE element as the
scale will be the same as the one required for INFO_PEAK, which in
turn is sometimes omitted if a single scale for peaks and raw values
is required.

Add an IIO_CHAN_INFO_TROUGH info element for minimum values.

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20231211122747.9723-1-579lpy@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-core.c
include/linux/iio/types.h

index f6a123d397db517abdad80db044b151c31be59a0..9a85752124ddc43b10ecb12ed2c48f605395b170 100644 (file)
@@ -184,6 +184,7 @@ static const char * const iio_chan_info_postfix[] = {
        [IIO_CHAN_INFO_THERMOCOUPLE_TYPE] = "thermocouple_type",
        [IIO_CHAN_INFO_CALIBAMBIENT] = "calibambient",
        [IIO_CHAN_INFO_ZEROPOINT] = "zeropoint",
+       [IIO_CHAN_INFO_TROUGH] = "trough_raw",
 };
 /**
  * iio_device_id() - query the unique ID for the device
index 117bde7d6ad7915be091d2fa9e958a9efcafd4ff..d89982c98368cf72c0fc30fa66ab001e48af4e8b 100644 (file)
@@ -68,6 +68,7 @@ enum iio_chan_info_enum {
        IIO_CHAN_INFO_THERMOCOUPLE_TYPE,
        IIO_CHAN_INFO_CALIBAMBIENT,
        IIO_CHAN_INFO_ZEROPOINT,
+       IIO_CHAN_INFO_TROUGH,
 };
 
 #endif /* _IIO_TYPES_H_ */