blob: 28cb7f98982ec7b4145c6056d2d5266f21c442bd [file] [log] [blame]
Takashi Iwai7639a062015-03-03 10:07:24 +01001/*
2 */
3
4#ifndef __HDAC_LOCAL_H
5#define __HDAC_LOCAL_H
6
7int hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm);
8
9#define get_wcaps(codec, nid) \
10 hdac_read_parm(codec, nid, AC_PAR_AUDIO_WIDGET_CAP)
11/* get the widget type from widget capability bits */
12static inline int get_wcaps_type(unsigned int wcaps)
13{
14 if (!wcaps)
15 return -1; /* invalid type */
16 return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
17}
18
19#define get_pin_caps(codec, nid) \
20 hdac_read_parm(codec, nid, AC_PAR_PIN_CAP)
21
22static inline
23unsigned int get_pin_cfg(struct hdac_device *codec, hda_nid_t nid)
24{
25 unsigned int val;
26
27 if (snd_hdac_read(codec, nid, AC_VERB_GET_CONFIG_DEFAULT, 0, &val))
28 return -1;
29 return val;
30}
31
32#define get_amp_caps(codec, nid, dir) \
33 hdac_read_parm(codec, nid, (dir) == HDA_OUTPUT ? \
34 AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP)
35
36#define get_power_caps(codec, nid) \
37 hdac_read_parm(codec, nid, AC_PAR_POWER_STATE)
38
39#endif /* __HDAC_LOCAL_H */