include/uapi/linux/gpio.h
Source file repositories/reference/linux-study-clean/include/uapi/linux/gpio.h
File Facts
- System
- Linux kernel
- Corpus path
include/uapi/linux/gpio.h- Extension
.h- Size
- 20312 bytes
- Lines
- 535
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/const.hlinux/ioctl.hlinux/types.h
Detected Declarations
struct gpiochip_infostruct gpio_v2_line_valuesstruct gpio_v2_line_attributestruct gpio_v2_line_config_attributestruct gpio_v2_line_configstruct gpio_v2_line_requeststruct gpio_v2_line_infostruct gpio_v2_line_info_changedstruct gpio_v2_line_eventstruct gpioline_infostruct gpioline_info_changedstruct gpiohandle_requeststruct gpiohandle_configstruct gpiohandle_datastruct gpioevent_requeststruct gpioevent_dataenum gpio_v2_line_flagenum gpio_v2_line_attr_idenum gpio_v2_line_changed_typeenum gpio_v2_line_event_id
Annotated Snippet
struct gpiochip_info {
char name[GPIO_MAX_NAME_SIZE];
char label[GPIO_MAX_NAME_SIZE];
__u32 lines;
};
/*
* Maximum number of requested lines.
*
* Must be no greater than 64, as bitmaps are restricted here to 64-bits
* for simplicity, and a multiple of 2 to ensure 32/64-bit alignment of
* structs.
*/
#define GPIO_V2_LINES_MAX 64
/*
* The maximum number of configuration attributes associated with a line
* request.
*/
#define GPIO_V2_LINE_NUM_ATTRS_MAX 10
/**
* enum gpio_v2_line_flag - &struct gpio_v2_line_attribute.flags values
* @GPIO_V2_LINE_FLAG_USED: line is not available for request
* @GPIO_V2_LINE_FLAG_ACTIVE_LOW: line active state is physical low
* @GPIO_V2_LINE_FLAG_INPUT: line is an input
* @GPIO_V2_LINE_FLAG_OUTPUT: line is an output
* @GPIO_V2_LINE_FLAG_EDGE_RISING: line detects rising (inactive to active)
* edges
* @GPIO_V2_LINE_FLAG_EDGE_FALLING: line detects falling (active to
* inactive) edges
* @GPIO_V2_LINE_FLAG_OPEN_DRAIN: line is an open drain output
* @GPIO_V2_LINE_FLAG_OPEN_SOURCE: line is an open source output
* @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled
* @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled
* @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled
* @GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME: line events contain REALTIME timestamps
* @GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE: line events contain timestamps from
* the hardware timestamping engine (HTE) subsystem
*/
enum gpio_v2_line_flag {
GPIO_V2_LINE_FLAG_USED = _BITULL(0),
GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL(1),
GPIO_V2_LINE_FLAG_INPUT = _BITULL(2),
GPIO_V2_LINE_FLAG_OUTPUT = _BITULL(3),
GPIO_V2_LINE_FLAG_EDGE_RISING = _BITULL(4),
GPIO_V2_LINE_FLAG_EDGE_FALLING = _BITULL(5),
GPIO_V2_LINE_FLAG_OPEN_DRAIN = _BITULL(6),
GPIO_V2_LINE_FLAG_OPEN_SOURCE = _BITULL(7),
GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),
GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11),
GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE = _BITULL(12),
};
/**
* struct gpio_v2_line_values - Values of GPIO lines
* @bits: a bitmap containing the value of the lines, set to 1 for active
* and 0 for inactive
* @mask: a bitmap identifying the lines to get or set, with each bit
* number corresponding to the index into &struct
* gpio_v2_line_request.offsets
*/
struct gpio_v2_line_values {
__aligned_u64 bits;
__aligned_u64 mask;
};
/**
* enum gpio_v2_line_attr_id - &struct gpio_v2_line_attribute.id values
* identifying which field of the attribute union is in use.
* @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use
* @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use
* @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us field is in use
*/
enum gpio_v2_line_attr_id {
GPIO_V2_LINE_ATTR_ID_FLAGS = 1,
GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2,
GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3,
};
/**
* struct gpio_v2_line_attribute - a configurable attribute of a line
* @id: attribute identifier with value from &enum gpio_v2_line_attr_id
* @padding: reserved for future use and must be zero filled
* @flags: if id is %GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO
* line, with values from &enum gpio_v2_line_flag, such as
* %GPIO_V2_LINE_FLAG_ACTIVE_LOW, %GPIO_V2_LINE_FLAG_OUTPUT etc, added
* together. This overrides the default flags contained in the &struct
Annotation
- Immediate include surface: `linux/const.h`, `linux/ioctl.h`, `linux/types.h`.
- Detected declarations: `struct gpiochip_info`, `struct gpio_v2_line_values`, `struct gpio_v2_line_attribute`, `struct gpio_v2_line_config_attribute`, `struct gpio_v2_line_config`, `struct gpio_v2_line_request`, `struct gpio_v2_line_info`, `struct gpio_v2_line_info_changed`, `struct gpio_v2_line_event`, `struct gpioline_info`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.