hda_component.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // SPDX-License-Identifier: GPL-2.0
  2. // HD-Audio helpers to sync with DRM driver
  3. #ifndef __SOUND_HDA_COMPONENT_H
  4. #define __SOUND_HDA_COMPONENT_H
  5. #include <drm/drm_audio_component.h>
  6. #include <sound/hdaudio.h>
  7. /* virtual idx for controller */
  8. #define HDA_CODEC_IDX_CONTROLLER HDA_MAX_CODECS
  9. #ifdef CONFIG_SND_HDA_COMPONENT
  10. int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
  11. void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx,
  12. bool enable);
  13. int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid,
  14. int dev_id, int rate);
  15. int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id,
  16. bool *audio_enabled, char *buffer, int max_bytes);
  17. int snd_hdac_acomp_init(struct hdac_bus *bus,
  18. const struct drm_audio_component_audio_ops *aops,
  19. int (*match_master)(struct device *, int, void *),
  20. size_t extra_size);
  21. int snd_hdac_acomp_exit(struct hdac_bus *bus);
  22. int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
  23. const struct drm_audio_component_audio_ops *ops);
  24. #else
  25. static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
  26. {
  27. return 0;
  28. }
  29. static inline void snd_hdac_display_power(struct hdac_bus *bus,
  30. unsigned int idx, bool enable)
  31. {
  32. }
  33. static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec,
  34. hda_nid_t nid, int dev_id, int rate)
  35. {
  36. return 0;
  37. }
  38. static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
  39. int dev_id, bool *audio_enabled,
  40. char *buffer, int max_bytes)
  41. {
  42. return -ENODEV;
  43. }
  44. static inline int snd_hdac_acomp_init(struct hdac_bus *bus,
  45. const struct drm_audio_component_audio_ops *aops,
  46. int (*match_master)(struct device *,
  47. int, void *),
  48. size_t extra_size)
  49. {
  50. return -ENODEV;
  51. }
  52. static inline int snd_hdac_acomp_exit(struct hdac_bus *bus)
  53. {
  54. return 0;
  55. }
  56. static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
  57. const struct drm_audio_component_audio_ops *ops)
  58. {
  59. return -ENODEV;
  60. }
  61. #endif
  62. #endif /* __SOUND_HDA_COMPONENT_H */