audio_notifier.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2016-2017, 2020-2021 The Linux Foundation. All rights reserved.
  4. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  5. */
  6. #include <linux/init.h>
  7. #include <linux/kernel.h>
  8. #include <linux/module.h>
  9. #include <linux/err.h>
  10. #include <linux/string.h>
  11. #include <linux/delay.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/of_device.h>
  14. #include <linux/slab.h>
  15. #include <linux/remoteproc.h>
  16. #include <linux/remoteproc/qcom_rproc.h>
  17. #include <dsp/audio_notifier.h>
  18. #include "audio_ssr.h"
  19. #include "audio_pdr.h"
  20. /* Audio states internal to notifier. Client */
  21. /* used states defined in audio_notifier.h */
  22. /* for AUDIO_NOTIFIER_SERVICE_DOWN & UP */
  23. #define NO_SERVICE -2
  24. #define UNINIT_SERVICE -1
  25. static struct platform_device *adsp_private;
  26. struct adsp_notify_private {
  27. struct rproc *rproc_h;
  28. bool notifier_probe_complete;
  29. };
  30. /*
  31. * Used for each client registered with audio notifier
  32. */
  33. struct client_data {
  34. struct list_head list;
  35. /* Notifier block given by client */
  36. struct notifier_block *nb;
  37. char client_name[20];
  38. int service;
  39. int domain;
  40. };
  41. /*
  42. * Used for each service and domain combination
  43. * Tracks information specific to the underlying
  44. * service.
  45. */
  46. struct service_info {
  47. const char name[20];
  48. int domain_id;
  49. int state;
  50. void *handle;
  51. /* Hook registered to service */
  52. union {
  53. void (*cb)(int, char *, void *);
  54. struct notifier_block *nb;
  55. } hook;
  56. /* Used to determine when to register and deregister service */
  57. int num_of_clients;
  58. /* List of all clients registered to the service and domain */
  59. struct srcu_notifier_head client_nb_list;
  60. };
  61. static int audio_notifier_ssr_adsp_cb(struct notifier_block *this,
  62. unsigned long opcode, void *data);
  63. static int audio_notifier_ssr_modem_cb(struct notifier_block *this,
  64. unsigned long opcode, void *data);
  65. static void audio_notifier_pdr_adsp_cb(int status, char *service_name, void *priv);
  66. static struct notifier_block notifier_ssr_adsp_nb = {
  67. .notifier_call = audio_notifier_ssr_adsp_cb,
  68. .priority = 0,
  69. };
  70. static struct notifier_block notifier_ssr_modem_nb = {
  71. .notifier_call = audio_notifier_ssr_modem_cb,
  72. .priority = 0,
  73. };
  74. static struct service_info service_data[AUDIO_NOTIFIER_MAX_SERVICES]
  75. [AUDIO_NOTIFIER_MAX_DOMAINS] = {
  76. {{
  77. .name = "SSR_ADSP",
  78. .domain_id = AUDIO_SSR_DOMAIN_ADSP,
  79. .state = AUDIO_NOTIFIER_SERVICE_DOWN,
  80. .hook.nb = &notifier_ssr_adsp_nb
  81. },
  82. {
  83. .name = "SSR_MODEM",
  84. .domain_id = AUDIO_SSR_DOMAIN_MODEM,
  85. .state = AUDIO_NOTIFIER_SERVICE_DOWN,
  86. .hook.nb = &notifier_ssr_modem_nb
  87. } },
  88. {{
  89. .name = "PDR_ADSP",
  90. .domain_id = AUDIO_PDR_DOMAIN_ADSP,
  91. .state = UNINIT_SERVICE,
  92. .hook.cb = &audio_notifier_pdr_adsp_cb
  93. },
  94. { /* PDR MODEM service not enabled */
  95. .name = "INVALID",
  96. .state = NO_SERVICE,
  97. .hook.nb = NULL
  98. } }
  99. };
  100. /* Master list of all audio notifier clients */
  101. LIST_HEAD(client_list);
  102. struct mutex notifier_mutex;
  103. static int audio_notifier_get_default_service(int domain)
  104. {
  105. int service = NO_SERVICE;
  106. /* initial service to connect per domain */
  107. switch (domain) {
  108. case AUDIO_NOTIFIER_ADSP_DOMAIN:
  109. service = AUDIO_NOTIFIER_PDR_SERVICE;
  110. break;
  111. case AUDIO_NOTIFIER_MODEM_DOMAIN:
  112. service = AUDIO_NOTIFIER_SSR_SERVICE;
  113. break;
  114. }
  115. return service;
  116. }
  117. #ifdef CONFIG_MSM_QDSP6_PDR
  118. static void audio_notifier_init_service(int service)
  119. {
  120. int i;
  121. for (i = 0; i < AUDIO_NOTIFIER_MAX_DOMAINS; i++) {
  122. if (service_data[service][i].state == UNINIT_SERVICE)
  123. service_data[service][i].state =
  124. AUDIO_NOTIFIER_SERVICE_DOWN;
  125. }
  126. }
  127. #else
  128. static void audio_notifier_init_service(int service)
  129. {
  130. int i;
  131. for (i = 0; i < AUDIO_NOTIFIER_MAX_DOMAINS; i++)
  132. service_data[service][i].state = NO_SERVICE;
  133. }
  134. #endif
  135. static bool audio_notifier_is_service_enabled(int service)
  136. {
  137. int i;
  138. for (i = 0; i < AUDIO_NOTIFIER_MAX_DOMAINS; i++)
  139. if (service_data[service][i].state != NO_SERVICE)
  140. return true;
  141. return false;
  142. }
  143. static int audio_notifier_reg_service(int service, int domain)
  144. {
  145. void *handle;
  146. int ret = 0;
  147. int curr_state = AUDIO_NOTIFIER_SERVICE_DOWN;
  148. struct platform_device *pdev = adsp_private;
  149. struct adsp_notify_private *priv = NULL;
  150. struct rproc *rproc;
  151. priv = platform_get_drvdata(pdev);
  152. if (!priv) {
  153. dev_err_ratelimited(&pdev->dev, " %s: Private data get failed\n", __func__);
  154. return ret;;
  155. }
  156. rproc = priv->rproc_h;
  157. switch (service) {
  158. case AUDIO_NOTIFIER_SSR_SERVICE:
  159. handle = audio_ssr_register(rproc->name,
  160. service_data[service][domain].hook.nb);
  161. break;
  162. case AUDIO_NOTIFIER_PDR_SERVICE:
  163. handle = audio_pdr_service_register(
  164. service_data[service][domain].domain_id,
  165. service_data[service][domain].hook.cb);
  166. curr_state = AUDIO_NOTIFIER_SERVICE_DOWN;
  167. break;
  168. default:
  169. pr_err_ratelimited("%s: Invalid service %d\n",
  170. __func__, service);
  171. ret = -EINVAL;
  172. goto done;
  173. }
  174. if (IS_ERR_OR_NULL(handle)) {
  175. pr_err_ratelimited("%s: handle is incorrect for service %s\n",
  176. __func__, service_data[service][domain].name);
  177. ret = -EINVAL;
  178. goto done;
  179. }
  180. service_data[service][domain].state = curr_state;
  181. service_data[service][domain].handle = handle;
  182. pr_info("%s: service %s is in use\n",
  183. __func__, service_data[service][domain].name);
  184. pr_debug("%s: service %s has current state %d, handle 0x%pK\n",
  185. __func__, service_data[service][domain].name,
  186. service_data[service][domain].state,
  187. service_data[service][domain].handle);
  188. done:
  189. return ret;
  190. }
  191. static int audio_notifier_dereg_service(int service, int domain)
  192. {
  193. int ret;
  194. switch (service) {
  195. case AUDIO_NOTIFIER_SSR_SERVICE:
  196. ret = audio_ssr_deregister(
  197. service_data[service][domain].handle,
  198. service_data[service][domain].hook.nb);
  199. break;
  200. case AUDIO_NOTIFIER_PDR_SERVICE:
  201. ret = audio_pdr_service_deregister(
  202. service_data[service][domain].domain_id);
  203. break;
  204. default:
  205. pr_err_ratelimited("%s: Invalid service %d\n",
  206. __func__, service);
  207. ret = -EINVAL;
  208. goto done;
  209. }
  210. if (ret < 0) {
  211. pr_err_ratelimited("%s: deregister failed for service %s, ret %d\n",
  212. __func__, service_data[service][domain].name, ret);
  213. goto done;
  214. }
  215. pr_debug("%s: service %s with handle 0x%pK deregistered\n",
  216. __func__, service_data[service][domain].name,
  217. service_data[service][domain].handle);
  218. mutex_lock(&notifier_mutex);
  219. service_data[service][domain].state = AUDIO_NOTIFIER_SERVICE_DOWN;
  220. service_data[service][domain].handle = NULL;
  221. mutex_unlock(&notifier_mutex);
  222. done:
  223. return ret;
  224. }
  225. static int audio_notifier_reg_client_service(struct client_data *client_data,
  226. int service)
  227. {
  228. int ret = 0;
  229. int domain = client_data->domain;
  230. struct audio_notifier_cb_data data;
  231. switch (service) {
  232. case AUDIO_NOTIFIER_SSR_SERVICE:
  233. case AUDIO_NOTIFIER_PDR_SERVICE:
  234. if (service_data[service][domain].num_of_clients == 0)
  235. ret = audio_notifier_reg_service(service, domain);
  236. break;
  237. default:
  238. pr_err_ratelimited("%s: Invalid service for client %s, service %d, domain %d\n",
  239. __func__, client_data->client_name, service, domain);
  240. ret = -EINVAL;
  241. goto done;
  242. }
  243. if (ret < 0) {
  244. pr_err_ratelimited("%s: service registration failed on service %s for client %s\n",
  245. __func__, service_data[service][domain].name,
  246. client_data->client_name);
  247. goto done;
  248. }
  249. client_data->service = service;
  250. srcu_notifier_chain_register(
  251. &service_data[service][domain].client_nb_list,
  252. client_data->nb);
  253. service_data[service][domain].num_of_clients++;
  254. pr_debug("%s: registered client %s on service %s, current state 0x%x\n",
  255. __func__, client_data->client_name,
  256. service_data[service][domain].name,
  257. service_data[service][domain].state);
  258. /*
  259. * PDR registration returns current state
  260. * Force callback of client with current state for PDR
  261. */
  262. if (client_data->service == AUDIO_NOTIFIER_PDR_SERVICE) {
  263. data.service = service;
  264. data.domain = domain;
  265. (void)client_data->nb->notifier_call(client_data->nb,
  266. service_data[service][domain].state, &data);
  267. }
  268. done:
  269. return ret;
  270. }
  271. static int audio_notifier_reg_client(struct client_data *client_data)
  272. {
  273. int ret = 0;
  274. int service;
  275. int domain = client_data->domain;
  276. service = audio_notifier_get_default_service(domain);
  277. if (service < 0) {
  278. pr_err_ratelimited("%s: service %d is incorrect\n", __func__, service);
  279. ret = -EINVAL;
  280. goto done;
  281. }
  282. /* Search through services to find a valid one to register client on. */
  283. for (; service >= 0; service--) {
  284. /* If a service is not initialized, wait for it to come up. */
  285. if (service_data[service][domain].state == UNINIT_SERVICE) {
  286. pr_err_ratelimited("%s: failed in client registration to PDR\n",
  287. __func__);
  288. ret = -EINVAL;
  289. goto done;
  290. }
  291. /* Skip unsupported service and domain combinations. */
  292. if (service_data[service][domain].state < 0)
  293. continue;
  294. /* Only register clients who have not acquired a service. */
  295. if (client_data->service != NO_SERVICE)
  296. continue;
  297. /*
  298. * Only register clients, who have not acquired a service, on
  299. * the best available service for their domain. Uninitialized
  300. * services will try to register all of their clients after
  301. * they initialize correctly or will disable their service and
  302. * register clients on the next best avaialable service.
  303. */
  304. pr_debug("%s: register client %s on service %s",
  305. __func__, client_data->client_name,
  306. service_data[service][domain].name);
  307. ret = audio_notifier_reg_client_service(client_data, service);
  308. if (ret < 0)
  309. pr_err_ratelimited("%s: client %s failed to register on service %s",
  310. __func__, client_data->client_name,
  311. service_data[service][domain].name);
  312. }
  313. done:
  314. return ret;
  315. }
  316. static int audio_notifier_dereg_client(struct client_data *client_data)
  317. {
  318. int ret = 0;
  319. int service = client_data->service;
  320. int domain = client_data->domain;
  321. switch (client_data->service) {
  322. case AUDIO_NOTIFIER_SSR_SERVICE:
  323. case AUDIO_NOTIFIER_PDR_SERVICE:
  324. if (service_data[service][domain].num_of_clients == 1)
  325. ret = audio_notifier_dereg_service(service, domain);
  326. break;
  327. case NO_SERVICE:
  328. goto done;
  329. default:
  330. pr_err_ratelimited("%s: Invalid service for client %s, service %d\n",
  331. __func__, client_data->client_name,
  332. client_data->service);
  333. ret = -EINVAL;
  334. goto done;
  335. }
  336. if (ret < 0) {
  337. pr_err_ratelimited("%s: deregister failed for client %s on service %s, ret %d\n",
  338. __func__, client_data->client_name,
  339. service_data[service][domain].name, ret);
  340. goto done;
  341. }
  342. ret = srcu_notifier_chain_unregister(&service_data[service][domain].
  343. client_nb_list, client_data->nb);
  344. if (ret < 0) {
  345. pr_err_ratelimited("%s: srcu_notifier_chain_unregister failed, ret %d\n",
  346. __func__, ret);
  347. goto done;
  348. }
  349. pr_debug("%s: deregistered client %s on service %s\n",
  350. __func__, client_data->client_name,
  351. service_data[service][domain].name);
  352. client_data->service = NO_SERVICE;
  353. if (service_data[service][domain].num_of_clients > 0)
  354. service_data[service][domain].num_of_clients--;
  355. done:
  356. return ret;
  357. }
  358. static void audio_notifier_reg_all_clients(void)
  359. {
  360. struct list_head *ptr, *next;
  361. struct client_data *client_data;
  362. int ret;
  363. list_for_each_safe(ptr, next, &client_list) {
  364. client_data = list_entry(ptr, struct client_data, list);
  365. ret = audio_notifier_reg_client(client_data);
  366. if (ret < 0)
  367. pr_err_ratelimited("%s: audio_notifier_reg_client failed for client %s, \
  368. ret %d\n", __func__, client_data->client_name,
  369. ret);
  370. }
  371. }
  372. static int audio_notifier_convert_opcode(unsigned long opcode,
  373. unsigned long *notifier_opcode)
  374. {
  375. int ret = 0;
  376. switch (opcode) {
  377. case QCOM_SSR_BEFORE_SHUTDOWN:
  378. case SERVREG_SERVICE_STATE_DOWN:
  379. *notifier_opcode = AUDIO_NOTIFIER_SERVICE_DOWN;
  380. break;
  381. case QCOM_SSR_AFTER_POWERUP:
  382. case SERVREG_SERVICE_STATE_UP:
  383. *notifier_opcode = AUDIO_NOTIFIER_SERVICE_UP;
  384. break;
  385. default:
  386. pr_debug("%s: Unused opcode 0x%lx\n", __func__, opcode);
  387. ret = -EINVAL;
  388. }
  389. return ret;
  390. }
  391. static int audio_notifier_service_cb(unsigned long opcode,
  392. int service, int domain)
  393. {
  394. int ret = 0;
  395. unsigned long notifier_opcode;
  396. struct audio_notifier_cb_data data;
  397. if (audio_notifier_convert_opcode(opcode, &notifier_opcode) < 0)
  398. return NOTIFY_OK;
  399. data.service = service;
  400. data.domain = domain;
  401. pr_info("%s: service %s, opcode 0x%lx\n",
  402. __func__, service_data[service][domain].name, notifier_opcode);
  403. mutex_lock(&notifier_mutex);
  404. service_data[service][domain].state = notifier_opcode;
  405. ret = srcu_notifier_call_chain(&service_data[service][domain].
  406. client_nb_list, notifier_opcode, &data);
  407. mutex_unlock(&notifier_mutex);
  408. if (ret < 0)
  409. pr_err_ratelimited("%s: srcu_notifier_call_chain returned %d, service %s, \
  410. opcode 0x%lx\n", __func__, ret, service_data[service][domain].name,
  411. notifier_opcode);
  412. return NOTIFY_OK;
  413. }
  414. static void audio_notifier_pdr_adsp_cb(int status, char *service_name, void *priv)
  415. {
  416. audio_notifier_service_cb(status, AUDIO_NOTIFIER_PDR_SERVICE, AUDIO_NOTIFIER_ADSP_DOMAIN);
  417. }
  418. static int audio_notifier_ssr_adsp_cb(struct notifier_block *this,
  419. unsigned long opcode, void *data)
  420. {
  421. return audio_notifier_service_cb(opcode,
  422. AUDIO_NOTIFIER_SSR_SERVICE,
  423. AUDIO_NOTIFIER_ADSP_DOMAIN);
  424. }
  425. static int audio_notifier_ssr_modem_cb(struct notifier_block *this,
  426. unsigned long opcode, void *data)
  427. {
  428. return audio_notifier_service_cb(opcode,
  429. AUDIO_NOTIFIER_SSR_SERVICE,
  430. AUDIO_NOTIFIER_MODEM_DOMAIN);
  431. }
  432. int audio_notifier_deregister(char *client_name)
  433. {
  434. int ret = 0;
  435. int ret2;
  436. struct list_head *ptr, *next;
  437. struct client_data *client_data = NULL;
  438. if (client_name == NULL) {
  439. pr_err_ratelimited("%s: client_name is NULL\n", __func__);
  440. ret = -EINVAL;
  441. goto done;
  442. }
  443. list_for_each_safe(ptr, next, &client_list) {
  444. client_data = list_entry(ptr, struct client_data, list);
  445. if (!strcmp(client_name, client_data->client_name)) {
  446. ret2 = audio_notifier_dereg_client(client_data);
  447. if (ret2 < 0) {
  448. pr_err_ratelimited("%s: audio_notifier_dereg_client failed, \
  449. ret %d\n, service %d, domain %d",
  450. __func__, ret2, client_data->service,
  451. client_data->domain);
  452. ret = ret2;
  453. continue;
  454. }
  455. list_del(&client_data->list);
  456. kfree(client_data);
  457. }
  458. }
  459. done:
  460. return ret;
  461. }
  462. EXPORT_SYMBOL(audio_notifier_deregister);
  463. int audio_notifier_register(char *client_name, int domain,
  464. struct notifier_block *nb)
  465. {
  466. int ret;
  467. struct client_data *client_data;
  468. if (client_name == NULL) {
  469. pr_err_ratelimited("%s: client_name is NULL\n", __func__);
  470. ret = -EINVAL;
  471. goto done;
  472. } else if (nb == NULL) {
  473. pr_err_ratelimited("%s: Notifier block is NULL\n", __func__);
  474. ret = -EINVAL;
  475. goto done;
  476. }
  477. client_data = kmalloc(sizeof(*client_data), GFP_KERNEL);
  478. if (client_data == NULL) {
  479. ret = -ENOMEM;
  480. goto done;
  481. }
  482. INIT_LIST_HEAD(&client_data->list);
  483. client_data->nb = nb;
  484. strlcpy(client_data->client_name, client_name,
  485. sizeof(client_data->client_name));
  486. client_data->service = NO_SERVICE;
  487. client_data->domain = domain;
  488. mutex_lock(&notifier_mutex);
  489. ret = audio_notifier_reg_client(client_data);
  490. if (ret < 0) {
  491. mutex_unlock(&notifier_mutex);
  492. pr_err_ratelimited("%s: audio_notifier_reg_client for client %s failed ret = %d\n",
  493. __func__, client_data->client_name,
  494. ret);
  495. kfree(client_data);
  496. goto done;
  497. }
  498. list_add_tail(&client_data->list, &client_list);
  499. mutex_unlock(&notifier_mutex);
  500. done:
  501. return ret;
  502. }
  503. EXPORT_SYMBOL(audio_notifier_register);
  504. static int audio_notifier_subsys_init(void)
  505. {
  506. int i, j;
  507. mutex_init(&notifier_mutex);
  508. for (i = 0; i < AUDIO_NOTIFIER_MAX_SERVICES; i++) {
  509. for (j = 0; j < AUDIO_NOTIFIER_MAX_DOMAINS; j++) {
  510. if (service_data[i][j].state <= NO_SERVICE)
  511. continue;
  512. srcu_init_notifier_head(
  513. &service_data[i][j].client_nb_list);
  514. }
  515. }
  516. return 0;
  517. }
  518. static int audio_notifier_late_init(void)
  519. {
  520. /*
  521. * If pdr registration failed, register clients on next service
  522. * Do in late init to ensure that SSR subsystem is initialized
  523. */
  524. mutex_lock(&notifier_mutex);
  525. if (!audio_notifier_is_service_enabled(AUDIO_NOTIFIER_PDR_SERVICE))
  526. audio_notifier_reg_all_clients();
  527. mutex_unlock(&notifier_mutex);
  528. return 0;
  529. }
  530. bool audio_notifier_probe_status(void)
  531. {
  532. struct adsp_notify_private *priv = NULL;
  533. struct platform_device *pdev = NULL;
  534. if (!adsp_private)
  535. goto exit;
  536. pdev = adsp_private;
  537. priv = platform_get_drvdata(pdev);
  538. if (!priv) {
  539. dev_err(&pdev->dev," %s: Private data get failed\n", __func__);
  540. goto exit;
  541. }
  542. if (priv->notifier_probe_complete) {
  543. dev_dbg(&pdev->dev, "%s: audio notify probe successfully completed\n",
  544. __func__);
  545. return true;
  546. }
  547. exit:
  548. return false;
  549. }
  550. EXPORT_SYMBOL(audio_notifier_probe_status);
  551. static int audio_notify_probe(struct platform_device *pdev)
  552. {
  553. int ret = -EINVAL;
  554. struct adsp_notify_private *priv = NULL;
  555. struct property *prop;
  556. int size;
  557. phandle rproc_phandle;
  558. adsp_private = NULL;
  559. priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
  560. if (!priv) {
  561. ret = -ENOMEM;
  562. return ret;
  563. }
  564. priv->notifier_probe_complete = false;
  565. platform_set_drvdata(pdev, priv);
  566. prop = of_find_property(pdev->dev.of_node, "qcom,rproc-handle", &size);
  567. if (!prop) {
  568. dev_err(&pdev->dev, "Missing remotproc handle\n");
  569. return ret;
  570. }
  571. rproc_phandle = be32_to_cpup(prop->value);
  572. priv->rproc_h = rproc_get_by_phandle(rproc_phandle);
  573. if (!priv->rproc_h) {
  574. dev_info_ratelimited(&pdev->dev, "remotproc handle NULL\n");
  575. ret = -EPROBE_DEFER;
  576. return ret;
  577. }
  578. adsp_private = pdev;
  579. audio_notifier_subsys_init();
  580. audio_notifier_init_service(AUDIO_NOTIFIER_PDR_SERVICE);
  581. /* Do not return error since PDR enablement is not critical */
  582. audio_notifier_late_init();
  583. priv->notifier_probe_complete = true;
  584. return 0;
  585. }
  586. static int audio_notify_remove(struct platform_device *pdev)
  587. {
  588. return 0;
  589. }
  590. static const struct of_device_id adsp_notify_dt_match[] = {
  591. { .compatible = "qcom,adsp-notify" },
  592. { }
  593. };
  594. MODULE_DEVICE_TABLE(of, adsp_notify_dt_match);
  595. static struct platform_driver adsp_notify_driver = {
  596. .driver = {
  597. .name = "adsp-notify",
  598. .owner = THIS_MODULE,
  599. .of_match_table = adsp_notify_dt_match,
  600. .suppress_bind_attrs = true,
  601. },
  602. .probe = audio_notify_probe,
  603. .remove = audio_notify_remove,
  604. };
  605. static int __init audio_notifier_init(void)
  606. {
  607. return platform_driver_register(&adsp_notify_driver);
  608. }
  609. module_init(audio_notifier_init);
  610. static void __exit audio_notifier_exit(void)
  611. {
  612. platform_driver_unregister(&adsp_notify_driver);
  613. }
  614. module_exit(audio_notifier_exit);
  615. MODULE_SOFTDEP("pre: qcom_q6v5_pas");
  616. MODULE_DESCRIPTION("Audio notifier driver");
  617. MODULE_LICENSE("GPL v2");