Debian Codegraph @

lib/uapi/gpio.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */cxx . . $ `<file>/lib/uapi/gpio.h`/
2 /*
3 * <linux/gpio.h> - userspace ABI for the GPIO character devices
4 *
5 * Copyright (C) 2016 Linus Walleij
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
10 */
11 #ifndef _UAPI_GPIO_H_
12 #define _UAPI_GPIO_H_cxx . . $ `lib/uapi/gpio.h:12:9`!
13
14 #include <linux/const.h>
15 #include <linux/ioctl.h>
16 #include <linux/types.h>
17
18 /*
19 * The maximum size of name and label arrays.
20 *
21 * Must be a multiple of 8 to ensure 32/64-bit alignment of structs.
22 */
23 #define GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`! 32
24
25 /**
26 * struct gpiochip_info - Information about a certain GPIO chip
27 * @name: the Linux kernel name of this GPIO chip
28 * @label: a functional name for this GPIO chip, such as a product
29 * number, may be empty (i.e. label[0] == '\0')
30 * @lines: number of GPIO lines on this chip
31 */
32 struct gpiochip_infocxx . . $ gpiochip_info# {
33 char namecxx . . $ gpiochip_info#name.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
34 char labelcxx . . $ gpiochip_info#label.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
35 __u32cxx . . $ __u32# linescxx . . $ gpiochip_info#lines.;
36 };
37
38 /*
39 * Maximum number of requested lines.
40 *
41 * Must be no greater than 64, as bitmaps are restricted here to 64-bits
42 * for simplicity, and a multiple of 2 to ensure 32/64-bit alignment of
43 * structs.
44 */
45 #define GPIO_V2_LINES_MAXcxx . . $ `lib/uapi/gpio.h:45:9`! 64
46
47 /*
48 * The maximum number of configuration attributes associated with a line
49 * request.
50 */
51 #define GPIO_V2_LINE_NUM_ATTRS_MAXcxx . . $ `lib/uapi/gpio.h:51:9`! 10
52
53 /**
54 * enum gpio_v2_line_flag - &struct gpio_v2_line_attribute.flags values
55 * @GPIO_V2_LINE_FLAG_USED: line is not available for request
56 * @GPIO_V2_LINE_FLAG_ACTIVE_LOW: line active state is physical low
57 * @GPIO_V2_LINE_FLAG_INPUT: line is an input
58 * @GPIO_V2_LINE_FLAG_OUTPUT: line is an output
59 * @GPIO_V2_LINE_FLAG_EDGE_RISING: line detects rising (inactive to active)
60 * edges
61 * @GPIO_V2_LINE_FLAG_EDGE_FALLING: line detects falling (active to
62 * inactive) edges
63 * @GPIO_V2_LINE_FLAG_OPEN_DRAIN: line is an open drain output
64 * @GPIO_V2_LINE_FLAG_OPEN_SOURCE: line is an open source output
65 * @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled
66 * @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled
67 * @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled
68 * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME: line events contain REALTIME timestamps
69 * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE: line events contain timestamps from
70 * hardware timestamp engine
71 */
72 enum gpio_v2_line_flagcxx . . $ gpio_v2_line_flag# {
73 GPIO_V2_LINE_FLAG_USEDcxx . . $ GPIO_V2_LINE_FLAG_USED. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(0),
74 GPIO_V2_LINE_FLAG_ACTIVE_LOWcxx . . $ GPIO_V2_LINE_FLAG_ACTIVE_LOW. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(1),
75 GPIO_V2_LINE_FLAG_INPUTcxx . . $ GPIO_V2_LINE_FLAG_INPUT. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(2),
76 GPIO_V2_LINE_FLAG_OUTPUTcxx . . $ GPIO_V2_LINE_FLAG_OUTPUT. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(3),
77 GPIO_V2_LINE_FLAG_EDGE_RISINGcxx . . $ GPIO_V2_LINE_FLAG_EDGE_RISING. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(4),
78 GPIO_V2_LINE_FLAG_EDGE_FALLINGcxx . . $ GPIO_V2_LINE_FLAG_EDGE_FALLING. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(5),
79 GPIO_V2_LINE_FLAG_OPEN_DRAINcxx . . $ GPIO_V2_LINE_FLAG_OPEN_DRAIN. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(6),
80 GPIO_V2_LINE_FLAG_OPEN_SOURCEcxx . . $ GPIO_V2_LINE_FLAG_OPEN_SOURCE. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(7),
81 GPIO_V2_LINE_FLAG_BIAS_PULL_UPcxx . . $ GPIO_V2_LINE_FLAG_BIAS_PULL_UP. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(8),
82 GPIO_V2_LINE_FLAG_BIAS_PULL_DOWNcxx . . $ GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(9),
83 GPIO_V2_LINE_FLAG_BIAS_DISABLEDcxx . . $ GPIO_V2_LINE_FLAG_BIAS_DISABLED. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(10),
84 GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIMEcxx . . $ GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(11),
85 GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTEcxx . . $ GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE. = _BITULLcxx . . $ `<external>/6741057015114754088/const.h:29:9`!(12),
86 };
87
88 /**
89 * struct gpio_v2_line_values - Values of GPIO lines
90 * @bits: a bitmap containing the value of the lines, set to 1 for active
91 * and 0 for inactive.
92 * @mask: a bitmap identifying the lines to get or set, with each bit
93 * number corresponding to the index into &struct
94 * gpio_v2_line_request.offsets.
95 */
96 struct gpio_v2_line_valuescxx . . $ gpio_v2_line_values# {
97 __aligned_u64cxx . . $ __u64# bitscxx . . $ gpio_v2_line_values#bits.;
98 __aligned_u64cxx . . $ `<external>/18415469021366710567/types.h:50:9`! maskcxx . . $ gpio_v2_line_values#mask.;
99 };
100
101 /**
102 * enum gpio_v2_line_attr_id - &struct gpio_v2_line_attribute.id values
103 * identifying which field of the attribute union is in use.
104 * @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use
105 * @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use
106 * @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us field is in use
107 */
108 enum gpio_v2_line_attr_idcxx . . $ gpio_v2_line_attr_id# {
109 GPIO_V2_LINE_ATTR_ID_FLAGScxx . . $ GPIO_V2_LINE_ATTR_ID_FLAGS. = 1,
110 GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUEScxx . . $ GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES. = 2,
111 GPIO_V2_LINE_ATTR_ID_DEBOUNCEcxx . . $ GPIO_V2_LINE_ATTR_ID_DEBOUNCE. = 3,
112 };
113
114 /**
115 * struct gpio_v2_line_attribute - a configurable attribute of a line
116 * @id: attribute identifier with value from &enum gpio_v2_line_attr_id
117 * @padding: reserved for future use and must be zero filled
118 * @flags: if id is %GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO
119 * line, with values from &enum gpio_v2_line_flag, such as
120 * %GPIO_V2_LINE_FLAG_ACTIVE_LOW, %GPIO_V2_LINE_FLAG_OUTPUT etc, added
121 * together. This overrides the default flags contained in the &struct
122 * gpio_v2_line_config for the associated line.
123 * @values: if id is %GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap
124 * containing the values to which the lines will be set, with each bit
125 * number corresponding to the index into &struct
126 * gpio_v2_line_request.offsets.
127 * @debounce_period_us: if id is %GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the
128 * desired debounce period, in microseconds
129 */
130 struct gpio_v2_line_attributecxx . . $ gpio_v2_line_attribute# {
131 __u32cxx . . $ __u32# idcxx . . $ gpio_v2_line_attribute#id.;
132 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_attribute#padding.;
133 unioncxx . . $ gpio_v2_line_attribute#$anonymous_type_0# {
134 __aligned_u64cxx . . $ `<external>/18415469021366710567/types.h:50:9`! flagscxx . . $ gpio_v2_line_attribute#$anonymous_type_0#flags.;
135 __aligned_u64cxx . . $ `<external>/18415469021366710567/types.h:50:9`! valuescxx . . $ gpio_v2_line_attribute#$anonymous_type_0#values.;
136 __u32cxx . . $ __u32# debounce_period_uscxx . . $ gpio_v2_line_attribute#$anonymous_type_0#debounce_period_us.;
137 };
138 };
139
140 /**
141 * struct gpio_v2_line_config_attribute - a configuration attribute
142 * associated with one or more of the requested lines.
143 * @attr: the configurable attribute
144 * @mask: a bitmap identifying the lines to which the attribute applies,
145 * with each bit number corresponding to the index into &struct
146 * gpio_v2_line_request.offsets.
147 */
148 struct gpio_v2_line_config_attributecxx . . $ gpio_v2_line_config_attribute# {
149 struct gpio_v2_line_attributecxx . . $ gpio_v2_line_attribute# attrcxx . . $ gpio_v2_line_config_attribute#attr.;
150 __aligned_u64cxx . . $ __u64# maskcxx . . $ gpio_v2_line_config_attribute#mask.;
151 };
152
153 /**
154 * struct gpio_v2_line_config - Configuration for GPIO lines
155 * @flags: flags for the GPIO lines, with values from &enum
156 * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
157 * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together. This is the default for
158 * all requested lines but may be overridden for particular lines using
159 * @attrs.
160 * @num_attrs: the number of attributes in @attrs
161 * @padding: reserved for future use and must be zero filled
162 * @attrs: the configuration attributes associated with the requested
163 * lines. Any attribute should only be associated with a particular line
164 * once. If an attribute is associated with a line multiple times then the
165 * first occurrence (i.e. lowest index) has precedence.
166 */
167 struct gpio_v2_line_configcxx . . $ gpio_v2_line_config# {
168 __aligned_u64cxx . . $ __u64# flagscxx . . $ gpio_v2_line_config#flags.;
169 __u32cxx . . $ __u32# num_attrscxx . . $ gpio_v2_line_config#num_attrs.;
170 /* Pad to fill implicit padding and reserve space for future use. */
171 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_config#padding.[5];
172 struct gpio_v2_line_config_attributecxx . . $ gpio_v2_line_config_attribute# attrscxx . . $ gpio_v2_line_config#attrs.[GPIO_V2_LINE_NUM_ATTRS_MAXcxx . . $ `lib/uapi/gpio.h:51:9`!];
173 };
174
175 /**
176 * struct gpio_v2_line_request - Information about a request for GPIO lines
177 * @offsets: an array of desired lines, specified by offset index for the
178 * associated GPIO chip
179 * @consumer: a desired consumer label for the selected GPIO lines such as
180 * "my-bitbanged-relay"
181 * @config: requested configuration for the lines.
182 * @num_lines: number of lines requested in this request, i.e. the number
183 * of valid fields in the %GPIO_V2_LINES_MAX sized arrays, set to 1 to
184 * request a single line
185 * @event_buffer_size: a suggested minimum number of line events that the
186 * kernel should buffer. This is only relevant if edge detection is
187 * enabled in the configuration. Note that this is only a suggested value
188 * and the kernel may allocate a larger buffer or cap the size of the
189 * buffer. If this field is zero then the buffer size defaults to a minimum
190 * of @num_lines * 16.
191 * @padding: reserved for future use and must be zero filled
192 * @fd: if successful this field will contain a valid anonymous file handle
193 * after a %GPIO_GET_LINE_IOCTL operation, zero or negative value means
194 * error
195 */
196 struct gpio_v2_line_requestcxx . . $ gpio_v2_line_request# {
197 __u32cxx . . $ __u32# offsetscxx . . $ gpio_v2_line_request#offsets.[GPIO_V2_LINES_MAXcxx . . $ `lib/uapi/gpio.h:45:9`!];
198 char consumercxx . . $ gpio_v2_line_request#consumer.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
199 struct gpio_v2_line_configcxx . . $ gpio_v2_line_config# configcxx . . $ gpio_v2_line_request#config.;
200 __u32cxx . . $ __u32# num_linescxx . . $ gpio_v2_line_request#num_lines.;
201 __u32cxx . . $ __u32# event_buffer_sizecxx . . $ gpio_v2_line_request#event_buffer_size.;
202 /* Pad to fill implicit padding and reserve space for future use. */
203 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_request#padding.[5];
204 __s32cxx . . $ __s32# fdcxx . . $ gpio_v2_line_request#fd.;
205 };
206
207 /**
208 * struct gpio_v2_line_info - Information about a certain GPIO line
209 * @name: the name of this GPIO line, such as the output pin of the line on
210 * the chip, a rail or a pin header name on a board, as specified by the
211 * GPIO chip, may be empty (i.e. name[0] == '\0')
212 * @consumer: a functional name for the consumer of this GPIO line as set
213 * by whatever is using it, will be empty if there is no current user but
214 * may also be empty if the consumer doesn't set this up
215 * @offset: the local offset on this GPIO chip, fill this in when
216 * requesting the line information from the kernel
217 * @num_attrs: the number of attributes in @attrs
218 * @flags: flags for this GPIO line, with values from &enum
219 * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
220 * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together.
221 * @attrs: the configuration attributes associated with the line
222 * @padding: reserved for future use
223 */
224 struct gpio_v2_line_infocxx . . $ gpio_v2_line_info# {
225 char namecxx . . $ gpio_v2_line_info#name.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
226 char consumercxx . . $ gpio_v2_line_info#consumer.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
227 __u32cxx . . $ __u32# offsetcxx . . $ gpio_v2_line_info#offset.;
228 __u32cxx . . $ __u32# num_attrscxx . . $ gpio_v2_line_info#num_attrs.;
229 __aligned_u64cxx . . $ __u64# flagscxx . . $ gpio_v2_line_info#flags.;
230 struct gpio_v2_line_attributecxx . . $ gpio_v2_line_attribute# attrscxx . . $ gpio_v2_line_info#attrs.[GPIO_V2_LINE_NUM_ATTRS_MAXcxx . . $ `lib/uapi/gpio.h:51:9`!];
231 /* Space reserved for future use. */
232 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_info#padding.[4];
233 };
234
235 /**
236 * enum gpio_v2_line_changed_type - &struct gpio_v2_line_changed.event_type
237 * values
238 * @GPIO_V2_LINE_CHANGED_REQUESTED: line has been requested
239 * @GPIO_V2_LINE_CHANGED_RELEASED: line has been released
240 * @GPIO_V2_LINE_CHANGED_CONFIG: line has been reconfigured
241 */
242 enum gpio_v2_line_changed_typecxx . . $ gpio_v2_line_changed_type# {
243 GPIO_V2_LINE_CHANGED_REQUESTEDcxx . . $ GPIO_V2_LINE_CHANGED_REQUESTED. = 1,
244 GPIO_V2_LINE_CHANGED_RELEASEDcxx . . $ GPIO_V2_LINE_CHANGED_RELEASED. = 2,
245 GPIO_V2_LINE_CHANGED_CONFIGcxx . . $ GPIO_V2_LINE_CHANGED_CONFIG. = 3,
246 };
247
248 /**
249 * struct gpio_v2_line_info_changed - Information about a change in status
250 * of a GPIO line
251 * @info: updated line information
252 * @timestamp_ns: estimate of time of status change occurrence, in nanoseconds
253 * @event_type: the type of change with a value from &enum
254 * gpio_v2_line_changed_type
255 * @padding: reserved for future use
256 */
257 struct gpio_v2_line_info_changedcxx . . $ gpio_v2_line_info_changed# {
258 struct gpio_v2_line_infocxx . . $ gpio_v2_line_info# infocxx . . $ gpio_v2_line_info_changed#info.;
259 __aligned_u64cxx . . $ __u64# timestamp_nscxx . . $ gpio_v2_line_info_changed#timestamp_ns.;
260 __u32cxx . . $ __u32# event_typecxx . . $ gpio_v2_line_info_changed#event_type.;
261 /* Pad struct to 64-bit boundary and reserve space for future use. */
262 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_info_changed#padding.[5];
263 };
264
265 /**
266 * enum gpio_v2_line_event_id - &struct gpio_v2_line_event.id values
267 * @GPIO_V2_LINE_EVENT_RISING_EDGE: event triggered by a rising edge
268 * @GPIO_V2_LINE_EVENT_FALLING_EDGE: event triggered by a falling edge
269 */
270 enum gpio_v2_line_event_idcxx . . $ gpio_v2_line_event_id# {
271 GPIO_V2_LINE_EVENT_RISING_EDGEcxx . . $ GPIO_V2_LINE_EVENT_RISING_EDGE. = 1,
272 GPIO_V2_LINE_EVENT_FALLING_EDGEcxx . . $ GPIO_V2_LINE_EVENT_FALLING_EDGE. = 2,
273 };
274
275 /**
276 * struct gpio_v2_line_event - The actual event being pushed to userspace
277 * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds.
278 * @id: event identifier with value from &enum gpio_v2_line_event_id
279 * @offset: the offset of the line that triggered the event
280 * @seqno: the sequence number for this event in the sequence of events for
281 * all the lines in this line request
282 * @line_seqno: the sequence number for this event in the sequence of
283 * events on this particular line
284 * @padding: reserved for future use
285 *
286 * By default the @timestamp_ns is read from %CLOCK_MONOTONIC and is
287 * intended to allow the accurate measurement of the time between events.
288 * It does not provide the wall-clock time.
289 *
290 * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag is set then the
291 * @timestamp_ns is read from %CLOCK_REALTIME.
292 */
293 struct gpio_v2_line_eventcxx . . $ gpio_v2_line_event# {
294 __aligned_u64cxx . . $ `<external>/18415469021366710567/types.h:50:9`! timestamp_nscxx . . $ gpio_v2_line_event#timestamp_ns.;
295 __u32cxx . . $ __u32# idcxx . . $ gpio_v2_line_event#id.;
296 __u32cxx . . $ __u32# offsetcxx . . $ gpio_v2_line_event#offset.;
297 __u32cxx . . $ __u32# seqnocxx . . $ gpio_v2_line_event#seqno.;
298 __u32cxx . . $ __u32# line_seqnocxx . . $ gpio_v2_line_event#line_seqno.;
299 /* Space reserved for future use. */
300 __u32cxx . . $ __u32# paddingcxx . . $ gpio_v2_line_event#padding.[6];
301 };
302
303 /*
304 * ABI v1
305 *
306 * This version of the ABI is deprecated.
307 * Use the latest version of the ABI, defined above, instead.
308 */
309
310 /* Informational flags */
311 #define GPIOLINE_FLAG_KERNELcxx . . $ `lib/uapi/gpio.h:311:9`! (1UL << 0) /* Line used by the kernel */
312 #define GPIOLINE_FLAG_IS_OUTcxx . . $ `lib/uapi/gpio.h:312:9`! (1UL << 1)
313 #define GPIOLINE_FLAG_ACTIVE_LOWcxx . . $ `lib/uapi/gpio.h:313:9`! (1UL << 2)
314 #define GPIOLINE_FLAG_OPEN_DRAINcxx . . $ `lib/uapi/gpio.h:314:9`! (1UL << 3)
315 #define GPIOLINE_FLAG_OPEN_SOURCEcxx . . $ `lib/uapi/gpio.h:315:9`! (1UL << 4)
316 #define GPIOLINE_FLAG_BIAS_PULL_UPcxx . . $ `lib/uapi/gpio.h:316:9`! (1UL << 5)
317 #define GPIOLINE_FLAG_BIAS_PULL_DOWNcxx . . $ `lib/uapi/gpio.h:317:9`! (1UL << 6)
318 #define GPIOLINE_FLAG_BIAS_DISABLEcxx . . $ `lib/uapi/gpio.h:318:9`! (1UL << 7)
319
320 /**
321 * struct gpioline_info - Information about a certain GPIO line
322 * @line_offset: the local offset on this GPIO device, fill this in when
323 * requesting the line information from the kernel
324 * @flags: various flags for this line
325 * @name: the name of this GPIO line, such as the output pin of the line on the
326 * chip, a rail or a pin header name on a board, as specified by the gpio
327 * chip, may be empty (i.e. name[0] == '\0')
328 * @consumer: a functional name for the consumer of this GPIO line as set by
329 * whatever is using it, will be empty if there is no current user but may
330 * also be empty if the consumer doesn't set this up
331 *
332 * Note: This struct is part of ABI v1 and is deprecated.
333 * Use &struct gpio_v2_line_info instead.
334 */
335 struct gpioline_infocxx . . $ gpioline_info# {
336 __u32cxx . . $ __u32# line_offsetcxx . . $ gpioline_info#line_offset.;
337 __u32cxx . . $ __u32# flagscxx . . $ gpioline_info#flags.;
338 char namecxx . . $ gpioline_info#name.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
339 char consumercxx . . $ gpioline_info#consumer.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
340 };
341
342 /* Maximum number of requested handles */
343 #define GPIOHANDLES_MAXcxx . . $ `lib/uapi/gpio.h:343:9`! 64
344
345 /* Possible line status change events */
346 enumcxx . . $ $anonymous_type_5aa5a6ba81b2afa9_1# {
347 GPIOLINE_CHANGED_REQUESTEDcxx . . $ GPIOLINE_CHANGED_REQUESTED. = 1,
348 GPIOLINE_CHANGED_RELEASEDcxx . . $ GPIOLINE_CHANGED_RELEASED.,
349 GPIOLINE_CHANGED_CONFIGcxx . . $ GPIOLINE_CHANGED_CONFIG.,
350 };
351
352 /**
353 * struct gpioline_info_changed - Information about a change in status
354 * of a GPIO line
355 * @info: updated line information
356 * @timestamp: estimate of time of status change occurrence, in nanoseconds
357 * @event_type: one of %GPIOLINE_CHANGED_REQUESTED,
358 * %GPIOLINE_CHANGED_RELEASED and %GPIOLINE_CHANGED_CONFIG
359 * @padding: reserved for future use
360 *
361 * The &struct gpioline_info embedded here has 32-bit alignment on its own,
362 * but it works fine with 64-bit alignment too. With its 72 byte size, we can
363 * guarantee there are no implicit holes between it and subsequent members.
364 * The 20-byte padding at the end makes sure we don't add any implicit padding
365 * at the end of the structure on 64-bit architectures.
366 *
367 * Note: This struct is part of ABI v1 and is deprecated.
368 * Use &struct gpio_v2_line_info_changed instead.
369 */
370 struct gpioline_info_changedcxx . . $ gpioline_info_changed# {
371 struct gpioline_infocxx . . $ gpioline_info# infocxx . . $ gpioline_info_changed#info.;
372 __u64cxx . . $ __u64# timestampcxx . . $ gpioline_info_changed#timestamp.;
373 __u32cxx . . $ __u32# event_typecxx . . $ gpioline_info_changed#event_type.;
374 __u32cxx . . $ __u32# paddingcxx . . $ gpioline_info_changed#padding.[5]; /* for future use */
375 };
376
377 /* Linerequest flags */
378 #define GPIOHANDLE_REQUEST_INPUTcxx . . $ `lib/uapi/gpio.h:378:9`! (1UL << 0)
379 #define GPIOHANDLE_REQUEST_OUTPUTcxx . . $ `lib/uapi/gpio.h:379:9`! (1UL << 1)
380 #define GPIOHANDLE_REQUEST_ACTIVE_LOWcxx . . $ `lib/uapi/gpio.h:380:9`! (1UL << 2)
381 #define GPIOHANDLE_REQUEST_OPEN_DRAINcxx . . $ `lib/uapi/gpio.h:381:9`! (1UL << 3)
382 #define GPIOHANDLE_REQUEST_OPEN_SOURCEcxx . . $ `lib/uapi/gpio.h:382:9`! (1UL << 4)
383 #define GPIOHANDLE_REQUEST_BIAS_PULL_UPcxx . . $ `lib/uapi/gpio.h:383:9`! (1UL << 5)
384 #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWNcxx . . $ `lib/uapi/gpio.h:384:9`! (1UL << 6)
385 #define GPIOHANDLE_REQUEST_BIAS_DISABLEcxx . . $ `lib/uapi/gpio.h:385:9`! (1UL << 7)
386
387 /**
388 * struct gpiohandle_request - Information about a GPIO handle request
389 * @lineoffsets: an array of desired lines, specified by offset index for the
390 * associated GPIO device
391 * @flags: desired flags for the desired GPIO lines, such as
392 * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
393 * together. Note that even if multiple lines are requested, the same flags
394 * must be applicable to all of them, if you want lines with individual
395 * flags set, request them one by one. It is possible to select
396 * a batch of input or output lines, but they must all have the same
397 * characteristics, i.e. all inputs or all outputs, all active low etc
398 * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
399 * line, this specifies the default output value, should be 0 (low) or
400 * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
401 * @consumer_label: a desired consumer label for the selected GPIO line(s)
402 * such as "my-bitbanged-relay"
403 * @lines: number of lines requested in this request, i.e. the number of
404 * valid fields in the above arrays, set to 1 to request a single line
405 * @fd: if successful this field will contain a valid anonymous file handle
406 * after a %GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value
407 * means error
408 *
409 * Note: This struct is part of ABI v1 and is deprecated.
410 * Use &struct gpio_v2_line_request instead.
411 */
412 struct gpiohandle_requestcxx . . $ gpiohandle_request# {
413 __u32cxx . . $ __u32# lineoffsetscxx . . $ gpiohandle_request#lineoffsets.[GPIOHANDLES_MAXcxx . . $ `lib/uapi/gpio.h:343:9`!];
414 __u32cxx . . $ __u32# flagscxx . . $ gpiohandle_request#flags.;
415 __u8cxx . . $ __u8# default_valuescxx . . $ gpiohandle_request#default_values.[GPIOHANDLES_MAXcxx . . $ `lib/uapi/gpio.h:343:9`!];
416 char consumer_labelcxx . . $ gpiohandle_request#consumer_label.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
417 __u32cxx . . $ __u32# linescxx . . $ gpiohandle_request#lines.;
418 int fdcxx . . $ gpiohandle_request#fd.;
419 };
420
421 /**
422 * struct gpiohandle_config - Configuration for a GPIO handle request
423 * @flags: updated flags for the requested GPIO lines, such as
424 * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
425 * together
426 * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags,
427 * this specifies the default output value, should be 0 (low) or
428 * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
429 * @padding: reserved for future use and should be zero filled
430 *
431 * Note: This struct is part of ABI v1 and is deprecated.
432 * Use &struct gpio_v2_line_config instead.
433 */
434 struct gpiohandle_configcxx . . $ gpiohandle_config# {
435 __u32cxx . . $ __u32# flagscxx . . $ gpiohandle_config#flags.;
436 __u8cxx . . $ __u8# default_valuescxx . . $ gpiohandle_config#default_values.[GPIOHANDLES_MAXcxx . . $ `lib/uapi/gpio.h:343:9`!];
437 __u32cxx . . $ __u32# paddingcxx . . $ gpiohandle_config#padding.[4]; /* padding for future use */
438 };
439
440 /**
441 * struct gpiohandle_data - Information of values on a GPIO handle
442 * @values: when getting the state of lines this contains the current
443 * state of a line, when setting the state of lines these should contain
444 * the desired target state
445 *
446 * Note: This struct is part of ABI v1 and is deprecated.
447 * Use &struct gpio_v2_line_values instead.
448 */
449 struct gpiohandle_datacxx . . $ gpiohandle_data# {
450 __u8cxx . . $ __u8# valuescxx . . $ gpiohandle_data#values.[GPIOHANDLES_MAXcxx . . $ `lib/uapi/gpio.h:343:9`!];
451 };
452
453 /* Eventrequest flags */
454 #define GPIOEVENT_REQUEST_RISING_EDGEcxx . . $ `lib/uapi/gpio.h:454:9`! (1UL << 0)
455 #define GPIOEVENT_REQUEST_FALLING_EDGEcxx . . $ `lib/uapi/gpio.h:455:9`! (1UL << 1)
456 #define GPIOEVENT_REQUEST_BOTH_EDGEScxx . . $ `lib/uapi/gpio.h:456:9`! ((1UL << 0) | (1UL << 1))
457
458 /**
459 * struct gpioevent_request - Information about a GPIO event request
460 * @lineoffset: the desired line to subscribe to events from, specified by
461 * offset index for the associated GPIO device
462 * @handleflags: desired handle flags for the desired GPIO line, such as
463 * %GPIOHANDLE_REQUEST_ACTIVE_LOW or %GPIOHANDLE_REQUEST_OPEN_DRAIN
464 * @eventflags: desired flags for the desired GPIO event line, such as
465 * %GPIOEVENT_REQUEST_RISING_EDGE or %GPIOEVENT_REQUEST_FALLING_EDGE
466 * @consumer_label: a desired consumer label for the selected GPIO line(s)
467 * such as "my-listener"
468 * @fd: if successful this field will contain a valid anonymous file handle
469 * after a %GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value
470 * means error
471 *
472 * Note: This struct is part of ABI v1 and is deprecated.
473 * Use &struct gpio_v2_line_request instead.
474 */
475 struct gpioevent_requestcxx . . $ gpioevent_request# {
476 __u32cxx . . $ __u32# lineoffsetcxx . . $ gpioevent_request#lineoffset.;
477 __u32cxx . . $ __u32# handleflagscxx . . $ gpioevent_request#handleflags.;
478 __u32cxx . . $ __u32# eventflagscxx . . $ gpioevent_request#eventflags.;
479 char consumer_labelcxx . . $ gpioevent_request#consumer_label.[GPIO_MAX_NAME_SIZEcxx . . $ `lib/uapi/gpio.h:23:9`!];
480 int fdcxx . . $ gpioevent_request#fd.;
481 };
482
483 /*
484 * GPIO event types
485 */
486 #define GPIOEVENT_EVENT_RISING_EDGEcxx . . $ `lib/uapi/gpio.h:486:9`! 0x01
487 #define GPIOEVENT_EVENT_FALLING_EDGEcxx . . $ `lib/uapi/gpio.h:487:9`! 0x02
488
489 /**
490 * struct gpioevent_data - The actual event being pushed to userspace
491 * @timestamp: best estimate of time of event occurrence, in nanoseconds
492 * @id: event identifier
493 *
494 * Note: This struct is part of ABI v1 and is deprecated.
495 * Use &struct gpio_v2_line_event instead.
496 */
497 struct gpioevent_datacxx . . $ gpioevent_data# {
498 __u64cxx . . $ __u64# timestampcxx . . $ gpioevent_data#timestamp.;
499 __u32cxx . . $ __u32# idcxx . . $ gpioevent_data#id.;
500 };
501
502 /*
503 * v1 and v2 ioctl()s
504 */
505 #define GPIO_GET_CHIPINFO_IOCTLcxx . . $ `lib/uapi/gpio.h:505:9`! _IORcxx . . $ `<external>/9493957431124703620/ioctl.h:84:9`!(0xB4, 0x01, struct gpiochip_info)
506 #define GPIO_GET_LINEINFO_UNWATCH_IOCTLcxx . . $ `lib/uapi/gpio.h:506:9`! _IOWRcxx . . $ `<external>/9493957431124703620/ioctl.h:86:9`!(0xB4, 0x0C, __u32)
507
508 /*
509 * v2 ioctl()s
510 */
511 #define GPIO_V2_GET_LINEINFO_IOCTLcxx . . $ `lib/uapi/gpio.h:511:9`! _IOWRcxx . . $ `<external>/9493957431124703620/ioctl.h:86:9`!(0xB4, 0x05, struct gpio_v2_line_info)
512 #define GPIO_V2_GET_LINEINFO_WATCH_IOCTLcxx . . $ `lib/uapi/gpio.h:512:9`! _IOWRcxx . . $ `<external>/9493957431124703620/ioctl.h:86:9`!(0xB4, 0x06, struct gpio_v2_line_info)
513 #define GPIO_V2_GET_LINE_IOCTLcxx . . $ `lib/uapi/gpio.h:513:9`! _IOWRcxx . . $ `<external>/9493957431124703620/ioctl.h:86:9`!(0xB4, 0x07, struct gpio_v2_line_request)
514 #define GPIO_V2_LINE_SET_CONFIG_IOCTLcxx . . $ `lib/uapi/gpio.h:514:9`! _IOWR(0xB4, 0x0D, struct gpio_v2_line_config)
515 #define GPIO_V2_LINE_GET_VALUES_IOCTLcxx . . $ `lib/uapi/gpio.h:515:9`! _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
516 #define GPIO_V2_LINE_SET_VALUES_IOCTLcxx . . $ `lib/uapi/gpio.h:516:9`! _IOWR(0xB4, 0x0F, struct gpio_v2_line_values)
517
518 /*
519 * v1 ioctl()s
520 *
521 * These ioctl()s are deprecated. Use the v2 equivalent instead.
522 */
523 #define GPIO_GET_LINEINFO_IOCTLcxx . . $ `lib/uapi/gpio.h:523:9`! _IOWR(0xB4, 0x02, struct gpioline_info)
524 #define GPIO_GET_LINEHANDLE_IOCTLcxx . . $ `lib/uapi/gpio.h:524:9`! _IOWR(0xB4, 0x03, struct gpiohandle_request)
525 #define GPIO_GET_LINEEVENT_IOCTLcxx . . $ `lib/uapi/gpio.h:525:9`! _IOWR(0xB4, 0x04, struct gpioevent_request)
526 #define GPIOHANDLE_GET_LINE_VALUES_IOCTLcxx . . $ `lib/uapi/gpio.h:526:9`! _IOWR(0xB4, 0x08, struct gpiohandle_data)
527 #define GPIOHANDLE_SET_LINE_VALUES_IOCTLcxx . . $ `lib/uapi/gpio.h:527:9`! _IOWR(0xB4, 0x09, struct gpiohandle_data)
528 #define GPIOHANDLE_SET_CONFIG_IOCTLcxx . . $ `lib/uapi/gpio.h:528:9`! _IOWR(0xB4, 0x0A, struct gpiohandle_config)
529 #define GPIO_GET_LINEINFO_WATCH_IOCTLcxx . . $ `lib/uapi/gpio.h:529:9`! _IOWR(0xB4, 0x0B, struct gpioline_info)
530
531 #endif /* _UAPI_GPIO_H_ */