xref: /linux/drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * Copyright 2021-2024 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5  */
6 
7 #ifndef _CEC_SPLITTER_H_
8 #define _CEC_SPLITTER_H_
9 
10 struct cec_splitter;
11 
12 #define STATE_CHANGE_MAX_REPEATS 2
13 
14 struct cec_splitter_port {
15 	struct cec_splitter *splitter;
16 	struct cec_adapter *adap;
17 	unsigned int port;
18 	bool is_active_source;
19 	bool found_sink;
20 	ktime_t lost_sink_ts;
21 	u32 out_request_current_latency_seq;
22 	ktime_t out_request_current_latency_ts;
23 	u8 video_latency;
24 	u32 out_give_device_power_status_seq;
25 	ktime_t out_give_device_power_status_ts;
26 	u8 power_status;
27 };
28 
29 struct cec_splitter {
30 	struct device *dev;
31 	unsigned int num_out_ports;
32 	struct cec_splitter_port **ports;
33 
34 	/* High-level splitter state */
35 	u8 request_current_latency_dest;
36 	u8 give_device_power_status_dest;
37 	bool is_standby;
38 };
39 
40 void cec_splitter_unconfigured_output(struct cec_splitter_port *port);
41 void cec_splitter_configured_output(struct cec_splitter_port *port);
42 int cec_splitter_received_input(struct cec_splitter_port *port, struct cec_msg *msg);
43 int cec_splitter_received_output(struct cec_splitter_port *port, struct cec_msg *msg,
44 				 struct cec_adapter *input_adap);
45 void cec_splitter_nb_transmit_canceled_output(struct cec_splitter_port *port,
46 					      const struct cec_msg *msg,
47 					      struct cec_adapter *input_adap);
48 bool cec_splitter_poll(struct cec_splitter *splitter,
49 		       struct cec_adapter *input_adap, bool debug);
50 
51 #endif
52