From patchwork Mon May 4 17:33:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Debski X-Patchwork-Id: 6328661 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F0FC69F1C2 for ; Mon, 4 May 2015 17:34:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DD372026D for ; Mon, 4 May 2015 17:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4034F202EB for ; Mon, 4 May 2015 17:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751590AbbEDRea (ORCPT ); Mon, 4 May 2015 13:34:30 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:23732 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751650AbbEDRe2 (ORCPT ); Mon, 4 May 2015 13:34:28 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NNU00L4H65DJE70@mailout3.samsung.com>; Tue, 05 May 2015 02:34:26 +0900 (KST) X-AuditID: cbfee61a-f79516d000006302-cd-5547ada150d3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0F.18.25346.1ADA7455; Tue, 5 May 2015 02:34:25 +0900 (KST) Received: from AMDC1342.digital.local ([106.116.147.39]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NNU0018W6370NB0@mmp1.samsung.com>; Tue, 05 May 2015 02:34:25 +0900 (KST) From: Kamil Debski To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Cc: m.szyprowski@samsung.com, k.debski@samsung.com, mchehab@osg.samsung.com, hverkuil@xs4all.nl, kyungmin.park@samsung.com, thomas@tommie-lie.de, sean@mess.org, dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-samsung-soc@vger.kernel.org, lars@opdenkamp.eu, Hans Verkuil Subject: [PATCH v6 07/11] DocBook/media: add CEC documentation Date: Mon, 04 May 2015 19:33:00 +0200 Message-id: <1430760785-1169-8-git-send-email-k.debski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1430760785-1169-1-git-send-email-k.debski@samsung.com> References: <1430760785-1169-1-git-send-email-k.debski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsVy+t9jAd2Fa91DDW7t1LY4vOgFo8WVr+/Z LD5MnMlocWryMyaLH68vsFmcbXrDbrF+6TVWi5ufvrFa9GzYymox4/w+Jou1R+6yW6x+VmGx 8Ol3FouFy9rZHPg8pvzeyOqxc9Zddo/73ceZPJa8sfbY8O4dq8eWfqBQ35ZVjB6PLs1h9vi8 Sc7j1NfP7AFcUVw2Kak5mWWpRfp2CVwZs64vYC34cIu54u+uI8wNjOuambsYOTkkBEwkJjTM YYSwxSQu3FvP1sXIxSEksIhR4sG6u0wQzi9GiVkPHrF2MXJwsAloSqy65wHSICLgIDFt4w+w GmaBHUwSrXsvg00VFrCTmHr5JDNIPYuAqsTRQ8UgJq+As8S7R14gpoSAgsScSTYgxZwCLhKr /rSzgNhCQBVftvxnnsDIu4CRYRWjaGpBckFxUnquoV5xYm5xaV66XnJ+7iZGcCA/k9rBuLLB 4hCjAAejEg/viVVuoUKsiWXFlbmHGCU4mJVEeJ8vcQ8V4k1JrKxKLcqPLyrNSS0+xCjNwaIk zjtHVy5USCA9sSQ1OzW1ILUIJsvEwSnVwHiIa8I/o4XdtdNk2V5edLpbX5/Lb8Q0Z8LtD7ue SnkYLN/Ouq/o04v3+Uu61RnDruamvOI6M/ehZVvfAd7cLiG/nbPffLa3Mf4ge6/oD9O9ziOJ LY5bBEsVn7x43TJbiE1jQqrFYa0n1k9zd7fOvFtlr1hzbY/IReN39ydsO9dlbcCgVLTicqYS S3FGoqEWc1FxIgCVst4UYAIAAA== Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Add DocBook documentation for the CEC API. Signed-off-by: Hans Verkuil [k.debski@samsung.com: add documentation for passthrough mode] [k.debski@samsung.com: minor fixes and change of reserved field sizes] Signed-off-by: Kamil Debski --- Documentation/DocBook/media/Makefile | 4 +- Documentation/DocBook/media/v4l/biblio.xml | 10 + Documentation/DocBook/media/v4l/cec-api.xml | 74 ++++++ Documentation/DocBook/media/v4l/cec-func-close.xml | 59 +++++ Documentation/DocBook/media/v4l/cec-func-ioctl.xml | 73 ++++++ Documentation/DocBook/media/v4l/cec-func-open.xml | 94 +++++++ Documentation/DocBook/media/v4l/cec-func-poll.xml | 89 +++++++ .../DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml | 275 ++++++++++++++++++++ .../DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml | 78 ++++++ .../DocBook/media/v4l/cec-ioc-g-adap-state.xml | 87 +++++++ Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml | 173 ++++++++++++ .../DocBook/media/v4l/cec-ioc-g-event.xml | 125 +++++++++ .../DocBook/media/v4l/cec-ioc-g-passthrough.xml | 88 +++++++ .../DocBook/media/v4l/cec-ioc-g-vendor-id.xml | 70 +++++ .../DocBook/media/v4l/cec-ioc-receive.xml | 185 +++++++++++++ Documentation/DocBook/media_api.tmpl | 6 +- 16 files changed, 1487 insertions(+), 3 deletions(-) create mode 100644 Documentation/DocBook/media/v4l/cec-api.xml create mode 100644 Documentation/DocBook/media/v4l/cec-func-close.xml create mode 100644 Documentation/DocBook/media/v4l/cec-func-ioctl.xml create mode 100644 Documentation/DocBook/media/v4l/cec-func-open.xml create mode 100644 Documentation/DocBook/media/v4l/cec-func-poll.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-adap-state.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-event.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-passthrough.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-g-vendor-id.xml create mode 100644 Documentation/DocBook/media/v4l/cec-ioc-receive.xml diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 8bf7c61..9650332 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -64,6 +64,7 @@ IOCTLS = \ $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/net.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/cec.h) \ $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \ VIDIOC_SUBDEV_G_FRAME_INTERVAL \ VIDIOC_SUBDEV_S_FRAME_INTERVAL \ @@ -98,6 +99,7 @@ STRUCTS = \ $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/net.h) \ $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/video.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \ + $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/cec.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \ $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h) @@ -300,7 +302,7 @@ $(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml @( \ for ident in $(IOCTLS) ; do \ entity=`echo $$ident | tr _ -` ; \ - id=`grep "$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml $(MEDIA_OBJ_DIR)/media-ioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \ + id=`grep "$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml $(MEDIA_OBJ_DIR)/media-ioc-*.xml $(MEDIA_OBJ_DIR)/cec-ioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \ echo "$$ident\">" \ >>$@ ; \ diff --git a/Documentation/DocBook/media/v4l/biblio.xml b/Documentation/DocBook/media/v4l/biblio.xml index fdee6b3..bed940b 100644 --- a/Documentation/DocBook/media/v4l/biblio.xml +++ b/Documentation/DocBook/media/v4l/biblio.xml @@ -324,6 +324,16 @@ in the frequency range from 87,5 to 108,0 MHz Specification Version 1.4a + + HDMI2 + + HDMI Licensing LLC +(http://www.hdmi.org) + + High-Definition Multimedia Interface + Specification Version 2.0 + + DP diff --git a/Documentation/DocBook/media/v4l/cec-api.xml b/Documentation/DocBook/media/v4l/cec-api.xml new file mode 100644 index 0000000..b59f610 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-api.xml @@ -0,0 +1,74 @@ + + + + Hans + Verkuil +
hans.verkuil@cisco.com
+ Initial version. +
+
+ + 2015 + Hans Verkuil + + + + + + 1.0.0 + 2015-04-27 + hv + Initial revision + + +
+ +CEC API + + + CEC: Consumer Electronics Control + +
+ Introduction + HDMI connectors provide a single pin for use by the Consumer Electronics + Control protocol. This protocol allows different devices connected by an HDMI cable + to communicate. The protocol for CEC version 1.4 is defined in supplements 1 (CEC) + and 2 (HEAC or HDMI Ethernet and Audio Return Channel) of the HDMI 1.4a + () specification and the extensions added to CEC version 2.0 + are defined in chapter 11 of the HDMI 2.0 () specification. + + + The bitrate is very slow (effectively no more than 36 bytes per second) and + is based on the ancient AV.link protocol used in old SCART connectors. The protocol + closely resembles a crazy Rube Goldberg contraption and is an unholy mix of low and + high level messages. Some messages, especially those part of the HEAC protocol layered + on top of CEC, need to be handled by the kernel, others can be handled either by the + kernel or by userspace. + + In addition, CEC can be implemented in HDMI receivers, transmitters and in USB + devices that have an HDMI input and an HDMI output and that control just the CEC pin. + + Drivers that support CEC and that allow (or require) userspace to handle CEC + messages and/or configure the CEC adapter will create a CEC device node (/dev/cecX) + to give userspace access to the CEC adapter. The &CEC-G-CAPS; ioctl will tell userspace + what it is allowed to do. +
+
+ + + Function Reference + + &sub-cec-func-open; + &sub-cec-func-close; + &sub-cec-func-ioctl; + &sub-cec-func-poll; + + &sub-cec-ioc-g-caps; + &sub-cec-ioc-receive; + &sub-cec-ioc-g-adap-log-addrs; + &sub-cec-ioc-g-adap-state; + &sub-cec-ioc-g-adap-phys-addr; + &sub-cec-ioc-g-event; + &sub-cec-ioc-g-vendor-id; + &sub-cec-ioc-g-passthrough; + diff --git a/Documentation/DocBook/media/v4l/cec-func-close.xml b/Documentation/DocBook/media/v4l/cec-func-close.xml new file mode 100644 index 0000000..c3978af --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-func-close.xml @@ -0,0 +1,59 @@ + + + cec close() + &manvol; + + + + cec-close + Close a cec device + + + + + #include <unistd.h> + + int close + int fd + + + + + + Arguments + + + + fd + + &fd; + + + + + + + Description + + Closes the cec device. Resources associated with the file descriptor + are freed. The device configuration remain unchanged. + + + + Return Value + + close returns 0 on success. On error, -1 is + returned, and errno is set appropriately. Possible error + codes are: + + + + EBADF + + fd is not a valid open file descriptor. + + + + + + diff --git a/Documentation/DocBook/media/v4l/cec-func-ioctl.xml b/Documentation/DocBook/media/v4l/cec-func-ioctl.xml new file mode 100644 index 0000000..ad85973 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-func-ioctl.xml @@ -0,0 +1,73 @@ + + + cec ioctl() + &manvol; + + + + cec-ioctl + Control a cec device + + + + + #include <sys/ioctl.h> + + int ioctl + int fd + int request + void *argp + + + + + + Arguments + + + + fd + + &fd; + + + + request + + CEC ioctl request code as defined in the cec.h header file, + for example CEC_G_CAPS. + + + + argp + + Pointer to a request-specific structure. + + + + + + + Description + The ioctl() function manipulates cec device + parameters. The argument fd must be an open file + descriptor. + The ioctl request code specifies the cec + function to be called. It has encoded in it whether the argument is an + input, output or read/write parameter, and the size of the argument + argp in bytes. + Macros and structures definitions specifying cec ioctl requests and + their parameters are located in the cec.h header file. All cec ioctl + requests, their respective function and parameters are specified in + . + + + + &return-value; + + Request-specific error codes are listed in the + individual requests descriptions. + When an ioctl that takes an output or read/write parameter fails, + the parameter remains unmodified. + + diff --git a/Documentation/DocBook/media/v4l/cec-func-open.xml b/Documentation/DocBook/media/v4l/cec-func-open.xml new file mode 100644 index 0000000..d814847 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-func-open.xml @@ -0,0 +1,94 @@ + + + cec open() + &manvol; + + + + cec-open + Open a cec device + + + + + #include <fcntl.h> + + int open + const char *device_name + int flags + + + + + + Arguments + + + + device_name + + Device to be opened. + + + + flags + + Open flags. Access mode must be either O_RDONLY + or O_RDWR. Other flags have no effect. + + + + + + Description + To open a cec device applications call open() + with the desired device name. The function has no side effects; the device + configuration remain unchanged. + When the device is opened in read-only mode, attempts to modify its + configuration will result in an error, and errno will be + set to EBADF. + + + Return Value + + open returns the new file descriptor on success. + On error, -1 is returned, and errno is set appropriately. + Possible error codes are: + + + + EACCES + + The requested access to the file is not allowed. + + + + EMFILE + + The process already has the maximum number of files open. + + + + + ENFILE + + The system limit on the total number of open files has been + reached. + + + + ENOMEM + + Insufficient kernel memory was available. + + + + ENXIO + + No device corresponding to this device special file exists. + + + + + + diff --git a/Documentation/DocBook/media/v4l/cec-func-poll.xml b/Documentation/DocBook/media/v4l/cec-func-poll.xml new file mode 100644 index 0000000..6853817 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-func-poll.xml @@ -0,0 +1,89 @@ + + + cec poll() + &manvol; + + + + cec-poll + Wait for some event on a file descriptor + + + + + #include <sys/poll.h> + + int poll + struct pollfd *ufds + unsigned int nfds + int timeout + + + + + + Description + + With the poll() function applications +can wait for CEC events. + + On success poll() returns the number of +file descriptors that have been selected (that is, file descriptors +for which the revents field of the +respective pollfd structure is non-zero). +CEC devices set the POLLIN and +POLLRDNORM flags in the +revents field if there are messages in the +receive queue. If the transmit queue has room for new messages, the +POLLOUT and POLLWRNORM +flags are set. If there are events in the event queue, then the +POLLPRI flag is set. +When the function timed out it returns a value of zero, on +failure it returns -1 and the +errno variable is set appropriately. + + + For more details see the +poll() manual page. + + + + Return Value + + On success, poll() returns the number +structures which have non-zero revents +fields, or zero if the call timed out. On error +-1 is returned, and the +errno variable is set appropriately: + + + + EBADF + + One or more of the ufds members +specify an invalid file descriptor. + + + + EFAULT + + ufds references an inaccessible +memory area. + + + + EINTR + + The call was interrupted by a signal. + + + + EINVAL + + The nfds argument is greater +than OPEN_MAX. + + + + + diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml new file mode 100644 index 0000000..7bed57f --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-log-addrs.xml @@ -0,0 +1,275 @@ + + + ioctl CEC_G_ADAP_LOG_ADDRS, CEC_S_ADAP_LOG_ADDRS + &manvol; + + + + CEC_G_ADAP_LOG_ADDRS + CEC_S_ADAP_LOG_ADDRS + Get or set the logical addresses + + + + + + int ioctl + int fd + int request + struct cec_log_addrs *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_ADAP_LOG_ADDRS, CEC_S_ADAP_LOG_ADDRS + + + + argp + + + + + + + + + Description + + To query the current CEC logical addresses applications call the +CEC_G_ADAP_LOG_ADDRS ioctl with a pointer to a +cec_log_addrs structure where the drivers stores the +logical addresses. + + To set new logical addresses applications fill in struct cec_log_addrs +and call the CEC_S_ADAP_LOG_ADDRS ioctl with a pointer to this struct. +The CEC_S_ADAP_LOG_ADDRS ioctl is only available if +CEC_CAP_LOG_ADDRS is set. This ioctl will block until all +requested logical addresses have been claimed. + + + struct <structname>cec_log_addrs</structname> + + &cs-str; + + + __u8 + cec_version + The CEC version that this adapter shall use. See + . + Used to implement the CEC_OP_CEC_VERSION and + CEC_OP_REPORT_FEATURES messages. Note that + CEC_VERSION_1_3A is not allowed + by the CEC framework. + + + + __u8 + num_log_addrs + Number of logical addresses to set up. Must be ≤ + available_log_addrs as returned by + &CEC-G-CAPS;. All arrays in this structure are only filled up to + index available_log_addrs-1. The remaining + array elements will be ignored. Note that the CEC 2.0 standard allows + for a maximum of 2 logical addresses, although some hardware has support + for more. CEC_MAX_LOG_ADDRS is 4. The driver will + return the actual number of logical addresses it could claim, which may + be less than what was requested. If this field is set to 0, then the + CEC adapter shall clear all claimed logical addresses and all other + fields will be ignored. + + + __u8 + primary_device_type[CEC_MAX_LOG_ADDRS] + Primary device type for each logical address. See + for possible types. + + + __u8 + log_addr_type[CEC_MAX_LOG_ADDRS] + Logical address types. See for + possible types. The driver will update this with the actual logical address + type that it claimed (e.g. it may have to fallback to + CEC_LOG_ADDR_TYPE_UNREGISTERED). + + + __u8 + log_addr[CEC_MAX_LOG_ADDRS] + The actual logical addresses that were claimed. This is set by the + driver. If no logical address could be claimed, then it is set to + CEC_LOG_ADDR_INVALID. + + + __u8 + all_device_types + CEC 2.0 specific: all device types. See . + Used to implement the CEC_OP_REPORT_FEATURES message. + This field is ignored if cec_version < + CEC_VERSION_2_0. + + + __u8 + features[CEC_MAX_LOG_ADDRS][12] + Features for each logical address. Used to implement the + CEC_OP_REPORT_FEATURES message. The 12 bytes include + both the RC Profile and the Device Features. + This field is ignored if cec_version < + CEC_VERSION_2_0. + + + __u8 + reserved[65] + Reserved for future extensions. Drivers and applications must + set this array to zero. + + + +
+ + + CEC Primary Device Types + + &cs-def; + + + CEC_PRIM_DEVTYPE_TV + 0 + Use for a TV. + + + CEC_PRIM_DEVTYPE_RECORD + 1 + Use for a recording device. + + + CEC_PRIM_DEVTYPE_TUNER + 3 + Use for a device with a tuner. + + + CEC_PRIM_DEVTYPE_PLAYBACK + 4 + Use for a playback device. + + + CEC_PRIM_DEVTYPE_AUDIOSYSTEM + 5 + Use for an audio system (e.g. an audio/video receiver). + + + CEC_PRIM_DEVTYPE_SWITCH + 6 + Use for a CEC switch. + + + CEC_PRIM_DEVTYPE_VIDEOPROC + 7 + Use for a video processor device. + + + +
+ + + CEC Logical Address Types + + &cs-def; + + + CEC_LOG_ADDR_TYPE_TV + 0 + Use for a TV. + + + CEC_LOG_ADDR_TYPE_RECORD + 1 + Use for a recording device. + + + CEC_LOG_ADDR_TYPE_TUNER + 2 + Use for a tuner device. + + + CEC_LOG_ADDR_TYPE_PLAYBACK + 3 + Use for a playback device. + + + CEC_LOG_ADDR_TYPE_AUDIOSYSTEM + 4 + Use for an audio system device. + + + CEC_LOG_ADDR_TYPE_SPECIFIC + 5 + Use for a second TV or for a video processor device. + + + CEC_LOG_ADDR_TYPE_UNREGISTERED + 6 + Fallback if all relevant logical addresses are claimed, or for + pure CEC switches or CDC-only devices (CDC: Capability Discovery and Control). + + + +
+ + + CEC All Device Types Flags + + &cs-def; + + + CEC_FL_ALL_DEVTYPE_TV + 0x80 + This supports the TV type. + + + CEC_FL_ALL_DEVTYPE_RECORD + 0x40 + This supports the Recording type. + + + CEC_FL_ALL_DEVTYPE_TUNER + 0x20 + This supports the Tuner type. + + + CEC_FL_ALL_DEVTYPE_PLAYBACK + 0x10 + This supports the Playback type. + + + CEC_FL_ALL_DEVTYPE_AUDIOSYSTEM + 0x08 + This supports the Audio System type. + + + CEC_FL_ALL_DEVTYPE_SWITCH + 0x04 + This supports the CEC Switch or Video Processing type. + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml new file mode 100644 index 0000000..0e201af --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-phys-addr.xml @@ -0,0 +1,78 @@ + + + ioctl CEC_G_ADAP_PHYS_ADDR, CEC_S_ADAP_PHYS_ADDR + &manvol; + + + + CEC_G_ADAP_PHYS_ADDR + CEC_S_ADAP_PHYS_ADDR + Get or set the physical address + + + + + + int ioctl + int fd + int request + __u16 *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_ADAP_PHYS_ADDR, CEC_S_ADAP_PHYS_ADDR + + + + argp + + + + + + + + + Description + + To query the current physical address applications call the +CEC_G_ADAP_PHYS_ADDR ioctl with a pointer to an __u16 +where the driver stores the physical address. + + To set a new physical address applications store the physical address in +an __u16 and call the CEC_S_ADAP_PHYS_ADDR ioctl with a +pointer to this integer. CEC_S_ADAP_PHYS_ADDR is only +available if CEC_CAP_PHYS_ADDR is set. + + The physical address is a 16-bit number where each group of 4 bits +represent a digit of the physical address a.b.c.d where the most significant +4 bits represent 'a'. The CEC root device (usually the TV) has address 0.0.0.0. +Every device that is hooked up to an input of the TV has address a.0.0.0 (where +'a' is ≥ 1), devices hooked up to those in turn have addresses a.b.0.0, etc. +So a topology of up to 5 devices deep is supported. The physical address a +device shall use is stored in the EDID of the sink. + +For example, the EDID for each HDMI input of the TV will have a different +physical address of the form a.0.0.0 that the sources will read out and use as +their physical address. + + + + &return-value; + + diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-adap-state.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-state.xml new file mode 100644 index 0000000..f20dd17 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-adap-state.xml @@ -0,0 +1,87 @@ + + + ioctl CEC_G_ADAP_STATE, CEC_S_ADAP_STATE + &manvol; + + + + CEC_G_ADAP_STATE + CEC_S_ADAP_STATE + Get or set the adapter state + + + + + + int ioctl + int fd + int request + __u32 *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_ADAP_STATE, CEC_S_ADAP_STATE + + + + argp + + + + + + + + + Description + + To query the current adapter state applications call the +CEC_G_ADAP_STATE ioctl with a pointer to an __u32 +where the driver stores the state. + + To set the adapter state applications store the CEC adapter state +in an __u32 and call the CEC_S_ADAP_STATE ioctl with a +pointer to this integer. CEC_S_ADAP_STATE is only +available if CEC_CAP_STATE is set. + + Available states are: + + + Adapter States + + &cs-def; + + + CEC_STATE_DISABLED + 0 + The adapter is disabled. + + + CEC_STATE_ENABLED + 1 + The adapter is enabled. + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml new file mode 100644 index 0000000..63b7ef5 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-caps.xml @@ -0,0 +1,173 @@ + + + ioctl CEC_G_CAPS + &manvol; + + + + CEC_G_CAPS + Query device capabilities + + + + + + int ioctl + int fd + int request + struct cec_caps *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_CAPS + + + + argp + + + + + + + + + Description + + All cec devices must support the CEC_G_CAPS + ioctl. To query device information, applications call the ioctl with a + pointer to a &cec-caps;. The driver fills the structure and returns + the information to the application. + The ioctl never fails. + + + struct <structname>cec_caps</structname> + + &cs-str; + + + __u32 + available_log_addrs + How many logical addresses does the CEC adapter support. This will + be at most CEC_MAX_LOG_ADDRS. + + + __u32 + capabilities + The capabilities of the CEC adapter, see . + + + __u32 + vendor_id + The CEC vendor ID. + + + __u8 + version + The CEC version supported by this device, see + . + + + __u8 + reserved[35] + Reserved for future extensions. Drivers must + set this array to zero. + + + +
+ + + CEC Versions + + &cs-def; + + + CEC_VERSION_1_3A + 4 + CEC version according to the HDMI 1.3a standard. + + + CEC_VERSION_1_4B + 5 + CEC version according to the HDMI 1.4b standard. + + + CEC_VERSION_2_0 + 6 + CEC version according to the HDMI 2.0 standard. + + + +
+ + + CEC Capabilities Flags + + &cs-def; + + + CEC_CAP_STATE + 0x00000001 + Userspace has to configure the adapter state (enable or disable it) by + calling &CEC-S-ADAP-STATE;. + + + CEC_CAP_PHYS_ADDR + 0x00000002 + Userspace has to configure the physical address by + calling &CEC-S-ADAP-PHYS-ADDR;. + + + CEC_CAP_LOG_ADDRS + 0x00000004 + Userspace has to configure the logical addresses by + calling &CEC-S-ADAP-LOG-ADDRS;. + + + CEC_CAP_TRANSMIT + 0x00000008 + Userspace can transmit messages by calling &CEC-TRANSMIT;. + + + CEC_CAP_RECEIVE + 0x00000010 + Userspace can receive messages by calling &CEC-RECEIVE;. + + + CEC_CAP_VENDOR_ID + 0x00000020 + Userspace has to configure the vendor ID by + calling &CEC-S-VENDOR-ID;. + + + CEC_CAP_PASSTHROUGH + 0x00000040 + Userspace can use the passthrough mode by + calling &CEC-S-PASSTHROUGH;. + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml new file mode 100644 index 0000000..cbde320 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-event.xml @@ -0,0 +1,125 @@ + + + ioctl CEC_G_EVENT + &manvol; + + + + CEC_G_EVENT + Get a CEC event + + + + + + int ioctl + int fd + int request + struct cec_event *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_EVENT + + + + argp + + + + + + + + + Description + + CEC devices can send asynchronous events. These can be retrieved by calling + the CEC_G_EVENT ioctl. If the file descriptor is in non-blocking + mode and no event is pending, then it will return -1 and set errno to the &EAGAIN;. + + There can be up to 40 events queued up. If more events are added, then the oldest event will be discarded. + + + struct <structname>cec_event</structname> + + &cs-str; + + + __u64 + ts + Timestamp of the event in ns. + + + __u32 + event + The event, see . + + + __u32 + sequence + For the CEC_EVENT_GOT_REPLY event this + holds the sequence number of message that requested the reply. + + + + __u8 + reserved[8] + Reserved for future extensions. Drivers must + set this array to zero. + + + +
+ + + CEC Events + + &cs-def; + + + CEC_EVENT_CONNECT + 1 + Generated when the HDMI cable is connected. + + + CEC_EVENT_READY + 2 + Generated when all logical addresses are claimed. + + + CEC_EVENT_DISCONNECT + 3 + Generated when the HDMI cable is disconnected. + + + CEC_EVENT_GOT_REPLY + 4 + Generated when a reply is received for a previously sent + message. Generated only if a reply was requested and only if the + message was sent in non-blocking mode. + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-passthrough.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-passthrough.xml new file mode 100644 index 0000000..aa8cb51 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-passthrough.xml @@ -0,0 +1,88 @@ + + + ioctl CEC_G_PASSTHROUGH, CEC_S_PASSTHROUGH + &manvol; + + + + CEC_G_PASSTHROUGH + CEC_S_PASSTHROUGH + Get or set the passthrough mode + + + + + + int ioctl + int fd + int request + __u32 *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_PASSTHROUGH, CEC_S_PASSTHROUGH + + + + argp + + + + + + + + + Description + + To query the current state of the passhrough mode the applications + call the CEC_G_PASSTHROUGH ioctl with a pointer to an + __u32 where the driver stores the state. + + To set the state of the passthrough mode applications store the + passthrough mode state in an __u32 and call the CEC_S_PASSTHROUGH + ioctl with a pointer to this integer. + CEC_S_PASSTHROUGH is only available if + CEC_CAP_PASSTHROUGH is set. + + Available states are: + + + Adapter States + + &cs-def; + + + CEC_PASSTHROUGH_DISABLED + 0 + The passthrough mode is disabled. + + + CEC_PASSTHROUGH_ENABLED + 1 + The passthrough is enabled. + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media/v4l/cec-ioc-g-vendor-id.xml b/Documentation/DocBook/media/v4l/cec-ioc-g-vendor-id.xml new file mode 100644 index 0000000..642e6b5 --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-g-vendor-id.xml @@ -0,0 +1,70 @@ + + + ioctl CEC_G_VENDOR_ID, CEC_S_VENDOR_ID + &manvol; + + + + CEC_G_VENDOR_ID + CEC_S_VENDOR_ID + Get or set vendor ID + + + + + + int ioctl + int fd + int request + __u32 *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_G_VENDOR_ID, CEC_S_VENDOR_ID + + + + argp + + + + + + + + + Description + + To query the current CEC vendor ID applications call the +CEC_G_VENDOR_ID ioctl with a pointer to an __u32 +where the driver stores the vendor ID. + + To set a new vendor ID applications store the vendor ID in +an __u32 and call the CEC_S_VENDOR_ID ioctl with a +pointer to this integer. CEC_S_VENDOR_ID is only +available if CEC_CAP_VENDOR_ID is set. + + The vendor ID is a 24-bit number that identifies the specific +vendor or entity. Based on this ID vendor specific commands may be +defined. + + + + &return-value; + + diff --git a/Documentation/DocBook/media/v4l/cec-ioc-receive.xml b/Documentation/DocBook/media/v4l/cec-ioc-receive.xml new file mode 100644 index 0000000..dbec20a --- /dev/null +++ b/Documentation/DocBook/media/v4l/cec-ioc-receive.xml @@ -0,0 +1,185 @@ + + + ioctl CEC_RECEIVE, CEC_TRANSMIT + &manvol; + + + + CEC_RECEIVE + CEC_TRANSMIT + Receive or transmit a CEC message + + + + + + int ioctl + int fd + int request + struct cec_msg *argp + + + + + + Arguments + + + + fd + + File descriptor returned by + open(). + + + + request + + CEC_RECEIVE, CEC_TRANSMIT + + + + argp + + + + + + + + + Description + + To receive a CEC message the application has to fill in the + cec_msg structure and pass it to the + CEC_RECEIVE ioctl. CEC_RECEIVE is + only available if CEC_CAP_RECEIVE is set. If the + file descriptor is in non-blocking mode and there are no received + messages pending, then it will return -1 and set errno to the &EAGAIN;. + If the file descriptor is in blocking mode and timeout + is non-zero and no message arrived within timeout + milliseconds, then it will return -1 and set errno to the &ETIMEDOUT;. + + To send a CEC message the application has to fill in the + cec_msg structure and pass it to the + CEC_TRANSMIT ioctl. CEC_TRANSMIT is + only available if CEC_CAP_TRANSMIT is set. + If there is no more room in the transmit queue, then it will return + -1 and set errno to the &EBUSY;. + + + struct <structname>cec_msg</structname> + + &cs-str; + + + __u64 + ts + Timestamp of when the message was transmitted in ns in the case + of CEC_TRANSMIT with reply + set to 0, or the timestamp of the received message in all other cases. + + + __u32 + len + The length of the message. For CEC_TRANSMIT this + is filled in by the application. The driver will fill this in for + CEC_RECEIVE and for CEC_TRANSMIT + it will be filled in with the length of the reply message if + reply was set. + + + __u32 + status + The status of the message. When used with CEC_RECEIVE + this is always set to CEC_RX_STATUS_READY. When + used with CEC_TRANSMIT see + for the possible status values. + + + __u32 + timeout + The timeout in milliseconds. This is the time we wait for a message to + be received. If it is set to 0, then we wait indefinitely. + It is ignored by CEC_TRANSMIT. + + + __u8 + msg[16] + The message payload. For CEC_TRANSMIT this + is filled in by the application. The driver will fill this in for + CEC_RECEIVE and for CEC_TRANSMIT + it will be filled in with the payload of the reply message if + reply was set. + + + __u8 + reply + Wait until this message is replied. If reply + is 0, then don't wait for a reply but return after transmitting the + message. If there was an error as indicated by a non-zero status + field, then reply is set to 0 by the driver. + Ignored by CEC_RECEIVE. + + + __u32 + sequence + The sequence number is automatically assigned by the CEC + framework for all transmitted messages. It can be later used by the + framework to generate an event if a reply for a message was + requested and the message was transmitted in a non-blocking mode. + + + + __u8 + reserved[35] + Reserved for future extensions. Drivers and applications must + set this array to zero. + + + +
+ + + CEC Transmit Status + + &cs-def; + + + CEC_TX_STATUS_OK + 0x00 + The message was transmitted successfully. + + + CEC_TX_STATUS_ARB_LOST + 0x01 + CEC line arbitration was lost. + + + CEC_TX_STATUS_RETRY_TIMEOUT + 0x02 + The transmit timed out. The timeout period is 200 ms for a polling + message and 1 second for other messages as specified by the CEC protocol. + + + CEC_TX_STATUS_FEATURE_ABORT + 0x04 + The message was transmitted successfully but the reply was + CEC_OP_FEATURE_ABORT. + + + CEC_TX_STATUS_REPLY_TIMEOUT + 0x08 + The message was transmitted successfully but the reply was never + received within the 1 second timeout period (this timeout value is + specified by the CEC protocol). + + + +
+
+ + + &return-value; + +
diff --git a/Documentation/DocBook/media_api.tmpl b/Documentation/DocBook/media_api.tmpl index 03f9a1f..ebddc3f 100644 --- a/Documentation/DocBook/media_api.tmpl +++ b/Documentation/DocBook/media_api.tmpl @@ -37,7 +37,7 @@ LINUX MEDIA INFRASTRUCTURE API - 2009-2014 + 2009-2015 LinuxTV Developers @@ -60,7 +60,7 @@ analog and digital TV receiver cards, AM/FM receiver cards, streaming capture and output devices, codec devices and remote controllers. - It is divided into four parts. + It is divided into five parts. The first part covers radio, video capture and output, cameras, analog TV devices and codecs. The second part covers the @@ -71,6 +71,7 @@ to document support also for DVB-S2, ISDB-T and ISDB-S. The third part covers the Remote Controller API. The fourth part covers the Media Controller API. + The fifth part covers the CEC (Consumer Electronics Control) API. For additional information and for the latest development code, see: http://linuxtv.org. For discussing improvements, reporting troubles, sending new drivers, etc, please mail to: Linux Media Mailing List (LMML).. @@ -80,6 +81,7 @@ &sub-dvbapi; &sub-remote_controllers; &sub-media-controller; +&sub-cec-api; &sub-gen-errors;