Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
0002 /*
0003  * <linux/gpio.h> - userspace ABI for the GPIO character devices
0004  *
0005  * Copyright (C) 2016 Linus Walleij
0006  *
0007  * This program is free software; you can redistribute it and/or modify it
0008  * under the terms of the GNU General Public License version 2 as published by
0009  * the Free Software Foundation.
0010  */
0011 #ifndef _UAPI_GPIO_H_
0012 #define _UAPI_GPIO_H_
0013 
0014 #include <linux/const.h>
0015 #include <linux/ioctl.h>
0016 #include <linux/types.h>
0017 
0018 /*
0019  * The maximum size of name and label arrays.
0020  *
0021  * Must be a multiple of 8 to ensure 32/64-bit alignment of structs.
0022  */
0023 #define GPIO_MAX_NAME_SIZE 32
0024 
0025 /**
0026  * struct gpiochip_info - Information about a certain GPIO chip
0027  * @name: the Linux kernel name of this GPIO chip
0028  * @label: a functional name for this GPIO chip, such as a product
0029  * number, may be empty (i.e. label[0] == '\0')
0030  * @lines: number of GPIO lines on this chip
0031  */
0032 struct gpiochip_info {
0033     char name[GPIO_MAX_NAME_SIZE];
0034     char label[GPIO_MAX_NAME_SIZE];
0035     __u32 lines;
0036 };
0037 
0038 /*
0039  * Maximum number of requested lines.
0040  *
0041  * Must be no greater than 64, as bitmaps are restricted here to 64-bits
0042  * for simplicity, and a multiple of 2 to ensure 32/64-bit alignment of
0043  * structs.
0044  */
0045 #define GPIO_V2_LINES_MAX 64
0046 
0047 /*
0048  * The maximum number of configuration attributes associated with a line
0049  * request.
0050  */
0051 #define GPIO_V2_LINE_NUM_ATTRS_MAX 10
0052 
0053 /**
0054  * enum gpio_v2_line_flag - &struct gpio_v2_line_attribute.flags values
0055  * @GPIO_V2_LINE_FLAG_USED: line is not available for request
0056  * @GPIO_V2_LINE_FLAG_ACTIVE_LOW: line active state is physical low
0057  * @GPIO_V2_LINE_FLAG_INPUT: line is an input
0058  * @GPIO_V2_LINE_FLAG_OUTPUT: line is an output
0059  * @GPIO_V2_LINE_FLAG_EDGE_RISING: line detects rising (inactive to active)
0060  * edges
0061  * @GPIO_V2_LINE_FLAG_EDGE_FALLING: line detects falling (active to
0062  * inactive) edges
0063  * @GPIO_V2_LINE_FLAG_OPEN_DRAIN: line is an open drain output
0064  * @GPIO_V2_LINE_FLAG_OPEN_SOURCE: line is an open source output
0065  * @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled
0066  * @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled
0067  * @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled
0068  * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME: line events contain REALTIME timestamps
0069  * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE: line events contain timestamps from
0070  * hardware timestamp engine
0071  */
0072 enum gpio_v2_line_flag {
0073     GPIO_V2_LINE_FLAG_USED          = _BITULL(0),
0074     GPIO_V2_LINE_FLAG_ACTIVE_LOW        = _BITULL(1),
0075     GPIO_V2_LINE_FLAG_INPUT         = _BITULL(2),
0076     GPIO_V2_LINE_FLAG_OUTPUT        = _BITULL(3),
0077     GPIO_V2_LINE_FLAG_EDGE_RISING       = _BITULL(4),
0078     GPIO_V2_LINE_FLAG_EDGE_FALLING      = _BITULL(5),
0079     GPIO_V2_LINE_FLAG_OPEN_DRAIN        = _BITULL(6),
0080     GPIO_V2_LINE_FLAG_OPEN_SOURCE       = _BITULL(7),
0081     GPIO_V2_LINE_FLAG_BIAS_PULL_UP      = _BITULL(8),
0082     GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN    = _BITULL(9),
0083     GPIO_V2_LINE_FLAG_BIAS_DISABLED     = _BITULL(10),
0084     GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME  = _BITULL(11),
0085     GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE   = _BITULL(12),
0086 };
0087 
0088 /**
0089  * struct gpio_v2_line_values - Values of GPIO lines
0090  * @bits: a bitmap containing the value of the lines, set to 1 for active
0091  * and 0 for inactive.
0092  * @mask: a bitmap identifying the lines to get or set, with each bit
0093  * number corresponding to the index into &struct
0094  * gpio_v2_line_request.offsets.
0095  */
0096 struct gpio_v2_line_values {
0097     __aligned_u64 bits;
0098     __aligned_u64 mask;
0099 };
0100 
0101 /**
0102  * enum gpio_v2_line_attr_id - &struct gpio_v2_line_attribute.id values
0103  * identifying which field of the attribute union is in use.
0104  * @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use
0105  * @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use
0106  * @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us field is in use
0107  */
0108 enum gpio_v2_line_attr_id {
0109     GPIO_V2_LINE_ATTR_ID_FLAGS      = 1,
0110     GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES  = 2,
0111     GPIO_V2_LINE_ATTR_ID_DEBOUNCE       = 3,
0112 };
0113 
0114 /**
0115  * struct gpio_v2_line_attribute - a configurable attribute of a line
0116  * @id: attribute identifier with value from &enum gpio_v2_line_attr_id
0117  * @padding: reserved for future use and must be zero filled
0118  * @flags: if id is %GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO
0119  * line, with values from &enum gpio_v2_line_flag, such as
0120  * %GPIO_V2_LINE_FLAG_ACTIVE_LOW, %GPIO_V2_LINE_FLAG_OUTPUT etc, added
0121  * together.  This overrides the default flags contained in the &struct
0122  * gpio_v2_line_config for the associated line.
0123  * @values: if id is %GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap
0124  * containing the values to which the lines will be set, with each bit
0125  * number corresponding to the index into &struct
0126  * gpio_v2_line_request.offsets.
0127  * @debounce_period_us: if id is %GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the
0128  * desired debounce period, in microseconds
0129  */
0130 struct gpio_v2_line_attribute {
0131     __u32 id;
0132     __u32 padding;
0133     union {
0134         __aligned_u64 flags;
0135         __aligned_u64 values;
0136         __u32 debounce_period_us;
0137     };
0138 };
0139 
0140 /**
0141  * struct gpio_v2_line_config_attribute - a configuration attribute
0142  * associated with one or more of the requested lines.
0143  * @attr: the configurable attribute
0144  * @mask: a bitmap identifying the lines to which the attribute applies,
0145  * with each bit number corresponding to the index into &struct
0146  * gpio_v2_line_request.offsets.
0147  */
0148 struct gpio_v2_line_config_attribute {
0149     struct gpio_v2_line_attribute attr;
0150     __aligned_u64 mask;
0151 };
0152 
0153 /**
0154  * struct gpio_v2_line_config - Configuration for GPIO lines
0155  * @flags: flags for the GPIO lines, with values from &enum
0156  * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
0157  * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together.  This is the default for
0158  * all requested lines but may be overridden for particular lines using
0159  * @attrs.
0160  * @num_attrs: the number of attributes in @attrs
0161  * @padding: reserved for future use and must be zero filled
0162  * @attrs: the configuration attributes associated with the requested
0163  * lines.  Any attribute should only be associated with a particular line
0164  * once.  If an attribute is associated with a line multiple times then the
0165  * first occurrence (i.e. lowest index) has precedence.
0166  */
0167 struct gpio_v2_line_config {
0168     __aligned_u64 flags;
0169     __u32 num_attrs;
0170     /* Pad to fill implicit padding and reserve space for future use. */
0171     __u32 padding[5];
0172     struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
0173 };
0174 
0175 /**
0176  * struct gpio_v2_line_request - Information about a request for GPIO lines
0177  * @offsets: an array of desired lines, specified by offset index for the
0178  * associated GPIO chip
0179  * @consumer: a desired consumer label for the selected GPIO lines such as
0180  * "my-bitbanged-relay"
0181  * @config: requested configuration for the lines.
0182  * @num_lines: number of lines requested in this request, i.e. the number
0183  * of valid fields in the %GPIO_V2_LINES_MAX sized arrays, set to 1 to
0184  * request a single line
0185  * @event_buffer_size: a suggested minimum number of line events that the
0186  * kernel should buffer.  This is only relevant if edge detection is
0187  * enabled in the configuration. Note that this is only a suggested value
0188  * and the kernel may allocate a larger buffer or cap the size of the
0189  * buffer. If this field is zero then the buffer size defaults to a minimum
0190  * of @num_lines * 16.
0191  * @padding: reserved for future use and must be zero filled
0192  * @fd: if successful this field will contain a valid anonymous file handle
0193  * after a %GPIO_GET_LINE_IOCTL operation, zero or negative value means
0194  * error
0195  */
0196 struct gpio_v2_line_request {
0197     __u32 offsets[GPIO_V2_LINES_MAX];
0198     char consumer[GPIO_MAX_NAME_SIZE];
0199     struct gpio_v2_line_config config;
0200     __u32 num_lines;
0201     __u32 event_buffer_size;
0202     /* Pad to fill implicit padding and reserve space for future use. */
0203     __u32 padding[5];
0204     __s32 fd;
0205 };
0206 
0207 /**
0208  * struct gpio_v2_line_info - Information about a certain GPIO line
0209  * @name: the name of this GPIO line, such as the output pin of the line on
0210  * the chip, a rail or a pin header name on a board, as specified by the
0211  * GPIO chip, may be empty (i.e. name[0] == '\0')
0212  * @consumer: a functional name for the consumer of this GPIO line as set
0213  * by whatever is using it, will be empty if there is no current user but
0214  * may also be empty if the consumer doesn't set this up
0215  * @offset: the local offset on this GPIO chip, fill this in when
0216  * requesting the line information from the kernel
0217  * @num_attrs: the number of attributes in @attrs
0218  * @flags: flags for this GPIO line, with values from &enum
0219  * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
0220  * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together.
0221  * @attrs: the configuration attributes associated with the line
0222  * @padding: reserved for future use
0223  */
0224 struct gpio_v2_line_info {
0225     char name[GPIO_MAX_NAME_SIZE];
0226     char consumer[GPIO_MAX_NAME_SIZE];
0227     __u32 offset;
0228     __u32 num_attrs;
0229     __aligned_u64 flags;
0230     struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
0231     /* Space reserved for future use. */
0232     __u32 padding[4];
0233 };
0234 
0235 /**
0236  * enum gpio_v2_line_changed_type - &struct gpio_v2_line_changed.event_type
0237  * values
0238  * @GPIO_V2_LINE_CHANGED_REQUESTED: line has been requested
0239  * @GPIO_V2_LINE_CHANGED_RELEASED: line has been released
0240  * @GPIO_V2_LINE_CHANGED_CONFIG: line has been reconfigured
0241  */
0242 enum gpio_v2_line_changed_type {
0243     GPIO_V2_LINE_CHANGED_REQUESTED  = 1,
0244     GPIO_V2_LINE_CHANGED_RELEASED   = 2,
0245     GPIO_V2_LINE_CHANGED_CONFIG = 3,
0246 };
0247 
0248 /**
0249  * struct gpio_v2_line_info_changed - Information about a change in status
0250  * of a GPIO line
0251  * @info: updated line information
0252  * @timestamp_ns: estimate of time of status change occurrence, in nanoseconds
0253  * @event_type: the type of change with a value from &enum
0254  * gpio_v2_line_changed_type
0255  * @padding: reserved for future use
0256  */
0257 struct gpio_v2_line_info_changed {
0258     struct gpio_v2_line_info info;
0259     __aligned_u64 timestamp_ns;
0260     __u32 event_type;
0261     /* Pad struct to 64-bit boundary and reserve space for future use. */
0262     __u32 padding[5];
0263 };
0264 
0265 /**
0266  * enum gpio_v2_line_event_id - &struct gpio_v2_line_event.id values
0267  * @GPIO_V2_LINE_EVENT_RISING_EDGE: event triggered by a rising edge
0268  * @GPIO_V2_LINE_EVENT_FALLING_EDGE: event triggered by a falling edge
0269  */
0270 enum gpio_v2_line_event_id {
0271     GPIO_V2_LINE_EVENT_RISING_EDGE  = 1,
0272     GPIO_V2_LINE_EVENT_FALLING_EDGE = 2,
0273 };
0274 
0275 /**
0276  * struct gpio_v2_line_event - The actual event being pushed to userspace
0277  * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds.
0278  * @id: event identifier with value from &enum gpio_v2_line_event_id
0279  * @offset: the offset of the line that triggered the event
0280  * @seqno: the sequence number for this event in the sequence of events for
0281  * all the lines in this line request
0282  * @line_seqno: the sequence number for this event in the sequence of
0283  * events on this particular line
0284  * @padding: reserved for future use
0285  *
0286  * By default the @timestamp_ns is read from %CLOCK_MONOTONIC and is
0287  * intended to allow the accurate measurement of the time between events.
0288  * It does not provide the wall-clock time.
0289  *
0290  * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag is set then the
0291  * @timestamp_ns is read from %CLOCK_REALTIME.
0292  */
0293 struct gpio_v2_line_event {
0294     __aligned_u64 timestamp_ns;
0295     __u32 id;
0296     __u32 offset;
0297     __u32 seqno;
0298     __u32 line_seqno;
0299     /* Space reserved for future use. */
0300     __u32 padding[6];
0301 };
0302 
0303 /*
0304  * ABI v1
0305  *
0306  * This version of the ABI is deprecated.
0307  * Use the latest version of the ABI, defined above, instead.
0308  */
0309 
0310 /* Informational flags */
0311 #define GPIOLINE_FLAG_KERNEL        (1UL << 0) /* Line used by the kernel */
0312 #define GPIOLINE_FLAG_IS_OUT        (1UL << 1)
0313 #define GPIOLINE_FLAG_ACTIVE_LOW    (1UL << 2)
0314 #define GPIOLINE_FLAG_OPEN_DRAIN    (1UL << 3)
0315 #define GPIOLINE_FLAG_OPEN_SOURCE   (1UL << 4)
0316 #define GPIOLINE_FLAG_BIAS_PULL_UP  (1UL << 5)
0317 #define GPIOLINE_FLAG_BIAS_PULL_DOWN    (1UL << 6)
0318 #define GPIOLINE_FLAG_BIAS_DISABLE  (1UL << 7)
0319 
0320 /**
0321  * struct gpioline_info - Information about a certain GPIO line
0322  * @line_offset: the local offset on this GPIO device, fill this in when
0323  * requesting the line information from the kernel
0324  * @flags: various flags for this line
0325  * @name: the name of this GPIO line, such as the output pin of the line on the
0326  * chip, a rail or a pin header name on a board, as specified by the gpio
0327  * chip, may be empty (i.e. name[0] == '\0')
0328  * @consumer: a functional name for the consumer of this GPIO line as set by
0329  * whatever is using it, will be empty if there is no current user but may
0330  * also be empty if the consumer doesn't set this up
0331  *
0332  * Note: This struct is part of ABI v1 and is deprecated.
0333  * Use &struct gpio_v2_line_info instead.
0334  */
0335 struct gpioline_info {
0336     __u32 line_offset;
0337     __u32 flags;
0338     char name[GPIO_MAX_NAME_SIZE];
0339     char consumer[GPIO_MAX_NAME_SIZE];
0340 };
0341 
0342 /* Maximum number of requested handles */
0343 #define GPIOHANDLES_MAX 64
0344 
0345 /* Possible line status change events */
0346 enum {
0347     GPIOLINE_CHANGED_REQUESTED = 1,
0348     GPIOLINE_CHANGED_RELEASED,
0349     GPIOLINE_CHANGED_CONFIG,
0350 };
0351 
0352 /**
0353  * struct gpioline_info_changed - Information about a change in status
0354  * of a GPIO line
0355  * @info: updated line information
0356  * @timestamp: estimate of time of status change occurrence, in nanoseconds
0357  * @event_type: one of %GPIOLINE_CHANGED_REQUESTED,
0358  * %GPIOLINE_CHANGED_RELEASED and %GPIOLINE_CHANGED_CONFIG
0359  * @padding: reserved for future use
0360  *
0361  * The &struct gpioline_info embedded here has 32-bit alignment on its own,
0362  * but it works fine with 64-bit alignment too. With its 72 byte size, we can
0363  * guarantee there are no implicit holes between it and subsequent members.
0364  * The 20-byte padding at the end makes sure we don't add any implicit padding
0365  * at the end of the structure on 64-bit architectures.
0366  *
0367  * Note: This struct is part of ABI v1 and is deprecated.
0368  * Use &struct gpio_v2_line_info_changed instead.
0369  */
0370 struct gpioline_info_changed {
0371     struct gpioline_info info;
0372     __u64 timestamp;
0373     __u32 event_type;
0374     __u32 padding[5]; /* for future use */
0375 };
0376 
0377 /* Linerequest flags */
0378 #define GPIOHANDLE_REQUEST_INPUT    (1UL << 0)
0379 #define GPIOHANDLE_REQUEST_OUTPUT   (1UL << 1)
0380 #define GPIOHANDLE_REQUEST_ACTIVE_LOW   (1UL << 2)
0381 #define GPIOHANDLE_REQUEST_OPEN_DRAIN   (1UL << 3)
0382 #define GPIOHANDLE_REQUEST_OPEN_SOURCE  (1UL << 4)
0383 #define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5)
0384 #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN   (1UL << 6)
0385 #define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7)
0386 
0387 /**
0388  * struct gpiohandle_request - Information about a GPIO handle request
0389  * @lineoffsets: an array of desired lines, specified by offset index for the
0390  * associated GPIO device
0391  * @flags: desired flags for the desired GPIO lines, such as
0392  * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
0393  * together. Note that even if multiple lines are requested, the same flags
0394  * must be applicable to all of them, if you want lines with individual
0395  * flags set, request them one by one. It is possible to select
0396  * a batch of input or output lines, but they must all have the same
0397  * characteristics, i.e. all inputs or all outputs, all active low etc
0398  * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
0399  * line, this specifies the default output value, should be 0 (low) or
0400  * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
0401  * @consumer_label: a desired consumer label for the selected GPIO line(s)
0402  * such as "my-bitbanged-relay"
0403  * @lines: number of lines requested in this request, i.e. the number of
0404  * valid fields in the above arrays, set to 1 to request a single line
0405  * @fd: if successful this field will contain a valid anonymous file handle
0406  * after a %GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value
0407  * means error
0408  *
0409  * Note: This struct is part of ABI v1 and is deprecated.
0410  * Use &struct gpio_v2_line_request instead.
0411  */
0412 struct gpiohandle_request {
0413     __u32 lineoffsets[GPIOHANDLES_MAX];
0414     __u32 flags;
0415     __u8 default_values[GPIOHANDLES_MAX];
0416     char consumer_label[GPIO_MAX_NAME_SIZE];
0417     __u32 lines;
0418     int fd;
0419 };
0420 
0421 /**
0422  * struct gpiohandle_config - Configuration for a GPIO handle request
0423  * @flags: updated flags for the requested GPIO lines, such as
0424  * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
0425  * together
0426  * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags,
0427  * this specifies the default output value, should be 0 (low) or
0428  * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
0429  * @padding: reserved for future use and should be zero filled
0430  *
0431  * Note: This struct is part of ABI v1 and is deprecated.
0432  * Use &struct gpio_v2_line_config instead.
0433  */
0434 struct gpiohandle_config {
0435     __u32 flags;
0436     __u8 default_values[GPIOHANDLES_MAX];
0437     __u32 padding[4]; /* padding for future use */
0438 };
0439 
0440 /**
0441  * struct gpiohandle_data - Information of values on a GPIO handle
0442  * @values: when getting the state of lines this contains the current
0443  * state of a line, when setting the state of lines these should contain
0444  * the desired target state
0445  *
0446  * Note: This struct is part of ABI v1 and is deprecated.
0447  * Use &struct gpio_v2_line_values instead.
0448  */
0449 struct gpiohandle_data {
0450     __u8 values[GPIOHANDLES_MAX];
0451 };
0452 
0453 /* Eventrequest flags */
0454 #define GPIOEVENT_REQUEST_RISING_EDGE   (1UL << 0)
0455 #define GPIOEVENT_REQUEST_FALLING_EDGE  (1UL << 1)
0456 #define GPIOEVENT_REQUEST_BOTH_EDGES    ((1UL << 0) | (1UL << 1))
0457 
0458 /**
0459  * struct gpioevent_request - Information about a GPIO event request
0460  * @lineoffset: the desired line to subscribe to events from, specified by
0461  * offset index for the associated GPIO device
0462  * @handleflags: desired handle flags for the desired GPIO line, such as
0463  * %GPIOHANDLE_REQUEST_ACTIVE_LOW or %GPIOHANDLE_REQUEST_OPEN_DRAIN
0464  * @eventflags: desired flags for the desired GPIO event line, such as
0465  * %GPIOEVENT_REQUEST_RISING_EDGE or %GPIOEVENT_REQUEST_FALLING_EDGE
0466  * @consumer_label: a desired consumer label for the selected GPIO line(s)
0467  * such as "my-listener"
0468  * @fd: if successful this field will contain a valid anonymous file handle
0469  * after a %GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value
0470  * means error
0471  *
0472  * Note: This struct is part of ABI v1 and is deprecated.
0473  * Use &struct gpio_v2_line_request instead.
0474  */
0475 struct gpioevent_request {
0476     __u32 lineoffset;
0477     __u32 handleflags;
0478     __u32 eventflags;
0479     char consumer_label[GPIO_MAX_NAME_SIZE];
0480     int fd;
0481 };
0482 
0483 /*
0484  * GPIO event types
0485  */
0486 #define GPIOEVENT_EVENT_RISING_EDGE 0x01
0487 #define GPIOEVENT_EVENT_FALLING_EDGE 0x02
0488 
0489 /**
0490  * struct gpioevent_data - The actual event being pushed to userspace
0491  * @timestamp: best estimate of time of event occurrence, in nanoseconds
0492  * @id: event identifier
0493  *
0494  * Note: This struct is part of ABI v1 and is deprecated.
0495  * Use &struct gpio_v2_line_event instead.
0496  */
0497 struct gpioevent_data {
0498     __u64 timestamp;
0499     __u32 id;
0500 };
0501 
0502 /*
0503  * v1 and v2 ioctl()s
0504  */
0505 #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
0506 #define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, __u32)
0507 
0508 /*
0509  * v2 ioctl()s
0510  */
0511 #define GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct gpio_v2_line_info)
0512 #define GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct gpio_v2_line_info)
0513 #define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request)
0514 #define GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct gpio_v2_line_config)
0515 #define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
0516 #define GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct gpio_v2_line_values)
0517 
0518 /*
0519  * v1 ioctl()s
0520  *
0521  * These ioctl()s are deprecated.  Use the v2 equivalent instead.
0522  */
0523 #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
0524 #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
0525 #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
0526 #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
0527 #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
0528 #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct gpiohandle_config)
0529 #define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct gpioline_info)
0530 
0531 #endif /* _UAPI_GPIO_H_ */