mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
![Jonathan Cameron](/assets/img/avatar_default.png)
A large number of attributes can only take a limited range of values. Currently in IIO this is handled by directly registering additional *_available attributes thus providing this information to userspace. It is desirable to provide this information via the core for much the same reason this was done for the actual channel information attributes in the first place. If it isn't there, then it can only really be accessed from userspace. Other in kernel IIO consumers have no access to what valid parameters are. Two forms are currently supported: * list of values in one particular IIO_VAL_* format. e.g. 1.300000 1.500000 1.730000 * range specification with a step size: e.g. [1.000000 0.500000 2.500000] equivalent to 1.000000 1.5000000 2.000000 2.500000 An addition set of masks are used to allow different sharing rules for the *_available attributes generated. This allows for example: in_accel_x_offset in_accel_y_offset in_accel_offset_available. We could have gone with having a specification for each and every info_mask element but that would have meant changing the existing userspace ABI. This approach does not. Signed-off-by: Jonathan Cameron <jic23@kernel.org> [forward ported, added some docs and fixed buffer overflows /peda] Acked-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
37 lines
873 B
C
37 lines
873 B
C
/* industrial I/O data types needed both in and out of kernel
|
|
*
|
|
* Copyright (c) 2008 Jonathan Cameron
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
* the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef _IIO_TYPES_H_
|
|
#define _IIO_TYPES_H_
|
|
|
|
#include <uapi/linux/iio/types.h>
|
|
|
|
enum iio_event_info {
|
|
IIO_EV_INFO_ENABLE,
|
|
IIO_EV_INFO_VALUE,
|
|
IIO_EV_INFO_HYSTERESIS,
|
|
IIO_EV_INFO_PERIOD,
|
|
IIO_EV_INFO_HIGH_PASS_FILTER_3DB,
|
|
IIO_EV_INFO_LOW_PASS_FILTER_3DB,
|
|
};
|
|
|
|
#define IIO_VAL_INT 1
|
|
#define IIO_VAL_INT_PLUS_MICRO 2
|
|
#define IIO_VAL_INT_PLUS_NANO 3
|
|
#define IIO_VAL_INT_PLUS_MICRO_DB 4
|
|
#define IIO_VAL_INT_MULTIPLE 5
|
|
#define IIO_VAL_FRACTIONAL 10
|
|
#define IIO_VAL_FRACTIONAL_LOG2 11
|
|
|
|
enum iio_available_type {
|
|
IIO_AVAIL_LIST,
|
|
IIO_AVAIL_RANGE,
|
|
};
|
|
|
|
#endif /* _IIO_TYPES_H_ */
|