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