1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2*01fae02dSMauro Carvalho Chehab.. c:namespace:: CEC 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _CEC_ADAP_PHYS_ADDR: 554f38fcaSMauro Carvalho Chehab.. _CEC_ADAP_G_PHYS_ADDR: 654f38fcaSMauro Carvalho Chehab.. _CEC_ADAP_S_PHYS_ADDR: 754f38fcaSMauro Carvalho Chehab 854f38fcaSMauro Carvalho Chehab**************************************************** 954f38fcaSMauro Carvalho Chehabioctls CEC_ADAP_G_PHYS_ADDR and CEC_ADAP_S_PHYS_ADDR 1054f38fcaSMauro Carvalho Chehab**************************************************** 1154f38fcaSMauro Carvalho Chehab 1254f38fcaSMauro Carvalho ChehabName 1354f38fcaSMauro Carvalho Chehab==== 1454f38fcaSMauro Carvalho Chehab 1554f38fcaSMauro Carvalho ChehabCEC_ADAP_G_PHYS_ADDR, CEC_ADAP_S_PHYS_ADDR - Get or set the physical address 1654f38fcaSMauro Carvalho Chehab 1754f38fcaSMauro Carvalho ChehabSynopsis 1854f38fcaSMauro Carvalho Chehab======== 1954f38fcaSMauro Carvalho Chehab 20*01fae02dSMauro Carvalho Chehab.. c:macro:: CEC_ADAP_G_PHYS_ADDR 2154f38fcaSMauro Carvalho Chehab 22*01fae02dSMauro Carvalho Chehab``int ioctl(int fd, CEC_ADAP_G_PHYS_ADDR, __u16 *argp)`` 23*01fae02dSMauro Carvalho Chehab 24*01fae02dSMauro Carvalho Chehab.. c:macro:: CEC_ADAP_S_PHYS_ADDR 25*01fae02dSMauro Carvalho Chehab 26*01fae02dSMauro Carvalho Chehab``int ioctl(int fd, CEC_ADAP_S_PHYS_ADDR, __u16 *argp)`` 2754f38fcaSMauro Carvalho Chehab 2854f38fcaSMauro Carvalho ChehabArguments 2954f38fcaSMauro Carvalho Chehab========= 3054f38fcaSMauro Carvalho Chehab 3154f38fcaSMauro Carvalho Chehab``fd`` 32*01fae02dSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 3354f38fcaSMauro Carvalho Chehab 3454f38fcaSMauro Carvalho Chehab``argp`` 3554f38fcaSMauro Carvalho Chehab Pointer to the CEC address. 3654f38fcaSMauro Carvalho Chehab 3754f38fcaSMauro Carvalho ChehabDescription 3854f38fcaSMauro Carvalho Chehab=========== 3954f38fcaSMauro Carvalho Chehab 4054f38fcaSMauro Carvalho ChehabTo query the current physical address applications call 4154f38fcaSMauro Carvalho Chehab:ref:`ioctl CEC_ADAP_G_PHYS_ADDR <CEC_ADAP_G_PHYS_ADDR>` with a pointer to a __u16 where the 4254f38fcaSMauro Carvalho Chehabdriver stores the physical address. 4354f38fcaSMauro Carvalho Chehab 4454f38fcaSMauro Carvalho ChehabTo set a new physical address applications store the physical address in 4554f38fcaSMauro Carvalho Chehaba __u16 and call :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` with a pointer to 4654f38fcaSMauro Carvalho Chehabthis integer. The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` is only available if 4754f38fcaSMauro Carvalho Chehab``CEC_CAP_PHYS_ADDR`` is set (the ``ENOTTY`` error code will be returned 4854f38fcaSMauro Carvalho Chehabotherwise). The :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can only be called 4954f38fcaSMauro Carvalho Chehabby a file descriptor in initiator mode (see :ref:`CEC_S_MODE`), if not 5054f38fcaSMauro Carvalho Chehabthe ``EBUSY`` error code will be returned. 5154f38fcaSMauro Carvalho Chehab 5254f38fcaSMauro Carvalho ChehabTo clear an existing physical address use ``CEC_PHYS_ADDR_INVALID``. 5354f38fcaSMauro Carvalho ChehabThe adapter will go to the unconfigured state. 5454f38fcaSMauro Carvalho Chehab 5554f38fcaSMauro Carvalho ChehabIf logical address types have been defined (see :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`), 5654f38fcaSMauro Carvalho Chehabthen this ioctl will block until all 5754f38fcaSMauro Carvalho Chehabrequested logical addresses have been claimed. If the file descriptor is in non-blocking mode 5854f38fcaSMauro Carvalho Chehabthen it will not wait for the logical addresses to be claimed, instead it just returns 0. 5954f38fcaSMauro Carvalho Chehab 6054f38fcaSMauro Carvalho ChehabA :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>` event is sent when the physical address 6154f38fcaSMauro Carvalho Chehabchanges. 6254f38fcaSMauro Carvalho Chehab 6354f38fcaSMauro Carvalho ChehabThe physical address is a 16-bit number where each group of 4 bits 6454f38fcaSMauro Carvalho Chehabrepresent a digit of the physical address a.b.c.d where the most 6554f38fcaSMauro Carvalho Chehabsignificant 4 bits represent 'a'. The CEC root device (usually the TV) 6654f38fcaSMauro Carvalho Chehabhas address 0.0.0.0. Every device that is hooked up to an input of the 6754f38fcaSMauro Carvalho ChehabTV has address a.0.0.0 (where 'a' is ≥ 1), devices hooked up to those in 6854f38fcaSMauro Carvalho Chehabturn have addresses a.b.0.0, etc. So a topology of up to 5 devices deep 6954f38fcaSMauro Carvalho Chehabis supported. The physical address a device shall use is stored in the 7054f38fcaSMauro Carvalho ChehabEDID of the sink. 7154f38fcaSMauro Carvalho Chehab 7254f38fcaSMauro Carvalho ChehabFor example, the EDID for each HDMI input of the TV will have a 7354f38fcaSMauro Carvalho Chehabdifferent physical address of the form a.0.0.0 that the sources will 7454f38fcaSMauro Carvalho Chehabread out and use as their physical address. 7554f38fcaSMauro Carvalho Chehab 7654f38fcaSMauro Carvalho ChehabReturn Value 7754f38fcaSMauro Carvalho Chehab============ 7854f38fcaSMauro Carvalho Chehab 7954f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 8054f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 8154f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 8254f38fcaSMauro Carvalho Chehab 8354f38fcaSMauro Carvalho ChehabThe :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>` can return the following 8454f38fcaSMauro Carvalho Chehaberror codes: 8554f38fcaSMauro Carvalho Chehab 8654f38fcaSMauro Carvalho ChehabENOTTY 8754f38fcaSMauro Carvalho Chehab The ``CEC_CAP_PHYS_ADDR`` capability wasn't set, so this ioctl is not supported. 8854f38fcaSMauro Carvalho Chehab 8954f38fcaSMauro Carvalho ChehabEBUSY 9054f38fcaSMauro Carvalho Chehab Another filehandle is in exclusive follower or initiator mode, or the filehandle 9154f38fcaSMauro Carvalho Chehab is in mode ``CEC_MODE_NO_INITIATOR``. 9254f38fcaSMauro Carvalho Chehab 9354f38fcaSMauro Carvalho ChehabEINVAL 9454f38fcaSMauro Carvalho Chehab The physical address is malformed. 95