Commit 40ef288f authored by Wenjing Liu's avatar Wenjing Liu Committed by Alex Deucher

drm/amd/display: add update authentication interface

[why]
Previously to toggle authentication, we need to remove and
add the same display back with modified adjustment.
This method will toggle DTM state without actual hardware changes.
This is not per design and would cause potential issues in the long run.

[how]
We are creating a dedicated interface that does the same thing as
remove and add back the display without changing DTM state.
Acked-by: default avatarSolomon Chiu <solomon.chiu@amd.com>
Signed-off-by: default avatarWenjing Liu <wenjing.liu@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ea2f15ff
...@@ -39,8 +39,12 @@ static void push_error_status(struct mod_hdcp *hdcp, ...@@ -39,8 +39,12 @@ static void push_error_status(struct mod_hdcp *hdcp,
if (is_hdcp1(hdcp)) { if (is_hdcp1(hdcp)) {
hdcp->connection.hdcp1_retry_count++; hdcp->connection.hdcp1_retry_count++;
if (hdcp->connection.hdcp1_retry_count == MAX_NUM_OF_ATTEMPTS)
hdcp->connection.link.adjust.hdcp1.disable = 1;
} else if (is_hdcp2(hdcp)) { } else if (is_hdcp2(hdcp)) {
hdcp->connection.hdcp2_retry_count++; hdcp->connection.hdcp2_retry_count++;
if (hdcp->connection.hdcp2_retry_count == MAX_NUM_OF_ATTEMPTS)
hdcp->connection.link.adjust.hdcp2.disable = 1;
} }
} }
...@@ -59,8 +63,7 @@ static uint8_t is_cp_desired_hdcp1(struct mod_hdcp *hdcp) ...@@ -59,8 +63,7 @@ static uint8_t is_cp_desired_hdcp1(struct mod_hdcp *hdcp)
} }
} }
return (hdcp->connection.hdcp1_retry_count < MAX_NUM_OF_ATTEMPTS) && return is_auth_needed &&
is_auth_needed &&
!hdcp->connection.link.adjust.hdcp1.disable && !hdcp->connection.link.adjust.hdcp1.disable &&
!hdcp->connection.is_hdcp1_revoked; !hdcp->connection.is_hdcp1_revoked;
} }
...@@ -80,8 +83,7 @@ static uint8_t is_cp_desired_hdcp2(struct mod_hdcp *hdcp) ...@@ -80,8 +83,7 @@ static uint8_t is_cp_desired_hdcp2(struct mod_hdcp *hdcp)
} }
} }
return (hdcp->connection.hdcp2_retry_count < MAX_NUM_OF_ATTEMPTS) && return is_auth_needed &&
is_auth_needed &&
!hdcp->connection.link.adjust.hdcp2.disable && !hdcp->connection.link.adjust.hdcp2.disable &&
!hdcp->connection.is_hdcp2_revoked; !hdcp->connection.is_hdcp2_revoked;
} }
...@@ -392,6 +394,60 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp, ...@@ -392,6 +394,60 @@ enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
return status; return status;
} }
enum mod_hdcp_status mod_hdcp_update_authentication(struct mod_hdcp *hdcp,
uint8_t index,
struct mod_hdcp_link_adjustment *link_adjust,
struct mod_hdcp_display_adjustment *display_adjust,
struct mod_hdcp_output *output)
{
enum mod_hdcp_status status = MOD_HDCP_STATUS_SUCCESS;
struct mod_hdcp_display *display = NULL;
HDCP_TOP_INTERFACE_TRACE_WITH_INDEX(hdcp, index);
memset(output, 0, sizeof(struct mod_hdcp_output));
/* find display in connection */
display = get_active_display_at_index(hdcp, index);
if (!display) {
status = MOD_HDCP_STATUS_DISPLAY_NOT_FOUND;
goto out;
}
/* skip if no changes */
if (memcmp(link_adjust, &hdcp->connection.link.adjust,
sizeof(struct mod_hdcp_link_adjustment)) == 0 &&
memcmp(display_adjust, &display->adjust,
sizeof(struct mod_hdcp_display_adjustment)) == 0) {
status = MOD_HDCP_STATUS_SUCCESS;
goto out;
}
/* stop current authentication */
status = reset_authentication(hdcp, output);
if (status != MOD_HDCP_STATUS_SUCCESS)
goto out;
/* clear retry counters */
reset_retry_counts(hdcp);
/* reset error trace */
memset(&hdcp->connection.trace, 0, sizeof(hdcp->connection.trace));
/* set new adjustment */
hdcp->connection.link.adjust = *link_adjust;
display->adjust = *display_adjust;
/* request authentication when connection is not reset */
if (current_state(hdcp) != HDCP_UNINITIALIZED)
/* wait 100ms to debounce simultaneous updates for different indices */
callback_in_ms(100, output);
out:
if (status != MOD_HDCP_STATUS_SUCCESS)
push_error_status(hdcp, status);
return status;
}
enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp, enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp,
uint8_t index, struct mod_hdcp_display_query *query) uint8_t index, struct mod_hdcp_display_query *query)
{ {
......
...@@ -282,15 +282,22 @@ enum mod_hdcp_status mod_hdcp_setup(struct mod_hdcp *hdcp, ...@@ -282,15 +282,22 @@ enum mod_hdcp_status mod_hdcp_setup(struct mod_hdcp *hdcp,
/* called per link on link destroy */ /* called per link on link destroy */
enum mod_hdcp_status mod_hdcp_teardown(struct mod_hdcp *hdcp); enum mod_hdcp_status mod_hdcp_teardown(struct mod_hdcp *hdcp);
/* called per display on cp_desired set to true */ /* called per display after stream is enabled */
enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp, enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp,
struct mod_hdcp_link *link, struct mod_hdcp_display *display, struct mod_hdcp_link *link, struct mod_hdcp_display *display,
struct mod_hdcp_output *output); struct mod_hdcp_output *output);
/* called per display on cp_desired set to false */ /* called per display before stream is disabled */
enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp, enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
uint8_t index, struct mod_hdcp_output *output); uint8_t index, struct mod_hdcp_output *output);
/* called per display to apply new authentication adjustment */
enum mod_hdcp_status mod_hdcp_update_authentication(struct mod_hdcp *hdcp,
uint8_t index,
struct mod_hdcp_link_adjustment *link_adjust,
struct mod_hdcp_display_adjustment *display_adjust,
struct mod_hdcp_output *output);
/* called to query hdcp information on a specific index */ /* called to query hdcp information on a specific index */
enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp, enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp,
uint8_t index, struct mod_hdcp_display_query *query); uint8_t index, struct mod_hdcp_display_query *query);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment