xref: /linux/include/uapi/linux/cec.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
20dbacebeSHans Verkuil /*
30dbacebeSHans Verkuil  * cec - HDMI Consumer Electronics Control public header
40dbacebeSHans Verkuil  *
50dbacebeSHans Verkuil  * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
60dbacebeSHans Verkuil  */
70dbacebeSHans Verkuil 
80dbacebeSHans Verkuil #ifndef _CEC_UAPI_H
90dbacebeSHans Verkuil #define _CEC_UAPI_H
100dbacebeSHans Verkuil 
110dbacebeSHans Verkuil #include <linux/types.h>
123145c754SHans Verkuil #include <linux/string.h>
130dbacebeSHans Verkuil 
140dbacebeSHans Verkuil #define CEC_MAX_MSG_SIZE	16
150dbacebeSHans Verkuil 
160dbacebeSHans Verkuil /**
170dbacebeSHans Verkuil  * struct cec_msg - CEC message structure.
180dbacebeSHans Verkuil  * @tx_ts:	Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the
190dbacebeSHans Verkuil  *		driver when the message transmission has finished.
200dbacebeSHans Verkuil  * @rx_ts:	Timestamp in nanoseconds using CLOCK_MONOTONIC. Set by the
210dbacebeSHans Verkuil  *		driver when the message was received.
220dbacebeSHans Verkuil  * @len:	Length in bytes of the message.
230dbacebeSHans Verkuil  * @timeout:	The timeout (in ms) that is used to timeout CEC_RECEIVE.
240dbacebeSHans Verkuil  *		Set to 0 if you want to wait forever. This timeout can also be
250dbacebeSHans Verkuil  *		used with CEC_TRANSMIT as the timeout for waiting for a reply.
260dbacebeSHans Verkuil  *		If 0, then it will use a 1 second timeout instead of waiting
270dbacebeSHans Verkuil  *		forever as is done with CEC_RECEIVE.
280dbacebeSHans Verkuil  * @sequence:	The framework assigns a sequence number to messages that are
290dbacebeSHans Verkuil  *		sent. This can be used to track replies to previously sent
300dbacebeSHans Verkuil  *		messages.
310dbacebeSHans Verkuil  * @flags:	Set to 0.
320dbacebeSHans Verkuil  * @msg:	The message payload.
330dbacebeSHans Verkuil  * @reply:	This field is ignored with CEC_RECEIVE and is only used by
340dbacebeSHans Verkuil  *		CEC_TRANSMIT. If non-zero, then wait for a reply with this
350dbacebeSHans Verkuil  *		opcode. Set to CEC_MSG_FEATURE_ABORT if you want to wait for
360dbacebeSHans Verkuil  *		a possible ABORT reply. If there was an error when sending the
370dbacebeSHans Verkuil  *		msg or FeatureAbort was returned, then reply is set to 0.
380dbacebeSHans Verkuil  *		If reply is non-zero upon return, then len/msg are set to
390dbacebeSHans Verkuil  *		the received message.
400dbacebeSHans Verkuil  *		If reply is zero upon return and status has the
410dbacebeSHans Verkuil  *		CEC_TX_STATUS_FEATURE_ABORT bit set, then len/msg are set to
420dbacebeSHans Verkuil  *		the received feature abort message.
430dbacebeSHans Verkuil  *		If reply is zero upon return and status has the
440dbacebeSHans Verkuil  *		CEC_TX_STATUS_MAX_RETRIES bit set, then no reply was seen at
450dbacebeSHans Verkuil  *		all. If reply is non-zero for CEC_TRANSMIT and the message is a
460dbacebeSHans Verkuil  *		broadcast, then -EINVAL is returned.
470dbacebeSHans Verkuil  *		if reply is non-zero, then timeout is set to 1000 (the required
480dbacebeSHans Verkuil  *		maximum response time).
490dbacebeSHans Verkuil  * @rx_status:	The message receive status bits. Set by the driver.
500dbacebeSHans Verkuil  * @tx_status:	The message transmit status bits. Set by the driver.
510dbacebeSHans Verkuil  * @tx_arb_lost_cnt: The number of 'Arbitration Lost' events. Set by the driver.
520dbacebeSHans Verkuil  * @tx_nack_cnt: The number of 'Not Acknowledged' events. Set by the driver.
530dbacebeSHans Verkuil  * @tx_low_drive_cnt: The number of 'Low Drive Detected' events. Set by the
540dbacebeSHans Verkuil  *		driver.
550dbacebeSHans Verkuil  * @tx_error_cnt: The number of 'Error' events. Set by the driver.
560dbacebeSHans Verkuil  */
570dbacebeSHans Verkuil struct cec_msg {
580dbacebeSHans Verkuil 	__u64 tx_ts;
590dbacebeSHans Verkuil 	__u64 rx_ts;
600dbacebeSHans Verkuil 	__u32 len;
610dbacebeSHans Verkuil 	__u32 timeout;
620dbacebeSHans Verkuil 	__u32 sequence;
630dbacebeSHans Verkuil 	__u32 flags;
640dbacebeSHans Verkuil 	__u8 msg[CEC_MAX_MSG_SIZE];
650dbacebeSHans Verkuil 	__u8 reply;
660dbacebeSHans Verkuil 	__u8 rx_status;
670dbacebeSHans Verkuil 	__u8 tx_status;
680dbacebeSHans Verkuil 	__u8 tx_arb_lost_cnt;
690dbacebeSHans Verkuil 	__u8 tx_nack_cnt;
700dbacebeSHans Verkuil 	__u8 tx_low_drive_cnt;
710dbacebeSHans Verkuil 	__u8 tx_error_cnt;
720dbacebeSHans Verkuil };
730dbacebeSHans Verkuil 
740dbacebeSHans Verkuil /**
750dbacebeSHans Verkuil  * cec_msg_initiator - return the initiator's logical address.
760dbacebeSHans Verkuil  * @msg:	the message structure
770dbacebeSHans Verkuil  */
cec_msg_initiator(const struct cec_msg * msg)780dbacebeSHans Verkuil static inline __u8 cec_msg_initiator(const struct cec_msg *msg)
790dbacebeSHans Verkuil {
800dbacebeSHans Verkuil 	return msg->msg[0] >> 4;
810dbacebeSHans Verkuil }
820dbacebeSHans Verkuil 
830dbacebeSHans Verkuil /**
840dbacebeSHans Verkuil  * cec_msg_destination - return the destination's logical address.
850dbacebeSHans Verkuil  * @msg:	the message structure
860dbacebeSHans Verkuil  */
cec_msg_destination(const struct cec_msg * msg)870dbacebeSHans Verkuil static inline __u8 cec_msg_destination(const struct cec_msg *msg)
880dbacebeSHans Verkuil {
890dbacebeSHans Verkuil 	return msg->msg[0] & 0xf;
900dbacebeSHans Verkuil }
910dbacebeSHans Verkuil 
920dbacebeSHans Verkuil /**
930dbacebeSHans Verkuil  * cec_msg_opcode - return the opcode of the message, -1 for poll
940dbacebeSHans Verkuil  * @msg:	the message structure
950dbacebeSHans Verkuil  */
cec_msg_opcode(const struct cec_msg * msg)960dbacebeSHans Verkuil static inline int cec_msg_opcode(const struct cec_msg *msg)
970dbacebeSHans Verkuil {
980dbacebeSHans Verkuil 	return msg->len > 1 ? msg->msg[1] : -1;
990dbacebeSHans Verkuil }
1000dbacebeSHans Verkuil 
1010dbacebeSHans Verkuil /**
1020dbacebeSHans Verkuil  * cec_msg_is_broadcast - return true if this is a broadcast message.
1030dbacebeSHans Verkuil  * @msg:	the message structure
1040dbacebeSHans Verkuil  */
cec_msg_is_broadcast(const struct cec_msg * msg)1053145c754SHans Verkuil static inline int cec_msg_is_broadcast(const struct cec_msg *msg)
1060dbacebeSHans Verkuil {
1070dbacebeSHans Verkuil 	return (msg->msg[0] & 0xf) == 0xf;
1080dbacebeSHans Verkuil }
1090dbacebeSHans Verkuil 
1100dbacebeSHans Verkuil /**
1110dbacebeSHans Verkuil  * cec_msg_init - initialize the message structure.
1120dbacebeSHans Verkuil  * @msg:	the message structure
1130dbacebeSHans Verkuil  * @initiator:	the logical address of the initiator
1140dbacebeSHans Verkuil  * @destination:the logical address of the destination (0xf for broadcast)
1150dbacebeSHans Verkuil  *
1160dbacebeSHans Verkuil  * The whole structure is zeroed, the len field is set to 1 (i.e. a poll
1170dbacebeSHans Verkuil  * message) and the initiator and destination are filled in.
1180dbacebeSHans Verkuil  */
cec_msg_init(struct cec_msg * msg,__u8 initiator,__u8 destination)1190dbacebeSHans Verkuil static inline void cec_msg_init(struct cec_msg *msg,
1200dbacebeSHans Verkuil 				__u8 initiator, __u8 destination)
1210dbacebeSHans Verkuil {
1220dbacebeSHans Verkuil 	memset(msg, 0, sizeof(*msg));
1230dbacebeSHans Verkuil 	msg->msg[0] = (initiator << 4) | destination;
1240dbacebeSHans Verkuil 	msg->len = 1;
1250dbacebeSHans Verkuil }
1260dbacebeSHans Verkuil 
1270dbacebeSHans Verkuil /**
1280dbacebeSHans Verkuil  * cec_msg_set_reply_to - fill in destination/initiator in a reply message.
1290dbacebeSHans Verkuil  * @msg:	the message structure for the reply
1300dbacebeSHans Verkuil  * @orig:	the original message structure
1310dbacebeSHans Verkuil  *
1320dbacebeSHans Verkuil  * Set the msg destination to the orig initiator and the msg initiator to the
1330dbacebeSHans Verkuil  * orig destination. Note that msg and orig may be the same pointer, in which
1340dbacebeSHans Verkuil  * case the change is done in place.
1350dbacebeSHans Verkuil  */
cec_msg_set_reply_to(struct cec_msg * msg,struct cec_msg * orig)1360dbacebeSHans Verkuil static inline void cec_msg_set_reply_to(struct cec_msg *msg,
1370dbacebeSHans Verkuil 					struct cec_msg *orig)
1380dbacebeSHans Verkuil {
1390dbacebeSHans Verkuil 	/* The destination becomes the initiator and vice versa */
1400dbacebeSHans Verkuil 	msg->msg[0] = (cec_msg_destination(orig) << 4) |
1410dbacebeSHans Verkuil 		      cec_msg_initiator(orig);
1420dbacebeSHans Verkuil 	msg->reply = msg->timeout = 0;
1430dbacebeSHans Verkuil }
1440dbacebeSHans Verkuil 
145567f882aSHans Verkuil /**
146567f882aSHans Verkuil  * cec_msg_recv_is_tx_result - return true if this message contains the
147567f882aSHans Verkuil  *			       result of an earlier non-blocking transmit
148567f882aSHans Verkuil  * @msg:	the message structure from CEC_RECEIVE
149567f882aSHans Verkuil  */
cec_msg_recv_is_tx_result(const struct cec_msg * msg)150567f882aSHans Verkuil static inline int cec_msg_recv_is_tx_result(const struct cec_msg *msg)
151567f882aSHans Verkuil {
152567f882aSHans Verkuil 	return msg->sequence && msg->tx_status && !msg->rx_status;
153567f882aSHans Verkuil }
154567f882aSHans Verkuil 
155567f882aSHans Verkuil /**
156567f882aSHans Verkuil  * cec_msg_recv_is_rx_result - return true if this message contains the
157567f882aSHans Verkuil  *			       reply of an earlier non-blocking transmit
158567f882aSHans Verkuil  * @msg:	the message structure from CEC_RECEIVE
159567f882aSHans Verkuil  */
cec_msg_recv_is_rx_result(const struct cec_msg * msg)160567f882aSHans Verkuil static inline int cec_msg_recv_is_rx_result(const struct cec_msg *msg)
161567f882aSHans Verkuil {
162567f882aSHans Verkuil 	return msg->sequence && !msg->tx_status && msg->rx_status;
163567f882aSHans Verkuil }
164567f882aSHans Verkuil 
1650dbacebeSHans Verkuil /* cec_msg flags field */
1660dbacebeSHans Verkuil #define CEC_MSG_FL_REPLY_TO_FOLLOWERS	(1 << 0)
167aa50accfSHans Verkuil #define CEC_MSG_FL_RAW			(1 << 1)
1680dbacebeSHans Verkuil 
1690dbacebeSHans Verkuil /* cec_msg tx/rx_status field */
1700dbacebeSHans Verkuil #define CEC_TX_STATUS_OK		(1 << 0)
1710dbacebeSHans Verkuil #define CEC_TX_STATUS_ARB_LOST		(1 << 1)
1720dbacebeSHans Verkuil #define CEC_TX_STATUS_NACK		(1 << 2)
1730dbacebeSHans Verkuil #define CEC_TX_STATUS_LOW_DRIVE		(1 << 3)
1740dbacebeSHans Verkuil #define CEC_TX_STATUS_ERROR		(1 << 4)
1750dbacebeSHans Verkuil #define CEC_TX_STATUS_MAX_RETRIES	(1 << 5)
1767ec2b3b9SHans Verkuil #define CEC_TX_STATUS_ABORTED		(1 << 6)
1777ec2b3b9SHans Verkuil #define CEC_TX_STATUS_TIMEOUT		(1 << 7)
1780dbacebeSHans Verkuil 
1790dbacebeSHans Verkuil #define CEC_RX_STATUS_OK		(1 << 0)
1800dbacebeSHans Verkuil #define CEC_RX_STATUS_TIMEOUT		(1 << 1)
1810dbacebeSHans Verkuil #define CEC_RX_STATUS_FEATURE_ABORT	(1 << 2)
1827ec2b3b9SHans Verkuil #define CEC_RX_STATUS_ABORTED		(1 << 3)
1830dbacebeSHans Verkuil 
cec_msg_status_is_ok(const struct cec_msg * msg)1843145c754SHans Verkuil static inline int cec_msg_status_is_ok(const struct cec_msg *msg)
1850dbacebeSHans Verkuil {
1860dbacebeSHans Verkuil 	if (msg->tx_status && !(msg->tx_status & CEC_TX_STATUS_OK))
1873145c754SHans Verkuil 		return 0;
1880dbacebeSHans Verkuil 	if (msg->rx_status && !(msg->rx_status & CEC_RX_STATUS_OK))
1893145c754SHans Verkuil 		return 0;
1900dbacebeSHans Verkuil 	if (!msg->tx_status && !msg->rx_status)
1913145c754SHans Verkuil 		return 0;
1920dbacebeSHans Verkuil 	return !(msg->rx_status & CEC_RX_STATUS_FEATURE_ABORT);
1930dbacebeSHans Verkuil }
1940dbacebeSHans Verkuil 
1950dbacebeSHans Verkuil #define CEC_LOG_ADDR_INVALID		0xff
1960dbacebeSHans Verkuil #define CEC_PHYS_ADDR_INVALID		0xffff
1970dbacebeSHans Verkuil 
1980dbacebeSHans Verkuil /*
1990dbacebeSHans Verkuil  * The maximum number of logical addresses one device can be assigned to.
2000dbacebeSHans Verkuil  * The CEC 2.0 spec allows for only 2 logical addresses at the moment. The
2010dbacebeSHans Verkuil  * Analog Devices CEC hardware supports 3. So let's go wild and go for 4.
2020dbacebeSHans Verkuil  */
2030dbacebeSHans Verkuil #define CEC_MAX_LOG_ADDRS 4
2040dbacebeSHans Verkuil 
2050dbacebeSHans Verkuil /* The logical addresses defined by CEC 2.0 */
2060dbacebeSHans Verkuil #define CEC_LOG_ADDR_TV			0
2070dbacebeSHans Verkuil #define CEC_LOG_ADDR_RECORD_1		1
2080dbacebeSHans Verkuil #define CEC_LOG_ADDR_RECORD_2		2
2090dbacebeSHans Verkuil #define CEC_LOG_ADDR_TUNER_1		3
2100dbacebeSHans Verkuil #define CEC_LOG_ADDR_PLAYBACK_1		4
2110dbacebeSHans Verkuil #define CEC_LOG_ADDR_AUDIOSYSTEM	5
2120dbacebeSHans Verkuil #define CEC_LOG_ADDR_TUNER_2		6
2130dbacebeSHans Verkuil #define CEC_LOG_ADDR_TUNER_3		7
2140dbacebeSHans Verkuil #define CEC_LOG_ADDR_PLAYBACK_2		8
2150dbacebeSHans Verkuil #define CEC_LOG_ADDR_RECORD_3		9
2160dbacebeSHans Verkuil #define CEC_LOG_ADDR_TUNER_4		10
2170dbacebeSHans Verkuil #define CEC_LOG_ADDR_PLAYBACK_3		11
2180dbacebeSHans Verkuil #define CEC_LOG_ADDR_BACKUP_1		12
2190dbacebeSHans Verkuil #define CEC_LOG_ADDR_BACKUP_2		13
2200dbacebeSHans Verkuil #define CEC_LOG_ADDR_SPECIFIC		14
2210dbacebeSHans Verkuil #define CEC_LOG_ADDR_UNREGISTERED	15 /* as initiator address */
2226e9b73c6SHans Verkuil #define CEC_LOG_ADDR_BROADCAST		15 /* as destination address */
2230dbacebeSHans Verkuil 
2240dbacebeSHans Verkuil /* The logical address types that the CEC device wants to claim */
2250dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_TV		0
2260dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_RECORD	1
2270dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_TUNER		2
2280dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_PLAYBACK	3
2290dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_AUDIOSYSTEM	4
2300dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_SPECIFIC	5
2310dbacebeSHans Verkuil #define CEC_LOG_ADDR_TYPE_UNREGISTERED	6
2320dbacebeSHans Verkuil /*
2330dbacebeSHans Verkuil  * Switches should use UNREGISTERED.
2340dbacebeSHans Verkuil  * Processors should use SPECIFIC.
2350dbacebeSHans Verkuil  */
2360dbacebeSHans Verkuil 
2370dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_TV		(1 << CEC_LOG_ADDR_TV)
2380dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_RECORD	((1 << CEC_LOG_ADDR_RECORD_1) | \
2390dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_RECORD_2) | \
2400dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_RECORD_3))
2410dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_TUNER		((1 << CEC_LOG_ADDR_TUNER_1) | \
2420dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_TUNER_2) | \
2430dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_TUNER_3) | \
2440dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_TUNER_4))
2450dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_PLAYBACK	((1 << CEC_LOG_ADDR_PLAYBACK_1) | \
2460dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_PLAYBACK_2) | \
2470dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_PLAYBACK_3))
2480dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_AUDIOSYSTEM	(1 << CEC_LOG_ADDR_AUDIOSYSTEM)
2490dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_BACKUP	((1 << CEC_LOG_ADDR_BACKUP_1) | \
2500dbacebeSHans Verkuil 					 (1 << CEC_LOG_ADDR_BACKUP_2))
2510dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_SPECIFIC	(1 << CEC_LOG_ADDR_SPECIFIC)
2520dbacebeSHans Verkuil #define CEC_LOG_ADDR_MASK_UNREGISTERED	(1 << CEC_LOG_ADDR_UNREGISTERED)
2530dbacebeSHans Verkuil 
cec_has_tv(__u16 log_addr_mask)2543145c754SHans Verkuil static inline int cec_has_tv(__u16 log_addr_mask)
2550dbacebeSHans Verkuil {
2560dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_TV;
2570dbacebeSHans Verkuil }
2580dbacebeSHans Verkuil 
cec_has_record(__u16 log_addr_mask)2593145c754SHans Verkuil static inline int cec_has_record(__u16 log_addr_mask)
2600dbacebeSHans Verkuil {
2610dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_RECORD;
2620dbacebeSHans Verkuil }
2630dbacebeSHans Verkuil 
cec_has_tuner(__u16 log_addr_mask)2643145c754SHans Verkuil static inline int cec_has_tuner(__u16 log_addr_mask)
2650dbacebeSHans Verkuil {
2660dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_TUNER;
2670dbacebeSHans Verkuil }
2680dbacebeSHans Verkuil 
cec_has_playback(__u16 log_addr_mask)2693145c754SHans Verkuil static inline int cec_has_playback(__u16 log_addr_mask)
2700dbacebeSHans Verkuil {
2710dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_PLAYBACK;
2720dbacebeSHans Verkuil }
2730dbacebeSHans Verkuil 
cec_has_audiosystem(__u16 log_addr_mask)2743145c754SHans Verkuil static inline int cec_has_audiosystem(__u16 log_addr_mask)
2750dbacebeSHans Verkuil {
2760dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_AUDIOSYSTEM;
2770dbacebeSHans Verkuil }
2780dbacebeSHans Verkuil 
cec_has_backup(__u16 log_addr_mask)2793145c754SHans Verkuil static inline int cec_has_backup(__u16 log_addr_mask)
2800dbacebeSHans Verkuil {
2810dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_BACKUP;
2820dbacebeSHans Verkuil }
2830dbacebeSHans Verkuil 
cec_has_specific(__u16 log_addr_mask)2843145c754SHans Verkuil static inline int cec_has_specific(__u16 log_addr_mask)
2850dbacebeSHans Verkuil {
2860dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_SPECIFIC;
2870dbacebeSHans Verkuil }
2880dbacebeSHans Verkuil 
cec_is_unregistered(__u16 log_addr_mask)2893145c754SHans Verkuil static inline int cec_is_unregistered(__u16 log_addr_mask)
2900dbacebeSHans Verkuil {
2910dbacebeSHans Verkuil 	return log_addr_mask & CEC_LOG_ADDR_MASK_UNREGISTERED;
2920dbacebeSHans Verkuil }
2930dbacebeSHans Verkuil 
cec_is_unconfigured(__u16 log_addr_mask)2943145c754SHans Verkuil static inline int cec_is_unconfigured(__u16 log_addr_mask)
2950dbacebeSHans Verkuil {
2960dbacebeSHans Verkuil 	return log_addr_mask == 0;
2970dbacebeSHans Verkuil }
2980dbacebeSHans Verkuil 
2990dbacebeSHans Verkuil /*
3000dbacebeSHans Verkuil  * Use this if there is no vendor ID (CEC_G_VENDOR_ID) or if the vendor ID
3010dbacebeSHans Verkuil  * should be disabled (CEC_S_VENDOR_ID)
3020dbacebeSHans Verkuil  */
3030dbacebeSHans Verkuil #define CEC_VENDOR_ID_NONE		0xffffffff
3040dbacebeSHans Verkuil 
3050dbacebeSHans Verkuil /* The message handling modes */
3060dbacebeSHans Verkuil /* Modes for initiator */
3070dbacebeSHans Verkuil #define CEC_MODE_NO_INITIATOR		(0x0 << 0)
3080dbacebeSHans Verkuil #define CEC_MODE_INITIATOR		(0x1 << 0)
3090dbacebeSHans Verkuil #define CEC_MODE_EXCL_INITIATOR		(0x2 << 0)
3100dbacebeSHans Verkuil #define CEC_MODE_INITIATOR_MSK		0x0f
3110dbacebeSHans Verkuil 
3120dbacebeSHans Verkuil /* Modes for follower */
3130dbacebeSHans Verkuil #define CEC_MODE_NO_FOLLOWER		(0x0 << 4)
3140dbacebeSHans Verkuil #define CEC_MODE_FOLLOWER		(0x1 << 4)
3150dbacebeSHans Verkuil #define CEC_MODE_EXCL_FOLLOWER		(0x2 << 4)
3160dbacebeSHans Verkuil #define CEC_MODE_EXCL_FOLLOWER_PASSTHRU	(0x3 << 4)
3176303d978SHans Verkuil #define CEC_MODE_MONITOR_PIN		(0xd << 4)
3180dbacebeSHans Verkuil #define CEC_MODE_MONITOR		(0xe << 4)
3190dbacebeSHans Verkuil #define CEC_MODE_MONITOR_ALL		(0xf << 4)
3200dbacebeSHans Verkuil #define CEC_MODE_FOLLOWER_MSK		0xf0
3210dbacebeSHans Verkuil 
3220dbacebeSHans Verkuil /* Userspace has to configure the physical address */
3230dbacebeSHans Verkuil #define CEC_CAP_PHYS_ADDR	(1 << 0)
3240dbacebeSHans Verkuil /* Userspace has to configure the logical addresses */
3250dbacebeSHans Verkuil #define CEC_CAP_LOG_ADDRS	(1 << 1)
3260dbacebeSHans Verkuil /* Userspace can transmit messages (and thus become follower as well) */
3270dbacebeSHans Verkuil #define CEC_CAP_TRANSMIT	(1 << 2)
3280dbacebeSHans Verkuil /*
3290dbacebeSHans Verkuil  * Passthrough all messages instead of processing them.
3300dbacebeSHans Verkuil  */
3310dbacebeSHans Verkuil #define CEC_CAP_PASSTHROUGH	(1 << 3)
3320dbacebeSHans Verkuil /* Supports remote control */
3330dbacebeSHans Verkuil #define CEC_CAP_RC		(1 << 4)
3340dbacebeSHans Verkuil /* Hardware can monitor all messages, not just directed and broadcast. */
3350dbacebeSHans Verkuil #define CEC_CAP_MONITOR_ALL	(1 << 5)
336f902c1e9SHans Verkuil /* Hardware can use CEC only if the HDMI HPD pin is high. */
337f902c1e9SHans Verkuil #define CEC_CAP_NEEDS_HPD	(1 << 6)
3386303d978SHans Verkuil /* Hardware can monitor CEC pin transitions */
3396303d978SHans Verkuil #define CEC_CAP_MONITOR_PIN	(1 << 7)
3409098c1c2SDariusz Marcinkiewicz /* CEC_ADAP_G_CONNECTOR_INFO is available */
3419098c1c2SDariusz Marcinkiewicz #define CEC_CAP_CONNECTOR_INFO	(1 << 8)
3420dbacebeSHans Verkuil 
3430dbacebeSHans Verkuil /**
3440dbacebeSHans Verkuil  * struct cec_caps - CEC capabilities structure.
3450dbacebeSHans Verkuil  * @driver: name of the CEC device driver.
3460dbacebeSHans Verkuil  * @name: name of the CEC device. @driver + @name must be unique.
3470dbacebeSHans Verkuil  * @available_log_addrs: number of available logical addresses.
3480dbacebeSHans Verkuil  * @capabilities: capabilities of the CEC adapter.
3490dbacebeSHans Verkuil  * @version: version of the CEC adapter framework.
3500dbacebeSHans Verkuil  */
3510dbacebeSHans Verkuil struct cec_caps {
3520dbacebeSHans Verkuil 	char driver[32];
3530dbacebeSHans Verkuil 	char name[32];
3540dbacebeSHans Verkuil 	__u32 available_log_addrs;
3550dbacebeSHans Verkuil 	__u32 capabilities;
3560dbacebeSHans Verkuil 	__u32 version;
3570dbacebeSHans Verkuil };
3580dbacebeSHans Verkuil 
3590dbacebeSHans Verkuil /**
3600dbacebeSHans Verkuil  * struct cec_log_addrs - CEC logical addresses structure.
3610dbacebeSHans Verkuil  * @log_addr: the claimed logical addresses. Set by the driver.
3620dbacebeSHans Verkuil  * @log_addr_mask: current logical address mask. Set by the driver.
3630dbacebeSHans Verkuil  * @cec_version: the CEC version that the adapter should implement. Set by the
3640dbacebeSHans Verkuil  *	caller.
3650dbacebeSHans Verkuil  * @num_log_addrs: how many logical addresses should be claimed. Set by the
3660dbacebeSHans Verkuil  *	caller.
3670dbacebeSHans Verkuil  * @vendor_id: the vendor ID of the device. Set by the caller.
3680dbacebeSHans Verkuil  * @flags: flags.
3690dbacebeSHans Verkuil  * @osd_name: the OSD name of the device. Set by the caller.
3700dbacebeSHans Verkuil  * @primary_device_type: the primary device type for each logical address.
3710dbacebeSHans Verkuil  *	Set by the caller.
3720dbacebeSHans Verkuil  * @log_addr_type: the logical address types. Set by the caller.
3730dbacebeSHans Verkuil  * @all_device_types: CEC 2.0: all device types represented by the logical
3740dbacebeSHans Verkuil  *	address. Set by the caller.
3750dbacebeSHans Verkuil  * @features:	CEC 2.0: The logical address features. Set by the caller.
3760dbacebeSHans Verkuil  */
3770dbacebeSHans Verkuil struct cec_log_addrs {
3780dbacebeSHans Verkuil 	__u8 log_addr[CEC_MAX_LOG_ADDRS];
3790dbacebeSHans Verkuil 	__u16 log_addr_mask;
3800dbacebeSHans Verkuil 	__u8 cec_version;
3810dbacebeSHans Verkuil 	__u8 num_log_addrs;
3820dbacebeSHans Verkuil 	__u32 vendor_id;
3830dbacebeSHans Verkuil 	__u32 flags;
3840dbacebeSHans Verkuil 	char osd_name[15];
3850dbacebeSHans Verkuil 	__u8 primary_device_type[CEC_MAX_LOG_ADDRS];
3860dbacebeSHans Verkuil 	__u8 log_addr_type[CEC_MAX_LOG_ADDRS];
3870dbacebeSHans Verkuil 
3880dbacebeSHans Verkuil 	/* CEC 2.0 */
3890dbacebeSHans Verkuil 	__u8 all_device_types[CEC_MAX_LOG_ADDRS];
3900dbacebeSHans Verkuil 	__u8 features[CEC_MAX_LOG_ADDRS][12];
3910dbacebeSHans Verkuil };
3920dbacebeSHans Verkuil 
3930dbacebeSHans Verkuil /* Allow a fallback to unregistered */
3940dbacebeSHans Verkuil #define CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK	(1 << 0)
3950dbacebeSHans Verkuil /* Passthrough RC messages to the input subsystem */
3960dbacebeSHans Verkuil #define CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU	(1 << 1)
3970dbacebeSHans Verkuil /* CDC-Only device: supports only CDC messages */
3980dbacebeSHans Verkuil #define CEC_LOG_ADDRS_FL_CDC_ONLY		(1 << 2)
3990dbacebeSHans Verkuil 
4009098c1c2SDariusz Marcinkiewicz /**
4019098c1c2SDariusz Marcinkiewicz  * struct cec_drm_connector_info - tells which drm connector is
4029098c1c2SDariusz Marcinkiewicz  * associated with the CEC adapter.
4039098c1c2SDariusz Marcinkiewicz  * @card_no: drm card number
4049098c1c2SDariusz Marcinkiewicz  * @connector_id: drm connector ID
4059098c1c2SDariusz Marcinkiewicz  */
4069098c1c2SDariusz Marcinkiewicz struct cec_drm_connector_info {
4079098c1c2SDariusz Marcinkiewicz 	__u32 card_no;
4089098c1c2SDariusz Marcinkiewicz 	__u32 connector_id;
4099098c1c2SDariusz Marcinkiewicz };
4109098c1c2SDariusz Marcinkiewicz 
4119098c1c2SDariusz Marcinkiewicz #define CEC_CONNECTOR_TYPE_NO_CONNECTOR	0
4129098c1c2SDariusz Marcinkiewicz #define CEC_CONNECTOR_TYPE_DRM		1
4139098c1c2SDariusz Marcinkiewicz 
4149098c1c2SDariusz Marcinkiewicz /**
4159098c1c2SDariusz Marcinkiewicz  * struct cec_connector_info - tells if and which connector is
4169098c1c2SDariusz Marcinkiewicz  * associated with the CEC adapter.
4179098c1c2SDariusz Marcinkiewicz  * @type: connector type (if any)
4189098c1c2SDariusz Marcinkiewicz  * @drm: drm connector info
419f12b81e4SHans Verkuil  * @raw: array to pad the union
4209098c1c2SDariusz Marcinkiewicz  */
4219098c1c2SDariusz Marcinkiewicz struct cec_connector_info {
4229098c1c2SDariusz Marcinkiewicz 	__u32 type;
4239098c1c2SDariusz Marcinkiewicz 	union {
4249098c1c2SDariusz Marcinkiewicz 		struct cec_drm_connector_info drm;
4259098c1c2SDariusz Marcinkiewicz 		__u32 raw[16];
4269098c1c2SDariusz Marcinkiewicz 	};
4279098c1c2SDariusz Marcinkiewicz };
4289098c1c2SDariusz Marcinkiewicz 
4290dbacebeSHans Verkuil /* Events */
4300dbacebeSHans Verkuil 
4310dbacebeSHans Verkuil /* Event that occurs when the adapter state changes */
4320dbacebeSHans Verkuil #define CEC_EVENT_STATE_CHANGE		1
4330dbacebeSHans Verkuil /*
4340dbacebeSHans Verkuil  * This event is sent when messages are lost because the application
4350dbacebeSHans Verkuil  * didn't empty the message queue in time
4360dbacebeSHans Verkuil  */
4370dbacebeSHans Verkuil #define CEC_EVENT_LOST_MSGS		2
4389a6b2a87SHans Verkuil #define CEC_EVENT_PIN_CEC_LOW		3
4399a6b2a87SHans Verkuil #define CEC_EVENT_PIN_CEC_HIGH		4
440333ef6bdSHans Verkuil #define CEC_EVENT_PIN_HPD_LOW		5
441333ef6bdSHans Verkuil #define CEC_EVENT_PIN_HPD_HIGH		6
442f48a534aSHans Verkuil #define CEC_EVENT_PIN_5V_LOW		7
443f48a534aSHans Verkuil #define CEC_EVENT_PIN_5V_HIGH		8
4440dbacebeSHans Verkuil 
4450dbacebeSHans Verkuil #define CEC_EVENT_FL_INITIAL_STATE	(1 << 0)
4466b2bbb08SHans Verkuil #define CEC_EVENT_FL_DROPPED_EVENTS	(1 << 1)
4470dbacebeSHans Verkuil 
4480dbacebeSHans Verkuil /**
4490dbacebeSHans Verkuil  * struct cec_event_state_change - used when the CEC adapter changes state.
4500dbacebeSHans Verkuil  * @phys_addr: the current physical address
4510dbacebeSHans Verkuil  * @log_addr_mask: the current logical address mask
4529098c1c2SDariusz Marcinkiewicz  * @have_conn_info: if non-zero, then HDMI connector information is available.
4539098c1c2SDariusz Marcinkiewicz  *	This field is only valid if CEC_CAP_CONNECTOR_INFO is set. If that
4549098c1c2SDariusz Marcinkiewicz  *	capability is set and @have_conn_info is zero, then that indicates
4559098c1c2SDariusz Marcinkiewicz  *	that the HDMI connector device is not instantiated, either because
4569098c1c2SDariusz Marcinkiewicz  *	the HDMI driver is still configuring the device or because the HDMI
4579098c1c2SDariusz Marcinkiewicz  *	device was unbound.
4580dbacebeSHans Verkuil  */
4590dbacebeSHans Verkuil struct cec_event_state_change {
4600dbacebeSHans Verkuil 	__u16 phys_addr;
4610dbacebeSHans Verkuil 	__u16 log_addr_mask;
4629098c1c2SDariusz Marcinkiewicz 	__u16 have_conn_info;
4630dbacebeSHans Verkuil };
4640dbacebeSHans Verkuil 
4650dbacebeSHans Verkuil /**
4666b2bbb08SHans Verkuil  * struct cec_event_lost_msgs - tells you how many messages were lost.
4670dbacebeSHans Verkuil  * @lost_msgs: how many messages were lost.
4680dbacebeSHans Verkuil  */
4690dbacebeSHans Verkuil struct cec_event_lost_msgs {
4700dbacebeSHans Verkuil 	__u32 lost_msgs;
4710dbacebeSHans Verkuil };
4720dbacebeSHans Verkuil 
4730dbacebeSHans Verkuil /**
4740dbacebeSHans Verkuil  * struct cec_event - CEC event structure
4750dbacebeSHans Verkuil  * @ts: the timestamp of when the event was sent.
4760dbacebeSHans Verkuil  * @event: the event.
477f12b81e4SHans Verkuil  * @flags: event flags.
4780dbacebeSHans Verkuil  * @state_change: the event payload for CEC_EVENT_STATE_CHANGE.
4790dbacebeSHans Verkuil  * @lost_msgs: the event payload for CEC_EVENT_LOST_MSGS.
4800dbacebeSHans Verkuil  * @raw: array to pad the union.
4810dbacebeSHans Verkuil  */
4820dbacebeSHans Verkuil struct cec_event {
4830dbacebeSHans Verkuil 	__u64 ts;
4840dbacebeSHans Verkuil 	__u32 event;
4850dbacebeSHans Verkuil 	__u32 flags;
4860dbacebeSHans Verkuil 	union {
4870dbacebeSHans Verkuil 		struct cec_event_state_change state_change;
4880dbacebeSHans Verkuil 		struct cec_event_lost_msgs lost_msgs;
4890dbacebeSHans Verkuil 		__u32 raw[16];
4900dbacebeSHans Verkuil 	};
4910dbacebeSHans Verkuil };
4920dbacebeSHans Verkuil 
4930dbacebeSHans Verkuil /* ioctls */
4940dbacebeSHans Verkuil 
4950dbacebeSHans Verkuil /* Adapter capabilities */
4960dbacebeSHans Verkuil #define CEC_ADAP_G_CAPS		_IOWR('a',  0, struct cec_caps)
4970dbacebeSHans Verkuil 
4980dbacebeSHans Verkuil /*
4990dbacebeSHans Verkuil  * phys_addr is either 0 (if this is the CEC root device)
5000dbacebeSHans Verkuil  * or a valid physical address obtained from the sink's EDID
5010dbacebeSHans Verkuil  * as read by this CEC device (if this is a source device)
5020dbacebeSHans Verkuil  * or a physical address obtained and modified from a sink
5030dbacebeSHans Verkuil  * EDID and used for a sink CEC device.
5040dbacebeSHans Verkuil  * If nothing is connected, then phys_addr is 0xffff.
5050dbacebeSHans Verkuil  * See HDMI 1.4b, section 8.7 (Physical Address).
5060dbacebeSHans Verkuil  *
5070dbacebeSHans Verkuil  * The CEC_ADAP_S_PHYS_ADDR ioctl may not be available if that is handled
5080dbacebeSHans Verkuil  * internally.
5090dbacebeSHans Verkuil  */
5100dbacebeSHans Verkuil #define CEC_ADAP_G_PHYS_ADDR	_IOR('a',  1, __u16)
5110dbacebeSHans Verkuil #define CEC_ADAP_S_PHYS_ADDR	_IOW('a',  2, __u16)
5120dbacebeSHans Verkuil 
5130dbacebeSHans Verkuil /*
5140dbacebeSHans Verkuil  * Configure the CEC adapter. It sets the device type and which
5150dbacebeSHans Verkuil  * logical types it will try to claim. It will return which
5160dbacebeSHans Verkuil  * logical addresses it could actually claim.
5170dbacebeSHans Verkuil  * An error is returned if the adapter is disabled or if there
5180dbacebeSHans Verkuil  * is no physical address assigned.
5190dbacebeSHans Verkuil  */
5200dbacebeSHans Verkuil 
5210dbacebeSHans Verkuil #define CEC_ADAP_G_LOG_ADDRS	_IOR('a',  3, struct cec_log_addrs)
5220dbacebeSHans Verkuil #define CEC_ADAP_S_LOG_ADDRS	_IOWR('a',  4, struct cec_log_addrs)
5230dbacebeSHans Verkuil 
5240dbacebeSHans Verkuil /* Transmit/receive a CEC command */
5250dbacebeSHans Verkuil #define CEC_TRANSMIT		_IOWR('a',  5, struct cec_msg)
5260dbacebeSHans Verkuil #define CEC_RECEIVE		_IOWR('a',  6, struct cec_msg)
5270dbacebeSHans Verkuil 
5280dbacebeSHans Verkuil /* Dequeue CEC events */
5290dbacebeSHans Verkuil #define CEC_DQEVENT		_IOWR('a',  7, struct cec_event)
5300dbacebeSHans Verkuil 
5310dbacebeSHans Verkuil /*
5320dbacebeSHans Verkuil  * Get and set the message handling mode for this filehandle.
5330dbacebeSHans Verkuil  */
5340dbacebeSHans Verkuil #define CEC_G_MODE		_IOR('a',  8, __u32)
5350dbacebeSHans Verkuil #define CEC_S_MODE		_IOW('a',  9, __u32)
5360dbacebeSHans Verkuil 
5379098c1c2SDariusz Marcinkiewicz /* Get the connector info */
5389098c1c2SDariusz Marcinkiewicz #define CEC_ADAP_G_CONNECTOR_INFO _IOR('a',  10, struct cec_connector_info)
5399098c1c2SDariusz Marcinkiewicz 
5400dbacebeSHans Verkuil /*
5410dbacebeSHans Verkuil  * The remainder of this header defines all CEC messages and operands.
5420dbacebeSHans Verkuil  * The format matters since it the cec-ctl utility parses it to generate
5430dbacebeSHans Verkuil  * code for implementing all these messages.
5440dbacebeSHans Verkuil  *
5450dbacebeSHans Verkuil  * Comments ending with 'Feature' group messages for each feature.
5460dbacebeSHans Verkuil  * If messages are part of multiple features, then the "Has also"
5470dbacebeSHans Verkuil  * comment is used to list the previously defined messages that are
5480dbacebeSHans Verkuil  * supported by the feature.
5490dbacebeSHans Verkuil  *
5500dbacebeSHans Verkuil  * Before operands are defined a comment is added that gives the
5510dbacebeSHans Verkuil  * name of the operand and in brackets the variable name of the
5520dbacebeSHans Verkuil  * corresponding argument in the cec-funcs.h function.
5530dbacebeSHans Verkuil  */
5540dbacebeSHans Verkuil 
5550dbacebeSHans Verkuil /* Messages */
5560dbacebeSHans Verkuil 
5570dbacebeSHans Verkuil /* One Touch Play Feature */
5580dbacebeSHans Verkuil #define CEC_MSG_ACTIVE_SOURCE				0x82
5590dbacebeSHans Verkuil #define CEC_MSG_IMAGE_VIEW_ON				0x04
5600dbacebeSHans Verkuil #define CEC_MSG_TEXT_VIEW_ON				0x0d
5610dbacebeSHans Verkuil 
5620dbacebeSHans Verkuil 
5630dbacebeSHans Verkuil /* Routing Control Feature */
5640dbacebeSHans Verkuil 
5650dbacebeSHans Verkuil /*
5660dbacebeSHans Verkuil  * Has also:
5670dbacebeSHans Verkuil  *	CEC_MSG_ACTIVE_SOURCE
5680dbacebeSHans Verkuil  */
5690dbacebeSHans Verkuil 
5700dbacebeSHans Verkuil #define CEC_MSG_INACTIVE_SOURCE				0x9d
5710dbacebeSHans Verkuil #define CEC_MSG_REQUEST_ACTIVE_SOURCE			0x85
5720dbacebeSHans Verkuil #define CEC_MSG_ROUTING_CHANGE				0x80
5730dbacebeSHans Verkuil #define CEC_MSG_ROUTING_INFORMATION			0x81
5740dbacebeSHans Verkuil #define CEC_MSG_SET_STREAM_PATH				0x86
5750dbacebeSHans Verkuil 
5760dbacebeSHans Verkuil 
5770dbacebeSHans Verkuil /* Standby Feature */
5780dbacebeSHans Verkuil #define CEC_MSG_STANDBY					0x36
5790dbacebeSHans Verkuil 
5800dbacebeSHans Verkuil 
5810dbacebeSHans Verkuil /* One Touch Record Feature */
5820dbacebeSHans Verkuil #define CEC_MSG_RECORD_OFF				0x0b
5830dbacebeSHans Verkuil #define CEC_MSG_RECORD_ON				0x09
5840dbacebeSHans Verkuil /* Record Source Type Operand (rec_src_type) */
5850dbacebeSHans Verkuil #define CEC_OP_RECORD_SRC_OWN				1
5860dbacebeSHans Verkuil #define CEC_OP_RECORD_SRC_DIGITAL			2
5870dbacebeSHans Verkuil #define CEC_OP_RECORD_SRC_ANALOG			3
5880dbacebeSHans Verkuil #define CEC_OP_RECORD_SRC_EXT_PLUG			4
5890dbacebeSHans Verkuil #define CEC_OP_RECORD_SRC_EXT_PHYS_ADDR			5
5900dbacebeSHans Verkuil /* Service Identification Method Operand (service_id_method) */
5910dbacebeSHans Verkuil #define CEC_OP_SERVICE_ID_METHOD_BY_DIG_ID		0
5920dbacebeSHans Verkuil #define CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL		1
5930dbacebeSHans Verkuil /* Digital Service Broadcast System Operand (dig_bcast_system) */
5940dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_GEN	0x00
5950dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN	0x01
5960dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_GEN		0x02
5970dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_BS		0x08
5980dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_CS		0x09
5990dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ARIB_T		0x0a
6000dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE	0x10
6010dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT	0x11
6020dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T		0x12
6030dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_C		0x18
6040dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S		0x19
6050dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_S2		0x1a
6060dbacebeSHans Verkuil #define CEC_OP_DIG_SERVICE_BCAST_SYSTEM_DVB_T		0x1b
6070dbacebeSHans Verkuil /* Analogue Broadcast Type Operand (ana_bcast_type) */
6080dbacebeSHans Verkuil #define CEC_OP_ANA_BCAST_TYPE_CABLE			0
6090dbacebeSHans Verkuil #define CEC_OP_ANA_BCAST_TYPE_SATELLITE			1
6100dbacebeSHans Verkuil #define CEC_OP_ANA_BCAST_TYPE_TERRESTRIAL		2
6110dbacebeSHans Verkuil /* Broadcast System Operand (bcast_system) */
6120dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_PAL_BG			0x00
6130dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_SECAM_LQ			0x01 /* SECAM L' */
6140dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_PAL_M			0x02
6150dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_NTSC_M			0x03
6160dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_PAL_I			0x04
6170dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_SECAM_DK			0x05
6180dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_SECAM_BG			0x06
6190dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_SECAM_L			0x07
6200dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_PAL_DK			0x08
6210dbacebeSHans Verkuil #define CEC_OP_BCAST_SYSTEM_OTHER			0x1f
6220dbacebeSHans Verkuil /* Channel Number Format Operand (channel_number_fmt) */
6230dbacebeSHans Verkuil #define CEC_OP_CHANNEL_NUMBER_FMT_1_PART		0x01
6240dbacebeSHans Verkuil #define CEC_OP_CHANNEL_NUMBER_FMT_2_PART		0x02
6250dbacebeSHans Verkuil 
6260dbacebeSHans Verkuil #define CEC_MSG_RECORD_STATUS				0x0a
6270dbacebeSHans Verkuil /* Record Status Operand (rec_status) */
6280dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_CUR_SRC			0x01
6290dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_DIG_SERVICE		0x02
6300dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_ANA_SERVICE		0x03
6310dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_EXT_INPUT			0x04
6320dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_DIG_SERVICE		0x05
6330dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_ANA_SERVICE		0x06
6340dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_SERVICE			0x07
6350dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_INVALID_EXT_PLUG		0x09
6360dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_INVALID_EXT_PHYS_ADDR	0x0a
6370dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_UNSUP_CA			0x0b
6380dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_CA_ENTITLEMENTS		0x0c
6390dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_CANT_COPY_SRC		0x0d
6400dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_MORE_COPIES		0x0e
6410dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_MEDIA			0x10
6420dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_PLAYING			0x11
6430dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_ALREADY_RECORDING		0x12
6440dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_MEDIA_PROT			0x13
6450dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_SIGNAL			0x14
6460dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_MEDIA_PROBLEM		0x15
6470dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_NO_SPACE			0x16
6480dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_PARENTAL_LOCK		0x17
6490dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_TERMINATED_OK		0x1a
6500dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_ALREADY_TERM		0x1b
6510dbacebeSHans Verkuil #define CEC_OP_RECORD_STATUS_OTHER			0x1f
6520dbacebeSHans Verkuil 
6530dbacebeSHans Verkuil #define CEC_MSG_RECORD_TV_SCREEN			0x0f
6540dbacebeSHans Verkuil 
6550dbacebeSHans Verkuil 
6560dbacebeSHans Verkuil /* Timer Programming Feature */
6570dbacebeSHans Verkuil #define CEC_MSG_CLEAR_ANALOGUE_TIMER			0x33
6580dbacebeSHans Verkuil /* Recording Sequence Operand (recording_seq) */
6590dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_SUNDAY				0x01
6600dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_MONDAY				0x02
6610dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_TUESDAY				0x04
6620dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_WEDNESDAY			0x08
6630dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_THURSDAY				0x10
6640dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_FRIDAY				0x20
665caa7302bSHans Verkuil #define CEC_OP_REC_SEQ_SATURDAY				0x40
6660dbacebeSHans Verkuil #define CEC_OP_REC_SEQ_ONCE_ONLY			0x00
6670dbacebeSHans Verkuil 
6680dbacebeSHans Verkuil #define CEC_MSG_CLEAR_DIGITAL_TIMER			0x99
6690dbacebeSHans Verkuil 
6700dbacebeSHans Verkuil #define CEC_MSG_CLEAR_EXT_TIMER				0xa1
6710dbacebeSHans Verkuil /* External Source Specifier Operand (ext_src_spec) */
6720dbacebeSHans Verkuil #define CEC_OP_EXT_SRC_PLUG				0x04
6730dbacebeSHans Verkuil #define CEC_OP_EXT_SRC_PHYS_ADDR			0x05
6740dbacebeSHans Verkuil 
6750dbacebeSHans Verkuil #define CEC_MSG_SET_ANALOGUE_TIMER			0x34
6760dbacebeSHans Verkuil #define CEC_MSG_SET_DIGITAL_TIMER			0x97
6770dbacebeSHans Verkuil #define CEC_MSG_SET_EXT_TIMER				0xa2
6780dbacebeSHans Verkuil 
6790dbacebeSHans Verkuil #define CEC_MSG_SET_TIMER_PROGRAM_TITLE			0x67
6800dbacebeSHans Verkuil #define CEC_MSG_TIMER_CLEARED_STATUS			0x43
6810dbacebeSHans Verkuil /* Timer Cleared Status Data Operand (timer_cleared_status) */
6820dbacebeSHans Verkuil #define CEC_OP_TIMER_CLR_STAT_RECORDING			0x00
6830dbacebeSHans Verkuil #define CEC_OP_TIMER_CLR_STAT_NO_MATCHING		0x01
6840dbacebeSHans Verkuil #define CEC_OP_TIMER_CLR_STAT_NO_INFO			0x02
6850dbacebeSHans Verkuil #define CEC_OP_TIMER_CLR_STAT_CLEARED			0x80
6860dbacebeSHans Verkuil 
6870dbacebeSHans Verkuil #define CEC_MSG_TIMER_STATUS				0x35
6880dbacebeSHans Verkuil /* Timer Overlap Warning Operand (timer_overlap_warning) */
6890dbacebeSHans Verkuil #define CEC_OP_TIMER_OVERLAP_WARNING_NO_OVERLAP		0
6900dbacebeSHans Verkuil #define CEC_OP_TIMER_OVERLAP_WARNING_OVERLAP		1
6910dbacebeSHans Verkuil /* Media Info Operand (media_info) */
6920dbacebeSHans Verkuil #define CEC_OP_MEDIA_INFO_UNPROT_MEDIA			0
6930dbacebeSHans Verkuil #define CEC_OP_MEDIA_INFO_PROT_MEDIA			1
6940dbacebeSHans Verkuil #define CEC_OP_MEDIA_INFO_NO_MEDIA			2
6950dbacebeSHans Verkuil /* Programmed Indicator Operand (prog_indicator) */
6960dbacebeSHans Verkuil #define CEC_OP_PROG_IND_NOT_PROGRAMMED			0
6970dbacebeSHans Verkuil #define CEC_OP_PROG_IND_PROGRAMMED			1
6980dbacebeSHans Verkuil /* Programmed Info Operand (prog_info) */
6990dbacebeSHans Verkuil #define CEC_OP_PROG_INFO_ENOUGH_SPACE			0x08
7000dbacebeSHans Verkuil #define CEC_OP_PROG_INFO_NOT_ENOUGH_SPACE		0x09
7010dbacebeSHans Verkuil #define CEC_OP_PROG_INFO_MIGHT_NOT_BE_ENOUGH_SPACE	0x0b
7020dbacebeSHans Verkuil #define CEC_OP_PROG_INFO_NONE_AVAILABLE			0x0a
7030dbacebeSHans Verkuil /* Not Programmed Error Info Operand (prog_error) */
7040dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_NO_FREE_TIMER			0x01
7050dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_DATE_OUT_OF_RANGE		0x02
7060dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_REC_SEQ_ERROR			0x03
7070dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_INV_EXT_PLUG			0x04
7080dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_INV_EXT_PHYS_ADDR		0x05
7090dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_CA_UNSUPP			0x06
7100dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_INSUF_CA_ENTITLEMENTS		0x07
7110dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_RESOLUTION_UNSUPP		0x08
7120dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_PARENTAL_LOCK			0x09
7130dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_CLOCK_FAILURE			0x0a
7140dbacebeSHans Verkuil #define CEC_OP_PROG_ERROR_DUPLICATE			0x0e
7150dbacebeSHans Verkuil 
7160dbacebeSHans Verkuil 
7170dbacebeSHans Verkuil /* System Information Feature */
7180dbacebeSHans Verkuil #define CEC_MSG_CEC_VERSION				0x9e
7190dbacebeSHans Verkuil /* CEC Version Operand (cec_version) */
7200dbacebeSHans Verkuil #define CEC_OP_CEC_VERSION_1_3A				4
7210dbacebeSHans Verkuil #define CEC_OP_CEC_VERSION_1_4				5
7220dbacebeSHans Verkuil #define CEC_OP_CEC_VERSION_2_0				6
7230dbacebeSHans Verkuil 
7240dbacebeSHans Verkuil #define CEC_MSG_GET_CEC_VERSION				0x9f
7250dbacebeSHans Verkuil #define CEC_MSG_GIVE_PHYSICAL_ADDR			0x83
7260dbacebeSHans Verkuil #define CEC_MSG_GET_MENU_LANGUAGE			0x91
7270dbacebeSHans Verkuil #define CEC_MSG_REPORT_PHYSICAL_ADDR			0x84
7280dbacebeSHans Verkuil /* Primary Device Type Operand (prim_devtype) */
7290dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_TV				0
7300dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_RECORD			1
7310dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_TUNER			3
7320dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_PLAYBACK			4
7330dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM			5
7340dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_SWITCH			6
7350dbacebeSHans Verkuil #define CEC_OP_PRIM_DEVTYPE_PROCESSOR			7
7360dbacebeSHans Verkuil 
7370dbacebeSHans Verkuil #define CEC_MSG_SET_MENU_LANGUAGE			0x32
7380dbacebeSHans Verkuil #define CEC_MSG_REPORT_FEATURES				0xa6	/* HDMI 2.0 */
7390dbacebeSHans Verkuil /* All Device Types Operand (all_device_types) */
7400dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_TV				0x80
7410dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_RECORD			0x40
7420dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_TUNER			0x20
7430dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_PLAYBACK			0x10
7440dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM			0x08
7450dbacebeSHans Verkuil #define CEC_OP_ALL_DEVTYPE_SWITCH			0x04
7460dbacebeSHans Verkuil /*
7470dbacebeSHans Verkuil  * And if you wondering what happened to PROCESSOR devices: those should
7480dbacebeSHans Verkuil  * be mapped to a SWITCH.
7490dbacebeSHans Verkuil  */
7500dbacebeSHans Verkuil 
7510dbacebeSHans Verkuil /* Valid for RC Profile and Device Feature operands */
7520dbacebeSHans Verkuil #define CEC_OP_FEAT_EXT					0x80	/* Extension bit */
7530dbacebeSHans Verkuil /* RC Profile Operand (rc_profile) */
7540dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_TV_PROFILE_NONE			0x00
7550dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_TV_PROFILE_1			0x02
7560dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_TV_PROFILE_2			0x06
7570dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_TV_PROFILE_3			0x0a
7580dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_TV_PROFILE_4			0x0e
7590dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_SRC_HAS_DEV_ROOT_MENU		0x50
7600dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_SRC_HAS_DEV_SETUP_MENU		0x48
7610dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_SRC_HAS_CONTENTS_MENU		0x44
7620dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_TOP_MENU		0x42
7630dbacebeSHans Verkuil #define CEC_OP_FEAT_RC_SRC_HAS_MEDIA_CONTEXT_MENU	0x41
7640dbacebeSHans Verkuil /* Device Feature Operand (dev_features) */
7650dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_HAS_RECORD_TV_SCREEN		0x40
7660dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_HAS_SET_OSD_STRING		0x20
7670dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_HAS_DECK_CONTROL		0x10
7680dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE		0x08
7690dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX			0x04
7700dbacebeSHans Verkuil #define CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX		0x02
771*479747caSHans Verkuil #define CEC_OP_FEAT_DEV_HAS_SET_AUDIO_VOLUME_LEVEL	0x01
7720dbacebeSHans Verkuil 
7730dbacebeSHans Verkuil #define CEC_MSG_GIVE_FEATURES				0xa5	/* HDMI 2.0 */
7740dbacebeSHans Verkuil 
7750dbacebeSHans Verkuil 
7760dbacebeSHans Verkuil /* Deck Control Feature */
7770dbacebeSHans Verkuil #define CEC_MSG_DECK_CONTROL				0x42
7780dbacebeSHans Verkuil /* Deck Control Mode Operand (deck_control_mode) */
7790dbacebeSHans Verkuil #define CEC_OP_DECK_CTL_MODE_SKIP_FWD			1
7800dbacebeSHans Verkuil #define CEC_OP_DECK_CTL_MODE_SKIP_REV			2
7810dbacebeSHans Verkuil #define CEC_OP_DECK_CTL_MODE_STOP			3
7820dbacebeSHans Verkuil #define CEC_OP_DECK_CTL_MODE_EJECT			4
7830dbacebeSHans Verkuil 
7840dbacebeSHans Verkuil #define CEC_MSG_DECK_STATUS				0x1b
7850dbacebeSHans Verkuil /* Deck Info Operand (deck_info) */
7860dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_PLAY				0x11
7870dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_RECORD				0x12
7880dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_PLAY_REV			0x13
7890dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_STILL				0x14
7900dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_SLOW				0x15
7910dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_SLOW_REV			0x16
7920dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_FAST_FWD			0x17
7930dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_FAST_REV			0x18
7940dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_NO_MEDIA			0x19
7950dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_STOP				0x1a
7960dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_SKIP_FWD			0x1b
7970dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_SKIP_REV			0x1c
7980dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_INDEX_SEARCH_FWD		0x1d
7990dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_INDEX_SEARCH_REV		0x1e
8000dbacebeSHans Verkuil #define CEC_OP_DECK_INFO_OTHER				0x1f
8010dbacebeSHans Verkuil 
8020dbacebeSHans Verkuil #define CEC_MSG_GIVE_DECK_STATUS			0x1a
8030dbacebeSHans Verkuil /* Status Request Operand (status_req) */
8040dbacebeSHans Verkuil #define CEC_OP_STATUS_REQ_ON				1
8050dbacebeSHans Verkuil #define CEC_OP_STATUS_REQ_OFF				2
8060dbacebeSHans Verkuil #define CEC_OP_STATUS_REQ_ONCE				3
8070dbacebeSHans Verkuil 
8080dbacebeSHans Verkuil #define CEC_MSG_PLAY					0x41
8090dbacebeSHans Verkuil /* Play Mode Operand (play_mode) */
8100dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FWD			0x24
8110dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_REV			0x20
8120dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_STILL			0x25
8130dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MIN		0x05
8140dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MED		0x06
8150dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_FWD_MAX		0x07
8160dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MIN		0x09
8170dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MED		0x0a
8180dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_FAST_REV_MAX		0x0b
8190dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MIN		0x15
8200dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MED		0x16
8210dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_FWD_MAX		0x17
8220dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MIN		0x19
8230dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MED		0x1a
8240dbacebeSHans Verkuil #define CEC_OP_PLAY_MODE_PLAY_SLOW_REV_MAX		0x1b
8250dbacebeSHans Verkuil 
8260dbacebeSHans Verkuil 
8270dbacebeSHans Verkuil /* Tuner Control Feature */
8280dbacebeSHans Verkuil #define CEC_MSG_GIVE_TUNER_DEVICE_STATUS		0x08
8290dbacebeSHans Verkuil #define CEC_MSG_SELECT_ANALOGUE_SERVICE			0x92
8300dbacebeSHans Verkuil #define CEC_MSG_SELECT_DIGITAL_SERVICE			0x93
8310dbacebeSHans Verkuil #define CEC_MSG_TUNER_DEVICE_STATUS			0x07
8320dbacebeSHans Verkuil /* Recording Flag Operand (rec_flag) */
833806e0cdfSHans Verkuil #define CEC_OP_REC_FLAG_NOT_USED			0
834806e0cdfSHans Verkuil #define CEC_OP_REC_FLAG_USED				1
8350dbacebeSHans Verkuil /* Tuner Display Info Operand (tuner_display_info) */
8360dbacebeSHans Verkuil #define CEC_OP_TUNER_DISPLAY_INFO_DIGITAL		0
8370dbacebeSHans Verkuil #define CEC_OP_TUNER_DISPLAY_INFO_NONE			1
8380dbacebeSHans Verkuil #define CEC_OP_TUNER_DISPLAY_INFO_ANALOGUE		2
8390dbacebeSHans Verkuil 
8400dbacebeSHans Verkuil #define CEC_MSG_TUNER_STEP_DECREMENT			0x06
8410dbacebeSHans Verkuil #define CEC_MSG_TUNER_STEP_INCREMENT			0x05
8420dbacebeSHans Verkuil 
8430dbacebeSHans Verkuil 
8440dbacebeSHans Verkuil /* Vendor Specific Commands Feature */
8450dbacebeSHans Verkuil 
8460dbacebeSHans Verkuil /*
8470dbacebeSHans Verkuil  * Has also:
8480dbacebeSHans Verkuil  *	CEC_MSG_CEC_VERSION
8490dbacebeSHans Verkuil  *	CEC_MSG_GET_CEC_VERSION
8500dbacebeSHans Verkuil  */
8510dbacebeSHans Verkuil #define CEC_MSG_DEVICE_VENDOR_ID			0x87
8520dbacebeSHans Verkuil #define CEC_MSG_GIVE_DEVICE_VENDOR_ID			0x8c
8530dbacebeSHans Verkuil #define CEC_MSG_VENDOR_COMMAND				0x89
8540dbacebeSHans Verkuil #define CEC_MSG_VENDOR_COMMAND_WITH_ID			0xa0
8550dbacebeSHans Verkuil #define CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN		0x8a
8560dbacebeSHans Verkuil #define CEC_MSG_VENDOR_REMOTE_BUTTON_UP			0x8b
8570dbacebeSHans Verkuil 
8580dbacebeSHans Verkuil 
8590dbacebeSHans Verkuil /* OSD Display Feature */
8600dbacebeSHans Verkuil #define CEC_MSG_SET_OSD_STRING				0x64
8610dbacebeSHans Verkuil /* Display Control Operand (disp_ctl) */
8620dbacebeSHans Verkuil #define CEC_OP_DISP_CTL_DEFAULT				0x00
8630dbacebeSHans Verkuil #define CEC_OP_DISP_CTL_UNTIL_CLEARED			0x40
8640dbacebeSHans Verkuil #define CEC_OP_DISP_CTL_CLEAR				0x80
8650dbacebeSHans Verkuil 
8660dbacebeSHans Verkuil 
8670dbacebeSHans Verkuil /* Device OSD Transfer Feature */
8680dbacebeSHans Verkuil #define CEC_MSG_GIVE_OSD_NAME				0x46
8690dbacebeSHans Verkuil #define CEC_MSG_SET_OSD_NAME				0x47
8700dbacebeSHans Verkuil 
8710dbacebeSHans Verkuil 
8720dbacebeSHans Verkuil /* Device Menu Control Feature */
8730dbacebeSHans Verkuil #define CEC_MSG_MENU_REQUEST				0x8d
8740dbacebeSHans Verkuil /* Menu Request Type Operand (menu_req) */
8750dbacebeSHans Verkuil #define CEC_OP_MENU_REQUEST_ACTIVATE			0x00
8760dbacebeSHans Verkuil #define CEC_OP_MENU_REQUEST_DEACTIVATE			0x01
8770dbacebeSHans Verkuil #define CEC_OP_MENU_REQUEST_QUERY			0x02
8780dbacebeSHans Verkuil 
8790dbacebeSHans Verkuil #define CEC_MSG_MENU_STATUS				0x8e
8800dbacebeSHans Verkuil /* Menu State Operand (menu_state) */
8810dbacebeSHans Verkuil #define CEC_OP_MENU_STATE_ACTIVATED			0x00
8820dbacebeSHans Verkuil #define CEC_OP_MENU_STATE_DEACTIVATED			0x01
8830dbacebeSHans Verkuil 
8840dbacebeSHans Verkuil #define CEC_MSG_USER_CONTROL_PRESSED			0x44
885eeabc18bSHans Verkuil /* UI Command Operand (ui_cmd) */
886eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT				0x00
887eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_UP				0x01
888eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DOWN				0x02
889eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_LEFT				0x03
890eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RIGHT				0x04
891eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RIGHT_UP				0x05
892eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RIGHT_DOWN			0x06
893eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_LEFT_UP				0x07
894eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_LEFT_DOWN				0x08
895eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DEVICE_ROOT_MENU			0x09
896eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DEVICE_SETUP_MENU			0x0a
897eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_CONTENTS_MENU			0x0b
898eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_FAVORITE_MENU			0x0c
899eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_BACK				0x0d
900eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_MEDIA_TOP_MENU			0x10
901eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_MEDIA_CONTEXT_SENSITIVE_MENU	0x11
902eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_ENTRY_MODE			0x1d
903eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_11				0x1e
904eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_12				0x1f
905eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_0_OR_NUMBER_10		0x20
906eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_1				0x21
907eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_2				0x22
908eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_3				0x23
909eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_4				0x24
910eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_5				0x25
911eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_6				0x26
912eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_7				0x27
913eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_8				0x28
914eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NUMBER_9				0x29
915eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DOT				0x2a
916eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_ENTER				0x2b
917eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_CLEAR				0x2c
918eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_NEXT_FAVORITE			0x2f
919eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_CHANNEL_UP			0x30
920eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_CHANNEL_DOWN			0x31
921eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PREVIOUS_CHANNEL			0x32
922eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SOUND_SELECT			0x33
923eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_INPUT_SELECT			0x34
924eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DISPLAY_INFORMATION		0x35
925eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_HELP				0x36
926eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAGE_UP				0x37
927eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAGE_DOWN				0x38
928eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_POWER				0x40
929eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_VOLUME_UP				0x41
930eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_VOLUME_DOWN			0x42
931eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_MUTE				0x43
932eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PLAY				0x44
933eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_STOP				0x45
934eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAUSE				0x46
935eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RECORD				0x47
936eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_REWIND				0x48
937eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_FAST_FORWARD			0x49
938eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_EJECT				0x4a
939eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SKIP_FORWARD			0x4b
940eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SKIP_BACKWARD			0x4c
941eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_STOP_RECORD			0x4d
942eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAUSE_RECORD			0x4e
943eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_ANGLE				0x50
944eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SUB_PICTURE			0x51
945eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_VIDEO_ON_DEMAND			0x52
946eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_ELECTRONIC_PROGRAM_GUIDE		0x53
947eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_TIMER_PROGRAMMING			0x54
948eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_INITIAL_CONFIGURATION		0x55
949eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT_BROADCAST_TYPE		0x56
950eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT_SOUND_PRESENTATION		0x57
951eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_AUDIO_DESCRIPTION			0x58
952eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_INTERNET				0x59
953eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_3D_MODE				0x5a
954eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PLAY_FUNCTION			0x60
955eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAUSE_PLAY_FUNCTION		0x61
956eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RECORD_FUNCTION			0x62
957eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_PAUSE_RECORD_FUNCTION		0x63
958eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_STOP_FUNCTION			0x64
959eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_MUTE_FUNCTION			0x65
960eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_RESTORE_VOLUME_FUNCTION		0x66
961eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_TUNE_FUNCTION			0x67
962eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT_MEDIA_FUNCTION		0x68
963eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT_AV_INPUT_FUNCTION		0x69
964eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_SELECT_AUDIO_INPUT_FUNCTION	0x6a
965eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_POWER_TOGGLE_FUNCTION		0x6b
966eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_POWER_OFF_FUNCTION		0x6c
967eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_POWER_ON_FUNCTION			0x6d
968eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_F1_BLUE				0x71
969eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_F2_RED				0x72
970eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_F3_GREEN				0x73
971eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_F4_YELLOW				0x74
972eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_F5				0x75
973eeabc18bSHans Verkuil #define CEC_OP_UI_CMD_DATA				0x76
9740dbacebeSHans Verkuil /* UI Broadcast Type Operand (ui_bcast_type) */
9750dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_TOGGLE_ALL			0x00
9760dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_TOGGLE_DIG_ANA		0x01
9770dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_ANALOGUE			0x10
9780dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_T			0x20
9790dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_CABLE		0x30
9800dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_ANALOGUE_SAT		0x40
9810dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL			0x50
9820dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL_T			0x60
9830dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL_CABLE		0x70
9840dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL_SAT		0x80
9850dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT		0x90
9860dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_DIGITAL_COM_SAT2		0x91
9870dbacebeSHans Verkuil #define CEC_OP_UI_BCAST_TYPE_IP				0xa0
9880dbacebeSHans Verkuil /* UI Sound Presentation Control Operand (ui_snd_pres_ctl) */
9890dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_DUAL_MONO		0x10
9900dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_KARAOKE			0x20
9910dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_DOWNMIX			0x80
9920dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_REVERB			0x90
9930dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_EQUALIZER		0xa0
9940dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_BASS_UP			0xb1
9950dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_BASS_NEUTRAL		0xb2
9960dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_BASS_DOWN		0xb3
9970dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_TREBLE_UP		0xc1
9980dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_TREBLE_NEUTRAL		0xc2
9990dbacebeSHans Verkuil #define CEC_OP_UI_SND_PRES_CTL_TREBLE_DOWN		0xc3
10000dbacebeSHans Verkuil 
10010dbacebeSHans Verkuil #define CEC_MSG_USER_CONTROL_RELEASED			0x45
10020dbacebeSHans Verkuil 
10030dbacebeSHans Verkuil 
10040dbacebeSHans Verkuil /* Remote Control Passthrough Feature */
10050dbacebeSHans Verkuil 
10060dbacebeSHans Verkuil /*
10070dbacebeSHans Verkuil  * Has also:
10080dbacebeSHans Verkuil  *	CEC_MSG_USER_CONTROL_PRESSED
10090dbacebeSHans Verkuil  *	CEC_MSG_USER_CONTROL_RELEASED
10100dbacebeSHans Verkuil  */
10110dbacebeSHans Verkuil 
10120dbacebeSHans Verkuil 
10130dbacebeSHans Verkuil /* Power Status Feature */
10140dbacebeSHans Verkuil #define CEC_MSG_GIVE_DEVICE_POWER_STATUS		0x8f
10150dbacebeSHans Verkuil #define CEC_MSG_REPORT_POWER_STATUS			0x90
10160dbacebeSHans Verkuil /* Power Status Operand (pwr_state) */
10170dbacebeSHans Verkuil #define CEC_OP_POWER_STATUS_ON				0
10180dbacebeSHans Verkuil #define CEC_OP_POWER_STATUS_STANDBY			1
10190dbacebeSHans Verkuil #define CEC_OP_POWER_STATUS_TO_ON			2
10200dbacebeSHans Verkuil #define CEC_OP_POWER_STATUS_TO_STANDBY			3
10210dbacebeSHans Verkuil 
10220dbacebeSHans Verkuil 
10230dbacebeSHans Verkuil /* General Protocol Messages */
10240dbacebeSHans Verkuil #define CEC_MSG_FEATURE_ABORT				0x00
10250dbacebeSHans Verkuil /* Abort Reason Operand (reason) */
10260dbacebeSHans Verkuil #define CEC_OP_ABORT_UNRECOGNIZED_OP			0
10270dbacebeSHans Verkuil #define CEC_OP_ABORT_INCORRECT_MODE			1
10280dbacebeSHans Verkuil #define CEC_OP_ABORT_NO_SOURCE				2
10290dbacebeSHans Verkuil #define CEC_OP_ABORT_INVALID_OP				3
10300dbacebeSHans Verkuil #define CEC_OP_ABORT_REFUSED				4
10310dbacebeSHans Verkuil #define CEC_OP_ABORT_UNDETERMINED			5
10320dbacebeSHans Verkuil 
10330dbacebeSHans Verkuil #define CEC_MSG_ABORT					0xff
10340dbacebeSHans Verkuil 
10350dbacebeSHans Verkuil 
10360dbacebeSHans Verkuil /* System Audio Control Feature */
10370dbacebeSHans Verkuil 
10380dbacebeSHans Verkuil /*
10390dbacebeSHans Verkuil  * Has also:
10400dbacebeSHans Verkuil  *	CEC_MSG_USER_CONTROL_PRESSED
10410dbacebeSHans Verkuil  *	CEC_MSG_USER_CONTROL_RELEASED
10420dbacebeSHans Verkuil  */
10430dbacebeSHans Verkuil #define CEC_MSG_GIVE_AUDIO_STATUS			0x71
10440dbacebeSHans Verkuil #define CEC_MSG_GIVE_SYSTEM_AUDIO_MODE_STATUS		0x7d
10450dbacebeSHans Verkuil #define CEC_MSG_REPORT_AUDIO_STATUS			0x7a
10460dbacebeSHans Verkuil /* Audio Mute Status Operand (aud_mute_status) */
10470dbacebeSHans Verkuil #define CEC_OP_AUD_MUTE_STATUS_OFF			0
10480dbacebeSHans Verkuil #define CEC_OP_AUD_MUTE_STATUS_ON			1
10490dbacebeSHans Verkuil 
10500dbacebeSHans Verkuil #define CEC_MSG_REPORT_SHORT_AUDIO_DESCRIPTOR		0xa3
10510dbacebeSHans Verkuil #define CEC_MSG_REQUEST_SHORT_AUDIO_DESCRIPTOR		0xa4
10520dbacebeSHans Verkuil #define CEC_MSG_SET_SYSTEM_AUDIO_MODE			0x72
10530dbacebeSHans Verkuil /* System Audio Status Operand (sys_aud_status) */
10540dbacebeSHans Verkuil #define CEC_OP_SYS_AUD_STATUS_OFF			0
10550dbacebeSHans Verkuil #define CEC_OP_SYS_AUD_STATUS_ON			1
10560dbacebeSHans Verkuil 
10570dbacebeSHans Verkuil #define CEC_MSG_SYSTEM_AUDIO_MODE_REQUEST		0x70
10580dbacebeSHans Verkuil #define CEC_MSG_SYSTEM_AUDIO_MODE_STATUS		0x7e
10590dbacebeSHans Verkuil /* Audio Format ID Operand (audio_format_id) */
10600dbacebeSHans Verkuil #define CEC_OP_AUD_FMT_ID_CEA861			0
10610dbacebeSHans Verkuil #define CEC_OP_AUD_FMT_ID_CEA861_CXT			1
10620dbacebeSHans Verkuil 
1063*479747caSHans Verkuil #define CEC_MSG_SET_AUDIO_VOLUME_LEVEL			0x73
10640dbacebeSHans Verkuil 
10650dbacebeSHans Verkuil /* Audio Rate Control Feature */
10660dbacebeSHans Verkuil #define CEC_MSG_SET_AUDIO_RATE				0x9a
10670dbacebeSHans Verkuil /* Audio Rate Operand (audio_rate) */
10680dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_OFF				0
10690dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_WIDE_STD			1
10700dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_WIDE_FAST			2
10710dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_WIDE_SLOW			3
10720dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_NARROW_STD			4
10730dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_NARROW_FAST			5
10740dbacebeSHans Verkuil #define CEC_OP_AUD_RATE_NARROW_SLOW			6
10750dbacebeSHans Verkuil 
10760dbacebeSHans Verkuil 
10770dbacebeSHans Verkuil /* Audio Return Channel Control Feature */
10780dbacebeSHans Verkuil #define CEC_MSG_INITIATE_ARC				0xc0
10790dbacebeSHans Verkuil #define CEC_MSG_REPORT_ARC_INITIATED			0xc1
10800dbacebeSHans Verkuil #define CEC_MSG_REPORT_ARC_TERMINATED			0xc2
10810dbacebeSHans Verkuil #define CEC_MSG_REQUEST_ARC_INITIATION			0xc3
10820dbacebeSHans Verkuil #define CEC_MSG_REQUEST_ARC_TERMINATION			0xc4
10830dbacebeSHans Verkuil #define CEC_MSG_TERMINATE_ARC				0xc5
10840dbacebeSHans Verkuil 
10850dbacebeSHans Verkuil 
10860dbacebeSHans Verkuil /* Dynamic Audio Lipsync Feature */
10870dbacebeSHans Verkuil /* Only for CEC 2.0 and up */
10880dbacebeSHans Verkuil #define CEC_MSG_REQUEST_CURRENT_LATENCY			0xa7
10890dbacebeSHans Verkuil #define CEC_MSG_REPORT_CURRENT_LATENCY			0xa8
10900dbacebeSHans Verkuil /* Low Latency Mode Operand (low_latency_mode) */
10910dbacebeSHans Verkuil #define CEC_OP_LOW_LATENCY_MODE_OFF			0
10920dbacebeSHans Verkuil #define CEC_OP_LOW_LATENCY_MODE_ON			1
10930dbacebeSHans Verkuil /* Audio Output Compensated Operand (audio_out_compensated) */
10940dbacebeSHans Verkuil #define CEC_OP_AUD_OUT_COMPENSATED_NA			0
10950dbacebeSHans Verkuil #define CEC_OP_AUD_OUT_COMPENSATED_DELAY		1
10960dbacebeSHans Verkuil #define CEC_OP_AUD_OUT_COMPENSATED_NO_DELAY		2
10970dbacebeSHans Verkuil #define CEC_OP_AUD_OUT_COMPENSATED_PARTIAL_DELAY	3
10980dbacebeSHans Verkuil 
10990dbacebeSHans Verkuil 
11000dbacebeSHans Verkuil /* Capability Discovery and Control Feature */
11010dbacebeSHans Verkuil #define CEC_MSG_CDC_MESSAGE				0xf8
11020dbacebeSHans Verkuil /* Ethernet-over-HDMI: nobody ever does this... */
11030dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_INQUIRE_STATE			0x00
11040dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_REPORT_STATE			0x01
11050dbacebeSHans Verkuil /* HEC Functionality State Operand (hec_func_state) */
11060dbacebeSHans Verkuil #define CEC_OP_HEC_FUNC_STATE_NOT_SUPPORTED		0
11070dbacebeSHans Verkuil #define CEC_OP_HEC_FUNC_STATE_INACTIVE			1
11080dbacebeSHans Verkuil #define CEC_OP_HEC_FUNC_STATE_ACTIVE			2
11090dbacebeSHans Verkuil #define CEC_OP_HEC_FUNC_STATE_ACTIVATION_FIELD		3
11100dbacebeSHans Verkuil /* Host Functionality State Operand (host_func_state) */
11110dbacebeSHans Verkuil #define CEC_OP_HOST_FUNC_STATE_NOT_SUPPORTED		0
11120dbacebeSHans Verkuil #define CEC_OP_HOST_FUNC_STATE_INACTIVE			1
11130dbacebeSHans Verkuil #define CEC_OP_HOST_FUNC_STATE_ACTIVE			2
11140dbacebeSHans Verkuil /* ENC Functionality State Operand (enc_func_state) */
11150dbacebeSHans Verkuil #define CEC_OP_ENC_FUNC_STATE_EXT_CON_NOT_SUPPORTED	0
11160dbacebeSHans Verkuil #define CEC_OP_ENC_FUNC_STATE_EXT_CON_INACTIVE		1
11170dbacebeSHans Verkuil #define CEC_OP_ENC_FUNC_STATE_EXT_CON_ACTIVE		2
11180dbacebeSHans Verkuil /* CDC Error Code Operand (cdc_errcode) */
11190dbacebeSHans Verkuil #define CEC_OP_CDC_ERROR_CODE_NONE			0
11200dbacebeSHans Verkuil #define CEC_OP_CDC_ERROR_CODE_CAP_UNSUPPORTED		1
11210dbacebeSHans Verkuil #define CEC_OP_CDC_ERROR_CODE_WRONG_STATE		2
11220dbacebeSHans Verkuil #define CEC_OP_CDC_ERROR_CODE_OTHER			3
11230dbacebeSHans Verkuil /* HEC Support Operand (hec_support) */
11240dbacebeSHans Verkuil #define CEC_OP_HEC_SUPPORT_NO				0
11250dbacebeSHans Verkuil #define CEC_OP_HEC_SUPPORT_YES				1
11260dbacebeSHans Verkuil /* HEC Activation Operand (hec_activation) */
11270dbacebeSHans Verkuil #define CEC_OP_HEC_ACTIVATION_ON			0
11280dbacebeSHans Verkuil #define CEC_OP_HEC_ACTIVATION_OFF			1
11290dbacebeSHans Verkuil 
11300dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_SET_STATE_ADJACENT		0x02
11310dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_SET_STATE			0x03
11320dbacebeSHans Verkuil /* HEC Set State Operand (hec_set_state) */
11330dbacebeSHans Verkuil #define CEC_OP_HEC_SET_STATE_DEACTIVATE			0
11340dbacebeSHans Verkuil #define CEC_OP_HEC_SET_STATE_ACTIVATE			1
11350dbacebeSHans Verkuil 
11360dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_REQUEST_DEACTIVATION		0x04
11370dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_NOTIFY_ALIVE			0x05
11380dbacebeSHans Verkuil #define CEC_MSG_CDC_HEC_DISCOVER			0x06
11390dbacebeSHans Verkuil /* Hotplug Detect messages */
11400dbacebeSHans Verkuil #define CEC_MSG_CDC_HPD_SET_STATE			0x10
11410dbacebeSHans Verkuil /* HPD State Operand (hpd_state) */
11420dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_CP_EDID_DISABLE		0
11430dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_CP_EDID_ENABLE			1
11440dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_CP_EDID_DISABLE_ENABLE		2
11450dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_EDID_DISABLE			3
11460dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_EDID_ENABLE			4
11470dbacebeSHans Verkuil #define CEC_OP_HPD_STATE_EDID_DISABLE_ENABLE		5
11480dbacebeSHans Verkuil #define CEC_MSG_CDC_HPD_REPORT_STATE			0x11
11490dbacebeSHans Verkuil /* HPD Error Code Operand (hpd_error) */
11500dbacebeSHans Verkuil #define CEC_OP_HPD_ERROR_NONE				0
11510dbacebeSHans Verkuil #define CEC_OP_HPD_ERROR_INITIATOR_NOT_CAPABLE		1
11520dbacebeSHans Verkuil #define CEC_OP_HPD_ERROR_INITIATOR_WRONG_STATE		2
11530dbacebeSHans Verkuil #define CEC_OP_HPD_ERROR_OTHER				3
11540dbacebeSHans Verkuil #define CEC_OP_HPD_ERROR_NONE_NO_VIDEO			4
11550dbacebeSHans Verkuil 
11560dbacebeSHans Verkuil /* End of Messages */
11570dbacebeSHans Verkuil 
11580dbacebeSHans Verkuil /* Helper functions to identify the 'special' CEC devices */
11590dbacebeSHans Verkuil 
cec_is_2nd_tv(const struct cec_log_addrs * las)11603145c754SHans Verkuil static inline int cec_is_2nd_tv(const struct cec_log_addrs *las)
11610dbacebeSHans Verkuil {
11620dbacebeSHans Verkuil 	/*
11630dbacebeSHans Verkuil 	 * It is a second TV if the logical address is 14 or 15 and the
11640dbacebeSHans Verkuil 	 * primary device type is a TV.
11650dbacebeSHans Verkuil 	 */
11660dbacebeSHans Verkuil 	return las->num_log_addrs &&
11670dbacebeSHans Verkuil 	       las->log_addr[0] >= CEC_LOG_ADDR_SPECIFIC &&
11680dbacebeSHans Verkuil 	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_TV;
11690dbacebeSHans Verkuil }
11700dbacebeSHans Verkuil 
cec_is_processor(const struct cec_log_addrs * las)11713145c754SHans Verkuil static inline int cec_is_processor(const struct cec_log_addrs *las)
11720dbacebeSHans Verkuil {
11730dbacebeSHans Verkuil 	/*
11740dbacebeSHans Verkuil 	 * It is a processor if the logical address is 12-15 and the
11750dbacebeSHans Verkuil 	 * primary device type is a Processor.
11760dbacebeSHans Verkuil 	 */
11770dbacebeSHans Verkuil 	return las->num_log_addrs &&
11780dbacebeSHans Verkuil 	       las->log_addr[0] >= CEC_LOG_ADDR_BACKUP_1 &&
11790dbacebeSHans Verkuil 	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_PROCESSOR;
11800dbacebeSHans Verkuil }
11810dbacebeSHans Verkuil 
cec_is_switch(const struct cec_log_addrs * las)11823145c754SHans Verkuil static inline int cec_is_switch(const struct cec_log_addrs *las)
11830dbacebeSHans Verkuil {
11840dbacebeSHans Verkuil 	/*
11850dbacebeSHans Verkuil 	 * It is a switch if the logical address is 15 and the
11860dbacebeSHans Verkuil 	 * primary device type is a Switch and the CDC-Only flag is not set.
11870dbacebeSHans Verkuil 	 */
11880dbacebeSHans Verkuil 	return las->num_log_addrs == 1 &&
11890dbacebeSHans Verkuil 	       las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED &&
11900dbacebeSHans Verkuil 	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH &&
11910dbacebeSHans Verkuil 	       !(las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY);
11920dbacebeSHans Verkuil }
11930dbacebeSHans Verkuil 
cec_is_cdc_only(const struct cec_log_addrs * las)11943145c754SHans Verkuil static inline int cec_is_cdc_only(const struct cec_log_addrs *las)
11950dbacebeSHans Verkuil {
11960dbacebeSHans Verkuil 	/*
11970dbacebeSHans Verkuil 	 * It is a CDC-only device if the logical address is 15 and the
11980dbacebeSHans Verkuil 	 * primary device type is a Switch and the CDC-Only flag is set.
11990dbacebeSHans Verkuil 	 */
12000dbacebeSHans Verkuil 	return las->num_log_addrs == 1 &&
12010dbacebeSHans Verkuil 	       las->log_addr[0] == CEC_LOG_ADDR_UNREGISTERED &&
12020dbacebeSHans Verkuil 	       las->primary_device_type[0] == CEC_OP_PRIM_DEVTYPE_SWITCH &&
12030dbacebeSHans Verkuil 	       (las->flags & CEC_LOG_ADDRS_FL_CDC_ONLY);
12040dbacebeSHans Verkuil }
12050dbacebeSHans Verkuil 
12060dbacebeSHans Verkuil #endif
1207