linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] cec/pulse8-cec: move out of staging
@ 2016-11-02 12:46 Hans Verkuil
  2016-11-02 12:46 ` [PATCH 01/11] pulse8-cec: set all_device_types when restoring config Hans Verkuil
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media

From: Hans Verkuil <hans.verkuil@cisco.com>

This patch series makes the final changes so that the cec framework
and the pulse8-cec driver can be moved out of staging.

The first patch fixes a pulse8-cec bug, the second removes the
spurious 'row' comments in the cec documentation using Laurent's script
(Thanks Laurent!).

The next patch adds a flag to enable the passthrough of remote control
keys to the rc subsystem. This is a userspace change since until now this
was always on. I decided that it is safer that this is enabled via an
opt-in flag so the caller can think about whether this is really what
they want.

Patch four adds a new flag that can force replies to a CEC_TRANSMIT to
be sent to followers as well. Depending on how the application is set
up this flag may be needed.

The fifth patch implements filtering for erroneous messages: messages
that are too short, or have the wrong transmit mode (broadcast where
directed is needed or vice versa) are ignored. This is only done for
the CEC messages specified in the spec, unknown messages are passed
on. This filtering is required by the CEC specification.

The next patch handles a corner case where one message can have two
different replies.

Then support for CDC-Only devices is added, which was a previously
not-very-well supported corner case.

The last four patches move the cec framework and pulse8-cec driver
out of staging.

Regards,

	Hans


Hans Verkuil (11):
  pulse8-cec: set all_device_types when restoring config
  cec rst: convert tables and drop the 'row' comments
  cec: add flag to cec_log_addrs to enable RC passthrough
  cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS
  cec: filter invalid messages
  cec: accept two replies for CEC_MSG_INITIATE_ARC.
  cec: add proper support for CDC-Only CEC devices
  cec: move the CEC framework out of staging and to media
  pulse8-cec: move out of staging
  s5p-cec/st-cec: update TODOs
  MAINTAINERS: update paths

 .../media/uapi/cec/cec-ioc-adap-g-caps.rst         | 156 +++----
 .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst    | 487 ++++++++-------------
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst   | 182 +++-----
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst    | 317 ++++++--------
 Documentation/media/uapi/cec/cec-ioc-receive.rst   | 418 ++++++++----------
 MAINTAINERS                                        |  10 +-
 drivers/media/Kconfig                              |  16 +
 drivers/media/Makefile                             |   4 +
 drivers/{staging => }/media/cec/Makefile           |   2 +-
 drivers/{staging => }/media/cec/cec-adap.c         | 212 ++++++++-
 drivers/{staging => }/media/cec/cec-api.c          |  11 +-
 drivers/{staging => }/media/cec/cec-core.c         |   0
 drivers/{staging => }/media/cec/cec-priv.h         |   0
 drivers/media/i2c/Kconfig                          |   6 +-
 drivers/media/platform/vivid/Kconfig               |   2 +-
 drivers/media/usb/Kconfig                          |   5 +
 drivers/media/usb/Makefile                         |   1 +
 .../media => media/usb}/pulse8-cec/Kconfig         |   2 +-
 .../media => media/usb}/pulse8-cec/Makefile        |   0
 .../media => media/usb}/pulse8-cec/pulse8-cec.c    |   8 +
 drivers/staging/media/Kconfig                      |   4 -
 drivers/staging/media/Makefile                     |   2 -
 drivers/staging/media/cec/Kconfig                  |  12 -
 drivers/staging/media/cec/TODO                     |  32 --
 drivers/staging/media/pulse8-cec/TODO              |  52 ---
 drivers/staging/media/s5p-cec/Kconfig              |   2 +-
 drivers/staging/media/s5p-cec/TODO                 |  12 +-
 drivers/staging/media/st-cec/Kconfig               |   2 +-
 drivers/staging/media/st-cec/TODO                  |   7 +
 include/media/cec.h                                |   2 +-
 include/uapi/linux/Kbuild                          |   2 +
 include/{ => uapi}/linux/cec-funcs.h               |   6 -
 include/{ => uapi}/linux/cec.h                     |  65 ++-
 33 files changed, 951 insertions(+), 1088 deletions(-)
 rename drivers/{staging => }/media/cec/Makefile (70%)
 rename drivers/{staging => }/media/cec/cec-adap.c (86%)
 rename drivers/{staging => }/media/cec/cec-api.c (97%)
 rename drivers/{staging => }/media/cec/cec-core.c (100%)
 rename drivers/{staging => }/media/cec/cec-priv.h (100%)
 rename drivers/{staging/media => media/usb}/pulse8-cec/Kconfig (86%)
 rename drivers/{staging/media => media/usb}/pulse8-cec/Makefile (100%)
 rename drivers/{staging/media => media/usb}/pulse8-cec/pulse8-cec.c (97%)
 delete mode 100644 drivers/staging/media/cec/Kconfig
 delete mode 100644 drivers/staging/media/cec/TODO
 delete mode 100644 drivers/staging/media/pulse8-cec/TODO
 create mode 100644 drivers/staging/media/st-cec/TODO
 rename include/{ => uapi}/linux/cec-funcs.h (99%)
 rename include/{ => uapi}/linux/cec.h (94%)

-- 
2.10.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 01/11] pulse8-cec: set all_device_types when restoring config
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 02/11] cec rst: convert tables and drop the 'row' comments Hans Verkuil
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

When the persistent state is restored, the all_device_types field
was never filled in. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/staging/media/pulse8-cec/pulse8-cec.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/staging/media/pulse8-cec/pulse8-cec.c
index 1732c38..9092494 100644
--- a/drivers/staging/media/pulse8-cec/pulse8-cec.c
+++ b/drivers/staging/media/pulse8-cec/pulse8-cec.c
@@ -375,27 +375,35 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
 	switch (log_addrs->primary_device_type[0]) {
 	case CEC_OP_PRIM_DEVTYPE_TV:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TV;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TV;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_RECORD:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_RECORD;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_RECORD;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_TUNER:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_TUNER;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_TUNER;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_PLAYBACK:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_PLAYBACK;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_SWITCH:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH;
 		break;
 	case CEC_OP_PRIM_DEVTYPE_PROCESSOR:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_SPECIFIC;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH;
 		break;
 	default:
 		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED;
+		log_addrs->all_device_types[0] = CEC_OP_ALL_DEVTYPE_SWITCH;
 		dev_info(pulse8->dev, "Unknown Primary Device Type: %d\n",
 			 log_addrs->primary_device_type[0]);
 		break;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 02/11] cec rst: convert tables and drop the 'row' comments
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
  2016-11-02 12:46 ` [PATCH 01/11] pulse8-cec: set all_device_types when restoring config Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 03/11] cec: add flag to cec_log_addrs to enable RC passthrough Hans Verkuil
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

This uses Laurent's python script to convert all tables, dropping
the useless 'row' comments.

See commit c2b66cafdf02 ("[media] v4l: doc: Remove row numbers from tables")
for the script that was used.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 .../media/uapi/cec/cec-ioc-adap-g-caps.rst         | 156 +++----
 .../media/uapi/cec/cec-ioc-adap-g-log-addrs.rst    | 475 ++++++++-------------
 Documentation/media/uapi/cec/cec-ioc-dqevent.rst   | 182 +++-----
 Documentation/media/uapi/cec/cec-ioc-g-mode.rst    | 317 ++++++--------
 Documentation/media/uapi/cec/cec-ioc-receive.rst   | 394 +++++++----------
 5 files changed, 579 insertions(+), 945 deletions(-)

diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst
index a35dca2..2b0ddb1 100644
--- a/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-caps.rst
@@ -48,41 +48,21 @@ returns the information to the application. The ioctl never fails.
     :stub-columns: 0
     :widths:       1 1 16
 
-
-    -  .. row 1
-
-       -  char
-
-       -  ``driver[32]``
-
-       -  The name of the cec adapter driver.
-
-    -  .. row 2
-
-       -  char
-
-       -  ``name[32]``
-
-       -  The name of this CEC adapter. The combination ``driver`` and
-	  ``name`` must be unique.
-
-    -  .. row 3
-
-       -  __u32
-
-       -  ``capabilities``
-
-       -  The capabilities of the CEC adapter, see
-	  :ref:`cec-capabilities`.
-
-    -  .. row 4
-
-       -  __u32
-
-       -  ``version``
-
-       -  CEC Framework API version, formatted with the ``KERNEL_VERSION()``
-	  macro.
+    * - char
+      - ``driver[32]``
+      - The name of the cec adapter driver.
+    * - char
+      - ``name[32]``
+      - The name of this CEC adapter. The combination ``driver`` and
+	``name`` must be unique.
+    * - __u32
+      - ``capabilities``
+      - The capabilities of the CEC adapter, see
+	:ref:`cec-capabilities`.
+    * - __u32
+      - ``version``
+      - CEC Framework API version, formatted with the ``KERNEL_VERSION()``
+	macro.
 
 
 .. tabularcolumns:: |p{4.4cm}|p{2.5cm}|p{10.6cm}|
@@ -94,68 +74,50 @@ returns the information to the application. The ioctl never fails.
     :stub-columns: 0
     :widths:       3 1 8
 
-
-    -  .. _`CEC-CAP-PHYS-ADDR`:
-
-       -  ``CEC_CAP_PHYS_ADDR``
-
-       -  0x00000001
-
-       -  Userspace has to configure the physical address by calling
-	  :ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`. If
-	  this capability isn't set, then setting the physical address is
-	  handled by the kernel whenever the EDID is set (for an HDMI
-	  receiver) or read (for an HDMI transmitter).
-
-    -  .. _`CEC-CAP-LOG-ADDRS`:
-
-       -  ``CEC_CAP_LOG_ADDRS``
-
-       -  0x00000002
-
-       -  Userspace has to configure the logical addresses by calling
-	  :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`. If
-	  this capability isn't set, then the kernel will have configured
-	  this.
-
-    -  .. _`CEC-CAP-TRANSMIT`:
-
-       -  ``CEC_CAP_TRANSMIT``
-
-       -  0x00000004
-
-       -  Userspace can transmit CEC messages by calling
-	  :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. This implies that
-	  userspace can be a follower as well, since being able to transmit
-	  messages is a prerequisite of becoming a follower. If this
-	  capability isn't set, then the kernel will handle all CEC
-	  transmits and process all CEC messages it receives.
-
-    -  .. _`CEC-CAP-PASSTHROUGH`:
-
-       -  ``CEC_CAP_PASSTHROUGH``
-
-       -  0x00000008
-
-       -  Userspace can use the passthrough mode by calling
-	  :ref:`ioctl CEC_S_MODE <CEC_S_MODE>`.
-
-    -  .. _`CEC-CAP-RC`:
-
-       -  ``CEC_CAP_RC``
-
-       -  0x00000010
-
-       -  This adapter supports the remote control protocol.
-
-    -  .. _`CEC-CAP-MONITOR-ALL`:
-
-       -  ``CEC_CAP_MONITOR_ALL``
-
-       -  0x00000020
-
-       -  The CEC hardware can monitor all messages, not just directed and
-	  broadcast messages.
+    * .. _`CEC-CAP-PHYS-ADDR`:
+
+      - ``CEC_CAP_PHYS_ADDR``
+      - 0x00000001
+      - Userspace has to configure the physical address by calling
+	:ref:`ioctl CEC_ADAP_S_PHYS_ADDR <CEC_ADAP_S_PHYS_ADDR>`. If
+	this capability isn't set, then setting the physical address is
+	handled by the kernel whenever the EDID is set (for an HDMI
+	receiver) or read (for an HDMI transmitter).
+    * .. _`CEC-CAP-LOG-ADDRS`:
+
+      - ``CEC_CAP_LOG_ADDRS``
+      - 0x00000002
+      - Userspace has to configure the logical addresses by calling
+	:ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`. If
+	this capability isn't set, then the kernel will have configured
+	this.
+    * .. _`CEC-CAP-TRANSMIT`:
+
+      - ``CEC_CAP_TRANSMIT``
+      - 0x00000004
+      - Userspace can transmit CEC messages by calling
+	:ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. This implies that
+	userspace can be a follower as well, since being able to transmit
+	messages is a prerequisite of becoming a follower. If this
+	capability isn't set, then the kernel will handle all CEC
+	transmits and process all CEC messages it receives.
+    * .. _`CEC-CAP-PASSTHROUGH`:
+
+      - ``CEC_CAP_PASSTHROUGH``
+      - 0x00000008
+      - Userspace can use the passthrough mode by calling
+	:ref:`ioctl CEC_S_MODE <CEC_S_MODE>`.
+    * .. _`CEC-CAP-RC`:
+
+      - ``CEC_CAP_RC``
+      - 0x00000010
+      - This adapter supports the remote control protocol.
+    * .. _`CEC-CAP-MONITOR-ALL`:
+
+      - ``CEC_CAP_MONITOR_ALL``
+      - 0x00000020
+      - The CEC hardware can monitor all messages, not just directed and
+	broadcast messages.
 
 
 
diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
index 940a16d..af35f71 100644
--- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
@@ -77,134 +77,79 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       1 1 16
 
-
-    -  .. row 1
-
-       -  __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``. If this adapter is Unregistered, then
-	  ``log_addr[0]`` is set to 0xf and all others to
-	  ``CEC_LOG_ADDR_INVALID``.
-
-    -  .. row 2
-
-       -  __u16
-
-       -  ``log_addr_mask``
-
-       -  The bitmask of all logical addresses this adapter has claimed. If
-	  this adapter is Unregistered then ``log_addr_mask`` sets bit 15
-	  and clears all other bits. If this adapter is not configured at
-	  all, then ``log_addr_mask`` is set to 0. Set by the driver.
-
-    -  .. row 3
-
-       -  __u8
-
-       -  ``cec_version``
-
-       -  The CEC version that this adapter shall use. See
-	  :ref:`cec-versions`. Used to implement the
-	  ``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages.
-	  Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-CEC-VERSION-1-3A>` is not allowed by the CEC
-	  framework.
-
-    -  .. row 4
-
-       -  __u8
-
-       -  ``num_log_addrs``
-
-       -  Number of logical addresses to set up. Must be ≤
-	  ``available_log_addrs`` as returned by
-	  :ref:`CEC_ADAP_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.
-
-    -  .. row 5
-
-       -  __u32
-
-       -  ``vendor_id``
-
-       -  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. If you do not want a vendor ID then set it to
-	  ``CEC_VENDOR_ID_NONE``.
-
-    -  .. row 6
-
-       -  __u32
-
-       -  ``flags``
-
-       -  Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
-
-    -  .. row 7
-
-       -  char
-
-       -  ``osd_name[15]``
-
-       -  The On-Screen Display name as is returned by the
-	  ``CEC_MSG_SET_OSD_NAME`` message.
-
-    -  .. row 8
-
-       -  __u8
-
-       -  ``primary_device_type[CEC_MAX_LOG_ADDRS]``
-
-       -  Primary device type for each logical address. See
-	  :ref:`cec-prim-dev-types` for possible types.
-
-    -  .. row 9
-
-       -  __u8
-
-       -  ``log_addr_type[CEC_MAX_LOG_ADDRS]``
-
-       -  Logical address types. See :ref:`cec-log-addr-types` 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 :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`).
-
-    -  .. row 10
-
-       -  __u8
-
-       -  ``all_device_types[CEC_MAX_LOG_ADDRS]``
-
-       -  CEC 2.0 specific: the bit mask of all device types. See
-	  :ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0
-	  ``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave
-	  this field to 0, or fill it in according to the CEC 2.0 guidelines to
-	  give the CEC framework more information about the device type, even
-	  though the framework won't use it directly in the CEC message.
-
-    -  .. row 11
-
-       -  __u8
-
-       -  ``features[CEC_MAX_LOG_ADDRS][12]``
-
-       -  Features for each logical address. It is used in the CEC 2.0
-	  ``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the
-	  RC Profile and the Device Features. For CEC 1.4 you can either leave
-          this field to all 0, or fill it in according to the CEC 2.0 guidelines to
-          give the CEC framework more information about the device type, even
-          though the framework won't use it directly in the CEC message.
+    * - __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``. If this adapter is Unregistered, then
+	``log_addr[0]`` is set to 0xf and all others to
+	``CEC_LOG_ADDR_INVALID``.
+    * - __u16
+      - ``log_addr_mask``
+      - The bitmask of all logical addresses this adapter has claimed. If
+	this adapter is Unregistered then ``log_addr_mask`` sets bit 15
+	and clears all other bits. If this adapter is not configured at
+	all, then ``log_addr_mask`` is set to 0. Set by the driver.
+    * - __u8
+      - ``cec_version``
+      - The CEC version that this adapter shall use. See
+	:ref:`cec-versions`. Used to implement the
+	``CEC_MSG_CEC_VERSION`` and ``CEC_MSG_REPORT_FEATURES`` messages.
+	Note that :ref:`CEC_OP_CEC_VERSION_1_3A <CEC-OP-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
+	:ref:`CEC_ADAP_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.
+    * - __u32
+      - ``vendor_id``
+      - 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. If you do not want a vendor ID then set it to
+	``CEC_VENDOR_ID_NONE``.
+    * - __u32
+      - ``flags``
+      - Flags. See :ref:`cec-log-addrs-flags` for a list of available flags.
+    * - char
+      - ``osd_name[15]``
+      - The On-Screen Display name as is returned by the
+	``CEC_MSG_SET_OSD_NAME`` message.
+    * - __u8
+      - ``primary_device_type[CEC_MAX_LOG_ADDRS]``
+      - Primary device type for each logical address. See
+	:ref:`cec-prim-dev-types` for possible types.
+    * - __u8
+      - ``log_addr_type[CEC_MAX_LOG_ADDRS]``
+      - Logical address types. See :ref:`cec-log-addr-types` 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 :ref:`CEC_LOG_ADDR_TYPE_UNREGISTERED <CEC-LOG-ADDR-TYPE-UNREGISTERED>`).
+    * - __u8
+      - ``all_device_types[CEC_MAX_LOG_ADDRS]``
+      - CEC 2.0 specific: the bit mask of all device types. See
+	:ref:`cec-all-dev-types-flags`. It is used in the CEC 2.0
+	``CEC_MSG_REPORT_FEATURES`` message. For CEC 1.4 you can either leave
+	this field to 0, or fill it in according to the CEC 2.0 guidelines to
+	give the CEC framework more information about the device type, even
+	though the framework won't use it directly in the CEC message.
+    * - __u8
+      - ``features[CEC_MAX_LOG_ADDRS][12]``
+      - Features for each logical address. It is used in the CEC 2.0
+	``CEC_MSG_REPORT_FEATURES`` message. The 12 bytes include both the
+	RC Profile and the Device Features. For CEC 1.4 you can either leave
+        this field to all 0, or fill it in according to the CEC 2.0 guidelines to
+        give the CEC framework more information about the device type, even
+        though the framework won't use it directly in the CEC message.
 
 .. _cec-log-addrs-flags:
 
