msm: mdss: hdcp2p2: do not process interrupts in failed state

Interrupts from sinks (cp_irq) may come asynchronously at different
states for HDCP authentications. In case HDCP has failed and an
interrupt is received from sink, do not process it to avoid getting
unnecessary failures.

Change-Id: I00b0d45fdbdc3d43ac49908db66573d6d4b58283
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
This commit is contained in:
Ajay Singh Parmar 2017-01-09 15:27:51 -08:00
parent efaccb4adb
commit 19b7c1036c
2 changed files with 32 additions and 12 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -805,8 +805,8 @@ static int hdcp_lib_get_version(struct hdcp_lib_handle *handle)
goto exit; goto exit;
} }
if (handle->hdcp_state & HDCP_STATE_APP_LOADED) { if (!(handle->hdcp_state & HDCP_STATE_APP_LOADED)) {
pr_err("library already loaded\n"); pr_err("library not loaded\n");
return rc; return rc;
} }
@ -901,8 +901,8 @@ static int hdcp_app_init_legacy(struct hdcp_lib_handle *handle)
goto exit; goto exit;
} }
if (handle->hdcp_state & HDCP_STATE_APP_LOADED) { if (!(handle->hdcp_state & HDCP_STATE_APP_LOADED)) {
pr_err("library already loaded\n"); pr_err("library not loaded\n");
goto exit; goto exit;
} }
@ -949,8 +949,8 @@ static int hdcp_app_init(struct hdcp_lib_handle *handle)
goto exit; goto exit;
} }
if (handle->hdcp_state & HDCP_STATE_APP_LOADED) { if (!(handle->hdcp_state & HDCP_STATE_APP_LOADED)) {
pr_err("library already loaded\n"); pr_err("library not loaded\n");
goto exit; goto exit;
} }
@ -1024,6 +1024,7 @@ static int hdcp_lib_library_load(struct hdcp_lib_handle *handle)
goto exit; goto exit;
} }
handle->hdcp_state |= HDCP_STATE_APP_LOADED;
pr_debug("qseecom_start_app success\n"); pr_debug("qseecom_start_app success\n");
rc = hdcp_lib_get_version(handle); rc = hdcp_lib_get_version(handle);
@ -1050,8 +1051,6 @@ static int hdcp_lib_library_load(struct hdcp_lib_handle *handle)
pr_err("app init failed\n"); pr_err("app init failed\n");
goto exit; goto exit;
} }
handle->hdcp_state |= HDCP_STATE_APP_LOADED;
exit: exit:
return rc; return rc;
} }
@ -1240,8 +1239,8 @@ static int hdcp_lib_txmtr_init(struct hdcp_lib_handle *handle)
goto exit; goto exit;
} }
if (handle->hdcp_state & HDCP_STATE_TXMTR_INIT) { if (!(handle->hdcp_state & HDCP_STATE_APP_LOADED)) {
pr_err("txmtr already initialized\n"); pr_err("library not loaded\n");
goto exit; goto exit;
} }
@ -1622,6 +1621,12 @@ static int hdcp_lib_check_valid_state(struct hdcp_lib_handle *handle)
rc = -EBUSY; rc = -EBUSY;
goto exit; goto exit;
} }
if (handle->hdcp_state & HDCP_STATE_APP_LOADED) {
pr_debug("library already loaded\n");
rc = -EBUSY;
goto exit;
}
} else { } else {
if (atomic_read(&handle->hdcp_off)) { if (atomic_read(&handle->hdcp_off)) {
pr_debug("hdcp2.2 session tearing down\n"); pr_debug("hdcp2.2 session tearing down\n");

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -370,6 +370,8 @@ static void dp_hdcp2p2_auth_failed(struct dp_hdcp2p2_ctrl *ctrl)
dp_hdcp2p2_set_interrupts(ctrl, false); dp_hdcp2p2_set_interrupts(ctrl, false);
atomic_set(&ctrl->auth_state, HDCP_STATE_AUTH_FAIL);
/* notify DP about HDCP failure */ /* notify DP about HDCP failure */
ctrl->init_data.notify_status(ctrl->init_data.cb_data, ctrl->init_data.notify_status(ctrl->init_data.cb_data,
HDCP_STATE_AUTH_FAIL); HDCP_STATE_AUTH_FAIL);
@ -625,6 +627,12 @@ static void dp_hdcp2p2_link_work(struct kthread_work *work)
return; return;
} }
if (atomic_read(&ctrl->auth_state) == HDCP_STATE_AUTH_FAIL ||
atomic_read(&ctrl->auth_state) == HDCP_STATE_INACTIVE) {
pr_err("invalid hdcp state\n");
return;
}
cdata.context = ctrl->lib_ctx; cdata.context = ctrl->lib_ctx;
if (ctrl->sink_rx_status & ctrl->abort_mask) { if (ctrl->sink_rx_status & ctrl->abort_mask) {
@ -685,6 +693,13 @@ static int dp_hdcp2p2_cp_irq(void *input)
return -EINVAL; return -EINVAL;
} }
if (atomic_read(&ctrl->auth_state) == HDCP_STATE_AUTH_FAIL ||
atomic_read(&ctrl->auth_state) == HDCP_STATE_INACTIVE) {
pr_err("invalid hdcp state\n");
rc = -EINVAL;
goto error;
}
ctrl->sink_rx_status = 0; ctrl->sink_rx_status = 0;
rc = mdss_dp_aux_read_rx_status(ctrl->init_data.cb_data, rc = mdss_dp_aux_read_rx_status(ctrl->init_data.cb_data,
&ctrl->sink_rx_status); &ctrl->sink_rx_status);