hdcp_qseecom.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  4. */
  5. #ifndef __HDCP_QSEECOM_H__
  6. #define __HDCP_QSEECOM_H__
  7. #include <linux/hdcp_qseecom.h>
  8. #include <linux/kernel.h>
  9. #include <linux/slab.h>
  10. #include <linux/types.h>
  11. #include "hdcp_main.h"
  12. struct hdcp1_qsee_handle {
  13. struct qseecom_handle *qseecom_handle;
  14. struct qseecom_handle *hdcpops_handle;
  15. bool feature_supported;
  16. uint32_t device_type;
  17. enum hdcp_state hdcp_state;
  18. char *app_name;
  19. };
  20. struct hdcp2_qsee_handle {
  21. struct hdcp2_app_data app_data;
  22. uint32_t tz_ctxhandle;
  23. bool feature_supported;
  24. enum hdcp_state hdcp_state;
  25. struct qseecom_handle *qseecom_handle;
  26. struct qseecom_handle *hdcpsrm_qseecom_handle;
  27. uint32_t session_id;
  28. bool legacy_app;
  29. uint32_t device_type;
  30. char *app_name;
  31. unsigned char *req_buf;
  32. unsigned char *res_buf;
  33. int (*app_init)(struct hdcp2_qsee_handle *handle);
  34. int (*tx_init)(struct hdcp2_qsee_handle *handle);
  35. };
  36. struct hdcp1_key_set_req {
  37. uint32_t commandid;
  38. } __packed;
  39. struct hdcp1_key_set_rsp {
  40. uint32_t commandid;
  41. uint32_t ret;
  42. uint8_t ksv[HDCP1_AKSV_SIZE];
  43. } __packed;
  44. struct hdcp1_ops_notify_req {
  45. uint32_t commandid;
  46. uint32_t device_type;
  47. uint8_t recv_id_list[MAX_REC_ID_LIST_SIZE];
  48. int32_t recv_id_len;
  49. struct hdcp1_topology topology;
  50. bool is_authenticated;
  51. } __packed;
  52. struct hdcp1_ops_notify_rsp {
  53. uint32_t commandid;
  54. uint32_t ret;
  55. } __packed;
  56. struct hdcp1_set_enc_req {
  57. uint32_t commandid;
  58. uint32_t enable;
  59. } __packed;
  60. struct hdcp1_set_enc_rsp {
  61. uint32_t commandid;
  62. uint32_t ret;
  63. } __packed;
  64. struct hdcp1_key_verify_req {
  65. uint32_t commandid;
  66. uint32_t key_type;
  67. } __packed;
  68. struct hdcp1_key_verify_rsp {
  69. uint32_t commandId;
  70. uint32_t ret;
  71. } __packed;
  72. struct hdcp_init_v1_req {
  73. uint32_t commandid;
  74. } __packed;
  75. struct hdcp_init_v1_rsp {
  76. uint32_t status;
  77. uint32_t commandid;
  78. uint32_t ctxhandle;
  79. uint32_t timeout;
  80. uint32_t msglen;
  81. uint8_t message[MAX_TX_MESSAGE_SIZE];
  82. } __packed;
  83. struct hdcp_init_req {
  84. uint32_t commandid;
  85. uint32_t clientversion;
  86. } __packed;
  87. struct hdcp_init_rsp {
  88. uint32_t status;
  89. uint32_t commandid;
  90. uint32_t appversion;
  91. } __packed;
  92. struct hdcp_session_init_req {
  93. uint32_t commandid;
  94. uint32_t deviceid;
  95. } __packed;
  96. struct hdcp_session_init_rsp {
  97. uint32_t status;
  98. uint32_t commandid;
  99. uint32_t sessionid;
  100. } __packed;
  101. struct hdcp_tx_init_v1_req {
  102. uint32_t commandid;
  103. } __packed;
  104. struct hdcp_tx_init_v1_rsp {
  105. uint32_t status;
  106. uint32_t commandid;
  107. uint32_t ctxhandle;
  108. uint32_t timeout;
  109. uint32_t msglen;
  110. uint8_t message[MAX_TX_MESSAGE_SIZE];
  111. } __packed;
  112. struct hdcp_tx_init_req {
  113. uint32_t commandid;
  114. uint32_t sessionid;
  115. } __packed;
  116. struct hdcp_tx_init_rsp {
  117. uint32_t status;
  118. uint32_t commandid;
  119. uint32_t ctxhandle;
  120. } __packed;
  121. struct hdcp_version_req {
  122. uint32_t commandid;
  123. } __packed;
  124. struct hdcp_version_rsp {
  125. uint32_t status;
  126. uint32_t commandId;
  127. uint32_t appversion;
  128. } __packed;
  129. struct hdcp_session_open_stream_req {
  130. uint32_t commandid;
  131. uint32_t sessionid;
  132. uint32_t vcpayloadid;
  133. uint32_t stream_number;
  134. uint32_t streamMediaType;
  135. } __packed;
  136. struct hdcp_session_open_stream_rsp {
  137. uint32_t status;
  138. uint32_t commandid;
  139. uint32_t streamid;
  140. } __packed;
  141. struct hdcp_session_close_stream_req {
  142. uint32_t commandid;
  143. uint32_t sessionid;
  144. uint32_t streamid;
  145. } __packed;
  146. struct hdcp_session_close_stream_rsp {
  147. uint32_t status;
  148. uint32_t commandid;
  149. } __packed;
  150. struct hdcp_force_encryption_req {
  151. uint32_t commandid;
  152. uint32_t ctxhandle;
  153. uint32_t enable;
  154. } __packed;
  155. struct hdcp_force_encryption_rsp {
  156. uint32_t status;
  157. uint32_t commandid;
  158. } __packed;
  159. struct hdcp_tx_deinit_req {
  160. uint32_t commandid;
  161. uint32_t ctxhandle;
  162. } __packed;
  163. struct hdcp_tx_deinit_rsp {
  164. uint32_t status;
  165. uint32_t commandid;
  166. } __packed;
  167. struct hdcp_session_deinit_req {
  168. uint32_t commandid;
  169. uint32_t sessionid;
  170. } __packed;
  171. struct hdcp_session_deinit_rsp {
  172. uint32_t status;
  173. uint32_t commandid;
  174. } __packed;
  175. struct hdcp_deinit_req {
  176. uint32_t commandid;
  177. } __packed;
  178. struct hdcp_deinit_rsp {
  179. uint32_t status;
  180. uint32_t commandid;
  181. } __packed;
  182. struct hdcp_query_stream_type_req {
  183. uint32_t commandid;
  184. uint32_t ctxhandle;
  185. } __packed;
  186. struct hdcp_query_stream_type_rsp {
  187. uint32_t status;
  188. uint32_t commandid;
  189. uint32_t timeout;
  190. uint32_t msglen;
  191. uint8_t msg[MAX_TX_MESSAGE_SIZE];
  192. } __packed;
  193. struct hdcp_set_hw_key_req {
  194. uint32_t commandid;
  195. uint32_t ctxhandle;
  196. } __packed;
  197. struct hdcp_set_hw_key_rsp {
  198. uint32_t status;
  199. uint32_t commandid;
  200. } __packed;
  201. struct hdcp_send_timeout_req {
  202. uint32_t commandid;
  203. uint32_t ctxhandle;
  204. } __packed;
  205. struct hdcp_send_timeout_rsp {
  206. uint32_t status;
  207. uint32_t commandid;
  208. uint32_t timeout;
  209. uint32_t msglen;
  210. uint8_t message[MAX_TX_MESSAGE_SIZE];
  211. } __packed;
  212. struct hdcp_start_auth_req {
  213. uint32_t commandid;
  214. uint32_t ctxHandle;
  215. } __packed;
  216. struct hdcp_start_auth_rsp {
  217. uint32_t status;
  218. uint32_t commandid;
  219. uint32_t ctxhandle;
  220. uint32_t timeout;
  221. uint32_t msglen;
  222. uint8_t message[MAX_TX_MESSAGE_SIZE];
  223. } __packed;
  224. struct hdcp_rcvd_msg_req {
  225. uint32_t commandid;
  226. uint32_t ctxhandle;
  227. uint32_t msglen;
  228. uint8_t msg[MAX_RX_MESSAGE_SIZE];
  229. } __packed;
  230. struct hdcp_rcvd_msg_rsp {
  231. uint32_t status;
  232. uint32_t commandid;
  233. uint32_t state;
  234. uint32_t timeout;
  235. uint32_t flag;
  236. uint32_t msglen;
  237. uint8_t msg[MAX_TX_MESSAGE_SIZE];
  238. } __packed;
  239. struct hdcp_verify_key_req {
  240. uint32_t commandid;
  241. } __packed;
  242. struct hdcp_verify_key_rsp {
  243. uint32_t status;
  244. uint32_t commandId;
  245. } __packed;
  246. #define HDCP1_SET_KEY 202
  247. #define HDCP1_KEY_VERIFY 204
  248. #define HDCP1_SET_ENC 205
  249. /* DP device type */
  250. #define DEVICE_TYPE_DP 0x8002
  251. void *hdcp1_init_qseecom(void);
  252. bool hdcp1_feature_supported_qseecom(void *data);
  253. int hdcp1_set_enc_qseecom(void *data, bool enable);
  254. int hdcp1_ops_notify_qseecom(void *data, void *topo, bool is_authenticated);
  255. int hdcp1_start_qseecom(void *data, u32 *aksv_msb, u32 *aksv_lsb);
  256. void hdcp1_stop_qseecom(void *data);
  257. void *hdcp2_init_qseecom(u32 device_type);
  258. void hdcp2_deinit_qseecom(void *ctx);
  259. int hdcp2_app_start_qseecom(void *ctx, uint32_t req_len);
  260. int hdcp2_app_start_auth_qseecom(void *ctx, uint32_t req_len);
  261. int hdcp2_app_process_msg_qseecom(void *ctx, uint32_t req_len);
  262. int hdcp2_app_timeout_qseecom(void *ctx, uint32_t req_len);
  263. int hdcp2_app_enable_encryption_qseecom(void *ctx, uint32_t req_len);
  264. int hdcp2_app_query_stream_qseecom(void *ctx, uint32_t req_len);
  265. int hdcp2_app_stop_qseecom(void *ctx);
  266. bool hdcp2_feature_supported_qseecom(void *ctx);
  267. int hdcp2_force_encryption_qseecom(void *ctx, uint32_t enable);
  268. int hdcp2_open_stream_qseecom(void *ctx, uint8_t vc_payload_id,
  269. uint8_t stream_number, uint32_t *stream_id);
  270. int hdcp2_close_stream_qseecom(void *ctx, uint32_t stream_id);
  271. int hdcp2_update_app_data_qseecom(void *ctx, struct hdcp2_app_data *app_data);
  272. #endif /* __HDCP_QSEECOM_H__ */