@@ -213,17 +158,14 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       3 1 4
 
+    * .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
 
-    -  .. _`CEC-LOG-ADDRS-FL-ALLOW-UNREG-FALLBACK`:
-
-       -  ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
-
-       -  1
-
-       -  By default if no logical address of the requested type can be claimed, then
-	  it will go back to the unconfigured state. If this flag is set, then it will
-	  fallback to the Unregistered logical address. Note that if the Unregistered
-	  logical address was explicitly requested, then this flag has no effect.
+      - ``CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK``
+      - 1
+      - By default if no logical address of the requested type can be claimed, then
+	it will go back to the unconfigured state. If this flag is set, then it will
+	fallback to the Unregistered logical address. Note that if the Unregistered
+	logical address was explicitly requested, then this flag has no effect.
 
 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
 
@@ -234,30 +176,21 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       3 1 4
 
+    * .. _`CEC-OP-CEC-VERSION-1-3A`:
 
-    -  .. _`CEC-OP-CEC-VERSION-1-3A`:
-
-       -  ``CEC_OP_CEC_VERSION_1_3A``
-
-       -  4
-
-       -  CEC version according to the HDMI 1.3a standard.
-
-    -  .. _`CEC-OP-CEC-VERSION-1-4B`:
+      - ``CEC_OP_CEC_VERSION_1_3A``
+      - 4
+      - CEC version according to the HDMI 1.3a standard.
+    * .. _`CEC-OP-CEC-VERSION-1-4B`:
 
-       -  ``CEC_OP_CEC_VERSION_1_4B``
+      - ``CEC_OP_CEC_VERSION_1_4B``
+      - 5
+      - CEC version according to the HDMI 1.4b standard.
+    * .. _`CEC-OP-CEC-VERSION-2-0`:
 
-       -  5
-
-       -  CEC version according to the HDMI 1.4b standard.
-
-    -  .. _`CEC-OP-CEC-VERSION-2-0`:
-
-       -  ``CEC_OP_CEC_VERSION_2_0``
-
-       -  6
-
-       -  CEC version according to the HDMI 2.0 standard.
+      - ``CEC_OP_CEC_VERSION_2_0``
+      - 6
+      - CEC version according to the HDMI 2.0 standard.
 
 
 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
@@ -269,62 +202,41 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       3 1 4
 
+    * .. _`CEC-OP-PRIM-DEVTYPE-TV`:
 
-    -  .. _`CEC-OP-PRIM-DEVTYPE-TV`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_TV``
-
-       -  0
+      - ``CEC_OP_PRIM_DEVTYPE_TV``
+      - 0
+      - Use for a TV.
+    * .. _`CEC-OP-PRIM-DEVTYPE-RECORD`:
 
-       -  Use for a TV.
+      - ``CEC_OP_PRIM_DEVTYPE_RECORD``
+      - 1
+      - Use for a recording device.
+    * .. _`CEC-OP-PRIM-DEVTYPE-TUNER`:
 
-    -  .. _`CEC-OP-PRIM-DEVTYPE-RECORD`:
+      - ``CEC_OP_PRIM_DEVTYPE_TUNER``
+      - 3
+      - Use for a device with a tuner.
+    * .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`:
 
-       -  ``CEC_OP_PRIM_DEVTYPE_RECORD``
+      - ``CEC_OP_PRIM_DEVTYPE_PLAYBACK``
+      - 4
+      - Use for a playback device.
+    * .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`:
 
-       -  1
+      - ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM``
+      - 5
+      - Use for an audio system (e.g. an audio/video receiver).
+    * .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`:
 
-       -  Use for a recording device.
+      - ``CEC_OP_PRIM_DEVTYPE_SWITCH``
+      - 6
+      - Use for a CEC switch.
+    * .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`:
 
-    -  .. _`CEC-OP-PRIM-DEVTYPE-TUNER`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_TUNER``
-
-       -  3
-
-       -  Use for a device with a tuner.
-
-    -  .. _`CEC-OP-PRIM-DEVTYPE-PLAYBACK`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_PLAYBACK``
-
-       -  4
-
-       -  Use for a playback device.
-
-    -  .. _`CEC-OP-PRIM-DEVTYPE-AUDIOSYSTEM`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM``
-
-       -  5
-
-       -  Use for an audio system (e.g. an audio/video receiver).
-
-    -  .. _`CEC-OP-PRIM-DEVTYPE-SWITCH`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_SWITCH``
-
-       -  6
-
-       -  Use for a CEC switch.
-
-    -  .. _`CEC-OP-PRIM-DEVTYPE-VIDEOPROC`:
-
-       -  ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC``
-
-       -  7
-
-       -  Use for a video processor device.
+      - ``CEC_OP_PRIM_DEVTYPE_VIDEOPROC``
+      - 7
+      - Use for a video processor device.
 
 
 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
@@ -336,64 +248,43 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       3 1 16
 
+    * .. _`CEC-LOG-ADDR-TYPE-TV`:
 
-    -  .. _`CEC-LOG-ADDR-TYPE-TV`:
-
-       -  ``CEC_LOG_ADDR_TYPE_TV``
-
-       -  0
-
-       -  Use for a TV.
-
-    -  .. _`CEC-LOG-ADDR-TYPE-RECORD`:
-
-       -  ``CEC_LOG_ADDR_TYPE_RECORD``
-
-       -  1
-
-       -  Use for a recording device.
-
-    -  .. _`CEC-LOG-ADDR-TYPE-TUNER`:
-
-       -  ``CEC_LOG_ADDR_TYPE_TUNER``
-
-       -  2
+      - ``CEC_LOG_ADDR_TYPE_TV``
+      - 0
+      - Use for a TV.
+    * .. _`CEC-LOG-ADDR-TYPE-RECORD`:
 
-       -  Use for a tuner device.
+      - ``CEC_LOG_ADDR_TYPE_RECORD``
+      - 1
+      - Use for a recording device.
+    * .. _`CEC-LOG-ADDR-TYPE-TUNER`:
 
-    -  .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`:
+      - ``CEC_LOG_ADDR_TYPE_TUNER``
+      - 2
+      - Use for a tuner device.
+    * .. _`CEC-LOG-ADDR-TYPE-PLAYBACK`:
 
-       -  ``CEC_LOG_ADDR_TYPE_PLAYBACK``
+      - ``CEC_LOG_ADDR_TYPE_PLAYBACK``
+      - 3
+      - Use for a playback device.
+    * .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`:
 
-       -  3
+      - ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM``
+      - 4
+      - Use for an audio system device.
+    * .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`:
 
-       -  Use for a playback device.
+      - ``CEC_LOG_ADDR_TYPE_SPECIFIC``
+      - 5
+      - Use for a second TV or for a video processor device.
+    * .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`:
 
-    -  .. _`CEC-LOG-ADDR-TYPE-AUDIOSYSTEM`:
-
-       -  ``CEC_LOG_ADDR_TYPE_AUDIOSYSTEM``
-
-       -  4
-
-       -  Use for an audio system device.
-
-    -  .. _`CEC-LOG-ADDR-TYPE-SPECIFIC`:
-
-       -  ``CEC_LOG_ADDR_TYPE_SPECIFIC``
-
-       -  5
-
-       -  Use for a second TV or for a video processor device.
-
-    -  .. _`CEC-LOG-ADDR-TYPE-UNREGISTERED`:
-
-       -  ``CEC_LOG_ADDR_TYPE_UNREGISTERED``
-
-       -  6
-
-       -  Use this if you just want to remain unregistered. Used for pure
-	  CEC switches or CDC-only devices (CDC: Capability Discovery and
-	  Control).
+      - ``CEC_LOG_ADDR_TYPE_UNREGISTERED``
+      - 6
+      - Use this if you just want to remain unregistered. Used for pure
+	CEC switches or CDC-only devices (CDC: Capability Discovery and
+	Control).
 
 
 
@@ -406,54 +297,36 @@ logical address types are already defined will return with error ``EBUSY``.
     :stub-columns: 0
     :widths:       3 1 4
 
+    * .. _`CEC-OP-ALL-DEVTYPE-TV`:
 
-    -  .. _`CEC-OP-ALL-DEVTYPE-TV`:
-
-       -  ``CEC_OP_ALL_DEVTYPE_TV``
-
-       -  0x80
-
-       -  This supports the TV type.
-
-    -  .. _`CEC-OP-ALL-DEVTYPE-RECORD`:
-
-       -  ``CEC_OP_ALL_DEVTYPE_RECORD``
-
-       -  0x40
-
-       -  This supports the Recording type.
-
-    -  .. _`CEC-OP-ALL-DEVTYPE-TUNER`:
-
-       -  ``CEC_OP_ALL_DEVTYPE_TUNER``
-
-       -  0x20
-
-       -  This supports the Tuner type.
-
-    -  .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`:
-
-       -  ``CEC_OP_ALL_DEVTYPE_PLAYBACK``
-
-       -  0x10
-
-       -  This supports the Playback type.
-
-    -  .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`:
-
-       -  ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM``
-
-       -  0x08
+      - ``CEC_OP_ALL_DEVTYPE_TV``
+      - 0x80
+      - This supports the TV type.
+    * .. _`CEC-OP-ALL-DEVTYPE-RECORD`:
 
-       -  This supports the Audio System type.
+      - ``CEC_OP_ALL_DEVTYPE_RECORD``
+      - 0x40
+      - This supports the Recording type.
+    * .. _`CEC-OP-ALL-DEVTYPE-TUNER`:
 
-    -  .. _`CEC-OP-ALL-DEVTYPE-SWITCH`:
+      - ``CEC_OP_ALL_DEVTYPE_TUNER``
+      - 0x20
+      - This supports the Tuner type.
+    * .. _`CEC-OP-ALL-DEVTYPE-PLAYBACK`:
 
-       -  ``CEC_OP_ALL_DEVTYPE_SWITCH``
+      - ``CEC_OP_ALL_DEVTYPE_PLAYBACK``
+      - 0x10
+      - This supports the Playback type.
+    * .. _`CEC-OP-ALL-DEVTYPE-AUDIOSYSTEM`:
 
-       -  0x04
+      - ``CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM``
+      - 0x08
+      - This supports the Audio System type.
+    * .. _`CEC-OP-ALL-DEVTYPE-SWITCH`:
 
-       -  This supports the CEC Switch or Video Processing type.
+      - ``CEC_OP_ALL_DEVTYPE_SWITCH``
+      - 0x04
+      - This supports the CEC Switch or Video Processing type.
 
 
 
diff --git a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
index e283588..e256c66 100644
--- a/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-dqevent.rst
@@ -58,26 +58,16 @@ it is guaranteed that the state did change in between the two events.
     :stub-columns: 0
     :widths:       1 1 8
 
-
-    -  .. row 1
-
-       -  __u16
-
-       -  ``phys_addr``
-
-       -  The current physical address. This is ``CEC_PHYS_ADDR_INVALID`` if no
+    * - __u16
+      - ``phys_addr``
+      - The current physical address. This is ``CEC_PHYS_ADDR_INVALID`` if no
           valid physical address is set.
-
-    -  .. row 2
-
-       -  __u16
-
-       -  ``log_addr_mask``
-
-       -  The current set of claimed logical addresses. This is 0 if no logical
-          addresses are claimed or if ``phys_addr`` is ``CEC_PHYS_ADDR_INVALID``.
-	  If bit 15 is set (``1 << CEC_LOG_ADDR_UNREGISTERED``) then this device
-	  has the unregistered logical address. In that case all other bits are 0.
+    * - __u16
+      - ``log_addr_mask``
+      - The current set of claimed logical addresses. This is 0 if no logical
+        addresses are claimed or if ``phys_addr`` is ``CEC_PHYS_ADDR_INVALID``.
+	If bit 15 is set (``1 << CEC_LOG_ADDR_UNREGISTERED``) then this device
+	has the unregistered logical address. In that case all other bits are 0.
 
 
 .. c:type:: cec_event_lost_msgs
@@ -89,22 +79,17 @@ it is guaranteed that the state did change in between the two events.
     :stub-columns: 0
     :widths:       1 1 16
 
-
-    -  .. row 1
-
-       -  __u32
-
-       -  ``lost_msgs``
-
-       -  Set to the number of lost messages since the filehandle was opened
-	  or since the last time this event was dequeued for this
-	  filehandle. The messages lost are the oldest messages. So when a
-	  new message arrives and there is no more room, then the oldest
-	  message is discarded to make room for the new one. The internal
-	  size of the message queue guarantees that all messages received in
-	  the last two seconds will be stored. Since messages should be
-	  replied to within a second according to the CEC specification,
-	  this is more than enough.
+    * - __u32
+      - ``lost_msgs``
+      - Set to the number of lost messages since the filehandle was opened
+	or since the last time this event was dequeued for this
+	filehandle. The messages lost are the oldest messages. So when a
+	new message arrives and there is no more room, then the oldest
+	message is discarded to make room for the new one. The internal
+	size of the message queue guarantees that all messages received in
+	the last two seconds will be stored. Since messages should be
+	replied to within a second according to the CEC specification,
+	this is more than enough.
 
 
 .. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{2.5cm}|p{8.8cm}|
@@ -116,62 +101,32 @@ it is guaranteed that the state did change in between the two events.
     :stub-columns: 0
     :widths:       1 1 1 8
 
