diff options
Diffstat (limited to 'sound/pci/hda/alc_quirks.c')
-rw-r--r-- | sound/pci/hda/alc_quirks.c | 480 |
1 files changed, 0 insertions, 480 deletions
diff --git a/sound/pci/hda/alc_quirks.c b/sound/pci/hda/alc_quirks.c deleted file mode 100644 index a18952ed4311..000000000000 --- a/sound/pci/hda/alc_quirks.c +++ /dev/null | |||
@@ -1,480 +0,0 @@ | |||
1 | /* | ||
2 | * Common codes for Realtek codec quirks | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* | ||
7 | * configuration template - to be copied to the spec instance | ||
8 | */ | ||
9 | struct alc_config_preset { | ||
10 | const struct snd_kcontrol_new *mixers[5]; /* should be identical size | ||
11 | * with spec | ||
12 | */ | ||
13 | const struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | ||
14 | const struct hda_verb *init_verbs[5]; | ||
15 | unsigned int num_dacs; | ||
16 | const hda_nid_t *dac_nids; | ||
17 | hda_nid_t dig_out_nid; /* optional */ | ||
18 | hda_nid_t hp_nid; /* optional */ | ||
19 | const hda_nid_t *slave_dig_outs; | ||
20 | unsigned int num_adc_nids; | ||
21 | const hda_nid_t *adc_nids; | ||
22 | const hda_nid_t *capsrc_nids; | ||
23 | hda_nid_t dig_in_nid; | ||
24 | unsigned int num_channel_mode; | ||
25 | const struct hda_channel_mode *channel_mode; | ||
26 | int need_dac_fix; | ||
27 | int const_channel_count; | ||
28 | unsigned int num_mux_defs; | ||
29 | const struct hda_input_mux *input_mux; | ||
30 | void (*unsol_event)(struct hda_codec *, unsigned int); | ||
31 | void (*setup)(struct hda_codec *); | ||
32 | void (*init_hook)(struct hda_codec *); | ||
33 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
34 | const struct hda_amp_list *loopbacks; | ||
35 | void (*power_hook)(struct hda_codec *codec); | ||
36 | #endif | ||
37 | }; | ||
38 | |||
39 | /* | ||
40 | * channel mode setting | ||
41 | */ | ||
42 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, | ||
43 | struct snd_ctl_elem_info *uinfo) | ||
44 | { | ||
45 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
46 | struct alc_spec *spec = codec->spec; | ||
47 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | ||
48 | spec->num_channel_mode); | ||
49 | } | ||
50 | |||
51 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, | ||
52 | struct snd_ctl_elem_value *ucontrol) | ||
53 | { | ||
54 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
55 | struct alc_spec *spec = codec->spec; | ||
56 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | ||
57 | spec->num_channel_mode, | ||
58 | spec->ext_channel_count); | ||
59 | } | ||
60 | |||
61 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | ||
62 | struct snd_ctl_elem_value *ucontrol) | ||
63 | { | ||
64 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
65 | struct alc_spec *spec = codec->spec; | ||
66 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | ||
67 | spec->num_channel_mode, | ||
68 | &spec->ext_channel_count); | ||
69 | if (err >= 0 && !spec->const_channel_count) { | ||
70 | spec->multiout.max_channels = spec->ext_channel_count; | ||
71 | if (spec->need_dac_fix) | ||
72 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | ||
73 | } | ||
74 | return err; | ||
75 | } | ||
76 | |||
77 | /* | ||
78 | * Control the mode of pin widget settings via the mixer. "pc" is used | ||
79 | * instead of "%" to avoid consequences of accidentally treating the % as | ||
80 | * being part of a format specifier. Maximum allowed length of a value is | ||
81 | * 63 characters plus NULL terminator. | ||
82 | * | ||
83 | * Note: some retasking pin complexes seem to ignore requests for input | ||
84 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | ||
85 | * are requested. Therefore order this list so that this behaviour will not | ||
86 | * cause problems when mixer clients move through the enum sequentially. | ||
87 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of | ||
88 | * March 2006. | ||
89 | */ | ||
90 | static const char * const alc_pin_mode_names[] = { | ||
91 | "Mic 50pc bias", "Mic 80pc bias", | ||
92 | "Line in", "Line out", "Headphone out", | ||
93 | }; | ||
94 | static const unsigned char alc_pin_mode_values[] = { | ||
95 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | ||
96 | }; | ||
97 | /* The control can present all 5 options, or it can limit the options based | ||
98 | * in the pin being assumed to be exclusively an input or an output pin. In | ||
99 | * addition, "input" pins may or may not process the mic bias option | ||
100 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | ||
101 | * accept requests for bias as of chip versions up to March 2006) and/or | ||
102 | * wiring in the computer. | ||
103 | */ | ||
104 | #define ALC_PIN_DIR_IN 0x00 | ||
105 | #define ALC_PIN_DIR_OUT 0x01 | ||
106 | #define ALC_PIN_DIR_INOUT 0x02 | ||
107 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | ||
108 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | ||
109 | |||
110 | /* Info about the pin modes supported by the different pin direction modes. | ||
111 | * For each direction the minimum and maximum values are given. | ||
112 | */ | ||
113 | static const signed char alc_pin_mode_dir_info[5][2] = { | ||
114 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | ||
115 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | ||
116 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | ||
117 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | ||
118 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | ||
119 | }; | ||
120 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | ||
121 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | ||
122 | #define alc_pin_mode_n_items(_dir) \ | ||
123 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | ||
124 | |||
125 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, | ||
126 | struct snd_ctl_elem_info *uinfo) | ||
127 | { | ||
128 | unsigned int item_num = uinfo->value.enumerated.item; | ||
129 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
130 | |||
131 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
132 | uinfo->count = 1; | ||
133 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); | ||
134 | |||
135 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | ||
136 | item_num = alc_pin_mode_min(dir); | ||
137 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | ||
138 | return 0; | ||
139 | } | ||
140 | |||
141 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, | ||
142 | struct snd_ctl_elem_value *ucontrol) | ||
143 | { | ||
144 | unsigned int i; | ||
145 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
146 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
147 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
148 | long *valp = ucontrol->value.integer.value; | ||
149 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | ||
150 | AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
151 | 0x00); | ||
152 | |||
153 | /* Find enumerated value for current pinctl setting */ | ||
154 | i = alc_pin_mode_min(dir); | ||
155 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) | ||
156 | i++; | ||
157 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); | ||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | ||
162 | struct snd_ctl_elem_value *ucontrol) | ||
163 | { | ||
164 | signed int change; | ||
165 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
166 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
167 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
168 | long val = *ucontrol->value.integer.value; | ||
169 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | ||
170 | AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
171 | 0x00); | ||
172 | |||
173 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) | ||
174 | val = alc_pin_mode_min(dir); | ||
175 | |||
176 | change = pinctl != alc_pin_mode_values[val]; | ||
177 | if (change) { | ||
178 | /* Set pin mode to that requested */ | ||
179 | snd_hda_codec_write_cache(codec, nid, 0, | ||
180 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
181 | alc_pin_mode_values[val]); | ||
182 | |||
183 | /* Also enable the retasking pin's input/output as required | ||
184 | * for the requested pin mode. Enum values of 2 or less are | ||
185 | * input modes. | ||
186 | * | ||
187 | * Dynamically switching the input/output buffers probably | ||
188 | * reduces noise slightly (particularly on input) so we'll | ||
189 | * do it. However, having both input and output buffers | ||
190 | * enabled simultaneously doesn't seem to be problematic if | ||
191 | * this turns out to be necessary in the future. | ||
192 | */ | ||
193 | if (val <= 2) { | ||
194 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
195 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
196 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | ||
197 | HDA_AMP_MUTE, 0); | ||
198 | } else { | ||
199 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | ||
200 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
201 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
202 | HDA_AMP_MUTE, 0); | ||
203 | } | ||
204 | } | ||
205 | return change; | ||
206 | } | ||
207 | |||
208 | #define ALC_PIN_MODE(xname, nid, dir) \ | ||
209 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
210 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
211 | .info = alc_pin_mode_info, \ | ||
212 | .get = alc_pin_mode_get, \ | ||
213 | .put = alc_pin_mode_put, \ | ||
214 | .private_value = nid | (dir<<16) } | ||
215 | |||
216 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged | ||
217 | * together using a mask with more than one bit set. This control is | ||
218 | * currently used only by the ALC260 test model. At this stage they are not | ||
219 | * needed for any "production" models. | ||
220 | */ | ||
221 | #ifdef CONFIG_SND_DEBUG | ||
222 | #define alc_gpio_data_info snd_ctl_boolean_mono_info | ||
223 | |||
224 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, | ||
225 | struct snd_ctl_elem_value *ucontrol) | ||
226 | { | ||
227 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
228 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
229 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
230 | long *valp = ucontrol->value.integer.value; | ||
231 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
232 | AC_VERB_GET_GPIO_DATA, 0x00); | ||
233 | |||
234 | *valp = (val & mask) != 0; | ||
235 | return 0; | ||
236 | } | ||
237 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, | ||
238 | struct snd_ctl_elem_value *ucontrol) | ||
239 | { | ||
240 | signed int change; | ||
241 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
242 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
243 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
244 | long val = *ucontrol->value.integer.value; | ||
245 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, | ||
246 | AC_VERB_GET_GPIO_DATA, | ||
247 | 0x00); | ||
248 | |||
249 | /* Set/unset the masked GPIO bit(s) as needed */ | ||
250 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); | ||
251 | if (val == 0) | ||
252 | gpio_data &= ~mask; | ||
253 | else | ||
254 | gpio_data |= mask; | ||
255 | snd_hda_codec_write_cache(codec, nid, 0, | ||
256 | AC_VERB_SET_GPIO_DATA, gpio_data); | ||
257 | |||
258 | return change; | ||
259 | } | ||
260 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | ||
261 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
262 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
263 | .info = alc_gpio_data_info, \ | ||
264 | .get = alc_gpio_data_get, \ | ||
265 | .put = alc_gpio_data_put, \ | ||
266 | .private_value = nid | (mask<<16) } | ||
267 | #endif /* CONFIG_SND_DEBUG */ | ||
268 | |||
269 | /* A switch control to allow the enabling of the digital IO pins on the | ||
270 | * ALC260. This is incredibly simplistic; the intention of this control is | ||
271 | * to provide something in the test model allowing digital outputs to be | ||
272 | * identified if present. If models are found which can utilise these | ||
273 | * outputs a more complete mixer control can be devised for those models if | ||
274 | * necessary. | ||
275 | */ | ||
276 | #ifdef CONFIG_SND_DEBUG | ||
277 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info | ||
278 | |||
279 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, | ||
280 | struct snd_ctl_elem_value *ucontrol) | ||
281 | { | ||
282 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
283 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
284 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
285 | long *valp = ucontrol->value.integer.value; | ||
286 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
287 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); | ||
288 | |||
289 | *valp = (val & mask) != 0; | ||
290 | return 0; | ||
291 | } | ||
292 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, | ||
293 | struct snd_ctl_elem_value *ucontrol) | ||
294 | { | ||
295 | signed int change; | ||
296 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
297 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
298 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
299 | long val = *ucontrol->value.integer.value; | ||
300 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | ||
301 | AC_VERB_GET_DIGI_CONVERT_1, | ||
302 | 0x00); | ||
303 | |||
304 | /* Set/unset the masked control bit(s) as needed */ | ||
305 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); | ||
306 | if (val==0) | ||
307 | ctrl_data &= ~mask; | ||
308 | else | ||
309 | ctrl_data |= mask; | ||
310 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | ||
311 | ctrl_data); | ||
312 | |||
313 | return change; | ||
314 | } | ||
315 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | ||
316 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
317 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
318 | .info = alc_spdif_ctrl_info, \ | ||
319 | .get = alc_spdif_ctrl_get, \ | ||
320 | .put = alc_spdif_ctrl_put, \ | ||
321 | .private_value = nid | (mask<<16) } | ||
322 | #endif /* CONFIG_SND_DEBUG */ | ||
323 | |||
324 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. | ||
325 | * Again, this is only used in the ALC26x test models to help identify when | ||
326 | * the EAPD line must be asserted for features to work. | ||
327 | */ | ||
328 | #ifdef CONFIG_SND_DEBUG | ||
329 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | ||
330 | |||
331 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | ||
332 | struct snd_ctl_elem_value *ucontrol) | ||
333 | { | ||
334 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
335 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
336 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
337 | long *valp = ucontrol->value.integer.value; | ||
338 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
339 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | ||
340 | |||
341 | *valp = (val & mask) != 0; | ||
342 | return 0; | ||
343 | } | ||
344 | |||
345 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | ||
346 | struct snd_ctl_elem_value *ucontrol) | ||
347 | { | ||
348 | int change; | ||
349 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
350 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
351 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
352 | long val = *ucontrol->value.integer.value; | ||
353 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | ||
354 | AC_VERB_GET_EAPD_BTLENABLE, | ||
355 | 0x00); | ||
356 | |||
357 | /* Set/unset the masked control bit(s) as needed */ | ||
358 | change = (!val ? 0 : mask) != (ctrl_data & mask); | ||
359 | if (!val) | ||
360 | ctrl_data &= ~mask; | ||
361 | else | ||
362 | ctrl_data |= mask; | ||
363 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
364 | ctrl_data); | ||
365 | |||
366 | return change; | ||
367 | } | ||
368 | |||
369 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | ||
370 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
371 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
372 | .info = alc_eapd_ctrl_info, \ | ||
373 | .get = alc_eapd_ctrl_get, \ | ||
374 | .put = alc_eapd_ctrl_put, \ | ||
375 | .private_value = nid | (mask<<16) } | ||
376 | #endif /* CONFIG_SND_DEBUG */ | ||
377 | |||
378 | static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec) | ||
379 | { | ||
380 | struct alc_spec *spec = codec->spec; | ||
381 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
382 | |||
383 | if (!cfg->line_outs) { | ||
384 | while (cfg->line_outs < AUTO_CFG_MAX_OUTS && | ||
385 | cfg->line_out_pins[cfg->line_outs]) | ||
386 | cfg->line_outs++; | ||
387 | } | ||
388 | if (!cfg->speaker_outs) { | ||
389 | while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS && | ||
390 | cfg->speaker_pins[cfg->speaker_outs]) | ||
391 | cfg->speaker_outs++; | ||
392 | } | ||
393 | if (!cfg->hp_outs) { | ||
394 | while (cfg->hp_outs < AUTO_CFG_MAX_OUTS && | ||
395 | cfg->hp_pins[cfg->hp_outs]) | ||
396 | cfg->hp_outs++; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | /* | ||
401 | * set up from the preset table | ||
402 | */ | ||
403 | static void setup_preset(struct hda_codec *codec, | ||
404 | const struct alc_config_preset *preset) | ||
405 | { | ||
406 | struct alc_spec *spec = codec->spec; | ||
407 | int i; | ||
408 | |||
409 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | ||
410 | add_mixer(spec, preset->mixers[i]); | ||
411 | spec->cap_mixer = preset->cap_mixer; | ||
412 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; | ||
413 | i++) | ||
414 | add_verb(spec, preset->init_verbs[i]); | ||
415 | |||
416 | spec->channel_mode = preset->channel_mode; | ||
417 | spec->num_channel_mode = preset->num_channel_mode; | ||
418 | spec->need_dac_fix = preset->need_dac_fix; | ||
419 | spec->const_channel_count = preset->const_channel_count; | ||
420 | |||
421 | if (preset->const_channel_count) | ||
422 | spec->multiout.max_channels = preset->const_channel_count; | ||
423 | else | ||
424 | spec->multiout.max_channels = spec->channel_mode[0].channels; | ||
425 | spec->ext_channel_count = spec->channel_mode[0].channels; | ||
426 | |||
427 | spec->multiout.num_dacs = preset->num_dacs; | ||
428 | spec->multiout.dac_nids = preset->dac_nids; | ||
429 | spec->multiout.dig_out_nid = preset->dig_out_nid; | ||
430 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | ||
431 | spec->multiout.hp_nid = preset->hp_nid; | ||
432 | |||
433 | spec->num_mux_defs = preset->num_mux_defs; | ||
434 | if (!spec->num_mux_defs) | ||
435 | spec->num_mux_defs = 1; | ||
436 | spec->input_mux = preset->input_mux; | ||
437 | |||
438 | spec->num_adc_nids = preset->num_adc_nids; | ||
439 | spec->adc_nids = preset->adc_nids; | ||
440 | spec->capsrc_nids = preset->capsrc_nids; | ||
441 | spec->dig_in_nid = preset->dig_in_nid; | ||
442 | |||
443 | spec->unsol_event = preset->unsol_event; | ||
444 | spec->init_hook = preset->init_hook; | ||
445 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
446 | spec->power_hook = preset->power_hook; | ||
447 | spec->loopback.amplist = preset->loopbacks; | ||
448 | #endif | ||
449 | |||
450 | if (preset->setup) | ||
451 | preset->setup(codec); | ||
452 | |||
453 | alc_fixup_autocfg_pin_nums(codec); | ||
454 | } | ||
455 | |||
456 | static void alc_simple_setup_automute(struct alc_spec *spec, int mode) | ||
457 | { | ||
458 | int lo_pin = spec->autocfg.line_out_pins[0]; | ||
459 | |||
460 | if (lo_pin == spec->autocfg.speaker_pins[0] || | ||
461 | lo_pin == spec->autocfg.hp_pins[0]) | ||
462 | lo_pin = 0; | ||
463 | spec->automute_mode = mode; | ||
464 | spec->detect_hp = !!spec->autocfg.hp_pins[0]; | ||
465 | spec->detect_lo = !!lo_pin; | ||
466 | spec->automute_lo = spec->automute_lo_possible = !!lo_pin; | ||
467 | spec->automute_speaker = spec->automute_speaker_possible = !!spec->autocfg.speaker_pins[0]; | ||
468 | } | ||
469 | |||
470 | /* auto-toggle front mic */ | ||
471 | static void alc88x_simple_mic_automute(struct hda_codec *codec) | ||
472 | { | ||
473 | unsigned int present; | ||
474 | unsigned char bits; | ||
475 | |||
476 | present = snd_hda_jack_detect(codec, 0x18); | ||
477 | bits = present ? HDA_AMP_MUTE : 0; | ||
478 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | ||
479 | } | ||
480 | |||