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

Commit 35f5c94d authored by Abhinav Kumar's avatar Abhinav Kumar
Browse files

drivers/misc: attempt to resend RepeaterAuth_Stream_Manage message



Currently when we timeout while waiting to receive
an RepeaterAuth_Stream_Ready from the repeater when
we transmit the RepeaterAuth_Stream_Manage message,
we do not attempt to resend it with an incremented
sequence number as required by the HDCP 2.2 specification.

Add logic to resend the message till a timeout happens
after exceeding certain number of retries.

Signed-off-by: default avatarAbhinav Kumar <abhinavk@codeaurora.org>
Change-Id: I4ab0f5f08784790cb04189ac68251178b2416197
parent 877444c9
Loading
Loading
Loading
Loading
+24 −23
Original line number Diff line number Diff line
@@ -67,10 +67,10 @@
#define LC_INIT_MESSAGE_ID               9
#define LC_SEND_L_PRIME_MESSAGE_ID      10
#define SKE_SEND_EKS_MESSAGE_ID         11
#define REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID 12
#define REPEATER_AUTH_SEND_ACK_MESSAGE_ID      15
#define REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID 16
#define REPEATER_AUTH_STREAM_READY_MESSAGE_ID  17
#define REP_SEND_RECV_ID_LIST_ID 12
#define REP_SEND_ACK_ID      15
#define REP_STREAM_MANAGE_ID     16
#define REP_STREAM_READY_ID  17
#define SKE_SEND_TYPE_ID                       18
#define HDCP2P2_MAX_MESSAGES                   19

@@ -195,18 +195,18 @@ static const struct hdcp_msg_data hdcp_msg_lookup[HDCP2P2_MAX_MESSAGES] = {
	[SKE_SEND_TYPE_ID] = { 1,
		{ {"type", 0x69494, 1} },
		0 },
	[REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID] = { 4,
	[REP_SEND_RECV_ID_LIST_ID] = { 4,
		{ {"RxInfo", 0x69330, 2}, {"seq_num_V", 0x69332, 3},
			{"V'", 0x69335, 16}, {"ridlist", 0x69345, 155} },
		(1 << 0) },
	[REPEATER_AUTH_SEND_ACK_MESSAGE_ID] = { 1,
	[REP_SEND_ACK_ID] = { 1,
		{ {"V", 0x693E0, 16} },
		0 },
	[REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID] = { 3,
	[REP_STREAM_MANAGE_ID] = { 3,
		{ {"seq_num_M", 0x693F0, 3}, {"k", 0x693F3, 2},
			{"streamID_Type", 0x693F5, 126} },
		0 },
	[REPEATER_AUTH_STREAM_READY_MESSAGE_ID] = { 1,
	[REP_STREAM_READY_ID] = { 1,
		{ {"M'", 0x69473, 32} },
		0 }
};
@@ -684,19 +684,19 @@ static int hdcp_lib_get_next_message(struct hdcp_lib_handle *handle,
			handle->device_type == HDCP_TXMTR_DP)
			return SKE_SEND_TYPE_ID;
	case SKE_SEND_TYPE_ID:
	case REPEATER_AUTH_STREAM_READY_MESSAGE_ID:
	case REPEATER_AUTH_SEND_ACK_MESSAGE_ID:
	case REP_STREAM_READY_ID:
	case REP_SEND_ACK_ID:
		if (!handle->repeater_flag)
			return INVALID_MESSAGE_ID;

		if (data->cmd == HDMI_HDCP_WKUP_CMD_SEND_MESSAGE)
			return REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID;
			return REP_STREAM_MANAGE_ID;
		else
			return REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID;
	case REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID:
		return REPEATER_AUTH_SEND_ACK_MESSAGE_ID;
	case REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID:
		return REPEATER_AUTH_STREAM_READY_MESSAGE_ID;
			return REP_SEND_RECV_ID_LIST_ID;
	case REP_SEND_RECV_ID_LIST_ID:
		return REP_SEND_ACK_ID;
	case REP_STREAM_MANAGE_ID:
		return REP_STREAM_READY_ID;
	default:
		pr_err("Uknown message ID (%d)", handle->last_msg);
		return -EINVAL;
@@ -716,7 +716,7 @@ static void hdcp_lib_wait_for_response(struct hdcp_lib_handle *handle,
	case AKE_SEND_PAIRING_INFO_MESSAGE_ID:
		handle->wait_timeout = HZ / 4;
		break;
	case REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID:
	case REP_SEND_RECV_ID_LIST_ID:
		if (!handle->authenticated)
			handle->wait_timeout = HZ * 3;
		else
@@ -1898,7 +1898,7 @@ static void hdcp_lib_msg_sent(struct hdcp_lib_handle *handle)
			cdata.cmd = HDMI_HDCP_WKUP_CMD_LINK_POLL;
		}
		break;
	case REPEATER_AUTH_SEND_ACK_MESSAGE_ID:
	case REP_SEND_ACK_ID:
		pr_debug("Repeater authentication successful\n");

		if (handle->update_stream) {
@@ -2033,12 +2033,13 @@ static void hdcp_lib_timeout(struct hdcp_lib_handle *handle)
	}

	/*
	 * if the response contains LC_Init message
	 * send the message again to TZ
	 * if the response contains LC_Init OR RepeaterAuth_Stream_Manage
	 * message send the message again to the sink as this means that
	 * TZ would like to try again
	 */
	if ((rsp_buf->commandid == HDCP_TXMTR_PROCESS_RECEIVED_MESSAGE) &&
	    ((int)rsp_buf->message[0] == LC_INIT_MESSAGE_ID) &&
	    (rsp_buf->msglen == LC_INIT_MESSAGE_SIZE)) {
	    ((int)rsp_buf->message[0] == LC_INIT_MESSAGE_ID ||
		 (int)rsp_buf->message[0] == REP_STREAM_MANAGE_ID)) {
		if (!atomic_read(&handle->hdcp_off)) {
			/* keep local copy of TZ response */
			memset(handle->listener_buf, 0, MAX_TX_MESSAGE_SIZE);
@@ -2202,7 +2203,7 @@ static void hdcp_lib_msg_recvd(struct hdcp_lib_handle *handle)
		goto exit;
	}

	if ((msg[0] == REPEATER_AUTH_STREAM_READY_MESSAGE_ID) &&
	if ((msg[0] == REP_STREAM_READY_ID) &&
	    (rc == 0) && (rsp_buf->status == 0)) {
		pr_debug("Got Auth_Stream_Ready, nothing sent to rx\n");