xref: /linux/Documentation/userspace-api/gpio/gpio-handle-get-line-values-ioctl.rst (revision 16b2bb7fe5e4a0757608e844902fdf05617f51f8)
1*16b2bb7fSKent Gibson.. SPDX-License-Identifier: GPL-2.0
2*16b2bb7fSKent Gibson
3*16b2bb7fSKent Gibson.. _GPIOHANDLE_GET_LINE_VALUES_IOCTL:
4*16b2bb7fSKent Gibson
5*16b2bb7fSKent Gibson********************************
6*16b2bb7fSKent GibsonGPIOHANDLE_GET_LINE_VALUES_IOCTL
7*16b2bb7fSKent Gibson********************************
8*16b2bb7fSKent Gibson.. warning::
9*16b2bb7fSKent Gibson    This ioctl is part of chardev_v1.rst and is obsoleted by
10*16b2bb7fSKent Gibson    gpio-v2-line-get-values-ioctl.rst.
11*16b2bb7fSKent Gibson
12*16b2bb7fSKent GibsonName
13*16b2bb7fSKent Gibson====
14*16b2bb7fSKent Gibson
15*16b2bb7fSKent GibsonGPIOHANDLE_GET_LINE_VALUES_IOCTL - Get the values of all requested lines.
16*16b2bb7fSKent Gibson
17*16b2bb7fSKent GibsonSynopsis
18*16b2bb7fSKent Gibson========
19*16b2bb7fSKent Gibson
20*16b2bb7fSKent Gibson.. c:macro:: GPIOHANDLE_GET_LINE_VALUES_IOCTL
21*16b2bb7fSKent Gibson
22*16b2bb7fSKent Gibson``int ioctl(int handle_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, struct gpiohandle_data *values)``
23*16b2bb7fSKent Gibson
24*16b2bb7fSKent GibsonArguments
25*16b2bb7fSKent Gibson=========
26*16b2bb7fSKent Gibson
27*16b2bb7fSKent Gibson``handle_fd``
28*16b2bb7fSKent Gibson    The file descriptor of the GPIO character device, as returned in the
29*16b2bb7fSKent Gibson    :c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.
30*16b2bb7fSKent Gibson
31*16b2bb7fSKent Gibson``values``
32*16b2bb7fSKent Gibson    The :c:type:`line_values<gpiohandle_data>` to be populated.
33*16b2bb7fSKent Gibson
34*16b2bb7fSKent GibsonDescription
35*16b2bb7fSKent Gibson===========
36*16b2bb7fSKent Gibson
37*16b2bb7fSKent GibsonGet the values of all requested lines.
38*16b2bb7fSKent Gibson
39*16b2bb7fSKent GibsonThe values of both input and output lines may be read.
40*16b2bb7fSKent Gibson
41*16b2bb7fSKent GibsonFor output lines, the value returned is driver and configuration dependent and
42*16b2bb7fSKent Gibsonmay be either the output buffer (the last requested value set) or the input
43*16b2bb7fSKent Gibsonbuffer (the actual level of the line), and depending on the hardware and
44*16b2bb7fSKent Gibsonconfiguration these may differ.
45*16b2bb7fSKent Gibson
46*16b2bb7fSKent GibsonThis ioctl can also be used to read the line value for line events,
47*16b2bb7fSKent Gibsonsubstituting the ``event_fd`` for the ``handle_fd``.  As there is only
48*16b2bb7fSKent Gibsonone line requested in that case, only the one value is returned in ``values``.
49*16b2bb7fSKent Gibson
50*16b2bb7fSKent GibsonReturn Value
51*16b2bb7fSKent Gibson============
52*16b2bb7fSKent Gibson
53*16b2bb7fSKent GibsonOn success 0 and ``values`` populated with the values read.
54*16b2bb7fSKent Gibson
55*16b2bb7fSKent GibsonOn error -1 and the ``errno`` variable is set appropriately.
56*16b2bb7fSKent GibsonCommon error codes are described in error-codes.rst.
57