summaryrefslogtreecommitdiff
path: root/include/linux/iio
diff options
context:
space:
mode:
authorWadim Mueller <wafgo01@gmail.com>2026-07-28 23:49:42 +0200
committerJonathan Cameron <jonathan.cameron@oss.qualcomm.com>2026-08-05 00:03:28 +0100
commit1647a1b67377e9f7b4ca75bc5607eda6791abd0a (patch)
tree036c745a7508a247c4870050ded35ea44df1894e /include/linux/iio
parent7462dce2368da9c055bd91f9622eaf393eb75049 (diff)
downloadlinux-next-1647a1b67377e9f7b4ca75bc5607eda6791abd0a.tar.gz
linux-next-1647a1b67377e9f7b4ca75bc5607eda6791abd0a.zip
iio: core: add IIO_VAL_DECIMAL64_FEMTO format type
Extend the IIO_VAL_DECIMAL64_* family with a femto-scaled variant (scale 15), following the existing MILLI/MICRO/NANO/PICO pattern. Both the read formatting path in __iio_format_value() and the write parsing path in iio_write_channel_info() (via kstrtodec64()) already derive their scale from "type - IIO_VAL_DECIMAL64_BASE", so the new type only needs to be added to the respective switch cases. This is needed by drivers reporting very small SI quantities where the existing pico scale loses precision. For example the Sensirion SLF3S liquid flow sensor reports its volume-flow scale in m^3/s, where the SLF3S-0600F scale is ~1.667e-12 m^3/s: at pico scale only a single significant digit survives, whereas femto scale preserves the full sensor resolution. Signed-off-by: Wadim Mueller <wafgo01@gmail.com> Reviewed-by: Rodrigo Alencar <rodrigo.alencar@analog.com> Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/types.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 924ac9dc6893..d8944c9e5e90 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -42,6 +42,7 @@ enum iio_event_info {
#define IIO_VAL_DECIMAL64_MICRO (IIO_VAL_DECIMAL64_BASE + 6)
#define IIO_VAL_DECIMAL64_NANO (IIO_VAL_DECIMAL64_BASE + 9)
#define IIO_VAL_DECIMAL64_PICO (IIO_VAL_DECIMAL64_BASE + 12)
+#define IIO_VAL_DECIMAL64_FEMTO (IIO_VAL_DECIMAL64_BASE + 15)
static inline s64 iio_val_s64_compose(s32 val0, s32 val1)
{