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