Merge tag 'tegra-for-4.8-i2c' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra...
[cascardo/linux.git] / Documentation / media / uapi / cec / cec-func-ioctl.rst
1 .. -*- coding: utf-8; mode: rst -*-
2
3 .. _cec-func-ioctl:
4
5 ***********
6 cec ioctl()
7 ***********
8
9 Name
10 ====
11
12 cec-ioctl - Control a cec device
13
14 Synopsis
15 ========
16
17 .. code-block:: c
18
19     #include <sys/ioctl.h>
20
21
22 .. c:function:: int ioctl( int fd, int request, void *argp )
23    :name: cec-ioctl
24
25 Arguments
26 =========
27
28 ``fd``
29     File descriptor returned by :c:func:`open() <cec-open>`.
30
31 ``request``
32     CEC ioctl request code as defined in the cec.h header file, for
33     example :c:func:`CEC_ADAP_G_CAPS`.
34
35 ``argp``
36     Pointer to a request-specific structure.
37
38
39 Description
40 ===========
41
42 .. note::
43
44    This documents the proposed CEC API. This API is not yet finalized
45    and is currently only available as a staging kernel module.
46
47 The :c:func:`ioctl()` function manipulates cec device parameters. The
48 argument ``fd`` must be an open file descriptor.
49
50 The ioctl ``request`` code specifies the cec function to be called. It
51 has encoded in it whether the argument is an input, output or read/write
52 parameter, and the size of the argument ``argp`` in bytes.
53
54 Macros and structures definitions specifying cec ioctl requests and
55 their parameters are located in the cec.h header file. All cec ioctl
56 requests, their respective function and parameters are specified in
57 :ref:`cec-user-func`.
58
59
60 Return Value
61 ============
62
63 On success 0 is returned, on error -1 and the ``errno`` variable is set
64 appropriately. The generic error codes are described at the
65 :ref:`Generic Error Codes <gen-errors>` chapter.
66
67 Request-specific error codes are listed in the individual requests
68 descriptions.
69
70 When an ioctl that takes an output or read/write parameter fails, the
71 parameter remains unmodified.