1
2
3
4
5
6
7
8
9
10
11
12#ifndef __SOUND_HDA_AUTO_PARSER_H
13#define __SOUND_HDA_AUTO_PARSER_H
14
15
16
17
18
19enum {
20 AUTO_PIN_MIC,
21 AUTO_PIN_LINE_IN,
22 AUTO_PIN_CD,
23 AUTO_PIN_AUX,
24 AUTO_PIN_LAST
25};
26
27enum {
28 AUTO_PIN_LINE_OUT,
29 AUTO_PIN_SPEAKER_OUT,
30 AUTO_PIN_HP_OUT
31};
32
33#define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
34#define AUTO_CFG_MAX_INS 8
35
36struct auto_pin_cfg_item {
37 hda_nid_t pin;
38 int type;
39 unsigned int is_headset_mic:1;
40 unsigned int is_headphone_mic:1;
41 unsigned int has_boost_on_pin:1;
42};
43
44struct auto_pin_cfg;
45const char *hda_get_autocfg_input_label(struct hda_codec *codec,
46 const struct auto_pin_cfg *cfg,
47 int input);
48int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
49 const struct auto_pin_cfg *cfg,
50 char *label, int maxlen, int *indexp);
51
52enum {
53 INPUT_PIN_ATTR_UNUSED,
54 INPUT_PIN_ATTR_INT,
55 INPUT_PIN_ATTR_DOCK,
56 INPUT_PIN_ATTR_NORMAL,
57 INPUT_PIN_ATTR_REAR,
58 INPUT_PIN_ATTR_FRONT,
59 INPUT_PIN_ATTR_LAST = INPUT_PIN_ATTR_FRONT,
60};
61
62int snd_hda_get_input_pin_attr(unsigned int def_conf);
63
64struct auto_pin_cfg {
65 int line_outs;
66
67 hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
68 int speaker_outs;
69 hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
70 int hp_outs;
71 int line_out_type;
72 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
73 int num_inputs;
74 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
75 int dig_outs;
76 hda_nid_t dig_out_pins[2];
77 hda_nid_t dig_in_pin;
78 hda_nid_t mono_out_pin;
79 int dig_out_type[2];
80 int dig_in_type;
81};
82
83
84#define HDA_PINCFG_NO_HP_FIXUP (1 << 0)
85#define HDA_PINCFG_NO_LO_FIXUP (1 << 1)
86#define HDA_PINCFG_HEADSET_MIC (1 << 2)
87#define HDA_PINCFG_HEADPHONE_MIC (1 << 3)
88
89int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
90 struct auto_pin_cfg *cfg,
91 const hda_nid_t *ignore_nids,
92 unsigned int cond_flags);
93
94
95#define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
96 snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
97
98static inline int auto_cfg_hp_outs(const struct auto_pin_cfg *cfg)
99{
100 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
101 cfg->line_outs : cfg->hp_outs;
102}
103static inline const hda_nid_t *auto_cfg_hp_pins(const struct auto_pin_cfg *cfg)
104{
105 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
106 cfg->line_out_pins : cfg->hp_pins;
107}
108static inline int auto_cfg_speaker_outs(const struct auto_pin_cfg *cfg)
109{
110 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
111 cfg->line_outs : cfg->speaker_outs;
112}
113static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg *cfg)
114{
115 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
116 cfg->line_out_pins : cfg->speaker_pins;
117}
118
119#endif
120