In preparation for the addition of kunit tests, expose the logic responsible for combining channel scales.
Showing the changes to include (1 of 2 files). Show all
Unified · Split
| @@ -0,0 +1,32 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | |
| 2 | +/* | |
| 3 | + * Copyright (C) 2018 Axentia Technologies AB | |
| 4 | + */ | |
| 5 | + | |
| 6 | +#ifndef __IIO_RESCALE_H__ | |
| 7 | +#define __IIO_RESCALE_H__ | |
| 8 | + | |
| 9 | +#include <linux/types.h> | |
| 10 | +#include <linux/iio/iio.h> | |
| 11 | + | |
| 12 | +struct device; | |
| 13 | +struct rescale; | |
| 14 | + | |
| 15 | +struct rescale_cfg { | |
| 16 | + enum iio_chan_type type; | |
| 17 | + int (*props)(struct device *dev, struct rescale *rescale); | |
| 18 | +}; | |
| 19 | + | |
| 20 | +struct rescale { | |
| 21 | + const struct rescale_cfg *cfg; | |
| 22 | + struct iio_channel *source; | |
| 23 | + struct iio_chan_spec chan; | |
| 24 | + struct iio_chan_spec_ext_info *ext_info; | |
| 25 | + bool chan_processed; | |
| 26 | + s32 numerator; | |
| 27 | + s32 denominator; | |
| 28 | +}; | |
| 29 | + | |
| 30 | +int rescale_process_scale(struct rescale *rescale, int scale_type, | |
| 31 | + int *val, int *val2); | |
| 32 | +#endif /* __IIO_RESCALE_H__ */ | |