xref: /linux/Documentation/userspace-api/gpio/gpio-v2-line-get-values-ioctl.rst (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
132a0a0daSKent Gibson.. SPDX-License-Identifier: GPL-2.0
232a0a0daSKent Gibson
332a0a0daSKent Gibson.. _GPIO_V2_LINE_GET_VALUES_IOCTL:
432a0a0daSKent Gibson
532a0a0daSKent Gibson*****************************
632a0a0daSKent GibsonGPIO_V2_LINE_GET_VALUES_IOCTL
732a0a0daSKent Gibson*****************************
832a0a0daSKent Gibson
932a0a0daSKent GibsonName
1032a0a0daSKent Gibson====
1132a0a0daSKent Gibson
1232a0a0daSKent GibsonGPIO_V2_LINE_GET_VALUES_IOCTL - Get the values of requested lines.
1332a0a0daSKent Gibson
1432a0a0daSKent GibsonSynopsis
1532a0a0daSKent Gibson========
1632a0a0daSKent Gibson
1732a0a0daSKent Gibson.. c:macro:: GPIO_V2_LINE_GET_VALUES_IOCTL
1832a0a0daSKent Gibson
1932a0a0daSKent Gibson``int ioctl(int req_fd, GPIO_V2_LINE_GET_VALUES_IOCTL, struct gpio_v2_line_values *values)``
2032a0a0daSKent Gibson
2132a0a0daSKent GibsonArguments
2232a0a0daSKent Gibson=========
2332a0a0daSKent Gibson
2432a0a0daSKent Gibson``req_fd``
2532a0a0daSKent Gibson    The file descriptor of the GPIO character device, as returned in the
2632a0a0daSKent Gibson    :c:type:`request.fd<gpio_v2_line_request>` by gpio-v2-get-line-ioctl.rst.
2732a0a0daSKent Gibson
2832a0a0daSKent Gibson``values``
2932a0a0daSKent Gibson    The :c:type:`line_values<gpio_v2_line_values>` to get with the ``mask`` set
3032a0a0daSKent Gibson    to indicate the subset of requested lines to get.
3132a0a0daSKent Gibson
3232a0a0daSKent GibsonDescription
3332a0a0daSKent Gibson===========
3432a0a0daSKent Gibson
3532a0a0daSKent GibsonGet the values of requested lines.
3632a0a0daSKent Gibson
37*5ca84d41SKent GibsonThe values returned are logical, indicating if the line is active or inactive.
38*5ca84d41SKent GibsonThe ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` flag controls the mapping between physical
39*5ca84d41SKent Gibsonvalues (high/low) and logical values (active/inactive).
40*5ca84d41SKent GibsonIf ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is not set then high is active and low is
41*5ca84d41SKent Gibsoninactive.  If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is set then low is active and
42*5ca84d41SKent Gibsonhigh is inactive.
43*5ca84d41SKent Gibson
4432a0a0daSKent GibsonThe values of both input and output lines may be read.
4532a0a0daSKent Gibson
4632a0a0daSKent GibsonFor output lines, the value returned is driver and configuration dependent and
4732a0a0daSKent Gibsonmay be either the output buffer (the last requested value set) or the input
4832a0a0daSKent Gibsonbuffer (the actual level of the line), and depending on the hardware and
4932a0a0daSKent Gibsonconfiguration these may differ.
5032a0a0daSKent Gibson
5132a0a0daSKent GibsonReturn Value
5232a0a0daSKent Gibson============
5332a0a0daSKent Gibson
5432a0a0daSKent GibsonOn success 0 and the corresponding :c:type:`values.bits<gpio_v2_line_values>`
5532a0a0daSKent Gibsoncontain the value read.
5632a0a0daSKent Gibson
5732a0a0daSKent GibsonOn error -1 and the ``errno`` variable is set appropriately.
5832a0a0daSKent GibsonCommon error codes are described in error-codes.rst.
59