q6core.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115
  1. /* Copyright (c) 2012-2017, 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.q6core_avcs_ver_info.status = VER_QUERY_SUPPORTED;
  217. q6core_lcl.avcs_fwk_ver_resp_received = 1;
  218. ret = parse_fwk_version_info(payload1);
  219. if (ret < 0)
  220. pr_err("%s: Failed to parse payload:%d\n",
  221. __func__, ret);
  222. wake_up(&q6core_lcl.avcs_fwk_ver_req_wait);
  223. break;
  224. default:
  225. pr_err("%s: Message id from adsp core svc: 0x%x\n",
  226. __func__, data->opcode);
  227. if (generic_get_data) {
  228. generic_get_data->valid = 1;
  229. generic_get_data->size_in_ints =
  230. data->payload_size/sizeof(int);
  231. pr_debug("callback size = %i\n",
  232. data->payload_size);
  233. memcpy(generic_get_data->ints, data->payload,
  234. data->payload_size);
  235. q6core_lcl.bus_bw_resp_received = 1;
  236. wake_up(&q6core_lcl.bus_bw_req_wait);
  237. break;
  238. }
  239. break;
  240. }
  241. return 0;
  242. }
  243. void ocm_core_open(void)
  244. {
  245. if (q6core_lcl.core_handle_q == NULL)
  246. q6core_lcl.core_handle_q = apr_register("ADSP", "CORE",
  247. aprv2_core_fn_q, 0xFFFFFFFF, NULL);
  248. pr_debug("%s: Open_q %pK\n", __func__, q6core_lcl.core_handle_q);
  249. if (q6core_lcl.core_handle_q == NULL)
  250. pr_err("%s: Unable to register CORE\n", __func__);
  251. }
  252. struct cal_block_data *cal_utils_get_cal_block_by_key(
  253. struct cal_type_data *cal_type, uint32_t key)
  254. {
  255. struct list_head *ptr, *next;
  256. struct cal_block_data *cal_block = NULL;
  257. struct audio_cal_info_metainfo *metainfo;
  258. list_for_each_safe(ptr, next,
  259. &cal_type->cal_blocks) {
  260. cal_block = list_entry(ptr,
  261. struct cal_block_data, list);
  262. metainfo = (struct audio_cal_info_metainfo *)
  263. cal_block->cal_info;
  264. if (metainfo->nKey != key) {
  265. pr_debug("%s: metainfo key mismatch!!! found:%x, needed:%x\n",
  266. __func__, metainfo->nKey, key);
  267. } else {
  268. pr_debug("%s: metainfo key match found", __func__);
  269. return cal_block;
  270. }
  271. }
  272. return NULL;
  273. }
  274. static int q6core_send_get_avcs_fwk_ver_cmd(void)
  275. {
  276. struct apr_hdr avcs_ver_cmd;
  277. int ret;
  278. avcs_ver_cmd.hdr_field =
  279. APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD, APR_HDR_LEN(APR_HDR_SIZE),
  280. APR_PKT_VER);
  281. avcs_ver_cmd.pkt_size = sizeof(struct apr_hdr);
  282. avcs_ver_cmd.src_port = 0;
  283. avcs_ver_cmd.dest_port = 0;
  284. avcs_ver_cmd.token = 0;
  285. avcs_ver_cmd.opcode = AVCS_CMD_GET_FWK_VERSION;
  286. q6core_lcl.adsp_status = 0;
  287. q6core_lcl.avcs_fwk_ver_resp_received = 0;
  288. ret = apr_send_pkt(q6core_lcl.core_handle_q,
  289. (uint32_t *) &avcs_ver_cmd);
  290. if (ret < 0) {
  291. pr_err("%s: failed to send apr packet, ret=%d\n", __func__,
  292. ret);
  293. goto done;
  294. }
  295. ret = wait_event_timeout(q6core_lcl.avcs_fwk_ver_req_wait,
  296. (q6core_lcl.avcs_fwk_ver_resp_received == 1),
  297. msecs_to_jiffies(TIMEOUT_MS));
  298. if (!ret) {
  299. pr_err("%s: wait_event timeout for AVCS fwk version info\n",
  300. __func__);
  301. ret = -ETIMEDOUT;
  302. goto done;
  303. }
  304. if (q6core_lcl.adsp_status < 0) {
  305. /*
  306. * adsp_err_get_err_str expects a positive value but we store
  307. * the DSP error as negative to match the Linux error standard.
  308. * Pass in the negated value so adsp_err_get_err_str returns
  309. * the correct string.
  310. */
  311. pr_err("%s: DSP returned error[%s]\n", __func__,
  312. adsp_err_get_err_str(-q6core_lcl.adsp_status));
  313. ret = adsp_err_get_lnx_err_code(q6core_lcl.adsp_status);
  314. goto done;
  315. }
  316. ret = 0;
  317. done:
  318. return ret;
  319. }
  320. int q6core_get_service_version(uint32_t service_id,
  321. struct avcs_fwk_ver_info *ver_info,
  322. size_t size)
  323. {
  324. struct avcs_fwk_ver_info *cached_ver_info = NULL;
  325. int i;
  326. uint32_t num_services;
  327. size_t ver_size;
  328. int ret;
  329. if (ver_info == NULL) {
  330. pr_err("%s: ver_info is NULL\n", __func__);
  331. return -EINVAL;
  332. }
  333. ret = q6core_get_fwk_version_size(service_id);
  334. if (ret < 0) {
  335. pr_err("%s: Failed to get service size for service id %d with error %d\n",
  336. __func__, service_id, ret);
  337. return ret;
  338. }
  339. ver_size = ret;
  340. if (ver_size != size) {
  341. pr_err("%s: Expected size %zu and provided size %zu do not match\n",
  342. __func__, ver_size, size);
  343. return -EINVAL;
  344. }
  345. cached_ver_info = q6core_lcl.q6core_avcs_ver_info.ver_info;
  346. num_services = cached_ver_info->avcs_fwk_version.num_services;
  347. if (service_id == AVCS_SERVICE_ID_ALL) {
  348. memcpy(ver_info, cached_ver_info, ver_size);
  349. return 0;
  350. }
  351. ver_info->avcs_fwk_version = cached_ver_info->avcs_fwk_version;
  352. for (i = 0; i < num_services; i++) {
  353. if (cached_ver_info->services[i].service_id == service_id) {
  354. ver_info->services[0] = cached_ver_info->services[i];
  355. return 0;
  356. }
  357. }
  358. pr_err("%s: No service matching service ID %d\n", __func__, service_id);
  359. return -EINVAL;
  360. }
  361. EXPORT_SYMBOL(q6core_get_service_version);
  362. size_t q6core_get_fwk_version_size(uint32_t service_id)
  363. {
  364. int ret = 0;
  365. uint32_t num_services;
  366. mutex_lock(&(q6core_lcl.ver_lock));
  367. pr_debug("%s: q6core_avcs_ver_info.status(%d)\n", __func__,
  368. q6core_lcl.q6core_avcs_ver_info.status);
  369. switch (q6core_lcl.q6core_avcs_ver_info.status) {
  370. case VER_QUERY_SUPPORTED:
  371. pr_debug("%s: AVCS FWK version query already attempted\n",
  372. __func__);
  373. break;
  374. case VER_QUERY_UNSUPPORTED:
  375. ret = -EOPNOTSUPP;
  376. break;
  377. case VER_QUERY_UNATTEMPTED:
  378. pr_debug("%s: Attempting AVCS FWK version query\n", __func__);
  379. if (q6core_is_adsp_ready()) {
  380. ret = q6core_send_get_avcs_fwk_ver_cmd();
  381. } else {
  382. pr_err("%s: ADSP is not ready to query version\n",
  383. __func__);
  384. ret = -ENODEV;
  385. }
  386. break;
  387. default:
  388. pr_err("%s: Invalid version query status %d\n", __func__,
  389. q6core_lcl.q6core_avcs_ver_info.status);
  390. ret = -EINVAL;
  391. break;
  392. }
  393. mutex_unlock(&(q6core_lcl.ver_lock));
  394. if (ret)
  395. goto done;
  396. num_services = q6core_lcl.q6core_avcs_ver_info.ver_info
  397. ->avcs_fwk_version.num_services;
  398. ret = sizeof(struct avcs_get_fwk_version);
  399. if (service_id == AVCS_SERVICE_ID_ALL)
  400. ret += num_services * sizeof(struct avs_svc_api_info);
  401. else
  402. ret += sizeof(struct avs_svc_api_info);
  403. done:
  404. return ret;
  405. }
  406. EXPORT_SYMBOL(q6core_get_fwk_version_size);
  407. /**
  408. * core_set_license -
  409. * command to set license for module
  410. *
  411. * @key: license key hash
  412. * @module_id: DSP Module ID
  413. *
  414. * Returns 0 on success or error on failure
  415. */
  416. int32_t core_set_license(uint32_t key, uint32_t module_id)
  417. {
  418. struct avcs_cmd_set_license *cmd_setl = NULL;
  419. struct cal_block_data *cal_block = NULL;
  420. int rc = 0, packet_size = 0;
  421. pr_debug("%s: key:0x%x, id:0x%x\n", __func__, key, module_id);
  422. mutex_lock(&(q6core_lcl.cmd_lock));
  423. if (q6core_lcl.cal_data[META_CAL] == NULL) {
  424. pr_err("%s: cal_data not initialized yet!!\n", __func__);
  425. rc = -EINVAL;
  426. goto cmd_unlock;
  427. }
  428. mutex_lock(&((q6core_lcl.cal_data[META_CAL])->lock));
  429. cal_block = cal_utils_get_cal_block_by_key(
  430. q6core_lcl.cal_data[META_CAL], key);
  431. if (cal_block == NULL ||
  432. cal_block->cal_data.kvaddr == NULL ||
  433. cal_block->cal_data.size <= 0) {
  434. pr_err("%s: Invalid cal block to send", __func__);
  435. rc = -EINVAL;
  436. goto cal_data_unlock;
  437. }
  438. packet_size = sizeof(struct avcs_cmd_set_license) +
  439. cal_block->cal_data.size;
  440. /*round up total packet_size to next 4 byte boundary*/
  441. packet_size = ((packet_size + 0x3)>>2)<<2;
  442. cmd_setl = kzalloc(packet_size, GFP_KERNEL);
  443. if (cmd_setl == NULL) {
  444. rc = -ENOMEM;
  445. goto cal_data_unlock;
  446. }
  447. ocm_core_open();
  448. if (q6core_lcl.core_handle_q == NULL) {
  449. pr_err("%s: apr registration for CORE failed\n", __func__);
  450. rc = -ENODEV;
  451. goto fail_cmd;
  452. }
  453. cmd_setl->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
  454. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  455. cmd_setl->hdr.pkt_size = packet_size;
  456. cmd_setl->hdr.src_port = 0;
  457. cmd_setl->hdr.dest_port = 0;
  458. cmd_setl->hdr.token = 0;
  459. cmd_setl->hdr.opcode = AVCS_CMD_SET_LICENSE;
  460. cmd_setl->id = module_id;
  461. cmd_setl->overwrite = 1;
  462. cmd_setl->size = cal_block->cal_data.size;
  463. memcpy((uint8_t *)cmd_setl + sizeof(struct avcs_cmd_set_license),
  464. cal_block->cal_data.kvaddr,
  465. cal_block->cal_data.size);
  466. pr_info("%s: Set license opcode=0x%x, id =0x%x, size = %d\n",
  467. __func__, cmd_setl->hdr.opcode,
  468. cmd_setl->id, cmd_setl->size);
  469. rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)cmd_setl);
  470. if (rc < 0)
  471. pr_err("%s: SET_LICENSE failed op[0x%x]rc[%d]\n",
  472. __func__, cmd_setl->hdr.opcode, rc);
  473. fail_cmd:
  474. kfree(cmd_setl);
  475. cal_data_unlock:
  476. mutex_unlock(&((q6core_lcl.cal_data[META_CAL])->lock));
  477. cmd_unlock:
  478. mutex_unlock(&(q6core_lcl.cmd_lock));
  479. return rc;
  480. }
  481. EXPORT_SYMBOL(core_set_license);
  482. /**
  483. * core_get_license_status -
  484. * command to retrieve license status for module
  485. *
  486. * @module_id: DSP Module ID
  487. *
  488. * Returns 0 on success or error on failure
  489. */
  490. int32_t core_get_license_status(uint32_t module_id)
  491. {
  492. struct avcs_cmd_get_license_validation_result get_lvr_cmd;
  493. int ret = 0;
  494. pr_debug("%s: module_id 0x%x", __func__, module_id);
  495. mutex_lock(&(q6core_lcl.cmd_lock));
  496. ocm_core_open();
  497. if (q6core_lcl.core_handle_q == NULL) {
  498. pr_err("%s: apr registration for CORE failed\n", __func__);
  499. ret = -ENODEV;
  500. goto fail_cmd;
  501. }
  502. get_lvr_cmd.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  503. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  504. get_lvr_cmd.hdr.pkt_size =
  505. sizeof(struct avcs_cmd_get_license_validation_result);
  506. get_lvr_cmd.hdr.src_port = 0;
  507. get_lvr_cmd.hdr.dest_port = 0;
  508. get_lvr_cmd.hdr.token = 0;
  509. get_lvr_cmd.hdr.opcode = AVCS_CMD_GET_LICENSE_VALIDATION_RESULT;
  510. get_lvr_cmd.id = module_id;
  511. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &get_lvr_cmd);
  512. if (ret < 0) {
  513. pr_err("%s: license_validation request failed, err %d\n",
  514. __func__, ret);
  515. ret = -EREMOTE;
  516. goto fail_cmd;
  517. }
  518. q6core_lcl.cmd_resp_received_flag &= ~(FLAG_CMDRSP_LICENSE_RESULT);
  519. mutex_unlock(&(q6core_lcl.cmd_lock));
  520. ret = wait_event_timeout(q6core_lcl.cmd_req_wait,
  521. (q6core_lcl.cmd_resp_received_flag ==
  522. FLAG_CMDRSP_LICENSE_RESULT),
  523. msecs_to_jiffies(TIMEOUT_MS));
  524. mutex_lock(&(q6core_lcl.cmd_lock));
  525. if (!ret) {
  526. pr_err("%s: wait_event timeout for CMDRSP_LICENSE_RESULT\n",
  527. __func__);
  528. ret = -ETIME;
  529. goto fail_cmd;
  530. }
  531. q6core_lcl.cmd_resp_received_flag &= ~(FLAG_CMDRSP_LICENSE_RESULT);
  532. ret = q6core_lcl.cmd_resp_payload.cmdrsp_license_result.result;
  533. fail_cmd:
  534. mutex_unlock(&(q6core_lcl.cmd_lock));
  535. pr_info("%s: cmdrsp_license_result.result = 0x%x for module 0x%x\n",
  536. __func__, ret, module_id);
  537. return ret;
  538. }
  539. EXPORT_SYMBOL(core_get_license_status);
  540. /**
  541. * core_set_dolby_manufacturer_id -
  542. * command to set dolby manufacturer id
  543. *
  544. * @manufacturer_id: Dolby manufacturer id
  545. *
  546. * Returns 0 on success or error on failure
  547. */
  548. uint32_t core_set_dolby_manufacturer_id(int manufacturer_id)
  549. {
  550. struct adsp_dolby_manufacturer_id payload;
  551. int rc = 0;
  552. pr_debug("%s: manufacturer_id :%d\n", __func__, manufacturer_id);
  553. mutex_lock(&(q6core_lcl.cmd_lock));
  554. ocm_core_open();
  555. if (q6core_lcl.core_handle_q) {
  556. payload.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_EVENT,
  557. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  558. payload.hdr.pkt_size =
  559. sizeof(struct adsp_dolby_manufacturer_id);
  560. payload.hdr.src_port = 0;
  561. payload.hdr.dest_port = 0;
  562. payload.hdr.token = 0;
  563. payload.hdr.opcode = ADSP_CMD_SET_DOLBY_MANUFACTURER_ID;
  564. payload.manufacturer_id = manufacturer_id;
  565. pr_debug("%s: Send Dolby security opcode=0x%x manufacturer ID = %d\n",
  566. __func__,
  567. payload.hdr.opcode, payload.manufacturer_id);
  568. rc = apr_send_pkt(q6core_lcl.core_handle_q,
  569. (uint32_t *)&payload);
  570. if (rc < 0)
  571. pr_err("%s: SET_DOLBY_MANUFACTURER_ID failed op[0x%x]rc[%d]\n",
  572. __func__, payload.hdr.opcode, rc);
  573. }
  574. mutex_unlock(&(q6core_lcl.cmd_lock));
  575. return rc;
  576. }
  577. EXPORT_SYMBOL(core_set_dolby_manufacturer_id);
  578. /**
  579. * q6core_is_adsp_ready - check adsp ready status
  580. *
  581. * Returns true if adsp is ready otherwise returns false
  582. */
  583. bool q6core_is_adsp_ready(void)
  584. {
  585. int rc = 0;
  586. bool ret = false;
  587. struct apr_hdr hdr;
  588. pr_debug("%s: enter\n", __func__);
  589. memset(&hdr, 0, sizeof(hdr));
  590. hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  591. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  592. hdr.pkt_size = APR_PKT_SIZE(APR_HDR_SIZE, 0);
  593. hdr.opcode = AVCS_CMD_ADSP_EVENT_GET_STATE;
  594. mutex_lock(&(q6core_lcl.cmd_lock));
  595. ocm_core_open();
  596. if (q6core_lcl.core_handle_q) {
  597. q6core_lcl.bus_bw_resp_received = 0;
  598. rc = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)&hdr);
  599. if (rc < 0) {
  600. pr_err("%s: Get ADSP state APR packet send event %d\n",
  601. __func__, rc);
  602. goto bail;
  603. }
  604. rc = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  605. (q6core_lcl.bus_bw_resp_received == 1),
  606. msecs_to_jiffies(Q6_READY_TIMEOUT_MS));
  607. if (rc > 0 && q6core_lcl.bus_bw_resp_received) {
  608. /* ensure to read updated param by callback thread */
  609. rmb();
  610. ret = !!q6core_lcl.param;
  611. }
  612. }
  613. bail:
  614. pr_debug("%s: leave, rc %d, adsp ready %d\n", __func__, rc, ret);
  615. mutex_unlock(&(q6core_lcl.cmd_lock));
  616. return ret;
  617. }
  618. EXPORT_SYMBOL(q6core_is_adsp_ready);
  619. static int q6core_map_memory_regions(phys_addr_t *buf_add, uint32_t mempool_id,
  620. uint32_t *bufsz, uint32_t bufcnt, uint32_t *map_handle)
  621. {
  622. struct avs_cmd_shared_mem_map_regions *mmap_regions = NULL;
  623. struct avs_shared_map_region_payload *mregions = NULL;
  624. void *mmap_region_cmd = NULL;
  625. void *payload = NULL;
  626. int ret = 0;
  627. int i = 0;
  628. int cmd_size = 0;
  629. cmd_size = sizeof(struct avs_cmd_shared_mem_map_regions)
  630. + sizeof(struct avs_shared_map_region_payload)
  631. * bufcnt;
  632. mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL);
  633. if (mmap_region_cmd == NULL)
  634. return -ENOMEM;
  635. mmap_regions = (struct avs_cmd_shared_mem_map_regions *)mmap_region_cmd;
  636. mmap_regions->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  637. APR_HDR_LEN(APR_HDR_SIZE),
  638. APR_PKT_VER);
  639. mmap_regions->hdr.pkt_size = cmd_size;
  640. mmap_regions->hdr.src_port = 0;
  641. mmap_regions->hdr.dest_port = 0;
  642. mmap_regions->hdr.token = 0;
  643. mmap_regions->hdr.opcode = AVCS_CMD_SHARED_MEM_MAP_REGIONS;
  644. mmap_regions->mem_pool_id = ADSP_MEMORY_MAP_SHMEM8_4K_POOL & 0x00ff;
  645. mmap_regions->num_regions = bufcnt & 0x00ff;
  646. mmap_regions->property_flag = 0x00;
  647. payload = ((u8 *) mmap_region_cmd +
  648. sizeof(struct avs_cmd_shared_mem_map_regions));
  649. mregions = (struct avs_shared_map_region_payload *)payload;
  650. for (i = 0; i < bufcnt; i++) {
  651. mregions->shm_addr_lsw = lower_32_bits(buf_add[i]);
  652. mregions->shm_addr_msw =
  653. msm_audio_populate_upper_32_bits(buf_add[i]);
  654. mregions->mem_size_bytes = bufsz[i];
  655. ++mregions;
  656. }
  657. pr_debug("%s: sending memory map, addr %pK, size %d, bufcnt = %d\n",
  658. __func__, buf_add, bufsz[0], mmap_regions->num_regions);
  659. *map_handle = 0;
  660. q6core_lcl.bus_bw_resp_received = 0;
  661. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)
  662. mmap_regions);
  663. if (ret < 0) {
  664. pr_err("%s: mmap regions failed %d\n",
  665. __func__, ret);
  666. ret = -EINVAL;
  667. goto done;
  668. }
  669. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  670. (q6core_lcl.bus_bw_resp_received == 1),
  671. msecs_to_jiffies(TIMEOUT_MS));
  672. if (!ret) {
  673. pr_err("%s: timeout. waited for memory map\n", __func__);
  674. ret = -ETIME;
  675. goto done;
  676. }
  677. *map_handle = q6core_lcl.mem_map_cal_handle;
  678. done:
  679. kfree(mmap_region_cmd);
  680. return ret;
  681. }
  682. static int q6core_memory_unmap_regions(uint32_t mem_map_handle)
  683. {
  684. struct avs_cmd_shared_mem_unmap_regions unmap_regions;
  685. int ret = 0;
  686. memset(&unmap_regions, 0, sizeof(unmap_regions));
  687. unmap_regions.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  688. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  689. unmap_regions.hdr.pkt_size = sizeof(unmap_regions);
  690. unmap_regions.hdr.src_svc = APR_SVC_ADSP_CORE;
  691. unmap_regions.hdr.src_domain = APR_DOMAIN_APPS;
  692. unmap_regions.hdr.src_port = 0;
  693. unmap_regions.hdr.dest_svc = APR_SVC_ADSP_CORE;
  694. unmap_regions.hdr.dest_domain = APR_DOMAIN_ADSP;
  695. unmap_regions.hdr.dest_port = 0;
  696. unmap_regions.hdr.token = 0;
  697. unmap_regions.hdr.opcode = AVCS_CMD_SHARED_MEM_UNMAP_REGIONS;
  698. unmap_regions.mem_map_handle = mem_map_handle;
  699. q6core_lcl.bus_bw_resp_received = 0;
  700. pr_debug("%s: unmap regions map handle %d\n",
  701. __func__, mem_map_handle);
  702. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *)
  703. &unmap_regions);
  704. if (ret < 0) {
  705. pr_err("%s: unmap regions failed %d\n",
  706. __func__, ret);
  707. ret = -EINVAL;
  708. goto done;
  709. }
  710. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  711. (q6core_lcl.bus_bw_resp_received == 1),
  712. msecs_to_jiffies(TIMEOUT_MS));
  713. if (!ret) {
  714. pr_err("%s: timeout. waited for memory_unmap\n",
  715. __func__);
  716. ret = -ETIME;
  717. goto done;
  718. }
  719. done:
  720. return ret;
  721. }
  722. static int q6core_dereg_all_custom_topologies(void)
  723. {
  724. int ret = 0;
  725. struct avcs_cmd_deregister_topologies dereg_top;
  726. memset(&dereg_top, 0, sizeof(dereg_top));
  727. dereg_top.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  728. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  729. dereg_top.hdr.pkt_size = sizeof(dereg_top);
  730. dereg_top.hdr.src_svc = APR_SVC_ADSP_CORE;
  731. dereg_top.hdr.src_domain = APR_DOMAIN_APPS;
  732. dereg_top.hdr.src_port = 0;
  733. dereg_top.hdr.dest_svc = APR_SVC_ADSP_CORE;
  734. dereg_top.hdr.dest_domain = APR_DOMAIN_ADSP;
  735. dereg_top.hdr.dest_port = 0;
  736. dereg_top.hdr.token = 0;
  737. dereg_top.hdr.opcode = AVCS_CMD_DEREGISTER_TOPOLOGIES;
  738. dereg_top.payload_addr_lsw = 0;
  739. dereg_top.payload_addr_msw = 0;
  740. dereg_top.mem_map_handle = 0;
  741. dereg_top.payload_size = 0;
  742. dereg_top.mode = AVCS_MODE_DEREGISTER_ALL_CUSTOM_TOPOLOGIES;
  743. q6core_lcl.bus_bw_resp_received = 0;
  744. pr_debug("%s: Deregister topologies mode %d\n",
  745. __func__, dereg_top.mode);
  746. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &dereg_top);
  747. if (ret < 0) {
  748. pr_err("%s: Deregister topologies failed %d\n",
  749. __func__, ret);
  750. goto done;
  751. }
  752. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  753. (q6core_lcl.bus_bw_resp_received == 1),
  754. msecs_to_jiffies(TIMEOUT_MS));
  755. if (!ret) {
  756. pr_err("%s: wait_event timeout for Deregister topologies\n",
  757. __func__);
  758. goto done;
  759. }
  760. done:
  761. return ret;
  762. }
  763. static int q6core_send_custom_topologies(void)
  764. {
  765. int ret = 0;
  766. int ret2 = 0;
  767. struct cal_block_data *cal_block = NULL;
  768. struct avcs_cmd_register_topologies reg_top;
  769. if (!q6core_is_adsp_ready()) {
  770. pr_err("%s: ADSP is not ready!\n", __func__);
  771. return -ENODEV;
  772. }
  773. memset(&reg_top, 0, sizeof(reg_top));
  774. mutex_lock(&q6core_lcl.cal_data[CUST_TOP_CAL]->lock);
  775. mutex_lock(&q6core_lcl.cmd_lock);
  776. cal_block = cal_utils_get_only_cal_block(
  777. q6core_lcl.cal_data[CUST_TOP_CAL]);
  778. if (cal_block == NULL) {
  779. pr_debug("%s: cal block is NULL!\n", __func__);
  780. goto unlock;
  781. }
  782. if (cal_block->cal_data.size <= 0) {
  783. pr_debug("%s: cal size is %zd not sending\n",
  784. __func__, cal_block->cal_data.size);
  785. goto unlock;
  786. }
  787. q6core_dereg_all_custom_topologies();
  788. ret = q6core_map_memory_regions(&cal_block->cal_data.paddr, 0,
  789. (uint32_t *)&cal_block->map_data.map_size, 1,
  790. &cal_block->map_data.q6map_handle);
  791. if (!ret) {
  792. pr_err("%s: q6core_map_memory_regions failed\n", __func__);
  793. goto unlock;
  794. }
  795. reg_top.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
  796. APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
  797. reg_top.hdr.pkt_size = sizeof(reg_top);
  798. reg_top.hdr.src_svc = APR_SVC_ADSP_CORE;
  799. reg_top.hdr.src_domain = APR_DOMAIN_APPS;
  800. reg_top.hdr.src_port = 0;
  801. reg_top.hdr.dest_svc = APR_SVC_ADSP_CORE;
  802. reg_top.hdr.dest_domain = APR_DOMAIN_ADSP;
  803. reg_top.hdr.dest_port = 0;
  804. reg_top.hdr.token = 0;
  805. reg_top.hdr.opcode = AVCS_CMD_REGISTER_TOPOLOGIES;
  806. reg_top.payload_addr_lsw =
  807. lower_32_bits(cal_block->cal_data.paddr);
  808. reg_top.payload_addr_msw =
  809. msm_audio_populate_upper_32_bits(cal_block->cal_data.paddr);
  810. reg_top.mem_map_handle = cal_block->map_data.q6map_handle;
  811. reg_top.payload_size = cal_block->cal_data.size;
  812. q6core_lcl.adsp_status = 0;
  813. q6core_lcl.bus_bw_resp_received = 0;
  814. pr_debug("%s: Register topologies addr %pK, size %zd, map handle %d\n",
  815. __func__, &cal_block->cal_data.paddr, cal_block->cal_data.size,
  816. cal_block->map_data.q6map_handle);
  817. ret = apr_send_pkt(q6core_lcl.core_handle_q, (uint32_t *) &reg_top);
  818. if (ret < 0) {
  819. pr_err("%s: Register topologies failed %d\n",
  820. __func__, ret);
  821. goto unmap;
  822. }
  823. ret = wait_event_timeout(q6core_lcl.bus_bw_req_wait,
  824. (q6core_lcl.bus_bw_resp_received == 1),
  825. msecs_to_jiffies(TIMEOUT_MS));
  826. if (!ret) {
  827. pr_err("%s: wait_event timeout for Register topologies\n",
  828. __func__);
  829. goto unmap;
  830. }
  831. if (q6core_lcl.adsp_status < 0)
  832. ret = q6core_lcl.adsp_status;
  833. unmap:
  834. ret2 = q6core_memory_unmap_regions(cal_block->map_data.q6map_handle);
  835. if (!ret2) {
  836. pr_err("%s: q6core_memory_unmap_regions failed for map handle %d\n",
  837. __func__, cal_block->map_data.q6map_handle);
  838. ret = ret2;
  839. goto unlock;
  840. }
  841. unlock:
  842. mutex_unlock(&q6core_lcl.cmd_lock);
  843. mutex_unlock(&q6core_lcl.cal_data[CUST_TOP_CAL]->lock);
  844. return ret;
  845. }
  846. static int get_cal_type_index(int32_t cal_type)
  847. {
  848. int ret = -EINVAL;
  849. switch (cal_type) {
  850. case AUDIO_CORE_METAINFO_CAL_TYPE:
  851. ret = META_CAL;
  852. break;
  853. case CORE_CUSTOM_TOPOLOGIES_CAL_TYPE:
  854. ret = CUST_TOP_CAL;
  855. break;
  856. default:
  857. pr_err("%s: invalid cal type %d!\n", __func__, cal_type);
  858. }
  859. return ret;
  860. }
  861. static int q6core_alloc_cal(int32_t cal_type,
  862. size_t data_size, void *data)
  863. {
  864. int ret = 0;
  865. int cal_index;
  866. cal_index = get_cal_type_index(cal_type);
  867. if (cal_index < 0) {
  868. pr_err("%s: could not get cal index %d!\n",
  869. __func__, cal_index);
  870. ret = -EINVAL;
  871. goto done;
  872. }
  873. ret = cal_utils_alloc_cal(data_size, data,
  874. q6core_lcl.cal_data[cal_index], 0, NULL);
  875. if (ret < 0) {
  876. pr_err("%s: cal_utils_alloc_block failed, ret = %d, cal type = %d!\n",
  877. __func__, ret, cal_type);
  878. goto done;
  879. }
  880. done:
  881. return ret;
  882. }
  883. static int q6core_dealloc_cal(int32_t cal_type,
  884. size_t data_size, void *data)
  885. {
  886. int ret = 0;
  887. int cal_index;
  888. cal_index = get_cal_type_index(cal_type);
  889. if (cal_index < 0) {
  890. pr_err("%s: could not get cal index %d!\n",
  891. __func__, cal_index);
  892. ret = -EINVAL;
  893. goto done;
  894. }
  895. ret = cal_utils_dealloc_cal(data_size, data,
  896. q6core_lcl.cal_data[cal_index]);
  897. if (ret < 0) {
  898. pr_err("%s: cal_utils_dealloc_block failed, ret = %d, cal type = %d!\n",
  899. __func__, ret, cal_type);
  900. goto done;
  901. }
  902. done:
  903. return ret;
  904. }
  905. static int q6core_set_cal(int32_t cal_type,
  906. size_t data_size, void *data)
  907. {
  908. int ret = 0;
  909. int cal_index;
  910. cal_index = get_cal_type_index(cal_type);
  911. if (cal_index < 0) {
  912. pr_err("%s: could not get cal index %d!\n",
  913. __func__, cal_index);
  914. ret = -EINVAL;
  915. goto done;
  916. }
  917. ret = cal_utils_set_cal(data_size, data,
  918. q6core_lcl.cal_data[cal_index], 0, NULL);
  919. if (ret < 0) {
  920. pr_err("%s: cal_utils_set_cal failed, ret = %d, cal type = %d!\n",
  921. __func__, ret, cal_type);
  922. goto done;
  923. }
  924. if (cal_index == CUST_TOP_CAL)
  925. ret = q6core_send_custom_topologies();
  926. done:
  927. return ret;
  928. }
  929. static void q6core_delete_cal_data(void)
  930. {
  931. pr_debug("%s:\n", __func__);
  932. cal_utils_destroy_cal_types(CORE_MAX_CAL, q6core_lcl.cal_data);
  933. }
  934. static int q6core_init_cal_data(void)
  935. {
  936. int ret = 0;
  937. struct cal_type_info cal_type_info[] = {
  938. {{AUDIO_CORE_METAINFO_CAL_TYPE,
  939. {q6core_alloc_cal, q6core_dealloc_cal, NULL,
  940. q6core_set_cal, NULL, NULL} },
  941. {NULL, NULL, cal_utils_match_buf_num} },
  942. {{CORE_CUSTOM_TOPOLOGIES_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. };
  947. pr_debug("%s:\n", __func__);
  948. ret = cal_utils_create_cal_types(CORE_MAX_CAL,
  949. q6core_lcl.cal_data, cal_type_info);
  950. if (ret < 0) {
  951. pr_err("%s: could not create cal type!\n",
  952. __func__);
  953. goto err;
  954. }
  955. return ret;
  956. err:
  957. q6core_delete_cal_data();
  958. return ret;
  959. }
  960. int __init core_init(void)
  961. {
  962. memset(&q6core_lcl, 0, sizeof(struct q6core_str));
  963. init_waitqueue_head(&q6core_lcl.bus_bw_req_wait);
  964. init_waitqueue_head(&q6core_lcl.cmd_req_wait);
  965. init_waitqueue_head(&q6core_lcl.avcs_fwk_ver_req_wait);
  966. q6core_lcl.cmd_resp_received_flag = FLAG_NONE;
  967. mutex_init(&q6core_lcl.cmd_lock);
  968. mutex_init(&q6core_lcl.ver_lock);
  969. q6core_init_cal_data();
  970. return 0;
  971. }
  972. void __exit core_exit(void)
  973. {
  974. mutex_destroy(&q6core_lcl.cmd_lock);
  975. mutex_destroy(&q6core_lcl.ver_lock);
  976. q6core_delete_cal_data();
  977. }
  978. MODULE_DESCRIPTION("ADSP core driver");
  979. MODULE_LICENSE("GPL v2");