Loading drivers/misc/hdcp_qseecom.c +130 −4 Original line number Diff line number Diff line Loading @@ -145,7 +145,8 @@ const char *HdcpErrors[] = { "HDCP_GET_CONTENT_LEVEL_FAILED", "HDCP_STREAMID_INUSE", "HDCP_STREAM_NOT_FOUND", "HDCP_FORCE_ENCRYPTION_FAILED" "HDCP_FORCE_ENCRYPTION_FAILED", "HDCP_STREAMNUMBER_INUSE" }; /* flags set by tz in response message */ Loading Loading @@ -216,6 +217,8 @@ enum { hdcp_cmd_session_init = SERVICE_CREATE_CMD(16), hdcp_cmd_session_deinit = SERVICE_CREATE_CMD(17), hdcp_cmd_start_auth = SERVICE_CREATE_CMD(18), hdcp_cmd_session_open_stream = SERVICE_CREATE_CMD(20), hdcp_cmd_session_close_stream = SERVICE_CREATE_CMD(21), hdcp_cmd_force_encryption = SERVICE_CREATE_CMD(22), }; Loading Loading @@ -488,6 +491,31 @@ struct __attribute__ ((__packed__)) hdcp_start_auth_rsp { uint8_t message[MAX_TX_MESSAGE_SIZE]; }; struct __attribute__((__packed__)) hdcp_session_open_stream_req { uint32_t commandid; uint32_t sessionid; uint32_t vcpayloadid; uint32_t stream_number; uint32_t streamMediaType; }; struct __attribute__((__packed__)) hdcp_session_open_stream_rsp { uint32_t status; uint32_t commandid; uint32_t streamid; }; struct __attribute__((__packed__)) hdcp_session_close_stream_req { uint32_t commandid; uint32_t sessionid; uint32_t streamid; }; struct __attribute__((__packed__)) hdcp_session_close_stream_rsp { uint32_t status; uint32_t commandid; }; struct __attribute__((__packed__)) hdcp_force_encryption_req { uint32_t commandid; uint32_t ctxhandle; Loading Loading @@ -1030,8 +1058,6 @@ static int hdcp2_app_process_msg(struct hdcp2_handle *handle) /* check if it's a repeater */ if (rsp_buf->flag == HDCP_TXMTR_SUBSTATE_WAITING_FOR_RECIEVERID_LIST) handle->app_data.repeater_flag = true; else handle->app_data.repeater_flag = false; handle->app_data.response.data = rsp_buf->msg; handle->app_data.response.length = rsp_buf->msglen; Loading Loading @@ -1205,6 +1231,106 @@ int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, return rc; } static int hdcp2_open_stream_helper(struct hdcp2_handle *handle, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { int rc = 0; hdcp2_app_init_var(session_open_stream); if (!(handle->hdcp_state & HDCP_STATE_SESSION_INIT)) { pr_err("session not initialized\n"); rc = -EINVAL; goto error; } if (!(handle->hdcp_state & HDCP_STATE_TXMTR_INIT)) { pr_err("txmtr not initialized\n"); rc = -EINVAL; goto error; } req_buf->sessionid = handle->session_id; req_buf->vcpayloadid = vc_payload_id; req_buf->stream_number = stream_number; req_buf->streamMediaType = 0; rc = hdcp2_app_process_cmd(session_open_stream); if (rc) goto error; *stream_id = rsp_buf->streamid; pr_debug("success\n"); error: return rc; } int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { struct hdcp2_handle *handle = NULL; if (!ctx) { pr_err("invalid input\n"); return -EINVAL; } handle = ctx; return hdcp2_open_stream_helper(handle, vc_payload_id, stream_number, stream_id); } static int hdcp2_close_stream_helper(struct hdcp2_handle *handle, uint32_t stream_id) { int rc = 0; hdcp2_app_init_var(session_close_stream); if (!(handle->hdcp_state & HDCP_STATE_SESSION_INIT)) { pr_err("session not initialized\n"); rc = -EINVAL; goto error; } if (!(handle->hdcp_state & HDCP_STATE_TXMTR_INIT)) { pr_err("txmtr not initialized\n"); rc = -EINVAL; goto error; } req_buf->sessionid = handle->session_id; req_buf->streamid = stream_id; rc = hdcp2_app_process_cmd(session_close_stream); if (rc) goto error; pr_debug("success\n"); error: return rc; } int hdcp2_close_stream(void *ctx, uint32_t stream_id) { struct hdcp2_handle *handle = NULL; if (!ctx) { pr_err("invalid input\n"); return -EINVAL; } handle = ctx; return hdcp2_close_stream_helper(handle, stream_id); } void *hdcp2_init(u32 device_type) { struct hdcp2_handle *handle = NULL; Loading include/linux/hdcp_qseecom.h +14 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ void hdcp2_deinit(void *ctx); bool hdcp2_feature_supported(void *ctx); int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, struct hdcp2_app_data *app_data); int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id); int hdcp2_close_stream(void *ctx, uint32_t stream_id); int hdcp2_force_encryption(void *ctx, uint32_t enable); #else static inline void *hdcp1_init(void) Loading Loading @@ -115,6 +118,17 @@ static inline int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, return 0; } static inline int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { return 0; } static inline int hdcp2_close_stream(void *ctx, uint32_t stream_id) { return 0; } static inline int hdcp2_force_encryption(void *ctx, uint32_t enable) { return 0; Loading Loading
drivers/misc/hdcp_qseecom.c +130 −4 Original line number Diff line number Diff line Loading @@ -145,7 +145,8 @@ const char *HdcpErrors[] = { "HDCP_GET_CONTENT_LEVEL_FAILED", "HDCP_STREAMID_INUSE", "HDCP_STREAM_NOT_FOUND", "HDCP_FORCE_ENCRYPTION_FAILED" "HDCP_FORCE_ENCRYPTION_FAILED", "HDCP_STREAMNUMBER_INUSE" }; /* flags set by tz in response message */ Loading Loading @@ -216,6 +217,8 @@ enum { hdcp_cmd_session_init = SERVICE_CREATE_CMD(16), hdcp_cmd_session_deinit = SERVICE_CREATE_CMD(17), hdcp_cmd_start_auth = SERVICE_CREATE_CMD(18), hdcp_cmd_session_open_stream = SERVICE_CREATE_CMD(20), hdcp_cmd_session_close_stream = SERVICE_CREATE_CMD(21), hdcp_cmd_force_encryption = SERVICE_CREATE_CMD(22), }; Loading Loading @@ -488,6 +491,31 @@ struct __attribute__ ((__packed__)) hdcp_start_auth_rsp { uint8_t message[MAX_TX_MESSAGE_SIZE]; }; struct __attribute__((__packed__)) hdcp_session_open_stream_req { uint32_t commandid; uint32_t sessionid; uint32_t vcpayloadid; uint32_t stream_number; uint32_t streamMediaType; }; struct __attribute__((__packed__)) hdcp_session_open_stream_rsp { uint32_t status; uint32_t commandid; uint32_t streamid; }; struct __attribute__((__packed__)) hdcp_session_close_stream_req { uint32_t commandid; uint32_t sessionid; uint32_t streamid; }; struct __attribute__((__packed__)) hdcp_session_close_stream_rsp { uint32_t status; uint32_t commandid; }; struct __attribute__((__packed__)) hdcp_force_encryption_req { uint32_t commandid; uint32_t ctxhandle; Loading Loading @@ -1030,8 +1058,6 @@ static int hdcp2_app_process_msg(struct hdcp2_handle *handle) /* check if it's a repeater */ if (rsp_buf->flag == HDCP_TXMTR_SUBSTATE_WAITING_FOR_RECIEVERID_LIST) handle->app_data.repeater_flag = true; else handle->app_data.repeater_flag = false; handle->app_data.response.data = rsp_buf->msg; handle->app_data.response.length = rsp_buf->msglen; Loading Loading @@ -1205,6 +1231,106 @@ int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, return rc; } static int hdcp2_open_stream_helper(struct hdcp2_handle *handle, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { int rc = 0; hdcp2_app_init_var(session_open_stream); if (!(handle->hdcp_state & HDCP_STATE_SESSION_INIT)) { pr_err("session not initialized\n"); rc = -EINVAL; goto error; } if (!(handle->hdcp_state & HDCP_STATE_TXMTR_INIT)) { pr_err("txmtr not initialized\n"); rc = -EINVAL; goto error; } req_buf->sessionid = handle->session_id; req_buf->vcpayloadid = vc_payload_id; req_buf->stream_number = stream_number; req_buf->streamMediaType = 0; rc = hdcp2_app_process_cmd(session_open_stream); if (rc) goto error; *stream_id = rsp_buf->streamid; pr_debug("success\n"); error: return rc; } int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { struct hdcp2_handle *handle = NULL; if (!ctx) { pr_err("invalid input\n"); return -EINVAL; } handle = ctx; return hdcp2_open_stream_helper(handle, vc_payload_id, stream_number, stream_id); } static int hdcp2_close_stream_helper(struct hdcp2_handle *handle, uint32_t stream_id) { int rc = 0; hdcp2_app_init_var(session_close_stream); if (!(handle->hdcp_state & HDCP_STATE_SESSION_INIT)) { pr_err("session not initialized\n"); rc = -EINVAL; goto error; } if (!(handle->hdcp_state & HDCP_STATE_TXMTR_INIT)) { pr_err("txmtr not initialized\n"); rc = -EINVAL; goto error; } req_buf->sessionid = handle->session_id; req_buf->streamid = stream_id; rc = hdcp2_app_process_cmd(session_close_stream); if (rc) goto error; pr_debug("success\n"); error: return rc; } int hdcp2_close_stream(void *ctx, uint32_t stream_id) { struct hdcp2_handle *handle = NULL; if (!ctx) { pr_err("invalid input\n"); return -EINVAL; } handle = ctx; return hdcp2_close_stream_helper(handle, stream_id); } void *hdcp2_init(u32 device_type) { struct hdcp2_handle *handle = NULL; Loading
include/linux/hdcp_qseecom.h +14 −0 Original line number Diff line number Diff line Loading @@ -68,6 +68,9 @@ void hdcp2_deinit(void *ctx); bool hdcp2_feature_supported(void *ctx); int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, struct hdcp2_app_data *app_data); int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id); int hdcp2_close_stream(void *ctx, uint32_t stream_id); int hdcp2_force_encryption(void *ctx, uint32_t enable); #else static inline void *hdcp1_init(void) Loading Loading @@ -115,6 +118,17 @@ static inline int hdcp2_app_comm(void *ctx, enum hdcp2_app_cmd cmd, return 0; } static inline int hdcp2_open_stream(void *ctx, uint8_t vc_payload_id, uint8_t stream_number, uint32_t *stream_id) { return 0; } static inline int hdcp2_close_stream(void *ctx, uint32_t stream_id) { return 0; } static inline int hdcp2_force_encryption(void *ctx, uint32_t enable) { return 0; Loading