logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

gpio.h (20297B)


  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 _GPIO_H_
  12. #define _GPIO_H_
  13. #include <linux/const.h>
  14. #include <linux/ioctl.h>
  15. #include <linux/types.h>
  16. /*
  17. * The maximum size of name and label arrays.
  18. *
  19. * Must be a multiple of 8 to ensure 32/64-bit alignment of structs.
  20. */
  21. #define GPIO_MAX_NAME_SIZE 32
  22. /**
  23. * struct gpiochip_info - Information about a certain GPIO chip
  24. * @name: the Linux kernel name of this GPIO chip
  25. * @label: a functional name for this GPIO chip, such as a product
  26. * number, may be empty (i.e. label[0] == '\0')
  27. * @lines: number of GPIO lines on this chip
  28. */
  29. struct gpiochip_info {
  30. char name[GPIO_MAX_NAME_SIZE];
  31. char label[GPIO_MAX_NAME_SIZE];
  32. __u32 lines;
  33. };
  34. /*
  35. * Maximum number of requested lines.
  36. *
  37. * Must be no greater than 64, as bitmaps are restricted here to 64-bits
  38. * for simplicity, and a multiple of 2 to ensure 32/64-bit alignment of
  39. * structs.
  40. */
  41. #define GPIO_V2_LINES_MAX 64
  42. /*
  43. * The maximum number of configuration attributes associated with a line
  44. * request.
  45. */
  46. #define GPIO_V2_LINE_NUM_ATTRS_MAX 10
  47. /**
  48. * enum gpio_v2_line_flag - &struct gpio_v2_line_attribute.flags values
  49. * @GPIO_V2_LINE_FLAG_USED: line is not available for request
  50. * @GPIO_V2_LINE_FLAG_ACTIVE_LOW: line active state is physical low
  51. * @GPIO_V2_LINE_FLAG_INPUT: line is an input
  52. * @GPIO_V2_LINE_FLAG_OUTPUT: line is an output
  53. * @GPIO_V2_LINE_FLAG_EDGE_RISING: line detects rising (inactive to active)
  54. * edges
  55. * @GPIO_V2_LINE_FLAG_EDGE_FALLING: line detects falling (active to
  56. * inactive) edges
  57. * @GPIO_V2_LINE_FLAG_OPEN_DRAIN: line is an open drain output
  58. * @GPIO_V2_LINE_FLAG_OPEN_SOURCE: line is an open source output
  59. * @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled
  60. * @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled
  61. * @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled
  62. * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME: line events contain REALTIME timestamps
  63. * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE: line events contain timestamps from
  64. * the hardware timestamping engine (HTE) subsystem
  65. */
  66. enum gpio_v2_line_flag {
  67. GPIO_V2_LINE_FLAG_USED = _BITULL(0),
  68. GPIO_V2_LINE_FLAG_ACTIVE_LOW = _BITULL(1),
  69. GPIO_V2_LINE_FLAG_INPUT = _BITULL(2),
  70. GPIO_V2_LINE_FLAG_OUTPUT = _BITULL(3),
  71. GPIO_V2_LINE_FLAG_EDGE_RISING = _BITULL(4),
  72. GPIO_V2_LINE_FLAG_EDGE_FALLING = _BITULL(5),
  73. GPIO_V2_LINE_FLAG_OPEN_DRAIN = _BITULL(6),
  74. GPIO_V2_LINE_FLAG_OPEN_SOURCE = _BITULL(7),
  75. GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),
  76. GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
  77. GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
  78. GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11),
  79. GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE = _BITULL(12),
  80. };
  81. /**
  82. * struct gpio_v2_line_values - Values of GPIO lines
  83. * @bits: a bitmap containing the value of the lines, set to 1 for active
  84. * and 0 for inactive
  85. * @mask: a bitmap identifying the lines to get or set, with each bit
  86. * number corresponding to the index into &struct
  87. * gpio_v2_line_request.offsets
  88. */
  89. struct gpio_v2_line_values {
  90. __aligned_u64 bits;
  91. __aligned_u64 mask;
  92. };
  93. /**
  94. * enum gpio_v2_line_attr_id - &struct gpio_v2_line_attribute.id values
  95. * identifying which field of the attribute union is in use.
  96. * @GPIO_V2_LINE_ATTR_ID_FLAGS: flags field is in use
  97. * @GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES: values field is in use
  98. * @GPIO_V2_LINE_ATTR_ID_DEBOUNCE: debounce_period_us field is in use
  99. */
  100. enum gpio_v2_line_attr_id {
  101. GPIO_V2_LINE_ATTR_ID_FLAGS = 1,
  102. GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES = 2,
  103. GPIO_V2_LINE_ATTR_ID_DEBOUNCE = 3,
  104. };
  105. /**
  106. * struct gpio_v2_line_attribute - a configurable attribute of a line
  107. * @id: attribute identifier with value from &enum gpio_v2_line_attr_id
  108. * @padding: reserved for future use and must be zero filled
  109. * @flags: if id is %GPIO_V2_LINE_ATTR_ID_FLAGS, the flags for the GPIO
  110. * line, with values from &enum gpio_v2_line_flag, such as
  111. * %GPIO_V2_LINE_FLAG_ACTIVE_LOW, %GPIO_V2_LINE_FLAG_OUTPUT etc, added
  112. * together. This overrides the default flags contained in the &struct
  113. * gpio_v2_line_config for the associated line.
  114. * @values: if id is %GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES, a bitmap
  115. * containing the values to which the lines will be set, with each bit
  116. * number corresponding to the index into &struct
  117. * gpio_v2_line_request.offsets
  118. * @debounce_period_us: if id is %GPIO_V2_LINE_ATTR_ID_DEBOUNCE, the
  119. * desired debounce period, in microseconds
  120. */
  121. struct gpio_v2_line_attribute {
  122. __u32 id;
  123. __u32 padding;
  124. union {
  125. __aligned_u64 flags;
  126. __aligned_u64 values;
  127. __u32 debounce_period_us;
  128. };
  129. };
  130. /**
  131. * struct gpio_v2_line_config_attribute - a configuration attribute
  132. * associated with one or more of the requested lines.
  133. * @attr: the configurable attribute
  134. * @mask: a bitmap identifying the lines to which the attribute applies,
  135. * with each bit number corresponding to the index into &struct
  136. * gpio_v2_line_request.offsets
  137. */
  138. struct gpio_v2_line_config_attribute {
  139. struct gpio_v2_line_attribute attr;
  140. __aligned_u64 mask;
  141. };
  142. /**
  143. * struct gpio_v2_line_config - Configuration for GPIO lines
  144. * @flags: flags for the GPIO lines, with values from &enum
  145. * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
  146. * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together. This is the default for
  147. * all requested lines but may be overridden for particular lines using
  148. * @attrs.
  149. * @num_attrs: the number of attributes in @attrs
  150. * @padding: reserved for future use and must be zero filled
  151. * @attrs: the configuration attributes associated with the requested
  152. * lines. Any attribute should only be associated with a particular line
  153. * once. If an attribute is associated with a line multiple times then the
  154. * first occurrence (i.e. lowest index) has precedence.
  155. */
  156. struct gpio_v2_line_config {
  157. __aligned_u64 flags;
  158. __u32 num_attrs;
  159. /* Pad to fill implicit padding and reserve space for future use. */
  160. __u32 padding[5];
  161. struct gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
  162. };
  163. /**
  164. * struct gpio_v2_line_request - Information about a request for GPIO lines
  165. * @offsets: an array of desired lines, specified by offset index for the
  166. * associated GPIO chip
  167. * @consumer: a desired consumer label for the selected GPIO lines such as
  168. * "my-bitbanged-relay"
  169. * @config: requested configuration for the lines
  170. * @num_lines: number of lines requested in this request, i.e. the number
  171. * of valid fields in the %GPIO_V2_LINES_MAX sized arrays, set to 1 to
  172. * request a single line
  173. * @event_buffer_size: a suggested minimum number of line events that the
  174. * kernel should buffer. This is only relevant if edge detection is
  175. * enabled in the configuration. Note that this is only a suggested value
  176. * and the kernel may allocate a larger buffer or cap the size of the
  177. * buffer. If this field is zero then the buffer size defaults to a minimum
  178. * of @num_lines * 16.
  179. * @padding: reserved for future use and must be zero filled
  180. * @fd: after a successful %GPIO_V2_GET_LINE_IOCTL operation, contains
  181. * a valid anonymous file descriptor representing the request
  182. */
  183. struct gpio_v2_line_request {
  184. __u32 offsets[GPIO_V2_LINES_MAX];
  185. char consumer[GPIO_MAX_NAME_SIZE];
  186. struct gpio_v2_line_config config;
  187. __u32 num_lines;
  188. __u32 event_buffer_size;
  189. /* Pad to fill implicit padding and reserve space for future use. */
  190. __u32 padding[5];
  191. __s32 fd;
  192. };
  193. /**
  194. * struct gpio_v2_line_info - Information about a certain GPIO line
  195. * @name: the name of this GPIO line, such as the output pin of the line on
  196. * the chip, a rail or a pin header name on a board, as specified by the
  197. * GPIO chip, may be empty (i.e. name[0] == '\0')
  198. * @consumer: a functional name for the consumer of this GPIO line as set
  199. * by whatever is using it, will be empty if there is no current user but
  200. * may also be empty if the consumer doesn't set this up
  201. * @offset: the local offset on this GPIO chip, fill this in when
  202. * requesting the line information from the kernel
  203. * @num_attrs: the number of attributes in @attrs
  204. * @flags: flags for this GPIO line, with values from &enum
  205. * gpio_v2_line_flag, such as %GPIO_V2_LINE_FLAG_ACTIVE_LOW,
  206. * %GPIO_V2_LINE_FLAG_OUTPUT etc, added together
  207. * @attrs: the configuration attributes associated with the line
  208. * @padding: reserved for future use
  209. */
  210. struct gpio_v2_line_info {
  211. char name[GPIO_MAX_NAME_SIZE];
  212. char consumer[GPIO_MAX_NAME_SIZE];
  213. __u32 offset;
  214. __u32 num_attrs;
  215. __aligned_u64 flags;
  216. struct gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
  217. /* Space reserved for future use. */
  218. __u32 padding[4];
  219. };
  220. /**
  221. * enum gpio_v2_line_changed_type - &struct gpio_v2_line_changed.event_type
  222. * values
  223. * @GPIO_V2_LINE_CHANGED_REQUESTED: line has been requested
  224. * @GPIO_V2_LINE_CHANGED_RELEASED: line has been released
  225. * @GPIO_V2_LINE_CHANGED_CONFIG: line has been reconfigured
  226. */
  227. enum gpio_v2_line_changed_type {
  228. GPIO_V2_LINE_CHANGED_REQUESTED = 1,
  229. GPIO_V2_LINE_CHANGED_RELEASED = 2,
  230. GPIO_V2_LINE_CHANGED_CONFIG = 3,
  231. };
  232. /**
  233. * struct gpio_v2_line_info_changed - Information about a change in status
  234. * of a GPIO line
  235. * @info: updated line information
  236. * @timestamp_ns: estimate of time of status change occurrence, in nanoseconds
  237. * @event_type: the type of change with a value from &enum
  238. * gpio_v2_line_changed_type
  239. * @padding: reserved for future use
  240. */
  241. struct gpio_v2_line_info_changed {
  242. struct gpio_v2_line_info info;
  243. __aligned_u64 timestamp_ns;
  244. __u32 event_type;
  245. /* Pad struct to 64-bit boundary and reserve space for future use. */
  246. __u32 padding[5];
  247. };
  248. /**
  249. * enum gpio_v2_line_event_id - &struct gpio_v2_line_event.id values
  250. * @GPIO_V2_LINE_EVENT_RISING_EDGE: event triggered by a rising edge
  251. * @GPIO_V2_LINE_EVENT_FALLING_EDGE: event triggered by a falling edge
  252. */
  253. enum gpio_v2_line_event_id {
  254. GPIO_V2_LINE_EVENT_RISING_EDGE = 1,
  255. GPIO_V2_LINE_EVENT_FALLING_EDGE = 2,
  256. };
  257. /**
  258. * struct gpio_v2_line_event - The actual event being pushed to userspace
  259. * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds
  260. * @id: event identifier with value from &enum gpio_v2_line_event_id
  261. * @offset: the offset of the line that triggered the event
  262. * @seqno: the sequence number for this event in the sequence of events for
  263. * all the lines in this line request
  264. * @line_seqno: the sequence number for this event in the sequence of
  265. * events on this particular line
  266. * @padding: reserved for future use
  267. *
  268. * By default the @timestamp_ns is read from %CLOCK_MONOTONIC and is
  269. * intended to allow the accurate measurement of the time between events.
  270. * It does not provide the wall-clock time.
  271. *
  272. * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag is set then the
  273. * @timestamp_ns is read from %CLOCK_REALTIME.
  274. *
  275. * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE flag is set then the
  276. * @timestamp_ns is provided by the hardware timestamping engine (HTE)
  277. * subsystem.
  278. */
  279. struct gpio_v2_line_event {
  280. __aligned_u64 timestamp_ns;
  281. __u32 id;
  282. __u32 offset;
  283. __u32 seqno;
  284. __u32 line_seqno;
  285. /* Space reserved for future use. */
  286. __u32 padding[6];
  287. };
  288. /*
  289. * ABI v1
  290. *
  291. * This version of the ABI is deprecated.
  292. * Use the latest version of the ABI, defined above, instead.
  293. */
  294. /* Informational flags */
  295. #define GPIOLINE_FLAG_KERNEL (1UL << 0) /* Line used by the kernel */
  296. #define GPIOLINE_FLAG_IS_OUT (1UL << 1)
  297. #define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
  298. #define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3)
  299. #define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)
  300. #define GPIOLINE_FLAG_BIAS_PULL_UP (1UL << 5)
  301. #define GPIOLINE_FLAG_BIAS_PULL_DOWN (1UL << 6)
  302. #define GPIOLINE_FLAG_BIAS_DISABLE (1UL << 7)
  303. /**
  304. * struct gpioline_info - Information about a certain GPIO line
  305. * @line_offset: the local offset on this GPIO device, fill this in when
  306. * requesting the line information from the kernel
  307. * @flags: various flags for this line
  308. * @name: the name of this GPIO line, such as the output pin of the line on the
  309. * chip, a rail or a pin header name on a board, as specified by the gpio
  310. * chip, may be empty (i.e. name[0] == '\0')
  311. * @consumer: a functional name for the consumer of this GPIO line as set by
  312. * whatever is using it, will be empty if there is no current user but may
  313. * also be empty if the consumer doesn't set this up
  314. *
  315. * Note: This struct is part of ABI v1 and is deprecated.
  316. * Use ABI v2 and &struct gpio_v2_line_info instead.
  317. */
  318. struct gpioline_info {
  319. __u32 line_offset;
  320. __u32 flags;
  321. char name[GPIO_MAX_NAME_SIZE];
  322. char consumer[GPIO_MAX_NAME_SIZE];
  323. };
  324. /* Maximum number of requested handles */
  325. #define GPIOHANDLES_MAX 64
  326. /* Possible line status change events */
  327. enum {
  328. GPIOLINE_CHANGED_REQUESTED = 1,
  329. GPIOLINE_CHANGED_RELEASED,
  330. GPIOLINE_CHANGED_CONFIG,
  331. };
  332. /**
  333. * struct gpioline_info_changed - Information about a change in status
  334. * of a GPIO line
  335. * @info: updated line information
  336. * @timestamp: estimate of time of status change occurrence, in nanoseconds
  337. * @event_type: one of %GPIOLINE_CHANGED_REQUESTED,
  338. * %GPIOLINE_CHANGED_RELEASED and %GPIOLINE_CHANGED_CONFIG
  339. * @padding: reserved for future use
  340. *
  341. * The &struct gpioline_info embedded here has 32-bit alignment on its own,
  342. * but it works fine with 64-bit alignment too. With its 72 byte size, we can
  343. * guarantee there are no implicit holes between it and subsequent members.
  344. * The 20-byte padding at the end makes sure we don't add any implicit padding
  345. * at the end of the structure on 64-bit architectures.
  346. *
  347. * Note: This struct is part of ABI v1 and is deprecated.
  348. * Use ABI v2 and &struct gpio_v2_line_info_changed instead.
  349. */
  350. struct gpioline_info_changed {
  351. struct gpioline_info info;
  352. __u64 timestamp;
  353. __u32 event_type;
  354. __u32 padding[5]; /* for future use */
  355. };
  356. /* Linerequest flags */
  357. #define GPIOHANDLE_REQUEST_INPUT (1UL << 0)
  358. #define GPIOHANDLE_REQUEST_OUTPUT (1UL << 1)
  359. #define GPIOHANDLE_REQUEST_ACTIVE_LOW (1UL << 2)
  360. #define GPIOHANDLE_REQUEST_OPEN_DRAIN (1UL << 3)
  361. #define GPIOHANDLE_REQUEST_OPEN_SOURCE (1UL << 4)
  362. #define GPIOHANDLE_REQUEST_BIAS_PULL_UP (1UL << 5)
  363. #define GPIOHANDLE_REQUEST_BIAS_PULL_DOWN (1UL << 6)
  364. #define GPIOHANDLE_REQUEST_BIAS_DISABLE (1UL << 7)
  365. /**
  366. * struct gpiohandle_request - Information about a GPIO handle request
  367. * @lineoffsets: an array of desired lines, specified by offset index for the
  368. * associated GPIO device
  369. * @flags: desired flags for the desired GPIO lines, such as
  370. * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
  371. * together. Note that even if multiple lines are requested, the same flags
  372. * must be applicable to all of them, if you want lines with individual
  373. * flags set, request them one by one. It is possible to select
  374. * a batch of input or output lines, but they must all have the same
  375. * characteristics, i.e. all inputs or all outputs, all active low etc
  376. * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set for a requested
  377. * line, this specifies the default output value, should be 0 (inactive) or
  378. * 1 (active). Anything other than 0 or 1 will be interpreted as active.
  379. * @consumer_label: a desired consumer label for the selected GPIO line(s)
  380. * such as "my-bitbanged-relay"
  381. * @lines: number of lines requested in this request, i.e. the number of
  382. * valid fields in the above arrays, set to 1 to request a single line
  383. * @fd: after a successful %GPIO_GET_LINEHANDLE_IOCTL operation, contains
  384. * a valid anonymous file descriptor representing the request
  385. *
  386. * Note: This struct is part of ABI v1 and is deprecated.
  387. * Use ABI v2 and &struct gpio_v2_line_request instead.
  388. */
  389. struct gpiohandle_request {
  390. __u32 lineoffsets[GPIOHANDLES_MAX];
  391. __u32 flags;
  392. __u8 default_values[GPIOHANDLES_MAX];
  393. char consumer_label[GPIO_MAX_NAME_SIZE];
  394. __u32 lines;
  395. int fd;
  396. };
  397. /**
  398. * struct gpiohandle_config - Configuration for a GPIO handle request
  399. * @flags: updated flags for the requested GPIO lines, such as
  400. * %GPIOHANDLE_REQUEST_OUTPUT, %GPIOHANDLE_REQUEST_ACTIVE_LOW etc, added
  401. * together
  402. * @default_values: if the %GPIOHANDLE_REQUEST_OUTPUT is set in flags,
  403. * this specifies the default output value, should be 0 (inactive) or
  404. * 1 (active). Anything other than 0 or 1 will be interpreted as active.
  405. * @padding: reserved for future use and should be zero filled
  406. *
  407. * Note: This struct is part of ABI v1 and is deprecated.
  408. * Use ABI v2 and &struct gpio_v2_line_config instead.
  409. */
  410. struct gpiohandle_config {
  411. __u32 flags;
  412. __u8 default_values[GPIOHANDLES_MAX];
  413. __u32 padding[4]; /* padding for future use */
  414. };
  415. /**
  416. * struct gpiohandle_data - Information of values on a GPIO handle
  417. * @values: when getting the state of lines this contains the current
  418. * state of a line, when setting the state of lines these should contain
  419. * the desired target state. States are 0 (inactive) or 1 (active).
  420. * When setting, anything other than 0 or 1 will be interpreted as active.
  421. *
  422. * Note: This struct is part of ABI v1 and is deprecated.
  423. * Use ABI v2 and &struct gpio_v2_line_values instead.
  424. */
  425. struct gpiohandle_data {
  426. __u8 values[GPIOHANDLES_MAX];
  427. };
  428. /* Eventrequest flags */
  429. #define GPIOEVENT_REQUEST_RISING_EDGE (1UL << 0)
  430. #define GPIOEVENT_REQUEST_FALLING_EDGE (1UL << 1)
  431. #define GPIOEVENT_REQUEST_BOTH_EDGES ((1UL << 0) | (1UL << 1))
  432. /**
  433. * struct gpioevent_request - Information about a GPIO event request
  434. * @lineoffset: the desired line to subscribe to events from, specified by
  435. * offset index for the associated GPIO device
  436. * @handleflags: desired handle flags for the desired GPIO line, such as
  437. * %GPIOHANDLE_REQUEST_ACTIVE_LOW or %GPIOHANDLE_REQUEST_OPEN_DRAIN
  438. * @eventflags: desired flags for the desired GPIO event line, such as
  439. * %GPIOEVENT_REQUEST_RISING_EDGE or %GPIOEVENT_REQUEST_FALLING_EDGE
  440. * @consumer_label: a desired consumer label for the selected GPIO line(s)
  441. * such as "my-listener"
  442. * @fd: after a successful %GPIO_GET_LINEEVENT_IOCTL operation, contains a
  443. * valid anonymous file descriptor representing the request
  444. *
  445. * Note: This struct is part of ABI v1 and is deprecated.
  446. * Use ABI v2 and &struct gpio_v2_line_request instead.
  447. */
  448. struct gpioevent_request {
  449. __u32 lineoffset;
  450. __u32 handleflags;
  451. __u32 eventflags;
  452. char consumer_label[GPIO_MAX_NAME_SIZE];
  453. int fd;
  454. };
  455. /*
  456. * GPIO event types
  457. */
  458. #define GPIOEVENT_EVENT_RISING_EDGE 0x01
  459. #define GPIOEVENT_EVENT_FALLING_EDGE 0x02
  460. /**
  461. * struct gpioevent_data - The actual event being pushed to userspace
  462. * @timestamp: best estimate of time of event occurrence, in nanoseconds
  463. * @id: event identifier, one of %GPIOEVENT_EVENT_RISING_EDGE or
  464. * %GPIOEVENT_EVENT_FALLING_EDGE
  465. *
  466. * Note: This struct is part of ABI v1 and is deprecated.
  467. * Use ABI v2 and &struct gpio_v2_line_event instead.
  468. */
  469. struct gpioevent_data {
  470. __u64 timestamp;
  471. __u32 id;
  472. };
  473. /*
  474. * v1 and v2 ioctl()s
  475. */
  476. #define GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct gpiochip_info)
  477. #define GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, __u32)
  478. /*
  479. * v2 ioctl()s
  480. */
  481. #define GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct gpio_v2_line_info)
  482. #define GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct gpio_v2_line_info)
  483. #define GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct gpio_v2_line_request)
  484. #define GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct gpio_v2_line_config)
  485. #define GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct gpio_v2_line_values)
  486. #define GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct gpio_v2_line_values)
  487. /*
  488. * v1 ioctl()s
  489. *
  490. * These ioctl()s are deprecated. Use the v2 equivalent instead.
  491. */
  492. #define GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct gpioline_info)
  493. #define GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct gpiohandle_request)
  494. #define GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct gpioevent_request)
  495. #define GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct gpiohandle_data)
  496. #define GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct gpiohandle_data)
  497. #define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct gpiohandle_config)
  498. #define GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct gpioline_info)
  499. #endif /* _GPIO_H_ */