-
-    -  .. row 1
-
-       -  __u64
-
-       -  ``ts``
-
-       -  :cspan:`1` Timestamp of the event in ns.
-
-	  The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
-	  the same clock from userspace use :c:func:`clock_gettime`.
-
-    -  .. row 2
-
-       -  __u32
-
-       -  ``event``
-
-       -  :cspan:`1` The CEC event type, see :ref:`cec-events`.
-
-    -  .. row 3
-
-       -  __u32
-
-       -  ``flags``
-
-       -  :cspan:`1` Event flags, see :ref:`cec-event-flags`.
-
-    -  .. row 4
-
-       -  union
-
-       -  (anonymous)
-
-       -
-       -
-
-    -  .. row 5
-
-       -
-       -  struct cec_event_state_change
-
-       -  ``state_change``
-
-       -  The new adapter state as sent by the :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>`
-	  event.
-
-    -  .. row 6
-
-       -
-       -  struct cec_event_lost_msgs
-
-       -  ``lost_msgs``
-
-       -  The number of lost messages as sent by the :ref:`CEC_EVENT_LOST_MSGS <CEC-EVENT-LOST-MSGS>`
-	  event.
+    * - __u64
+      - ``ts``
+      - :cspan:`1` Timestamp of the event in ns.
+
+	The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
+	the same clock from userspace use :c:func:`clock_gettime`.
+    * - __u32
+      - ``event``
+      - :cspan:`1` The CEC event type, see :ref:`cec-events`.
+    * - __u32
+      - ``flags``
+      - :cspan:`1` Event flags, see :ref:`cec-event-flags`.
+    * - union
+      - (anonymous)
+      -
+      -
+    * -
+      - struct cec_event_state_change
+      - ``state_change``
+      - The new adapter state as sent by the :ref:`CEC_EVENT_STATE_CHANGE <CEC-EVENT-STATE-CHANGE>`
+	event.
+    * -
+      - struct cec_event_lost_msgs
+      - ``lost_msgs``
+      - The number of lost messages as sent by the :ref:`CEC_EVENT_LOST_MSGS <CEC-EVENT-LOST-MSGS>`
+	event.
 
 
 .. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
@@ -183,25 +138,19 @@ it is guaranteed that the state did change in between the two events.
     :stub-columns: 0
     :widths:       3 1 16
 
+    * .. _`CEC-EVENT-STATE-CHANGE`:
 
-    -  .. _`CEC-EVENT-STATE-CHANGE`:
-
-       -  ``CEC_EVENT_STATE_CHANGE``
-
-       -  1
-
-       -  Generated when the CEC Adapter's state changes. When open() is
-	  called an initial event will be generated for that filehandle with
-	  the CEC Adapter's state at that time.
-
-    -  .. _`CEC-EVENT-LOST-MSGS`:
+      - ``CEC_EVENT_STATE_CHANGE``
+      - 1
+      - Generated when the CEC Adapter's state changes. When open() is
+	called an initial event will be generated for that filehandle with
+	the CEC Adapter's state at that time.
+    * .. _`CEC-EVENT-LOST-MSGS`:
 
-       -  ``CEC_EVENT_LOST_MSGS``
-
-       -  2
-
-       -  Generated if one or more CEC messages were lost because the
-	  application didn't dequeue CEC messages fast enough.
+      - ``CEC_EVENT_LOST_MSGS``
+      - 2
+      - Generated if one or more CEC messages were lost because the
+	application didn't dequeue CEC messages fast enough.
 
 
 .. tabularcolumns:: |p{6.0cm}|p{0.6cm}|p{10.9cm}|
@@ -213,17 +162,14 @@ it is guaranteed that the state did change in between the two events.
     :stub-columns: 0
     :widths:       3 1 8
 
+    * .. _`CEC-EVENT-FL-INITIAL-VALUE`:
 
-    -  .. _`CEC-EVENT-FL-INITIAL-VALUE`:
-
-       -  ``CEC_EVENT_FL_INITIAL_VALUE``
-
-       -  1
-
-       -  Set for the initial events that are generated when the device is
-	  opened. See the table above for which events do this. This allows
-	  applications to learn the initial state of the CEC adapter at
-	  open() time.
+      - ``CEC_EVENT_FL_INITIAL_VALUE``
+      - 1
+      - Set for the initial events that are generated when the device is
+	opened. See the table above for which events do this. This allows
+	applications to learn the initial state of the CEC adapter at
+	open() time.
 
 
 
diff --git a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
index 70a4190..4f5818b 100644
--- a/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-g-mode.rst
@@ -83,37 +83,28 @@ Available initiator modes are:
     :stub-columns: 0
     :widths:       3 1 16
 
-
-    -  .. _`CEC-MODE-NO-INITIATOR`:
-
-       -  ``CEC_MODE_NO_INITIATOR``
-
-       -  0x0
-
-       -  This is not an initiator, i.e. it cannot transmit CEC messages or
-	  make any other changes to the CEC adapter.
-
-    -  .. _`CEC-MODE-INITIATOR`:
-
-       -  ``CEC_MODE_INITIATOR``
-
-       -  0x1
-
-       -  This is an initiator (the default when the device is opened) and
-	  it can transmit CEC messages and make changes to the CEC adapter,
-	  unless there is an exclusive initiator.
-
-    -  .. _`CEC-MODE-EXCL-INITIATOR`:
-
-       -  ``CEC_MODE_EXCL_INITIATOR``
-
-       -  0x2
-
-       -  This is an exclusive initiator and this file descriptor is the
-	  only one that can transmit CEC messages and make changes to the
-	  CEC adapter. If someone else is already the exclusive initiator
-	  then an attempt to become one will return the ``EBUSY`` error code
-	  error.
+    * .. _`CEC-MODE-NO-INITIATOR`:
+
+      - ``CEC_MODE_NO_INITIATOR``
+      - 0x0
+      - This is not an initiator, i.e. it cannot transmit CEC messages or
+	make any other changes to the CEC adapter.
+    * .. _`CEC-MODE-INITIATOR`:
+
+      - ``CEC_MODE_INITIATOR``
+      - 0x1
+      - This is an initiator (the default when the device is opened) and
+	it can transmit CEC messages and make changes to the CEC adapter,
+	unless there is an exclusive initiator.
+    * .. _`CEC-MODE-EXCL-INITIATOR`:
+
+      - ``CEC_MODE_EXCL_INITIATOR``
+      - 0x2
+      - This is an exclusive initiator and this file descriptor is the
+	only one that can transmit CEC messages and make changes to the
+	CEC adapter. If someone else is already the exclusive initiator
+	then an attempt to become one will return the ``EBUSY`` error code
+	error.
 
 
 Available follower modes are:
@@ -127,86 +118,68 @@ Available follower modes are:
     :stub-columns: 0
     :widths:       3 1 16
 
-
-    -  .. _`CEC-MODE-NO-FOLLOWER`:
-
-       -  ``CEC_MODE_NO_FOLLOWER``
-
-       -  0x00
-
-       -  This is not a follower (the default when the device is opened).
-
-    -  .. _`CEC-MODE-FOLLOWER`:
-
-       -  ``CEC_MODE_FOLLOWER``
-
-       -  0x10
-
-       -  This is a follower and it will receive CEC messages unless there
-	  is an exclusive follower. You cannot become a follower if
-	  :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
-	  was specified, the ``EINVAL`` error code is returned in that case.
-
-    -  .. _`CEC-MODE-EXCL-FOLLOWER`:
-
-       -  ``CEC_MODE_EXCL_FOLLOWER``
-
-       -  0x20
-
-       -  This is an exclusive follower and only this file descriptor will
-	  receive CEC messages for processing. If someone else is already
-	  the exclusive follower then an attempt to become one will return
-	  the ``EBUSY`` error code. You cannot become a follower if
-	  :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
-	  was specified, the ``EINVAL`` error code is returned in that case.
-
-    -  .. _`CEC-MODE-EXCL-FOLLOWER-PASSTHRU`:
-
-       -  ``CEC_MODE_EXCL_FOLLOWER_PASSTHRU``
-
-       -  0x30
-
-       -  This is an exclusive follower and only this file descriptor will
-	  receive CEC messages for processing. In addition it will put the
-	  CEC device into passthrough mode, allowing the exclusive follower
-	  to handle most core messages instead of relying on the CEC
-	  framework for that. If someone else is already the exclusive
-	  follower then an attempt to become one will return the ``EBUSY`` error
-	  code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>`
-	  is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` was specified,
-	  the ``EINVAL`` error code is returned in that case.
-
-    -  .. _`CEC-MODE-MONITOR`:
-
-       -  ``CEC_MODE_MONITOR``
-
-       -  0xe0
-
-       -  Put the file descriptor into monitor mode. Can only be used in
-	  combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise EINVAL error
-	  code will be returned. In monitor mode all messages this CEC
-	  device transmits and all messages it receives (both broadcast
-	  messages and directed messages for one its logical addresses) will
-	  be reported. This is very useful for debugging. This is only
-	  allowed if the process has the ``CAP_NET_ADMIN`` capability. If
-	  that is not set, then the ``EPERM`` error code is returned.
-
-    -  .. _`CEC-MODE-MONITOR-ALL`:
-
-       -  ``CEC_MODE_MONITOR_ALL``
-
-       -  0xf0
-
-       -  Put the file descriptor into 'monitor all' mode. Can only be used
-	  in combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise
-	  the ``EINVAL`` error code will be returned. In 'monitor all' mode all messages
-	  this CEC device transmits and all messages it receives, including
-	  directed messages for other CEC devices will be reported. This is
-	  very useful for debugging, but not all devices support this. This
-	  mode requires that the :ref:`CEC_CAP_MONITOR_ALL <CEC-CAP-MONITOR-ALL>` capability is set,
-	  otherwise the ``EINVAL`` error code is returned. This is only allowed if
-	  the process has the ``CAP_NET_ADMIN`` capability. If that is not
-	  set, then the ``EPERM`` error code is returned.
+    * .. _`CEC-MODE-NO-FOLLOWER`:
+
+      - ``CEC_MODE_NO_FOLLOWER``
+      - 0x00
+      - This is not a follower (the default when the device is opened).
+    * .. _`CEC-MODE-FOLLOWER`:
+
+      - ``CEC_MODE_FOLLOWER``
+      - 0x10
+      - This is a follower and it will receive CEC messages unless there
+	is an exclusive follower. You cannot become a follower if
+	:ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
+	was specified, the ``EINVAL`` error code is returned in that case.
+    * .. _`CEC-MODE-EXCL-FOLLOWER`:
+
+      - ``CEC_MODE_EXCL_FOLLOWER``
+      - 0x20
+      - This is an exclusive follower and only this file descriptor will
+	receive CEC messages for processing. If someone else is already
+	the exclusive follower then an attempt to become one will return
+	the ``EBUSY`` error code. You cannot become a follower if
+	:ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>` is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`
+	was specified, the ``EINVAL`` error code is returned in that case.
+    * .. _`CEC-MODE-EXCL-FOLLOWER-PASSTHRU`:
+
+      - ``CEC_MODE_EXCL_FOLLOWER_PASSTHRU``
+      - 0x30
+      - This is an exclusive follower and only this file descriptor will
+	receive CEC messages for processing. In addition it will put the
+	CEC device into passthrough mode, allowing the exclusive follower
+	to handle most core messages instead of relying on the CEC
+	framework for that. If someone else is already the exclusive
+	follower then an attempt to become one will return the ``EBUSY`` error
+	code. You cannot become a follower if :ref:`CEC_CAP_TRANSMIT <CEC-CAP-TRANSMIT>`
+	is not set or if :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>` was specified,
+	the ``EINVAL`` error code is returned in that case.
+    * .. _`CEC-MODE-MONITOR`:
+
+      - ``CEC_MODE_MONITOR``
+      - 0xe0
+      - Put the file descriptor into monitor mode. Can only be used in
+	combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise EINVAL error
+	code will be returned. In monitor mode all messages this CEC
+	device transmits and all messages it receives (both broadcast
+	messages and directed messages for one its logical addresses) will
+	be reported. This is very useful for debugging. This is only
+	allowed if the process has the ``CAP_NET_ADMIN`` capability. If
+	that is not set, then the ``EPERM`` error code is returned.
+    * .. _`CEC-MODE-MONITOR-ALL`:
+
+      - ``CEC_MODE_MONITOR_ALL``
+      - 0xf0
+      - Put the file descriptor into 'monitor all' mode. Can only be used
+	in combination with :ref:`CEC_MODE_NO_INITIATOR <CEC-MODE-NO-INITIATOR>`, otherwise
+	the ``EINVAL`` error code will be returned. In 'monitor all' mode all messages
+	this CEC device transmits and all messages it receives, including
+	directed messages for other CEC devices will be reported. This is
+	very useful for debugging, but not all devices support this. This
+	mode requires that the :ref:`CEC_CAP_MONITOR_ALL <CEC-CAP-MONITOR-ALL>` capability is set,
+	otherwise the ``EINVAL`` error code is returned. This is only allowed if
+	the process has the ``CAP_NET_ADMIN`` capability. If that is not
+	set, then the ``EPERM`` error code is returned.
 
 
 Core message processing details:
@@ -220,76 +193,58 @@ Core message processing details:
     :stub-columns: 0
     :widths: 1 8
 
