xref: /linux/include/uapi/linux/gpio.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
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_
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_SIZE 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_info {
33 	char name[GPIO_MAX_NAME_SIZE];
34 	char label[GPIO_MAX_NAME_SIZE];
35 	__u32 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_MAX 64
46 
47 /*
48  * The maximum number of configuration attributes associated with a line
49  * request.
50  */
51 #define GPIO_V2_LINE_NUM_ATTRS_MAX 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  * the hardware timestamping engine (HTE) subsystem
71  */
72 enum gpio_v2_line_flag {
73 	GPIO_V2_LINE_FLAG_USED			= _BITULL(0),
74 	GPIO_V2_LINE_FLAG_ACTIVE_LOW		= _BITULL(1),
75 	GPIO_V2_LINE_FLAG_INPUT			= _BITULL(2),
76 	GPIO_V2_LINE_FLAG_OUTPUT		= _BITULL(3),
77 	GPIO_V2_LINE_FLAG_EDGE_RISING		= _BITULL(4),
78 	GPIO_V2_LINE_FLAG_EDGE_FALLING		= _BITULL(5),
79 	GPIO_V2_LINE_FLAG_OPEN_DRAIN		= _BITULL(6),
80 	GPIO_V2_LINE_FLAG_OPEN_SOURCE		= _BITULL(7),
81 	GPIO_V2_LINE_FLAG_BIAS_PULL_UP		= _BITULL(8),
82 	GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN	= _BITULL(9),
83 	GPIO_V2_LINE_FLAG_BIAS_DISABLED		= _BITULL(10),
84 	GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME	= _BITULL(11),
85 	GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE	= _BITULL(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_values {
97 	__aligned_u64 bits;
98 	__aligned_u64 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_id {
109 	GPIO_V2_LINE_ATTR_ID_FLAGS		= 1,
110 	GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES	= 2,
111 	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_attribute {
131 	__u32 id;
132 	__u32 padding;
133 	union {
134 		__aligned_u64 flags;
135 		__aligned_u64 values;
136 		__u32 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_attribute {
149 	struct gpio_v2_line_attribute attr;
150 	__aligned_u64 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_config {
168 	__aligned_u64 flags;
169 	__u32 num_attrs;
170 	/* Pad to fill implicit padding and reserve space for future use. */
171 	__u32 padding[5];
172 	struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
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: after a successful %GPIO_V2_GET_LINE_IOCTL operation, contains
193  * a valid anonymous file descriptor representing the request
194  */
195 struct gpio_v2_line_request {
196 	__u32 offsets[GPIO_V2_LINES_MAX];
197 	char consumer[GPIO_MAX_NAME_SIZE];
198 	struct gpio_v2_line_config config;
199 	__u32 num_lines;
200 	__u32 event_buffer_size;
201 	/* Pad to fill implicit padding and reserve space for future use. */
202 	__u32 padding[5];
203 	__s32 fd;
204 };
205 
206 /**
207  * struct gpio_v2_line_info - Information about a certain GPIO line
208  * @name: the name of this GPIO line, such as the output pin of the line on
209  * the chip, a rail or a pin header name on a board, as specified by the
210  * GPIO chip, may be empty (i.e. name[0] == '\0')
211  * @consumer: a functional name for the consumer of this GPIO line as set
212  * by whatever is using it, will be empty if there is no current user but
213  * may also be empty if the consumer doesn't set this up
214  * @offset: the local offset on this GPIO chip, fill this in when
215  * requesting the line information from the kernel
216  * @num_attrs: the number of attributes in @attrs
217  * @flags: flags for this GPIO line, with values from &enum
218  * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
219  * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together
220  * @attrs: the configuration attributes associated with the line
221  * @padding: reserved for future use
222  */
223 struct gpio_v2_line_info {
224 	char name[GPIO_MAX_NAME_SIZE];
225 	char consumer[GPIO_MAX_NAME_SIZE];
226 	__u32 offset;
227 	__u32 num_attrs;
228 	__aligned_u64 flags;
229 	struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
230 	/* Space reserved for future use. */
231 	__u32 padding[4];
232 };
233 
234 /**
235  * enum gpio_v2_line_changed_type - &struct gpio_v2_line_changed.event_type
236  * values
237  * @GPIO_V2_LINE_CHANGED_REQUESTED: line has been requested
238  * @GPIO_V2_LINE_CHANGED_RELEASED: line has been released
239  * @GPIO_V2_LINE_CHANGED_CONFIG: line has been reconfigured
240  */
241 enum gpio_v2_line_changed_type {
242 	GPIO_V2_LINE_CHANGED_REQUESTED	= 1,
243 	GPIO_V2_LINE_CHANGED_RELEASED	= 2,
244 	GPIO_V2_LINE_CHANGED_CONFIG	= 3,
245 };
246 
247 /**
248  * struct gpio_v2_line_info_changed - Information about a change in status
249  * of a GPIO line
250  * @info: updated line information
251  * @timestamp_ns: estimate of time of status change occurrence, in nanoseconds
252  * @event_type: the type of change with a value from &enum
253  * gpio_v2_line_changed_type
254  * @padding: reserved for future use
255  */
256 struct gpio_v2_line_info_changed {
257 	struct gpio_v2_line_info info;
258 	__aligned_u64 timestamp_ns;
259 	__u32 event_type;
260 	/* Pad struct to 64-bit boundary and reserve space for future use. */
261 	__u32 padding[5];
262 };
263 
264 /**
265  * enum gpio_v2_line_event_id - &struct gpio_v2_line_event.id values
266  * @GPIO_V2_LINE_EVENT_RISING_EDGE: event triggered by a rising edge
267  * @GPIO_V2_LINE_EVENT_FALLING_EDGE: event triggered by a falling edge
268  */
269 enum gpio_v2_line_event_id {
270 	GPIO_V2_LINE_EVENT_RISING_EDGE	= 1,
271 	GPIO_V2_LINE_EVENT_FALLING_EDGE	= 2,
272 };
273 
274 /**
275  * struct gpio_v2_line_event - The actual event being pushed to userspace
276  * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds
277  * @id: event identifier with value from &enum gpio_v2_line_event_id
278  * @offset: the offset of the line that triggered the event
279  * @seqno: the sequence number for this event in the sequence of events for
280  * all the lines in this line request
281  * @line_seqno: the sequence number for this event in the sequence of
282  * events on this particular line
283  * @padding: reserved for future use
284  *
285  * By default the @timestamp_ns is read from %CLOCK_MONOTONIC and is
286  * intended to allow the accurate measurement of the time between events.
287  * It does not provide the wall-clock time.
288  *
289  * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag is set then the
290  * @timestamp_ns is read from %CLOCK_REALTIME.
291  *
292  * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag is set then the
293  * @timestamp_ns is provided by the hardware timestamping engine (HTE)
294  * subsystem.
295  */
296 struct gpio_v2_line_event {
297 	__aligned_u64 timestamp_ns;
298 	__u32 id;
299 	__u32 offset;
300 	__u32 seqno;
301 	__u32 line_seqno;
302 	/* Space reserved for future use. */
303 	__u32 padding[6];
304 };
305 
306 /*
307  * ABI v1
308  *
309  * This version of the ABI is deprecated.
310  * Use the latest version of the ABI, defined above, instead.
311  */
312 
313 /* Informational flags */
314 #define GPIOLINE_FLAG_KERNEL		(1UL << 0) /* Line used by the kernel */
315 #define GPIOLINE_FLAG_IS_OUT		(1UL << 1)
316 #define GPIOLINE_FLAG_ACTIVE_LOW	(1UL << 2)
317 #define GPIOLINE_FLAG_OPEN_DRAIN	(1UL << 3)
318 #define GPIOLINE_FLAG_OPEN_SOURCE	(1UL << 4)
319 #define GPIOLINE_FLAG_BIAS_PULL_UP	(1UL << 5)
320 #define GPIOLINE_FLAG_BIAS_PULL_DOWN	(1UL << 6)
321 #define GPIOLINE_FLAG_BIAS_DISABLE	(1UL << 7)
322 
323 /**
324  * struct gpioline_info - Information about a certain GPIO line
325  * @line_offset: the local offset on this GPIO device, fill this in when
326  * requesting the line information from the kernel
327  * @flags: various flags for this line
328  * @name: the name of this GPIO line, such as the output pin of the line on the
329  * chip, a rail or a pin header name on a board, as specified by the gpio
330  * chip, may be empty (i.e. name[0] == '\0')
331  * @consumer: a functional name for the consumer of this GPIO line as set by
332  * whatever is using it, will be empty if there is no current user but may
333  * also be empty if the consumer doesn't set this up
334  *
335  * Note: This struct is part of ABI v1 and is deprecated.
336  * Use ABI v2 and &struct gpio_v2_line_info instead.
337  */
338 struct gpioline_info {
339 	__u32 line_offset;
340 	__u32 flags;
341 	char name[GPIO_MAX_NAME_SIZE];
342 	char consumer[GPIO_MAX_NAME_SIZE];
343 };
344 
345 /* Maximum number of requested handles */
346 #define GPIOHANDLES_MAX 64
347 
348 /* Possible line status change events */
349 enum {
350 	GPIOLINE_CHANGED_REQUESTED = 1,
351 	GPIOLINE_CHANGED_RELEASED,
352 	GPIOLINE_CHANGED_CONFIG,
353 };
354 
355 /**
356  * struct gpioline_info_changed - Information about a change in status
357  * of a GPIO line
358  * @info: updated line information
359  * @timestamp: estimate of time of status change occurrence, in nanoseconds
360  * @event_type: one of %GPIOLINE_CHANGED_REQUESTED,
361  * %GPIOLINE_CHANGED_RELEASED and %GPIOLINE_CHANGED_CONFIG
362  * @padding: reserved for future use
363  *
364  * The &struct gpioline_info embedded here has 32-bit alignment on its own,
365  * but it works fine with 64-bit alignment too. With its 72 byte size, we can
366  * guarantee there are no implicit holes between it and subsequent members.
367  * The 20-byte padding at the end makes sure we don't add any implicit padding
368  * at the end of the structure on 64-bit architectures.
369  *
370  * Note: This struct is part of ABI v1 and is deprecated.
371  * Use ABI v2 and &struct gpio_v2_line_info_changed instead.
372  */
373 struct gpioline_info_changed {
374 	struct gpioline_info info;
375 	__u64 timestamp;
376 	__u32 event_type;
377 	__u32 padding[5]; /* for future use */
378 };
379 
380 /* Linerequest flags */
381 #define GPIOHANDLE_REQUEST_INPUT	(1UL << 0)
382 #define GPIOHANDLE_REQUEST_OUTPUT	(1UL << 1)
383 #define GPIOHANDLE_REQUEST_ACTIVE_LOW	(1UL << 2)
384 #define GPIOHANDLE_REQUEST_OPEN_DRAIN	(1UL << 3)
385 #define GPIOHANDLE_REQUEST_OPEN_SOURCE	(1UL << 4)
386 #define GPIOHANDLE_REQUEST_BIAS_PULL_UP	(1UL << 5)
387 #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN	(1UL << 6)
388 #define GPIOHANDLE_REQUEST_BIAS_DISABLE	(1UL << 7)
389 
390 /**
391  * struct gpiohandle_request - Information about a GPIO handle request
392  * @lineoffsets: an array of desired lines, specified by offset index for the
393  * associated GPIO device
394  * @flags: desired flags for the desired GPIO lines, such as
395  * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
396  * together. Note that even if multiple lines are requested, the same flags
397  * must be applicable to all of them, if you want lines with individual
398  * flags set, request them one by one. It is possible to select
399  * a batch of input or output lines, but they must all have the same
400  * characteristics, i.e. all inputs or all outputs, all active low etc
401  * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
402  * line, this specifies the default output value, should be 0 (inactive) or
403  * 1 (active).  Anything other than 0 or 1 will be interpreted as active.
404  * @consumer_label: a desired consumer label for the selected GPIO line(s)
405  * such as "my-bitbanged-relay"
406  * @lines: number of lines requested in this request, i.e. the number of
407  * valid fields in the above arrays, set to 1 to request a single line
408  * @fd: after a successful %GPIO_GET_LINEHANDLE_IOCTL operation, contains
409  * a valid anonymous file descriptor representing the request
410  *
411  * Note: This struct is part of ABI v1 and is deprecated.
412  * Use ABI v2 and &struct gpio_v2_line_request instead.
413  */
414 struct gpiohandle_request {
415 	__u32 lineoffsets[GPIOHANDLES_MAX];
416 	__u32 flags;
417 	__u8 default_values[GPIOHANDLES_MAX];
418 	char consumer_label[GPIO_MAX_NAME_SIZE];
419 	__u32 lines;
420 	int fd;
421 };
422 
423 /**
424  * struct gpiohandle_config - Configuration for a GPIO handle request
425  * @flags: updated flags for the requested GPIO lines, such as
426  * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
427  * together
428  * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags,
429  * this specifies the default output value, should be 0 (inactive) or
430  * 1 (active).  Anything other than 0 or 1 will be interpreted as active.
431  * @padding: reserved for future use and should be zero filled
432  *
433  * Note: This struct is part of ABI v1 and is deprecated.
434  * Use ABI v2 and &struct gpio_v2_line_config instead.
435  */
436 struct gpiohandle_config {
437 	__u32 flags;
438 	__u8 default_values[GPIOHANDLES_MAX];
439 	__u32 padding[4]; /* padding for future use */
440 };
441 
442 /**
443  * struct gpiohandle_data - Information of values on a GPIO handle
444  * @values: when getting the state of lines this contains the current
445  * state of a line, when setting the state of lines these should contain
446  * the desired target state.  States are 0 (inactive) or 1 (active).
447  * When setting, anything other than 0 or 1 will be interpreted as active.
448  *
449  * Note: This struct is part of ABI v1 and is deprecated.
450  * Use ABI v2 and &struct gpio_v2_line_values instead.
451  */
452 struct gpiohandle_data {
453 	__u8 values[GPIOHANDLES_MAX];
454 };
455 
456 /* Eventrequest flags */
457 #define GPIOEVENT_REQUEST_RISING_EDGE	(1UL << 0)
458 #define GPIOEVENT_REQUEST_FALLING_EDGE	(1UL << 1)
459 #define GPIOEVENT_REQUEST_BOTH_EDGES	((1UL << 0) | (1UL << 1))
460 
461 /**
462  * struct gpioevent_request - Information about a GPIO event request
463  * @lineoffset: the desired line to subscribe to events from, specified by
464  * offset index for the associated GPIO device
465  * @handleflags: desired handle flags for the desired GPIO line, such as
466  * %GPIOHANDLE_REQUEST_ACTIVE_LOW or %GPIOHANDLE_REQUEST_OPEN_DRAIN
467  * @eventflags: desired flags for the desired GPIO event line, such as
468  * %GPIOEVENT_REQUEST_RISING_EDGE or %GPIOEVENT_REQUEST_FALLING_EDGE
469  * @consumer_label: a desired consumer label for the selected GPIO line(s)
470  * such as "my-listener"
471  * @fd: after a successful %GPIO_GET_LINEEVENT_IOCTL operation, contains a
472  * valid anonymous file descriptor representing the request
473  *
474  * Note: This struct is part of ABI v1 and is deprecated.
475  * Use ABI v2 and &struct gpio_v2_line_request instead.
476  */
477 struct gpioevent_request {
478 	__u32 lineoffset;
479 	__u32 handleflags;
480 	__u32 eventflags;
481 	char consumer_label[GPIO_MAX_NAME_SIZE];
482 	int fd;
483 };
484 
485 /*
486  * GPIO event types
487  */
488 #define GPIOEVENT_EVENT_RISING_EDGE 0x01
489 #define GPIOEVENT_EVENT_FALLING_EDGE 0x02
490 
491 /**
492  * struct gpioevent_data - The actual event being pushed to userspace
493  * @timestamp: best estimate of time of event occurrence, in nanoseconds
494  * @id: event identifier, one of %GPIOEVENT_EVENT_RISING_EDGE or
495  *  %GPIOEVENT_EVENT_FALLING_EDGE
496  *
497  * Note: This struct is part of ABI v1 and is deprecated.
498  * Use ABI v2 and &struct gpio_v2_line_event instead.
499  */
500 struct gpioevent_data {
501 	__u64 timestamp;
502 	__u32 id;
503 };
504 
505 /*
506  * v1 and v2 ioctl()s
507  */
508 #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
509 #define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, __u32)
510 
511 /*
512  * v2 ioctl()s
513  */
514 #define GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct gpio_v2_line_info)
515 #define GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct gpio_v2_line_info)
516 #define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request)
517 #define GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct gpio_v2_line_config)
518 #define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
519 #define GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct gpio_v2_line_values)
520 
521 /*
522  * v1 ioctl()s
523  *
524  * These ioctl()s are deprecated.  Use the v2 equivalent instead.
525  */
526 #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
527 #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
528 #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
529 #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
530 #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
531 #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct gpiohandle_config)
532 #define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct gpioline_info)
533 
534 #endif /* _UAPI_GPIO_H_ */
535