audio_pdr.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef __AUDIO_PDR_H_
  14. #define __AUDIO_PDR_H_
  15. enum {
  16. AUDIO_PDR_DOMAIN_ADSP,
  17. AUDIO_PDR_DOMAIN_MAX
  18. };
  19. enum {
  20. AUDIO_PDR_FRAMEWORK_DOWN,
  21. AUDIO_PDR_FRAMEWORK_UP
  22. };
  23. #ifdef CONFIG_MSM_QDSP6_PDR
  24. /*
  25. * Use audio_pdr_register to register with the PDR subsystem this
  26. * should be done before module late init otherwise notification
  27. * of the AUDIO_PDR_FRAMEWORK_UP cannot be guaranteed.
  28. *
  29. * *nb - Pointer to a notifier block. Provide a callback function
  30. * to be notified once the PDR framework has been initialized.
  31. * Callback will receive either the AUDIO_PDR_FRAMEWORK_DOWN
  32. * or AUDIO_PDR_FRAMEWORK_UP ioctl depending on the state of
  33. * the PDR framework.
  34. *
  35. * Returns: Success: 0
  36. * Failure: Error code
  37. */
  38. int audio_pdr_register(struct notifier_block *nb);
  39. int audio_pdr_deregister(struct notifier_block *nb);
  40. /*
  41. * Use audio_pdr_service_register to register with a PDR service
  42. * Function should be called after nb callback registered with
  43. * audio_pdr_register has been called back with the
  44. * AUDIO_PDR_FRAMEWORK_UP ioctl.
  45. *
  46. * domain_id - Domain to use, example: AUDIO_PDR_ADSP
  47. * *nb - Pointer to a notifier block. Provide a callback function
  48. * that will be notified of the state of the domain
  49. * requested. The ioctls received by the callback are
  50. * defined in service-notifier.h.
  51. *
  52. * Returns: Success: Client handle
  53. * Failure: Pointer error code
  54. */
  55. void *audio_pdr_service_register(int domain_id,
  56. struct notifier_block *nb, int *curr_state);
  57. /*
  58. * Use audio_pdr_service_deregister to deregister with a PDR
  59. * service that was registered using the audio_pdr_service_register
  60. * API.
  61. *
  62. * *service_handle - Service handle returned by audio_pdr_service_register
  63. * *nb - Pointer to the notifier block. Used in the call to
  64. * audio_pdr_service_register.
  65. *
  66. * Returns: Success: Client handle
  67. * Failure: Error code
  68. */
  69. int audio_pdr_service_deregister(void *service_handle,
  70. struct notifier_block *nb);
  71. #else
  72. static inline int audio_pdr_register(struct notifier_block *nb)
  73. {
  74. return -ENODEV;
  75. }
  76. static inline int audio_pdr_deregister(struct notifier_block *nb)
  77. {
  78. return -ENODEV;
  79. }
  80. static inline void *audio_pdr_service_register(int domain_id,
  81. struct notifier_block *nb,
  82. int *curr_state)
  83. {
  84. return NULL;
  85. }
  86. static inline int audio_pdr_service_deregister(void *service_handle,
  87. struct notifier_block *nb)
  88. {
  89. return 0;
  90. }
  91. #endif /* CONFIG_MSM_QDSP6_PDR */
  92. #endif