msm: mdss: hdcp2p2: optimize aux message read and write
hdcp 2.2 message has multiple parts with different addresses. Currently, each address is read/written as a separate aux transactions. As, for a particular message, all parts are read/written contiguously, make single aux transaction instead of multiple transactions to avoid unnecessary aux delays. Change-Id: I284bc56aa94eef127c2bdd0f80aab7b0cf080342 Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
This commit is contained in:
parent
01cb3026c6
commit
dc10995a1b
3 changed files with 45 additions and 53 deletions
|
@ -160,43 +160,46 @@
|
|||
|
||||
static const struct hdcp_msg_data hdcp_msg_lookup[HDCP2P2_MAX_MESSAGES] = {
|
||||
[AKE_INIT_MESSAGE_ID] = { 2,
|
||||
{ {0x69000, 8}, {0x69008, 3} },
|
||||
{ {"rtx", 0x69000, 8}, {"TxCaps", 0x69008, 3} },
|
||||
0 },
|
||||
[AKE_SEND_CERT_MESSAGE_ID] = { 3,
|
||||
{ {0x6900B, 522}, {0x69215, 8}, {0x6921D, 3} },
|
||||
{ {"cert-rx", 0x6900B, 522}, {"rrx", 0x69215, 8},
|
||||
{"RxCaps", 0x6921D, 3} },
|
||||
0 },
|
||||
[AKE_NO_STORED_KM_MESSAGE_ID] = { 1,
|
||||
{ {0x69220, 128} },
|
||||
{ {"Ekpub_km", 0x69220, 128} },
|
||||
0 },
|
||||
[AKE_STORED_KM_MESSAGE_ID] = { 2,
|
||||
{ {0x692A0, 16}, {0x692B0, 16} },
|
||||
{ {"Ekh_km", 0x692A0, 16}, {"m", 0x692B0, 16} },
|
||||
0 },
|
||||
[AKE_SEND_H_PRIME_MESSAGE_ID] = { 1,
|
||||
{ {0x692C0, 32} },
|
||||
{ {"H'", 0x692C0, 32} },
|
||||
(1 << 1) },
|
||||
[AKE_SEND_PAIRING_INFO_MESSAGE_ID] = { 1,
|
||||
{ {0x692E0, 16} },
|
||||
{ {"Ekh_km", 0x692E0, 16} },
|
||||
(1 << 2) },
|
||||
[LC_INIT_MESSAGE_ID] = { 1,
|
||||
{ {0x692F0, 8} },
|
||||
{ {"rn", 0x692F0, 8} },
|
||||
0 },
|
||||
[LC_SEND_L_PRIME_MESSAGE_ID] = { 1,
|
||||
{ {0x692F8, 32} },
|
||||
{ {"L'", 0x692F8, 32} },
|
||||
0 },
|
||||
[SKE_SEND_EKS_MESSAGE_ID] = { 2,
|
||||
{ {0x69318, 16}, {0x69328, 8} },
|
||||
{ {"Edkey_ks", 0x69318, 16}, {"riv", 0x69328, 8} },
|
||||
0 },
|
||||
[REPEATER_AUTH_SEND_RECEIVERID_LIST_MESSAGE_ID] = { 4,
|
||||
{ {0x69330, 2}, {0x69332, 3}, {0x69335, 16}, {0x69345, 155} },
|
||||
{ {"RxInfo", 0x69330, 2}, {"seq_num_V", 0x69332, 3},
|
||||
{"V'", 0x69335, 16}, {"ridlist", 0x69345, 155} },
|
||||
(1 << 0) },
|
||||
[REPEATER_AUTH_SEND_ACK_MESSAGE_ID] = { 1,
|
||||
{ {0x693E0, 16} },
|
||||
{ {"V", 0x693E0, 16} },
|
||||
0 },
|
||||
[REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID] = { 3,
|
||||
{ {0x693F0, 3}, {0x693F3, 2}, {0x693F5, 126} },
|
||||
{ {"seq_num_M", 0x693F0, 3}, {"k", 0x693F3, 2},
|
||||
{"streamID_Type", 0x693F5, 126} },
|
||||
0 },
|
||||
[REPEATER_AUTH_STREAM_READY_MESSAGE_ID] = { 1,
|
||||
{ {0x69473, 32} },
|
||||
{ {"M'", 0x69473, 32} },
|
||||
0 }
|
||||
};
|
||||
|
||||
|
@ -648,11 +651,12 @@ static void hdcp_lib_wakeup_client(struct hdcp_lib_handle *handle,
|
|||
rx_status = data->message_data->rx_status;
|
||||
|
||||
pr_debug("rxstatus 0x%x\n", rx_status);
|
||||
pr_debug("%6s | %4s\n", "offset", "len");
|
||||
pr_debug("%10s | %6s | %4s\n", "name", "offset", "len");
|
||||
|
||||
for (i = 0; i < msg_num; i++)
|
||||
pr_debug("%6x | %4d\n",
|
||||
msg[i].offset, msg[i].length);
|
||||
pr_debug("%10s | %6x | %4d\n",
|
||||
msg[i].name, msg[i].offset,
|
||||
msg[i].length);
|
||||
}
|
||||
} else {
|
||||
pr_debug("lib->client: %s\n",
|
||||
|
@ -667,6 +671,7 @@ static void hdcp_lib_wakeup_client(struct hdcp_lib_handle *handle,
|
|||
|
||||
static inline void hdcp_lib_send_message(struct hdcp_lib_handle *handle)
|
||||
{
|
||||
char msg_name[50];
|
||||
struct hdmi_hdcp_wakeup_data cdata = {
|
||||
HDMI_HDCP_WKUP_CMD_SEND_MESSAGE
|
||||
};
|
||||
|
@ -676,6 +681,13 @@ static inline void hdcp_lib_send_message(struct hdcp_lib_handle *handle)
|
|||
cdata.send_msg_len = handle->msglen;
|
||||
cdata.timeout = handle->hdcp_timeout;
|
||||
|
||||
snprintf(msg_name, sizeof(msg_name), "%s: ",
|
||||
hdcp_lib_message_name((int)cdata.send_msg_buf[0]));
|
||||
|
||||
print_hex_dump(KERN_DEBUG, msg_name,
|
||||
DUMP_PREFIX_NONE, 16, 1, cdata.send_msg_buf,
|
||||
cdata.send_msg_len, false);
|
||||
|
||||
hdcp_lib_wakeup_client(handle, &cdata);
|
||||
}
|
||||
|
||||
|
@ -2016,13 +2028,8 @@ static void hdcp_lib_msg_recvd(struct hdcp_lib_handle *handle)
|
|||
handle->hdcp_timeout = rsp_buf->timeout;
|
||||
handle->msglen = rsp_buf->msglen;
|
||||
|
||||
if (!atomic_read(&handle->hdcp_off)) {
|
||||
cdata.cmd = HDMI_HDCP_WKUP_CMD_SEND_MESSAGE;
|
||||
cdata.send_msg_buf = handle->listener_buf;
|
||||
cdata.send_msg_len = handle->msglen;
|
||||
cdata.timeout = handle->hdcp_timeout;
|
||||
}
|
||||
|
||||
if (!atomic_read(&handle->hdcp_off))
|
||||
hdcp_lib_send_message(handle);
|
||||
exit:
|
||||
kzfree(msg);
|
||||
|
||||
|
|
|
@ -425,12 +425,9 @@ end:
|
|||
static void dp_hdcp2p2_send_msg_work(struct kthread_work *work)
|
||||
{
|
||||
int rc = 0;
|
||||
int i;
|
||||
int sent_bytes = 0;
|
||||
struct dp_hdcp2p2_ctrl *ctrl = container_of(work,
|
||||
struct dp_hdcp2p2_ctrl, send_msg);
|
||||
struct hdcp_lib_wakeup_data cdata = {HDCP_LIB_WKUP_CMD_INVALID};
|
||||
char *buf = NULL;
|
||||
|
||||
if (!ctrl) {
|
||||
pr_err("invalid input\n");
|
||||
|
@ -447,20 +444,13 @@ static void dp_hdcp2p2_send_msg_work(struct kthread_work *work)
|
|||
|
||||
mutex_lock(&ctrl->msg_lock);
|
||||
|
||||
/* Loop through number of parameters in the messages. */
|
||||
for (i = 0; i < ctrl->num_messages; i++) {
|
||||
buf = ctrl->msg_buf + sent_bytes;
|
||||
|
||||
/* Forward the message to the sink */
|
||||
rc = dp_hdcp2p2_aux_write_message(ctrl, buf,
|
||||
(size_t)ctrl->msg_part[i].length,
|
||||
ctrl->msg_part[i].offset, ctrl->timeout);
|
||||
if (rc) {
|
||||
pr_err("Error sending msg to sink %d\n", rc);
|
||||
mutex_unlock(&ctrl->msg_lock);
|
||||
goto exit;
|
||||
}
|
||||
sent_bytes += ctrl->msg_part[i].length;
|
||||
rc = dp_hdcp2p2_aux_write_message(ctrl, ctrl->msg_buf,
|
||||
ctrl->send_msg_len, ctrl->msg_part->offset,
|
||||
ctrl->timeout);
|
||||
if (rc) {
|
||||
pr_err("Error sending msg to sink %d\n", rc);
|
||||
mutex_unlock(&ctrl->msg_lock);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cdata.cmd = HDCP_LIB_WKUP_CMD_MSG_SEND_SUCCESS;
|
||||
|
@ -478,10 +468,9 @@ exit:
|
|||
|
||||
static int dp_hdcp2p2_get_msg_from_sink(struct dp_hdcp2p2_ctrl *ctrl)
|
||||
{
|
||||
int i, rc = 0;
|
||||
int rc = 0;
|
||||
char *recvd_msg_buf = NULL;
|
||||
struct hdcp_lib_wakeup_data cdata = { HDCP_LIB_WKUP_CMD_INVALID };
|
||||
int bytes_read = 0;
|
||||
|
||||
cdata.context = ctrl->lib_ctx;
|
||||
|
||||
|
@ -491,17 +480,12 @@ static int dp_hdcp2p2_get_msg_from_sink(struct dp_hdcp2p2_ctrl *ctrl)
|
|||
goto exit;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctrl->num_messages; i++) {
|
||||
rc = dp_hdcp2p2_aux_read_message(
|
||||
ctrl, recvd_msg_buf + bytes_read,
|
||||
ctrl->msg_part[i].length,
|
||||
ctrl->msg_part[i].offset,
|
||||
ctrl->timeout);
|
||||
if (rc) {
|
||||
pr_err("error reading message %d\n", rc);
|
||||
goto exit;
|
||||
}
|
||||
bytes_read += ctrl->msg_part[i].length;
|
||||
rc = dp_hdcp2p2_aux_read_message(ctrl, recvd_msg_buf,
|
||||
ctrl->send_msg_len, ctrl->msg_part->offset,
|
||||
ctrl->timeout);
|
||||
if (rc) {
|
||||
pr_err("error reading message %d\n", rc);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cdata.recvd_msg_buf = recvd_msg_buf;
|
||||
|
|
|
@ -48,6 +48,7 @@ struct hdcp_lib_wakeup_data {
|
|||
};
|
||||
|
||||
struct hdcp_msg_part {
|
||||
char *name;
|
||||
uint32_t offset;
|
||||
uint32_t length;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue