aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@intel.com>2015-02-10 11:33:51 -0500
committerJonathan Cameron <jic23@kernel.org>2015-02-14 12:05:03 -0500
commit293487c8ecc1103f4625cea5e90e1ba0cc89660f (patch)
tree2222fda327366ac5a52377f7e62a1ba14f334b9c
parente257a16e680a27ddc3dcbfc9fd39ad7f9d7ea135 (diff)
iio: Export userspace IIO headers
After UAPI header file split [1] all user-kernel interfaces were placed under include/uapi/. This patch moves IIO user specific API from: * include/linux/iio/events.h => include/uapi/linux/iio/events.h * include/linux/types.h => include/uapi/linux/types.h Now there is no need for nasty tricks to compile userspace programs (e.g iio_event_monitor). Just installing the kernel headers with make headers_install command does the job. [1] http://lwn.net/Articles/507794/ Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--include/linux/iio/events.h30
-rw-r--r--include/linux/iio/types.h78
-rw-r--r--include/uapi/linux/Kbuild1
-rw-r--r--include/uapi/linux/iio/Kbuild3
-rw-r--r--include/uapi/linux/iio/events.h42
-rw-r--r--include/uapi/linux/iio/types.h92
6 files changed, 140 insertions, 106 deletions
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 03fa332ad2a8..8ad87d1c5340 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -9,22 +9,8 @@
9#ifndef _IIO_EVENTS_H_ 9#ifndef _IIO_EVENTS_H_
10#define _IIO_EVENTS_H_ 10#define _IIO_EVENTS_H_
11 11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14#include <linux/iio/types.h> 12#include <linux/iio/types.h>
15 13#include <uapi/linux/iio/events.h>
16/**
17 * struct iio_event_data - The actual event being pushed to userspace
18 * @id: event identifier
19 * @timestamp: best estimate of time of event occurrence (often from
20 * the interrupt handler)
21 */
22struct iio_event_data {
23 __u64 id;
24 __s64 timestamp;
25};
26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 14
29/** 15/**
30 * IIO_EVENT_CODE() - create event identifier 16 * IIO_EVENT_CODE() - create event identifier
@@ -70,18 +56,4 @@ struct iio_event_data {
70#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \ 56#define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \
71 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0) 57 IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0)
72 58
73#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
74
75#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
76
77#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
78
79/* Event code number extraction depends on which type of event we have.
80 * Perhaps review this function in the future*/
81#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
82#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
83
84#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
85#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
86
87#endif 59#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 580ed5bdb3fa..942b6de68e2f 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -10,76 +10,7 @@
10#ifndef _IIO_TYPES_H_ 10#ifndef _IIO_TYPES_H_
11#define _IIO_TYPES_H_ 11#define _IIO_TYPES_H_
12 12
13enum iio_chan_type { 13#include <uapi/linux/iio/types.h>
14 IIO_VOLTAGE,
15 IIO_CURRENT,
16 IIO_POWER,
17 IIO_ACCEL,
18 IIO_ANGL_VEL,
19 IIO_MAGN,
20 IIO_LIGHT,
21 IIO_INTENSITY,
22 IIO_PROXIMITY,
23 IIO_TEMP,
24 IIO_INCLI,
25 IIO_ROT,
26 IIO_ANGL,
27 IIO_TIMESTAMP,
28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE,
30 IIO_CCT,
31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
38};
39
40enum iio_modifier {
41 IIO_NO_MOD,
42 IIO_MOD_X,
43 IIO_MOD_Y,
44 IIO_MOD_Z,
45 IIO_MOD_X_AND_Y,
46 IIO_MOD_X_AND_Z,
47 IIO_MOD_Y_AND_Z,
48 IIO_MOD_X_AND_Y_AND_Z,
49 IIO_MOD_X_OR_Y,
50 IIO_MOD_X_OR_Z,
51 IIO_MOD_Y_OR_Z,
52 IIO_MOD_X_OR_Y_OR_Z,
53 IIO_MOD_LIGHT_BOTH,
54 IIO_MOD_LIGHT_IR,
55 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
56 IIO_MOD_SUM_SQUARED_X_Y_Z,
57 IIO_MOD_LIGHT_CLEAR,
58 IIO_MOD_LIGHT_RED,
59 IIO_MOD_LIGHT_GREEN,
60 IIO_MOD_LIGHT_BLUE,
61 IIO_MOD_QUATERNION,
62 IIO_MOD_TEMP_AMBIENT,
63 IIO_MOD_TEMP_OBJECT,
64 IIO_MOD_NORTH_MAGN,
65 IIO_MOD_NORTH_TRUE,
66 IIO_MOD_NORTH_MAGN_TILT_COMP,
67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
73};
74
75enum iio_event_type {
76 IIO_EV_TYPE_THRESH,
77 IIO_EV_TYPE_MAG,
78 IIO_EV_TYPE_ROC,
79 IIO_EV_TYPE_THRESH_ADAPTIVE,
80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
82};
83 14
84enum iio_event_info { 15enum iio_event_info {
85 IIO_EV_INFO_ENABLE, 16 IIO_EV_INFO_ENABLE,
@@ -88,13 +19,6 @@ enum iio_event_info {
88 IIO_EV_INFO_PERIOD, 19 IIO_EV_INFO_PERIOD,
89}; 20};
90 21
91enum iio_event_direction {
92 IIO_EV_DIR_EITHER,
93 IIO_EV_DIR_RISING,
94 IIO_EV_DIR_FALLING,
95 IIO_EV_DIR_NONE,
96};
97
98#define IIO_VAL_INT 1 22#define IIO_VAL_INT 1
99#define IIO_VAL_INT_PLUS_MICRO 2 23#define IIO_VAL_INT_PLUS_MICRO 2
100#define IIO_VAL_INT_PLUS_NANO 3 24#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 00b100023c47..5bfc5bdc3c5d 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -6,6 +6,7 @@ header-y += caif/
6header-y += dvb/ 6header-y += dvb/
7header-y += hdlc/ 7header-y += hdlc/
8header-y += hsi/ 8header-y += hsi/
9header-y += iio/
9header-y += isdn/ 10header-y += isdn/
10header-y += mmc/ 11header-y += mmc/
11header-y += nfsd/ 12header-y += nfsd/
diff --git a/include/uapi/linux/iio/Kbuild b/include/uapi/linux/iio/Kbuild
new file mode 100644
index 000000000000..86f76d84c44f
--- /dev/null
+++ b/include/uapi/linux/iio/Kbuild
@@ -0,0 +1,3 @@
1# UAPI Header export list
2header-y += events.h
3header-y += types.h
diff --git a/include/uapi/linux/iio/events.h b/include/uapi/linux/iio/events.h
new file mode 100644
index 000000000000..00bbdaed2f97
--- /dev/null
+++ b/include/uapi/linux/iio/events.h
@@ -0,0 +1,42 @@
1/* The industrial I/O - event passing to userspace
2 *
3 * Copyright (c) 2008-2011 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9#ifndef _UAPI_IIO_EVENTS_H_
10#define _UAPI_IIO_EVENTS_H_
11
12#include <linux/ioctl.h>
13#include <linux/types.h>
14
15/**
16 * struct iio_event_data - The actual event being pushed to userspace
17 * @id: event identifier
18 * @timestamp: best estimate of time of event occurrence (often from
19 * the interrupt handler)
20 */
21struct iio_event_data {
22 __u64 id;
23 __s64 timestamp;
24};
25
26#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
27
28#define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
29
30#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
31
32#define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
33
34/* Event code number extraction depends on which type of event we have.
35 * Perhaps review this function in the future*/
36#define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF))
37#define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF))
38
39#define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF)
40#define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1)
41
42#endif /* _UAPI_IIO_EVENTS_H_ */
diff --git a/include/uapi/linux/iio/types.h b/include/uapi/linux/iio/types.h
new file mode 100644
index 000000000000..5c4601935005
--- /dev/null
+++ b/include/uapi/linux/iio/types.h
@@ -0,0 +1,92 @@
1/* industrial I/O data types needed both in and out of kernel
2 *
3 * Copyright (c) 2008 Jonathan Cameron
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#ifndef _UAPI_IIO_TYPES_H_
11#define _UAPI_IIO_TYPES_H_
12
13enum iio_chan_type {
14 IIO_VOLTAGE,
15 IIO_CURRENT,
16 IIO_POWER,
17 IIO_ACCEL,
18 IIO_ANGL_VEL,
19 IIO_MAGN,
20 IIO_LIGHT,
21 IIO_INTENSITY,
22 IIO_PROXIMITY,
23 IIO_TEMP,
24 IIO_INCLI,
25 IIO_ROT,
26 IIO_ANGL,
27 IIO_TIMESTAMP,
28 IIO_CAPACITANCE,
29 IIO_ALTVOLTAGE,
30 IIO_CCT,
31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
38};
39
40enum iio_modifier {
41 IIO_NO_MOD,
42 IIO_MOD_X,
43 IIO_MOD_Y,
44 IIO_MOD_Z,
45 IIO_MOD_X_AND_Y,
46 IIO_MOD_X_AND_Z,
47 IIO_MOD_Y_AND_Z,
48 IIO_MOD_X_AND_Y_AND_Z,
49 IIO_MOD_X_OR_Y,
50 IIO_MOD_X_OR_Z,
51 IIO_MOD_Y_OR_Z,
52 IIO_MOD_X_OR_Y_OR_Z,
53 IIO_MOD_LIGHT_BOTH,
54 IIO_MOD_LIGHT_IR,
55 IIO_MOD_ROOT_SUM_SQUARED_X_Y,
56 IIO_MOD_SUM_SQUARED_X_Y_Z,
57 IIO_MOD_LIGHT_CLEAR,
58 IIO_MOD_LIGHT_RED,
59 IIO_MOD_LIGHT_GREEN,
60 IIO_MOD_LIGHT_BLUE,
61 IIO_MOD_QUATERNION,
62 IIO_MOD_TEMP_AMBIENT,
63 IIO_MOD_TEMP_OBJECT,
64 IIO_MOD_NORTH_MAGN,
65 IIO_MOD_NORTH_TRUE,
66 IIO_MOD_NORTH_MAGN_TILT_COMP,
67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
73};
74
75enum iio_event_type {
76 IIO_EV_TYPE_THRESH,
77 IIO_EV_TYPE_MAG,
78 IIO_EV_TYPE_ROC,
79 IIO_EV_TYPE_THRESH_ADAPTIVE,
80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
82};
83
84enum iio_event_direction {
85 IIO_EV_DIR_EITHER,
86 IIO_EV_DIR_RISING,
87 IIO_EV_DIR_FALLING,
88 IIO_EV_DIR_NONE,
89};
90
91#endif /* _UAPI_IIO_TYPES_H_ */
92