Browse Source

disp: msm: update hdcp 2.2 stream management sequence

When HDCP stream management needs to be re-performed, the SDE_HDCP state
machine breaks down and reads or writes to the wrong DPCD HDCP offsets.
This results in an authentication failure, effectively allowing stream
management to succeed only on the first attempt.

Update the SDE_HDCP stream management logic to properly take its current
state into account in re-management scenarios. This will reduce the need
for full re-authentications upon content type updates.

Change-Id: Iebefbb060e49a7082b2d4c9efbed22a83a2a5ec5
Signed-off-by: Christopher Braga <[email protected]>
Christopher Braga 6 years ago
parent
commit
a09ee5a065
1 changed files with 12 additions and 7 deletions
  1. 12 7
      msm/sde_hdcp_2x.c

+ 12 - 7
msm/sde_hdcp_2x.c

@@ -193,10 +193,7 @@ static int sde_hdcp_2x_get_next_message(struct sde_hdcp_2x_ctrl *hdcp,
 	case REP_SEND_RECV_ID_LIST:
 		return REP_SEND_ACK;
 	case REP_STREAM_MANAGE:
-		if (hdcp->resend_stream_manage)
-			return REP_STREAM_MANAGE;
-		else
-			return REP_STREAM_READY;
+		return REP_STREAM_READY;
 	default:
 		pr_err("Unknown message ID (%d)\n", hdcp->last_msg);
 		return -EINVAL;
@@ -406,6 +403,12 @@ static void sde_hdcp_2x_query_stream(struct sde_hdcp_2x_ctrl *hdcp)
 		return;
 	}
 
+	if (!hdcp->authenticated &&
+			hdcp->app_data.response.data[0] != REP_SEND_ACK) {
+		pr_debug("invalid state. HDCP repeater not authenticated\n");
+		return;
+	}
+
 	rc = hdcp2_app_comm(hdcp->hdcp2_ctx, HDCP2_CMD_QUERY_STREAM,
 			&hdcp->app_data);
 	if (rc)
@@ -420,8 +423,11 @@ static void sde_hdcp_2x_query_stream(struct sde_hdcp_2x_ctrl *hdcp)
 	pr_debug("[tz]: %s\n", sde_hdcp_2x_message_name(
 		hdcp->app_data.response.data[0]));
 exit:
-	if (!rc && !atomic_read(&hdcp->hdcp_off))
+	if (!rc && !atomic_read(&hdcp->hdcp_off)) {
+		/* Modify last message to ensure the proper message is sent */
+		hdcp->last_msg = REP_SEND_ACK;
 		sde_hdcp_2x_send_message(hdcp);
+	}
 }
 
 static void sde_hdcp_2x_initialize_command(struct sde_hdcp_2x_ctrl *hdcp,
@@ -624,9 +630,8 @@ static void sde_hdcp_2x_msg_recvd(struct sde_hdcp_2x_ctrl *hdcp)
 	if (msg[0] == LC_SEND_L_PRIME && out_msg == LC_INIT)
 		hdcp->resend_lc_init = true;
 
-	hdcp->resend_stream_manage = false;
 	if (msg[0] == REP_STREAM_READY && out_msg == REP_STREAM_MANAGE)
-		hdcp->resend_stream_manage = true;
+		pr_debug("resend %s\n", sde_hdcp_2x_message_name(out_msg));
 
 	if (out_msg == AKE_NO_STORED_KM)
 		hdcp->no_stored_km = true;