xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/cec/cec-ioc-adap-g-phys-addr.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun.. c:namespace:: CEC
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun.. _CEC_ADAP_PHYS_ADDR:
5*4882a593Smuzhiyun.. _CEC_ADAP_G_PHYS_ADDR:
6*4882a593Smuzhiyun.. _CEC_ADAP_S_PHYS_ADDR:
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun****************************************************
9*4882a593Smuzhiyunioctls CEC_ADAP_G_PHYS_ADDR and CEC_ADAP_S_PHYS_ADDR
10*4882a593Smuzhiyun****************************************************
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunName
13*4882a593Smuzhiyun====
14*4882a593Smuzhiyun
15*4882a593SmuzhiyunCEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunSynopsis
18*4882a593Smuzhiyun========
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun.. c:macro:: CEC_ADAP_G_PHYS_ADDR
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun``int ioctl(int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp)``
23*4882a593Smuzhiyun
24*4882a593Smuzhiyun.. c:macro:: CEC_ADAP_S_PHYS_ADDR
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun``int ioctl(int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp)``
27*4882a593Smuzhiyun
28*4882a593SmuzhiyunArguments
29*4882a593Smuzhiyun=========
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun``fd``
32*4882a593Smuzhiyun    File descriptor returned by :c:func:`open()`.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun``argp``
35*4882a593Smuzhiyun    Pointer to the CEC address.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunDescription
38*4882a593Smuzhiyun===========
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunTo query the current physical address applications call
41*4882a593Smuzhiyun:ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the
42*4882a593Smuzhiyundriver stores the physical address.
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunTo set a new physical address applications store the physical address in
45*4882a593Smuzhiyuna __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` with a pointer to
46*4882a593Smuzhiyunthis integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` is only available if
47*4882a593Smuzhiyun``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned
48*4882a593Smuzhiyunotherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called
49*4882a593Smuzhiyunby a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not
50*4882a593Smuzhiyunthe ``EBUSY`` error code will be returned.
51*4882a593Smuzhiyun
52*4882a593SmuzhiyunTo clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``.
53*4882a593SmuzhiyunThe adapter will go to the unconfigured state.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunIf logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`),
56*4882a593Smuzhiyunthen this ioctl will block until all
57*4882a593Smuzhiyunrequested logical addresses have been claimed. If the file descriptor is in non-blocking mode
58*4882a593Smuzhiyunthen it will not wait for the logical addresses to be claimed, instead it just returns 0.
59*4882a593Smuzhiyun
60*4882a593SmuzhiyunA :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the physical address
61*4882a593Smuzhiyunchanges.
62*4882a593Smuzhiyun
63*4882a593SmuzhiyunThe physical address is a 16-bit number where each group of 4 bits
64*4882a593Smuzhiyunrepresent a digit of the physical address a.b.c.d where the most
65*4882a593Smuzhiyunsignificant 4 bits represent 'a'. The CEC root device (usually the TV)
66*4882a593Smuzhiyunhas address 0.0.0.0. Every device that is hooked up to an input of the
67*4882a593SmuzhiyunTV has address a.0.0.0 (where 'a' is ≥ 1), devices hooked up to those in
68*4882a593Smuzhiyunturn have addresses a.b.0.0, etc. So a topology of up to 5 devices deep
69*4882a593Smuzhiyunis supported. The physical address a device shall use is stored in the
70*4882a593SmuzhiyunEDID of the sink.
71*4882a593Smuzhiyun
72*4882a593SmuzhiyunFor example, the EDID for each HDMI input of the TV will have a
73*4882a593Smuzhiyundifferent physical address of the form a.0.0.0 that the sources will
74*4882a593Smuzhiyunread out and use as their physical address.
75*4882a593Smuzhiyun
76*4882a593SmuzhiyunReturn Value
77*4882a593Smuzhiyun============
78*4882a593Smuzhiyun
79*4882a593SmuzhiyunOn success 0 is returned, on error -1 and the ``errno`` variable is set
80*4882a593Smuzhiyunappropriately. The generic error codes are described at the
81*4882a593Smuzhiyun:ref:`Generic Error Codes <gen-errors>` chapter.
82*4882a593Smuzhiyun
83*4882a593SmuzhiyunThe :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can return the following
84*4882a593Smuzhiyunerror codes:
85*4882a593Smuzhiyun
86*4882a593SmuzhiyunENOTTY
87*4882a593Smuzhiyun    The ``CEC_CAP_PHYS_ADDR`` capability wasn't set, so this ioctl is not supported.
88*4882a593Smuzhiyun
89*4882a593SmuzhiyunEBUSY
90*4882a593Smuzhiyun    Another filehandle is in exclusive follower or initiator mode, or the filehandle
91*4882a593Smuzhiyun    is in mode ``CEC_MODE_NO_INITIATOR``.
92*4882a593Smuzhiyun
93*4882a593SmuzhiyunEINVAL
94*4882a593Smuzhiyun    The physical address is malformed.
95