Loading drivers/misc/hdcp.c +51 −23 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -67,10 +70,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 Loading Loading @@ -195,18 +198,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 } }; Loading Loading @@ -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; Loading Loading @@ -684,19 +688,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; Loading @@ -716,7 +720,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 Loading Loading @@ -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; Loading Loading @@ -1898,7 +1903,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) { Loading Loading @@ -2033,12 +2038,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); Loading Loading @@ -2191,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) { Loading @@ -2202,7 +2216,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"); Loading Loading @@ -2817,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); Loading Loading
drivers/misc/hdcp.c +51 −23 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -67,10 +70,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 Loading Loading @@ -195,18 +198,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 } }; Loading Loading @@ -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; Loading Loading @@ -684,19 +688,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; Loading @@ -716,7 +720,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 Loading Loading @@ -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; Loading Loading @@ -1898,7 +1903,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) { Loading Loading @@ -2033,12 +2038,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); Loading Loading @@ -2191,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) { Loading @@ -2202,7 +2216,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"); Loading Loading @@ -2817,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); Loading