2 * Copyright 2019 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
32 #include <drm/drm_hdcp.h>
33 #include <drm/drm_dp_helper.h>
35 enum mod_hdcp_trans_input_result
{
41 struct mod_hdcp_transition_input_hdcp1
{
43 uint8_t bksv_validation
;
45 uint8_t create_session
;
51 uint8_t rx_validation
;
53 uint8_t link_maintenance
;
56 uint8_t max_cascade_check
;
57 uint8_t max_devs_check
;
58 uint8_t device_count_check
;
61 uint8_t ksvlist_vp_validation
;
63 uint8_t hdcp_capable_dp
;
64 uint8_t binfo_read_dp
;
65 uint8_t r0p_available_dp
;
66 uint8_t link_integiry_check
;
67 uint8_t reauth_request_check
;
68 uint8_t stream_encryption_dp
;
71 struct mod_hdcp_transition_input_hdcp2
{
72 uint8_t hdcp2version_read
;
73 uint8_t hdcp2_capable_check
;
75 uint8_t create_session
;
76 uint8_t ake_init_prepare
;
77 uint8_t ake_init_write
;
78 uint8_t rxstatus_read
;
79 uint8_t ake_cert_available
;
80 uint8_t ake_cert_read
;
81 uint8_t ake_cert_validation
;
82 uint8_t stored_km_write
;
83 uint8_t no_stored_km_write
;
84 uint8_t h_prime_available
;
86 uint8_t pairing_available
;
87 uint8_t pairing_info_read
;
88 uint8_t h_prime_validation
;
89 uint8_t lc_init_prepare
;
90 uint8_t lc_init_write
;
91 uint8_t l_prime_available_poll
;
93 uint8_t l_prime_validation
;
96 uint8_t enable_encryption
;
97 uint8_t reauth_request_check
;
98 uint8_t rx_id_list_read
;
99 uint8_t device_count_check
;
100 uint8_t rx_id_list_validation
;
101 uint8_t repeater_auth_ack_write
;
102 uint8_t prepare_stream_manage
;
103 uint8_t stream_manage_write
;
104 uint8_t stream_ready_available
;
105 uint8_t stream_ready_read
;
106 uint8_t stream_ready_validation
;
108 uint8_t rx_caps_read_dp
;
109 uint8_t content_stream_type_write
;
110 uint8_t link_integrity_check_dp
;
111 uint8_t stream_encryption_dp
;
114 union mod_hdcp_transition_input
{
115 struct mod_hdcp_transition_input_hdcp1 hdcp1
;
116 struct mod_hdcp_transition_input_hdcp2 hdcp2
;
119 struct mod_hdcp_message_hdcp1
{
127 uint8_t ksvlist
[635];
128 uint16_t ksvlist_size
;
134 struct mod_hdcp_message_hdcp2
{
135 uint8_t hdcp2version_hdmi
;
136 uint8_t rxcaps_dp
[3];
139 uint8_t ake_init
[12];
140 uint8_t ake_cert
[534];
141 uint8_t ake_no_stored_km
[129];
142 uint8_t ake_stored_km
[33];
143 uint8_t ake_h_prime
[33];
144 uint8_t ake_pairing_info
[17];
146 uint8_t lc_l_prime
[33];
148 uint8_t rx_id_list
[177]; // 22 + 5 * 31
149 uint16_t rx_id_list_size
;
150 uint8_t repeater_auth_ack
[17];
151 uint8_t repeater_auth_stream_manage
[68]; // 6 + 2 * 31
152 uint16_t stream_manage_size
;
153 uint8_t repeater_auth_stream_ready
[33];
155 uint8_t content_stream_type_dp
[2];
158 union mod_hdcp_message
{
159 struct mod_hdcp_message_hdcp1 hdcp1
;
160 struct mod_hdcp_message_hdcp2 hdcp2
;
163 struct mod_hdcp_auth_counters
{
164 uint8_t stream_management_retry_count
;
167 /* contains values per connection */
168 struct mod_hdcp_connection
{
169 struct mod_hdcp_link link
;
170 struct mod_hdcp_display displays
[MAX_NUM_OF_DISPLAYS
];
172 uint8_t is_km_stored
;
173 uint8_t is_hdcp2_revoked
;
174 struct mod_hdcp_trace trace
;
175 uint8_t hdcp1_retry_count
;
176 uint8_t hdcp2_retry_count
;
179 /* contains values per authentication cycle */
180 struct mod_hdcp_authentication
{
182 union mod_hdcp_message msg
;
183 union mod_hdcp_transition_input trans_input
;
184 struct mod_hdcp_auth_counters count
;
187 /* contains values per state change */
188 struct mod_hdcp_state
{
193 /* per event in a state */
194 struct mod_hdcp_event_context
{
195 enum mod_hdcp_event event
;
196 uint8_t rx_id_list_ready
;
197 uint8_t unexpected_event
;
202 struct mod_hdcp_config config
;
204 struct mod_hdcp_connection connection
;
205 /* per authentication attempt */
206 struct mod_hdcp_authentication auth
;
207 /* per state in an authentication */
208 struct mod_hdcp_state state
;
209 /* reserved memory buffer */
213 enum mod_hdcp_initial_state_id
{
214 HDCP_UNINITIALIZED
= 0x0,
215 HDCP_INITIAL_STATE_START
= HDCP_UNINITIALIZED
,
218 HDCP_INITIAL_STATE_END
= HDCP_CP_NOT_DESIRED
221 enum mod_hdcp_hdcp1_state_id
{
222 HDCP1_STATE_START
= HDCP_INITIAL_STATE_END
,
223 H1_A0_WAIT_FOR_ACTIVE_RX
,
225 H1_A2_COMPUTATIONS_A3_VALIDATE_RX_A6_TEST_FOR_REPEATER
,
226 H1_A45_AUTHENTICATED
,
227 H1_A8_WAIT_FOR_READY
,
229 HDCP1_STATE_END
= H1_A9_READ_KSV_LIST
232 enum mod_hdcp_hdcp1_dp_state_id
{
233 HDCP1_DP_STATE_START
= HDCP1_STATE_END
,
234 D1_A0_DETERMINE_RX_HDCP_CAPABLE
,
236 D1_A23_WAIT_FOR_R0_PRIME
,
237 D1_A2_COMPUTATIONS_A3_VALIDATE_RX_A5_TEST_FOR_REPEATER
,
239 D1_A6_WAIT_FOR_READY
,
241 HDCP1_DP_STATE_END
= D1_A7_READ_KSV_LIST
,
244 enum mod_hdcp_hdcp2_state_id
{
245 HDCP2_STATE_START
= HDCP1_DP_STATE_END
,
246 H2_A0_KNOWN_HDCP2_CAPABLE_RX
,
248 H2_A1_VALIDATE_AKE_CERT
,
249 H2_A1_SEND_NO_STORED_KM
,
251 H2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
,
252 H2_A1_SEND_STORED_KM
,
253 H2_A1_VALIDATE_H_PRIME
,
254 H2_A2_LOCALITY_CHECK
,
255 H2_A3_EXCHANGE_KS_AND_TEST_FOR_REPEATER
,
256 H2_ENABLE_ENCRYPTION
,
258 H2_A6_WAIT_FOR_RX_ID_LIST
,
259 H2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
,
260 H2_A9_SEND_STREAM_MANAGEMENT
,
261 H2_A9_VALIDATE_STREAM_READY
,
262 HDCP2_STATE_END
= H2_A9_VALIDATE_STREAM_READY
,
265 enum mod_hdcp_hdcp2_dp_state_id
{
266 HDCP2_DP_STATE_START
= HDCP2_STATE_END
,
267 D2_A0_DETERMINE_RX_HDCP_CAPABLE
,
269 D2_A1_VALIDATE_AKE_CERT
,
270 D2_A1_SEND_NO_STORED_KM
,
272 D2_A1_READ_PAIRING_INFO_AND_VALIDATE_H_PRIME
,
273 D2_A1_SEND_STORED_KM
,
274 D2_A1_VALIDATE_H_PRIME
,
275 D2_A2_LOCALITY_CHECK
,
276 D2_A34_EXCHANGE_KS_AND_TEST_FOR_REPEATER
,
277 D2_SEND_CONTENT_STREAM_TYPE
,
278 D2_ENABLE_ENCRYPTION
,
280 D2_A6_WAIT_FOR_RX_ID_LIST
,
281 D2_A78_VERIFY_RX_ID_LIST_AND_SEND_ACK
,
282 D2_A9_SEND_STREAM_MANAGEMENT
,
283 D2_A9_VALIDATE_STREAM_READY
,
284 HDCP2_DP_STATE_END
= D2_A9_VALIDATE_STREAM_READY
,
285 HDCP_STATE_END
= HDCP2_DP_STATE_END
,
288 /* hdcp1 executions and transitions */
289 typedef enum mod_hdcp_status (*mod_hdcp_action
)(struct mod_hdcp
*hdcp
);
290 uint8_t mod_hdcp_execute_and_set(
291 mod_hdcp_action func
, uint8_t *flag
,
292 enum mod_hdcp_status
*status
, struct mod_hdcp
*hdcp
, char *str
);
293 enum mod_hdcp_status
mod_hdcp_hdcp1_execution(struct mod_hdcp
*hdcp
,
294 struct mod_hdcp_event_context
*event_ctx
,
295 struct mod_hdcp_transition_input_hdcp1
*input
);
296 enum mod_hdcp_status
mod_hdcp_hdcp1_dp_execution(struct mod_hdcp
*hdcp
,
297 struct mod_hdcp_event_context
*event_ctx
,
298 struct mod_hdcp_transition_input_hdcp1
*input
);
299 enum mod_hdcp_status
mod_hdcp_hdcp1_transition(struct mod_hdcp
*hdcp
,
300 struct mod_hdcp_event_context
*event_ctx
,
301 struct mod_hdcp_transition_input_hdcp1
*input
,
302 struct mod_hdcp_output
*output
);
303 enum mod_hdcp_status
mod_hdcp_hdcp1_dp_transition(struct mod_hdcp
*hdcp
,
304 struct mod_hdcp_event_context
*event_ctx
,
305 struct mod_hdcp_transition_input_hdcp1
*input
,
306 struct mod_hdcp_output
*output
);
308 /* hdcp2 executions and transitions */
309 enum mod_hdcp_status
mod_hdcp_hdcp2_execution(struct mod_hdcp
*hdcp
,
310 struct mod_hdcp_event_context
*event_ctx
,
311 struct mod_hdcp_transition_input_hdcp2
*input
);
312 enum mod_hdcp_status
mod_hdcp_hdcp2_dp_execution(struct mod_hdcp
*hdcp
,
313 struct mod_hdcp_event_context
*event_ctx
,
314 struct mod_hdcp_transition_input_hdcp2
*input
);
315 enum mod_hdcp_status
mod_hdcp_hdcp2_transition(struct mod_hdcp
*hdcp
,
316 struct mod_hdcp_event_context
*event_ctx
,
317 struct mod_hdcp_transition_input_hdcp2
*input
,
318 struct mod_hdcp_output
*output
);
319 enum mod_hdcp_status
mod_hdcp_hdcp2_dp_transition(struct mod_hdcp
*hdcp
,
320 struct mod_hdcp_event_context
*event_ctx
,
321 struct mod_hdcp_transition_input_hdcp2
*input
,
322 struct mod_hdcp_output
*output
);
325 void mod_hdcp_dump_binary_message(uint8_t *msg
, uint32_t msg_size
,
326 uint8_t *buf
, uint32_t buf_size
);
327 /* TODO: add adjustment log */
330 enum mod_hdcp_status
mod_hdcp_add_display_topology(
331 struct mod_hdcp
*hdcp
);
332 enum mod_hdcp_status
mod_hdcp_remove_display_topology(
333 struct mod_hdcp
*hdcp
);
334 enum mod_hdcp_status
mod_hdcp_hdcp1_create_session(struct mod_hdcp
*hdcp
);
335 enum mod_hdcp_status
mod_hdcp_hdcp1_destroy_session(struct mod_hdcp
*hdcp
);
336 enum mod_hdcp_status
mod_hdcp_hdcp1_validate_rx(struct mod_hdcp
*hdcp
);
337 enum mod_hdcp_status
mod_hdcp_hdcp1_enable_encryption(struct mod_hdcp
*hdcp
);
338 enum mod_hdcp_status
mod_hdcp_hdcp1_validate_ksvlist_vp(struct mod_hdcp
*hdcp
);
339 enum mod_hdcp_status
mod_hdcp_hdcp1_enable_dp_stream_encryption(
340 struct mod_hdcp
*hdcp
);
341 enum mod_hdcp_status
mod_hdcp_hdcp1_link_maintenance(struct mod_hdcp
*hdcp
);
342 enum mod_hdcp_status
mod_hdcp_hdcp1_get_link_encryption_status(struct mod_hdcp
*hdcp
,
343 enum mod_hdcp_encryption_status
*encryption_status
);
344 enum mod_hdcp_status
mod_hdcp_hdcp2_create_session(struct mod_hdcp
*hdcp
);
345 enum mod_hdcp_status
mod_hdcp_hdcp2_destroy_session(struct mod_hdcp
*hdcp
);
346 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_ake_init(struct mod_hdcp
*hdcp
);
347 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_ake_cert(struct mod_hdcp
*hdcp
);
348 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_h_prime(struct mod_hdcp
*hdcp
);
349 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_lc_init(struct mod_hdcp
*hdcp
);
350 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_l_prime(struct mod_hdcp
*hdcp
);
351 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_eks(struct mod_hdcp
*hdcp
);
352 enum mod_hdcp_status
mod_hdcp_hdcp2_enable_encryption(struct mod_hdcp
*hdcp
);
353 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_rx_id_list(struct mod_hdcp
*hdcp
);
354 enum mod_hdcp_status
mod_hdcp_hdcp2_enable_dp_stream_encryption(
355 struct mod_hdcp
*hdcp
);
356 enum mod_hdcp_status
mod_hdcp_hdcp2_prepare_stream_management(
357 struct mod_hdcp
*hdcp
);
358 enum mod_hdcp_status
mod_hdcp_hdcp2_validate_stream_ready(
359 struct mod_hdcp
*hdcp
);
360 enum mod_hdcp_status
mod_hdcp_hdcp2_get_link_encryption_status(struct mod_hdcp
*hdcp
,
361 enum mod_hdcp_encryption_status
*encryption_status
);
364 enum mod_hdcp_status
mod_hdcp_read_bksv(struct mod_hdcp
*hdcp
);
365 enum mod_hdcp_status
mod_hdcp_read_bcaps(struct mod_hdcp
*hdcp
);
366 enum mod_hdcp_status
mod_hdcp_read_bstatus(struct mod_hdcp
*hdcp
);
367 enum mod_hdcp_status
mod_hdcp_read_r0p(struct mod_hdcp
*hdcp
);
368 enum mod_hdcp_status
mod_hdcp_read_ksvlist(struct mod_hdcp
*hdcp
);
369 enum mod_hdcp_status
mod_hdcp_read_vp(struct mod_hdcp
*hdcp
);
370 enum mod_hdcp_status
mod_hdcp_read_binfo(struct mod_hdcp
*hdcp
);
371 enum mod_hdcp_status
mod_hdcp_write_aksv(struct mod_hdcp
*hdcp
);
372 enum mod_hdcp_status
mod_hdcp_write_ainfo(struct mod_hdcp
*hdcp
);
373 enum mod_hdcp_status
mod_hdcp_write_an(struct mod_hdcp
*hdcp
);
374 enum mod_hdcp_status
mod_hdcp_read_hdcp2version(struct mod_hdcp
*hdcp
);
375 enum mod_hdcp_status
mod_hdcp_read_rxcaps(struct mod_hdcp
*hdcp
);
376 enum mod_hdcp_status
mod_hdcp_read_rxstatus(struct mod_hdcp
*hdcp
);
377 enum mod_hdcp_status
mod_hdcp_read_ake_cert(struct mod_hdcp
*hdcp
);
378 enum mod_hdcp_status
mod_hdcp_read_h_prime(struct mod_hdcp
*hdcp
);
379 enum mod_hdcp_status
mod_hdcp_read_pairing_info(struct mod_hdcp
*hdcp
);
380 enum mod_hdcp_status
mod_hdcp_read_l_prime(struct mod_hdcp
*hdcp
);
381 enum mod_hdcp_status
mod_hdcp_read_rx_id_list(struct mod_hdcp
*hdcp
);
382 enum mod_hdcp_status
mod_hdcp_read_stream_ready(struct mod_hdcp
*hdcp
);
383 enum mod_hdcp_status
mod_hdcp_write_ake_init(struct mod_hdcp
*hdcp
);
384 enum mod_hdcp_status
mod_hdcp_write_no_stored_km(struct mod_hdcp
*hdcp
);
385 enum mod_hdcp_status
mod_hdcp_write_stored_km(struct mod_hdcp
*hdcp
);
386 enum mod_hdcp_status
mod_hdcp_write_lc_init(struct mod_hdcp
*hdcp
);
387 enum mod_hdcp_status
mod_hdcp_write_eks(struct mod_hdcp
*hdcp
);
388 enum mod_hdcp_status
mod_hdcp_write_repeater_auth_ack(struct mod_hdcp
*hdcp
);
389 enum mod_hdcp_status
mod_hdcp_write_stream_manage(struct mod_hdcp
*hdcp
);
390 enum mod_hdcp_status
mod_hdcp_write_content_type(struct mod_hdcp
*hdcp
);
392 /* hdcp version helpers */
393 static inline uint8_t is_dp_hdcp(struct mod_hdcp
*hdcp
)
395 return (hdcp
->connection
.link
.mode
== MOD_HDCP_MODE_DP
||
396 hdcp
->connection
.link
.mode
== MOD_HDCP_MODE_DP_MST
);
399 static inline uint8_t is_dp_mst_hdcp(struct mod_hdcp
*hdcp
)
401 return (hdcp
->connection
.link
.mode
== MOD_HDCP_MODE_DP_MST
);
404 static inline uint8_t is_hdmi_dvi_sl_hdcp(struct mod_hdcp
*hdcp
)
406 return (hdcp
->connection
.link
.mode
== MOD_HDCP_MODE_DEFAULT
);
409 /* hdcp state helpers */
410 static inline uint8_t current_state(struct mod_hdcp
*hdcp
)
412 return hdcp
->state
.id
;
415 static inline void set_state_id(struct mod_hdcp
*hdcp
,
416 struct mod_hdcp_output
*output
, uint8_t id
)
418 memset(&hdcp
->state
, 0, sizeof(hdcp
->state
));
420 /* callback timer should be reset per state */
421 output
->callback_stop
= 1;
422 output
->watchdog_timer_stop
= 1;
423 HDCP_NEXT_STATE_TRACE(hdcp
, id
, output
);
426 static inline uint8_t is_in_hdcp1_states(struct mod_hdcp
*hdcp
)
428 return (current_state(hdcp
) > HDCP1_STATE_START
&&
429 current_state(hdcp
) <= HDCP1_STATE_END
);
432 static inline uint8_t is_in_hdcp1_dp_states(struct mod_hdcp
*hdcp
)
434 return (current_state(hdcp
) > HDCP1_DP_STATE_START
&&
435 current_state(hdcp
) <= HDCP1_DP_STATE_END
);
438 static inline uint8_t is_in_hdcp2_states(struct mod_hdcp
*hdcp
)
440 return (current_state(hdcp
) > HDCP2_STATE_START
&&
441 current_state(hdcp
) <= HDCP2_STATE_END
);
444 static inline uint8_t is_in_hdcp2_dp_states(struct mod_hdcp
*hdcp
)
446 return (current_state(hdcp
) > HDCP2_DP_STATE_START
&&
447 current_state(hdcp
) <= HDCP2_DP_STATE_END
);
450 static inline uint8_t is_hdcp1(struct mod_hdcp
*hdcp
)
452 return (is_in_hdcp1_states(hdcp
) || is_in_hdcp1_dp_states(hdcp
));
455 static inline uint8_t is_hdcp2(struct mod_hdcp
*hdcp
)
457 return (is_in_hdcp2_states(hdcp
) || is_in_hdcp2_dp_states(hdcp
));
460 static inline uint8_t is_in_cp_not_desired_state(struct mod_hdcp
*hdcp
)
462 return current_state(hdcp
) == HDCP_CP_NOT_DESIRED
;
465 static inline uint8_t is_in_initialized_state(struct mod_hdcp
*hdcp
)
467 return current_state(hdcp
) == HDCP_INITIALIZED
;
470 /* transition operation helpers */
471 static inline void increment_stay_counter(struct mod_hdcp
*hdcp
)
473 hdcp
->state
.stay_count
++;
476 static inline void fail_and_restart_in_ms(uint16_t time
,
477 enum mod_hdcp_status
*status
,
478 struct mod_hdcp_output
*output
)
480 output
->callback_needed
= 1;
481 output
->callback_delay
= time
;
482 output
->watchdog_timer_needed
= 0;
483 output
->watchdog_timer_delay
= 0;
484 *status
= MOD_HDCP_STATUS_RESET_NEEDED
;
487 static inline void callback_in_ms(uint16_t time
, struct mod_hdcp_output
*output
)
489 output
->callback_needed
= 1;
490 output
->callback_delay
= time
;
493 static inline void set_watchdog_in_ms(struct mod_hdcp
*hdcp
, uint16_t time
,
494 struct mod_hdcp_output
*output
)
496 output
->watchdog_timer_needed
= 1;
497 output
->watchdog_timer_delay
= time
;
500 /* connection topology helpers */
501 static inline uint8_t is_display_active(struct mod_hdcp_display
*display
)
503 return display
->state
>= MOD_HDCP_DISPLAY_ACTIVE
;
506 static inline uint8_t is_display_added(struct mod_hdcp_display
*display
)
508 return display
->state
>= MOD_HDCP_DISPLAY_ACTIVE_AND_ADDED
;
511 static inline uint8_t is_display_encryption_enabled(struct mod_hdcp_display
*display
)
513 return display
->state
>= MOD_HDCP_DISPLAY_ENCRYPTION_ENABLED
;
516 static inline uint8_t get_active_display_count(struct mod_hdcp
*hdcp
)
518 uint8_t added_count
= 0;
521 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++)
522 if (is_display_active(&hdcp
->connection
.displays
[i
]))
527 static inline uint8_t get_added_display_count(struct mod_hdcp
*hdcp
)
529 uint8_t added_count
= 0;
532 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++)
533 if (is_display_added(&hdcp
->connection
.displays
[i
]))
538 static inline struct mod_hdcp_display
*get_first_added_display(
539 struct mod_hdcp
*hdcp
)
542 struct mod_hdcp_display
*display
= NULL
;
544 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++)
545 if (is_display_added(&hdcp
->connection
.displays
[i
])) {
546 display
= &hdcp
->connection
.displays
[i
];
552 static inline struct mod_hdcp_display
*get_active_display_at_index(
553 struct mod_hdcp
*hdcp
, uint8_t index
)
556 struct mod_hdcp_display
*display
= NULL
;
558 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++)
559 if (hdcp
->connection
.displays
[i
].index
== index
&&
560 is_display_active(&hdcp
->connection
.displays
[i
])) {
561 display
= &hdcp
->connection
.displays
[i
];
567 static inline struct mod_hdcp_display
*get_empty_display_container(
568 struct mod_hdcp
*hdcp
)
571 struct mod_hdcp_display
*display
= NULL
;
573 for (i
= 0; i
< MAX_NUM_OF_DISPLAYS
; i
++)
574 if (!is_display_active(&hdcp
->connection
.displays
[i
])) {
575 display
= &hdcp
->connection
.displays
[i
];
581 static inline void reset_retry_counts(struct mod_hdcp
*hdcp
)
583 hdcp
->connection
.hdcp1_retry_count
= 0;
584 hdcp
->connection
.hdcp2_retry_count
= 0;