1*cda5da8dSAndroid Build Coastguard Worker /* 2*cda5da8dSAndroid Build Coastguard Worker * This file is auto-generated. Modifications will be lost. 3*cda5da8dSAndroid Build Coastguard Worker * 4*cda5da8dSAndroid Build Coastguard Worker * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ 5*cda5da8dSAndroid Build Coastguard Worker * for more information. 6*cda5da8dSAndroid Build Coastguard Worker */ 7*cda5da8dSAndroid Build Coastguard Worker #ifndef _UAPI_GPIO_H_ 8*cda5da8dSAndroid Build Coastguard Worker #define _UAPI_GPIO_H_ 9*cda5da8dSAndroid Build Coastguard Worker #include <linux/const.h> 10*cda5da8dSAndroid Build Coastguard Worker #include <linux/ioctl.h> 11*cda5da8dSAndroid Build Coastguard Worker #include <linux/types.h> 12*cda5da8dSAndroid Build Coastguard Worker #define GPIO_MAX_NAME_SIZE 32 13*cda5da8dSAndroid Build Coastguard Worker struct gpiochip_info { 14*cda5da8dSAndroid Build Coastguard Worker char name[GPIO_MAX_NAME_SIZE]; 15*cda5da8dSAndroid Build Coastguard Worker char label[GPIO_MAX_NAME_SIZE]; 16*cda5da8dSAndroid Build Coastguard Worker __u32 lines; 17*cda5da8dSAndroid Build Coastguard Worker }; 18*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_LINES_MAX 64 19*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_LINE_NUM_ATTRS_MAX 10 20*cda5da8dSAndroid Build Coastguard Worker enum gpio_v2_line_flag { 21*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_USED = _BITULL(0), 22*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL(1), 23*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_INPUT = _BITULL(2), 24*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_OUTPUT = _BITULL(3), 25*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_EDGE_RISING = _BITULL(4), 26*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_EDGE_FALLING = _BITULL(5), 27*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_OPEN_DRAIN = _BITULL(6), 28*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_OPEN_SOURCE = _BITULL(7), 29*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8), 30*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9), 31*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10), 32*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11), 33*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE = _BITULL(12), 34*cda5da8dSAndroid Build Coastguard Worker }; 35*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_values { 36*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 bits; 37*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 mask; 38*cda5da8dSAndroid Build Coastguard Worker }; 39*cda5da8dSAndroid Build Coastguard Worker enum gpio_v2_line_attr_id { 40*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_ATTR_ID_FLAGS = 1, 41*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2, 42*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3, 43*cda5da8dSAndroid Build Coastguard Worker }; 44*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_attribute { 45*cda5da8dSAndroid Build Coastguard Worker __u32 id; 46*cda5da8dSAndroid Build Coastguard Worker __u32 padding; 47*cda5da8dSAndroid Build Coastguard Worker union { 48*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 flags; 49*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 values; 50*cda5da8dSAndroid Build Coastguard Worker __u32 debounce_period_us; 51*cda5da8dSAndroid Build Coastguard Worker }; 52*cda5da8dSAndroid Build Coastguard Worker }; 53*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_config_attribute { 54*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_attribute attr; 55*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 mask; 56*cda5da8dSAndroid Build Coastguard Worker }; 57*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_config { 58*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 flags; 59*cda5da8dSAndroid Build Coastguard Worker __u32 num_attrs; 60*cda5da8dSAndroid Build Coastguard Worker __u32 padding[5]; 61*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX]; 62*cda5da8dSAndroid Build Coastguard Worker }; 63*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_request { 64*cda5da8dSAndroid Build Coastguard Worker __u32 offsets[GPIO_V2_LINES_MAX]; 65*cda5da8dSAndroid Build Coastguard Worker char consumer[GPIO_MAX_NAME_SIZE]; 66*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_config config; 67*cda5da8dSAndroid Build Coastguard Worker __u32 num_lines; 68*cda5da8dSAndroid Build Coastguard Worker __u32 event_buffer_size; 69*cda5da8dSAndroid Build Coastguard Worker __u32 padding[5]; 70*cda5da8dSAndroid Build Coastguard Worker __s32 fd; 71*cda5da8dSAndroid Build Coastguard Worker }; 72*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_info { 73*cda5da8dSAndroid Build Coastguard Worker char name[GPIO_MAX_NAME_SIZE]; 74*cda5da8dSAndroid Build Coastguard Worker char consumer[GPIO_MAX_NAME_SIZE]; 75*cda5da8dSAndroid Build Coastguard Worker __u32 offset; 76*cda5da8dSAndroid Build Coastguard Worker __u32 num_attrs; 77*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 flags; 78*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX]; 79*cda5da8dSAndroid Build Coastguard Worker __u32 padding[4]; 80*cda5da8dSAndroid Build Coastguard Worker }; 81*cda5da8dSAndroid Build Coastguard Worker enum gpio_v2_line_changed_type { 82*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_CHANGED_REQUESTED = 1, 83*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_CHANGED_RELEASED = 2, 84*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_CHANGED_CONFIG = 3, 85*cda5da8dSAndroid Build Coastguard Worker }; 86*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_info_changed { 87*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_info info; 88*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 timestamp_ns; 89*cda5da8dSAndroid Build Coastguard Worker __u32 event_type; 90*cda5da8dSAndroid Build Coastguard Worker __u32 padding[5]; 91*cda5da8dSAndroid Build Coastguard Worker }; 92*cda5da8dSAndroid Build Coastguard Worker enum gpio_v2_line_event_id { 93*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_EVENT_RISING_EDGE = 1, 94*cda5da8dSAndroid Build Coastguard Worker GPIO_V2_LINE_EVENT_FALLING_EDGE = 2, 95*cda5da8dSAndroid Build Coastguard Worker }; 96*cda5da8dSAndroid Build Coastguard Worker struct gpio_v2_line_event { 97*cda5da8dSAndroid Build Coastguard Worker __aligned_u64 timestamp_ns; 98*cda5da8dSAndroid Build Coastguard Worker __u32 id; 99*cda5da8dSAndroid Build Coastguard Worker __u32 offset; 100*cda5da8dSAndroid Build Coastguard Worker __u32 seqno; 101*cda5da8dSAndroid Build Coastguard Worker __u32 line_seqno; 102*cda5da8dSAndroid Build Coastguard Worker __u32 padding[6]; 103*cda5da8dSAndroid Build Coastguard Worker }; 104*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_KERNEL (1UL << 0) 105*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_IS_OUT (1UL << 1) 106*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2) 107*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3) 108*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4) 109*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_BIAS_PULL_UP (1UL << 5) 110*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_BIAS_PULL_DOWN (1UL << 6) 111*cda5da8dSAndroid Build Coastguard Worker #define GPIOLINE_FLAG_BIAS_DISABLE (1UL << 7) 112*cda5da8dSAndroid Build Coastguard Worker struct gpioline_info { 113*cda5da8dSAndroid Build Coastguard Worker __u32 line_offset; 114*cda5da8dSAndroid Build Coastguard Worker __u32 flags; 115*cda5da8dSAndroid Build Coastguard Worker char name[GPIO_MAX_NAME_SIZE]; 116*cda5da8dSAndroid Build Coastguard Worker char consumer[GPIO_MAX_NAME_SIZE]; 117*cda5da8dSAndroid Build Coastguard Worker }; 118*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLES_MAX 64 119*cda5da8dSAndroid Build Coastguard Worker enum { 120*cda5da8dSAndroid Build Coastguard Worker GPIOLINE_CHANGED_REQUESTED = 1, 121*cda5da8dSAndroid Build Coastguard Worker GPIOLINE_CHANGED_RELEASED, 122*cda5da8dSAndroid Build Coastguard Worker GPIOLINE_CHANGED_CONFIG, 123*cda5da8dSAndroid Build Coastguard Worker }; 124*cda5da8dSAndroid Build Coastguard Worker struct gpioline_info_changed { 125*cda5da8dSAndroid Build Coastguard Worker struct gpioline_info info; 126*cda5da8dSAndroid Build Coastguard Worker __u64 timestamp; 127*cda5da8dSAndroid Build Coastguard Worker __u32 event_type; 128*cda5da8dSAndroid Build Coastguard Worker __u32 padding[5]; 129*cda5da8dSAndroid Build Coastguard Worker }; 130*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_INPUT (1UL << 0) 131*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1) 132*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2) 133*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3) 134*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4) 135*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5) 136*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN (1UL << 6) 137*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7) 138*cda5da8dSAndroid Build Coastguard Worker struct gpiohandle_request { 139*cda5da8dSAndroid Build Coastguard Worker __u32 lineoffsets[GPIOHANDLES_MAX]; 140*cda5da8dSAndroid Build Coastguard Worker __u32 flags; 141*cda5da8dSAndroid Build Coastguard Worker __u8 default_values[GPIOHANDLES_MAX]; 142*cda5da8dSAndroid Build Coastguard Worker char consumer_label[GPIO_MAX_NAME_SIZE]; 143*cda5da8dSAndroid Build Coastguard Worker __u32 lines; 144*cda5da8dSAndroid Build Coastguard Worker int fd; 145*cda5da8dSAndroid Build Coastguard Worker }; 146*cda5da8dSAndroid Build Coastguard Worker struct gpiohandle_config { 147*cda5da8dSAndroid Build Coastguard Worker __u32 flags; 148*cda5da8dSAndroid Build Coastguard Worker __u8 default_values[GPIOHANDLES_MAX]; 149*cda5da8dSAndroid Build Coastguard Worker __u32 padding[4]; 150*cda5da8dSAndroid Build Coastguard Worker }; 151*cda5da8dSAndroid Build Coastguard Worker struct gpiohandle_data { 152*cda5da8dSAndroid Build Coastguard Worker __u8 values[GPIOHANDLES_MAX]; 153*cda5da8dSAndroid Build Coastguard Worker }; 154*cda5da8dSAndroid Build Coastguard Worker #define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0) 155*cda5da8dSAndroid Build Coastguard Worker #define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1) 156*cda5da8dSAndroid Build Coastguard Worker #define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1)) 157*cda5da8dSAndroid Build Coastguard Worker struct gpioevent_request { 158*cda5da8dSAndroid Build Coastguard Worker __u32 lineoffset; 159*cda5da8dSAndroid Build Coastguard Worker __u32 handleflags; 160*cda5da8dSAndroid Build Coastguard Worker __u32 eventflags; 161*cda5da8dSAndroid Build Coastguard Worker char consumer_label[GPIO_MAX_NAME_SIZE]; 162*cda5da8dSAndroid Build Coastguard Worker int fd; 163*cda5da8dSAndroid Build Coastguard Worker }; 164*cda5da8dSAndroid Build Coastguard Worker #define GPIOEVENT_EVENT_RISING_EDGE 0x01 165*cda5da8dSAndroid Build Coastguard Worker #define GPIOEVENT_EVENT_FALLING_EDGE 0x02 166*cda5da8dSAndroid Build Coastguard Worker struct gpioevent_data { 167*cda5da8dSAndroid Build Coastguard Worker __u64 timestamp; 168*cda5da8dSAndroid Build Coastguard Worker __u32 id; 169*cda5da8dSAndroid Build Coastguard Worker }; 170*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info) 171*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, __u32) 172*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct gpio_v2_line_info) 173*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct gpio_v2_line_info) 174*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request) 175*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct gpio_v2_line_config) 176*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values) 177*cda5da8dSAndroid Build Coastguard Worker #define GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct gpio_v2_line_values) 178*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info) 179*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request) 180*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request) 181*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data) 182*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data) 183*cda5da8dSAndroid Build Coastguard Worker #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct gpiohandle_config) 184*cda5da8dSAndroid Build Coastguard Worker #define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct gpioline_info) 185*cda5da8dSAndroid Build Coastguard Worker #endif 186