cvp.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  4. */
  5. #include <linux/debugfs.h>
  6. #include <linux/dma-mapping.h>
  7. #include <linux/init.h>
  8. #include <linux/ioctl.h>
  9. #include <linux/list.h>
  10. #include <linux/module.h>
  11. #include <linux/of_platform.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/slab.h>
  14. #include <linux/types.h>
  15. #include <linux/version.h>
  16. #include <linux/io.h>
  17. #include "msm_cvp_core.h"
  18. #include "msm_cvp_common.h"
  19. #include "msm_cvp_debug.h"
  20. #include "msm_cvp_internal.h"
  21. #include "msm_cvp_res_parse.h"
  22. #include "msm_cvp_resources.h"
  23. #include "cvp_hfi_api.h"
  24. #include "cvp_private.h"
  25. #include "msm_cvp_clocks.h"
  26. #include "msm_cvp_dsp.h"
  27. #include "msm_cvp.h"
  28. #define CLASS_NAME "cvp"
  29. #define DRIVER_NAME "cvp"
  30. struct msm_cvp_drv *cvp_driver;
  31. static int cvp_open(struct inode *inode, struct file *filp)
  32. {
  33. struct msm_cvp_core *core = container_of(inode->i_cdev,
  34. struct msm_cvp_core, cdev);
  35. struct msm_cvp_inst *inst;
  36. dprintk(CVP_SESS, "%s: core->id: %d\n", __func__, core->id);
  37. inst = msm_cvp_open(core->id, MSM_CVP_USER);
  38. if (!inst) {
  39. dprintk(CVP_ERR, "Failed to create cvp instance\n");
  40. return -ENOMEM;
  41. }
  42. filp->private_data = inst;
  43. return 0;
  44. }
  45. static int cvp_close(struct inode *inode, struct file *filp)
  46. {
  47. int rc = 0;
  48. struct msm_cvp_inst *inst = filp->private_data;
  49. rc = msm_cvp_close(inst);
  50. filp->private_data = NULL;
  51. return rc;
  52. }
  53. static unsigned int cvp_poll(struct file *filp, struct poll_table_struct *p)
  54. {
  55. int rc = 0;
  56. struct msm_cvp_inst *inst = filp->private_data;
  57. unsigned long flags = 0;
  58. poll_wait(filp, &inst->event_handler.wq, p);
  59. spin_lock_irqsave(&inst->event_handler.lock, flags);
  60. if (inst->event_handler.event == CVP_SSR_EVENT)
  61. rc |= POLLPRI;
  62. if (inst->event_handler.event == CVP_DUMP_EVENT)
  63. rc |= POLLIN;
  64. inst->event_handler.event = CVP_NO_EVENT;
  65. spin_unlock_irqrestore(&inst->event_handler.lock, flags);
  66. return rc;
  67. }
  68. static const struct file_operations cvp_fops = {
  69. .owner = THIS_MODULE,
  70. .open = cvp_open,
  71. .release = cvp_close,
  72. .unlocked_ioctl = cvp_unblocked_ioctl,
  73. .compat_ioctl = cvp_compat_ioctl,
  74. .poll = cvp_poll,
  75. };
  76. static int read_platform_resources(struct msm_cvp_core *core,
  77. struct platform_device *pdev)
  78. {
  79. int rc = 0;
  80. if (!core || !pdev) {
  81. dprintk(CVP_ERR, "%s: Invalid params %pK %pK\n",
  82. __func__, core, pdev);
  83. return -EINVAL;
  84. }
  85. core->hfi_type = CVP_HFI_IRIS;
  86. core->resources.pdev = pdev;
  87. if (pdev->dev.of_node) {
  88. /* Target supports DT, parse from it */
  89. rc = cvp_read_platform_resources_from_drv_data(core);
  90. rc = cvp_read_platform_resources_from_dt(&core->resources);
  91. } else {
  92. dprintk(CVP_ERR, "pdev node is NULL\n");
  93. rc = -EINVAL;
  94. }
  95. return rc;
  96. }
  97. static void init_cycle_info(struct cvp_cycle_info *info)
  98. {
  99. memset(info->sum_fps, 0, HFI_MAX_HW_THREADS*sizeof(u32));
  100. memset(info->hi_ctrl_lim, 0, HFI_MAX_HW_THREADS*sizeof(u32));
  101. memset(info->lo_ctrl_lim, 0, HFI_MAX_HW_THREADS*sizeof(u32));
  102. memset(info->cycle, 0,
  103. HFI_MAX_HW_THREADS*sizeof(struct cvp_cycle_stat));
  104. info->conf_freq = 0;
  105. }
  106. static int msm_cvp_initialize_core(struct platform_device *pdev,
  107. struct msm_cvp_core *core)
  108. {
  109. int i = 0;
  110. int rc = 0;
  111. if (!core)
  112. return -EINVAL;
  113. rc = read_platform_resources(core, pdev);
  114. if (rc) {
  115. dprintk(CVP_ERR, "Failed to get platform resources\n");
  116. return rc;
  117. }
  118. INIT_LIST_HEAD(&core->instances);
  119. mutex_init(&core->lock);
  120. mutex_init(&core->clk_lock);
  121. core->state = CVP_CORE_UNINIT;
  122. for (i = SYS_MSG_INDEX(SYS_MSG_START);
  123. i <= SYS_MSG_INDEX(SYS_MSG_END); i++) {
  124. init_completion(&core->completions[i]);
  125. }
  126. INIT_DELAYED_WORK(&core->fw_unload_work, msm_cvp_fw_unload_handler);
  127. INIT_WORK(&core->ssr_work, msm_cvp_ssr_handler);
  128. init_cycle_info(&core->dyn_clk);
  129. core->ssr_count = 0;
  130. return rc;
  131. }
  132. static ssize_t link_name_show(struct device *dev,
  133. struct device_attribute *attr,
  134. char *buf)
  135. {
  136. struct msm_cvp_core *core = dev_get_drvdata(dev);
  137. if (core)
  138. if (dev == core->dev)
  139. return snprintf(buf, PAGE_SIZE, "msm_cvp\n");
  140. else
  141. return 0;
  142. else
  143. return 0;
  144. }
  145. static DEVICE_ATTR_RO(link_name);
  146. static ssize_t pwr_collapse_delay_store(struct device *dev,
  147. struct device_attribute *attr,
  148. const char *buf, size_t count)
  149. {
  150. unsigned long val = 0;
  151. int rc = 0;
  152. struct msm_cvp_core *core = NULL;
  153. rc = kstrtoul(buf, 0, &val);
  154. if (rc)
  155. return rc;
  156. else if (!val)
  157. return -EINVAL;
  158. core = get_cvp_core(MSM_CORE_CVP);
  159. if (!core)
  160. return -EINVAL;
  161. core->resources.msm_cvp_pwr_collapse_delay = val;
  162. return count;
  163. }
  164. static ssize_t pwr_collapse_delay_show(struct device *dev,
  165. struct device_attribute *attr,
  166. char *buf)
  167. {
  168. struct msm_cvp_core *core = NULL;
  169. core = get_cvp_core(MSM_CORE_CVP);
  170. if (!core)
  171. return -EINVAL;
  172. return snprintf(buf, PAGE_SIZE, "%u\n",
  173. core->resources.msm_cvp_pwr_collapse_delay);
  174. }
  175. static DEVICE_ATTR_RW(pwr_collapse_delay);
  176. static ssize_t thermal_level_show(struct device *dev,
  177. struct device_attribute *attr,
  178. char *buf)
  179. {
  180. return snprintf(buf, PAGE_SIZE, "%d\n", cvp_driver->thermal_level);
  181. }
  182. static ssize_t thermal_level_store(struct device *dev,
  183. struct device_attribute *attr,
  184. const char *buf, size_t count)
  185. {
  186. int rc = 0, val = 0;
  187. rc = kstrtoint(buf, 0, &val);
  188. if (rc || val < 0) {
  189. dprintk(CVP_WARN,
  190. "Invalid thermal level value: %s\n", buf);
  191. return -EINVAL;
  192. }
  193. dprintk(CVP_PWR, "Thermal level old %d new %d\n",
  194. cvp_driver->thermal_level, val);
  195. if (val == cvp_driver->thermal_level)
  196. return count;
  197. cvp_driver->thermal_level = val;
  198. msm_cvp_comm_handle_thermal_event();
  199. return count;
  200. }
  201. static DEVICE_ATTR_RW(thermal_level);
  202. static ssize_t sku_version_show(struct device *dev,
  203. struct device_attribute *attr, char *buf)
  204. {
  205. return scnprintf(buf, PAGE_SIZE, "%d",
  206. cvp_driver->sku_version);
  207. }
  208. static DEVICE_ATTR_RO(sku_version);
  209. static ssize_t boot_store(struct device *dev,
  210. struct device_attribute *attr,
  211. const char *buf, size_t count)
  212. {
  213. int rc = 0, val = 0;
  214. static int booted;
  215. rc = kstrtoint(buf, 0, &val);
  216. if (rc || val < 0) {
  217. dprintk(CVP_WARN,
  218. "Invalid boot value: %s\n", buf);
  219. return -EINVAL;
  220. }
  221. if (val > 0 && booted == 0) {
  222. struct msm_cvp_inst *inst;
  223. inst = msm_cvp_open(MSM_CORE_CVP, MSM_CVP_BOOT);
  224. if (!inst) {
  225. dprintk(CVP_ERR,
  226. "Failed to create cvp instance\n");
  227. return -ENOMEM;
  228. }
  229. rc = msm_cvp_close(inst);
  230. if (rc) {
  231. dprintk(CVP_ERR,
  232. "Failed to close cvp instance\n");
  233. return rc;
  234. }
  235. } else if ((val == 2) && booted) {
  236. struct msm_cvp_inst *inst;
  237. inst = msm_cvp_open(MSM_CORE_CVP, MSM_CVP_USER);
  238. if (!inst) {
  239. dprintk(CVP_ERR,
  240. "Failed to create eva instance\n");
  241. return -ENOMEM;
  242. }
  243. rc = msm_cvp_session_create(inst);
  244. if (rc)
  245. dprintk(CVP_ERR, "Failed to create eva session\n");
  246. rc = msm_cvp_close(inst);
  247. if (rc) {
  248. dprintk(CVP_ERR,
  249. "Failed to close eva instance\n");
  250. return rc;
  251. }
  252. }
  253. booted = 1;
  254. return count;
  255. }
  256. static DEVICE_ATTR_WO(boot);
  257. static struct attribute *msm_cvp_core_attrs[] = {
  258. &dev_attr_pwr_collapse_delay.attr,
  259. &dev_attr_thermal_level.attr,
  260. &dev_attr_sku_version.attr,
  261. &dev_attr_link_name.attr,
  262. &dev_attr_boot.attr,
  263. NULL
  264. };
  265. static struct attribute_group msm_cvp_core_attr_group = {
  266. .attrs = msm_cvp_core_attrs,
  267. };
  268. static const struct of_device_id msm_cvp_plat_match[] = {
  269. {.compatible = "qcom,msm-cvp"},
  270. {.compatible = "qcom,msm-cvp,context-bank"},
  271. {.compatible = "qcom,msm-cvp,bus"},
  272. {.compatible = "qcom,msm-cvp,mem-cdsp"},
  273. {}
  274. };
  275. static int msm_probe_cvp_device(struct platform_device *pdev)
  276. {
  277. int rc = 0;
  278. struct msm_cvp_core *core;
  279. if (!cvp_driver) {
  280. dprintk(CVP_ERR, "Invalid cvp driver\n");
  281. return -EINVAL;
  282. }
  283. core = kzalloc(sizeof(*core), GFP_KERNEL);
  284. if (!core)
  285. return -ENOMEM;
  286. core->platform_data = cvp_get_drv_data(&pdev->dev);
  287. dev_set_drvdata(&pdev->dev, core);
  288. rc = msm_cvp_initialize_core(pdev, core);
  289. if (rc) {
  290. dprintk(CVP_ERR, "Failed to init core\n");
  291. goto err_core_init;
  292. }
  293. core->id = MSM_CORE_CVP;
  294. rc = alloc_chrdev_region(&core->dev_num, 0, 1, DRIVER_NAME);
  295. if (rc < 0) {
  296. dprintk(CVP_ERR, "alloc_chrdev_region failed: %d\n",
  297. rc);
  298. goto err_alloc_chrdev;
  299. }
  300. core->class = class_create(THIS_MODULE, CLASS_NAME);
  301. if (IS_ERR(core->class)) {
  302. rc = PTR_ERR(core->class);
  303. dprintk(CVP_ERR, "class_create failed: %d\n",
  304. rc);
  305. goto err_class_create;
  306. }
  307. core->dev = device_create(core->class, NULL,
  308. core->dev_num, NULL, DRIVER_NAME);
  309. if (IS_ERR(core->dev)) {
  310. rc = PTR_ERR(core->dev);
  311. dprintk(CVP_ERR, "device_create failed: %d\n",
  312. rc);
  313. goto err_device_create;
  314. }
  315. dev_set_drvdata(core->dev, core);
  316. cdev_init(&core->cdev, &cvp_fops);
  317. rc = cdev_add(&core->cdev,
  318. MKDEV(MAJOR(core->dev_num), 0), 1);
  319. if (rc < 0) {
  320. dprintk(CVP_ERR, "cdev_add failed: %d\n",
  321. rc);
  322. goto error_cdev_add;
  323. }
  324. /* finish setting up the 'core' */
  325. mutex_lock(&cvp_driver->lock);
  326. if (cvp_driver->num_cores + 1 > MSM_CVP_CORES_MAX) {
  327. mutex_unlock(&cvp_driver->lock);
  328. dprintk(CVP_ERR, "Maximum cores already exist, core_no = %d\n",
  329. cvp_driver->num_cores);
  330. goto err_cores_exceeded;
  331. }
  332. cvp_driver->num_cores++;
  333. mutex_unlock(&cvp_driver->lock);
  334. rc = sysfs_create_group(&core->dev->kobj, &msm_cvp_core_attr_group);
  335. if (rc) {
  336. dprintk(CVP_ERR,
  337. "Failed to create attributes\n");
  338. goto err_cores_exceeded;
  339. }
  340. core->device = cvp_hfi_initialize(core->hfi_type, core->id,
  341. &core->resources, &cvp_handle_cmd_response);
  342. if (IS_ERR_OR_NULL(core->device)) {
  343. mutex_lock(&cvp_driver->lock);
  344. cvp_driver->num_cores--;
  345. mutex_unlock(&cvp_driver->lock);
  346. rc = PTR_ERR(core->device) ?: -EBADHANDLE;
  347. if (rc != -EPROBE_DEFER)
  348. dprintk(CVP_ERR, "Failed to create HFI device\n");
  349. else
  350. dprintk(CVP_CORE, "msm_cvp: request probe defer\n");
  351. goto err_hfi_initialize;
  352. }
  353. mutex_lock(&cvp_driver->lock);
  354. list_add_tail(&core->list, &cvp_driver->cores);
  355. mutex_unlock(&cvp_driver->lock);
  356. core->debugfs_root = msm_cvp_debugfs_init_core(
  357. core, cvp_driver->debugfs_root);
  358. cvp_driver->sku_version = core->resources.sku_version;
  359. dprintk(CVP_CORE, "populating sub devices\n");
  360. /*
  361. * Trigger probe for each sub-device i.e. qcom,msm-cvp,context-bank.
  362. * When msm_cvp_probe is called for each sub-device, parse the
  363. * context-bank details and store it in core->resources.context_banks
  364. * list.
  365. */
  366. rc = of_platform_populate(pdev->dev.of_node, msm_cvp_plat_match, NULL,
  367. &pdev->dev);
  368. if (rc) {
  369. dprintk(CVP_ERR, "Failed to trigger probe for sub-devices\n");
  370. goto err_fail_sub_device_probe;
  371. }
  372. atomic64_set(&core->kernel_trans_id, get_pkt_array_size());
  373. if (core->resources.dsp_enabled) {
  374. rc = cvp_dsp_device_init();
  375. if (rc)
  376. dprintk(CVP_WARN, "Failed to initialize DSP driver\n");
  377. } else {
  378. dprintk(CVP_DSP, "DSP interface not enabled\n");
  379. }
  380. return rc;
  381. err_fail_sub_device_probe:
  382. cvp_hfi_deinitialize(core->hfi_type, core->device);
  383. err_hfi_initialize:
  384. err_cores_exceeded:
  385. cdev_del(&core->cdev);
  386. error_cdev_add:
  387. device_destroy(core->class, core->dev_num);
  388. err_device_create:
  389. class_destroy(core->class);
  390. err_class_create:
  391. unregister_chrdev_region(core->dev_num, 1);
  392. err_alloc_chrdev:
  393. sysfs_remove_group(&pdev->dev.kobj, &msm_cvp_core_attr_group);
  394. err_core_init:
  395. dev_set_drvdata(&pdev->dev, NULL);
  396. kfree(core);
  397. return rc;
  398. }
  399. static int msm_cvp_probe_mem_cdsp(struct platform_device *pdev)
  400. {
  401. return cvp_read_mem_cdsp_resources_from_dt(pdev);
  402. }
  403. static int msm_cvp_probe_context_bank(struct platform_device *pdev)
  404. {
  405. return cvp_read_context_bank_resources_from_dt(pdev);
  406. }
  407. static int msm_cvp_probe_bus(struct platform_device *pdev)
  408. {
  409. return cvp_read_bus_resources_from_dt(pdev);
  410. }
  411. static int msm_cvp_probe(struct platform_device *pdev)
  412. {
  413. /*
  414. * Sub devices probe will be triggered by of_platform_populate() towards
  415. * the end of the probe function after msm-cvp device probe is
  416. * completed. Return immediately after completing sub-device probe.
  417. */
  418. if (of_device_is_compatible(pdev->dev.of_node, "qcom,msm-cvp")) {
  419. return msm_probe_cvp_device(pdev);
  420. } else if (of_device_is_compatible(pdev->dev.of_node,
  421. "qcom,msm-cvp,bus")) {
  422. return msm_cvp_probe_bus(pdev);
  423. } else if (of_device_is_compatible(pdev->dev.of_node,
  424. "qcom,msm-cvp,context-bank")) {
  425. return msm_cvp_probe_context_bank(pdev);
  426. } else if (of_device_is_compatible(pdev->dev.of_node,
  427. "qcom,msm-cvp,mem-cdsp")) {
  428. return msm_cvp_probe_mem_cdsp(pdev);
  429. }
  430. /* How did we end up here? */
  431. MSM_CVP_ERROR(1);
  432. return -EINVAL;
  433. }
  434. static int msm_cvp_remove(struct platform_device *pdev)
  435. {
  436. int rc = 0;
  437. struct msm_cvp_core *core;
  438. if (!pdev) {
  439. dprintk(CVP_ERR, "%s invalid input %pK", __func__, pdev);
  440. return -EINVAL;
  441. }
  442. core = dev_get_drvdata(&pdev->dev);
  443. if (!core) {
  444. dprintk(CVP_ERR, "%s invalid core", __func__);
  445. return -EINVAL;
  446. }
  447. cvp_hfi_deinitialize(core->hfi_type, core->device);
  448. msm_cvp_free_platform_resources(&core->resources);
  449. sysfs_remove_group(&pdev->dev.kobj, &msm_cvp_core_attr_group);
  450. dev_set_drvdata(&pdev->dev, NULL);
  451. mutex_destroy(&core->lock);
  452. mutex_destroy(&core->clk_lock);
  453. kfree(core);
  454. return rc;
  455. }
  456. static int msm_cvp_pm_suspend(struct device *dev)
  457. {
  458. int rc = 0;
  459. struct msm_cvp_core *core;
  460. /*
  461. * Bail out if
  462. * - driver possibly not probed yet
  463. * - not the main device. We don't support power management on
  464. * subdevices (e.g. context banks)
  465. */
  466. if (!dev || !dev->driver ||
  467. !of_device_is_compatible(dev->of_node, "qcom,msm-cvp"))
  468. return 0;
  469. core = dev_get_drvdata(dev);
  470. if (!core) {
  471. dprintk(CVP_ERR, "%s invalid core\n", __func__);
  472. return -EINVAL;
  473. }
  474. rc = msm_cvp_suspend(core->id);
  475. if (rc == -ENOTSUPP)
  476. rc = 0;
  477. else if (rc)
  478. dprintk(CVP_WARN, "Failed to suspend: %d\n", rc);
  479. return rc;
  480. }
  481. static int msm_cvp_pm_resume(struct device *dev)
  482. {
  483. dprintk(CVP_INFO, "%s\n", __func__);
  484. return 0;
  485. }
  486. static const struct dev_pm_ops msm_cvp_pm_ops = {
  487. SET_SYSTEM_SLEEP_PM_OPS(msm_cvp_pm_suspend, msm_cvp_pm_resume)
  488. };
  489. MODULE_DEVICE_TABLE(of, msm_cvp_plat_match);
  490. static struct platform_driver msm_cvp_driver = {
  491. .probe = msm_cvp_probe,
  492. .remove = msm_cvp_remove,
  493. .driver = {
  494. .name = "msm_cvp",
  495. .of_match_table = msm_cvp_plat_match,
  496. .pm = &msm_cvp_pm_ops,
  497. },
  498. };
  499. static int __init msm_cvp_init(void)
  500. {
  501. int rc = 0;
  502. cvp_driver = kzalloc(sizeof(*cvp_driver), GFP_KERNEL);
  503. if (!cvp_driver) {
  504. dprintk(CVP_ERR,
  505. "Failed to allocate memroy for msm_cvp_drv\n");
  506. return -ENOMEM;
  507. }
  508. INIT_LIST_HEAD(&cvp_driver->cores);
  509. mutex_init(&cvp_driver->lock);
  510. cvp_driver->debugfs_root = msm_cvp_debugfs_init_drv();
  511. if (!cvp_driver->debugfs_root)
  512. dprintk(CVP_ERR,
  513. "Failed to create debugfs for msm_cvp\n");
  514. rc = platform_driver_register(&msm_cvp_driver);
  515. if (rc) {
  516. dprintk(CVP_ERR,
  517. "Failed to register platform driver\n");
  518. debugfs_remove_recursive(cvp_driver->debugfs_root);
  519. kfree(cvp_driver);
  520. cvp_driver = NULL;
  521. return rc;
  522. }
  523. cvp_driver->msg_cache = KMEM_CACHE(cvp_session_msg, 0);
  524. cvp_driver->frame_cache = KMEM_CACHE(msm_cvp_frame, 0);
  525. cvp_driver->buf_cache = KMEM_CACHE(cvp_internal_buf, 0);
  526. cvp_driver->smem_cache = KMEM_CACHE(msm_cvp_smem, 0);
  527. return rc;
  528. }
  529. static void __exit msm_cvp_exit(void)
  530. {
  531. cvp_dsp_device_exit();
  532. kmem_cache_destroy(cvp_driver->msg_cache);
  533. kmem_cache_destroy(cvp_driver->frame_cache);
  534. kmem_cache_destroy(cvp_driver->buf_cache);
  535. kmem_cache_destroy(cvp_driver->smem_cache);
  536. platform_driver_unregister(&msm_cvp_driver);
  537. debugfs_remove_recursive(cvp_driver->debugfs_root);
  538. mutex_destroy(&cvp_driver->lock);
  539. kfree(cvp_driver);
  540. cvp_driver = NULL;
  541. }
  542. module_init(msm_cvp_init);
  543. module_exit(msm_cvp_exit);
  544. MODULE_SOFTDEP("pre: msm-mmrm");
  545. MODULE_LICENSE("GPL v2");