Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // HD-Audio helpers to sync with DRM driver
0003 
0004 #ifndef __SOUND_HDA_COMPONENT_H
0005 #define __SOUND_HDA_COMPONENT_H
0006 
0007 #include <drm/drm_audio_component.h>
0008 #include <sound/hdaudio.h>
0009 
0010 /* virtual idx for controller */
0011 #define HDA_CODEC_IDX_CONTROLLER    HDA_MAX_CODECS
0012 
0013 #ifdef CONFIG_SND_HDA_COMPONENT
0014 int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable);
0015 void snd_hdac_display_power(struct hdac_bus *bus, unsigned int idx,
0016                 bool enable);
0017 int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid,
0018                  int dev_id, int rate);
0019 int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id,
0020                bool *audio_enabled, char *buffer, int max_bytes);
0021 int snd_hdac_acomp_init(struct hdac_bus *bus,
0022             const struct drm_audio_component_audio_ops *aops,
0023             int (*match_master)(struct device *, int, void *),
0024             size_t extra_size);
0025 int snd_hdac_acomp_exit(struct hdac_bus *bus);
0026 int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
0027                     const struct drm_audio_component_audio_ops *ops);
0028 #else
0029 static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable)
0030 {
0031     return 0;
0032 }
0033 static inline void snd_hdac_display_power(struct hdac_bus *bus,
0034                       unsigned int idx, bool enable)
0035 {
0036 }
0037 static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec,
0038                        hda_nid_t nid, int dev_id, int rate)
0039 {
0040     return 0;
0041 }
0042 static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
0043                      int dev_id, bool *audio_enabled,
0044                      char *buffer, int max_bytes)
0045 {
0046     return -ENODEV;
0047 }
0048 static inline int snd_hdac_acomp_init(struct hdac_bus *bus,
0049                       const struct drm_audio_component_audio_ops *aops,
0050                       int (*match_master)(struct device *,
0051                               int, void *),
0052                       size_t extra_size)
0053 {
0054     return -ENODEV;
0055 }
0056 static inline int snd_hdac_acomp_exit(struct hdac_bus *bus)
0057 {
0058     return 0;
0059 }
0060 static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
0061                           const struct drm_audio_component_audio_ops *ops)
0062 {
0063     return -ENODEV;
0064 }
0065 #endif
0066 
0067 #endif /* __SOUND_HDA_COMPONENT_H */