Browse Source

disp: msm: hdcp: force encryption for HDCP 1.3 compliance

Force encryption for HDCP 1.3 compliance or HDMI use cases only
since DisplayPort supports dynamic encryption enable.

Change-Id: Ice0f462188e4cc96597a4779a6daca7877e36b6c
Signed-off-by: Tatenda Chipeperekwa <[email protected]>
Tatenda Chipeperekwa 6 years ago
parent
commit
bd8fff4f9f
2 changed files with 26 additions and 5 deletions
  1. 2 1
      msm/dp/dp_display.c
  2. 24 4
      msm/sde_hdcp_1x.c

+ 2 - 1
msm/dp/dp_display.c

@@ -348,7 +348,8 @@ static void dp_display_hdcp_cb_work(struct work_struct *work)
 
 	dp_display_update_hdcp_status(dp, false);
 
-	if (dp->debug->force_encryption && ops && ops->force_encryption)
+	if (status->hdcp_state != HDCP_STATE_AUTHENTICATED &&
+		dp->debug->force_encryption && ops && ops->force_encryption)
 		ops->force_encryption(data, dp->debug->force_encryption);
 
 	switch (status->hdcp_state) {

+ 24 - 4
msm/sde_hdcp_1x.c

@@ -206,6 +206,7 @@ struct sde_hdcp_1x {
 	bool sink_r0_ready;
 	bool reauth;
 	bool ksv_ready;
+	bool force_encryption;
 	enum sde_hdcp_state hdcp_state;
 	struct HDCP_V2V1_MSG_TOPOLOGY current_tp;
 	struct delayed_work hdcp_auth_work;
@@ -1067,10 +1068,13 @@ static void sde_hdcp_1x_auth_work(struct work_struct *work)
 	}
 
 	/*
-	 * program hw to enable encryption as soon as
-	 * authentication is successful.
+	 * Program h/w to enable encryption as soon as authentication is
+	 * successful. This is applicable for HDMI sinks and HDCP 1.x compliance
+	 * test cases.
 	 */
-	hdcp1_set_enc(hdcp->hdcp1_handle, true);
+	if (hdcp->init_data.client_id == HDCP_CLIENT_HDMI ||
+			hdcp->force_encryption)
+		hdcp1_set_enc(hdcp->hdcp1_handle, true);
 
 	rc = sde_hdcp_1x_authentication_part1(hdcp);
 	if (rc)
@@ -1224,7 +1228,9 @@ static void sde_hdcp_1x_off(void *input)
 		pr_debug("%s: Deleted hdcp auth work\n",
 			SDE_HDCP_STATE_NAME);
 
-	hdcp1_set_enc(hdcp->hdcp1_handle, false);
+	if (hdcp->init_data.client_id == HDCP_CLIENT_HDMI ||
+			hdcp->force_encryption)
+		hdcp1_set_enc(hdcp->hdcp1_handle, false);
 
 	reg = DSS_REG_R(io, reg_set->reset);
 	DSS_REG_W(io, reg_set->reset, reg | reg_set->reset_bit);
@@ -1353,6 +1359,18 @@ static bool sde_hdcp_1x_feature_supported(void *input)
 	return feature_supported;
 }
 
+static void sde_hdcp_1x_force_encryption(void *input, bool enable)
+{
+	struct sde_hdcp_1x *hdcp = (struct sde_hdcp_1x *)input;
+
+	if (!hdcp) {
+		pr_err("invalid input\n");
+		return;
+	}
+	hdcp->force_encryption = enable;
+	pr_info("force_encryption=%d\n", hdcp->force_encryption);
+}
+
 static bool sde_hdcp_1x_sink_support(void *input)
 {
 	return true;
@@ -1476,6 +1494,7 @@ void *sde_hdcp_1x_init(struct sde_hdcp_init_data *init_data)
 		.reauthenticate = sde_hdcp_1x_reauthenticate,
 		.authenticate = sde_hdcp_1x_authenticate,
 		.feature_supported = sde_hdcp_1x_feature_supported,
+		.force_encryption = sde_hdcp_1x_force_encryption,
 		.sink_support = sde_hdcp_1x_sink_support,
 		.off = sde_hdcp_1x_off
 	};
@@ -1520,6 +1539,7 @@ void *sde_hdcp_1x_init(struct sde_hdcp_init_data *init_data)
 	hdcp->hdcp_state = HDCP_STATE_INACTIVE;
 	init_completion(&hdcp->r0_checked);
 	init_completion(&hdcp->sink_r0_available);
+	hdcp->force_encryption = false;
 
 	pr_debug("HDCP module initialized. HDCP_STATE=%s\n",
 		SDE_HDCP_STATE_NAME);