drm/vc4: Remove BOs seqnos
[drm/drm-misc.git] / drivers / media / cec / usb / extron-da-hd-4k-plus / extron-da-hd-4k-plus.h
blobb79f1253ab5db75e353722b65ec9c293e97ab394
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /*
4 * Copyright 2021-2024 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 */
7 #ifndef _EXTRON_DA_HD_4K_PLUS_H_
8 #define _EXTRON_DA_HD_4K_PLUS_H_
10 #include <linux/kthread.h>
11 #include <linux/serio.h>
12 #include <linux/workqueue.h>
13 #include <media/cec.h>
14 #include <media/v4l2-ctrls.h>
15 #include <media/v4l2-dev.h>
16 #include <media/v4l2-device.h>
17 #include <media/v4l2-dv-timings.h>
18 #include <media/v4l2-event.h>
19 #include <media/v4l2-fh.h>
20 #include <media/v4l2-ioctl.h>
22 #include "cec-splitter.h"
24 #define DATA_SIZE 256
26 #define PING_PERIOD (15 * HZ)
28 #define NUM_MSGS CEC_MAX_MSG_RX_QUEUE_SZ
30 #define MAX_PORTS (1 + 6)
32 #define MAX_EDID_BLOCKS 2
34 struct extron;
36 struct extron_port {
37 struct cec_splitter_port port;
38 struct device *dev;
39 struct cec_adapter *adap;
40 struct video_device vdev;
41 struct v4l2_ctrl_handler hdl;
42 struct v4l2_ctrl *ctrl_rx_power_present;
43 struct v4l2_ctrl *ctrl_tx_hotplug;
44 struct v4l2_ctrl *ctrl_tx_edid_present;
45 bool is_input;
46 char direction;
47 char name[26];
48 unsigned char edid[MAX_EDID_BLOCKS * 128];
49 unsigned char edid_tmp[MAX_EDID_BLOCKS * 128];
50 unsigned int edid_blocks;
51 bool read_edid;
52 struct extron *extron;
53 struct work_struct irq_work;
54 struct completion cmd_done;
55 const char *response;
56 unsigned int cmd_error;
57 struct cec_msg rx_msg[NUM_MSGS];
58 unsigned int rx_msg_cur_idx, rx_msg_num;
59 /* protect rx_msg_cur_idx and rx_msg_num */
60 spinlock_t msg_lock;
61 u32 tx_done_status;
62 bool update_phys_addr;
63 u16 phys_addr;
64 bool cec_was_registered;
65 bool disconnected;
66 bool update_has_signal;
67 bool has_signal;
68 bool update_has_edid;
69 bool has_edid;
70 bool has_4kp30;
71 bool has_4kp60;
72 bool has_qy;
73 bool has_qs;
74 u8 est_i, est_ii;
76 /* locks access to the video_device */
77 struct mutex video_lock;
80 struct extron {
81 struct cec_splitter splitter;
82 struct device *dev;
83 struct serio *serio;
84 /* locks access to serio */
85 struct mutex serio_lock;
86 unsigned int num_ports;
87 unsigned int num_in_ports;
88 unsigned int num_out_ports;
89 char unit_name[32];
90 char unit_type[64];
91 char unit_fw_version[32];
92 char unit_cec_engine_version[32];
93 struct extron_port *ports[MAX_PORTS];
94 struct cec_splitter_port *splitter_ports[MAX_PORTS];
95 struct v4l2_device v4l2_dev;
96 bool hpd_never_low;
97 struct task_struct *kthread_setup;
98 struct delayed_work work_update_edid;
100 /* serializes EDID reading */
101 struct mutex edid_lock;
102 unsigned int edid_bytes_read;
103 struct extron_port *edid_port;
104 struct completion edid_completion;
105 bool edid_reading;
106 bool is_ready;
108 struct completion cmd_done;
109 const char *response;
110 unsigned int cmd_error;
111 char data[DATA_SIZE];
112 unsigned int len;
113 char reply[DATA_SIZE];
114 char buf[DATA_SIZE];
115 unsigned int idx;
118 #endif