summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjay Singh Parmar <aparmar@codeaurora.org>2015-11-22 18:06:34 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:14:11 -0700
commitb3e68382ffcfdff0dbbdc9d3cc06f8132c014e65 (patch)
tree9bffde2ca902769d92333e537f5320f2c0ed5792
parent178d4d6f8b7920e8038de802a2c0cfd2a66df39a (diff)
msm: mdss: hdmi: add dynamic encryption enable support
Implement qseecomm API to send command to TZ to enable/disable encryption based on hdcp status. Enable encryption when hdcp part 1 is successful and disable it when cable is disconnected or authentication fails. Change-Id: Ia5e1a5927dad36abc3093b16638879be823c84df Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>
-rw-r--r--drivers/misc/hdcp.c46
-rw-r--r--drivers/video/fbdev/msm/mdss_hdmi_tx.c8
-rw-r--r--include/linux/hdcp_qseecom.h1
3 files changed, 55 insertions, 0 deletions
diff --git a/drivers/misc/hdcp.c b/drivers/misc/hdcp.c
index 66b1135fe855..45638e4fcbcf 100644
--- a/drivers/misc/hdcp.c
+++ b/drivers/misc/hdcp.c
@@ -64,6 +64,7 @@
#define REPEATER_AUTH_STREAM_MANAGE_MESSAGE_ID 16
#define REPEATER_AUTH_STREAM_READY_MESSAGE_ID 17
#define HDCP1_SET_KEY_MESSAGE_ID 202
+#define HDCP1_SET_ENC_MESSAGE_ID 205
#define BITS_8_IN_BYTES 1
#define BITS_16_IN_BYTES 2
@@ -316,6 +317,16 @@ struct __attribute__ ((__packed__)) repeater_info_struct {
uint32_t ReceiverIDListLen;
};
+struct __attribute__ ((__packed__)) hdcp1_set_enc_req {
+ uint32_t commandid;
+ uint32_t enable;
+};
+
+struct __attribute__ ((__packed__)) hdcp1_set_enc_rsp {
+ uint32_t commandid;
+ uint32_t ret;
+};
+
/*
* struct hdcp_lib_handle - handle for hdcp client
* @qseecom_handle - for sending commands to qseecom
@@ -1362,6 +1373,41 @@ int hdcp1_set_keys(uint32_t *aksv_msb, uint32_t *aksv_lsb)
return 0;
}
+int hdcp1_set_enc(bool enable)
+{
+ int rc = 0;
+ struct hdcp1_set_enc_req *set_enc_req;
+ struct hdcp1_set_enc_rsp *set_enc_rsp;
+
+ if (!hdcp1_supported || !hdcp1_handle)
+ return -EINVAL;
+
+ /* set keys and request aksv */
+ set_enc_req = (struct hdcp1_set_enc_req *)hdcp1_handle->sbuf;
+ set_enc_req->commandid = HDCP1_SET_ENC_MESSAGE_ID;
+ set_enc_req->enable = enable;
+ set_enc_rsp = (struct hdcp1_set_enc_rsp *)(hdcp1_handle->sbuf +
+ QSEECOM_ALIGN(sizeof(struct hdcp1_set_enc_req)));
+ rc = qseecom_send_command(hdcp1_handle,
+ set_enc_req, QSEECOM_ALIGN(sizeof(struct hdcp1_set_enc_req)),
+ set_enc_rsp, QSEECOM_ALIGN(sizeof(struct hdcp1_set_enc_rsp)));
+
+ if (rc < 0) {
+ pr_err("qseecom cmd failed err=%d\n", rc);
+ return -EINVAL;
+ }
+
+ rc = set_enc_rsp->ret;
+ if (rc) {
+ pr_err("enc cmd failed, rsp=%d\n",
+ set_enc_rsp->ret);
+ return -EINVAL;
+ }
+
+ pr_debug("success\n");
+ return 0;
+}
+
int hdcp_library_register(struct hdcp_register_data *data)
{
int rc = 0;
diff --git a/drivers/video/fbdev/msm/mdss_hdmi_tx.c b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
index ed66718c5e5c..71763ef74caf 100644
--- a/drivers/video/fbdev/msm/mdss_hdmi_tx.c
+++ b/drivers/video/fbdev/msm/mdss_hdmi_tx.c
@@ -1359,8 +1359,16 @@ static void hdmi_tx_hdcp_cb_work(struct work_struct *work)
rc = hdmi_tx_config_avmute(hdmi_ctrl, false);
hdmi_tx_set_audio_switch_node(hdmi_ctrl, 1);
}
+
+ if (hdmi_ctrl->hdcp1_use_sw_keys && hdmi_ctrl->hdcp14_present)
+ hdcp1_set_enc(true);
break;
case HDCP_STATE_AUTH_FAIL:
+ if (hdmi_ctrl->hdcp1_use_sw_keys && hdmi_ctrl->hdcp14_present) {
+ if (hdmi_ctrl->auth_state)
+ hdcp1_set_enc(false);
+ }
+
hdmi_ctrl->auth_state = false;
if (hdmi_tx_is_encryption_set(hdmi_ctrl) ||
diff --git a/include/linux/hdcp_qseecom.h b/include/linux/hdcp_qseecom.h
index ab39126b41ef..33b02c6fb066 100644
--- a/include/linux/hdcp_qseecom.h
+++ b/include/linux/hdcp_qseecom.h
@@ -117,5 +117,6 @@ int hdcp_library_register(struct hdcp_register_data *data);
void hdcp_library_deregister(void *phdcpcontext);
bool hdcp1_check_if_supported_load_app(void);
int hdcp1_set_keys(uint32_t *aksv_msb, uint32_t *aksv_lsb);
+int hdcp1_set_enc(bool enable);
#endif /* __HDCP_QSEECOM_H */