qcom_aoss.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2019, Linaro Ltd
  4. */
  5. #include <linux/clk-provider.h>
  6. #include <linux/debugfs.h>
  7. #include <linux/interrupt.h>
  8. #include <linux/io.h>
  9. #include <linux/mailbox_client.h>
  10. #include <linux/module.h>
  11. #include <linux/of_platform.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/thermal.h>
  14. #include <linux/slab.h>
  15. #include <linux/soc/qcom/qcom_aoss.h>
  16. #define CREATE_TRACE_POINTS
  17. #include "trace-aoss.h"
  18. #define QMP_DESC_MAGIC 0x0
  19. #define QMP_DESC_VERSION 0x4
  20. #define QMP_DESC_FEATURES 0x8
  21. /* AOP-side offsets */
  22. #define QMP_DESC_UCORE_LINK_STATE 0xc
  23. #define QMP_DESC_UCORE_LINK_STATE_ACK 0x10
  24. #define QMP_DESC_UCORE_CH_STATE 0x14
  25. #define QMP_DESC_UCORE_CH_STATE_ACK 0x18
  26. #define QMP_DESC_UCORE_MBOX_SIZE 0x1c
  27. #define QMP_DESC_UCORE_MBOX_OFFSET 0x20
  28. /* Linux-side offsets */
  29. #define QMP_DESC_MCORE_LINK_STATE 0x24
  30. #define QMP_DESC_MCORE_LINK_STATE_ACK 0x28
  31. #define QMP_DESC_MCORE_CH_STATE 0x2c
  32. #define QMP_DESC_MCORE_CH_STATE_ACK 0x30
  33. #define QMP_DESC_MCORE_MBOX_SIZE 0x34
  34. #define QMP_DESC_MCORE_MBOX_OFFSET 0x38
  35. #define QMP_STATE_UP GENMASK(15, 0)
  36. #define QMP_STATE_DOWN GENMASK(31, 16)
  37. #define QMP_MAGIC 0x4d41494c /* mail */
  38. #define QMP_VERSION 1
  39. /* 64 bytes is enough to store the requests and provides padding to 4 bytes */
  40. #define QMP_MSG_LEN 64
  41. #define QMP_NUM_COOLING_RESOURCES 2
  42. #define QMP_DEBUGFS_FILES 4
  43. static bool qmp_cdev_max_state = 1;
  44. struct qmp_cooling_device {
  45. struct thermal_cooling_device *cdev;
  46. struct qmp *qmp;
  47. char *name;
  48. bool state;
  49. };
  50. /**
  51. * struct qmp - driver state for QMP implementation
  52. * @msgram: iomem referencing the message RAM used for communication
  53. * @dev: reference to QMP device
  54. * @mbox_client: mailbox client used to ring the doorbell on transmit
  55. * @mbox_chan: mailbox channel used to ring the doorbell on transmit
  56. * @offset: offset within @msgram where messages should be written
  57. * @size: maximum size of the messages to be transmitted
  58. * @event: wait_queue for synchronization with the IRQ
  59. * @tx_lock: provides synchronization between multiple callers of qmp_send()
  60. * @qdss_clk: QDSS clock hw struct
  61. * @cooling_devs: thermal cooling devices
  62. * @debugfs_root: directory for the developer/tester interface
  63. * @debugfs_files: array of individual debugfs entries under debugfs_root
  64. */
  65. struct qmp {
  66. void __iomem *msgram;
  67. struct device *dev;
  68. struct mbox_client mbox_client;
  69. struct mbox_chan *mbox_chan;
  70. size_t offset;
  71. size_t size;
  72. wait_queue_head_t event;
  73. struct mutex tx_lock;
  74. struct clk_hw qdss_clk;
  75. struct qmp_cooling_device *cooling_devs;
  76. struct dentry *debugfs_root;
  77. struct dentry *debugfs_files[QMP_DEBUGFS_FILES];
  78. };
  79. static void qmp_kick(struct qmp *qmp)
  80. {
  81. mbox_send_message(qmp->mbox_chan, NULL);
  82. mbox_client_txdone(qmp->mbox_chan, 0);
  83. }
  84. static bool qmp_magic_valid(struct qmp *qmp)
  85. {
  86. return readl(qmp->msgram + QMP_DESC_MAGIC) == QMP_MAGIC;
  87. }
  88. static bool qmp_link_acked(struct qmp *qmp)
  89. {
  90. return readl(qmp->msgram + QMP_DESC_MCORE_LINK_STATE_ACK) == QMP_STATE_UP;
  91. }
  92. static bool qmp_mcore_channel_acked(struct qmp *qmp)
  93. {
  94. return readl(qmp->msgram + QMP_DESC_MCORE_CH_STATE_ACK) == QMP_STATE_UP;
  95. }
  96. static bool qmp_ucore_channel_up(struct qmp *qmp)
  97. {
  98. return readl(qmp->msgram + QMP_DESC_UCORE_CH_STATE) == QMP_STATE_UP;
  99. }
  100. static int qmp_open(struct qmp *qmp)
  101. {
  102. int ret;
  103. u32 val;
  104. if (!qmp_magic_valid(qmp)) {
  105. dev_err(qmp->dev, "QMP magic doesn't match\n");
  106. return -EINVAL;
  107. }
  108. val = readl(qmp->msgram + QMP_DESC_VERSION);
  109. if (val != QMP_VERSION) {
  110. dev_err(qmp->dev, "unsupported QMP version %d\n", val);
  111. return -EINVAL;
  112. }
  113. qmp->offset = readl(qmp->msgram + QMP_DESC_MCORE_MBOX_OFFSET);
  114. qmp->size = readl(qmp->msgram + QMP_DESC_MCORE_MBOX_SIZE);
  115. if (!qmp->size) {
  116. dev_err(qmp->dev, "invalid mailbox size\n");
  117. return -EINVAL;
  118. }
  119. /* Ack remote core's link state */
  120. val = readl(qmp->msgram + QMP_DESC_UCORE_LINK_STATE);
  121. writel(val, qmp->msgram + QMP_DESC_UCORE_LINK_STATE_ACK);
  122. /* Set local core's link state to up */
  123. writel(QMP_STATE_UP, qmp->msgram + QMP_DESC_MCORE_LINK_STATE);
  124. qmp_kick(qmp);
  125. ret = wait_event_timeout(qmp->event, qmp_link_acked(qmp), HZ);
  126. if (!ret) {
  127. dev_err(qmp->dev, "ucore didn't ack link\n");
  128. goto timeout_close_link;
  129. }
  130. writel(QMP_STATE_UP, qmp->msgram + QMP_DESC_MCORE_CH_STATE);
  131. qmp_kick(qmp);
  132. ret = wait_event_timeout(qmp->event, qmp_ucore_channel_up(qmp), HZ);
  133. if (!ret) {
  134. dev_err(qmp->dev, "ucore didn't open channel\n");
  135. goto timeout_close_channel;
  136. }
  137. /* Ack remote core's channel state */
  138. writel(QMP_STATE_UP, qmp->msgram + QMP_DESC_UCORE_CH_STATE_ACK);
  139. qmp_kick(qmp);
  140. ret = wait_event_timeout(qmp->event, qmp_mcore_channel_acked(qmp), HZ);
  141. if (!ret) {
  142. dev_err(qmp->dev, "ucore didn't ack channel\n");
  143. goto timeout_close_channel;
  144. }
  145. return 0;
  146. timeout_close_channel:
  147. writel(QMP_STATE_DOWN, qmp->msgram + QMP_DESC_MCORE_CH_STATE);
  148. timeout_close_link:
  149. writel(QMP_STATE_DOWN, qmp->msgram + QMP_DESC_MCORE_LINK_STATE);
  150. qmp_kick(qmp);
  151. return -ETIMEDOUT;
  152. }
  153. static void qmp_close(struct qmp *qmp)
  154. {
  155. writel(QMP_STATE_DOWN, qmp->msgram + QMP_DESC_MCORE_CH_STATE);
  156. writel(QMP_STATE_DOWN, qmp->msgram + QMP_DESC_MCORE_LINK_STATE);
  157. qmp_kick(qmp);
  158. }
  159. static irqreturn_t qmp_intr(int irq, void *data)
  160. {
  161. struct qmp *qmp = data;
  162. wake_up_all(&qmp->event);
  163. return IRQ_HANDLED;
  164. }
  165. static bool qmp_message_empty(struct qmp *qmp)
  166. {
  167. return readl(qmp->msgram + qmp->offset) == 0;
  168. }
  169. /**
  170. * qmp_send() - send a message to the AOSS
  171. * @qmp: qmp context
  172. * @fmt: format string for message to be sent
  173. * @...: arguments for the format string
  174. *
  175. * Transmit message to AOSS and wait for the AOSS to acknowledge the message.
  176. * data must not be longer than the mailbox size. Access is synchronized by
  177. * this implementation.
  178. *
  179. * Return: 0 on success, negative errno on failure
  180. */
  181. int __printf(2, 3) qmp_send(struct qmp *qmp, const char *fmt, ...)
  182. {
  183. char buf[QMP_MSG_LEN];
  184. long time_left;
  185. va_list args;
  186. int len;
  187. int ret;
  188. if (WARN_ON(IS_ERR_OR_NULL(qmp) || !fmt))
  189. return -EINVAL;
  190. memset(buf, 0, sizeof(buf));
  191. va_start(args, fmt);
  192. len = vsnprintf(buf, sizeof(buf), fmt, args);
  193. va_end(args);
  194. if (WARN_ON(len >= sizeof(buf)))
  195. return -EINVAL;
  196. mutex_lock(&qmp->tx_lock);
  197. trace_aoss_send(buf);
  198. /* The message RAM only implements 32-bit accesses */
  199. __iowrite32_copy(qmp->msgram + qmp->offset + sizeof(u32),
  200. buf, sizeof(buf) / sizeof(u32));
  201. writel(sizeof(buf), qmp->msgram + qmp->offset);
  202. /* Read back length to confirm data written in message RAM */
  203. readl(qmp->msgram + qmp->offset);
  204. qmp_kick(qmp);
  205. time_left = wait_event_interruptible_timeout(qmp->event,
  206. qmp_message_empty(qmp), HZ);
  207. if (!time_left) {
  208. dev_err(qmp->dev, "ucore did not ack channel\n");
  209. ret = -ETIMEDOUT;
  210. /* Clear message from buffer */
  211. writel(0, qmp->msgram + qmp->offset);
  212. } else {
  213. ret = 0;
  214. }
  215. trace_aoss_send_done(buf, ret);
  216. mutex_unlock(&qmp->tx_lock);
  217. return ret;
  218. }
  219. EXPORT_SYMBOL_GPL(qmp_send);
  220. static int qmp_qdss_clk_prepare(struct clk_hw *hw)
  221. {
  222. static const char *buf = "{class: clock, res: qdss, val: 1}";
  223. struct qmp *qmp = container_of(hw, struct qmp, qdss_clk);
  224. return qmp_send(qmp, buf);
  225. }
  226. static void qmp_qdss_clk_unprepare(struct clk_hw *hw)
  227. {
  228. static const char *buf = "{class: clock, res: qdss, val: 0}";
  229. struct qmp *qmp = container_of(hw, struct qmp, qdss_clk);
  230. qmp_send(qmp, buf);
  231. }
  232. static const struct clk_ops qmp_qdss_clk_ops = {
  233. .prepare = qmp_qdss_clk_prepare,
  234. .unprepare = qmp_qdss_clk_unprepare,
  235. };
  236. static int qmp_qdss_clk_add(struct qmp *qmp)
  237. {
  238. static const struct clk_init_data qdss_init = {
  239. .ops = &qmp_qdss_clk_ops,
  240. .name = "qdss",
  241. };
  242. int ret;
  243. qmp->qdss_clk.init = &qdss_init;
  244. ret = clk_hw_register(qmp->dev, &qmp->qdss_clk);
  245. if (ret < 0) {
  246. dev_err(qmp->dev, "failed to register qdss clock\n");
  247. return ret;
  248. }
  249. ret = of_clk_add_hw_provider(qmp->dev->of_node, of_clk_hw_simple_get,
  250. &qmp->qdss_clk);
  251. if (ret < 0) {
  252. dev_err(qmp->dev, "unable to register of clk hw provider\n");
  253. clk_hw_unregister(&qmp->qdss_clk);
  254. }
  255. return ret;
  256. }
  257. static void qmp_qdss_clk_remove(struct qmp *qmp)
  258. {
  259. of_clk_del_provider(qmp->dev->of_node);
  260. clk_hw_unregister(&qmp->qdss_clk);
  261. }
  262. static int qmp_cdev_get_max_state(struct thermal_cooling_device *cdev,
  263. unsigned long *state)
  264. {
  265. *state = qmp_cdev_max_state;
  266. return 0;
  267. }
  268. static int qmp_cdev_get_cur_state(struct thermal_cooling_device *cdev,
  269. unsigned long *state)
  270. {
  271. struct qmp_cooling_device *qmp_cdev = cdev->devdata;
  272. *state = qmp_cdev->state;
  273. return 0;
  274. }
  275. static int qmp_cdev_set_cur_state(struct thermal_cooling_device *cdev,
  276. unsigned long state)
  277. {
  278. struct qmp_cooling_device *qmp_cdev = cdev->devdata;
  279. bool cdev_state;
  280. int ret;
  281. /* Normalize state */
  282. cdev_state = !!state;
  283. if (qmp_cdev->state == state)
  284. return 0;
  285. ret = qmp_send(qmp_cdev->qmp, "{class: volt_flr, event:zero_temp, res:%s, value:%s}",
  286. qmp_cdev->name, cdev_state ? "on" : "off");
  287. if (!ret)
  288. qmp_cdev->state = cdev_state;
  289. return ret;
  290. }
  291. static const struct thermal_cooling_device_ops qmp_cooling_device_ops = {
  292. .get_max_state = qmp_cdev_get_max_state,
  293. .get_cur_state = qmp_cdev_get_cur_state,
  294. .set_cur_state = qmp_cdev_set_cur_state,
  295. };
  296. static int qmp_cooling_device_add(struct qmp *qmp,
  297. struct qmp_cooling_device *qmp_cdev,
  298. struct device_node *node)
  299. {
  300. char *cdev_name = (char *)node->name;
  301. qmp_cdev->qmp = qmp;
  302. qmp_cdev->state = !qmp_cdev_max_state;
  303. qmp_cdev->name = cdev_name;
  304. qmp_cdev->cdev = devm_thermal_of_cooling_device_register
  305. (qmp->dev, node,
  306. cdev_name,
  307. qmp_cdev, &qmp_cooling_device_ops);
  308. if (IS_ERR(qmp_cdev->cdev))
  309. dev_err(qmp->dev, "unable to register %s cooling device\n",
  310. cdev_name);
  311. return PTR_ERR_OR_ZERO(qmp_cdev->cdev);
  312. }
  313. static int qmp_cooling_devices_register(struct qmp *qmp)
  314. {
  315. struct device_node *np;
  316. int count = 0;
  317. int ret;
  318. np = qmp->dev->of_node;
  319. qmp->cooling_devs = devm_kcalloc(qmp->dev, QMP_NUM_COOLING_RESOURCES,
  320. sizeof(*qmp->cooling_devs),
  321. GFP_KERNEL);
  322. if (!qmp->cooling_devs)
  323. return -ENOMEM;
  324. for_each_available_child_of_node_scoped(np, child) {
  325. if (!of_property_present(child, "#cooling-cells"))
  326. continue;
  327. ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++],
  328. child);
  329. if (ret)
  330. goto unroll;
  331. }
  332. if (!count)
  333. devm_kfree(qmp->dev, qmp->cooling_devs);
  334. return 0;
  335. unroll:
  336. while (--count >= 0)
  337. thermal_cooling_device_unregister
  338. (qmp->cooling_devs[count].cdev);
  339. devm_kfree(qmp->dev, qmp->cooling_devs);
  340. return ret;
  341. }
  342. static void qmp_cooling_devices_remove(struct qmp *qmp)
  343. {
  344. int i;
  345. for (i = 0; i < QMP_NUM_COOLING_RESOURCES; i++)
  346. thermal_cooling_device_unregister(qmp->cooling_devs[i].cdev);
  347. }
  348. /**
  349. * qmp_get() - get a qmp handle from a device
  350. * @dev: client device pointer
  351. *
  352. * Return: handle to qmp device on success, ERR_PTR() on failure
  353. */
  354. struct qmp *qmp_get(struct device *dev)
  355. {
  356. struct platform_device *pdev;
  357. struct device_node *np;
  358. struct qmp *qmp;
  359. if (!dev || !dev->of_node)
  360. return ERR_PTR(-EINVAL);
  361. np = of_parse_phandle(dev->of_node, "qcom,qmp", 0);
  362. if (!np)
  363. return ERR_PTR(-ENODEV);
  364. pdev = of_find_device_by_node(np);
  365. of_node_put(np);
  366. if (!pdev)
  367. return ERR_PTR(-EINVAL);
  368. qmp = platform_get_drvdata(pdev);
  369. if (!qmp) {
  370. put_device(&pdev->dev);
  371. return ERR_PTR(-EPROBE_DEFER);
  372. }
  373. return qmp;
  374. }
  375. EXPORT_SYMBOL_GPL(qmp_get);
  376. /**
  377. * qmp_put() - release a qmp handle
  378. * @qmp: qmp handle obtained from qmp_get()
  379. */
  380. void qmp_put(struct qmp *qmp)
  381. {
  382. /*
  383. * Match get_device() inside of_find_device_by_node() in
  384. * qmp_get()
  385. */
  386. if (!IS_ERR_OR_NULL(qmp))
  387. put_device(qmp->dev);
  388. }
  389. EXPORT_SYMBOL_GPL(qmp_put);
  390. struct qmp_debugfs_entry {
  391. const char *name;
  392. const char *fmt;
  393. bool is_bool;
  394. const char *true_val;
  395. const char *false_val;
  396. };
  397. static const struct qmp_debugfs_entry qmp_debugfs_entries[QMP_DEBUGFS_FILES] = {
  398. { "ddr_frequency_mhz", "{class: ddr, res: fixed, val: %u}", false },
  399. { "prevent_aoss_sleep", "{class: aoss_slp, res: sleep: %s}", true, "enable", "disable" },
  400. { "prevent_cx_collapse", "{class: cx_mol, res: cx, val: %s}", true, "mol", "off" },
  401. { "prevent_ddr_collapse", "{class: ddr_mol, res: ddr, val: %s}", true, "mol", "off" },
  402. };
  403. static ssize_t qmp_debugfs_write(struct file *file, const char __user *user_buf,
  404. size_t count, loff_t *pos)
  405. {
  406. const struct qmp_debugfs_entry *entry = NULL;
  407. struct qmp *qmp = file->private_data;
  408. char buf[QMP_MSG_LEN];
  409. unsigned int uint_val;
  410. const char *str_val;
  411. bool bool_val;
  412. int ret;
  413. int i;
  414. for (i = 0; i < ARRAY_SIZE(qmp->debugfs_files); i++) {
  415. if (qmp->debugfs_files[i] == file->f_path.dentry) {
  416. entry = &qmp_debugfs_entries[i];
  417. break;
  418. }
  419. }
  420. if (WARN_ON(!entry))
  421. return -EFAULT;
  422. if (entry->is_bool) {
  423. ret = kstrtobool_from_user(user_buf, count, &bool_val);
  424. if (ret)
  425. return ret;
  426. str_val = bool_val ? entry->true_val : entry->false_val;
  427. ret = snprintf(buf, sizeof(buf), entry->fmt, str_val);
  428. if (ret >= sizeof(buf))
  429. return -EINVAL;
  430. } else {
  431. ret = kstrtou32_from_user(user_buf, count, 0, &uint_val);
  432. if (ret)
  433. return ret;
  434. ret = snprintf(buf, sizeof(buf), entry->fmt, uint_val);
  435. if (ret >= sizeof(buf))
  436. return -EINVAL;
  437. }
  438. ret = qmp_send(qmp, buf);
  439. if (ret < 0)
  440. return ret;
  441. return count;
  442. }
  443. static const struct file_operations qmp_debugfs_fops = {
  444. .open = simple_open,
  445. .write = qmp_debugfs_write,
  446. };
  447. static void qmp_debugfs_create(struct qmp *qmp)
  448. {
  449. const struct qmp_debugfs_entry *entry;
  450. int i;
  451. qmp->debugfs_root = debugfs_create_dir("qcom_aoss", NULL);
  452. for (i = 0; i < ARRAY_SIZE(qmp->debugfs_files); i++) {
  453. entry = &qmp_debugfs_entries[i];
  454. qmp->debugfs_files[i] = debugfs_create_file(entry->name, 0200,
  455. qmp->debugfs_root,
  456. qmp,
  457. &qmp_debugfs_fops);
  458. }
  459. }
  460. static int qmp_probe(struct platform_device *pdev)
  461. {
  462. struct qmp *qmp;
  463. int irq;
  464. int ret;
  465. qmp = devm_kzalloc(&pdev->dev, sizeof(*qmp), GFP_KERNEL);
  466. if (!qmp)
  467. return -ENOMEM;
  468. qmp->dev = &pdev->dev;
  469. init_waitqueue_head(&qmp->event);
  470. mutex_init(&qmp->tx_lock);
  471. qmp->msgram = devm_platform_ioremap_resource(pdev, 0);
  472. if (IS_ERR(qmp->msgram))
  473. return PTR_ERR(qmp->msgram);
  474. qmp->mbox_client.dev = &pdev->dev;
  475. qmp->mbox_client.knows_txdone = true;
  476. qmp->mbox_chan = mbox_request_channel(&qmp->mbox_client, 0);
  477. if (IS_ERR(qmp->mbox_chan)) {
  478. dev_err(&pdev->dev, "failed to acquire ipc mailbox\n");
  479. return PTR_ERR(qmp->mbox_chan);
  480. }
  481. irq = platform_get_irq(pdev, 0);
  482. ret = devm_request_irq(&pdev->dev, irq, qmp_intr, 0,
  483. "aoss-qmp", qmp);
  484. if (ret < 0) {
  485. dev_err(&pdev->dev, "failed to request interrupt\n");
  486. goto err_free_mbox;
  487. }
  488. ret = qmp_open(qmp);
  489. if (ret < 0)
  490. goto err_free_mbox;
  491. ret = qmp_qdss_clk_add(qmp);
  492. if (ret)
  493. goto err_close_qmp;
  494. ret = qmp_cooling_devices_register(qmp);
  495. if (ret)
  496. dev_err(&pdev->dev, "failed to register aoss cooling devices\n");
  497. platform_set_drvdata(pdev, qmp);
  498. qmp_debugfs_create(qmp);
  499. return 0;
  500. err_close_qmp:
  501. qmp_close(qmp);
  502. err_free_mbox:
  503. mbox_free_channel(qmp->mbox_chan);
  504. return ret;
  505. }
  506. static void qmp_remove(struct platform_device *pdev)
  507. {
  508. struct qmp *qmp = platform_get_drvdata(pdev);
  509. debugfs_remove_recursive(qmp->debugfs_root);
  510. qmp_qdss_clk_remove(qmp);
  511. qmp_cooling_devices_remove(qmp);
  512. qmp_close(qmp);
  513. mbox_free_channel(qmp->mbox_chan);
  514. }
  515. static const struct of_device_id qmp_dt_match[] = {
  516. { .compatible = "qcom,sc7180-aoss-qmp", },
  517. { .compatible = "qcom,sc7280-aoss-qmp", },
  518. { .compatible = "qcom,sdm845-aoss-qmp", },
  519. { .compatible = "qcom,sm8150-aoss-qmp", },
  520. { .compatible = "qcom,sm8250-aoss-qmp", },
  521. { .compatible = "qcom,sm8350-aoss-qmp", },
  522. { .compatible = "qcom,aoss-qmp", },
  523. {}
  524. };
  525. MODULE_DEVICE_TABLE(of, qmp_dt_match);
  526. static struct platform_driver qmp_driver = {
  527. .driver = {
  528. .name = "qcom_aoss_qmp",
  529. .of_match_table = qmp_dt_match,
  530. .suppress_bind_attrs = true,
  531. },
  532. .probe = qmp_probe,
  533. .remove_new = qmp_remove,
  534. };
  535. module_platform_driver(qmp_driver);
  536. MODULE_DESCRIPTION("Qualcomm AOSS QMP driver");
  537. MODULE_LICENSE("GPL v2");