-
-    -  .. _`CEC-MSG-GET-CEC-VERSION`:
-
-       -  ``CEC_MSG_GET_CEC_VERSION``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will return the CEC version that was
-	  set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
-
-    -  .. _`CEC-MSG-GIVE-DEVICE-VENDOR-ID`:
-
-       -  ``CEC_MSG_GIVE_DEVICE_VENDOR_ID``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will return the vendor ID that was
-	  set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
-
-    -  .. _`CEC-MSG-ABORT`:
-
-       -  ``CEC_MSG_ABORT``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will return a feature refused
-	  message as per the specification.
-
-    -  .. _`CEC-MSG-GIVE-PHYSICAL-ADDR`:
-
-       -  ``CEC_MSG_GIVE_PHYSICAL_ADDR``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will report the current physical
-	  address.
-
-    -  .. _`CEC-MSG-GIVE-OSD-NAME`:
-
-       -  ``CEC_MSG_GIVE_OSD_NAME``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will report the current OSD name as
-	  was set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
-
-    -  .. _`CEC-MSG-GIVE-FEATURES`:
-
-       -  ``CEC_MSG_GIVE_FEATURES``
-
-       -  When in passthrough mode this message has to be handled by
-	  userspace, otherwise the core will report the current features as
-	  was set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
-	  or the message is ignored if the CEC version was older than 2.0.
-
-    -  .. _`CEC-MSG-USER-CONTROL-PRESSED`:
-
-       -  ``CEC_MSG_USER_CONTROL_PRESSED``
-
-       -  If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set, then generate a remote control key
-	  press. This message is always passed on to userspace.
-
-    -  .. _`CEC-MSG-USER-CONTROL-RELEASED`:
-
-       -  ``CEC_MSG_USER_CONTROL_RELEASED``
-
-       -  If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set, then generate a remote control key
-	  release. This message is always passed on to userspace.
-
-    -  .. _`CEC-MSG-REPORT-PHYSICAL-ADDR`:
-
-       -  ``CEC_MSG_REPORT_PHYSICAL_ADDR``
-
-       -  The CEC framework will make note of the reported physical address
-	  and then just pass the message on to userspace.
+    * .. _`CEC-MSG-GET-CEC-VERSION`:
+
+      - ``CEC_MSG_GET_CEC_VERSION``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will return the CEC version that was
+	set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
+    * .. _`CEC-MSG-GIVE-DEVICE-VENDOR-ID`:
+
+      - ``CEC_MSG_GIVE_DEVICE_VENDOR_ID``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will return the vendor ID that was
+	set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
+    * .. _`CEC-MSG-ABORT`:
+
+      - ``CEC_MSG_ABORT``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will return a feature refused
+	message as per the specification.
+    * .. _`CEC-MSG-GIVE-PHYSICAL-ADDR`:
+
+      - ``CEC_MSG_GIVE_PHYSICAL_ADDR``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will report the current physical
+	address.
+    * .. _`CEC-MSG-GIVE-OSD-NAME`:
+
+      - ``CEC_MSG_GIVE_OSD_NAME``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will report the current OSD name as
+	was set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`.
+    * .. _`CEC-MSG-GIVE-FEATURES`:
+
+      - ``CEC_MSG_GIVE_FEATURES``
+      - When in passthrough mode this message has to be handled by
+	userspace, otherwise the core will report the current features as
+	was set with :ref:`ioctl CEC_ADAP_S_LOG_ADDRS <CEC_ADAP_S_LOG_ADDRS>`
+	or the message is ignored if the CEC version was older than 2.0.
+    * .. _`CEC-MSG-USER-CONTROL-PRESSED`:
+
+      - ``CEC_MSG_USER_CONTROL_PRESSED``
+      - If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set, then generate a remote control key
+	press. This message is always passed on to userspace.
+    * .. _`CEC-MSG-USER-CONTROL-RELEASED`:
+
+      - ``CEC_MSG_USER_CONTROL_RELEASED``
+      - If :ref:`CEC_CAP_RC <CEC-CAP-RC>` is set, then generate a remote control key
+	release. This message is always passed on to userspace.
+    * .. _`CEC-MSG-REPORT-PHYSICAL-ADDR`:
+
+      - ``CEC_MSG_REPORT_PHYSICAL_ADDR``
+      - The CEC framework will make note of the reported physical address
+	and then just pass the message on to userspace.
 
 
 
diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst
index d585b1b..21a88df 100644
--- a/Documentation/media/uapi/cec/cec-ioc-receive.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst
@@ -86,173 +86,98 @@ result.
     :stub-columns: 0
     :widths:       1 1 16
 
-
-    -  .. row 1
-
-       -  __u64
-
-       -  ``tx_ts``
-
-       -  Timestamp in ns of when the last byte of the message was transmitted.
-	  The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
-	  the same clock from userspace use :c:func:`clock_gettime`.
-
-    -  .. row 2
-
-       -  __u64
-
-       -  ``rx_ts``
-
-       -  Timestamp in ns of when the last byte of the message was received.
-	  The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
-	  the same clock from userspace use :c:func:`clock_gettime`.
-
-    -  .. row 3
-
-       -  __u32
-
-       -  ``len``
-
-       -  The length of the message. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` this is filled in
-	  by the application. The driver will fill this in for
-	  :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` it will be
-	  filled in by the driver with the length of the reply message if ``reply`` was set.
-
-    -  .. row 4
-
-       -  __u32
-
-       -  ``timeout``
-
-       -  The timeout in milliseconds. This is the time the device will wait
-	  for a message to be received before timing out. If it is set to 0,
-	  then it will wait indefinitely when it is called by :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
-	  If it is 0 and it is called by :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`,
-	  then it will be replaced by 1000 if the ``reply`` is non-zero or
-	  ignored if ``reply`` is 0.
-
-    -  .. row 5
-
-       -  __u32
-
-       -  ``sequence``
-
-       -  A non-zero sequence number is automatically assigned by the CEC framework
-	  for all transmitted messages. It is used by the CEC framework when it queues
-	  the transmit result (when transmit was called in non-blocking mode). This
-	  allows the application to associate the received message with the original
-	  transmit.
-
-    -  .. row 6
-
-       -  __u32
-
-       -  ``flags``
-
-       -  Flags. No flags are defined yet, so set this to 0.
-
-    -  .. row 7
-
-       -  __u8
-
-       -  ``tx_status``
-
-       -  The status bits of the transmitted message. See
-	  :ref:`cec-tx-status` for the possible status values. It is 0 if
-	  this messages was received, not transmitted.
-
-    -  .. row 8
-
-       -  __u8
-
-       -  ``msg[16]``
-
-       -  The message payload. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` this is filled in by the
-	  application. The driver will fill this in for :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
-	  For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` it will be filled in by the driver with
-	  the payload of the reply message if ``timeout`` was set.
-
-    -  .. row 8
-
-       -  __u8
-
-       -  ``reply``
-
-       -  Wait until this message is replied. If ``reply`` is 0 and the
-	  ``timeout`` is 0, then don't wait for a reply but return after
-	  transmitting the message. Ignored by :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
-	  The case where ``reply`` is 0 (this is the opcode for the Feature Abort
-	  message) and ``timeout`` is non-zero is specifically allowed to make it
-	  possible to send a message and wait up to ``timeout`` milliseconds for a
-	  Feature Abort reply. In this case ``rx_status`` will either be set
-	  to :ref:`CEC_RX_STATUS_TIMEOUT <CEC-RX-STATUS-TIMEOUT>` or
-	  :ref:`CEC_RX_STATUS_FEATURE_ABORT <CEC-RX-STATUS-FEATURE-ABORT>`.
-
-    -  .. row 9
-
-       -  __u8
-
-       -  ``rx_status``
-
-       -  The status bits of the received message. See
-	  :ref:`cec-rx-status` for the possible status values. It is 0 if
-	  this message was transmitted, not received, unless this is the
-	  reply to a transmitted message. In that case both ``rx_status``
-	  and ``tx_status`` are set.
-
-    -  .. row 10
-
-       -  __u8
-
-       -  ``tx_status``
-
-       -  The status bits of the transmitted message. See
-	  :ref:`cec-tx-status` for the possible status values. It is 0 if
-	  this messages was received, not transmitted.
-
-    -  .. row 11
-
-       -  __u8
-
-       -  ``tx_arb_lost_cnt``
-
-       -  A counter of the number of transmit attempts that resulted in the
-	  Arbitration Lost error. This is only set if the hardware supports
-	  this, otherwise it is always 0. This counter is only valid if the
-	  :ref:`CEC_TX_STATUS_ARB_LOST <CEC-TX-STATUS-ARB-LOST>` status bit is set.
-
-    -  .. row 12
-
-       -  __u8
-
-       -  ``tx_nack_cnt``
-
-       -  A counter of the number of transmit attempts that resulted in the
-	  Not Acknowledged error. This is only set if the hardware supports
-	  this, otherwise it is always 0. This counter is only valid if the
-	  :ref:`CEC_TX_STATUS_NACK <CEC-TX-STATUS-NACK>` status bit is set.
-
-    -  .. row 13
-
-       -  __u8
-
-       -  ``tx_low_drive_cnt``
-
-       -  A counter of the number of transmit attempts that resulted in the
-	  Arbitration Lost error. This is only set if the hardware supports
-	  this, otherwise it is always 0. This counter is only valid if the
-	  :ref:`CEC_TX_STATUS_LOW_DRIVE <CEC-TX-STATUS-LOW-DRIVE>` status bit is set.
-
-    -  .. row 14
-
-       -  __u8
-
-       -  ``tx_error_cnt``
-
-       -  A counter of the number of transmit errors other than Arbitration
-	  Lost or Not Acknowledged. This is only set if the hardware
-	  supports this, otherwise it is always 0. This counter is only
-	  valid if the :ref:`CEC_TX_STATUS_ERROR <CEC-TX-STATUS-ERROR>` status bit is set.
+    * - __u64
+      - ``tx_ts``
+      - Timestamp in ns of when the last byte of the message was transmitted.
+	The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
+	the same clock from userspace use :c:func:`clock_gettime`.
+    * - __u64
+      - ``rx_ts``
+      - Timestamp in ns of when the last byte of the message was received.
+	The timestamp has been taken from the ``CLOCK_MONOTONIC`` clock. To access
+	the same clock from userspace use :c:func:`clock_gettime`.
+    * - __u32
+      - ``len``
+      - The length of the message. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` this is filled in
+	by the application. The driver will fill this in for
+	:ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` it will be
+	filled in by the driver with the length of the reply message if ``reply`` was set.
+    * - __u32
+      - ``timeout``
+      - The timeout in milliseconds. This is the time the device will wait
+	for a message to be received before timing out. If it is set to 0,
+	then it will wait indefinitely when it is called by :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
+	If it is 0 and it is called by :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`,
+	then it will be replaced by 1000 if the ``reply`` is non-zero or
+	ignored if ``reply`` is 0.
+    * - __u32
+      - ``sequence``
+      - A non-zero sequence number is automatically assigned by the CEC framework
+	for all transmitted messages. It is used by the CEC framework when it queues
+	the transmit result (when transmit was called in non-blocking mode). This
+	allows the application to associate the received message with the original
+	transmit.
+    * - __u32
+      - ``flags``
+      - Flags. No flags are defined yet, so set this to 0.
+    * - __u8
+      - ``tx_status``
+      - The status bits of the transmitted message. See
+	:ref:`cec-tx-status` for the possible status values. It is 0 if
+	this messages was received, not transmitted.
+    * - __u8
+      - ``msg[16]``
+      - The message payload. For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` this is filled in by the
+	application. The driver will fill this in for :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
+	For :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` it will be filled in by the driver with
+	the payload of the reply message if ``timeout`` was set.
+    * - __u8
+      - ``reply``
+      - Wait until this message is replied. If ``reply`` is 0 and the
+	``timeout`` is 0, then don't wait for a reply but return after
+	transmitting the message. Ignored by :ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
+	The case where ``reply`` is 0 (this is the opcode for the Feature Abort
+	message) and ``timeout`` is non-zero is specifically allowed to make it
+	possible to send a message and wait up to ``timeout`` milliseconds for a
+	Feature Abort reply. In this case ``rx_status`` will either be set
+	to :ref:`CEC_RX_STATUS_TIMEOUT <CEC-RX-STATUS-TIMEOUT>` or
+	:ref:`CEC_RX_STATUS_FEATURE_ABORT <CEC-RX-STATUS-FEATURE-ABORT>`.
+    * - __u8
+      - ``rx_status``
+      - The status bits of the received message. See
+	:ref:`cec-rx-status` for the possible status values. It is 0 if
+	this message was transmitted, not received, unless this is the
+	reply to a transmitted message. In that case both ``rx_status``
+	and ``tx_status`` are set.
+    * - __u8
+      - ``tx_status``
+      - The status bits of the transmitted message. See
+	:ref:`cec-tx-status` for the possible status values. It is 0 if
+	this messages was received, not transmitted.
+    * - __u8
+      - ``tx_arb_lost_cnt``
+      - A counter of the number of transmit attempts that resulted in the
+	Arbitration Lost error. This is only set if the hardware supports
+	this, otherwise it is always 0. This counter is only valid if the
+	:ref:`CEC_TX_STATUS_ARB_LOST <CEC-TX-STATUS-ARB-LOST>` status bit is set.
+    * - __u8
+      - ``tx_nack_cnt``
+      - A counter of the number of transmit attempts that resulted in the
+	Not Acknowledged error. This is only set if the hardware supports
+	this, otherwise it is always 0. This counter is only valid if the
+	:ref:`CEC_TX_STATUS_NACK <CEC-TX-STATUS-NACK>` status bit is set.
+    * - __u8
+      - ``tx_low_drive_cnt``
+      - A counter of the number of transmit attempts that resulted in the
+	Arbitration Lost error. This is only set if the hardware supports
+	this, otherwise it is always 0. This counter is only valid if the
+	:ref:`CEC_TX_STATUS_LOW_DRIVE <CEC-TX-STATUS-LOW-DRIVE>` status bit is set.
+    * - __u8
+      - ``tx_error_cnt``
+      - A counter of the number of transmit errors other than Arbitration
+	Lost or Not Acknowledged. This is only set if the hardware
+	supports this, otherwise it is always 0. This counter is only
+	valid if the :ref:`CEC_TX_STATUS_ERROR <CEC-TX-STATUS-ERROR>` status bit is set.
 
 
 .. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
@@ -264,64 +189,46 @@ result.
     :stub-columns: 0
     :widths:       3 1 16
 
-
-    -  .. _`CEC-TX-STATUS-OK`:
-
-       -  ``CEC_TX_STATUS_OK``
-
-       -  0x01
-
-       -  The message was transmitted successfully. This is mutually
-	  exclusive with :ref:`CEC_TX_STATUS_MAX_RETRIES <CEC-TX-STATUS-MAX-RETRIES>`. Other bits can still
-	  be set if earlier attempts met with failure before the transmit
-	  was eventually successful.
-
-    -  .. _`CEC-TX-STATUS-ARB-LOST`:
-
-       -  ``CEC_TX_STATUS_ARB_LOST``
-
-       -  0x02
-
-       -  CEC line arbitration was lost.
-
-    -  .. _`CEC-TX-STATUS-NACK`:
-
-       -  ``CEC_TX_STATUS_NACK``
-
-       -  0x04
-
-       -  Message was not acknowledged.
-
-    -  .. _`CEC-TX-STATUS-LOW-DRIVE`:
-
-       -  ``CEC_TX_STATUS_LOW_DRIVE``
-
-       -  0x08
-
-       -  Low drive was detected on the CEC bus. This indicates that a
-	  follower detected an error on the bus and requests a
-	  retransmission.
-
-    -  .. _`CEC-TX-STATUS-ERROR`:
-
-       -  ``CEC_TX_STATUS_ERROR``
-
-       -  0x10
-
-       -  Some error occurred. This is used for any errors that do not fit
-	  the previous two, either because the hardware could not tell which
-	  error occurred, or because the hardware tested for other
-	  conditions besides those two.
-
-    -  .. _`CEC-TX-STATUS-MAX-RETRIES`:
-
-       -  ``CEC_TX_STATUS_MAX_RETRIES``
-
-       -  0x20
-
-       -  The transmit failed after one or more retries. This status bit is
-	  mutually exclusive with :ref:`CEC_TX_STATUS_OK <CEC-TX-STATUS-OK>`. Other bits can still
-	  be set to explain which failures were seen.
+    * .. _`CEC-TX-STATUS-OK`:
+
+      - ``CEC_TX_STATUS_OK``
+      - 0x01
+      - The message was transmitted successfully. This is mutually
+	exclusive with :ref:`CEC_TX_STATUS_MAX_RETRIES <CEC-TX-STATUS-MAX-RETRIES>`. Other bits can still
+	be set if earlier attempts met with failure before the transmit
+	was eventually successful.
+    * .. _`CEC-TX-STATUS-ARB-LOST`:
+
+      - ``CEC_TX_STATUS_ARB_LOST``
+      - 0x02
+      - CEC line arbitration was lost.
+    * .. _`CEC-TX-STATUS-NACK`:
+
+      - ``CEC_TX_STATUS_NACK``
+      - 0x04
+      - Message was not acknowledged.
+    * .. _`CEC-TX-STATUS-LOW-DRIVE`:
+
+      - ``CEC_TX_STATUS_LOW_DRIVE``
+      - 0x08
+      - Low drive was detected on the CEC bus. This indicates that a
+	follower detected an error on the bus and requests a
+	retransmission.
+    * .. _`CEC-TX-STATUS-ERROR`:
+
+      - ``CEC_TX_STATUS_ERROR``
+      - 0x10
+      - Some error occurred. This is used for any errors that do not fit
+	the previous two, either because the hardware could not tell which
+	error occurred, or because the hardware tested for other
+	conditions besides those two.
+    * .. _`CEC-TX-STATUS-MAX-RETRIES`:
+
+      - ``CEC_TX_STATUS_MAX_RETRIES``
+      - 0x20
+      - The transmit failed after one or more retries. This status bit is
+	mutually exclusive with :ref:`CEC_TX_STATUS_OK <CEC-TX-STATUS-OK>`. Other bits can still
+	be set to explain which failures were seen.
 
 
 .. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
@@ -333,32 +240,23 @@ result.
     :stub-columns: 0
     :widths:       3 1 16
 
+    * .. _`CEC-RX-STATUS-OK`:
 
-    -  .. _`CEC-RX-STATUS-OK`:
-
-       -  ``CEC_RX_STATUS_OK``
-
-       -  0x01
-
-       -  The message was received successfully.
-
-    -  .. _`CEC-RX-STATUS-TIMEOUT`:
-
-       -  ``CEC_RX_STATUS_TIMEOUT``
-
-       -  0x02
-
-       -  The reply to an earlier transmitted message timed out.
-
-    -  .. _`CEC-RX-STATUS-FEATURE-ABORT`:
-
-       -  ``CEC_RX_STATUS_FEATURE_ABORT``
+      - ``CEC_RX_STATUS_OK``
+      - 0x01
+      - The message was received successfully.
+    * .. _`CEC-RX-STATUS-TIMEOUT`:
 
-       -  0x04
+      - ``CEC_RX_STATUS_TIMEOUT``
+      - 0x02
+      - The reply to an earlier transmitted message timed out.
+    * .. _`CEC-RX-STATUS-FEATURE-ABORT`:
 
-       -  The message was received successfully but the reply was
-	  ``CEC_MSG_FEATURE_ABORT``. This status is only set if this message
-	  was the reply to an earlier transmitted message.
+      - ``CEC_RX_STATUS_FEATURE_ABORT``
+      - 0x04
+      - The message was received successfully but the reply was
+	``CEC_MSG_FEATURE_ABORT``. This status is only set if this message
+	was the reply to an earlier transmitted message.
 
 
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 03/11] cec: add flag to cec_log_addrs to enable RC passthrough
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
  2016-11-02 12:46 ` [PATCH 01/11] pulse8-cec: set all_device_types when restoring config Hans Verkuil
  2016-11-02 12:46 ` [PATCH 02/11] cec rst: convert tables and drop the 'row' comments Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 04/11] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS Hans Verkuil
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

By default the CEC_MSG_USER_CONTROL_PRESSED/RELEASED messages
are passed on to the follower(s) only. If the new
CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU flag is set in the
flags field of struct cec_log_addrs then these messages are also
passed on to the remote control input subsystem and they will appear
as keystrokes.

This used to be the default behavior, but now you have to explicitly
enable it. This is done to force the caller to think about possible
security issues (e.g. if these messages are used to enter passwords).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst | 10 ++++++++++
 drivers/staging/media/cec/TODO                            |  2 --
 drivers/staging/media/cec/cec-adap.c                      |  6 ++++--
 drivers/staging/media/cec/cec-api.c                       |  3 ++-
 include/linux/cec.h                                       |  2 ++
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
index af35f71..571ae57 100644
--- a/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-adap-g-log-addrs.rst
@@ -166,6 +166,16 @@ logical address types are already defined will return with error ``EBUSY``.
 	it will go back to the unconfigured state. If this flag is set, then it will
 	fallback to the Unregistered logical address. Note that if the Unregistered
 	logical address was explicitly requested, then this flag has no effect.
+    * .. _`CEC-LOG-ADDRS-FL-ALLOW-RC-PASSTHRU`:
+
+      - ``CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU``
+      - 2
+      - By default the ``CEC_MSG_USER_CONTROL_PRESSED`` and ``CEC_MSG_USER_CONTROL_RELEASED``
+        messages are only passed on to the follower(s), if any. If this flag is set,
+	then these messages are also passed on to the remote control input subsystem
+	and will appear as keystrokes. This features needs to be enabled explicitly.
+	If CEC is used to enter e.g. passwords, then you may not want to enable this
+	to avoid trivial snooping of the keystrokes.
 
 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
 
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
index 1322469..0841206 100644
--- a/drivers/staging/media/cec/TODO
+++ b/drivers/staging/media/cec/TODO
@@ -13,8 +13,6 @@ Hopefully this will happen later in 2016.
 Other TODOs:
 
 - There are two possible replies to CEC_MSG_INITIATE_ARC. How to handle that?
-- Add a flag to inhibit passing CEC RC messages to the rc subsystem.
-  Applications should be able to choose this when calling S_LOG_ADDRS.
 - If the reply field of cec_msg is set then when the reply arrives it
   is only sent to the filehandle that transmitted the original message
   and not to any followers. Should this behavior change or perhaps
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index 611e07b..589e457 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -1478,7 +1478,8 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 	}
 
 	case CEC_MSG_USER_CONTROL_PRESSED:
-		if (!(adap->capabilities & CEC_CAP_RC))
+		if (!(adap->capabilities & CEC_CAP_RC) ||
+		    !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
 			break;
 
 #if IS_REACHABLE(CONFIG_RC_CORE)
@@ -1515,7 +1516,8 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 		break;
 
 	case CEC_MSG_USER_CONTROL_RELEASED:
-		if (!(adap->capabilities & CEC_CAP_RC))
+		if (!(adap->capabilities & CEC_CAP_RC) ||
+		    !(adap->log_addrs.flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU))
 			break;
 #if IS_REACHABLE(CONFIG_RC_CORE)
 		rc_keyup(adap->rc);
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/staging/media/cec/cec-api.c
index e274e2f..040ca7d 100644
--- a/drivers/staging/media/cec/cec-api.c
+++ b/drivers/staging/media/cec/cec-api.c
@@ -162,7 +162,8 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
 		return -ENOTTY;
 	if (copy_from_user(&log_addrs, parg, sizeof(log_addrs)))
 		return -EFAULT;
-	log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK;
+	log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK |
+			   CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU;
 	mutex_lock(&adap->lock);
 	if (!adap->is_configuring &&
 	    (!log_addrs.num_log_addrs || !adap->is_configured) &&
diff --git a/include/linux/cec.h b/include/linux/cec.h
index 851968e..825455f 100644
--- a/include/linux/cec.h
+++ b/include/linux/cec.h
@@ -391,6 +391,8 @@ struct cec_log_addrs {
 
 /* Allow a fallback to unregistered */
 #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK	(1 << 0)
+/* Passthrough RC messages to the input subsystem */
+#define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU	(1 << 1)
 
 /* Events */
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 04/11] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (2 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 03/11] cec: add flag to cec_log_addrs to enable RC passthrough Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 05/11] cec: filter invalid messages Hans Verkuil
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Give the caller more control over how replies to a transmit are
handled. By default the reply will only go to the filehandle that
called CEC_TRANSMIT. If this new flag is set, then the reply will
also go to all followers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 Documentation/media/uapi/cec/cec-ioc-receive.rst | 22 +++++++++++++++++++++-
 drivers/staging/media/cec/TODO                   |  4 ----
 drivers/staging/media/cec/cec-adap.c             |  6 +++---
 drivers/staging/media/cec/cec-api.c              |  1 +
 include/linux/cec.h                              |  5 ++++-
 5 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst
index 21a88df..b4dffd2 100644
--- a/Documentation/media/uapi/cec/cec-ioc-receive.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst
@@ -119,7 +119,7 @@ result.
 	transmit.
     * - __u32
       - ``flags``
-      - Flags. No flags are defined yet, so set this to 0.
+      - Flags. See :ref:`cec-msg-flags` for a list of available flags.
     * - __u8
       - ``tx_status``
       - The status bits of the transmitted message. See
@@ -180,6 +180,26 @@ result.
 	valid if the :ref:`CEC_TX_STATUS_ERROR <CEC-TX-STATUS-ERROR>` status bit is set.
 
 
+.. _cec-msg-flags:
+
+.. flat-table:: Flags for struct cec_msg
+    :header-rows:  0
+    :stub-columns: 0
+    :widths:       3 1 4
+
+    * .. _`CEC-MSG-FL-REPLY-TO-FOLLOWERS`:
+
+      - ``CEC_MSG_FL_REPLY_TO_FOLLOWERS``
+      - 1
+      - If a CEC transmit expects a reply, then by default that reply is only sent to
+	the filehandle that called :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`. If this
+	flag is set, then the reply is also sent to all followers, if any. If the
+	filehandle that called :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>` is also a
+	follower, then that filehandle will receive the reply twice: once as the
+	result of the :ref:`ioctl CEC_TRANSMIT <CEC_TRANSMIT>`, and once via
+	:ref:`ioctl CEC_RECEIVE <CEC_RECEIVE>`.
+
+
 .. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
 
 .. _cec-tx-status:
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
index 0841206..ce69001 100644
--- a/drivers/staging/media/cec/TODO
+++ b/drivers/staging/media/cec/TODO
@@ -13,10 +13,6 @@ Hopefully this will happen later in 2016.
 Other TODOs:
 
 - There are two possible replies to CEC_MSG_INITIATE_ARC. How to handle that?
-- If the reply field of cec_msg is set then when the reply arrives it
-  is only sent to the filehandle that transmitted the original message
-  and not to any followers. Should this behavior change or perhaps
-  controlled through a cec_msg flag?
 - Should CEC_LOG_ADDR_TYPE_SPECIFIC be replaced by TYPE_2ND_TV and TYPE_PROCESSOR?
   And also TYPE_SWITCH and TYPE_CDC_ONLY in addition to the TYPE_UNREGISTERED?
   This should give the framework more information about the device type
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index 589e457..6aceb1d 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -587,7 +587,6 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
 	msg->tx_nack_cnt = 0;
 	msg->tx_low_drive_cnt = 0;
 	msg->tx_error_cnt = 0;
-	msg->flags = 0;
 	msg->sequence = ++adap->sequence;
 	if (!msg->sequence)
 		msg->sequence = ++adap->sequence;
@@ -823,6 +822,7 @@ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg)
 			dst->rx_status = msg->rx_status;
 			if (abort)
 				dst->rx_status |= CEC_RX_STATUS_FEATURE_ABORT;
+			msg->flags = dst->flags;
 			/* Remove it from the wait_queue */
 			list_del_init(&data->list);
 
@@ -1575,8 +1575,8 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 	}
 
 skip_processing:
-	/* If this was a reply, then we're done */
-	if (is_reply)
+	/* If this was a reply, then we're done, unless otherwise specified */
+	if (is_reply && !(msg->flags & CEC_MSG_FL_REPLY_TO_FOLLOWERS))
 		return 0;
 
 	/*
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/staging/media/cec/cec-api.c
index 040ca7d..54148a6 100644
--- a/drivers/staging/media/cec/cec-api.c
+++ b/drivers/staging/media/cec/cec-api.c
@@ -190,6 +190,7 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
 		return -ENOTTY;
 	if (copy_from_user(&msg, parg, sizeof(msg)))
 		return -EFAULT;
+	msg.flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS;
 	mutex_lock(&adap->lock);
 	if (!adap->is_configured)
 		err = -ENONET;
diff --git a/include/linux/cec.h b/include/linux/cec.h
index 825455f..3f2f076 100644
--- a/include/linux/cec.h
+++ b/include/linux/cec.h
@@ -175,7 +175,10 @@ static inline void cec_msg_set_reply_to(struct cec_msg *msg,
 	msg->reply = msg->timeout = 0;
 }
 
-/* cec status field */
+/* cec_msg flags field */
+#define CEC_MSG_FL_REPLY_TO_FOLLOWERS	(1 << 0)
+
+/* cec_msg tx/rx_status field */
 #define CEC_TX_STATUS_OK		(1 << 0)
 #define CEC_TX_STATUS_ARB_LOST		(1 << 1)
 #define CEC_TX_STATUS_NACK		(1 << 2)
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 05/11] cec: filter invalid messages
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (3 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 04/11] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 06/11] cec: accept two replies for CEC_MSG_INITIATE_ARC Hans Verkuil
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

As per the CEC specification:

- CEC messages with a too-small payload should be ignored.
- Broadcast messages that are only allowed as directed messages
  should be ignored.
- Directed messages that are only allowed as broadcast messages
  should be ignored.

Implement this in the core CEC framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/staging/media/cec/cec-adap.c | 157 ++++++++++++++++++++++++++++++++++-
 1 file changed, 155 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index 6aceb1d..93b53e6 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -762,14 +762,105 @@ EXPORT_SYMBOL_GPL(cec_transmit_msg);
 static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 			      bool is_reply);
 
+#define DIRECTED	0x80
+#define BCAST1_4	0x40
+#define BCAST2_0	0x20	/* broadcast only allowed for >= 2.0 */
+#define BCAST		(BCAST1_4 | BCAST2_0)
+#define BOTH		(BCAST | DIRECTED)
+
+/*
+ * Specify minimum length and whether the message is directed, broadcast
+ * or both. Messages that do not match the criteria are ignored as per
+ * the CEC specification.
+ */
+static const u8 cec_msg_size[256] = {
+	[CEC_MSG_ACTIVE_SOURCE] = 4 | BCAST,
+	[CEC_MSG_IMAGE_VIEW_ON] = 2 | DIRECTED,
+	[CEC_MSG_TEXT_VIEW_ON] = 2 | DIRECTED,
+	[CEC_MSG_INACTIVE_SOURCE] = 4 | DIRECTED,
+	[CEC_MSG_REQUEST_ACTIVE_SOURCE] = 2 | BCAST,
+	[CEC_MSG_ROUTING_CHANGE] = 6 | BCAST,
+	[CEC_MSG_ROUTING_INFORMATION] = 4 | BCAST,
+	[CEC_MSG_SET_STREAM_PATH] = 4 | BCAST,
+	[CEC_MSG_STANDBY] = 2 | BOTH,
+	[CEC_MSG_RECORD_OFF] = 2 | DIRECTED,
+	[CEC_MSG_RECORD_ON] = 3 | DIRECTED,
+	[CEC_MSG_RECORD_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_RECORD_TV_SCREEN] = 2 | DIRECTED,
+	[CEC_MSG_CLEAR_ANALOGUE_TIMER] = 13 | DIRECTED,
+	[CEC_MSG_CLEAR_DIGITAL_TIMER] = 16 | DIRECTED,
+	[CEC_MSG_CLEAR_EXT_TIMER] = 13 | DIRECTED,
+	[CEC_MSG_SET_ANALOGUE_TIMER] = 13 | DIRECTED,
+	[CEC_MSG_SET_DIGITAL_TIMER] = 16 | DIRECTED,
+	[CEC_MSG_SET_EXT_TIMER] = 13 | DIRECTED,
+	[CEC_MSG_SET_TIMER_PROGRAM_TITLE] = 2 | DIRECTED,
+	[CEC_MSG_TIMER_CLEARED_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_TIMER_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_CEC_VERSION] = 3 | DIRECTED,
+	[CEC_MSG_GET_CEC_VERSION] = 2 | DIRECTED,
+	[CEC_MSG_GIVE_PHYSICAL_ADDR] = 2 | DIRECTED,
+	[CEC_MSG_GET_MENU_LANGUAGE] = 2 | DIRECTED,
+	[CEC_MSG_REPORT_PHYSICAL_ADDR] = 5 | BCAST,
+	[CEC_MSG_SET_MENU_LANGUAGE] = 5 | BCAST,
+	[CEC_MSG_REPORT_FEATURES] = 6 | BCAST,
+	[CEC_MSG_GIVE_FEATURES] = 2 | DIRECTED,
+	[CEC_MSG_DECK_CONTROL] = 3 | DIRECTED,
+	[CEC_MSG_DECK_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_GIVE_DECK_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_PLAY] = 3 | DIRECTED,
+	[CEC_MSG_GIVE_TUNER_DEVICE_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_SELECT_ANALOGUE_SERVICE] = 6 | DIRECTED,
+	[CEC_MSG_SELECT_DIGITAL_SERVICE] = 9 | DIRECTED,
+	[CEC_MSG_TUNER_DEVICE_STATUS] = 7 | DIRECTED,
+	[CEC_MSG_TUNER_STEP_DECREMENT] = 2 | DIRECTED,
+	[CEC_MSG_TUNER_STEP_INCREMENT] = 2 | DIRECTED,
+	[CEC_MSG_DEVICE_VENDOR_ID] = 5 | BCAST,
+	[CEC_MSG_GIVE_DEVICE_VENDOR_ID] = 2 | DIRECTED,
+	[CEC_MSG_VENDOR_COMMAND] = 2 | DIRECTED,
+	[CEC_MSG_VENDOR_COMMAND_WITH_ID] = 5 | BOTH,
+	[CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN] = 2 | BOTH,
+	[CEC_MSG_VENDOR_REMOTE_BUTTON_UP] = 2 | BOTH,
+	[CEC_MSG_SET_OSD_STRING] = 3 | DIRECTED,
+	[CEC_MSG_GIVE_OSD_NAME] = 2 | DIRECTED,
+	[CEC_MSG_SET_OSD_NAME] = 2 | DIRECTED,
+	[CEC_MSG_MENU_REQUEST] = 3 | DIRECTED,
+	[CEC_MSG_MENU_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_USER_CONTROL_PRESSED] = 3 | DIRECTED,
+	[CEC_MSG_USER_CONTROL_RELEASED] = 2 | DIRECTED,
+	[CEC_MSG_GIVE_DEVICE_POWER_STATUS] = 2 | DIRECTED,
+	[CEC_MSG_REPORT_POWER_STATUS] = 3 | DIRECTED | BCAST2_0,
+	[CEC_MSG_FEATURE_ABORT] = 4 | DIRECTED,
+	[CEC_MSG_ABORT] = 2 | DIRECTED,
+	[CEC_MSG_GIVE_AUDIO_STATUS] = 2 | DIRECTED,
+	[CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS] = 2 | DIRECTED,
+	[CEC_MSG_REPORT_AUDIO_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR] = 2 | DIRECTED,
+	[CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR] = 2 | DIRECTED,
+	[CEC_MSG_SET_SYSTEM_AUDIO_MODE] = 3 | BOTH,
+	[CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST] = 2 | DIRECTED,
+	[CEC_MSG_SYSTEM_AUDIO_MODE_STATUS] = 3 | DIRECTED,
+	[CEC_MSG_SET_AUDIO_RATE] = 3 | DIRECTED,
+	[CEC_MSG_INITIATE_ARC] = 2 | DIRECTED,
+	[CEC_MSG_REPORT_ARC_INITIATED] = 2 | DIRECTED,
+	[CEC_MSG_REPORT_ARC_TERMINATED] = 2 | DIRECTED,
+	[CEC_MSG_REQUEST_ARC_INITIATION] = 2 | DIRECTED,
+	[CEC_MSG_REQUEST_ARC_TERMINATION] = 2 | DIRECTED,
+	[CEC_MSG_TERMINATE_ARC] = 2 | DIRECTED,
+	[CEC_MSG_REQUEST_CURRENT_LATENCY] = 4 | BCAST,
+	[CEC_MSG_REPORT_CURRENT_LATENCY] = 7 | BCAST,
+	[CEC_MSG_CDC_MESSAGE] = 2 | BCAST,
+};
+
 /* Called by the CEC adapter if a message is received */
 void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg)
 {
 	struct cec_data *data;
 	u8 msg_init = cec_msg_initiator(msg);
 	u8 msg_dest = cec_msg_destination(msg);
+	u8 cmd = msg->msg[1];
 	bool is_reply = false;
 	bool valid_la = true;
+	u8 min_len = 0;
 
 	if (WARN_ON(!msg->len || msg->len > CEC_MAX_MSG_SIZE))
 		return;
@@ -789,9 +880,71 @@ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg)
 	if (!cec_msg_is_broadcast(msg))
 		valid_la = cec_has_log_addr(adap, msg_dest);
 
+	/*
+	 * Check if the length is not too short or if the message is a
+	 * broadcast message where a directed message was expected or
+	 * vice versa. If so, then the message has to be ignored (according
+	 * to section CEC 7.3 and CEC 12.2).
+	 */
+	if (valid_la && msg->len > 1 && cec_msg_size[cmd]) {
+		u8 dir_fl = cec_msg_size[cmd] & BOTH;
+
+		min_len = cec_msg_size[cmd] & 0x1f;
+		if (msg->len < min_len)
+			valid_la = false;
+		else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED))
+			valid_la = false;
+		else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4))
+			valid_la = false;
+		else if (cec_msg_is_broadcast(msg) &&
+			 adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 &&
+			 !(dir_fl & BCAST2_0))
+			valid_la = false;
+	}
+	if (valid_la && min_len) {
+		/* These messages have special length requirements */
+		switch (cmd) {
+		case CEC_MSG_TIMER_STATUS:
+			if (msg->msg[2] & 0x10) {
+				switch (msg->msg[2] & 0xf) {
+				case CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE:
+				case CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE:
+					if (msg->len < 5)
+						valid_la = false;
+					break;
+				}
+			} else if ((msg->msg[2] & 0xf) == CEC_OP_PROG_ERROR_DUPLICATE) {
+				if (msg->len < 5)
+					valid_la = false;
+			}
+			break;
+		case CEC_MSG_RECORD_ON:
+			switch (msg->msg[2]) {
+			case CEC_OP_RECORD_SRC_OWN:
+				break;
+			case CEC_OP_RECORD_SRC_DIGITAL:
+				if (msg->len < 10)
+					valid_la = false;
+				break;
+			case CEC_OP_RECORD_SRC_ANALOG:
+				if (msg->len < 7)
+					valid_la = false;
+				break;
+			case CEC_OP_RECORD_SRC_EXT_PLUG:
+				if (msg->len < 4)
+					valid_la = false;
+				break;
+			case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR:
+				if (msg->len < 5)
+					valid_la = false;
+				break;
+			}
+			break;
+		}
+	}
+
 	/* It's a valid message and not a poll or CDC message */
-	if (valid_la && msg->len > 1 && msg->msg[1] != CEC_MSG_CDC_MESSAGE) {
-		u8 cmd = msg->msg[1];
+	if (valid_la && msg->len > 1 && cmd != CEC_MSG_CDC_MESSAGE) {
 		bool abort = cmd == CEC_MSG_FEATURE_ABORT;
 
 		/* The aborted command is in msg[2] */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 06/11] cec: accept two replies for CEC_MSG_INITIATE_ARC.
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (4 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 05/11] cec: filter invalid messages Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 07/11] cec: add proper support for CDC-Only CEC devices Hans Verkuil
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

The CEC_MSG_INITIATE_ARC message is special since it is the ONLY
CEC message that accepts two possible valid replies:

CEC_MSG_REPORT_ARC_INITIATED and CEC_MSG_REPORT_ARC_TERMINATED.

So if the transmitted message is CEC_MSG_INITIATE_ARC and the remote
side replied with CEC_MSG_REPORT_ARC_INITIATED or CEC_MSG_REPORT_ARC_TERMINATED,
then a msg->reply value of CEC_MSG_REPORT_ARC_INITIATED or
CEC_MSG_REPORT_ARC_TERMINATED will match either reply.

I thought about either adding a second reply2 field, but that's ugly
for all other messages that have only one reply, and what if in the
future a new message is added that can have three replies?

Another option would be to add a cec_msg flag, but really, the combination
of CEC_MSG_REPORT_ARC_INITIATED and a reply value of one of the two
possible replies already functions as a flag.

Another advantage of this approach is that it is safe to re-use a
cec_msg struct. No need to zero a flags field or a reply2 field.

So since this really is an exception in the CEC specification, I
decided to implement it as an exception as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 Documentation/media/uapi/cec/cec-ioc-receive.rst |  8 ++++++++
 drivers/staging/media/cec/TODO                   | 15 +--------------
 drivers/staging/media/cec/cec-adap.c             | 12 ++++++++++++
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/Documentation/media/uapi/cec/cec-ioc-receive.rst b/Documentation/media/uapi/cec/cec-ioc-receive.rst
index b4dffd2..bdf015b 100644
--- a/Documentation/media/uapi/cec/cec-ioc-receive.rst
+++ b/Documentation/media/uapi/cec/cec-ioc-receive.rst
@@ -142,6 +142,14 @@ result.
 	Feature Abort reply. In this case ``rx_status`` will either be set
 	to :ref:`CEC_RX_STATUS_TIMEOUT <CEC-RX-STATUS-TIMEOUT>` or
 	:ref:`CEC_RX_STATUS_FEATURE_ABORT <CEC-RX-STATUS-FEATURE-ABORT>`.
+
+	If the transmitter message is ``CEC_MSG_INITIATE_ARC`` then the ``reply``
+	values ``CEC_MSG_REPORT_ARC_INITIATED`` and ``CEC_MSG_REPORT_ARC_TERMINATED``
+	are processed differently: either value will match both possible replies.
+	The reason is that the ``CEC_MSG_INITIATE_ARC`` message is the only CEC
+	message that has two possible replies other than Feature Abort. The
+	``reply`` field will be updated with the actual reply so that it is
+	synchronized with the contents of the received message.
     * - __u8
       - ``rx_status``
       - The status bits of the received message. See
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
index ce69001..5a4cfdf8 100644
--- a/drivers/staging/media/cec/TODO
+++ b/drivers/staging/media/cec/TODO
@@ -1,18 +1,5 @@
-The reason why cec.c is still in staging is that I would like
-to have a bit more confidence in the uABI. The kABI is fine,
-no problem there, but I would like to let the public API mature
-a bit.
+TODOs:
 
-Once I'm confident that I didn't miss anything then the cec.c source
-can move to drivers/media and the linux/cec.h and linux/cec-funcs.h
-headers can move to uapi/linux and added to uapi/linux/Kbuild to make
-them public.
-
-Hopefully this will happen later in 2016.
-
-Other TODOs:
-
-- There are two possible replies to CEC_MSG_INITIATE_ARC. How to handle that?
 - Should CEC_LOG_ADDR_TYPE_SPECIFIC be replaced by TYPE_2ND_TV and TYPE_PROCESSOR?
   And also TYPE_SWITCH and TYPE_CDC_ONLY in addition to the TYPE_UNREGISTERED?
   This should give the framework more information about the device type
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index 93b53e6..a65d866 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -958,6 +958,18 @@ void cec_received_msg(struct cec_adapter *adap, struct cec_msg *msg)
 		list_for_each_entry(data, &adap->wait_queue, list) {
 			struct cec_msg *dst = &data->msg;
 
+			/*
+			 * The *only* CEC message that has two possible replies
+			 * is CEC_MSG_INITIATE_ARC.
+			 * In this case allow either of the two replies.
+			 */
+			if (!abort && dst->msg[1] == CEC_MSG_INITIATE_ARC &&
+			    (cmd == CEC_MSG_REPORT_ARC_INITIATED ||
+			     cmd == CEC_MSG_REPORT_ARC_TERMINATED) &&
+			    (dst->reply == CEC_MSG_REPORT_ARC_INITIATED ||
+			     dst->reply == CEC_MSG_REPORT_ARC_TERMINATED))
+				dst->reply = cmd;
+
 			/* Does the command match? */
 			if ((abort && cmd != dst->msg[1]) ||
 			    (!abort && cmd != dst->reply))
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 07/11] cec: add proper support for CDC-Only CEC devices
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (5 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 06/11] cec: accept two replies for CEC_MSG_INITIATE_ARC Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 08/11] cec: move the CEC framework out of staging and to media Hans Verkuil
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

CDC-Only CEC devices are CEC devices that can only handle CDC messages,
all other messages are ignored.

Add a flag to signal that this is a CDC-Only device and act accordingly.

Also add helper functions to identify if a CEC device is configured as a
CDC-Only device, a second TV, a switch or a processor, since these variations
cannot be determined by the logical address alone.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/staging/media/cec/TODO       |  4 ---
 drivers/staging/media/cec/cec-adap.c | 31 ++++++++++++++++++++-
 drivers/staging/media/cec/cec-api.c  |  9 ++++++-
 include/linux/cec.h                  | 52 ++++++++++++++++++++++++++++++++++++
 4 files changed, 90 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
index 5a4cfdf8..504d35c 100644
--- a/drivers/staging/media/cec/TODO
+++ b/drivers/staging/media/cec/TODO
@@ -1,9 +1,5 @@
 TODOs:
 
-- Should CEC_LOG_ADDR_TYPE_SPECIFIC be replaced by TYPE_2ND_TV and TYPE_PROCESSOR?
-  And also TYPE_SWITCH and TYPE_CDC_ONLY in addition to the TYPE_UNREGISTERED?
-  This should give the framework more information about the device type
-  since SPECIFIC and UNREGISTERED give no useful information.
 - Once this is out of staging this should no longer be a separate
   config option, instead it should be selected by drivers that want it.
 - Revisit the IS_REACHABLE(RC_CORE): perhaps the RC_CORE support should
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/staging/media/cec/cec-adap.c
index a65d866..054cd06 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -1233,7 +1233,8 @@ static int cec_config_thread_func(void *arg)
 	mutex_unlock(&adap->lock);
 
 	for (i = 0; i < las->num_log_addrs; i++) {
-		if (las->log_addr[i] == CEC_LOG_ADDR_INVALID)
+		if (las->log_addr[i] == CEC_LOG_ADDR_INVALID ||
+		    (las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY))
 			continue;
 
 		/*
@@ -1355,6 +1356,29 @@ int __cec_s_log_addrs(struct cec_adapter *adap,
 		return 0;
 	}
 
+	if (log_addrs->flags & CEC_LOG_ADDRS_FL_CDC_ONLY) {
+		/*
+		 * Sanitize log_addrs fields if a CDC-Only device is
+		 * requested.
+		 */
+		log_addrs->num_log_addrs = 1;
+		log_addrs->osd_name[0] = '\0';
+		log_addrs->vendor_id = CEC_VENDOR_ID_NONE;
+		log_addrs->log_addr_type[0] = CEC_LOG_ADDR_TYPE_UNREGISTERED;
+		/*
+		 * This is just an internal convention since a CDC-Only device
+		 * doesn't have to be a switch. But switches already use
+		 * unregistered, so it makes some kind of sense to pick this
+		 * as the primary device. Since a CDC-Only device never sends
+		 * any 'normal' CEC messages this primary device type is never
+		 * sent over the CEC bus.
+		 */
+		log_addrs->primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_SWITCH;
+		log_addrs->all_device_types[0] = 0;
+		log_addrs->features[0][0] = 0;
+		log_addrs->features[0][1] = 0;
+	}
+
 	/* Ensure the osd name is 0-terminated */
 	log_addrs->osd_name[sizeof(log_addrs->osd_name) - 1] = '\0';
 
@@ -1575,6 +1599,11 @@ static int cec_receive_notify(struct cec_adapter *adap, struct cec_msg *msg,
 
 	dprintk(1, "cec_receive_notify: %*ph\n", msg->len, msg->msg);
 
+	/* If this is a CDC-Only device, then ignore any non-CDC messages */
+	if (cec_is_cdc_only(&adap->log_addrs) &&
+	    msg->msg[1] != CEC_MSG_CDC_MESSAGE)
+		return 0;
+
 	if (adap->ops->received) {
 		/* Allow drivers to process the message first */
 		if (adap->ops->received(adap, msg) != -ENOMSG)
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/staging/media/cec/cec-api.c
index 54148a6..d4bc4ee 100644
--- a/drivers/staging/media/cec/cec-api.c
+++ b/drivers/staging/media/cec/cec-api.c
@@ -163,7 +163,8 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
 	if (copy_from_user(&log_addrs, parg, sizeof(log_addrs)))
 		return -EFAULT;
 	log_addrs.flags &= CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK |
-			   CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU;
+			   CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU |
+			   CEC_LOG_ADDRS_FL_CDC_ONLY;
 	mutex_lock(&adap->lock);
 	if (!adap->is_configuring &&
 	    (!log_addrs.num_log_addrs || !adap->is_configured) &&
@@ -190,6 +191,12 @@ static long cec_transmit(struct cec_adapter *adap, struct cec_fh *fh,
 		return -ENOTTY;
 	if (copy_from_user(&msg, parg, sizeof(msg)))
 		return -EFAULT;
+
+	/* A CDC-Only device can only send CDC messages */
+	if ((adap->log_addrs.flags & CEC_LOG_ADDRS_FL_CDC_ONLY) &&
+	    (msg.len == 1 || msg.msg[1] != CEC_MSG_CDC_MESSAGE))
+		return -EINVAL;
+
 	msg.flags &= CEC_MSG_FL_REPLY_TO_FOLLOWERS;
 	mutex_lock(&adap->lock);
 	if (!adap->is_configured)
diff --git a/include/linux/cec.h b/include/linux/cec.h
index 3f2f076..9c87711 100644
--- a/include/linux/cec.h
+++ b/include/linux/cec.h
@@ -396,6 +396,8 @@ struct cec_log_addrs {
 #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK	(1 << 0)
 /* Passthrough RC messages to the input subsystem */
 #define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU	(1 << 1)
+/* CDC-Only device: supports only CDC messages */
+#define CEC_LOG_ADDRS_FL_CDC_ONLY		(1 << 2)
 
 /* Events */
 
@@ -1016,4 +1018,54 @@ struct cec_event {
 #define CEC_OP_HPD_ERROR_OTHER				3
 #define CEC_OP_HPD_ERROR_NONE_NO_VIDEO			4
 
+/* End of Messages */
+
+/* Helper functions to identify the 'special' CEC devices */
+
+static inline bool cec_is_2nd_tv(const struct cec_log_addrs *las)
+{
+	/*
+	 * It is a second TV if the logical address is 14 or 15 and the
+	 * primary device type is a TV.
+	 */
+	return las->num_log_addrs &&
+	       las->log_addr[0] >= CEC_LOG_ADDR_SPECIFIC &&
+	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_TV;
+}
+
+static inline bool cec_is_processor(const struct cec_log_addrs *las)
+{
+	/*
+	 * It is a processor if the logical address is 12-15 and the
+	 * primary device type is a Processor.
+	 */
+	return las->num_log_addrs &&
+	       las->log_addr[0] >= CEC_LOG_ADDR_BACKUP_1 &&
+	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_PROCESSOR;
+}
+
+static inline bool cec_is_switch(const struct cec_log_addrs *las)
+{
+	/*
+	 * It is a switch if the logical address is 15 and the
+	 * primary device type is a Switch and the CDC-Only flag is not set.
+	 */
+	return las->num_log_addrs == 1 &&
+	       las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED &&
+	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH &&
+	       !(las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY);
+}
+
+static inline bool cec_is_cdc_only(const struct cec_log_addrs *las)
+{
+	/*
+	 * It is a CDC-only device if the logical address is 15 and the
+	 * primary device type is a Switch and the CDC-Only flag is set.
+	 */
+	return las->num_log_addrs == 1 &&
+	       las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED &&
+	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH &&
+	       (las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY);
+}
+
 #endif
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 08/11] cec: move the CEC framework out of staging and to media
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (6 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 07/11] cec: add proper support for CDC-Only CEC devices Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 13:04   ` [PATCHv2 " Hans Verkuil
  2016-11-02 12:46 ` [PATCH 09/11] pulse8-cec: move out of staging Hans Verkuil
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

The last open issues have been addressed, so it is time to move
this out of staging and into the mainline and to move the public
cec headers to include/uapi/linux.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/Kconfig                      | 16 ++++++++++++++++
 drivers/media/Makefile                     |  4 ++++
 drivers/{staging => }/media/cec/Makefile   |  2 +-
 drivers/{staging => }/media/cec/cec-adap.c |  0
 drivers/{staging => }/media/cec/cec-api.c  |  0
 drivers/{staging => }/media/cec/cec-core.c |  0
 drivers/{staging => }/media/cec/cec-priv.h |  0
 drivers/media/i2c/Kconfig                  |  6 +++---
 drivers/media/platform/vivid/Kconfig       |  2 +-
 drivers/staging/media/Kconfig              |  2 --
 drivers/staging/media/Makefile             |  1 -
 drivers/staging/media/cec/Kconfig          | 12 ------------
 drivers/staging/media/cec/TODO             |  9 ---------
 drivers/staging/media/pulse8-cec/Kconfig   |  2 +-
 drivers/staging/media/s5p-cec/Kconfig      |  2 +-
 drivers/staging/media/st-cec/Kconfig       |  2 +-
 include/media/cec.h                        |  2 +-
 include/uapi/linux/Kbuild                  |  2 ++
 include/{ => uapi}/linux/cec-funcs.h       |  6 ------
 include/{ => uapi}/linux/cec.h             |  6 ------
 20 files changed, 31 insertions(+), 45 deletions(-)
 rename drivers/{staging => }/media/cec/Makefile (70%)
 rename drivers/{staging => }/media/cec/cec-adap.c (100%)
 rename drivers/{staging => }/media/cec/cec-api.c (100%)
 rename drivers/{staging => }/media/cec/cec-core.c (100%)
 rename drivers/{staging => }/media/cec/cec-priv.h (100%)
 delete mode 100644 drivers/staging/media/cec/Kconfig
 delete mode 100644 drivers/staging/media/cec/TODO
 rename include/{ => uapi}/linux/cec-funcs.h (99%)
 rename include/{ => uapi}/linux/cec.h (99%)

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 7b85402..bc643cb 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -80,6 +80,22 @@ config MEDIA_RC_SUPPORT
 
 	  Say Y when you have a TV or an IR device.
 
+config MEDIA_CEC_SUPPORT
+	bool "HDMI CEC support"
+	select MEDIA_CEC_EDID
+	---help---
+	  Enable support for HDMI CEC (Consumer Electronics Control),
+	  which is an optional HDMI feature.
+
+	  Say Y when you have an HDMI receiver, transmitter or a USB CEC
+	  adapter that supports HDMI CEC.
+
+config MEDIA_CEC_DEBUG
+	bool "HDMI CEC debugfs interface"
+	depends on MEDIA_CEC_SUPPORT && DEBUG_FS
+	---help---
+	  Turns on the DebugFS interface for CEC devices.
+
 config MEDIA_CEC_EDID
 	bool
 
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index 0deaa93..d87ccb8 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -6,6 +6,10 @@ ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
   obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
 endif
 
+ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
+  obj-$(CONFIG_MEDIA_SUPPORT) += cec/
+endif
+
 media-objs	:= media-device.o media-devnode.o media-entity.o
 
 #
diff --git a/drivers/staging/media/cec/Makefile b/drivers/media/cec/Makefile
similarity index 70%
rename from drivers/staging/media/cec/Makefile
rename to drivers/media/cec/Makefile
index bd7f3c5..d668633 100644
--- a/drivers/staging/media/cec/Makefile
+++ b/drivers/media/cec/Makefile
@@ -1,5 +1,5 @@
 cec-objs := cec-core.o cec-adap.o cec-api.o
 
-ifeq ($(CONFIG_MEDIA_CEC),y)
+ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
   obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
 endif
diff --git a/drivers/staging/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c
similarity index 100%
rename from drivers/staging/media/cec/cec-adap.c
rename to drivers/media/cec/cec-adap.c
diff --git a/drivers/staging/media/cec/cec-api.c b/drivers/media/cec/cec-api.c
similarity index 100%
rename from drivers/staging/media/cec/cec-api.c
rename to drivers/media/cec/cec-api.c
diff --git a/drivers/staging/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
similarity index 100%
rename from drivers/staging/media/cec/cec-core.c
rename to drivers/media/cec/cec-core.c
diff --git a/drivers/staging/media/cec/cec-priv.h b/drivers/media/cec/cec-priv.h
similarity index 100%
rename from drivers/staging/media/cec/cec-priv.h
rename to drivers/media/cec/cec-priv.h
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 2669b4b..b31fa6f 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -221,7 +221,7 @@ config VIDEO_ADV7604
 
 config VIDEO_ADV7604_CEC
 	bool "Enable Analog Devices ADV7604 CEC support"
-	depends on VIDEO_ADV7604 && MEDIA_CEC
+	depends on VIDEO_ADV7604 && MEDIA_CEC_SUPPORT
 	---help---
 	  When selected the adv7604 will support the optional
 	  HDMI CEC feature.
@@ -242,7 +242,7 @@ config VIDEO_ADV7842
 
 config VIDEO_ADV7842_CEC
 	bool "Enable Analog Devices ADV7842 CEC support"
-	depends on VIDEO_ADV7842 && MEDIA_CEC
+	depends on VIDEO_ADV7842 && MEDIA_CEC_SUPPORT
 	---help---
 	  When selected the adv7842 will support the optional
 	  HDMI CEC feature.
@@ -481,7 +481,7 @@ config VIDEO_ADV7511
 
 config VIDEO_ADV7511_CEC
 	bool "Enable Analog Devices ADV7511 CEC support"
-	depends on VIDEO_ADV7511 && MEDIA_CEC
+	depends on VIDEO_ADV7511 && MEDIA_CEC_SUPPORT
 	---help---
 	  When selected the adv7511 will support the optional
 	  HDMI CEC feature.
diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig
index 8e6918c..db0dd19 100644
--- a/drivers/media/platform/vivid/Kconfig
+++ b/drivers/media/platform/vivid/Kconfig
@@ -25,7 +25,7 @@ config VIDEO_VIVID
 
 config VIDEO_VIVID_CEC
 	bool "Enable CEC emulation support"
-	depends on VIDEO_VIVID && MEDIA_CEC
+	depends on VIDEO_VIVID && MEDIA_CEC_SUPPORT
 	---help---
 	  When selected the vivid module will emulate the optional
 	  HDMI CEC feature.
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index 6620d96..0abe5ff 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -21,8 +21,6 @@ if STAGING_MEDIA && MEDIA_SUPPORT
 # Please keep them in alphabetic order
 source "drivers/staging/media/bcm2048/Kconfig"
 
-source "drivers/staging/media/cec/Kconfig"
-
 source "drivers/staging/media/cxd2099/Kconfig"
 
 source "drivers/staging/media/davinci_vpfe/Kconfig"
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index 906257e..246299e 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -1,5 +1,4 @@
 obj-$(CONFIG_I2C_BCM2048)	+= bcm2048/
-obj-$(CONFIG_MEDIA_CEC)		+= cec/
 obj-$(CONFIG_VIDEO_SAMSUNG_S5P_CEC) += s5p-cec/
 obj-$(CONFIG_DVB_CXD2099)	+= cxd2099/
 obj-$(CONFIG_LIRC_STAGING)	+= lirc/
diff --git a/drivers/staging/media/cec/Kconfig b/drivers/staging/media/cec/Kconfig
deleted file mode 100644
index 6e12d41..0000000
--- a/drivers/staging/media/cec/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-config MEDIA_CEC
-	bool "CEC API (EXPERIMENTAL)"
-	depends on MEDIA_SUPPORT
-	select MEDIA_CEC_EDID
-	---help---
-	  Enable the CEC API.
-
-config MEDIA_CEC_DEBUG
-	bool "CEC debugfs interface (EXPERIMENTAL)"
-	depends on MEDIA_CEC && DEBUG_FS
-	---help---
-	  Turns on the DebugFS interface for CEC devices.
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
deleted file mode 100644
index 504d35c..0000000
--- a/drivers/staging/media/cec/TODO
+++ /dev/null
@@ -1,9 +0,0 @@
-TODOs:
-
-- Once this is out of staging this should no longer be a separate
-  config option, instead it should be selected by drivers that want it.
-- Revisit the IS_REACHABLE(RC_CORE): perhaps the RC_CORE support should
-  be enabled through a separate config option in drivers/media/Kconfig
-  or rc/Kconfig?
-
-Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/drivers/staging/media/pulse8-cec/Kconfig b/drivers/staging/media/pulse8-cec/Kconfig
index c6aa2d1..6ffc407 100644
--- a/drivers/staging/media/pulse8-cec/Kconfig
+++ b/drivers/staging/media/pulse8-cec/Kconfig
@@ -1,6 +1,6 @@
 config USB_PULSE8_CEC
 	tristate "Pulse Eight HDMI CEC"
-	depends on USB_ACM && MEDIA_CEC
+	depends on USB_ACM && MEDIA_CEC_SUPPORT
 	select SERIO
 	select SERIO_SERPORT
 	---help---
diff --git a/drivers/staging/media/s5p-cec/Kconfig b/drivers/staging/media/s5p-cec/Kconfig
index 0315fd7..ddfd955 100644
--- a/drivers/staging/media/s5p-cec/Kconfig
+++ b/drivers/staging/media/s5p-cec/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_SAMSUNG_S5P_CEC
        tristate "Samsung S5P CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
+       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST)
        ---help---
          This is a driver for Samsung S5P HDMI CEC interface. It uses the
          generic CEC framework interface.
diff --git a/drivers/staging/media/st-cec/Kconfig b/drivers/staging/media/st-cec/Kconfig
index 784d2c6..c04283d 100644
--- a/drivers/staging/media/st-cec/Kconfig
+++ b/drivers/staging/media/st-cec/Kconfig
@@ -1,6 +1,6 @@
 config VIDEO_STI_HDMI_CEC
        tristate "STMicroelectronics STiH4xx HDMI CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC && (ARCH_STI || COMPILE_TEST)
+       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (ARCH_STI || COMPILE_TEST)
        ---help---
          This is a driver for STIH4xx HDMI CEC interface. It uses the
          generic CEC framework interface.
diff --git a/include/media/cec.h b/include/media/cec.h
index fdb5d60..717eaf5 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -196,7 +196,7 @@ static inline bool cec_is_sink(const struct cec_adapter *adap)
 	return adap->phys_addr == 0;
 }
 
-#if IS_ENABLED(CONFIG_MEDIA_CEC)
+#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
 struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 		void *priv, const char *name, u32 caps, u8 available_las,
 		struct device *parent);
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 6965d09..c49c448 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -82,6 +82,8 @@ header-y += capi.h
 header-y += cciss_defs.h
 header-y += cciss_ioctl.h
 header-y += cdrom.h
+header-y += cec.h
+header-y += cec-funcs.h
 header-y += cgroupstats.h
 header-y += chio.h
 header-y += cm4000_cs.h
diff --git a/include/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h
similarity index 99%
rename from include/linux/cec-funcs.h
rename to include/uapi/linux/cec-funcs.h
index 138bbf7..1a1de21 100644
--- a/include/linux/cec-funcs.h
+++ b/include/uapi/linux/cec-funcs.h
@@ -33,12 +33,6 @@
  * SOFTWARE.
  */
 
-/*
- * Note: this framework is still in staging and it is likely the API
- * will change before it goes out of staging.
- *
- * Once it is moved out of staging this header will move to uapi.
- */
 #ifndef _CEC_UAPI_FUNCS_H
 #define _CEC_UAPI_FUNCS_H
 
diff --git a/include/linux/cec.h b/include/uapi/linux/cec.h
similarity index 99%
rename from include/linux/cec.h
rename to include/uapi/linux/cec.h
index 9c87711..f4ec0af 100644
--- a/include/linux/cec.h
+++ b/include/uapi/linux/cec.h
@@ -33,12 +33,6 @@
  * SOFTWARE.
  */
 
-/*
- * Note: this framework is still in staging and it is likely the API
- * will change before it goes out of staging.
- *
- * Once it is moved out of staging this header will move to uapi.
- */
 #ifndef _CEC_UAPI_H
 #define _CEC_UAPI_H
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 09/11] pulse8-cec: move out of staging
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (7 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 08/11] cec: move the CEC framework out of staging and to media Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 10/11] s5p-cec/st-cec: update TODOs Hans Verkuil
  2016-11-02 12:46 ` [PATCH 11/11] MAINTAINERS: update paths Hans Verkuil
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Now that the CEC framework has been moved out of staging and into the
mainline kernel we can do the same for the pulse8-cec driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/usb/Kconfig                          |  5 +++
 drivers/media/usb/Makefile                         |  1 +
 .../media => media/usb}/pulse8-cec/Kconfig         |  0
 .../media => media/usb}/pulse8-cec/Makefile        |  0
 .../media => media/usb}/pulse8-cec/pulse8-cec.c    |  0
 drivers/staging/media/Kconfig                      |  2 -
 drivers/staging/media/Makefile                     |  1 -
 drivers/staging/media/pulse8-cec/TODO              | 52 ----------------------
 8 files changed, 6 insertions(+), 55 deletions(-)
 rename drivers/{staging/media => media/usb}/pulse8-cec/Kconfig (100%)
 rename drivers/{staging/media => media/usb}/pulse8-cec/Makefile (100%)
 rename drivers/{staging/media => media/usb}/pulse8-cec/pulse8-cec.c (100%)
 delete mode 100644 drivers/staging/media/pulse8-cec/TODO

diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
index 7496f33..c9644b6 100644
--- a/drivers/media/usb/Kconfig
+++ b/drivers/media/usb/Kconfig
@@ -60,5 +60,10 @@ source "drivers/media/usb/hackrf/Kconfig"
 source "drivers/media/usb/msi2500/Kconfig"
 endif
 
+if MEDIA_CEC_SUPPORT
+	comment "USB HDMI CEC adapters"
+source "drivers/media/usb/pulse8-cec/Kconfig"
+endif
+
 endif #MEDIA_USB_SUPPORT
 endif #USB
diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
index 8874ba7..0f15e33 100644
--- a/drivers/media/usb/Makefile
+++ b/drivers/media/usb/Makefile
@@ -24,3 +24,4 @@ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
 obj-$(CONFIG_VIDEO_USBTV) += usbtv/
 obj-$(CONFIG_VIDEO_GO7007) += go7007/
 obj-$(CONFIG_DVB_AS102) += as102/
+obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
diff --git a/drivers/staging/media/pulse8-cec/Kconfig b/drivers/media/usb/pulse8-cec/Kconfig
similarity index 100%
rename from drivers/staging/media/pulse8-cec/Kconfig
rename to drivers/media/usb/pulse8-cec/Kconfig
diff --git a/drivers/staging/media/pulse8-cec/Makefile b/drivers/media/usb/pulse8-cec/Makefile
similarity index 100%
rename from drivers/staging/media/pulse8-cec/Makefile
rename to drivers/media/usb/pulse8-cec/Makefile
diff --git a/drivers/staging/media/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c
similarity index 100%
rename from drivers/staging/media/pulse8-cec/pulse8-cec.c
rename to drivers/media/usb/pulse8-cec/pulse8-cec.c
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index 0abe5ff..ffb8fa7 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -27,8 +27,6 @@ source "drivers/staging/media/davinci_vpfe/Kconfig"
 
 source "drivers/staging/media/omap4iss/Kconfig"
 
