aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_auto_parser.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-05-13 05:35:44 -0400
committerTakashi Iwai <tiwai@suse.de>2012-05-13 05:35:44 -0400
commitd9bbb4756dbc05764cebd0e3e2f49a56c9504e4d (patch)
treeb25672ad22284debf08d6663c228dcfe70e0be94 /sound/pci/hda/hda_auto_parser.h
parent3e9e63dbd3745ba9ea10f0f86c93f4086c89d5b8 (diff)
parent8c7dd8907637d863bdd175f24e895cbcfe03e1e5 (diff)
Merge branch 'topic/hda' into topic/hda-switcheroo
Diffstat (limited to 'sound/pci/hda/hda_auto_parser.h')
-rw-r--r--sound/pci/hda/hda_auto_parser.h160
1 files changed, 160 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
new file mode 100644
index 000000000000..2a7889dfbd1b
--- /dev/null
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -0,0 +1,160 @@
1/*
2 * BIOS auto-parser helper functions for HD-audio
3 *
4 * Copyright (c) 2012 Takashi Iwai <tiwai@suse.de>
5 *
6 * This driver is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __SOUND_HDA_AUTO_PARSER_H
13#define __SOUND_HDA_AUTO_PARSER_H
14
15/*
16 * Helper for automatic pin configuration
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};
40
41struct auto_pin_cfg;
42const char *hda_get_autocfg_input_label(struct hda_codec *codec,
43 const struct auto_pin_cfg *cfg,
44 int input);
45int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
46 const struct auto_pin_cfg *cfg,
47 char *label, int maxlen, int *indexp);
48
49enum {
50 INPUT_PIN_ATTR_UNUSED, /* pin not connected */
51 INPUT_PIN_ATTR_INT, /* internal mic/line-in */
52 INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
53 INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
54 INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
55 INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
56};
57
58int snd_hda_get_input_pin_attr(unsigned int def_conf);
59
60struct auto_pin_cfg {
61 int line_outs;
62 /* sorted in the order of Front/Surr/CLFE/Side */
63 hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
64 int speaker_outs;
65 hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
66 int hp_outs;
67 int line_out_type; /* AUTO_PIN_XXX_OUT */
68 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
69 int num_inputs;
70 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
71 int dig_outs;
72 hda_nid_t dig_out_pins[2];
73 hda_nid_t dig_in_pin;
74 hda_nid_t mono_out_pin;
75 int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
76 int dig_in_type; /* HDA_PCM_TYPE_XXX */
77};
78
79/* bit-flags for snd_hda_parse_pin_def_config() behavior */
80#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
81#define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */
82
83int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
84 struct auto_pin_cfg *cfg,
85 const hda_nid_t *ignore_nids,
86 unsigned int cond_flags);
87
88/* older function */
89#define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
90 snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
91
92/*
93 */
94
95struct hda_gen_spec {
96 /* fix-up list */
97 int fixup_id;
98 const struct hda_fixup *fixup_list;
99 const char *fixup_name;
100
101 /* additional init verbs */
102 struct snd_array verbs;
103};
104
105
106/*
107 * Fix-up pin default configurations and add default verbs
108 */
109
110struct hda_pintbl {
111 hda_nid_t nid;
112 u32 val;
113};
114
115struct hda_model_fixup {
116 const int id;
117 const char *name;
118};
119
120struct hda_fixup {
121 int type;
122 bool chained;
123 int chain_id;
124 union {
125 const struct hda_pintbl *pins;
126 const struct hda_verb *verbs;
127 void (*func)(struct hda_codec *codec,
128 const struct hda_fixup *fix,
129 int action);
130 } v;
131};
132
133/* fixup types */
134enum {
135 HDA_FIXUP_INVALID,
136 HDA_FIXUP_PINS,
137 HDA_FIXUP_VERBS,
138 HDA_FIXUP_FUNC,
139};
140
141/* fixup action definitions */
142enum {
143 HDA_FIXUP_ACT_PRE_PROBE,
144 HDA_FIXUP_ACT_PROBE,
145 HDA_FIXUP_ACT_INIT,
146 HDA_FIXUP_ACT_BUILD,
147};
148
149int snd_hda_gen_add_verbs(struct hda_gen_spec *spec,
150 const struct hda_verb *list);
151void snd_hda_gen_apply_verbs(struct hda_codec *codec);
152void snd_hda_apply_pincfgs(struct hda_codec *codec,
153 const struct hda_pintbl *cfg);
154void snd_hda_apply_fixup(struct hda_codec *codec, int action);
155void snd_hda_pick_fixup(struct hda_codec *codec,
156 const struct hda_model_fixup *models,
157 const struct snd_pci_quirk *quirk,
158 const struct hda_fixup *fixlist);
159
160#endif /* __SOUND_HDA_AUTO_PARSER_H */