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