-source "drivers/staging/media/pulse8-cec/Kconfig"
-
 source "drivers/staging/media/s5p-cec/Kconfig"
 
 # Keep LIRC at the end, as it has sub-menus
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index 246299e..a28e82c 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -4,5 +4,4 @@ obj-$(CONFIG_DVB_CXD2099)	+= cxd2099/
 obj-$(CONFIG_LIRC_STAGING)	+= lirc/
 obj-$(CONFIG_VIDEO_DM365_VPFE)	+= davinci_vpfe/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
-obj-$(CONFIG_USB_PULSE8_CEC)    += pulse8-cec/
 obj-$(CONFIG_VIDEO_STI_HDMI_CEC) += st-cec/
diff --git a/drivers/staging/media/pulse8-cec/TODO b/drivers/staging/media/pulse8-cec/TODO
deleted file mode 100644
index fa66602..0000000
--- a/drivers/staging/media/pulse8-cec/TODO
+++ /dev/null
@@ -1,52 +0,0 @@
-This driver needs to mature a bit more and another round of
-code cleanups.
-
-Otherwise it looks to be in good shape. And of course the fact
-that the CEC framework is in staging at the moment also prevents
-this driver from being mainlined.
-
-Some notes:
-
-1) Regarding the "autonomous" mode of the Pulse-Eight: currently this
-is disabled, but the idea is that this allows basic functionality
-when the PC is off, and it can wake-up the PC through USB.
-
-To prevent the device to go into autonomous mode the driver would
-have to send MSGCODE_SET_CONTROLLED 1 and then send a ping every
-30 seconds (in practice once every 15 seconds would be good). When
-powering off or going to standby send MSGCODE_SET_CONTROLLED 0 to
-turn the autonomous mode back on.
-
-This needs to be implemented in the driver. Autonomous mode was
-added in firmware v2.
-
-2) Writing to the EEPROM can only be done once every 10 seconds.
-
-3) To use this driver you also need to patch the inputattach utility,
-this patch will be submitted once this driver is moved out of staging.
-
-diff -urN linuxconsoletools-1.4.9/utils/inputattach.c linuxconsoletools-1.4.9.new/utils/inputattach.c
---- linuxconsoletools-1.4.9/utils/inputattach.c	2016-01-09 16:27:02.000000000 +0100
-+++ linuxconsoletools-1.4.9.new/utils/inputattach.c	2016-03-20 11:35:31.707788967 +0100
-@@ -861,6 +861,9 @@
- { "--wacom_iv",		"-wacom_iv",	"Wacom protocol IV tablet",
- 	B9600, CS8 | CRTSCTS,
- 	SERIO_WACOM_IV,		0x00,	0x00,	0,	wacom_iv_init },
-+{ "--pulse8-cec",		"-pulse8-cec",	"Pulse Eight HDMI CEC dongle",
-+	B9600, CS8,
-+	SERIO_PULSE8_CEC,		0x00,	0x00,	0,	NULL },
- { NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL }
- };
- 
-diff -urN linuxconsoletools-1.4.9/utils/serio-ids.h linuxconsoletools-1.4.9.new/utils/serio-ids.h
---- linuxconsoletools-1.4.9/utils/serio-ids.h	2015-04-26 18:29:42.000000000 +0200
-+++ linuxconsoletools-1.4.9.new/utils/serio-ids.h	2016-03-20 11:41:00.153558539 +0100
-@@ -131,5 +131,8 @@
- #ifndef SERIO_EASYPEN
- # define SERIO_EASYPEN		0x3f
- #endif
-+#ifndef SERIO_PULSE8_CEC
-+# define SERIO_PULSE8_CEC	0x40
-+#endif
- 
- #endif
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 10/11] s5p-cec/st-cec: update TODOs
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (8 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 09/11] pulse8-cec: move out of staging Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  2016-11-02 12:46 ` [PATCH 11/11] MAINTAINERS: update paths Hans Verkuil
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

Update the TODOs explaining why these two drivers remain in
staging. The reason is that these drivers rely on userspace to
set the physical address, but that should come from the HDMI
output driver. This in turn needs the upcoming HDMI notifier
framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/staging/media/s5p-cec/TODO | 12 ++++++------
 drivers/staging/media/st-cec/TODO  |  7 +++++++
 2 files changed, 13 insertions(+), 6 deletions(-)
 create mode 100644 drivers/staging/media/st-cec/TODO

diff --git a/drivers/staging/media/s5p-cec/TODO b/drivers/staging/media/s5p-cec/TODO
index f51d526..64f21ba 100644
--- a/drivers/staging/media/s5p-cec/TODO
+++ b/drivers/staging/media/s5p-cec/TODO
@@ -1,7 +1,7 @@
-This driver depends on the CEC framework, which is currently in
-staging, so therefor this driver is in staging as well.
+This driver requires that userspace sets the physical address.
+However, this should be passed on from the corresponding
+Samsung HDMI driver.
 
-In addition, this driver requires that userspace sets the physical
-address. However, this should be passed on from the corresponding
-samsung HDMI driver. It is very annoying if userspace has to do this,
-and other than USB CEC adapters this must be handled automatically.
+We have to wait until the HDMI notifier framework has been merged
+in order to handle this gracefully, until that time this driver
+has to remain in staging.
diff --git a/drivers/staging/media/st-cec/TODO b/drivers/staging/media/st-cec/TODO
new file mode 100644
index 0000000..c612897
--- /dev/null
+++ b/drivers/staging/media/st-cec/TODO
@@ -0,0 +1,7 @@
+This driver requires that userspace sets the physical address.
+However, this should be passed on from the corresponding
+ST HDMI driver.
+
+We have to wait until the HDMI notifier framework has been merged
+in order to handle this gracefully, until that time this driver
+has to remain in staging.
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 11/11] MAINTAINERS: update paths
  2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
                   ` (9 preceding siblings ...)
  2016-11-02 12:46 ` [PATCH 10/11] s5p-cec/st-cec: update TODOs Hans Verkuil
@ 2016-11-02 12:46 ` Hans Verkuil
  10 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 12:46 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

