Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f311037a authored by Abhinav Kumar's avatar Abhinav Kumar
Browse files

drivers/misc: ignore minimum encryption level change for stream type 1



If the HDCP repeater is already authenticated with a stream type 1
ignore subsequent writes to change minimum encryption level.

This shall ensure that there are no transitions to other encryption
levels in the middle of a secure playback and thus avoid any
visual artifacts in case of re-authentication.

Change-Id: I8496c0a82101df4dcc5234e2afd5a2fe11a5eabd
Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
parent 35f5c94d
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@
#define SKE_SEND_EKS_MESSAGE_SIZE \
	(MESSAGE_ID_SIZE+BITS_128_IN_BYTES+BITS_64_IN_BYTES)

#define HDCP2_0_REPEATER_DOWNSTREAM BIT(1)
#define HDCP1_DEVICE_DOWNSTREAM BIT(0)

/* all message IDs */
#define INVALID_MESSAGE_ID               0
#define AKE_INIT_MESSAGE_ID              2
@@ -552,6 +555,7 @@ struct hdcp_lib_handle {
	enum hdcp_state hdcp_state;
	enum hdcp_lib_wakeup_cmd wakeup_cmd;
	bool repeater_flag;
	bool non_2p2_present;
	bool update_stream;
	bool tethered;
	struct qseecom_handle *qseecom_handle;
@@ -1791,6 +1795,7 @@ static int hdcp_lib_wakeup_thread(struct hdcp_lib_wakeup_data *data)
	case HDCP_LIB_WKUP_CMD_START:
		handle->no_stored_km_flag = 0;
		handle->repeater_flag = false;
		handle->non_2p2_present = false;
		handle->update_stream = false;
		handle->last_msg_sent = 0;
		handle->last_msg = INVALID_MESSAGE_ID;
@@ -2192,6 +2197,14 @@ static void hdcp_lib_msg_recvd(struct hdcp_lib_handle *handle)
				  QSEECOM_ALIGN(sizeof
						(struct hdcp_rcvd_msg_rsp)));

	if (msg[0] == REP_SEND_RECV_ID_LIST_ID) {
		if ((msg[2] & HDCP2_0_REPEATER_DOWNSTREAM) ||
		   (msg[2] & HDCP1_DEVICE_DOWNSTREAM))
			handle->non_2p2_present = true;
		else
			handle->non_2p2_present = false;
	}

	/* get next message from sink if we receive H PRIME on no store km */
	if ((msg[0] == AKE_SEND_H_PRIME_MESSAGE_ID) &&
	    handle->no_stored_km_flag) {
@@ -2818,6 +2831,20 @@ static ssize_t hdmi_hdcp2p2_sysfs_wta_min_level_change(struct device *dev,

	handle = hdcp_drv_mgr->handle;

	/*
	 * if the stream type from TZ is type 1
	 * ignore subsequent writes to the min_enc_level
	 * to avoid state transitions which can potentially
	 * cause visual artifacts because the stream type
	 * is already at the highest level and for a HDCP 2.2
	 * capable sink, we do not need to reduce the stream type
	 */
	if (handle &&
		!handle->non_2p2_present) {
		pr_info("stream type is 1 returning\n");
		return ret;
	}

	rc = kstrtoint(buf, 10, &min_enc_lvl);
	if (rc) {
		pr_err("%s: kstrtoint failed. rc=%d\n", __func__, rc);