q6core.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119
  1. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/module.h>
  14. #include <linux/string.h>
  15. #include <linux/types.h>
  16. #include <linux/spinlock.h>
  17. #include <linux/mutex.h>
  18. #include <linux/sched.h>
  19. #include <linux/slab.h>
  20. #include <dsp/q6core.h>
  21. #include <dsp/audio_cal_utils.h>
  22. #include <dsp/apr_audio-v2.h>
  23. #include <ipc/apr.h>
  24. #include "adsp_err.h"
  25. #define TIMEOUT_MS 1000
  26. /*
  27. * AVS bring up in the modem is optimitized for the new
  28. * Sub System Restart design and 100 milliseconds timeout
  29. * is sufficient to make sure the Q6 will be ready.
  30. */
  31. #define Q6_READY_TIMEOUT_MS 100
  32. enum {
  33. META_CAL,
  34. CUST_TOP_CAL,
  35. CORE_MAX_CAL
  36. };
  37. enum ver_query_status {
  38. VER_QUERY_UNATTEMPTED,
  39. VER_QUERY_UNSUPPORTED,
  40. VER_QUERY_SUPPORTED
  41. };
  42. struct q6core_avcs_ver_info {
  43. enum ver_query_status status;
  44. struct avcs_fwk_ver_info *ver_info;
  45. };
  46. struct q6core_str {
  47. struct apr_svc *core_handle_q;
  48. wait_queue_head_t bus_bw_req_wait;
  49. wait_queue_head_t cmd_req_wait;
  50. wait_queue_head_t avcs_fwk_ver_req_wait;
  51. u32 bus_bw_resp_received;
  52. enum cmd_flags {
  53. FLAG_NONE,
  54. FLAG_CMDRSP_LICENSE_RESULT
  55. } cmd_resp_received_flag;
  56. u32 avcs_fwk_ver_resp_received;
  57. struct mutex cmd_lock;
  58. struct mutex ver_lock;
  59. union {
  60. struct avcs_cmdrsp_get_license_validation_result
  61. cmdrsp_license_result;
  62. } cmd_resp_payload;
  63. u32 param;
  64. struct cal_type_data *cal_data[CORE_MAX_CAL];
  65. uint32_t mem_map_cal_handle;
  66. int32_t adsp_status;
  67. struct q6core_avcs_ver_info q6core_avcs_ver_info;
  68. };
  69. static struct q6core_str q6core_lcl;
  70. struct generic_get_data_ {
  71. int valid;
  72. int size_in_ints;
  73. int ints[];
  74. };
  75. static struct generic_get_data_ *generic_get_data;
  76. static int parse_fwk_version_info(uint32_t *payload)
  77. {
  78. size_t ver_size;
  79. int num_services;
  80. pr_debug("%s: Payload info num services %d\n",
  81. __func__, payload[4]);
  82. /*
  83. * payload1[4] is the number of services running on DSP
  84. * Based on this info, we copy the payload into core
  85. * avcs version info structure.
  86. */
  87. num_services = payload[4];
  88. if (num_services > VSS_MAX_AVCS_NUM_SERVICES) {
  89. pr_err("%s: num_services: %d greater than max services: %d\n",
  90. __func__, num_services, VSS_MAX_AVCS_NUM_SERVICES);
  91. return -EINVAL;
  92. }
  93. /*
  94. * Dynamically allocate memory for all
  95. * the services based on num_services
  96. */
  97. ver_size = sizeof(struct avcs_get_fwk_version) +
  98. num_services * sizeof(struct avs_svc_api_info);
  99. if (q6core_lcl.q6core_avcs_ver_info.ver_info != NULL)
  100. pr_warn("%s: Version info is not NULL\n", __func__);
  101. q6core_lcl.q6core_avcs_ver_info.ver_info =
  102. kzalloc(ver_size, GFP_ATOMIC);
  103. if (q6core_lcl.q6core_avcs_ver_info.ver_info == NULL)
  104. return -ENOMEM;
  105. memcpy(q6core_lcl.q6core_avcs_ver_info.ver_info, (uint8_t *) payload,
  106. ver_size);
  107. return 0;
  108. }
  109. static int32_t aprv2_core_fn_q(struct apr_client_data *data, void *priv)
  110. {
  111. uint32_t *payload1;
  112. int ret = 0;
  113. if (data == NULL) {
  114. pr_err("%s: data argument is null\n", __func__);
  115. return -EINVAL;
  116. }
  117. pr_debug("%s: core msg: payload len = %u, apr resp opcode = 0x%x\n",
  118. __func__,
  119. data->payload_size, data->opcode);
  120. switch (data->opcode) {
  121. case APR_BASIC_RSP_RESULT:{
  122. if (data->payload_size == 0) {
  123. pr_err("%s: APR_BASIC_RSP_RESULT No Payload ",
  124. __func__);
  125. return 0;
  126. }
  127. payload1 = data->payload;
  128. switch (payload1[0]) {
  129. case AVCS_CMD_SHARED_MEM_UNMAP_REGIONS:
  130. pr_debug("%s: Cmd = AVCS_CMD_SHARED_MEM_UNMAP_REGIONS status[0x%x]\n",
  131. __func__, payload1[1]);
  132. q6core_lcl.bus_bw_resp_received = 1;
  133. wake_up(&q6core_lcl.bus_bw_req_wait);
  134. break;
  135. case AVCS_CMD_SHARED_MEM_MAP_REGIONS:
  136. pr_debug("%s: Cmd = AVCS_CMD_SHARED_MEM_MAP_REGIONS status[0x%x]\n",
  137. __func__, payload1[1]);
  138. q6core_lcl.bus_bw_resp_received = 1;
  139. wake_up(&q6core_lcl.bus_bw_req_wait);
  140. break;
  141. case AVCS_CMD_REGISTER_TOPOLOGIES:
  142. pr_debug("%s: Cmd = AVCS_CMD_REGISTER_TOPOLOGIES status[0x%x]\n",
  143. __func__, payload1[1]);
  144. /* -ADSP status to match Linux error standard */
  145. q6core_lcl.adsp_status = -payload1[1];
  146. q6core_lcl.bus_bw_resp_received = 1;
  147. wake_up(&q6core_lcl.bus_bw_req_wait);
  148. break;
  149. case AVCS_CMD_DEREGISTER_TOPOLOGIES:
  150. pr_debug("%s: Cmd = AVCS_CMD_DEREGISTER_TOPOLOGIES status[0x%x]\n",
  151. __func__, payload1[1]);
  152. q6core_lcl.bus_bw_resp_received = 1;
  153. wake_up(&q6core_lcl.bus_bw_req_wait);
  154. break;
  155. case AVCS_CMD_GET_FWK_VERSION:
  156. pr_debug("%s: Cmd = AVCS_CMD_GET_FWK_VERSION status[%s]\n",
  157. __func__, adsp_err_get_err_str(payload1[1]));
  158. /* ADSP status to match Linux error standard */
  159. q6core_lcl.adsp_status = -payload1[1];
  160. if (payload1[1] == ADSP_EUNSUPPORTED)
  161. q6core_lcl.q6core_avcs_ver_info.status =
  162. VER_QUERY_UNSUPPORTED;
  163. q6core_lcl.avcs_fwk_ver_resp_received = 1;
  164. wake_up(&q6core_lcl.avcs_fwk_ver_req_wait);
  165. break;
  166. default:
  167. pr_err("%s: Invalid cmd rsp[0x%x][0x%x] opcode %d\n",
  168. __func__,
  169. payload1[0], payload1[1], data->opcode);
  170. break;
  171. }
  172. break;
  173. }
  174. case RESET_EVENTS:{
  175. pr_debug("%s: Reset event received in Core service\n",
  176. __func__);
  177. /*
  178. * no reset for q6core_avcs_ver_info done as
  179. * the data will not change after SSR
  180. */
  181. apr_reset(q6core_lcl.core_handle_q);
  182. q6core_lcl.core_handle_q = NULL;
  183. break;
  184. }
  185. case AVCS_CMDRSP_SHARED_MEM_MAP_REGIONS:
  186. payload1 = data->payload;
  187. pr_debug("%s: AVCS_CMDRSP_SHARED_MEM_MAP_REGIONS handle %d\n",
  188. __func__, payload1[0]);
  189. q6core_lcl.mem_map_cal_handle = payload1[0];
  190. q6core_lcl.bus_bw_resp_received = 1;
  191. wake_up(&q6core_lcl.bus_bw_req_wait);
  192. break;
  193. case AVCS_CMDRSP_ADSP_EVENT_GET_STATE:
  194. payload1 = data->payload;
  195. q6core_lcl.param = payload1[0];
  196. pr_debug("%s: Received ADSP get state response 0x%x\n",
  197. __func__, q6core_lcl.param);
  198. /* ensure .param is updated prior to .bus_bw_resp_received */
  199. wmb();
  200. q6core_lcl.bus_bw_resp_received = 1;
  201. wake_up(&q6core_lcl.bus_bw_req_wait);
  202. break;
  203. case AVCS_CMDRSP_GET_LICENSE_VALIDATION_RESULT:
  204. payload1 = data->payload;
  205. pr_debug("%s: cmd = LICENSE_VALIDATION_RESULT, result = 0x%x\n",
  206. __func__, payload1[0]);
  207. q6core_lcl.cmd_resp_payload.cmdrsp_license_result.result
  208. = payload1[0];
  209. q6core_lcl.cmd_resp_received_flag = FLAG_CMDRSP_LICENSE_RESULT;
  210. wake_up(&q6core_lcl.cmd_req_wait);
  211. break;
  212. case AVCS_CMDRSP_GET_FWK_VERSION:
  213. pr_debug("%s: Received AVCS_CMDRSP_GET_FWK_VERSION\n",
  214. __func__);
  215. payload1 = data->payload;
  216. q6core_lcl.avcs_fwk_ver_resp_received = 1;
  217. ret = parse_fwk_version_info(payload1);
  218. if (ret < 0) {
  219. q6core_lcl.adsp_status = ret;
  220. pr_err("%s: Failed to parse payload:%d\n",
  221. __func__, ret);
  222. } else {
  223. q6core_lcl.q6core_avcs_ver_info.status =
  224. VER_QUERY_SUPPORTED;
  225. }
  226. wake_up(&q6core_lcl.avcs_fwk_ver_req_wait);
  227. break;
  228. default:
  229. pr_err("%s: Message id from adsp core svc: 0x%x\n",
  230. __func__, data->opcode);
  231. if (generic_get_data) {
  232. generic_get_data->valid = 1;
  233. generic_get_data->size_in_ints =
  234. data->payload_size/sizeof(int);
  235. pr_debug("callback size = %i\n",
  236. data->payload_size);
  237. memcpy(generic_get_data->ints, data->payload,
  238. data->payload_size);
  239. q6core_lcl.bus_bw_resp_received = 1;
  240. wake_up(&q6core_lcl.bus_bw_req_wait);
  241. break;
  242. }
  243. break;
  244. }
  245. return 0;
  246. }
  247. void ocm_core_open(void)
  248. {
  249. if (q6core_lcl.core_handle_q == NULL)
  250. q6core_lcl.core_handle_q = apr_register("ADSP", "CORE",
  251. aprv2_core_fn_q, 0xFFFFFFFF, NULL);
  252. pr_debug("%s: Open_q %pK\n", __func__, q6core_lcl.core_handle_q);
  253. if (q6core_lcl.core_handle_q == NULL)
  254. pr_err("%s: Unable to register CORE\n", __func__);
  255. }
  256. struct cal_block_data *cal_utils_get_cal_block_by_key(
  257. struct cal_type_data *cal_type, uint32_t key)
  258. {
  259. struct list_head *ptr, *next;
  260. struct cal_block_data *cal_block = NULL;
  261. struct audio_cal_info_metainfo *metainfo;
  262. list_for_each_safe(ptr, next,
  263. &cal_type->cal_blocks) {
  264. cal_block = list_entry(ptr,
  265. struct cal_block_data, list);
  266. metainfo = (struct audio_cal_info_metainfo *)
  267. cal_block->cal_info;
  268. if (metainfo->nKey != key) {
  269. pr_debug("%s: metainfo key mismatch!!! found:%x, needed:%x\n",
  270. __func__, metainfo->nKey, key);
  271. } else {
  272. pr_debug("%s: metainfo key match found", __func__);
  273. return cal_block;
  274. }
  275. }
  276. return NULL;
  277. }
  278. static int q6core_send_get_avcs_fwk_ver_cmd(void)
  279. {
  280. struct apr_hdr avcs_ver_cmd;
  281. int ret;
  282. avcs_ver_cmd.hdr_field =
  283. APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE),
  284. APR_PKT_VER);
  285. avcs_ver_cmd.pkt_size = sizeof(struct apr_hdr);
  286. avcs_ver_cmd.src_port = 0;
  287. avcs_ver_cmd.dest_port = 0;
  288. avcs_ver_cmd.token = 0;
  289. avcs_ver_cmd.opcode = AVCS_CMD_GET_FWK_VERSION;
  290. q6core_lcl.adsp_status = 0;
  291. q6core_lcl.avcs_fwk_ver_resp_received = 0;
  292. ret = apr_send_pkt(q6core_lcl.core_handle_q,
  293. (uint32_t *) &avcs_ver_cmd);
  294. if (ret < 0) {
  295. pr_err("%s: failed to send apr packet, ret=%d\n", __func__,
  296. ret);
  297. goto done;
  298. }
  299. ret = wait_event_timeout(q6core_lcl.avcs_fwk_ver_req_wait,
  300. (q6core_lcl.avcs_fwk_ver_resp_received == 1),
  301. msecs_to_jiffies(TIMEOUT_MS));
  302. if (!ret) {
  303. pr_err("%s: wait_event timeout for AVCS fwk version info\n",
  304. __func__);
  305. ret = -ETIMEDOUT;
  306. goto done;
  307. }
  308. if (q6core_lcl.adsp_status < 0) {
  309. /*
  310. * adsp_err_get_err_str expects a positive value but we store
  311. * the DSP error as negative to match the Linux error standard.
  312. * Pass in the negated value so adsp_err_get_err_str returns
  313. * the correct string.
  314. */
  315. pr_err("%s: DSP returned error[%s]\n", __func__,
  316. adsp_err_get_err_str(-q6core_lcl.adsp_status));
  317. ret = adsp_err_get_lnx_err_code(q6core_lcl.adsp_status);
  318. goto done;
  319. }
  320. ret = 0;
  321. done:
  322. return ret;
  323. }
  324. int q6core_get_service_version(uint32_t service_id,
  325. struct avcs_fwk_ver_info *ver_info,
  326. size_t size)
  327. {
  328. struct avcs_fwk_ver_info *cached_ver_info = NULL;
  329. int i;
  330. uint32_t num_services;
  331. size_t ver_size;
  332. int ret;
  333. if (ver_info == NULL) {
  334. pr_err("%s: ver_info is NULL\n", __func__);
  335. return -EINVAL;
  336. }
  337. ret = q6core_get_fwk_version_size(service_id);
  338. if (ret < 0) {
  339. pr_err("%s: Failed to get service size for service id %d with error %d\n",
  340. __func__, service_id, ret);
  341. return ret;
  342. }
  343. ver_size = ret;
  344. if (ver_size != size) {
  345. pr_err("%s: Expected size %zu and provided size %zu do not match\n",
  346. __func__, ver_size, size);
  347. return -EINVAL;
  348. }
  349. cached_ver_info = q6core_lcl.q6core_avcs_ver_info.ver_info;
  350. num_services = cached_ver_info->avcs_fwk_version.num_services;
  351. if (service_id == AVCS_SERVICE_ID_ALL) {
  352. memcpy(ver_info, cached_ver_info, ver_size);
  353. return 0;
  354. }
  355. ver_info->avcs_fwk_version = cached_ver_info->avcs_fwk_version;
  356. for (i = 0; i < num_services; i++) {
  357. if (cached_ver_info->services[i].service_id == service_id) {
  358. ver_info->services[0] = cached_ver_info->services[i];
  359. return 0;
  360. }
  361. }
  362. pr_err("%s: No service matching service ID %d\n", __func__, service_id);
  363. return -EINVAL;
  364. }
  365. EXPORT_SYMBOL(q6core_get_service_version);
  366. size_t q6core_get_fwk_version_size(uint32_t service_id)
  367. {
  368. int ret = 0;
  369. uint32_t num_services;
  370. mutex_lock(&(q6core_lcl.ver_lock));
  371. pr_debug("%s: q6core_avcs_ver_info.status(%d)\n", __func__,
  372. q6core_lcl.q6core_avcs_ver_info.status);
  373. switch (q6core_lcl.q6core_avcs_ver_info.status) {
  374. case VER_QUERY_SUPPORTED:
  375. pr_debug("%s: AVCS FWK version query already attempted\n",
  376. __func__);
  377. break;
  378. case VER_QUERY_UNSUPPORTED:
  379. ret = -EOPNOTSUPP;
  380. break;
  381. case VER_QUERY_UNATTEMPTED:
  382. pr_debug("%s: Attempting AVCS FWK version query\n", __func__);
  383. if (q6core_is_adsp_ready()) {
  384. ret = q6core_send_get_avcs_fwk_ver_cmd();
  385. } else {
  386. pr_err("%s: ADSP is not ready to query version\n",
  387. __func__);
  388. ret = -ENODEV;
  389. }
  390. break;
  391. default:
  392. pr_err("%s: Invalid version query status %d\n", __func__,
  393. q6core_lcl.q6core_avcs_ver_info.status);
  394. ret = -EINVAL;
  395. break;
  396. }
  397. mutex_unlock(&(q6core_lcl.ver_lock));
  398. if (ret)
  399. goto done;
  400. num_services = q6core_lcl.q6core_avcs_ver_info.ver_info
  401. ->avcs_fwk_version.num_services;
  402. ret = sizeof(struct avcs_get_fwk_version);
  403. if (service_id == AVCS_SERVICE_ID_ALL)
  404. ret += num_services * sizeof(struct avs_svc_api_info);
  405. else
  406. ret += sizeof(struct avs_svc_api_info);
  407. done:
  408. return ret;
  409. }
  410. EXPORT_SYMBOL(q6core_get_fwk_version_size);
  411. /**
  412. * core_set_license -
  413. * command to set license for module
  414. *
  415. * @key: license key hash
  416. * @module_id: DSP Module ID
  417. *
  418. * Returns 0 on success or error on failure
  419. */
  420. int32_t core_set_license(uint32_t key, uint32_t module_id)
  421. {
  422. struct avcs_cmd_set_license *cmd_setl = NULL;
  423. struct cal_block_data *cal_block = NULL;
  424. int rc = 0, packet_size = 0;
  425. pr_debug("%s: key:0x%x, id:0x%x\n", __func__, key, module_id);
  426. mutex_lock(&(q6core_lcl.cmd_lock));
  427. if (q6core_lcl.cal_data[META_CAL] == NULL) {
  428. pr_err("%s: cal_data not initialized yet!!\n", __func__);
  429. rc = -EINVAL;
  430. goto cmd_unlock;
  431. }
  432. mutex_lock(&((q6core_lcl.cal_data[META_CAL])->lock));
  433. cal_block = cal_utils_get_cal_block_by_key(
  434. q6core_lcl.cal_data[META_CAL], key);
  435. if (cal_block == NULL ||
  436. cal_block->cal_data.kvaddr == NULL ||
  437. cal_block->cal_data.size <= 0) {
  438. pr_err("%s: Invalid cal block to send", __func__);
  439. rc = -EINVAL;
  440. goto cal_data_unlock;
  441. }
  442. packet_size = sizeof(struct avcs_cmd_set_license) +
  443. cal_block->cal_data.size;
  444. /*round up total packet_size to next 4 byte boundary*/
  445. packet_size = ((packet_size + 0x3)>>2)<<2;
  446. cmd_setl = kzalloc(packet_size, GFP_KERNEL);
  447. if (cmd_setl == NULL) {
  448. rc = -ENOMEM;
  449. goto cal_data_unlock;
  450. }
  451. ocm_core_open();
  452. if (q6core_lcl.core_handle_q == NULL) {
  453. pr_err("%s: apr registration for CORE failed\n", __func__);
  454. rc = -ENODEV;
  455. goto fail_cmd;
  456. }
  457. cmd_setl->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
  458. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  459. cmd_setl->hdr.pkt_size = packet_size;
  460. cmd_setl->hdr.src_port = 0;
  461. cmd_setl->hdr.dest_port = 0;
  462. cmd_setl->hdr.token = 0;
  463. cmd_setl->hdr.opcode = AVCS_CMD_SET_LICENSE;
  464. cmd_setl->id = module_id;
  465. cmd_setl->overwrite = 1;
  466. cmd_setl->size = cal_block->cal_data.size;
  467. memcpy((uint8_t *)cmd_setl + sizeof(struct avcs_cmd_set_license),
  468. cal_block->cal_data.kvaddr,
  469. cal_block->cal_data.size);
  470. pr_info("%s: Set license opcode=0x%x, id =0x%x, size = %d\n",
  471. __func__, cmd_setl->hdr.opcode,
  472. cmd_setl->id, cmd_setl->size);
  473. rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)cmd_setl);
  474. if (rc < 0)
  475. pr_err("%s: SET_LICENSE failed op[0x%x]rc[%d]\n",
  476. __func__, cmd_setl->hdr.opcode, rc);
  477. fail_cmd:
  478. kfree(cmd_setl);
  479. cal_data_unlock:
  480. mutex_unlock(&((q6core_lcl.cal_data[META_CAL])->lock));
  481. cmd_unlock:
  482. mutex_unlock(&(q6core_lcl.cmd_lock));
  483. return rc;
  484. }
  485. EXPORT_SYMBOL(core_set_license);
  486. /**
  487. * core_get_license_status -
  488. * command to retrieve license status for module
  489. *
  490. * @module_id: DSP Module ID
  491. *
  492. * Returns 0 on success or error on failure
  493. */
  494. int32_t core_get_license_status(uint32_t module_id)
  495. {
  496. struct avcs_cmd_get_license_validation_result get_lvr_cmd;
  497. int ret = 0;
  498. pr_debug("%s: module_id 0x%x", __func__, module_id);
  499. mutex_lock(&(q6core_lcl.cmd_lock));
  500. ocm_core_open();
  501. if (q6core_lcl.core_handle_q == NULL) {
  502. pr_err("%s: apr registration for CORE failed\n", __func__);
  503. ret = -ENODEV;
  504. goto fail_cmd;
  505. }
  506. get_lvr_cmd.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  507. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  508. get_lvr_cmd.hdr.pkt_size =
  509. sizeof(struct avcs_cmd_get_license_validation_result);
  510. get_lvr_cmd.hdr.src_port = 0;
  511. get_lvr_cmd.hdr.dest_port = 0;
  512. get_lvr_cmd.hdr.token = 0;
  513. get_lvr_cmd.hdr.opcode = AVCS_CMD_GET_LICENSE_VALIDATION_RESULT;
  514. get_lvr_cmd.id = module_id;
  515. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &get_lvr_cmd);
  516. if (ret < 0) {
  517. pr_err("%s: license_validation request failed, err %d\n",
  518. __func__, ret);
  519. ret = -EREMOTE;
  520. goto fail_cmd;
  521. }
  522. q6core_lcl.cmd_resp_received_flag &= ~(FLAG_CMDRSP_LICENSE_RESULT);
  523. mutex_unlock(&(q6core_lcl.cmd_lock));
  524. ret = wait_event_timeout(q6core_lcl.cmd_req_wait,
  525. (q6core_lcl.cmd_resp_received_flag ==
  526. FLAG_CMDRSP_LICENSE_RESULT),
  527. msecs_to_jiffies(TIMEOUT_MS));
  528. mutex_lock(&(q6core_lcl.cmd_lock));
  529. if (!ret) {
  530. pr_err("%s: wait_event timeout for CMDRSP_LICENSE_RESULT\n",
  531. __func__);
  532. ret = -ETIME;
  533. goto fail_cmd;
  534. }
  535. q6core_lcl.cmd_resp_received_flag &= ~(FLAG_CMDRSP_LICENSE_RESULT);
  536. ret = q6core_lcl.cmd_resp_payload.cmdrsp_license_result.result;
  537. fail_cmd:
  538. mutex_unlock(&(q6core_lcl.cmd_lock));
  539. pr_info("%s: cmdrsp_license_result.result = 0x%x for module 0x%x\n",
  540. __func__, ret, module_id);
  541. return ret;
  542. }
  543. EXPORT_SYMBOL(core_get_license_status);
  544. /**
  545. * core_set_dolby_manufacturer_id -
  546. * command to set dolby manufacturer id
  547. *
  548. * @manufacturer_id: Dolby manufacturer id
  549. *
  550. * Returns 0 on success or error on failure
  551. */
  552. uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
  553. {
  554. struct adsp_dolby_manufacturer_id payload;
  555. int rc = 0;
  556. pr_debug("%s: manufacturer_id :%d\n", __func__, manufacturer_id);
  557. mutex_lock(&(q6core_lcl.cmd_lock));
  558. ocm_core_open();
  559. if (q6core_lcl.core_handle_q) {
  560. payload.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
  561. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  562. payload.hdr.pkt_size =
  563. sizeof(struct adsp_dolby_manufacturer_id);
  564. payload.hdr.src_port = 0;
  565. payload.hdr.dest_port = 0;
  566. payload.hdr.token = 0;
  567. payload.hdr.opcode = ADSP_CMD_SET_DOLBY_MANUFACTURER_ID;
  568. payload.manufacturer_id = manufacturer_id;
  569. pr_debug("%s: Send Dolby security opcode=0x%x manufacturer ID = %d\n",
  570. __func__,
  571. payload.hdr.opcode, payload.manufacturer_id);
  572. rc = apr_send_pkt(q6core_lcl.core_handle_q,
  573. (uint32_t *)&payload);
  574. if (rc < 0)
  575. pr_err("%s: SET_DOLBY_MANUFACTURER_ID failed op[0x%x]rc[%d]\n",
  576. __func__, payload.hdr.opcode, rc);
  577. }
  578. mutex_unlock(&(q6core_lcl.cmd_lock));
  579. return rc;
  580. }
  581. EXPORT_SYMBOL(core_set_dolby_manufacturer_id);
  582. /**
  583. * q6core_is_adsp_ready - check adsp ready status
  584. *
  585. * Returns true if adsp is ready otherwise returns false
  586. */
  587. bool q6core_is_adsp_ready(void)
  588. {
  589. int rc = 0;
  590. bool ret = false;
  591. struct apr_hdr hdr;
  592. pr_debug("%s: enter\n", __func__);
  593. memset(&hdr, 0, sizeof(hdr));
  594. hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  595. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  596. hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, 0);
  597. hdr.opcode = AVCS_CMD_ADSP_EVENT_GET_STATE;
  598. mutex_lock(&(q6core_lcl.cmd_lock));
  599. ocm_core_open();
  600. if (q6core_lcl.core_handle_q) {
  601. q6core_lcl.bus_bw_resp_received = 0;
  602. rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)&hdr);
  603. if (rc < 0) {
  604. pr_err("%s: Get ADSP state APR packet send event %d\n",
  605. __func__, rc);
  606. goto bail;
  607. }
  608. rc = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  609. (q6core_lcl.bus_bw_resp_received == 1),
  610. msecs_to_jiffies(Q6_READY_TIMEOUT_MS));
  611. if (rc > 0 && q6core_lcl.bus_bw_resp_received) {
  612. /* ensure to read updated param by callback thread */
  613. rmb();
  614. ret = !!q6core_lcl.param;
  615. }
  616. }
  617. bail:
  618. pr_debug("%s: leave, rc %d, adsp ready %d\n", __func__, rc, ret);
  619. mutex_unlock(&(q6core_lcl.cmd_lock));
  620. return ret;
  621. }
  622. EXPORT_SYMBOL(q6core_is_adsp_ready);
  623. static int q6core_map_memory_regions(phys_addr_t *buf_add, uint32_t mempool_id,
  624. uint32_t *bufsz, uint32_t bufcnt, uint32_t *map_handle)
  625. {
  626. struct avs_cmd_shared_mem_map_regions *mmap_regions = NULL;
  627. struct avs_shared_map_region_payload *mregions = NULL;
  628. void *mmap_region_cmd = NULL;
  629. void *payload = NULL;
  630. int ret = 0;
  631. int i = 0;
  632. int cmd_size = 0;
  633. cmd_size = sizeof(struct avs_cmd_shared_mem_map_regions)
  634. + sizeof(struct avs_shared_map_region_payload)
  635. * bufcnt;
  636. mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL);
  637. if (mmap_region_cmd == NULL)
  638. return -ENOMEM;
  639. mmap_regions = (struct avs_cmd_shared_mem_map_regions *)mmap_region_cmd;
  640. mmap_regions->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  641. APR_HDR_LEN(APR_HDR_SIZE),
  642. APR_PKT_VER);
  643. mmap_regions->hdr.pkt_size = cmd_size;
  644. mmap_regions->hdr.src_port = 0;
  645. mmap_regions->hdr.dest_port = 0;
  646. mmap_regions->hdr.token = 0;
  647. mmap_regions->hdr.opcode = AVCS_CMD_SHARED_MEM_MAP_REGIONS;
  648. mmap_regions->mem_pool_id = ADSP_MEMORY_MAP_SHMEM8_4K_POOL & 0x00ff;
  649. mmap_regions->num_regions = bufcnt & 0x00ff;
  650. mmap_regions->property_flag = 0x00;
  651. payload = ((u8 *) mmap_region_cmd +
  652. sizeof(struct avs_cmd_shared_mem_map_regions));
  653. mregions = (struct avs_shared_map_region_payload *)payload;
  654. for (i = 0; i < bufcnt; i++) {
  655. mregions->shm_addr_lsw = lower_32_bits(buf_add[i]);
  656. mregions->shm_addr_msw =
  657. msm_audio_populate_upper_32_bits(buf_add[i]);
  658. mregions->mem_size_bytes = bufsz[i];
  659. ++mregions;
  660. }
  661. pr_debug("%s: sending memory map, addr %pK, size %d, bufcnt = %d\n",
  662. __func__, buf_add, bufsz[0], mmap_regions->num_regions);
  663. *map_handle = 0;
  664. q6core_lcl.bus_bw_resp_received = 0;
  665. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)
  666. mmap_regions);
  667. if (ret < 0) {
  668. pr_err("%s: mmap regions failed %d\n",
  669. __func__, ret);
  670. ret = -EINVAL;
  671. goto done;
  672. }
  673. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  674. (q6core_lcl.bus_bw_resp_received == 1),
  675. msecs_to_jiffies(TIMEOUT_MS));
  676. if (!ret) {
  677. pr_err("%s: timeout. waited for memory map\n", __func__);
  678. ret = -ETIME;
  679. goto done;
  680. }
  681. *map_handle = q6core_lcl.mem_map_cal_handle;
  682. done:
  683. kfree(mmap_region_cmd);
  684. return ret;
  685. }
  686. static int q6core_memory_unmap_regions(uint32_t mem_map_handle)
  687. {
  688. struct avs_cmd_shared_mem_unmap_regions unmap_regions;
  689. int ret = 0;
  690. memset(&unmap_regions, 0, sizeof(unmap_regions));
  691. unmap_regions.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  692. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  693. unmap_regions.hdr.pkt_size = sizeof(unmap_regions);
  694. unmap_regions.hdr.src_svc = APR_SVC_ADSP_CORE;
  695. unmap_regions.hdr.src_domain = APR_DOMAIN_APPS;
  696. unmap_regions.hdr.src_port = 0;
  697. unmap_regions.hdr.dest_svc = APR_SVC_ADSP_CORE;
  698. unmap_regions.hdr.dest_domain = APR_DOMAIN_ADSP;
  699. unmap_regions.hdr.dest_port = 0;
  700. unmap_regions.hdr.token = 0;
  701. unmap_regions.hdr.opcode = AVCS_CMD_SHARED_MEM_UNMAP_REGIONS;
  702. unmap_regions.mem_map_handle = mem_map_handle;
  703. q6core_lcl.bus_bw_resp_received = 0;
  704. pr_debug("%s: unmap regions map handle %d\n",
  705. __func__, mem_map_handle);
  706. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)
  707. &unmap_regions);
  708. if (ret < 0) {
  709. pr_err("%s: unmap regions failed %d\n",
  710. __func__, ret);
  711. ret = -EINVAL;
  712. goto done;
  713. }
  714. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  715. (q6core_lcl.bus_bw_resp_received == 1),
  716. msecs_to_jiffies(TIMEOUT_MS));
  717. if (!ret) {
  718. pr_err("%s: timeout. waited for memory_unmap\n",
  719. __func__);
  720. ret = -ETIME;
  721. goto done;
  722. }
  723. done:
  724. return ret;
  725. }
  726. static int q6core_dereg_all_custom_topologies(void)
  727. {
  728. int ret = 0;
  729. struct avcs_cmd_deregister_topologies dereg_top;
  730. memset(&dereg_top, 0, sizeof(dereg_top));
  731. dereg_top.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  732. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  733. dereg_top.hdr.pkt_size = sizeof(dereg_top);
  734. dereg_top.hdr.src_svc = APR_SVC_ADSP_CORE;
  735. dereg_top.hdr.src_domain = APR_DOMAIN_APPS;
  736. dereg_top.hdr.src_port = 0;
  737. dereg_top.hdr.dest_svc = APR_SVC_ADSP_CORE;
  738. dereg_top.hdr.dest_domain = APR_DOMAIN_ADSP;
  739. dereg_top.hdr.dest_port = 0;
  740. dereg_top.hdr.token = 0;
  741. dereg_top.hdr.opcode = AVCS_CMD_DEREGISTER_TOPOLOGIES;
  742. dereg_top.payload_addr_lsw = 0;
  743. dereg_top.payload_addr_msw = 0;
  744. dereg_top.mem_map_handle = 0;
  745. dereg_top.payload_size = 0;
  746. dereg_top.mode = AVCS_MODE_DEREGISTER_ALL_CUSTOM_TOPOLOGIES;
  747. q6core_lcl.bus_bw_resp_received = 0;
  748. pr_debug("%s: Deregister topologies mode %d\n",
  749. __func__, dereg_top.mode);
  750. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &dereg_top);
  751. if (ret < 0) {
  752. pr_err("%s: Deregister topologies failed %d\n",
  753. __func__, ret);
  754. goto done;
  755. }
  756. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  757. (q6core_lcl.bus_bw_resp_received == 1),
  758. msecs_to_jiffies(TIMEOUT_MS));
  759. if (!ret) {
  760. pr_err("%s: wait_event timeout for Deregister topologies\n",
  761. __func__);
  762. goto done;
  763. }
  764. done:
  765. return ret;
  766. }
  767. static int q6core_send_custom_topologies(void)
  768. {
  769. int ret = 0;
  770. int ret2 = 0;
  771. struct cal_block_data *cal_block = NULL;
  772. struct avcs_cmd_register_topologies reg_top;
  773. if (!q6core_is_adsp_ready()) {
  774. pr_err("%s: ADSP is not ready!\n", __func__);
  775. return -ENODEV;
  776. }
  777. memset(&reg_top, 0, sizeof(reg_top));
  778. mutex_lock(&q6core_lcl.cal_data[CUST_TOP_CAL]->lock);
  779. mutex_lock(&q6core_lcl.cmd_lock);
  780. cal_block = cal_utils_get_only_cal_block(
  781. q6core_lcl.cal_data[CUST_TOP_CAL]);
  782. if (cal_block == NULL) {
  783. pr_debug("%s: cal block is NULL!\n", __func__);
  784. goto unlock;
  785. }
  786. if (cal_block->cal_data.size <= 0) {
  787. pr_debug("%s: cal size is %zd not sending\n",
  788. __func__, cal_block->cal_data.size);
  789. goto unlock;
  790. }
  791. q6core_dereg_all_custom_topologies();
  792. ret = q6core_map_memory_regions(&cal_block->cal_data.paddr, 0,
  793. (uint32_t *)&cal_block->map_data.map_size, 1,
  794. &cal_block->map_data.q6map_handle);
  795. if (!ret) {
  796. pr_err("%s: q6core_map_memory_regions failed\n", __func__);
  797. goto unlock;
  798. }
  799. reg_top.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  800. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  801. reg_top.hdr.pkt_size = sizeof(reg_top);
  802. reg_top.hdr.src_svc = APR_SVC_ADSP_CORE;
  803. reg_top.hdr.src_domain = APR_DOMAIN_APPS;
  804. reg_top.hdr.src_port = 0;
  805. reg_top.hdr.dest_svc = APR_SVC_ADSP_CORE;
  806. reg_top.hdr.dest_domain = APR_DOMAIN_ADSP;
  807. reg_top.hdr.dest_port = 0;
  808. reg_top.hdr.token = 0;
  809. reg_top.hdr.opcode = AVCS_CMD_REGISTER_TOPOLOGIES;
  810. reg_top.payload_addr_lsw =
  811. lower_32_bits(cal_block->cal_data.paddr);
  812. reg_top.payload_addr_msw =
  813. msm_audio_populate_upper_32_bits(cal_block->cal_data.paddr);
  814. reg_top.mem_map_handle = cal_block->map_data.q6map_handle;
  815. reg_top.payload_size = cal_block->cal_data.size;
  816. q6core_lcl.adsp_status = 0;
  817. q6core_lcl.bus_bw_resp_received = 0;
  818. pr_debug("%s: Register topologies addr %pK, size %zd, map handle %d\n",
  819. __func__, &cal_block->cal_data.paddr, cal_block->cal_data.size,
  820. cal_block->map_data.q6map_handle);
  821. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &reg_top);
  822. if (ret < 0) {
  823. pr_err("%s: Register topologies failed %d\n",
  824. __func__, ret);
  825. goto unmap;
  826. }
  827. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  828. (q6core_lcl.bus_bw_resp_received == 1),
  829. msecs_to_jiffies(TIMEOUT_MS));
  830. if (!ret) {
  831. pr_err("%s: wait_event timeout for Register topologies\n",
  832. __func__);
  833. goto unmap;
  834. }
  835. if (q6core_lcl.adsp_status < 0)
  836. ret = q6core_lcl.adsp_status;
  837. unmap:
  838. ret2 = q6core_memory_unmap_regions(cal_block->map_data.q6map_handle);
  839. if (!ret2) {
  840. pr_err("%s: q6core_memory_unmap_regions failed for map handle %d\n",
  841. __func__, cal_block->map_data.q6map_handle);
  842. ret = ret2;
  843. goto unlock;
  844. }
  845. unlock:
  846. mutex_unlock(&q6core_lcl.cmd_lock);
  847. mutex_unlock(&q6core_lcl.cal_data[CUST_TOP_CAL]->lock);
  848. return ret;
  849. }
  850. static int get_cal_type_index(int32_t cal_type)
  851. {
  852. int ret = -EINVAL;
  853. switch (cal_type) {
  854. case AUDIO_CORE_METAINFO_CAL_TYPE:
  855. ret = META_CAL;
  856. break;
  857. case CORE_CUSTOM_TOPOLOGIES_CAL_TYPE:
  858. ret = CUST_TOP_CAL;
  859. break;
  860. default:
  861. pr_err("%s: invalid cal type %d!\n", __func__, cal_type);
  862. }
  863. return ret;
  864. }
  865. static int q6core_alloc_cal(int32_t cal_type,
  866. size_t data_size, void *data)
  867. {
  868. int ret = 0;
  869. int cal_index;
  870. cal_index = get_cal_type_index(cal_type);
  871. if (cal_index < 0) {
  872. pr_err("%s: could not get cal index %d!\n",
  873. __func__, cal_index);
  874. ret = -EINVAL;
  875. goto done;
  876. }
  877. ret = cal_utils_alloc_cal(data_size, data,
  878. q6core_lcl.cal_data[cal_index], 0, NULL);
  879. if (ret < 0) {
  880. pr_err("%s: cal_utils_alloc_block failed, ret = %d, cal type = %d!\n",
  881. __func__, ret, cal_type);
  882. goto done;
  883. }
  884. done:
  885. return ret;
  886. }
  887. static int q6core_dealloc_cal(int32_t cal_type,
  888. size_t data_size, void *data)
  889. {
  890. int ret = 0;
  891. int cal_index;
  892. cal_index = get_cal_type_index(cal_type);
  893. if (cal_index < 0) {
  894. pr_err("%s: could not get cal index %d!\n",
  895. __func__, cal_index);
  896. ret = -EINVAL;
  897. goto done;
  898. }
  899. ret = cal_utils_dealloc_cal(data_size, data,
  900. q6core_lcl.cal_data[cal_index]);
  901. if (ret < 0) {
  902. pr_err("%s: cal_utils_dealloc_block failed, ret = %d, cal type = %d!\n",
  903. __func__, ret, cal_type);
  904. goto done;
  905. }
  906. done:
  907. return ret;
  908. }
  909. static int q6core_set_cal(int32_t cal_type,
  910. size_t data_size, void *data)
  911. {
  912. int ret = 0;
  913. int cal_index;
  914. cal_index = get_cal_type_index(cal_type);
  915. if (cal_index < 0) {
  916. pr_err("%s: could not get cal index %d!\n",
  917. __func__, cal_index);
  918. ret = -EINVAL;
  919. goto done;
  920. }
  921. ret = cal_utils_set_cal(data_size, data,
  922. q6core_lcl.cal_data[cal_index], 0, NULL);
  923. if (ret < 0) {
  924. pr_err("%s: cal_utils_set_cal failed, ret = %d, cal type = %d!\n",
  925. __func__, ret, cal_type);
  926. goto done;
  927. }
  928. if (cal_index == CUST_TOP_CAL)
  929. ret = q6core_send_custom_topologies();
  930. done:
  931. return ret;
  932. }
  933. static void q6core_delete_cal_data(void)
  934. {
  935. pr_debug("%s:\n", __func__);
  936. cal_utils_destroy_cal_types(CORE_MAX_CAL, q6core_lcl.cal_data);
  937. }
  938. static int q6core_init_cal_data(void)
  939. {
  940. int ret = 0;
  941. struct cal_type_info cal_type_info[] = {
  942. {{AUDIO_CORE_METAINFO_CAL_TYPE,
  943. {q6core_alloc_cal, q6core_dealloc_cal, NULL,
  944. q6core_set_cal, NULL, NULL} },
  945. {NULL, NULL, cal_utils_match_buf_num} },
  946. {{CORE_CUSTOM_TOPOLOGIES_CAL_TYPE,
  947. {q6core_alloc_cal, q6core_dealloc_cal, NULL,
  948. q6core_set_cal, NULL, NULL} },
  949. {NULL, NULL, cal_utils_match_buf_num} }
  950. };
  951. pr_debug("%s:\n", __func__);
  952. ret = cal_utils_create_cal_types(CORE_MAX_CAL,
  953. q6core_lcl.cal_data, cal_type_info);
  954. if (ret < 0) {
  955. pr_err("%s: could not create cal type!\n",
  956. __func__);
  957. goto err;
  958. }
  959. return ret;
  960. err:
  961. q6core_delete_cal_data();
  962. return ret;
  963. }
  964. int __init core_init(void)
  965. {
  966. memset(&q6core_lcl, 0, sizeof(struct q6core_str));
  967. init_waitqueue_head(&q6core_lcl.bus_bw_req_wait);
  968. init_waitqueue_head(&q6core_lcl.cmd_req_wait);
  969. init_waitqueue_head(&q6core_lcl.avcs_fwk_ver_req_wait);
  970. q6core_lcl.cmd_resp_received_flag = FLAG_NONE;
  971. mutex_init(&q6core_lcl.cmd_lock);
  972. mutex_init(&q6core_lcl.ver_lock);
  973. q6core_init_cal_data();
  974. return 0;
  975. }
  976. void core_exit(void)
  977. {
  978. mutex_destroy(&q6core_lcl.cmd_lock);
  979. mutex_destroy(&q6core_lcl.ver_lock);
  980. q6core_delete_cal_data();
  981. }
  982. MODULE_DESCRIPTION("ADSP core driver");
  983. MODULE_LICENSE("GPL v2");