summaryrefslogtreecommitdiffstats
path: root/include/linux/cec.h
diff options
context:
space:
mode:
authorHans Verkuil2016-11-02 10:41:41 +0100
committerMauro Carvalho Chehab2016-11-16 18:36:03 +0100
commita69a168a1bd470cb8a8c5f2ff4b54463de615226 (patch)
tree4c3610eea028d8f79d3e5b6139ad2e7d2bd97776 /include/linux/cec.h
parent[media] cec: accept two replies for CEC_MSG_INITIATE_ARC (diff)
downloadkernel-qcow2-linux-a69a168a1bd470cb8a8c5f2ff4b54463de615226.tar.gz
kernel-qcow2-linux-a69a168a1bd470cb8a8c5f2ff4b54463de615226.tar.xz
kernel-qcow2-linux-a69a168a1bd470cb8a8c5f2ff4b54463de615226.zip
[media] cec: add proper support for CDC-Only CEC devices
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> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include/linux/cec.h')
-rw-r--r--include/linux/cec.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/cec.h b/include/linux/cec.h
index 3f2f076027b1..9c87711c0e1c 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