Lines Matching full:hdcp

26 #include "hdcp.h"
28 static void push_error_status(struct mod_hdcp *hdcp, in push_error_status() argument
31 struct mod_hdcp_trace *trace = &hdcp->connection.trace; in push_error_status()
35 trace->errors[trace->error_count].state_id = hdcp->state.id; in push_error_status()
37 HDCP_ERROR_TRACE(hdcp, status); in push_error_status()
40 if (is_hdcp1(hdcp)) { in push_error_status()
41 hdcp->connection.hdcp1_retry_count++; in push_error_status()
42 if (hdcp->connection.hdcp1_retry_count == MAX_NUM_OF_ATTEMPTS) in push_error_status()
43 hdcp->connection.link.adjust.hdcp1.disable = 1; in push_error_status()
44 } else if (is_hdcp2(hdcp)) { in push_error_status()
45 hdcp->connection.hdcp2_retry_count++; in push_error_status()
46 if (hdcp->connection.hdcp2_retry_count == MAX_NUM_OF_ATTEMPTS) in push_error_status()
47 hdcp->connection.link.adjust.hdcp2.disable = 1; in push_error_status()
51 static uint8_t is_cp_desired_hdcp1(struct mod_hdcp *hdcp) in is_cp_desired_hdcp1() argument
56 * hdcp is not desired in is_cp_desired_hdcp1()
59 if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_INACTIVE && in is_cp_desired_hdcp1()
60 hdcp->displays[i].adjust.disable != MOD_HDCP_DISPLAY_DISABLE_AUTHENTICATION) { in is_cp_desired_hdcp1()
67 !hdcp->connection.link.adjust.hdcp1.disable && in is_cp_desired_hdcp1()
68 !hdcp->connection.is_hdcp1_revoked; in is_cp_desired_hdcp1()
71 static uint8_t is_cp_desired_hdcp2(struct mod_hdcp *hdcp) in is_cp_desired_hdcp2() argument
76 * hdcp is not desired in is_cp_desired_hdcp2()
79 if (hdcp->displays[i].state != MOD_HDCP_DISPLAY_INACTIVE && in is_cp_desired_hdcp2()
80 hdcp->displays[i].adjust.disable != MOD_HDCP_DISPLAY_DISABLE_AUTHENTICATION) { in is_cp_desired_hdcp2()
87 !hdcp->connection.link.adjust.hdcp2.disable && in is_cp_desired_hdcp2()
88 !hdcp->connection.is_hdcp2_revoked; in is_cp_desired_hdcp2()
91 static enum mod_hdcp_status execution(struct mod_hdcp *hdcp, in execution() argument
97 if (is_in_initialized_state(hdcp)) { in execution()
104 } else if (is_in_cp_not_desired_state(hdcp)) { in execution()
109 } else if (is_in_hdcp1_states(hdcp)) { in execution()
110 status = mod_hdcp_hdcp1_execution(hdcp, event_ctx, &input->hdcp1); in execution()
111 } else if (is_in_hdcp1_dp_states(hdcp)) { in execution()
112 status = mod_hdcp_hdcp1_dp_execution(hdcp, in execution()
114 } else if (is_in_hdcp2_states(hdcp)) { in execution()
115 status = mod_hdcp_hdcp2_execution(hdcp, event_ctx, &input->hdcp2); in execution()
116 } else if (is_in_hdcp2_dp_states(hdcp)) { in execution()
117 status = mod_hdcp_hdcp2_dp_execution(hdcp, in execution()
127 static enum mod_hdcp_status transition(struct mod_hdcp *hdcp, in transition() argument
137 if (is_in_initialized_state(hdcp)) { in transition()
138 if (is_dp_hdcp(hdcp)) in transition()
139 if (is_cp_desired_hdcp2(hdcp)) { in transition()
141 set_state_id(hdcp, output, D2_A0_DETERMINE_RX_HDCP_CAPABLE); in transition()
142 } else if (is_cp_desired_hdcp1(hdcp)) { in transition()
144 set_state_id(hdcp, output, D1_A0_DETERMINE_RX_HDCP_CAPABLE); in transition()
147 set_state_id(hdcp, output, HDCP_CP_NOT_DESIRED); in transition()
148 set_auth_complete(hdcp, output); in transition()
150 else if (is_hdmi_dvi_sl_hdcp(hdcp)) in transition()
151 if (is_cp_desired_hdcp2(hdcp)) { in transition()
153 set_state_id(hdcp, output, H2_A0_KNOWN_HDCP2_CAPABLE_RX); in transition()
154 } else if (is_cp_desired_hdcp1(hdcp)) { in transition()
156 set_state_id(hdcp, output, H1_A0_WAIT_FOR_ACTIVE_RX); in transition()
159 set_state_id(hdcp, output, HDCP_CP_NOT_DESIRED); in transition()
160 set_auth_complete(hdcp, output); in transition()
164 set_state_id(hdcp, output, HDCP_CP_NOT_DESIRED); in transition()
165 set_auth_complete(hdcp, output); in transition()
167 } else if (is_in_cp_not_desired_state(hdcp)) { in transition()
168 increment_stay_counter(hdcp); in transition()
169 } else if (is_in_hdcp1_states(hdcp)) { in transition()
170 status = mod_hdcp_hdcp1_transition(hdcp, in transition()
172 } else if (is_in_hdcp1_dp_states(hdcp)) { in transition()
173 status = mod_hdcp_hdcp1_dp_transition(hdcp, in transition()
175 } else if (is_in_hdcp2_states(hdcp)) { in transition()
176 status = mod_hdcp_hdcp2_transition(hdcp, in transition()
178 } else if (is_in_hdcp2_dp_states(hdcp)) { in transition()
179 status = mod_hdcp_hdcp2_dp_transition(hdcp, in transition()
188 static enum mod_hdcp_status reset_authentication(struct mod_hdcp *hdcp, in reset_authentication() argument
193 if (is_hdcp1(hdcp)) { in reset_authentication()
194 if (hdcp->auth.trans_input.hdcp1.create_session != UNKNOWN) { in reset_authentication()
198 mod_hdcp_hdcp1_destroy_session(hdcp); in reset_authentication()
202 HDCP_TOP_RESET_AUTH_TRACE(hdcp); in reset_authentication()
203 memset(&hdcp->auth, 0, sizeof(struct mod_hdcp_authentication)); in reset_authentication()
204 memset(&hdcp->state, 0, sizeof(struct mod_hdcp_state)); in reset_authentication()
205 set_state_id(hdcp, output, HDCP_INITIALIZED); in reset_authentication()
206 } else if (is_hdcp2(hdcp)) { in reset_authentication()
207 if (hdcp->auth.trans_input.hdcp2.create_session == PASS) { in reset_authentication()
208 status = mod_hdcp_hdcp2_destroy_session(hdcp); in reset_authentication()
216 HDCP_TOP_RESET_AUTH_TRACE(hdcp); in reset_authentication()
217 memset(&hdcp->auth, 0, sizeof(struct mod_hdcp_authentication)); in reset_authentication()
218 memset(&hdcp->state, 0, sizeof(struct mod_hdcp_state)); in reset_authentication()
219 set_state_id(hdcp, output, HDCP_INITIALIZED); in reset_authentication()
220 } else if (is_in_cp_not_desired_state(hdcp)) { in reset_authentication()
221 HDCP_TOP_RESET_AUTH_TRACE(hdcp); in reset_authentication()
222 memset(&hdcp->auth, 0, sizeof(struct mod_hdcp_authentication)); in reset_authentication()
223 memset(&hdcp->state, 0, sizeof(struct mod_hdcp_state)); in reset_authentication()
224 set_state_id(hdcp, output, HDCP_INITIALIZED); in reset_authentication()
234 static enum mod_hdcp_status reset_connection(struct mod_hdcp *hdcp, in reset_connection() argument
241 status = reset_authentication(hdcp, output); in reset_connection()
245 if (current_state(hdcp) != HDCP_UNINITIALIZED) { in reset_connection()
246 HDCP_TOP_RESET_CONN_TRACE(hdcp); in reset_connection()
247 set_state_id(hdcp, output, HDCP_UNINITIALIZED); in reset_connection()
249 memset(&hdcp->connection, 0, sizeof(hdcp->connection)); in reset_connection()
254 static enum mod_hdcp_status update_display_adjustments(struct mod_hdcp *hdcp, in update_display_adjustments() argument
260 if (is_in_authenticated_states(hdcp) && in update_display_adjustments()
261 is_dp_mst_hdcp(hdcp) && in update_display_adjustments()
265 if (is_hdcp1(hdcp)) in update_display_adjustments()
266 status = mod_hdcp_hdcp1_enable_dp_stream_encryption(hdcp); in update_display_adjustments()
267 else if (is_hdcp2(hdcp)) in update_display_adjustments()
268 status = mod_hdcp_hdcp2_enable_dp_stream_encryption(hdcp); in update_display_adjustments()
289 enum mod_hdcp_status mod_hdcp_setup(struct mod_hdcp *hdcp, in mod_hdcp_setup() argument
296 hdcp->config = *config; in mod_hdcp_setup()
297 HDCP_TOP_INTERFACE_TRACE(hdcp); in mod_hdcp_setup()
298 status = reset_connection(hdcp, &output); in mod_hdcp_setup()
300 push_error_status(hdcp, status); in mod_hdcp_setup()
304 enum mod_hdcp_status mod_hdcp_teardown(struct mod_hdcp *hdcp) in mod_hdcp_teardown() argument
309 HDCP_TOP_INTERFACE_TRACE(hdcp); in mod_hdcp_teardown()
311 status = reset_connection(hdcp, &output); in mod_hdcp_teardown()
313 memset(hdcp, 0, sizeof(struct mod_hdcp)); in mod_hdcp_teardown()
315 push_error_status(hdcp, status); in mod_hdcp_teardown()
319 enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp, in mod_hdcp_add_display() argument
326 HDCP_TOP_INTERFACE_TRACE_WITH_INDEX(hdcp, display->index); in mod_hdcp_add_display()
336 if (get_active_display_at_index(hdcp, display->index)) { in mod_hdcp_add_display()
342 display_container = get_empty_display_container(hdcp); in mod_hdcp_add_display()
349 status = reset_authentication(hdcp, output); in mod_hdcp_add_display()
354 reset_retry_counts(hdcp); in mod_hdcp_add_display()
357 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); in mod_hdcp_add_display()
360 hdcp->connection.link = *link; in mod_hdcp_add_display()
362 status = mod_hdcp_add_display_to_topology(hdcp, display_container); in mod_hdcp_add_display()
368 if (current_state(hdcp) != HDCP_INITIALIZED) in mod_hdcp_add_display()
369 set_state_id(hdcp, output, HDCP_INITIALIZED); in mod_hdcp_add_display()
370 callback_in_ms(hdcp->connection.link.adjust.auth_delay * 1000, output); in mod_hdcp_add_display()
373 push_error_status(hdcp, status); in mod_hdcp_add_display()
378 enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp, in mod_hdcp_remove_display() argument
384 HDCP_TOP_INTERFACE_TRACE_WITH_INDEX(hdcp, index); in mod_hdcp_remove_display()
388 display = get_active_display_at_index(hdcp, index); in mod_hdcp_remove_display()
395 status = reset_authentication(hdcp, output); in mod_hdcp_remove_display()
400 reset_retry_counts(hdcp); in mod_hdcp_remove_display()
403 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); in mod_hdcp_remove_display()
406 status = mod_hdcp_remove_display_from_topology(hdcp, index); in mod_hdcp_remove_display()
412 if (current_state(hdcp) != HDCP_UNINITIALIZED) in mod_hdcp_remove_display()
413 callback_in_ms(hdcp->connection.link.adjust.auth_delay * 1000, in mod_hdcp_remove_display()
417 push_error_status(hdcp, status); in mod_hdcp_remove_display()
421 enum mod_hdcp_status mod_hdcp_update_display(struct mod_hdcp *hdcp, in mod_hdcp_update_display() argument
430 HDCP_TOP_INTERFACE_TRACE_WITH_INDEX(hdcp, index); in mod_hdcp_update_display()
434 display = get_active_display_at_index(hdcp, index); in mod_hdcp_update_display()
441 if (memcmp(link_adjust, &hdcp->connection.link.adjust, in mod_hdcp_update_display()
449 if (memcmp(link_adjust, &hdcp->connection.link.adjust, in mod_hdcp_update_display()
453 status = update_display_adjustments(hdcp, display, display_adjust); in mod_hdcp_update_display()
459 status = reset_authentication(hdcp, output); in mod_hdcp_update_display()
464 reset_retry_counts(hdcp); in mod_hdcp_update_display()
467 memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace)); in mod_hdcp_update_display()
470 hdcp->connection.link.adjust = *link_adjust; in mod_hdcp_update_display()
474 if (current_state(hdcp) != HDCP_UNINITIALIZED) in mod_hdcp_update_display()
480 push_error_status(hdcp, status); in mod_hdcp_update_display()
484 enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp, in mod_hdcp_query_display() argument
491 display = get_active_display_at_index(hdcp, index); in mod_hdcp_query_display()
498 query->link = &hdcp->connection.link; in mod_hdcp_query_display()
500 query->trace = &hdcp->connection.trace; in mod_hdcp_query_display()
504 if (is_hdcp1(hdcp)) { in mod_hdcp_query_display()
506 } else if (is_hdcp2(hdcp)) { in mod_hdcp_query_display()
522 enum mod_hdcp_status mod_hdcp_reset_connection(struct mod_hdcp *hdcp, in mod_hdcp_reset_connection() argument
527 HDCP_TOP_INTERFACE_TRACE(hdcp); in mod_hdcp_reset_connection()
528 status = reset_connection(hdcp, output); in mod_hdcp_reset_connection()
530 push_error_status(hdcp, status); in mod_hdcp_reset_connection()
535 enum mod_hdcp_status mod_hdcp_process_event(struct mod_hdcp *hdcp, in mod_hdcp_process_event() argument
541 HDCP_EVENT_TRACE(hdcp, event); in mod_hdcp_process_event()
547 exec_status = execution(hdcp, &event_ctx, &hdcp->auth.trans_input); in mod_hdcp_process_event()
549 hdcp, &event_ctx, &hdcp->auth.trans_input, output); in mod_hdcp_process_event()
554 push_error_status(hdcp, status); in mod_hdcp_process_event()
557 push_error_status(hdcp, status); in mod_hdcp_process_event()
562 mod_hdcp_log_ddc_trace(hdcp); in mod_hdcp_process_event()
563 reset_status = reset_authentication(hdcp, output); in mod_hdcp_process_event()
565 push_error_status(hdcp, reset_status); in mod_hdcp_process_event()
570 status = mod_hdcp_clear_cp_irq_status(hdcp); in mod_hdcp_process_event()
572 push_error_status(hdcp, status); in mod_hdcp_process_event()