Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/linux
File: gpio.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
/*
[1] Fix | Delete
* <linux/gpio.h> - userspace ABI for the GPIO character devices
[2] Fix | Delete
*
[3] Fix | Delete
* Copyright (C) 2016 Linus Walleij
[4] Fix | Delete
*
[5] Fix | Delete
* This program is free software; you can redistribute it and/or modify it
[6] Fix | Delete
* under the terms of the GNU General Public License version 2 as published by
[7] Fix | Delete
* the Free Software Foundation.
[8] Fix | Delete
*/
[9] Fix | Delete
#ifndef _GPIO_H_
[10] Fix | Delete
#define _GPIO_H_
[11] Fix | Delete
[12] Fix | Delete
#include <linux/ioctl.h>
[13] Fix | Delete
#include <linux/types.h>
[14] Fix | Delete
[15] Fix | Delete
/**
[16] Fix | Delete
* struct gpiochip_info - Information about a certain GPIO chip
[17] Fix | Delete
* @name: the Linux kernel name of this GPIO chip
[18] Fix | Delete
* @label: a functional name for this GPIO chip, such as a product
[19] Fix | Delete
* number, may be NULL
[20] Fix | Delete
* @lines: number of GPIO lines on this chip
[21] Fix | Delete
*/
[22] Fix | Delete
struct gpiochip_info {
[23] Fix | Delete
char name[32];
[24] Fix | Delete
char label[32];
[25] Fix | Delete
__u32 lines;
[26] Fix | Delete
};
[27] Fix | Delete
[28] Fix | Delete
/* Informational flags */
[29] Fix | Delete
#define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */
[30] Fix | Delete
#define GPIOLINE_FLAG_IS_OUT (1UL << 1)
[31] Fix | Delete
#define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
[32] Fix | Delete
#define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3)
[33] Fix | Delete
#define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)
[34] Fix | Delete
#define GPIOLINE_FLAG_BIAS_PULL_UP (1UL << 5)
[35] Fix | Delete
#define GPIOLINE_FLAG_BIAS_PULL_DOWN (1UL << 6)
[36] Fix | Delete
#define GPIOLINE_FLAG_BIAS_DISABLE (1UL << 7)
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* struct gpioline_info - Information about a certain GPIO line
[40] Fix | Delete
* @line_offset: the local offset on this GPIO device, fill this in when
[41] Fix | Delete
* requesting the line information from the kernel
[42] Fix | Delete
* @flags: various flags for this line
[43] Fix | Delete
* @name: the name of this GPIO line, such as the output pin of the line on the
[44] Fix | Delete
* chip, a rail or a pin header name on a board, as specified by the gpio
[45] Fix | Delete
* chip, may be NULL
[46] Fix | Delete
* @consumer: a functional name for the consumer of this GPIO line as set by
[47] Fix | Delete
* whatever is using it, will be NULL if there is no current user but may
[48] Fix | Delete
* also be NULL if the consumer doesn't set this up
[49] Fix | Delete
*/
[50] Fix | Delete
struct gpioline_info {
[51] Fix | Delete
__u32 line_offset;
[52] Fix | Delete
__u32 flags;
[53] Fix | Delete
char name[32];
[54] Fix | Delete
char consumer[32];
[55] Fix | Delete
};
[56] Fix | Delete
[57] Fix | Delete
/* Maximum number of requested handles */
[58] Fix | Delete
#define GPIOHANDLES_MAX 64
[59] Fix | Delete
[60] Fix | Delete
/* Linerequest flags */
[61] Fix | Delete
#define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
[62] Fix | Delete
#define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
[63] Fix | Delete
#define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
[64] Fix | Delete
#define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
[65] Fix | Delete
#define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
[66] Fix | Delete
#define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5)
[67] Fix | Delete
#define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN (1UL << 6)
[68] Fix | Delete
#define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7)
[69] Fix | Delete
[70] Fix | Delete
/**
[71] Fix | Delete
* struct gpiohandle_request - Information about a GPIO handle request
[72] Fix | Delete
* @lineoffsets: an array desired lines, specified by offset index for the
[73] Fix | Delete
* associated GPIO device
[74] Fix | Delete
* @flags: desired flags for the desired GPIO lines, such as
[75] Fix | Delete
* GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed
[76] Fix | Delete
* together. Note that even if multiple lines are requested, the same flags
[77] Fix | Delete
* must be applicable to all of them, if you want lines with individual
[78] Fix | Delete
* flags set, request them one by one. It is possible to select
[79] Fix | Delete
* a batch of input or output lines, but they must all have the same
[80] Fix | Delete
* characteristics, i.e. all inputs or all outputs, all active low etc
[81] Fix | Delete
* @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set for a requested
[82] Fix | Delete
* line, this specifies the default output value, should be 0 (low) or
[83] Fix | Delete
* 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
[84] Fix | Delete
* @consumer_label: a desired consumer label for the selected GPIO line(s)
[85] Fix | Delete
* such as "my-bitbanged-relay"
[86] Fix | Delete
* @lines: number of lines requested in this request, i.e. the number of
[87] Fix | Delete
* valid fields in the above arrays, set to 1 to request a single line
[88] Fix | Delete
* @fd: if successful this field will contain a valid anonymous file handle
[89] Fix | Delete
* after a GPIO_GET_LINEHANDLE_IOCTL operation, zero or negative value
[90] Fix | Delete
* means error
[91] Fix | Delete
*/
[92] Fix | Delete
struct gpiohandle_request {
[93] Fix | Delete
__u32 lineoffsets[GPIOHANDLES_MAX];
[94] Fix | Delete
__u32 flags;
[95] Fix | Delete
__u8 default_values[GPIOHANDLES_MAX];
[96] Fix | Delete
char consumer_label[32];
[97] Fix | Delete
__u32 lines;
[98] Fix | Delete
int fd;
[99] Fix | Delete
};
[100] Fix | Delete
[101] Fix | Delete
/**
[102] Fix | Delete
* struct gpiohandle_config - Configuration for a GPIO handle request
[103] Fix | Delete
* @flags: updated flags for the requested GPIO lines, such as
[104] Fix | Delete
* GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed
[105] Fix | Delete
* together
[106] Fix | Delete
* @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set in flags,
[107] Fix | Delete
* this specifies the default output value, should be 0 (low) or
[108] Fix | Delete
* 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
[109] Fix | Delete
* @padding: reserved for future use and should be zero filled
[110] Fix | Delete
*/
[111] Fix | Delete
struct gpiohandle_config {
[112] Fix | Delete
__u32 flags;
[113] Fix | Delete
__u8 default_values[GPIOHANDLES_MAX];
[114] Fix | Delete
__u32 padding[4]; /* padding for future use */
[115] Fix | Delete
};
[116] Fix | Delete
[117] Fix | Delete
#define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0a, struct gpiohandle_config)
[118] Fix | Delete
[119] Fix | Delete
/**
[120] Fix | Delete
* struct gpiohandle_data - Information of values on a GPIO handle
[121] Fix | Delete
* @values: when getting the state of lines this contains the current
[122] Fix | Delete
* state of a line, when setting the state of lines these should contain
[123] Fix | Delete
* the desired target state
[124] Fix | Delete
*/
[125] Fix | Delete
struct gpiohandle_data {
[126] Fix | Delete
__u8 values[GPIOHANDLES_MAX];
[127] Fix | Delete
};
[128] Fix | Delete
[129] Fix | Delete
#define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
[130] Fix | Delete
#define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
[131] Fix | Delete
[132] Fix | Delete
/* Eventrequest flags */
[133] Fix | Delete
#define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0)
[134] Fix | Delete
#define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1)
[135] Fix | Delete
#define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1))
[136] Fix | Delete
[137] Fix | Delete
/**
[138] Fix | Delete
* struct gpioevent_request - Information about a GPIO event request
[139] Fix | Delete
* @lineoffset: the desired line to subscribe to events from, specified by
[140] Fix | Delete
* offset index for the associated GPIO device
[141] Fix | Delete
* @handleflags: desired handle flags for the desired GPIO line, such as
[142] Fix | Delete
* GPIOHANDLE_REQUEST_ACTIVE_LOW or GPIOHANDLE_REQUEST_OPEN_DRAIN
[143] Fix | Delete
* @eventflags: desired flags for the desired GPIO event line, such as
[144] Fix | Delete
* GPIOEVENT_REQUEST_RISING_EDGE or GPIOEVENT_REQUEST_FALLING_EDGE
[145] Fix | Delete
* @consumer_label: a desired consumer label for the selected GPIO line(s)
[146] Fix | Delete
* such as "my-listener"
[147] Fix | Delete
* @fd: if successful this field will contain a valid anonymous file handle
[148] Fix | Delete
* after a GPIO_GET_LINEEVENT_IOCTL operation, zero or negative value
[149] Fix | Delete
* means error
[150] Fix | Delete
*/
[151] Fix | Delete
struct gpioevent_request {
[152] Fix | Delete
__u32 lineoffset;
[153] Fix | Delete
__u32 handleflags;
[154] Fix | Delete
__u32 eventflags;
[155] Fix | Delete
char consumer_label[32];
[156] Fix | Delete
int fd;
[157] Fix | Delete
};
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* GPIO event types
[161] Fix | Delete
*/
[162] Fix | Delete
#define GPIOEVENT_EVENT_RISING_EDGE 0x01
[163] Fix | Delete
#define GPIOEVENT_EVENT_FALLING_EDGE 0x02
[164] Fix | Delete
[165] Fix | Delete
/**
[166] Fix | Delete
* struct gpioevent_data - The actual event being pushed to userspace
[167] Fix | Delete
* @timestamp: best estimate of time of event occurrence, in nanoseconds
[168] Fix | Delete
* @id: event identifier
[169] Fix | Delete
*/
[170] Fix | Delete
struct gpioevent_data {
[171] Fix | Delete
__u64 timestamp;
[172] Fix | Delete
__u32 id;
[173] Fix | Delete
};
[174] Fix | Delete
[175] Fix | Delete
#define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
[176] Fix | Delete
#define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
[177] Fix | Delete
#define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
[178] Fix | Delete
#define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
[179] Fix | Delete
[180] Fix | Delete
#endif /* _GPIO_H_ */
[181] Fix | Delete
[182] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function