aboutsummaryrefslogtreecommitdiff
path: root/include/linux/iio
diff options
context:
space:
mode:
authorGravatar Liam Beguin <liambeguin@gmail.com> 2022-02-12 21:57:30 -0500
committerGravatar Jonathan Cameron <Jonathan.Cameron@huawei.com> 2022-02-27 13:37:49 +0000
commitbc437f7515f5e14aec9f2801412d9ea48116a97d (patch)
tree6dfdfc527dc2a50681355825c48a392e00f85e79 /include/linux/iio
parentiio: frequency: admv4420.c: Add support for ADMV4420 (diff)
downloadlinux-bc437f7515f5e14aec9f2801412d9ea48116a97d.tar.gz
linux-bc437f7515f5e14aec9f2801412d9ea48116a97d.tar.bz2
linux-bc437f7515f5e14aec9f2801412d9ea48116a97d.zip
iio: afe: rescale: expose scale processing function
In preparation for the addition of kunit tests, expose the logic responsible for combining channel scales. Signed-off-by: Liam Beguin <liambeguin@gmail.com> Reviewed-by: Peter Rosin <peda@axentia.se> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220213025739.2561834-2-liambeguin@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/afe/rescale.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/iio/afe/rescale.h b/include/linux/iio/afe/rescale.h
new file mode 100644
index 000000000000..8a2eb34af327
--- /dev/null
+++ b/include/linux/iio/afe/rescale.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2018 Axentia Technologies AB
+ */
+
+#ifndef __IIO_RESCALE_H__
+#define __IIO_RESCALE_H__
+
+#include <linux/types.h>
+#include <linux/iio/iio.h>
+
+struct device;
+struct rescale;
+
+struct rescale_cfg {
+ enum iio_chan_type type;
+ int (*props)(struct device *dev, struct rescale *rescale);
+};
+
+struct rescale {
+ const struct rescale_cfg *cfg;
+ struct iio_channel *source;
+ struct iio_chan_spec chan;
+ struct iio_chan_spec_ext_info *ext_info;
+ bool chan_processed;
+ s32 numerator;
+ s32 denominator;
+};
+
+int rescale_process_scale(struct rescale *rescale, int scale_type,
+ int *val, int *val2);
+#endif /* __IIO_RESCALE_H__ */