diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2018-10-26 00:09:47 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-10-26 00:09:46 -0700 |
| commit | e3ef3fd9863ed7dda8271933ac65c6eba8151fbd (patch) | |
| tree | 38dbbcded2b0d269a72668c964c726fab9318b4b | |
| parent | 3e4e8be646d38792e689362a10981d383932c080 (diff) | |
| parent | f311037a137ccc47477c18804e4f32e91ad46876 (diff) | |
Merge "drivers/misc: ignore minimum encryption level change for stream type 1"
| -rw-r--r-- | drivers/misc/hdcp.c | 74 |
1 files changed, 51 insertions, 23 deletions
diff --git a/drivers/misc/hdcp.c b/drivers/misc/hdcp.c index 8dd9ba018f3b..cc11ede6a456 100644 --- a/drivers/misc/hdcp.c +++ b/drivers/misc/hdcp.c @@ -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 @@ -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 @@ -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 } }; @@ -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; @@ -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; @@ -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 @@ -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; @@ -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) { @@ -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); @@ -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) { @@ -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"); @@ -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); |
