audio_pdr.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __AUDIO_PDR_H_
  6. #define __AUDIO_PDR_H_
  7. enum {
  8. AUDIO_PDR_DOMAIN_ADSP,
  9. AUDIO_PDR_DOMAIN_MAX
  10. };
  11. enum {
  12. AUDIO_PDR_FRAMEWORK_DOWN,
  13. AUDIO_PDR_FRAMEWORK_UP
  14. };
  15. #ifdef CONFIG_MSM_QDSP6_PDR
  16. /*
  17. * Use audio_pdr_register to register with the PDR subsystem this
  18. * should be done before module late init otherwise notification
  19. * of the AUDIO_PDR_FRAMEWORK_UP cannot be guaranteed.
  20. *
  21. * *nb - Pointer to a notifier block. Provide a callback function
  22. * to be notified once the PDR framework has been initialized.
  23. * Callback will receive either the AUDIO_PDR_FRAMEWORK_DOWN
  24. * or AUDIO_PDR_FRAMEWORK_UP ioctl depending on the state of
  25. * the PDR framework.
  26. *
  27. * Returns: Success: 0
  28. * Failure: Error code
  29. */
  30. int audio_pdr_register(struct notifier_block *nb);
  31. int audio_pdr_deregister(struct notifier_block *nb);
  32. /*
  33. * Use audio_pdr_service_register to register with a PDR service
  34. * Function should be called after nb callback registered with
  35. * audio_pdr_register has been called back with the
  36. * AUDIO_PDR_FRAMEWORK_UP ioctl.
  37. *
  38. * domain_id - Domain to use, example: AUDIO_PDR_ADSP
  39. * *nb - Pointer to a notifier block. Provide a callback function
  40. * that will be notified of the state of the domain
  41. * requested. The ioctls received by the callback are
  42. * defined in service-notifier.h.
  43. *
  44. * Returns: Success: Client handle
  45. * Failure: Pointer error code
  46. */
  47. void *audio_pdr_service_register(int domain_id,
  48. struct notifier_block *nb, int *curr_state);
  49. /*
  50. * Use audio_pdr_service_deregister to deregister with a PDR
  51. * service that was registered using the audio_pdr_service_register
  52. * API.
  53. *
  54. * *service_handle - Service handle returned by audio_pdr_service_register
  55. * *nb - Pointer to the notifier block. Used in the call to
  56. * audio_pdr_service_register.
  57. *
  58. * Returns: Success: Client handle
  59. * Failure: Error code
  60. */
  61. int audio_pdr_service_deregister(void *service_handle,
  62. struct notifier_block *nb);
  63. #else
  64. static inline int audio_pdr_register(struct notifier_block *nb)
  65. {
  66. return -ENODEV;
  67. }
  68. static inline int audio_pdr_deregister(struct notifier_block *nb)
  69. {
  70. return -ENODEV;
  71. }
  72. static inline void *audio_pdr_service_register(int domain_id,
  73. struct notifier_block *nb,
  74. int *curr_state)
  75. {
  76. return NULL;
  77. }
  78. static inline int audio_pdr_service_deregister(void *service_handle,
  79. struct notifier_block *nb)
  80. {
  81. return 0;
  82. }
  83. #endif /* CONFIG_MSM_QDSP6_PDR */
  84. #endif