The cec framework and the pulse8-cec driver have been moved out
of staging, so update the MAINTAINERS paths.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 MAINTAINERS | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 93e9f42..5106590 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2958,15 +2958,15 @@ L:	linux-media@vger.kernel.org
 T:	git git://linuxtv.org/media_tree.git
 W:	http://linuxtv.org
 S:	Supported
-F:	Documentation/cec.txt
+F:	Documentation/media/kapi/cec-core.rst
 F:	Documentation/media/uapi/cec
-F:	drivers/staging/media/cec/
+F:	drivers/media/cec/
 F:	drivers/media/cec-edid.c
 F:	drivers/media/rc/keymaps/rc-cec.c
 F:	include/media/cec.h
 F:	include/media/cec-edid.h
-F:	include/linux/cec.h
-F:	include/linux/cec-funcs.h
+F:	include/uapi/linux/cec.h
+F:	include/uapi/linux/cec-funcs.h
 
 CELL BROADBAND ENGINE ARCHITECTURE
 M:	Arnd Bergmann <arnd@arndb.de>
@@ -9783,7 +9783,7 @@ M:	Hans Verkuil <hverkuil@xs4all.nl>
 L:	linux-media@vger.kernel.org
 T:	git git://linuxtv.org/media_tree.git
 S:	Maintained
