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>
This commit is contained in:
parent
178d4d6f8b
commit
b3e68382ff
3 changed files with 55 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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) ||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue