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