1 .. SPDX-License-Identifier: GPL-2.0 2 3 .. _GPIO_V2_GET_LINE_IOCTL: 4 5 ********************** 6 GPIO_V2_GET_LINE_IOCTL 7 ********************** 8 9 Name 10 ==== 11 12 GPIO_V2_GET_LINE_IOCTL - Request a line or lin 13 14 Synopsis 15 ======== 16 17 .. c:macro:: GPIO_V2_GET_LINE_IOCTL 18 19 ``int ioctl(int chip_fd, GPIO_V2_GET_LINE_IOCT 20 21 Arguments 22 ========= 23 24 ``chip_fd`` 25 The file descriptor of the GPIO character 26 27 ``request`` 28 The :c:type:`line_request<gpio_v2_line_req 29 to request and their configuration. 30 31 Description 32 =========== 33 34 On success, the requesting process is granted 35 value, write access to the line configuration, 36 edges are detected on the line, all of which a 37 :ref:`gpio-v2-line-request`. 38 39 A number of lines may be requested in the one 40 operations are performed on the requested line 41 as possible. e.g. gpio-v2-line-get-values-ioct 42 requested lines at once. 43 44 The state of a line, including the value of ou 45 remain as requested until the returned file de 46 file descriptor is closed, the state of the li 47 the userspace perspective, and may revert to i 48 49 Requesting a line already in use is an error ( 50 51 Closing the ``chip_fd`` has no effect on exist 52 53 .. _gpio-v2-get-line-config-rules: 54 55 Configuration Rules 56 ------------------- 57 58 For any given requested line, the following co 59 60 The direction flags, ``GPIO_V2_LINE_FLAG_INPUT 61 ``GPIO_V2_LINE_FLAG_OUTPUT``, cannot be combin 62 the only other flag that may be set is ``GPIO_ 63 and the line is requested "as-is" to allow rea 64 without altering the electrical configuration. 65 66 The drive flags, ``GPIO_V2_LINE_FLAG_OPEN_xxx` 67 ``GPIO_V2_LINE_FLAG_OUTPUT`` to be set. 68 Only one drive flag may be set. 69 If none are set then the line is assumed push- 70 71 Only one bias flag, ``GPIO_V2_LINE_FLAG_BIAS_x 72 requires a direction flag to also be set. 73 If no bias flags are set then the bias configu 74 75 The edge flags, ``GPIO_V2_LINE_FLAG_EDGE_xxx`` 76 ``GPIO_V2_LINE_FLAG_INPUT`` to be set and may 77 and falling edges. Requesting edge detection 78 it is an error (**ENXIO**). 79 80 Only one event clock flag, ``GPIO_V2_LINE_FLAG 81 If none are set then the event clock defaults 82 The ``GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE`` flag 83 and a kernel with ``CONFIG_HTE`` set. Request 84 doesn't support it is an error (**EOPNOTSUPP** 85 86 The :c:type:`debounce_period_us<gpio_v2_line_a 87 be applied to lines with ``GPIO_V2_LINE_FLAG_I 88 applies to both the values returned by gpio-v2 89 the edges returned by gpio-v2-line-event-read. 90 supported directly by hardware, debouncing is 91 kernel. Requesting debounce on a line that su 92 hardware nor interrupts, as required for softw 93 (**ENXIO**). 94 95 Requesting an invalid configuration is an erro 96 97 .. _gpio-v2-get-line-config-support: 98 99 Configuration Support 100 --------------------- 101 102 Where the requested configuration is not direc 103 hardware and driver, the kernel applies one of 104 105 - reject the request 106 - emulate the feature in software 107 - treat the feature as best effort 108 109 The approach applied depends on whether the fe 110 in software, and the impact on the hardware an 111 supported. 112 The approach applied for each feature is as fo 113 114 ============== =========== 115 Feature Approach 116 ============== =========== 117 Bias best effort 118 Debounce emulate 119 Direction reject 120 Drive emulate 121 Edge Detection reject 122 ============== =========== 123 124 Bias is treated as best effort to allow usersp 125 configuration for platforms that support inter 126 external bias. 127 Worst case the line floats rather than being b 128 129 Debounce is emulated by applying a filter to h 130 An edge event is generated after an edge is de 131 stable for the debounce period. 132 The event timestamp corresponds to the end of 133 134 Drive is emulated by switching the line to an 135 be actively driven. 136 137 Edge detection requires interrupt support, and 138 supported. Emulation by polling can still be p 139 140 In all cases, the configuration reported by gp 141 is the requested configuration, not the result 142 Userspace cannot determine if a feature is sup 143 emulated, or is best effort. 144 145 Return Value 146 ============ 147 148 On success 0 and the :c:type:`request.fd<gpio_ 149 file descriptor for the request. 150 151 On error -1 and the ``errno`` variable is set 152 Common error codes are described in error-code
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.