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