-F:	drivers/staging/media/pulse8-cec
+F:	drivers/media/usb/pulse8-cec/*
 
 PVRUSB2 VIDEO4LINUX DRIVER
 M:	Mike Isely <isely@pobox.com>
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCHv2 08/11] cec: move the CEC framework out of staging and to media
  2016-11-02 12:46 ` [PATCH 08/11] cec: move the CEC framework out of staging and to media Hans Verkuil
@ 2016-11-02 13:04   ` Hans Verkuil
  0 siblings, 0 replies; 13+ messages in thread
From: Hans Verkuil @ 2016-11-02 13:04 UTC (permalink / raw)
  To: linux-media; +Cc: Hans Verkuil

From: Hans Verkuil <hans.verkuil@cisco.com>

The last open issues have been addressed, so it is time to move
this out of staging and into the mainline and to move the public
cec headers to include/uapi/linux.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
Changes since v1:

Fix path to cec.h in Documentation/media/Makefile.
Forgot to make the documentation after moving linux/cec.h to
uapi/linux/cec.h :-(
---
  Documentation/media/Makefile               |  2 +-
  drivers/media/Kconfig                      | 16 ++++++++++++++++
  drivers/media/Makefile                     |  4 ++++
  drivers/{staging => }/media/cec/Makefile   |  2 +-
  drivers/{staging => }/media/cec/cec-adap.c |  0
  drivers/{staging => }/media/cec/cec-api.c  |  0
  drivers/{staging => }/media/cec/cec-core.c |  0
  drivers/{staging => }/media/cec/cec-priv.h |  0
  drivers/media/i2c/Kconfig                  |  6 +++---
  drivers/media/platform/vivid/Kconfig       |  2 +-
  drivers/staging/media/Kconfig              |  2 --
  drivers/staging/media/Makefile             |  1 -
  drivers/staging/media/cec/Kconfig          | 12 ------------
  drivers/staging/media/cec/TODO             |  9 ---------
  drivers/staging/media/pulse8-cec/Kconfig   |  2 +-
  drivers/staging/media/s5p-cec/Kconfig      |  2 +-
  drivers/staging/media/st-cec/Kconfig       |  2 +-
  include/media/cec.h                        |  2 +-
  include/uapi/linux/Kbuild                  |  2 ++
  include/{ => uapi}/linux/cec-funcs.h       |  6 ------
  include/{ => uapi}/linux/cec.h             |  6 ------
  21 files changed, 32 insertions(+), 46 deletions(-)
  rename drivers/{staging => }/media/cec/Makefile (70%)
  rename drivers/{staging => }/media/cec/cec-adap.c (100%)
  rename drivers/{staging => }/media/cec/cec-api.c (100%)
  rename drivers/{staging => }/media/cec/cec-core.c (100%)
  rename drivers/{staging => }/media/cec/cec-priv.h (100%)
  delete mode 100644 drivers/staging/media/cec/Kconfig
  delete mode 100644 drivers/staging/media/cec/TODO
  rename include/{ => uapi}/linux/cec-funcs.h (99%)
  rename include/{ => uapi}/linux/cec.h (99%)

diff --git a/Documentation/media/Makefile b/Documentation/media/Makefile
index a7fb352..61afa05 100644
--- a/Documentation/media/Makefile
+++ b/Documentation/media/Makefile
@@ -51,7 +51,7 @@ $(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h 
${PARSER} $(SRC_DIR)/videodev2.
  $(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} 
$(SRC_DIR)/media.h.rst.exceptions
  	@$($(quiet)gen_rst)

-$(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} 
$(SRC_DIR)/cec.h.rst.exceptions
+$(BUILDDIR)/cec.h.rst: ${UAPI}/cec.h ${PARSER} 
$(SRC_DIR)/cec.h.rst.exceptions
  	@$($(quiet)gen_rst)

  $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} 
$(SRC_DIR)/lirc.h.rst.exceptions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 7b85402..bc643cb 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -80,6 +80,22 @@ config MEDIA_RC_SUPPORT

  	  Say Y when you have a TV or an IR device.

+config MEDIA_CEC_SUPPORT
+	bool "HDMI CEC support"
+	select MEDIA_CEC_EDID
+	---help---
+	  Enable support for HDMI CEC (Consumer Electronics Control),
+	  which is an optional HDMI feature.
+
+	  Say Y when you have an HDMI receiver, transmitter or a USB CEC
+	  adapter that supports HDMI CEC.
+
+config MEDIA_CEC_DEBUG
+	bool "HDMI CEC debugfs interface"
+	depends on MEDIA_CEC_SUPPORT && DEBUG_FS
+	---help---
+	  Turns on the DebugFS interface for CEC devices.
+
  config MEDIA_CEC_EDID
  	bool

diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index 0deaa93..d87ccb8 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -6,6 +6,10 @@ ifeq ($(CONFIG_MEDIA_CEC_EDID),y)
    obj-$(CONFIG_MEDIA_SUPPORT) += cec-edid.o
  endif

+ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
+  obj-$(CONFIG_MEDIA_SUPPORT) += cec/
+endif
+
  media-objs	:= media-device.o media-devnode.o media-entity.o

  #
diff --git a/drivers/staging/media/cec/Makefile b/drivers/media/cec/Makefile
similarity index 70%
rename from drivers/staging/media/cec/Makefile
rename to drivers/media/cec/Makefile
index bd7f3c5..d668633 100644
--- a/drivers/staging/media/cec/Makefile
+++ b/drivers/media/cec/Makefile
@@ -1,5 +1,5 @@
  cec-objs := cec-core.o cec-adap.o cec-api.o

-ifeq ($(CONFIG_MEDIA_CEC),y)
+ifeq ($(CONFIG_MEDIA_CEC_SUPPORT),y)
    obj-$(CONFIG_MEDIA_SUPPORT) += cec.o
  endif
diff --git a/drivers/staging/media/cec/cec-adap.c 
b/drivers/media/cec/cec-adap.c
similarity index 100%
rename from drivers/staging/media/cec/cec-adap.c
rename to drivers/media/cec/cec-adap.c
diff --git a/drivers/staging/media/cec/cec-api.c 
b/drivers/media/cec/cec-api.c
similarity index 100%
rename from drivers/staging/media/cec/cec-api.c
rename to drivers/media/cec/cec-api.c
diff --git a/drivers/staging/media/cec/cec-core.c 
b/drivers/media/cec/cec-core.c
similarity index 100%
rename from drivers/staging/media/cec/cec-core.c
rename to drivers/media/cec/cec-core.c
diff --git a/drivers/staging/media/cec/cec-priv.h 
b/drivers/media/cec/cec-priv.h
similarity index 100%
rename from drivers/staging/media/cec/cec-priv.h
rename to drivers/media/cec/cec-priv.h
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 2669b4b..b31fa6f 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -221,7 +221,7 @@ config VIDEO_ADV7604

  config VIDEO_ADV7604_CEC
  	bool "Enable Analog Devices ADV7604 CEC support"
-	depends on VIDEO_ADV7604 && MEDIA_CEC
+	depends on VIDEO_ADV7604 && MEDIA_CEC_SUPPORT
  	---help---
  	  When selected the adv7604 will support the optional
  	  HDMI CEC feature.
@@ -242,7 +242,7 @@ config VIDEO_ADV7842

  config VIDEO_ADV7842_CEC
  	bool "Enable Analog Devices ADV7842 CEC support"
-	depends on VIDEO_ADV7842 && MEDIA_CEC
+	depends on VIDEO_ADV7842 && MEDIA_CEC_SUPPORT
  	---help---
  	  When selected the adv7842 will support the optional
  	  HDMI CEC feature.
@@ -481,7 +481,7 @@ config VIDEO_ADV7511

  config VIDEO_ADV7511_CEC
  	bool "Enable Analog Devices ADV7511 CEC support"
-	depends on VIDEO_ADV7511 && MEDIA_CEC
+	depends on VIDEO_ADV7511 && MEDIA_CEC_SUPPORT
  	---help---
  	  When selected the adv7511 will support the optional
  	  HDMI CEC feature.
diff --git a/drivers/media/platform/vivid/Kconfig 
b/drivers/media/platform/vivid/Kconfig
index 8e6918c..db0dd19 100644
--- a/drivers/media/platform/vivid/Kconfig
+++ b/drivers/media/platform/vivid/Kconfig
@@ -25,7 +25,7 @@ config VIDEO_VIVID

  config VIDEO_VIVID_CEC
  	bool "Enable CEC emulation support"
-	depends on VIDEO_VIVID && MEDIA_CEC
+	depends on VIDEO_VIVID && MEDIA_CEC_SUPPORT
  	---help---
  	  When selected the vivid module will emulate the optional
  	  HDMI CEC feature.
diff --git a/drivers/staging/media/Kconfig b/drivers/staging/media/Kconfig
index 6620d96..0abe5ff 100644
--- a/drivers/staging/media/Kconfig
+++ b/drivers/staging/media/Kconfig
@@ -21,8 +21,6 @@ if STAGING_MEDIA && MEDIA_SUPPORT
  # Please keep them in alphabetic order
  source "drivers/staging/media/bcm2048/Kconfig"

-source "drivers/staging/media/cec/Kconfig"
-
  source "drivers/staging/media/cxd2099/Kconfig"

  source "drivers/staging/media/davinci_vpfe/Kconfig"
diff --git a/drivers/staging/media/Makefile b/drivers/staging/media/Makefile
index 906257e..246299e 100644
--- a/drivers/staging/media/Makefile
+++ b/drivers/staging/media/Makefile
@@ -1,5 +1,4 @@
  obj-$(CONFIG_I2C_BCM2048)	+= bcm2048/
-obj-$(CONFIG_MEDIA_CEC)		+= cec/
  obj-$(CONFIG_VIDEO_SAMSUNG_S5P_CEC) += s5p-cec/
  obj-$(CONFIG_DVB_CXD2099)	+= cxd2099/
  obj-$(CONFIG_LIRC_STAGING)	+= lirc/
diff --git a/drivers/staging/media/cec/Kconfig 
b/drivers/staging/media/cec/Kconfig
deleted file mode 100644
index 6e12d41..0000000
--- a/drivers/staging/media/cec/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-config MEDIA_CEC
-	bool "CEC API (EXPERIMENTAL)"
-	depends on MEDIA_SUPPORT
-	select MEDIA_CEC_EDID
-	---help---
-	  Enable the CEC API.
-
-config MEDIA_CEC_DEBUG
-	bool "CEC debugfs interface (EXPERIMENTAL)"
-	depends on MEDIA_CEC && DEBUG_FS
-	---help---
-	  Turns on the DebugFS interface for CEC devices.
diff --git a/drivers/staging/media/cec/TODO b/drivers/staging/media/cec/TODO
deleted file mode 100644
index 504d35c..0000000
--- a/drivers/staging/media/cec/TODO
+++ /dev/null
@@ -1,9 +0,0 @@
-TODOs:
-
-- Once this is out of staging this should no longer be a separate
-  config option, instead it should be selected by drivers that want it.
-- Revisit the IS_REACHABLE(RC_CORE): perhaps the RC_CORE support should
-  be enabled through a separate config option in drivers/media/Kconfig
-  or rc/Kconfig?
-
-Hans Verkuil <hans.verkuil@cisco.com>
diff --git a/drivers/staging/media/pulse8-cec/Kconfig 
b/drivers/staging/media/pulse8-cec/Kconfig
index c6aa2d1..6ffc407 100644
--- a/drivers/staging/media/pulse8-cec/Kconfig
+++ b/drivers/staging/media/pulse8-cec/Kconfig
@@ -1,6 +1,6 @@
  config USB_PULSE8_CEC
  	tristate "Pulse Eight HDMI CEC"
-	depends on USB_ACM && MEDIA_CEC
+	depends on USB_ACM && MEDIA_CEC_SUPPORT
  	select SERIO
  	select SERIO_SERPORT
  	---help---
diff --git a/drivers/staging/media/s5p-cec/Kconfig 
b/drivers/staging/media/s5p-cec/Kconfig
index 0315fd7..ddfd955 100644
--- a/drivers/staging/media/s5p-cec/Kconfig
+++ b/drivers/staging/media/s5p-cec/Kconfig
@@ -1,6 +1,6 @@
  config VIDEO_SAMSUNG_S5P_CEC
         tristate "Samsung S5P CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC && (PLAT_S5P || ARCH_EXYNOS || 
COMPILE_TEST)
+       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (PLAT_S5P || 
ARCH_EXYNOS || COMPILE_TEST)
         ---help---
           This is a driver for Samsung S5P HDMI CEC interface. It uses the
           generic CEC framework interface.
diff --git a/drivers/staging/media/st-cec/Kconfig 
b/drivers/staging/media/st-cec/Kconfig
index 784d2c6..c04283d 100644
--- a/drivers/staging/media/st-cec/Kconfig
+++ b/drivers/staging/media/st-cec/Kconfig
@@ -1,6 +1,6 @@
  config VIDEO_STI_HDMI_CEC
         tristate "STMicroelectronics STiH4xx HDMI CEC driver"
-       depends on VIDEO_DEV && MEDIA_CEC && (ARCH_STI || COMPILE_TEST)
+       depends on VIDEO_DEV && MEDIA_CEC_SUPPORT && (ARCH_STI || 
COMPILE_TEST)
         ---help---
           This is a driver for STIH4xx HDMI CEC interface. It uses the
           generic CEC framework interface.
diff --git a/include/media/cec.h b/include/media/cec.h
index fdb5d60..717eaf5 100644
--- a/include/media/cec.h
+++ b/include/media/cec.h
@@ -196,7 +196,7 @@ static inline bool cec_is_sink(const struct 
cec_adapter *adap)
  	return adap->phys_addr == 0;
  }

-#if IS_ENABLED(CONFIG_MEDIA_CEC)
+#if IS_ENABLED(CONFIG_MEDIA_CEC_SUPPORT)
  struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
  		void *priv, const char *name, u32 caps, u8 available_las,
  		struct device *parent);
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 6965d09..c49c448 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -82,6 +82,8 @@ header-y += capi.h
  header-y += cciss_defs.h
  header-y += cciss_ioctl.h
  header-y += cdrom.h
+header-y += cec.h
+header-y += cec-funcs.h
  header-y += cgroupstats.h
  header-y += chio.h
  header-y += cm4000_cs.h
diff --git a/include/linux/cec-funcs.h b/include/uapi/linux/cec-funcs.h
similarity index 99%
rename from include/linux/cec-funcs.h
rename to include/uapi/linux/cec-funcs.h
index 138bbf7..1a1de21 100644
--- a/include/linux/cec-funcs.h
+++ b/include/uapi/linux/cec-funcs.h
@@ -33,12 +33,6 @@
   * SOFTWARE.
   */

-/*
- * Note: this framework is still in staging and it is likely the API
- * will change before it goes out of staging.
- *
- * Once it is moved out of staging this header will move to uapi.
- */
  #ifndef _CEC_UAPI_FUNCS_H
  #define _CEC_UAPI_FUNCS_H

diff --git a/include/linux/cec.h b/include/uapi/linux/cec.h
similarity index 99%
rename from include/linux/cec.h
rename to include/uapi/linux/cec.h
index 9c87711..f4ec0af 100644
--- a/include/linux/cec.h
+++ b/include/uapi/linux/cec.h
@@ -33,12 +33,6 @@
   * SOFTWARE.
   */

-/*
- * Note: this framework is still in staging and it is likely the API
- * will change before it goes out of staging.
- *
- * Once it is moved out of staging this header will move to uapi.
- */
  #ifndef _CEC_UAPI_H
  #define _CEC_UAPI_H

-- 
2.10.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-11-02 13:04 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-02 12:46 [PATCH 00/11] cec/pulse8-cec: move out of staging Hans Verkuil
2016-11-02 12:46 ` [PATCH 01/11] pulse8-cec: set all_device_types when restoring config Hans Verkuil
2016-11-02 12:46 ` [PATCH 02/11] cec rst: convert tables and drop the 'row' comments Hans Verkuil
2016-11-02 12:46 ` [PATCH 03/11] cec: add flag to cec_log_addrs to enable RC passthrough Hans Verkuil
2016-11-02 12:46 ` [PATCH 04/11] cec: add CEC_MSG_FL_REPLY_TO_FOLLOWERS Hans Verkuil
2016-11-02 12:46 ` [PATCH 05/11] cec: filter invalid messages Hans Verkuil
2016-11-02 12:46 ` [PATCH 06/11] cec: accept two replies for CEC_MSG_INITIATE_ARC Hans Verkuil
2016-11-02 12:46 ` [PATCH 07/11] cec: add proper support for CDC-Only CEC devices Hans Verkuil
2016-11-02 12:46 ` [PATCH 08/11] cec: move the CEC framework out of staging and to media Hans Verkuil
2016-11-02 13:04   ` [PATCHv2 " Hans Verkuil
2016-11-02 12:46 ` [PATCH 09/11] pulse8-cec: move out of staging Hans Verkuil
2016-11-02 12:46 ` [PATCH 10/11] s5p-cec/st-cec: update TODOs Hans Verkuil
2016-11-02 12:46 ` [PATCH 11/11] MAINTAINERS: update paths Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).