cvp.c 15 KB

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