Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Local helper macros and functions for HD-audio core drivers
0004  */
0005 
0006 #ifndef __HDAC_LOCAL_H
0007 #define __HDAC_LOCAL_H
0008 
0009 #define get_wcaps(codec, nid) \
0010     snd_hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
0011 
0012 /* get the widget type from widget capability bits */
0013 static inline int get_wcaps_type(unsigned int wcaps)
0014 {
0015     if (!wcaps)
0016         return -1; /* invalid type */
0017     return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
0018 }
0019 
0020 static inline unsigned int get_wcaps_channels(u32 wcaps)
0021 {
0022     unsigned int chans;
0023 
0024     chans = (wcaps & AC_WCAP_CHAN_CNT_EXT) >> 13;
0025     chans = (chans + 1) * 2;
0026 
0027     return chans;
0028 }
0029 
0030 extern const struct attribute_group *hdac_dev_attr_groups[];
0031 int hda_widget_sysfs_init(struct hdac_device *codec);
0032 int hda_widget_sysfs_reinit(struct hdac_device *codec, hda_nid_t start_nid,
0033                 int num_nodes);
0034 void hda_widget_sysfs_exit(struct hdac_device *codec);
0035 
0036 int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec);
0037 void snd_hdac_bus_remove_device(struct hdac_bus *bus,
0038                 struct hdac_device *codec);
0039 void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex);
0040 int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr,
0041                unsigned int cmd, unsigned int *res);
0042 
0043 int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
0044                unsigned int flags, unsigned int *res);
0045 
0046 #endif /* __HDAC_LOCAL_H */