.. | .. |
---|
17 | 17 | #include <linux/timer.h> |
---|
18 | 18 | #include <linux/cec-funcs.h> |
---|
19 | 19 | #include <media/rc-core.h> |
---|
20 | | -#include <media/cec-notifier.h> |
---|
21 | 20 | |
---|
22 | 21 | #define CEC_CAP_DEFAULTS (CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | \ |
---|
23 | 22 | CEC_CAP_PASSTHROUGH | CEC_CAP_RC) |
---|
.. | .. |
---|
53 | 52 | struct cec_adapter; |
---|
54 | 53 | struct cec_data; |
---|
55 | 54 | struct cec_pin; |
---|
| 55 | +struct cec_notifier; |
---|
56 | 56 | |
---|
57 | 57 | struct cec_data { |
---|
58 | 58 | struct list_head list; |
---|
.. | .. |
---|
144 | 144 | */ |
---|
145 | 145 | #define CEC_MAX_MSG_TX_QUEUE_SZ (18 * 1) |
---|
146 | 146 | |
---|
| 147 | +/** |
---|
| 148 | + * struct cec_adapter - cec adapter structure |
---|
| 149 | + * @owner: module owner |
---|
| 150 | + * @name: name of the CEC adapter |
---|
| 151 | + * @devnode: device node for the /dev/cecX device |
---|
| 152 | + * @lock: mutex controlling access to this structure |
---|
| 153 | + * @rc: remote control device |
---|
| 154 | + * @transmit_queue: queue of pending transmits |
---|
| 155 | + * @transmit_queue_sz: number of pending transmits |
---|
| 156 | + * @wait_queue: queue of transmits waiting for a reply |
---|
| 157 | + * @transmitting: CEC messages currently being transmitted |
---|
| 158 | + * @transmit_in_progress: true if a transmit is in progress |
---|
| 159 | + * @kthread_config: kthread used to configure a CEC adapter |
---|
| 160 | + * @config_completion: used to signal completion of the config kthread |
---|
| 161 | + * @kthread: main CEC processing thread |
---|
| 162 | + * @kthread_waitq: main CEC processing wait_queue |
---|
| 163 | + * @ops: cec adapter ops |
---|
| 164 | + * @priv: cec driver's private data |
---|
| 165 | + * @capabilities: cec adapter capabilities |
---|
| 166 | + * @available_log_addrs: maximum number of available logical addresses |
---|
| 167 | + * @phys_addr: the current physical address |
---|
| 168 | + * @needs_hpd: if true, then the HDMI HotPlug Detect pin must be high |
---|
| 169 | + * in order to transmit or receive CEC messages. This is usually a HW |
---|
| 170 | + * limitation. |
---|
| 171 | + * @is_configuring: the CEC adapter is configuring (i.e. claiming LAs) |
---|
| 172 | + * @is_configured: the CEC adapter is configured (i.e. has claimed LAs) |
---|
| 173 | + * @cec_pin_is_high: if true then the CEC pin is high. Only used with the |
---|
| 174 | + * CEC pin framework. |
---|
| 175 | + * @adap_controls_phys_addr: if true, then the CEC adapter controls the |
---|
| 176 | + * physical address, i.e. the CEC hardware can detect HPD changes and |
---|
| 177 | + * read the EDID and is not dependent on an external HDMI driver. |
---|
| 178 | + * Drivers that need this can set this field to true after the |
---|
| 179 | + * cec_allocate_adapter() call. |
---|
| 180 | + * @last_initiator: the initiator of the last transmitted message. |
---|
| 181 | + * @monitor_all_cnt: number of filehandles monitoring all msgs |
---|
| 182 | + * @monitor_pin_cnt: number of filehandles monitoring pin changes |
---|
| 183 | + * @follower_cnt: number of filehandles in follower mode |
---|
| 184 | + * @cec_follower: filehandle of the exclusive follower |
---|
| 185 | + * @cec_initiator: filehandle of the exclusive initiator |
---|
| 186 | + * @passthrough: if true, then the exclusive follower is in |
---|
| 187 | + * passthrough mode. |
---|
| 188 | + * @log_addrs: current logical addresses |
---|
| 189 | + * @conn_info: current connector info |
---|
| 190 | + * @tx_timeouts: number of transmit timeouts |
---|
| 191 | + * @notifier: CEC notifier |
---|
| 192 | + * @pin: CEC pin status struct |
---|
| 193 | + * @cec_dir: debugfs cec directory |
---|
| 194 | + * @status_file: debugfs cec status file |
---|
| 195 | + * @error_inj_file: debugfs cec error injection file |
---|
| 196 | + * @sequence: transmit sequence counter |
---|
| 197 | + * @input_phys: remote control input_phys name |
---|
| 198 | + * |
---|
| 199 | + * This structure represents a cec adapter. |
---|
| 200 | + */ |
---|
147 | 201 | struct cec_adapter { |
---|
148 | 202 | struct module *owner; |
---|
149 | 203 | char name[32]; |
---|
.. | .. |
---|
162 | 216 | |
---|
163 | 217 | struct task_struct *kthread; |
---|
164 | 218 | wait_queue_head_t kthread_waitq; |
---|
165 | | - wait_queue_head_t waitq; |
---|
166 | 219 | |
---|
167 | 220 | const struct cec_adap_ops *ops; |
---|
168 | 221 | void *priv; |
---|
.. | .. |
---|
174 | 227 | bool is_configuring; |
---|
175 | 228 | bool is_configured; |
---|
176 | 229 | bool cec_pin_is_high; |
---|
| 230 | + bool adap_controls_phys_addr; |
---|
177 | 231 | u8 last_initiator; |
---|
178 | 232 | u32 monitor_all_cnt; |
---|
179 | 233 | u32 monitor_pin_cnt; |
---|
.. | .. |
---|
182 | 236 | struct cec_fh *cec_initiator; |
---|
183 | 237 | bool passthrough; |
---|
184 | 238 | struct cec_log_addrs log_addrs; |
---|
| 239 | + struct cec_connector_info conn_info; |
---|
185 | 240 | |
---|
186 | 241 | u32 tx_timeouts; |
---|
187 | 242 | |
---|
.. | .. |
---|
193 | 248 | #endif |
---|
194 | 249 | |
---|
195 | 250 | struct dentry *cec_dir; |
---|
196 | | - struct dentry *status_file; |
---|
197 | | - struct dentry *error_inj_file; |
---|
198 | 251 | |
---|
199 | | - u16 phys_addrs[15]; |
---|
200 | 252 | u32 sequence; |
---|
201 | 253 | |
---|
202 | | - char device_name[32]; |
---|
203 | 254 | char input_phys[32]; |
---|
204 | | - char input_drv[32]; |
---|
205 | 255 | }; |
---|
206 | 256 | |
---|
207 | 257 | static inline void *cec_get_drvdata(const struct cec_adapter *adap) |
---|
.. | .. |
---|
235 | 285 | ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf |
---|
236 | 286 | |
---|
237 | 287 | struct edid; |
---|
| 288 | +struct drm_connector; |
---|
238 | 289 | |
---|
239 | 290 | #if IS_REACHABLE(CONFIG_CEC_CORE) |
---|
240 | 291 | struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, |
---|
.. | .. |
---|
249 | 300 | bool block); |
---|
250 | 301 | void cec_s_phys_addr_from_edid(struct cec_adapter *adap, |
---|
251 | 302 | const struct edid *edid); |
---|
| 303 | +void cec_s_conn_info(struct cec_adapter *adap, |
---|
| 304 | + const struct cec_connector_info *conn_info); |
---|
252 | 305 | int cec_transmit_msg(struct cec_adapter *adap, struct cec_msg *msg, |
---|
253 | 306 | bool block); |
---|
254 | 307 | |
---|
.. | .. |
---|
333 | 386 | u16 cec_get_edid_phys_addr(const u8 *edid, unsigned int size, |
---|
334 | 387 | unsigned int *offset); |
---|
335 | 388 | |
---|
| 389 | +void cec_fill_conn_info_from_drm(struct cec_connector_info *conn_info, |
---|
| 390 | + const struct drm_connector *connector); |
---|
| 391 | + |
---|
336 | 392 | #else |
---|
337 | 393 | |
---|
338 | 394 | static inline int cec_register_adapter(struct cec_adapter *adap, |
---|
.. | .. |
---|
367 | 423 | return CEC_PHYS_ADDR_INVALID; |
---|
368 | 424 | } |
---|
369 | 425 | |
---|
| 426 | +static inline void cec_s_conn_info(struct cec_adapter *adap, |
---|
| 427 | + const struct cec_connector_info *conn_info) |
---|
| 428 | +{ |
---|
| 429 | +} |
---|
| 430 | + |
---|
| 431 | +static inline void |
---|
| 432 | +cec_fill_conn_info_from_drm(struct cec_connector_info *conn_info, |
---|
| 433 | + const struct drm_connector *connector) |
---|
| 434 | +{ |
---|
| 435 | + memset(conn_info, 0, sizeof(*conn_info)); |
---|
| 436 | +} |
---|
| 437 | + |
---|
370 | 438 | #endif |
---|
371 | 439 | |
---|
372 | 440 | /** |
---|