apr_v2.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
  4. */
  5. #include <linux/types.h>
  6. #include <linux/uaccess.h>
  7. #include <linux/spinlock.h>
  8. #include <linux/kernel.h>
  9. #include <dsp/audio_notifier.h>
  10. #include <ipc/apr.h>
  11. #include <ipc/apr_tal.h>
  12. /**
  13. * apr_get_subsys_state - get Q6 subsys status
  14. *
  15. * Returns apr_subsys_state
  16. */
  17. enum apr_subsys_state apr_get_subsys_state(void)
  18. {
  19. return apr_get_q6_state();
  20. }
  21. EXPORT_SYMBOL(apr_get_subsys_state);
  22. void apr_set_subsys_state(void)
  23. {
  24. apr_set_q6_state(APR_SUBSYS_DOWN);
  25. apr_set_modem_state(APR_SUBSYS_UP);
  26. }
  27. uint16_t apr_get_data_src(struct apr_hdr *hdr)
  28. {
  29. if (hdr->src_domain == APR_DOMAIN_MODEM)
  30. return APR_DEST_MODEM;
  31. else if (hdr->src_domain == APR_DOMAIN_ADSP)
  32. return APR_DEST_QDSP6;
  33. pr_err("APR: Pkt from wrong source: %d\n", hdr->src_domain);
  34. return APR_DEST_MAX; /*RETURN INVALID VALUE*/
  35. }
  36. int apr_get_dest_id(char *dest)
  37. {
  38. if (!strcmp(dest, "ADSP"))
  39. return APR_DEST_QDSP6;
  40. else
  41. return APR_DEST_MODEM;
  42. }
  43. void subsys_notif_register(char *client_name, int domain,
  44. struct notifier_block *nb)
  45. {
  46. int ret;
  47. ret = audio_notifier_register(client_name, domain, nb);
  48. if (ret < 0)
  49. pr_err("%s: Audio notifier register failed for domain %d ret = %d\n",
  50. __func__, domain, ret);
  51. }
  52. void subsys_notif_deregister(char *client_name)
  53. {
  54. int ret;
  55. ret = audio_notifier_deregister(client_name);
  56. if (ret < 0)
  57. pr_err("%s: Audio notifier de-register failed for client %s\n",
  58. __func__, client_name);
  59. }
  60. uint16_t apr_get_reset_domain(uint16_t proc)
  61. {
  62. return proc;
  63. }