snd_event.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef _SND_EVENT_H_
  6. #define _SND_EVENT_H_
  7. enum {
  8. SND_EVENT_DOWN = 0,
  9. SND_EVENT_UP,
  10. };
  11. struct snd_event_clients;
  12. struct snd_event_ops {
  13. int (*enable)(struct device *dev, void *data);
  14. void (*disable)(struct device *dev, void *data);
  15. };
  16. #ifdef CONFIG_SND_EVENT
  17. int snd_event_client_register(struct device *dev,
  18. const struct snd_event_ops *snd_ev_ops,
  19. void *data);
  20. int snd_event_client_deregister(struct device *dev);
  21. int snd_event_master_register(struct device *dev,
  22. const struct snd_event_ops *ops,
  23. struct snd_event_clients *clients,
  24. void *data);
  25. int snd_event_master_deregister(struct device *dev);
  26. int snd_event_notify(struct device *dev, unsigned int state);
  27. void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
  28. int (*compare)(struct device *, void *),
  29. void *data);
  30. static inline bool is_snd_event_fwk_enabled(void)
  31. {
  32. return 1;
  33. }
  34. #else
  35. static inline int snd_event_client_register(struct device *dev,
  36. const struct snd_event_ops *snd_ev_ops,
  37. void *data)
  38. {
  39. return 0;
  40. }
  41. static inline int snd_event_client_deregister(struct device *dev)
  42. {
  43. return 0;
  44. }
  45. static inline int snd_event_master_register(struct device *dev,
  46. const struct snd_event_ops *ops,
  47. struct snd_event_clients *clients,
  48. void *data)
  49. {
  50. return 0;
  51. }
  52. static inline int snd_event_master_deregister(struct device *dev)
  53. {
  54. return 0;
  55. }
  56. static inline int snd_event_notify(struct device *dev, unsigned int state)
  57. {
  58. return 0;
  59. }
  60. static inline void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
  61. int (*compare)(struct device *, void *),
  62. void *data)
  63. {
  64. return;
  65. }
  66. static inline bool is_snd_event_fwk_enabled(void)
  67. {
  68. return 0;
  69. }
  70. #endif /* CONFIG_SND_EVENT */
  71. #endif /* _SND_EVENT_H_ */