Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
37 lines
833 B
C
37 lines
833 B
C
/* 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;
|
|
s32 offset;
|
|
};
|
|
|
|
int rescale_process_scale(struct rescale *rescale, int scale_type,
|
|
int *val, int *val2);
|
|
int rescale_process_offset(struct rescale *rescale, int scale_type,
|
|
int scale, int scale2, int schan_off,
|
|
int *val, int *val2);
|
|
#endif /* __IIO_RESCALE_H__ */
|