Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2018 Axentia Technologies AB
0004  */
0005 
0006 #ifndef __IIO_RESCALE_H__
0007 #define __IIO_RESCALE_H__
0008 
0009 #include <linux/types.h>
0010 #include <linux/iio/iio.h>
0011 
0012 struct device;
0013 struct rescale;
0014 
0015 struct rescale_cfg {
0016     enum iio_chan_type type;
0017     int (*props)(struct device *dev, struct rescale *rescale);
0018 };
0019 
0020 struct rescale {
0021     const struct rescale_cfg *cfg;
0022     struct iio_channel *source;
0023     struct iio_chan_spec chan;
0024     struct iio_chan_spec_ext_info *ext_info;
0025     bool chan_processed;
0026     s32 numerator;
0027     s32 denominator;
0028     s32 offset;
0029 };
0030 
0031 int rescale_process_scale(struct rescale *rescale, int scale_type,
0032               int *val, int *val2);
0033 int rescale_process_offset(struct rescale *rescale, int scale_type,
0034                int scale, int scale2, int schan_off,
0035                int *val, int *val2);
0036 #endif /* __IIO_RESCALE_H__ */