First Support on Ginger and OMAP TI
[linux-ginger.git] / drivers / staging / iio / accel / accel.h
blob811fa0527a4360671f2cd00803aa2f6c4b32ede6
2 #include "../sysfs.h"
4 /* Accelerometer types of attribute */
6 #define IIO_DEV_ATTR_ACCEL_X_OFFSET(_mode, _show, _store, _addr) \
7 IIO_DEVICE_ATTR(accel_x_offset, _mode, _show, _store, _addr)
9 #define IIO_DEV_ATTR_ACCEL_Y_OFFSET(_mode, _show, _store, _addr) \
10 IIO_DEVICE_ATTR(accel_y_offset, _mode, _show, _store, _addr)
12 #define IIO_DEV_ATTR_ACCEL_Z_OFFSET(_mode, _show, _store, _addr) \
13 IIO_DEVICE_ATTR(accel_z_offset, _mode, _show, _store, _addr)
15 #define IIO_DEV_ATTR_ACCEL_X_GAIN(_mode, _show, _store, _addr) \
16 IIO_DEVICE_ATTR(accel_x_gain, _mode, _show, _store, _addr)
18 #define IIO_DEV_ATTR_ACCEL_Y_GAIN(_mode, _show, _store, _addr) \
19 IIO_DEVICE_ATTR(accel_y_gain, _mode, _show, _store, _addr)
21 #define IIO_DEV_ATTR_ACCEL_Z_GAIN(_mode, _show, _store, _addr) \
22 IIO_DEVICE_ATTR(accel_z_gain, _mode, _show, _store, _addr)
24 #define IIO_DEV_ATTR_ACCEL_X(_show, _addr) \
25 IIO_DEVICE_ATTR(accel_x, S_IRUGO, _show, NULL, _addr)
27 #define IIO_DEV_ATTR_ACCEL_Y(_show, _addr) \
28 IIO_DEVICE_ATTR(accel_y, S_IRUGO, _show, NULL, _addr)
30 #define IIO_DEV_ATTR_ACCEL_Z(_show, _addr) \
31 IIO_DEVICE_ATTR(accel_z, S_IRUGO, _show, NULL, _addr)
33 /* Thresholds are somewhat chip dependent - may need quite a few defs here */
34 /* For unified thesholds (shared across all directions */
36 /**
37 * IIO_DEV_ATTR_ACCEL_THRESH: unified threshold
38 * @_mode: read/write
39 * @_show: read detector threshold value
40 * @_store: write detector theshold value
41 * @_addr: driver specific data, typically a register address
43 * This one is for cases where as single threshold covers all directions
44 **/
45 #define IIO_DEV_ATTR_ACCEL_THRESH(_mode, _show, _store, _addr) \
46 IIO_DEVICE_ATTR(thresh, _mode, _show, _store, _addr)
48 /**
49 * IIO_DEV_ATTR_ACCEL_THRESH_X: independant direction threshold, x axis
50 * @_mode: readable / writable
51 * @_show: read x axis detector theshold value
52 * @_store: write x axis detector threshold value
53 * @_addr: device driver dependant, typically a register address
54 **/
55 #define IIO_DEV_ATTR_ACCEL_THRESH_X(_mode, _show, _store, _addr) \
56 IIO_DEVICE_ATTR(thresh_accel_x, _mode, _show, _store, _addr)
58 #define IIO_DEV_ATTR_ACCEL_THRESH_Y(_mode, _show, _store, _addr) \
59 IIO_DEVICE_ATTR(thresh_accel_y, _mode, _show, _store, _addr)
61 #define IIO_DEV_ATTR_ACCEL_THRESH_Z(_mode, _show, _store, _addr) \
62 IIO_DEVICE_ATTR(thresh_accel_z, _mode, _show, _store, _addr)
65 /**
66 * IIO_EVENT_ATTR_ACCEL_X_HIGH: threshold event, x acceleration
67 * @_show: read x acceleration high threshold
68 * @_store: write x acceleration high threshold
69 * @_mask: device dependant, typically a bit mask
70 * @_handler: the iio_handler associated with this attribute
71 **/
72 #define IIO_EVENT_ATTR_ACCEL_X_HIGH(_show, _store, _mask, _handler) \
73 IIO_EVENT_ATTR(accel_x_high, _show, _store, _mask, _handler)
75 /**
76 * IIO_EVENT_ATTR_ACCEL_X_HIGH_SH: threshold event, x accel high, shared handler
77 * @_evlist: event list used to share the handler
78 * @_show: attribute read
79 * @_store: attribute write
80 * @_mask: driver specific data, typically a bit mask
81 **/
82 #define IIO_EVENT_ATTR_ACCEL_X_HIGH_SH(_evlist, _show, _store, _mask) \
83 IIO_EVENT_ATTR_SH(accel_x_high, _evlist, _show, _store, _mask)
85 /**
86 * IIO_EVENT_CODE_ACCEL_X_HIGH - event code for x axis high accel threshold
87 **/
88 #define IIO_EVENT_CODE_ACCEL_X_HIGH IIO_EVENT_CODE_ACCEL_BASE
90 #define IIO_EVENT_ATTR_ACCEL_Y_HIGH(_show, _store, _mask, _handler) \
91 IIO_EVENT_ATTR(accel_y_high, _show, _store, _mask, _handler)
93 #define IIO_EVENT_ATTR_ACCEL_Y_HIGH_SH(_evlist, _show, _store, _mask) \
94 IIO_EVENT_ATTR_SH(accel_y_high, _evlist, _show, _store, _mask)
96 #define IIO_EVENT_CODE_ACCEL_Y_HIGH (IIO_EVENT_CODE_ACCEL_BASE + 1)
98 #define IIO_EVENT_ATTR_ACCEL_Z_HIGH(_show, _store, _mask, _handler) \
99 IIO_EVENT_ATTR(accel_z_high, _show, _store, _mask, _handler)
101 #define IIO_EVENT_ATTR_ACCEL_Z_HIGH_SH(_evlist, _show, _store, _mask) \
102 IIO_EVENT_ATTR_SH(accel_z_high, _evlist, _show, _store, _mask)
104 #define IIO_EVENT_CODE_ACCEL_Z_HIGH (IIO_EVENT_CODE_ACCEL_BASE + 2)
106 #define IIO_EVENT_ATTR_ACCEL_X_LOW(_show, _store, _mask, _handler) \
107 IIO_EVENT_ATTR(accel_x_low, _show, _store, _mask, _handler)
109 #define IIO_EVENT_ATTR_ACCEL_X_LOW_SH(_evlist, _show, _store, _mask) \
110 IIO_EVENT_ATTR_SH(accel_x_low, _evlist, _show, _store, _mask)
112 #define IIO_EVENT_CODE_ACCEL_X_LOW (IIO_EVENT_CODE_ACCEL_BASE + 3)
114 #define IIO_EVENT_ATTR_ACCEL_Y_LOW(_show, _store, _mask, _handler) \
115 IIO_EVENT_ATTR(accel_y_low, _show, _store, _mask, _handler)
117 #define IIO_EVENT_ATTR_ACCEL_Y_LOW_SH(_evlist, _show, _store, _mask)\
118 IIO_EVENT_ATTR_SH(accel_y_low, _evlist, _show, _store, _mask)
120 #define IIO_EVENT_CODE_ACCEL_Y_LOW (IIO_EVENT_CODE_ACCEL_BASE + 4)
122 #define IIO_EVENT_ATTR_ACCEL_Z_LOW(_show, _store, _mask, _handler) \
123 IIO_EVENT_ATTR(accel_z_low, _show, _store, _mask, _handler)
125 #define IIO_EVENT_ATTR_ACCEL_Z_LOW_SH(_evlist, _show, _store, _mask) \
126 IIO_EVENT_ATTR_SH(accel_z_low, _evlist, _show, _store, _mask)
128 #define IIO_EVENT_CODE_ACCEL_Z_LOW (IIO_EVENT_CODE_ACCEL_BASE + 5)
130 #define IIO_EVENT_ATTR_FREE_FALL_DETECT(_show, _store, _mask, _handler) \
131 IIO_EVENT_ATTR(free_fall, _show, _store, _mask, _handler)
133 #define IIO_EVENT_ATTR_FREE_FALL_DETECT_SH(_evlist, _show, _store, _mask) \
134 IIO_EVENT_ATTR_SH(free_fall, _evlist, _show, _store, _mask)
136 #define IIO_EVENT_CODE_FREE_FALL (IIO_EVENT_CODE_ACCEL_BASE + 6)
139 #define IIO_EVENT_ATTR_ACCEL_X_ROC_HIGH_SH(_evlist, _show, _store, _mask) \
140 IIO_EVENT_ATTR_SH(accel_x_roc_high, _evlist, _show, _store, _mask)
142 #define IIO_EVENT_CODE_ACCEL_X_ROC_HIGH (IIO_EVENT_CODE_ACCEL_BASE + 10)
144 #define IIO_EVENT_ATTR_ACCEL_X_ROC_LOW_SH(_evlist, _show, _store, _mask) \
145 IIO_EVENT_ATTR_SH(accel_x_roc_low, _evlist, _show, _store, _mask)
147 #define IIO_EVENT_CODE_ACCEL_X_ROC_LOW (IIO_EVENT_CODE_ACCEL_BASE + 11)
149 #define IIO_EVENT_ATTR_ACCEL_Y_ROC_HIGH_SH(_evlist, _show, _store, _mask) \
150 IIO_EVENT_ATTR_SH(accel_y_roc_high, _evlist, _show, _store, _mask)
152 #define IIO_EVENT_CODE_ACCEL_Y_ROC_HIGH (IIO_EVENT_CODE_ACCEL_BASE + 12)
154 #define IIO_EVENT_ATTR_ACCEL_Y_ROC_LOW_SH(_evlist, _show, _store, _mask) \
155 IIO_EVENT_ATTR_SH(accel_y_roc_low, _evlist, _show, _store, _mask)
157 #define IIO_EVENT_CODE_ACCEL_Y_ROC_LOW (IIO_EVENT_CODE_ACCEL_BASE + 13)
159 #define IIO_EVENT_ATTR_ACCEL_Z_ROC_HIGH_SH(_evlist, _show, _store, _mask) \
160 IIO_EVENT_ATTR_SH(accel_z_roc_high, _evlist, _show, _store, _mask)
162 #define IIO_EVENT_CODE_ACCEL_Z_ROC_HIGH (IIO_EVENT_CODE_ACCEL_BASE + 14)
164 #define IIO_EVENT_ATTR_ACCEL_Z_ROC_LOW_SH(_evlist, _show, _store, _mask) \
165 IIO_EVENT_ATTR_SH(accel_z_roc_low, _evlist, _show, _store, _mask)
167 #define IIO_EVENT_CODE_ACCEL_Z_ROC_LOW (IIO_EVENT_CODE_ACCEL_BASE + 15)