diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-11-05 13:00:15 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2010-11-05 13:00:15 +0100 |
| commit | d009051ca214924526788afdb49ccd4a6fa2a4b8 (patch) | |
| tree | 09647ec60f9e522f7d43e375b737dc7213e24b9f /usr/src/dkms_source_tree/patch_realtek.c | |
Initial dump of hda from maverick kernel Ubuntu-2.6.35-23.36
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'usr/src/dkms_source_tree/patch_realtek.c')
| -rw-r--r-- | usr/src/dkms_source_tree/patch_realtek.c | 18858 |
1 files changed, 18858 insertions, 0 deletions
diff --git a/usr/src/dkms_source_tree/patch_realtek.c b/usr/src/dkms_source_tree/patch_realtek.c new file mode 100644 index 0000000..cfe0abc --- /dev/null +++ b/usr/src/dkms_source_tree/patch_realtek.c | |||
| @@ -0,0 +1,18858 @@ | |||
| 1 | /* | ||
| 2 | * Universal Interface for Intel High Definition Audio Codec | ||
| 3 | * | ||
| 4 | * HD audio interface patch for ALC 260/880/882 codecs | ||
| 5 | * | ||
| 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> | ||
| 7 | * PeiSen Hou <pshou@realtek.com.tw> | ||
| 8 | * Takashi Iwai <tiwai@suse.de> | ||
| 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | ||
| 10 | * | ||
| 11 | * This driver is free software; you can redistribute it and/or modify | ||
| 12 | * it under the terms of the GNU General Public License as published by | ||
| 13 | * the Free Software Foundation; either version 2 of the License, or | ||
| 14 | * (at your option) any later version. | ||
| 15 | * | ||
| 16 | * This driver is distributed in the hope that it will be useful, | ||
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | * GNU General Public License for more details. | ||
| 20 | * | ||
| 21 | * You should have received a copy of the GNU General Public License | ||
| 22 | * along with this program; if not, write to the Free Software | ||
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 24 | */ | ||
| 25 | |||
| 26 | #include <linux/init.h> | ||
| 27 | #include <linux/delay.h> | ||
| 28 | #include <linux/slab.h> | ||
| 29 | #include <linux/pci.h> | ||
| 30 | #include <sound/core.h> | ||
| 31 | #include "hda_codec.h" | ||
| 32 | #include "hda_local.h" | ||
| 33 | #include "hda_beep.h" | ||
| 34 | |||
| 35 | #define ALC880_FRONT_EVENT 0x01 | ||
| 36 | #define ALC880_DCVOL_EVENT 0x02 | ||
| 37 | #define ALC880_HP_EVENT 0x04 | ||
| 38 | #define ALC880_MIC_EVENT 0x08 | ||
| 39 | |||
| 40 | /* ALC880 board config type */ | ||
| 41 | enum { | ||
| 42 | ALC880_3ST, | ||
| 43 | ALC880_3ST_DIG, | ||
| 44 | ALC880_5ST, | ||
| 45 | ALC880_5ST_DIG, | ||
| 46 | ALC880_W810, | ||
| 47 | ALC880_Z71V, | ||
| 48 | ALC880_6ST, | ||
| 49 | ALC880_6ST_DIG, | ||
| 50 | ALC880_F1734, | ||
| 51 | ALC880_ASUS, | ||
| 52 | ALC880_ASUS_DIG, | ||
| 53 | ALC880_ASUS_W1V, | ||
| 54 | ALC880_ASUS_DIG2, | ||
| 55 | ALC880_FUJITSU, | ||
| 56 | ALC880_UNIWILL_DIG, | ||
| 57 | ALC880_UNIWILL, | ||
| 58 | ALC880_UNIWILL_P53, | ||
| 59 | ALC880_CLEVO, | ||
| 60 | ALC880_TCL_S700, | ||
| 61 | ALC880_LG, | ||
| 62 | ALC880_LG_LW, | ||
| 63 | ALC880_MEDION_RIM, | ||
| 64 | #ifdef CONFIG_SND_DEBUG | ||
| 65 | ALC880_TEST, | ||
| 66 | #endif | ||
| 67 | ALC880_AUTO, | ||
| 68 | ALC880_MODEL_LAST /* last tag */ | ||
| 69 | }; | ||
| 70 | |||
| 71 | /* ALC260 models */ | ||
| 72 | enum { | ||
| 73 | ALC260_BASIC, | ||
| 74 | ALC260_HP, | ||
| 75 | ALC260_HP_DC7600, | ||
| 76 | ALC260_HP_3013, | ||
| 77 | ALC260_FUJITSU_S702X, | ||
| 78 | ALC260_ACER, | ||
| 79 | ALC260_WILL, | ||
| 80 | ALC260_REPLACER_672V, | ||
| 81 | ALC260_FAVORIT100, | ||
| 82 | #ifdef CONFIG_SND_DEBUG | ||
| 83 | ALC260_TEST, | ||
| 84 | #endif | ||
| 85 | ALC260_AUTO, | ||
| 86 | ALC260_MODEL_LAST /* last tag */ | ||
| 87 | }; | ||
| 88 | |||
| 89 | /* ALC262 models */ | ||
| 90 | enum { | ||
| 91 | ALC262_BASIC, | ||
| 92 | ALC262_HIPPO, | ||
| 93 | ALC262_HIPPO_1, | ||
| 94 | ALC262_FUJITSU, | ||
| 95 | ALC262_HP_BPC, | ||
| 96 | ALC262_HP_BPC_D7000_WL, | ||
| 97 | ALC262_HP_BPC_D7000_WF, | ||
| 98 | ALC262_HP_TC_T5735, | ||
| 99 | ALC262_HP_RP5700, | ||
| 100 | ALC262_BENQ_ED8, | ||
| 101 | ALC262_SONY_ASSAMD, | ||
| 102 | ALC262_BENQ_T31, | ||
| 103 | ALC262_ULTRA, | ||
| 104 | ALC262_LENOVO_3000, | ||
| 105 | ALC262_NEC, | ||
| 106 | ALC262_TOSHIBA_S06, | ||
| 107 | ALC262_TOSHIBA_RX1, | ||
| 108 | ALC262_TYAN, | ||
| 109 | ALC262_AUTO, | ||
| 110 | ALC262_MODEL_LAST /* last tag */ | ||
| 111 | }; | ||
| 112 | |||
| 113 | /* ALC268 models */ | ||
| 114 | enum { | ||
| 115 | ALC267_QUANTA_IL1, | ||
| 116 | ALC268_3ST, | ||
| 117 | ALC268_TOSHIBA, | ||
| 118 | ALC268_ACER, | ||
| 119 | ALC268_ACER_DMIC, | ||
| 120 | ALC268_ACER_ASPIRE_ONE, | ||
| 121 | ALC268_DELL, | ||
| 122 | ALC268_ZEPTO, | ||
| 123 | #ifdef CONFIG_SND_DEBUG | ||
| 124 | ALC268_TEST, | ||
| 125 | #endif | ||
| 126 | ALC268_AUTO, | ||
| 127 | ALC268_MODEL_LAST /* last tag */ | ||
| 128 | }; | ||
| 129 | |||
| 130 | /* ALC269 models */ | ||
| 131 | enum { | ||
| 132 | ALC269_BASIC, | ||
| 133 | ALC269_QUANTA_FL1, | ||
| 134 | ALC269_AMIC, | ||
| 135 | ALC269_DMIC, | ||
| 136 | ALC269VB_AMIC, | ||
| 137 | ALC269VB_DMIC, | ||
| 138 | ALC269_FUJITSU, | ||
| 139 | ALC269_LIFEBOOK, | ||
| 140 | ALC269_AUTO, | ||
| 141 | ALC269_MODEL_LAST /* last tag */ | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* ALC861 models */ | ||
| 145 | enum { | ||
| 146 | ALC861_3ST, | ||
| 147 | ALC660_3ST, | ||
| 148 | ALC861_3ST_DIG, | ||
| 149 | ALC861_6ST_DIG, | ||
| 150 | ALC861_UNIWILL_M31, | ||
| 151 | ALC861_TOSHIBA, | ||
| 152 | ALC861_ASUS, | ||
| 153 | ALC861_ASUS_LAPTOP, | ||
| 154 | ALC861_AUTO, | ||
| 155 | ALC861_MODEL_LAST, | ||
| 156 | }; | ||
| 157 | |||
| 158 | /* ALC861-VD models */ | ||
| 159 | enum { | ||
| 160 | ALC660VD_3ST, | ||
| 161 | ALC660VD_3ST_DIG, | ||
| 162 | ALC660VD_ASUS_V1S, | ||
| 163 | ALC861VD_3ST, | ||
| 164 | ALC861VD_3ST_DIG, | ||
| 165 | ALC861VD_6ST_DIG, | ||
| 166 | ALC861VD_LENOVO, | ||
| 167 | ALC861VD_DALLAS, | ||
| 168 | ALC861VD_HP, | ||
| 169 | ALC861VD_AUTO, | ||
| 170 | ALC861VD_MODEL_LAST, | ||
| 171 | }; | ||
| 172 | |||
| 173 | /* ALC662 models */ | ||
| 174 | enum { | ||
| 175 | ALC662_3ST_2ch_DIG, | ||
| 176 | ALC662_3ST_6ch_DIG, | ||
| 177 | ALC662_3ST_6ch, | ||
| 178 | ALC662_5ST_DIG, | ||
| 179 | ALC662_LENOVO_101E, | ||
| 180 | ALC662_ASUS_EEEPC_P701, | ||
| 181 | ALC662_ASUS_EEEPC_EP20, | ||
| 182 | ALC663_ASUS_M51VA, | ||
| 183 | ALC663_ASUS_G71V, | ||
| 184 | ALC663_ASUS_H13, | ||
| 185 | ALC663_ASUS_G50V, | ||
| 186 | ALC662_ECS, | ||
| 187 | ALC663_ASUS_MODE1, | ||
| 188 | ALC662_ASUS_MODE2, | ||
| 189 | ALC663_ASUS_MODE3, | ||
| 190 | ALC663_ASUS_MODE4, | ||
| 191 | ALC663_ASUS_MODE5, | ||
| 192 | ALC663_ASUS_MODE6, | ||
| 193 | ALC663_ASUS_MODE7, | ||
| 194 | ALC663_ASUS_MODE8, | ||
| 195 | ALC272_DELL, | ||
| 196 | ALC272_DELL_ZM1, | ||
| 197 | ALC272_SAMSUNG_NC10, | ||
| 198 | ALC662_AUTO, | ||
| 199 | ALC662_MODEL_LAST, | ||
| 200 | }; | ||
| 201 | |||
| 202 | /* ALC882 models */ | ||
| 203 | enum { | ||
| 204 | ALC882_3ST_DIG, | ||
| 205 | ALC882_6ST_DIG, | ||
| 206 | ALC882_ARIMA, | ||
| 207 | ALC882_W2JC, | ||
| 208 | ALC882_TARGA, | ||
| 209 | ALC882_ASUS_A7J, | ||
| 210 | ALC882_ASUS_A7M, | ||
| 211 | ALC885_MACPRO, | ||
| 212 | ALC885_MBA21, | ||
| 213 | ALC885_MBP3, | ||
| 214 | ALC885_MB5, | ||
| 215 | ALC885_MACMINI3, | ||
| 216 | ALC885_IMAC24, | ||
| 217 | ALC885_IMAC91, | ||
| 218 | ALC883_3ST_2ch_DIG, | ||
| 219 | ALC883_3ST_6ch_DIG, | ||
| 220 | ALC883_3ST_6ch, | ||
| 221 | ALC883_6ST_DIG, | ||
| 222 | ALC883_TARGA_DIG, | ||
| 223 | ALC883_TARGA_2ch_DIG, | ||
| 224 | ALC883_TARGA_8ch_DIG, | ||
| 225 | ALC883_ACER, | ||
| 226 | ALC883_ACER_ASPIRE, | ||
| 227 | ALC888_ACER_ASPIRE_4930G, | ||
| 228 | ALC888_ACER_ASPIRE_6530G, | ||
| 229 | ALC888_ACER_ASPIRE_8930G, | ||
| 230 | ALC888_ACER_ASPIRE_7730G, | ||
| 231 | ALC883_MEDION, | ||
| 232 | ALC883_MEDION_MD2, | ||
| 233 | ALC883_MEDION_WIM2160, | ||
| 234 | ALC883_LAPTOP_EAPD, | ||
| 235 | ALC883_LENOVO_101E_2ch, | ||
| 236 | ALC883_LENOVO_NB0763, | ||
| 237 | ALC888_LENOVO_MS7195_DIG, | ||
| 238 | ALC888_LENOVO_SKY, | ||
| 239 | ALC883_HAIER_W66, | ||
| 240 | ALC888_3ST_HP, | ||
| 241 | ALC888_6ST_DELL, | ||
| 242 | ALC883_MITAC, | ||
| 243 | ALC883_CLEVO_M540R, | ||
| 244 | ALC883_CLEVO_M720, | ||
| 245 | ALC883_FUJITSU_PI2515, | ||
| 246 | ALC888_FUJITSU_XA3530, | ||
| 247 | ALC883_3ST_6ch_INTEL, | ||
| 248 | ALC889A_INTEL, | ||
| 249 | ALC889_INTEL, | ||
| 250 | ALC888_ASUS_M90V, | ||
| 251 | ALC888_ASUS_EEE1601, | ||
| 252 | ALC889A_MB31, | ||
| 253 | ALC1200_ASUS_P5Q, | ||
| 254 | ALC883_SONY_VAIO_TT, | ||
| 255 | ALC882_AUTO, | ||
| 256 | ALC882_MODEL_LAST, | ||
| 257 | }; | ||
| 258 | |||
| 259 | /* for GPIO Poll */ | ||
| 260 | #define GPIO_MASK 0x03 | ||
| 261 | |||
| 262 | /* extra amp-initialization sequence types */ | ||
| 263 | enum { | ||
| 264 | ALC_INIT_NONE, | ||
| 265 | ALC_INIT_DEFAULT, | ||
| 266 | ALC_INIT_GPIO1, | ||
| 267 | ALC_INIT_GPIO2, | ||
| 268 | ALC_INIT_GPIO3, | ||
| 269 | }; | ||
| 270 | |||
| 271 | struct alc_mic_route { | ||
| 272 | hda_nid_t pin; | ||
| 273 | unsigned char mux_idx; | ||
| 274 | unsigned char amix_idx; | ||
| 275 | }; | ||
| 276 | |||
| 277 | #define MUX_IDX_UNDEF ((unsigned char)-1) | ||
| 278 | |||
| 279 | struct alc_customize_define { | ||
| 280 | unsigned int sku_cfg; | ||
| 281 | unsigned char port_connectivity; | ||
| 282 | unsigned char check_sum; | ||
| 283 | unsigned char customization; | ||
| 284 | unsigned char external_amp; | ||
| 285 | unsigned int enable_pcbeep:1; | ||
| 286 | unsigned int platform_type:1; | ||
| 287 | unsigned int swap:1; | ||
| 288 | unsigned int override:1; | ||
| 289 | }; | ||
| 290 | |||
| 291 | struct alc_spec { | ||
| 292 | /* codec parameterization */ | ||
| 293 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | ||
| 294 | unsigned int num_mixers; | ||
| 295 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | ||
| 296 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | ||
| 297 | |||
| 298 | const struct hda_verb *init_verbs[10]; /* initialization verbs | ||
| 299 | * don't forget NULL | ||
| 300 | * termination! | ||
| 301 | */ | ||
| 302 | unsigned int num_init_verbs; | ||
| 303 | |||
| 304 | char stream_name_analog[32]; /* analog PCM stream */ | ||
| 305 | struct hda_pcm_stream *stream_analog_playback; | ||
| 306 | struct hda_pcm_stream *stream_analog_capture; | ||
| 307 | struct hda_pcm_stream *stream_analog_alt_playback; | ||
| 308 | struct hda_pcm_stream *stream_analog_alt_capture; | ||
| 309 | |||
| 310 | char stream_name_digital[32]; /* digital PCM stream */ | ||
| 311 | struct hda_pcm_stream *stream_digital_playback; | ||
| 312 | struct hda_pcm_stream *stream_digital_capture; | ||
| 313 | |||
| 314 | /* playback */ | ||
| 315 | struct hda_multi_out multiout; /* playback set-up | ||
| 316 | * max_channels, dacs must be set | ||
| 317 | * dig_out_nid and hp_nid are optional | ||
| 318 | */ | ||
| 319 | hda_nid_t alt_dac_nid; | ||
| 320 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ | ||
| 321 | int dig_out_type; | ||
| 322 | |||
| 323 | /* capture */ | ||
| 324 | unsigned int num_adc_nids; | ||
| 325 | hda_nid_t *adc_nids; | ||
| 326 | hda_nid_t *capsrc_nids; | ||
| 327 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | ||
| 328 | |||
| 329 | /* capture source */ | ||
| 330 | unsigned int num_mux_defs; | ||
| 331 | const struct hda_input_mux *input_mux; | ||
| 332 | unsigned int cur_mux[3]; | ||
| 333 | struct alc_mic_route ext_mic; | ||
| 334 | struct alc_mic_route int_mic; | ||
| 335 | |||
| 336 | /* channel model */ | ||
| 337 | const struct hda_channel_mode *channel_mode; | ||
| 338 | int num_channel_mode; | ||
| 339 | int need_dac_fix; | ||
| 340 | int const_channel_count; | ||
| 341 | int ext_channel_count; | ||
| 342 | |||
| 343 | /* PCM information */ | ||
| 344 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | ||
| 345 | |||
| 346 | /* dynamic controls, init_verbs and input_mux */ | ||
| 347 | struct auto_pin_cfg autocfg; | ||
| 348 | struct alc_customize_define cdefine; | ||
| 349 | struct snd_array kctls; | ||
| 350 | struct hda_input_mux private_imux[3]; | ||
| 351 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | ||
| 352 | hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS]; | ||
| 353 | hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS]; | ||
| 354 | |||
| 355 | /* hooks */ | ||
| 356 | void (*init_hook)(struct hda_codec *codec); | ||
| 357 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | ||
| 358 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 359 | void (*power_hook)(struct hda_codec *codec); | ||
| 360 | #endif | ||
| 361 | |||
| 362 | /* for pin sensing */ | ||
| 363 | unsigned int sense_updated: 1; | ||
| 364 | unsigned int jack_present: 1; | ||
| 365 | unsigned int master_sw: 1; | ||
| 366 | unsigned int auto_mic:1; | ||
| 367 | |||
| 368 | /* other flags */ | ||
| 369 | unsigned int no_analog :1; /* digital I/O only */ | ||
| 370 | int init_amp; | ||
| 371 | |||
| 372 | /* for virtual master */ | ||
| 373 | hda_nid_t vmaster_nid; | ||
| 374 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 375 | struct hda_loopback_check loopback; | ||
| 376 | #endif | ||
| 377 | |||
| 378 | /* for PLL fix */ | ||
| 379 | hda_nid_t pll_nid; | ||
| 380 | unsigned int pll_coef_idx, pll_coef_bit; | ||
| 381 | }; | ||
| 382 | |||
| 383 | /* | ||
| 384 | * configuration template - to be copied to the spec instance | ||
| 385 | */ | ||
| 386 | struct alc_config_preset { | ||
| 387 | struct snd_kcontrol_new *mixers[5]; /* should be identical size | ||
| 388 | * with spec | ||
| 389 | */ | ||
| 390 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | ||
| 391 | const struct hda_verb *init_verbs[5]; | ||
| 392 | unsigned int num_dacs; | ||
| 393 | hda_nid_t *dac_nids; | ||
| 394 | hda_nid_t dig_out_nid; /* optional */ | ||
| 395 | hda_nid_t hp_nid; /* optional */ | ||
| 396 | hda_nid_t *slave_dig_outs; | ||
| 397 | unsigned int num_adc_nids; | ||
| 398 | hda_nid_t *adc_nids; | ||
| 399 | hda_nid_t *capsrc_nids; | ||
| 400 | hda_nid_t dig_in_nid; | ||
| 401 | unsigned int num_channel_mode; | ||
| 402 | const struct hda_channel_mode *channel_mode; | ||
| 403 | int need_dac_fix; | ||
| 404 | int const_channel_count; | ||
| 405 | unsigned int num_mux_defs; | ||
| 406 | const struct hda_input_mux *input_mux; | ||
| 407 | void (*unsol_event)(struct hda_codec *, unsigned int); | ||
| 408 | void (*setup)(struct hda_codec *); | ||
| 409 | void (*init_hook)(struct hda_codec *); | ||
| 410 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 411 | struct hda_amp_list *loopbacks; | ||
| 412 | void (*power_hook)(struct hda_codec *codec); | ||
| 413 | #endif | ||
| 414 | }; | ||
| 415 | |||
| 416 | |||
| 417 | /* | ||
| 418 | * input MUX handling | ||
| 419 | */ | ||
| 420 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, | ||
| 421 | struct snd_ctl_elem_info *uinfo) | ||
| 422 | { | ||
| 423 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 424 | struct alc_spec *spec = codec->spec; | ||
| 425 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); | ||
| 426 | if (mux_idx >= spec->num_mux_defs) | ||
| 427 | mux_idx = 0; | ||
| 428 | if (!spec->input_mux[mux_idx].num_items && mux_idx > 0) | ||
| 429 | mux_idx = 0; | ||
| 430 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); | ||
| 431 | } | ||
| 432 | |||
| 433 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, | ||
| 434 | struct snd_ctl_elem_value *ucontrol) | ||
| 435 | { | ||
| 436 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 437 | struct alc_spec *spec = codec->spec; | ||
| 438 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
| 439 | |||
| 440 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
| 445 | struct snd_ctl_elem_value *ucontrol) | ||
| 446 | { | ||
| 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 448 | struct alc_spec *spec = codec->spec; | ||
| 449 | const struct hda_input_mux *imux; | ||
| 450 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
| 451 | unsigned int mux_idx; | ||
| 452 | hda_nid_t nid = spec->capsrc_nids ? | ||
| 453 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
| 454 | unsigned int type; | ||
| 455 | |||
| 456 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | ||
| 457 | imux = &spec->input_mux[mux_idx]; | ||
| 458 | if (!imux->num_items && mux_idx > 0) | ||
| 459 | imux = &spec->input_mux[0]; | ||
| 460 | |||
| 461 | type = get_wcaps_type(get_wcaps(codec, nid)); | ||
| 462 | if (type == AC_WID_AUD_MIX) { | ||
| 463 | /* Matrix-mixer style (e.g. ALC882) */ | ||
| 464 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
| 465 | unsigned int i, idx; | ||
| 466 | |||
| 467 | idx = ucontrol->value.enumerated.item[0]; | ||
| 468 | if (idx >= imux->num_items) | ||
| 469 | idx = imux->num_items - 1; | ||
| 470 | if (*cur_val == idx) | ||
| 471 | return 0; | ||
| 472 | for (i = 0; i < imux->num_items; i++) { | ||
| 473 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
| 474 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
| 475 | imux->items[i].index, | ||
| 476 | HDA_AMP_MUTE, v); | ||
| 477 | } | ||
| 478 | *cur_val = idx; | ||
| 479 | return 1; | ||
| 480 | } else { | ||
| 481 | /* MUX style (e.g. ALC880) */ | ||
| 482 | return snd_hda_input_mux_put(codec, imux, ucontrol, nid, | ||
| 483 | &spec->cur_mux[adc_idx]); | ||
| 484 | } | ||
| 485 | } | ||
| 486 | |||
| 487 | /* | ||
| 488 | * channel mode setting | ||
| 489 | */ | ||
| 490 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, | ||
| 491 | struct snd_ctl_elem_info *uinfo) | ||
| 492 | { | ||
| 493 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 494 | struct alc_spec *spec = codec->spec; | ||
| 495 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, | ||
| 496 | spec->num_channel_mode); | ||
| 497 | } | ||
| 498 | |||
| 499 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, | ||
| 500 | struct snd_ctl_elem_value *ucontrol) | ||
| 501 | { | ||
| 502 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 503 | struct alc_spec *spec = codec->spec; | ||
| 504 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, | ||
| 505 | spec->num_channel_mode, | ||
| 506 | spec->ext_channel_count); | ||
| 507 | } | ||
| 508 | |||
| 509 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, | ||
| 510 | struct snd_ctl_elem_value *ucontrol) | ||
| 511 | { | ||
| 512 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 513 | struct alc_spec *spec = codec->spec; | ||
| 514 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, | ||
| 515 | spec->num_channel_mode, | ||
| 516 | &spec->ext_channel_count); | ||
| 517 | if (err >= 0 && !spec->const_channel_count) { | ||
| 518 | spec->multiout.max_channels = spec->ext_channel_count; | ||
| 519 | if (spec->need_dac_fix) | ||
| 520 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; | ||
| 521 | } | ||
| 522 | return err; | ||
| 523 | } | ||
| 524 | |||
| 525 | /* | ||
| 526 | * Control the mode of pin widget settings via the mixer. "pc" is used | ||
| 527 | * instead of "%" to avoid consequences of accidently treating the % as | ||
| 528 | * being part of a format specifier. Maximum allowed length of a value is | ||
| 529 | * 63 characters plus NULL terminator. | ||
| 530 | * | ||
| 531 | * Note: some retasking pin complexes seem to ignore requests for input | ||
| 532 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these | ||
| 533 | * are requested. Therefore order this list so that this behaviour will not | ||
| 534 | * cause problems when mixer clients move through the enum sequentially. | ||
| 535 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of | ||
| 536 | * March 2006. | ||
| 537 | */ | ||
| 538 | static char *alc_pin_mode_names[] = { | ||
| 539 | "Mic 50pc bias", "Mic 80pc bias", | ||
| 540 | "Line in", "Line out", "Headphone out", | ||
| 541 | }; | ||
| 542 | static unsigned char alc_pin_mode_values[] = { | ||
| 543 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, | ||
| 544 | }; | ||
| 545 | /* The control can present all 5 options, or it can limit the options based | ||
| 546 | * in the pin being assumed to be exclusively an input or an output pin. In | ||
| 547 | * addition, "input" pins may or may not process the mic bias option | ||
| 548 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to | ||
| 549 | * accept requests for bias as of chip versions up to March 2006) and/or | ||
| 550 | * wiring in the computer. | ||
| 551 | */ | ||
| 552 | #define ALC_PIN_DIR_IN 0x00 | ||
| 553 | #define ALC_PIN_DIR_OUT 0x01 | ||
| 554 | #define ALC_PIN_DIR_INOUT 0x02 | ||
| 555 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 | ||
| 556 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 | ||
| 557 | |||
| 558 | /* Info about the pin modes supported by the different pin direction modes. | ||
| 559 | * For each direction the minimum and maximum values are given. | ||
| 560 | */ | ||
| 561 | static signed char alc_pin_mode_dir_info[5][2] = { | ||
| 562 | { 0, 2 }, /* ALC_PIN_DIR_IN */ | ||
| 563 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ | ||
| 564 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ | ||
| 565 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ | ||
| 566 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ | ||
| 567 | }; | ||
| 568 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) | ||
| 569 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) | ||
| 570 | #define alc_pin_mode_n_items(_dir) \ | ||
| 571 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) | ||
| 572 | |||
| 573 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, | ||
| 574 | struct snd_ctl_elem_info *uinfo) | ||
| 575 | { | ||
| 576 | unsigned int item_num = uinfo->value.enumerated.item; | ||
| 577 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
| 578 | |||
| 579 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
| 580 | uinfo->count = 1; | ||
| 581 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); | ||
| 582 | |||
| 583 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) | ||
| 584 | item_num = alc_pin_mode_min(dir); | ||
| 585 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); | ||
| 586 | return 0; | ||
| 587 | } | ||
| 588 | |||
| 589 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, | ||
| 590 | struct snd_ctl_elem_value *ucontrol) | ||
| 591 | { | ||
| 592 | unsigned int i; | ||
| 593 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 594 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 595 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
| 596 | long *valp = ucontrol->value.integer.value; | ||
| 597 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | ||
| 598 | AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
| 599 | 0x00); | ||
| 600 | |||
| 601 | /* Find enumerated value for current pinctl setting */ | ||
| 602 | i = alc_pin_mode_min(dir); | ||
| 603 | while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl) | ||
| 604 | i++; | ||
| 605 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); | ||
| 606 | return 0; | ||
| 607 | } | ||
| 608 | |||
| 609 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, | ||
| 610 | struct snd_ctl_elem_value *ucontrol) | ||
| 611 | { | ||
| 612 | signed int change; | ||
| 613 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 614 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 615 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; | ||
| 616 | long val = *ucontrol->value.integer.value; | ||
| 617 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, | ||
| 618 | AC_VERB_GET_PIN_WIDGET_CONTROL, | ||
| 619 | 0x00); | ||
| 620 | |||
| 621 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) | ||
| 622 | val = alc_pin_mode_min(dir); | ||
| 623 | |||
| 624 | change = pinctl != alc_pin_mode_values[val]; | ||
| 625 | if (change) { | ||
| 626 | /* Set pin mode to that requested */ | ||
| 627 | snd_hda_codec_write_cache(codec, nid, 0, | ||
| 628 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 629 | alc_pin_mode_values[val]); | ||
| 630 | |||
| 631 | /* Also enable the retasking pin's input/output as required | ||
| 632 | * for the requested pin mode. Enum values of 2 or less are | ||
| 633 | * input modes. | ||
| 634 | * | ||
| 635 | * Dynamically switching the input/output buffers probably | ||
| 636 | * reduces noise slightly (particularly on input) so we'll | ||
| 637 | * do it. However, having both input and output buffers | ||
| 638 | * enabled simultaneously doesn't seem to be problematic if | ||
| 639 | * this turns out to be necessary in the future. | ||
| 640 | */ | ||
| 641 | if (val <= 2) { | ||
| 642 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
| 643 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 644 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | ||
| 645 | HDA_AMP_MUTE, 0); | ||
| 646 | } else { | ||
| 647 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, | ||
| 648 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 649 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
| 650 | HDA_AMP_MUTE, 0); | ||
| 651 | } | ||
| 652 | } | ||
| 653 | return change; | ||
| 654 | } | ||
| 655 | |||
| 656 | #define ALC_PIN_MODE(xname, nid, dir) \ | ||
| 657 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
| 658 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 659 | .info = alc_pin_mode_info, \ | ||
| 660 | .get = alc_pin_mode_get, \ | ||
| 661 | .put = alc_pin_mode_put, \ | ||
| 662 | .private_value = nid | (dir<<16) } | ||
| 663 | |||
| 664 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged | ||
| 665 | * together using a mask with more than one bit set. This control is | ||
| 666 | * currently used only by the ALC260 test model. At this stage they are not | ||
| 667 | * needed for any "production" models. | ||
| 668 | */ | ||
| 669 | #ifdef CONFIG_SND_DEBUG | ||
| 670 | #define alc_gpio_data_info snd_ctl_boolean_mono_info | ||
| 671 | |||
| 672 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, | ||
| 673 | struct snd_ctl_elem_value *ucontrol) | ||
| 674 | { | ||
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 676 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 677 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 678 | long *valp = ucontrol->value.integer.value; | ||
| 679 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
| 680 | AC_VERB_GET_GPIO_DATA, 0x00); | ||
| 681 | |||
| 682 | *valp = (val & mask) != 0; | ||
| 683 | return 0; | ||
| 684 | } | ||
| 685 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, | ||
| 686 | struct snd_ctl_elem_value *ucontrol) | ||
| 687 | { | ||
| 688 | signed int change; | ||
| 689 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 690 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 691 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 692 | long val = *ucontrol->value.integer.value; | ||
| 693 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, | ||
| 694 | AC_VERB_GET_GPIO_DATA, | ||
| 695 | 0x00); | ||
| 696 | |||
| 697 | /* Set/unset the masked GPIO bit(s) as needed */ | ||
| 698 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); | ||
| 699 | if (val == 0) | ||
| 700 | gpio_data &= ~mask; | ||
| 701 | else | ||
| 702 | gpio_data |= mask; | ||
| 703 | snd_hda_codec_write_cache(codec, nid, 0, | ||
| 704 | AC_VERB_SET_GPIO_DATA, gpio_data); | ||
| 705 | |||
| 706 | return change; | ||
| 707 | } | ||
| 708 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ | ||
| 709 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
| 710 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 711 | .info = alc_gpio_data_info, \ | ||
| 712 | .get = alc_gpio_data_get, \ | ||
| 713 | .put = alc_gpio_data_put, \ | ||
| 714 | .private_value = nid | (mask<<16) } | ||
| 715 | #endif /* CONFIG_SND_DEBUG */ | ||
| 716 | |||
| 717 | /* A switch control to allow the enabling of the digital IO pins on the | ||
| 718 | * ALC260. This is incredibly simplistic; the intention of this control is | ||
| 719 | * to provide something in the test model allowing digital outputs to be | ||
| 720 | * identified if present. If models are found which can utilise these | ||
| 721 | * outputs a more complete mixer control can be devised for those models if | ||
| 722 | * necessary. | ||
| 723 | */ | ||
| 724 | #ifdef CONFIG_SND_DEBUG | ||
| 725 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info | ||
| 726 | |||
| 727 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, | ||
| 728 | struct snd_ctl_elem_value *ucontrol) | ||
| 729 | { | ||
| 730 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 731 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 732 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 733 | long *valp = ucontrol->value.integer.value; | ||
| 734 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
| 735 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); | ||
| 736 | |||
| 737 | *valp = (val & mask) != 0; | ||
| 738 | return 0; | ||
| 739 | } | ||
| 740 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, | ||
| 741 | struct snd_ctl_elem_value *ucontrol) | ||
| 742 | { | ||
| 743 | signed int change; | ||
| 744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 745 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 746 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 747 | long val = *ucontrol->value.integer.value; | ||
| 748 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | ||
| 749 | AC_VERB_GET_DIGI_CONVERT_1, | ||
| 750 | 0x00); | ||
| 751 | |||
| 752 | /* Set/unset the masked control bit(s) as needed */ | ||
| 753 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); | ||
| 754 | if (val==0) | ||
| 755 | ctrl_data &= ~mask; | ||
| 756 | else | ||
| 757 | ctrl_data |= mask; | ||
| 758 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, | ||
| 759 | ctrl_data); | ||
| 760 | |||
| 761 | return change; | ||
| 762 | } | ||
| 763 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ | ||
| 764 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
| 765 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 766 | .info = alc_spdif_ctrl_info, \ | ||
| 767 | .get = alc_spdif_ctrl_get, \ | ||
| 768 | .put = alc_spdif_ctrl_put, \ | ||
| 769 | .private_value = nid | (mask<<16) } | ||
| 770 | #endif /* CONFIG_SND_DEBUG */ | ||
| 771 | |||
| 772 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. | ||
| 773 | * Again, this is only used in the ALC26x test models to help identify when | ||
| 774 | * the EAPD line must be asserted for features to work. | ||
| 775 | */ | ||
| 776 | #ifdef CONFIG_SND_DEBUG | ||
| 777 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info | ||
| 778 | |||
| 779 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, | ||
| 780 | struct snd_ctl_elem_value *ucontrol) | ||
| 781 | { | ||
| 782 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 783 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 784 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 785 | long *valp = ucontrol->value.integer.value; | ||
| 786 | unsigned int val = snd_hda_codec_read(codec, nid, 0, | ||
| 787 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); | ||
| 788 | |||
| 789 | *valp = (val & mask) != 0; | ||
| 790 | return 0; | ||
| 791 | } | ||
| 792 | |||
| 793 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | ||
| 794 | struct snd_ctl_elem_value *ucontrol) | ||
| 795 | { | ||
| 796 | int change; | ||
| 797 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 798 | hda_nid_t nid = kcontrol->private_value & 0xffff; | ||
| 799 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; | ||
| 800 | long val = *ucontrol->value.integer.value; | ||
| 801 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, | ||
| 802 | AC_VERB_GET_EAPD_BTLENABLE, | ||
| 803 | 0x00); | ||
| 804 | |||
| 805 | /* Set/unset the masked control bit(s) as needed */ | ||
| 806 | change = (!val ? 0 : mask) != (ctrl_data & mask); | ||
| 807 | if (!val) | ||
| 808 | ctrl_data &= ~mask; | ||
| 809 | else | ||
| 810 | ctrl_data |= mask; | ||
| 811 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
| 812 | ctrl_data); | ||
| 813 | |||
| 814 | return change; | ||
| 815 | } | ||
| 816 | |||
| 817 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ | ||
| 818 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ | ||
| 819 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 820 | .info = alc_eapd_ctrl_info, \ | ||
| 821 | .get = alc_eapd_ctrl_get, \ | ||
| 822 | .put = alc_eapd_ctrl_put, \ | ||
| 823 | .private_value = nid | (mask<<16) } | ||
| 824 | #endif /* CONFIG_SND_DEBUG */ | ||
| 825 | |||
| 826 | /* | ||
| 827 | * set up the input pin config (depending on the given auto-pin type) | ||
| 828 | */ | ||
| 829 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | ||
| 830 | int auto_pin_type) | ||
| 831 | { | ||
| 832 | unsigned int val = PIN_IN; | ||
| 833 | |||
| 834 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { | ||
| 835 | unsigned int pincap; | ||
| 836 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
| 837 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | ||
| 838 | if (pincap & AC_PINCAP_VREF_80) | ||
| 839 | val = PIN_VREF80; | ||
| 840 | else if (pincap & AC_PINCAP_VREF_50) | ||
| 841 | val = PIN_VREF50; | ||
| 842 | else if (pincap & AC_PINCAP_VREF_100) | ||
| 843 | val = PIN_VREF100; | ||
| 844 | else if (pincap & AC_PINCAP_VREF_GRD) | ||
| 845 | val = PIN_VREFGRD; | ||
| 846 | } | ||
| 847 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | ||
| 848 | } | ||
| 849 | |||
| 850 | /* | ||
| 851 | */ | ||
| 852 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | ||
| 853 | { | ||
| 854 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | ||
| 855 | return; | ||
| 856 | spec->mixers[spec->num_mixers++] = mix; | ||
| 857 | } | ||
| 858 | |||
| 859 | static void add_verb(struct alc_spec *spec, const struct hda_verb *verb) | ||
| 860 | { | ||
| 861 | if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs))) | ||
| 862 | return; | ||
| 863 | spec->init_verbs[spec->num_init_verbs++] = verb; | ||
| 864 | } | ||
| 865 | |||
| 866 | /* | ||
| 867 | * set up from the preset table | ||
| 868 | */ | ||
| 869 | static void setup_preset(struct hda_codec *codec, | ||
| 870 | const struct alc_config_preset *preset) | ||
| 871 | { | ||
| 872 | struct alc_spec *spec = codec->spec; | ||
| 873 | int i; | ||
| 874 | |||
| 875 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) | ||
| 876 | add_mixer(spec, preset->mixers[i]); | ||
| 877 | spec->cap_mixer = preset->cap_mixer; | ||
| 878 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; | ||
| 879 | i++) | ||
| 880 | add_verb(spec, preset->init_verbs[i]); | ||
| 881 | |||
| 882 | spec->channel_mode = preset->channel_mode; | ||
| 883 | spec->num_channel_mode = preset->num_channel_mode; | ||
| 884 | spec->need_dac_fix = preset->need_dac_fix; | ||
| 885 | spec->const_channel_count = preset->const_channel_count; | ||
| 886 | |||
| 887 | if (preset->const_channel_count) | ||
| 888 | spec->multiout.max_channels = preset->const_channel_count; | ||
| 889 | else | ||
| 890 | spec->multiout.max_channels = spec->channel_mode[0].channels; | ||
| 891 | spec->ext_channel_count = spec->channel_mode[0].channels; | ||
| 892 | |||
| 893 | spec->multiout.num_dacs = preset->num_dacs; | ||
| 894 | spec->multiout.dac_nids = preset->dac_nids; | ||
| 895 | spec->multiout.dig_out_nid = preset->dig_out_nid; | ||
| 896 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | ||
| 897 | spec->multiout.hp_nid = preset->hp_nid; | ||
| 898 | |||
| 899 | spec->num_mux_defs = preset->num_mux_defs; | ||
| 900 | if (!spec->num_mux_defs) | ||
| 901 | spec->num_mux_defs = 1; | ||
| 902 | spec->input_mux = preset->input_mux; | ||
| 903 | |||
| 904 | spec->num_adc_nids = preset->num_adc_nids; | ||
| 905 | spec->adc_nids = preset->adc_nids; | ||
| 906 | spec->capsrc_nids = preset->capsrc_nids; | ||
| 907 | spec->dig_in_nid = preset->dig_in_nid; | ||
| 908 | |||
| 909 | spec->unsol_event = preset->unsol_event; | ||
| 910 | spec->init_hook = preset->init_hook; | ||
| 911 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 912 | spec->power_hook = preset->power_hook; | ||
| 913 | spec->loopback.amplist = preset->loopbacks; | ||
| 914 | #endif | ||
| 915 | |||
| 916 | if (preset->setup) | ||
| 917 | preset->setup(codec); | ||
| 918 | } | ||
| 919 | |||
| 920 | /* Enable GPIO mask and set output */ | ||
| 921 | static struct hda_verb alc_gpio1_init_verbs[] = { | ||
| 922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | ||
| 923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
| 925 | { } | ||
| 926 | }; | ||
| 927 | |||
| 928 | static struct hda_verb alc_gpio2_init_verbs[] = { | ||
| 929 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, | ||
| 930 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | ||
| 931 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | ||
| 932 | { } | ||
| 933 | }; | ||
| 934 | |||
| 935 | static struct hda_verb alc_gpio3_init_verbs[] = { | ||
| 936 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
| 937 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | ||
| 938 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | ||
| 939 | { } | ||
| 940 | }; | ||
| 941 | |||
| 942 | /* | ||
| 943 | * Fix hardware PLL issue | ||
| 944 | * On some codecs, the analog PLL gating control must be off while | ||
| 945 | * the default value is 1. | ||
| 946 | */ | ||
| 947 | static void alc_fix_pll(struct hda_codec *codec) | ||
| 948 | { | ||
| 949 | struct alc_spec *spec = codec->spec; | ||
| 950 | unsigned int val; | ||
| 951 | |||
| 952 | if (!spec->pll_nid) | ||
| 953 | return; | ||
| 954 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | ||
| 955 | spec->pll_coef_idx); | ||
| 956 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, | ||
| 957 | AC_VERB_GET_PROC_COEF, 0); | ||
| 958 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, | ||
| 959 | spec->pll_coef_idx); | ||
| 960 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, | ||
| 961 | val & ~(1 << spec->pll_coef_bit)); | ||
| 962 | } | ||
| 963 | |||
| 964 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | ||
| 965 | unsigned int coef_idx, unsigned int coef_bit) | ||
| 966 | { | ||
| 967 | struct alc_spec *spec = codec->spec; | ||
| 968 | spec->pll_nid = nid; | ||
| 969 | spec->pll_coef_idx = coef_idx; | ||
| 970 | spec->pll_coef_bit = coef_bit; | ||
| 971 | alc_fix_pll(codec); | ||
| 972 | } | ||
| 973 | |||
| 974 | static void alc_automute_pin(struct hda_codec *codec) | ||
| 975 | { | ||
| 976 | struct alc_spec *spec = codec->spec; | ||
| 977 | unsigned int nid = spec->autocfg.hp_pins[0]; | ||
| 978 | int i; | ||
| 979 | |||
| 980 | if (!nid) | ||
| 981 | return; | ||
| 982 | spec->jack_present = snd_hda_jack_detect(codec, nid); | ||
| 983 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | ||
| 984 | nid = spec->autocfg.speaker_pins[i]; | ||
| 985 | if (!nid) | ||
| 986 | break; | ||
| 987 | snd_hda_codec_write(codec, nid, 0, | ||
| 988 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 989 | spec->jack_present ? 0 : PIN_OUT); | ||
| 990 | } | ||
| 991 | } | ||
| 992 | |||
| 993 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, | ||
| 994 | hda_nid_t nid) | ||
| 995 | { | ||
| 996 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
| 997 | int i, nums; | ||
| 998 | |||
| 999 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); | ||
| 1000 | for (i = 0; i < nums; i++) | ||
| 1001 | if (conn[i] == nid) | ||
| 1002 | return i; | ||
| 1003 | return -1; | ||
| 1004 | } | ||
| 1005 | |||
| 1006 | static void alc_mic_automute(struct hda_codec *codec) | ||
| 1007 | { | ||
| 1008 | struct alc_spec *spec = codec->spec; | ||
| 1009 | struct alc_mic_route *dead, *alive; | ||
| 1010 | unsigned int present, type; | ||
| 1011 | hda_nid_t cap_nid; | ||
| 1012 | |||
| 1013 | if (!spec->auto_mic) | ||
| 1014 | return; | ||
| 1015 | if (!spec->int_mic.pin || !spec->ext_mic.pin) | ||
| 1016 | return; | ||
| 1017 | if (snd_BUG_ON(!spec->adc_nids)) | ||
| 1018 | return; | ||
| 1019 | |||
| 1020 | cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0]; | ||
| 1021 | |||
| 1022 | present = snd_hda_jack_detect(codec, spec->ext_mic.pin); | ||
| 1023 | if (present) { | ||
| 1024 | alive = &spec->ext_mic; | ||
| 1025 | dead = &spec->int_mic; | ||
| 1026 | } else { | ||
| 1027 | alive = &spec->int_mic; | ||
| 1028 | dead = &spec->ext_mic; | ||
| 1029 | } | ||
| 1030 | |||
| 1031 | type = get_wcaps_type(get_wcaps(codec, cap_nid)); | ||
| 1032 | if (type == AC_WID_AUD_MIX) { | ||
| 1033 | /* Matrix-mixer style (e.g. ALC882) */ | ||
| 1034 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
| 1035 | alive->mux_idx, | ||
| 1036 | HDA_AMP_MUTE, 0); | ||
| 1037 | snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT, | ||
| 1038 | dead->mux_idx, | ||
| 1039 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 1040 | } else { | ||
| 1041 | /* MUX style (e.g. ALC880) */ | ||
| 1042 | snd_hda_codec_write_cache(codec, cap_nid, 0, | ||
| 1043 | AC_VERB_SET_CONNECT_SEL, | ||
| 1044 | alive->mux_idx); | ||
| 1045 | } | ||
| 1046 | |||
| 1047 | /* FIXME: analog mixer */ | ||
| 1048 | } | ||
| 1049 | |||
| 1050 | /* unsolicited event for HP jack sensing */ | ||
| 1051 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 1052 | { | ||
| 1053 | if (codec->vendor_id == 0x10ec0880) | ||
| 1054 | res >>= 28; | ||
| 1055 | else | ||
| 1056 | res >>= 26; | ||
| 1057 | switch (res) { | ||
| 1058 | case ALC880_HP_EVENT: | ||
| 1059 | alc_automute_pin(codec); | ||
| 1060 | break; | ||
| 1061 | case ALC880_MIC_EVENT: | ||
| 1062 | alc_mic_automute(codec); | ||
| 1063 | break; | ||
| 1064 | } | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | static void alc_inithook(struct hda_codec *codec) | ||
| 1068 | { | ||
| 1069 | alc_automute_pin(codec); | ||
| 1070 | alc_mic_automute(codec); | ||
| 1071 | } | ||
| 1072 | |||
| 1073 | /* additional initialization for ALC888 variants */ | ||
| 1074 | static void alc888_coef_init(struct hda_codec *codec) | ||
| 1075 | { | ||
| 1076 | unsigned int tmp; | ||
| 1077 | |||
| 1078 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | ||
| 1079 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | ||
| 1080 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
| 1081 | if ((tmp & 0xf0) == 0x20) | ||
| 1082 | /* alc888S-VC */ | ||
| 1083 | snd_hda_codec_read(codec, 0x20, 0, | ||
| 1084 | AC_VERB_SET_PROC_COEF, 0x830); | ||
| 1085 | else | ||
| 1086 | /* alc888-VB */ | ||
| 1087 | snd_hda_codec_read(codec, 0x20, 0, | ||
| 1088 | AC_VERB_SET_PROC_COEF, 0x3030); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | static void alc889_coef_init(struct hda_codec *codec) | ||
| 1092 | { | ||
| 1093 | unsigned int tmp; | ||
| 1094 | |||
| 1095 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
| 1096 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | ||
| 1097 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
| 1098 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); | ||
| 1099 | } | ||
| 1100 | |||
| 1101 | /* turn on/off EAPD control (only if available) */ | ||
| 1102 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | ||
| 1103 | { | ||
| 1104 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | ||
| 1105 | return; | ||
| 1106 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | ||
| 1107 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
| 1108 | on ? 2 : 0); | ||
| 1109 | } | ||
| 1110 | |||
| 1111 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | ||
| 1112 | { | ||
| 1113 | unsigned int tmp; | ||
| 1114 | |||
| 1115 | switch (type) { | ||
| 1116 | case ALC_INIT_GPIO1: | ||
| 1117 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); | ||
| 1118 | break; | ||
| 1119 | case ALC_INIT_GPIO2: | ||
| 1120 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); | ||
| 1121 | break; | ||
| 1122 | case ALC_INIT_GPIO3: | ||
| 1123 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); | ||
| 1124 | break; | ||
| 1125 | case ALC_INIT_DEFAULT: | ||
| 1126 | switch (codec->vendor_id) { | ||
| 1127 | case 0x10ec0260: | ||
| 1128 | set_eapd(codec, 0x0f, 1); | ||
| 1129 | set_eapd(codec, 0x10, 1); | ||
| 1130 | break; | ||
| 1131 | case 0x10ec0262: | ||
| 1132 | case 0x10ec0267: | ||
| 1133 | case 0x10ec0268: | ||
| 1134 | case 0x10ec0269: | ||
| 1135 | case 0x10ec0270: | ||
| 1136 | case 0x10ec0272: | ||
| 1137 | case 0x10ec0660: | ||
| 1138 | case 0x10ec0662: | ||
| 1139 | case 0x10ec0663: | ||
| 1140 | case 0x10ec0862: | ||
| 1141 | case 0x10ec0889: | ||
| 1142 | set_eapd(codec, 0x14, 1); | ||
| 1143 | set_eapd(codec, 0x15, 1); | ||
| 1144 | break; | ||
| 1145 | } | ||
| 1146 | switch (codec->vendor_id) { | ||
| 1147 | case 0x10ec0260: | ||
| 1148 | snd_hda_codec_write(codec, 0x1a, 0, | ||
| 1149 | AC_VERB_SET_COEF_INDEX, 7); | ||
| 1150 | tmp = snd_hda_codec_read(codec, 0x1a, 0, | ||
| 1151 | AC_VERB_GET_PROC_COEF, 0); | ||
| 1152 | snd_hda_codec_write(codec, 0x1a, 0, | ||
| 1153 | AC_VERB_SET_COEF_INDEX, 7); | ||
| 1154 | snd_hda_codec_write(codec, 0x1a, 0, | ||
| 1155 | AC_VERB_SET_PROC_COEF, | ||
| 1156 | tmp | 0x2010); | ||
| 1157 | break; | ||
| 1158 | case 0x10ec0262: | ||
| 1159 | case 0x10ec0880: | ||
| 1160 | case 0x10ec0882: | ||
| 1161 | case 0x10ec0883: | ||
| 1162 | case 0x10ec0885: | ||
| 1163 | case 0x10ec0887: | ||
| 1164 | case 0x10ec0889: | ||
| 1165 | alc889_coef_init(codec); | ||
| 1166 | break; | ||
| 1167 | case 0x10ec0888: | ||
| 1168 | alc888_coef_init(codec); | ||
| 1169 | break; | ||
| 1170 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ | ||
| 1171 | case 0x10ec0267: | ||
| 1172 | case 0x10ec0268: | ||
| 1173 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 1174 | AC_VERB_SET_COEF_INDEX, 7); | ||
| 1175 | tmp = snd_hda_codec_read(codec, 0x20, 0, | ||
| 1176 | AC_VERB_GET_PROC_COEF, 0); | ||
| 1177 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 1178 | AC_VERB_SET_COEF_INDEX, 7); | ||
| 1179 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 1180 | AC_VERB_SET_PROC_COEF, | ||
| 1181 | tmp | 0x3000); | ||
| 1182 | break; | ||
| 1183 | #endif /* XXX */ | ||
| 1184 | } | ||
| 1185 | break; | ||
| 1186 | } | ||
| 1187 | } | ||
| 1188 | |||
| 1189 | static void alc_init_auto_hp(struct hda_codec *codec) | ||
| 1190 | { | ||
| 1191 | struct alc_spec *spec = codec->spec; | ||
| 1192 | |||
| 1193 | if (!spec->autocfg.hp_pins[0]) | ||
| 1194 | return; | ||
| 1195 | |||
| 1196 | if (!spec->autocfg.speaker_pins[0]) { | ||
| 1197 | if (spec->autocfg.line_out_pins[0] && | ||
| 1198 | spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 1199 | spec->autocfg.speaker_pins[0] = | ||
| 1200 | spec->autocfg.line_out_pins[0]; | ||
| 1201 | else | ||
| 1202 | return; | ||
| 1203 | } | ||
| 1204 | |||
| 1205 | snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", | ||
| 1206 | spec->autocfg.hp_pins[0]); | ||
| 1207 | snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0, | ||
| 1208 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
| 1209 | AC_USRSP_EN | ALC880_HP_EVENT); | ||
| 1210 | spec->unsol_event = alc_sku_unsol_event; | ||
| 1211 | } | ||
| 1212 | |||
| 1213 | static void alc_init_auto_mic(struct hda_codec *codec) | ||
| 1214 | { | ||
| 1215 | struct alc_spec *spec = codec->spec; | ||
| 1216 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
| 1217 | hda_nid_t fixed, ext; | ||
| 1218 | int i; | ||
| 1219 | |||
| 1220 | /* there must be only two mic inputs exclusively */ | ||
| 1221 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) | ||
| 1222 | if (cfg->input_pins[i]) | ||
| 1223 | return; | ||
| 1224 | |||
| 1225 | fixed = ext = 0; | ||
| 1226 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) { | ||
| 1227 | hda_nid_t nid = cfg->input_pins[i]; | ||
| 1228 | unsigned int defcfg; | ||
| 1229 | if (!nid) | ||
| 1230 | return; | ||
| 1231 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | ||
| 1232 | switch (get_defcfg_connect(defcfg)) { | ||
| 1233 | case AC_JACK_PORT_FIXED: | ||
| 1234 | if (fixed) | ||
| 1235 | return; /* already occupied */ | ||
| 1236 | fixed = nid; | ||
| 1237 | break; | ||
| 1238 | case AC_JACK_PORT_COMPLEX: | ||
| 1239 | if (ext) | ||
| 1240 | return; /* already occupied */ | ||
| 1241 | ext = nid; | ||
| 1242 | break; | ||
| 1243 | default: | ||
| 1244 | return; /* invalid entry */ | ||
| 1245 | } | ||
| 1246 | } | ||
| 1247 | if (!ext || !fixed) | ||
| 1248 | return; | ||
| 1249 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) | ||
| 1250 | return; /* no unsol support */ | ||
| 1251 | snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", | ||
| 1252 | ext, fixed); | ||
| 1253 | spec->ext_mic.pin = ext; | ||
| 1254 | spec->int_mic.pin = fixed; | ||
| 1255 | spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
| 1256 | spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */ | ||
| 1257 | spec->auto_mic = 1; | ||
| 1258 | snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0, | ||
| 1259 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
| 1260 | AC_USRSP_EN | ALC880_MIC_EVENT); | ||
| 1261 | spec->unsol_event = alc_sku_unsol_event; | ||
| 1262 | } | ||
| 1263 | |||
| 1264 | static int alc_auto_parse_customize_define(struct hda_codec *codec) | ||
| 1265 | { | ||
| 1266 | unsigned int ass, tmp, i; | ||
| 1267 | unsigned nid = 0; | ||
| 1268 | struct alc_spec *spec = codec->spec; | ||
| 1269 | |||
| 1270 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ | ||
| 1271 | |||
| 1272 | ass = codec->subsystem_id & 0xffff; | ||
| 1273 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) | ||
| 1274 | goto do_sku; | ||
| 1275 | |||
| 1276 | nid = 0x1d; | ||
| 1277 | if (codec->vendor_id == 0x10ec0260) | ||
| 1278 | nid = 0x17; | ||
| 1279 | ass = snd_hda_codec_get_pincfg(codec, nid); | ||
| 1280 | |||
| 1281 | if (!(ass & 1)) { | ||
| 1282 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", | ||
| 1283 | codec->chip_name, ass); | ||
| 1284 | return -1; | ||
| 1285 | } | ||
| 1286 | |||
| 1287 | /* check sum */ | ||
| 1288 | tmp = 0; | ||
| 1289 | for (i = 1; i < 16; i++) { | ||
| 1290 | if ((ass >> i) & 1) | ||
| 1291 | tmp++; | ||
| 1292 | } | ||
| 1293 | if (((ass >> 16) & 0xf) != tmp) | ||
| 1294 | return -1; | ||
| 1295 | |||
| 1296 | spec->cdefine.port_connectivity = ass >> 30; | ||
| 1297 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | ||
| 1298 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | ||
| 1299 | spec->cdefine.customization = ass >> 8; | ||
| 1300 | do_sku: | ||
| 1301 | spec->cdefine.sku_cfg = ass; | ||
| 1302 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | ||
| 1303 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | ||
| 1304 | spec->cdefine.swap = (ass & 0x2) >> 1; | ||
| 1305 | spec->cdefine.override = ass & 0x1; | ||
| 1306 | |||
| 1307 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", | ||
| 1308 | nid, spec->cdefine.sku_cfg); | ||
| 1309 | snd_printd("SKU: port_connectivity=0x%x\n", | ||
| 1310 | spec->cdefine.port_connectivity); | ||
| 1311 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); | ||
| 1312 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | ||
| 1313 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); | ||
| 1314 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | ||
| 1315 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | ||
| 1316 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); | ||
| 1317 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); | ||
| 1318 | |||
| 1319 | return 0; | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | /* check subsystem ID and set up device-specific initialization; | ||
| 1323 | * return 1 if initialized, 0 if invalid SSID | ||
| 1324 | */ | ||
| 1325 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | ||
| 1326 | * 31 ~ 16 : Manufacture ID | ||
| 1327 | * 15 ~ 8 : SKU ID | ||
| 1328 | * 7 ~ 0 : Assembly ID | ||
| 1329 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | ||
| 1330 | */ | ||
| 1331 | static int alc_subsystem_id(struct hda_codec *codec, | ||
| 1332 | hda_nid_t porta, hda_nid_t porte, | ||
| 1333 | hda_nid_t portd, hda_nid_t porti) | ||
| 1334 | { | ||
| 1335 | unsigned int ass, tmp, i; | ||
| 1336 | unsigned nid; | ||
| 1337 | struct alc_spec *spec = codec->spec; | ||
| 1338 | |||
| 1339 | ass = codec->subsystem_id & 0xffff; | ||
| 1340 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | ||
| 1341 | goto do_sku; | ||
| 1342 | |||
| 1343 | /* invalid SSID, check the special NID pin defcfg instead */ | ||
| 1344 | /* | ||
| 1345 | * 31~30 : port connectivity | ||
| 1346 | * 29~21 : reserve | ||
| 1347 | * 20 : PCBEEP input | ||
| 1348 | * 19~16 : Check sum (15:1) | ||
| 1349 | * 15~1 : Custom | ||
| 1350 | * 0 : override | ||
| 1351 | */ | ||
| 1352 | nid = 0x1d; | ||
| 1353 | if (codec->vendor_id == 0x10ec0260) | ||
| 1354 | nid = 0x17; | ||
| 1355 | ass = snd_hda_codec_get_pincfg(codec, nid); | ||
| 1356 | snd_printd("realtek: No valid SSID, " | ||
| 1357 | "checking pincfg 0x%08x for NID 0x%x\n", | ||
| 1358 | ass, nid); | ||
| 1359 | if (!(ass & 1)) | ||
| 1360 | return 0; | ||
| 1361 | if ((ass >> 30) != 1) /* no physical connection */ | ||
| 1362 | return 0; | ||
| 1363 | |||
| 1364 | /* check sum */ | ||
| 1365 | tmp = 0; | ||
| 1366 | for (i = 1; i < 16; i++) { | ||
| 1367 | if ((ass >> i) & 1) | ||
| 1368 | tmp++; | ||
| 1369 | } | ||
| 1370 | if (((ass >> 16) & 0xf) != tmp) | ||
| 1371 | return 0; | ||
| 1372 | do_sku: | ||
| 1373 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", | ||
| 1374 | ass & 0xffff, codec->vendor_id); | ||
| 1375 | /* | ||
| 1376 | * 0 : override | ||
| 1377 | * 1 : Swap Jack | ||
| 1378 | * 2 : 0 --> Desktop, 1 --> Laptop | ||
| 1379 | * 3~5 : External Amplifier control | ||
| 1380 | * 7~6 : Reserved | ||
| 1381 | */ | ||
| 1382 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | ||
| 1383 | switch (tmp) { | ||
| 1384 | case 1: | ||
| 1385 | spec->init_amp = ALC_INIT_GPIO1; | ||
| 1386 | break; | ||
| 1387 | case 3: | ||
| 1388 | spec->init_amp = ALC_INIT_GPIO2; | ||
| 1389 | break; | ||
| 1390 | case 7: | ||
| 1391 | spec->init_amp = ALC_INIT_GPIO3; | ||
| 1392 | break; | ||
| 1393 | case 5: | ||
| 1394 | spec->init_amp = ALC_INIT_DEFAULT; | ||
| 1395 | break; | ||
| 1396 | } | ||
| 1397 | |||
| 1398 | /* is laptop or Desktop and enable the function "Mute internal speaker | ||
| 1399 | * when the external headphone out jack is plugged" | ||
| 1400 | */ | ||
| 1401 | if (!(ass & 0x8000)) | ||
| 1402 | return 1; | ||
| 1403 | /* | ||
| 1404 | * 10~8 : Jack location | ||
| 1405 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | ||
| 1406 | * 14~13: Resvered | ||
| 1407 | * 15 : 1 --> enable the function "Mute internal speaker | ||
| 1408 | * when the external headphone out jack is plugged" | ||
| 1409 | */ | ||
| 1410 | if (!spec->autocfg.hp_pins[0]) { | ||
| 1411 | hda_nid_t nid; | ||
| 1412 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ | ||
| 1413 | if (tmp == 0) | ||
| 1414 | nid = porta; | ||
| 1415 | else if (tmp == 1) | ||
| 1416 | nid = porte; | ||
| 1417 | else if (tmp == 2) | ||
| 1418 | nid = portd; | ||
| 1419 | else if (tmp == 3) | ||
| 1420 | nid = porti; | ||
| 1421 | else | ||
| 1422 | return 1; | ||
| 1423 | for (i = 0; i < spec->autocfg.line_outs; i++) | ||
| 1424 | if (spec->autocfg.line_out_pins[i] == nid) | ||
| 1425 | return 1; | ||
| 1426 | spec->autocfg.hp_pins[0] = nid; | ||
| 1427 | } | ||
| 1428 | |||
| 1429 | alc_init_auto_hp(codec); | ||
| 1430 | alc_init_auto_mic(codec); | ||
| 1431 | return 1; | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | static void alc_ssid_check(struct hda_codec *codec, | ||
| 1435 | hda_nid_t porta, hda_nid_t porte, | ||
| 1436 | hda_nid_t portd, hda_nid_t porti) | ||
| 1437 | { | ||
| 1438 | if (!alc_subsystem_id(codec, porta, porte, portd, porti)) { | ||
| 1439 | struct alc_spec *spec = codec->spec; | ||
| 1440 | snd_printd("realtek: " | ||
| 1441 | "Enable default setup for auto mode as fallback\n"); | ||
| 1442 | spec->init_amp = ALC_INIT_DEFAULT; | ||
| 1443 | alc_init_auto_hp(codec); | ||
| 1444 | alc_init_auto_mic(codec); | ||
| 1445 | } | ||
| 1446 | } | ||
| 1447 | |||
| 1448 | /* | ||
| 1449 | * Fix-up pin default configurations and add default verbs | ||
| 1450 | */ | ||
| 1451 | |||
| 1452 | struct alc_pincfg { | ||
| 1453 | hda_nid_t nid; | ||
| 1454 | u32 val; | ||
| 1455 | }; | ||
| 1456 | |||
| 1457 | struct alc_fixup { | ||
| 1458 | const struct alc_pincfg *pins; | ||
| 1459 | const struct hda_verb *verbs; | ||
| 1460 | }; | ||
| 1461 | |||
| 1462 | static void alc_pick_fixup(struct hda_codec *codec, | ||
| 1463 | const struct snd_pci_quirk *quirk, | ||
| 1464 | const struct alc_fixup *fix, | ||
| 1465 | int pre_init) | ||
| 1466 | { | ||
| 1467 | const struct alc_pincfg *cfg; | ||
| 1468 | |||
| 1469 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); | ||
| 1470 | if (!quirk) | ||
| 1471 | return; | ||
| 1472 | fix += quirk->value; | ||
| 1473 | cfg = fix->pins; | ||
| 1474 | if (pre_init && cfg) { | ||
| 1475 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 1476 | snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", | ||
| 1477 | codec->chip_name, quirk->name); | ||
| 1478 | #endif | ||
| 1479 | for (; cfg->nid; cfg++) | ||
| 1480 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); | ||
| 1481 | } | ||
| 1482 | if (!pre_init && fix->verbs) { | ||
| 1483 | #ifdef CONFIG_SND_DEBUG_VERBOSE | ||
| 1484 | snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", | ||
| 1485 | codec->chip_name, quirk->name); | ||
| 1486 | #endif | ||
| 1487 | add_verb(codec->spec, fix->verbs); | ||
| 1488 | } | ||
| 1489 | } | ||
| 1490 | |||
| 1491 | static int alc_read_coef_idx(struct hda_codec *codec, | ||
| 1492 | unsigned int coef_idx) | ||
| 1493 | { | ||
| 1494 | unsigned int val; | ||
| 1495 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, | ||
| 1496 | coef_idx); | ||
| 1497 | val = snd_hda_codec_read(codec, 0x20, 0, | ||
| 1498 | AC_VERB_GET_PROC_COEF, 0); | ||
| 1499 | return val; | ||
| 1500 | } | ||
| 1501 | |||
| 1502 | /* | ||
| 1503 | * ALC888 | ||
| 1504 | */ | ||
| 1505 | |||
| 1506 | /* | ||
| 1507 | * 2ch mode | ||
| 1508 | */ | ||
| 1509 | static struct hda_verb alc888_4ST_ch2_intel_init[] = { | ||
| 1510 | /* Mic-in jack as mic in */ | ||
| 1511 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 1512 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 1513 | /* Line-in jack as Line in */ | ||
| 1514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 1515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 1516 | /* Line-Out as Front */ | ||
| 1517 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1518 | { } /* end */ | ||
| 1519 | }; | ||
| 1520 | |||
| 1521 | /* | ||
| 1522 | * 4ch mode | ||
| 1523 | */ | ||
| 1524 | static struct hda_verb alc888_4ST_ch4_intel_init[] = { | ||
| 1525 | /* Mic-in jack as mic in */ | ||
| 1526 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 1527 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 1528 | /* Line-in jack as Surround */ | ||
| 1529 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1530 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1531 | /* Line-Out as Front */ | ||
| 1532 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1533 | { } /* end */ | ||
| 1534 | }; | ||
| 1535 | |||
| 1536 | /* | ||
| 1537 | * 6ch mode | ||
| 1538 | */ | ||
| 1539 | static struct hda_verb alc888_4ST_ch6_intel_init[] = { | ||
| 1540 | /* Mic-in jack as CLFE */ | ||
| 1541 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1542 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1543 | /* Line-in jack as Surround */ | ||
| 1544 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1545 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1546 | /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ | ||
| 1547 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 1548 | { } /* end */ | ||
| 1549 | }; | ||
| 1550 | |||
| 1551 | /* | ||
| 1552 | * 8ch mode | ||
| 1553 | */ | ||
| 1554 | static struct hda_verb alc888_4ST_ch8_intel_init[] = { | ||
| 1555 | /* Mic-in jack as CLFE */ | ||
| 1556 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1557 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1558 | /* Line-in jack as Surround */ | ||
| 1559 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1560 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1561 | /* Line-Out as Side */ | ||
| 1562 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 1563 | { } /* end */ | ||
| 1564 | }; | ||
| 1565 | |||
| 1566 | static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { | ||
| 1567 | { 2, alc888_4ST_ch2_intel_init }, | ||
| 1568 | { 4, alc888_4ST_ch4_intel_init }, | ||
| 1569 | { 6, alc888_4ST_ch6_intel_init }, | ||
| 1570 | { 8, alc888_4ST_ch8_intel_init }, | ||
| 1571 | }; | ||
| 1572 | |||
| 1573 | /* | ||
| 1574 | * ALC888 Fujitsu Siemens Amillo xa3530 | ||
| 1575 | */ | ||
| 1576 | |||
| 1577 | static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | ||
| 1578 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
| 1579 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 1580 | /* Connect Internal HP to Front */ | ||
| 1581 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1582 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1583 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1584 | /* Connect Bass HP to Front */ | ||
| 1585 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1586 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1587 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1588 | /* Connect Line-Out side jack (SPDIF) to Side */ | ||
| 1589 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1590 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1591 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 1592 | /* Connect Mic jack to CLFE */ | ||
| 1593 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1594 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1595 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 1596 | /* Connect Line-in jack to Surround */ | ||
| 1597 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1598 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1599 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 1600 | /* Connect HP out jack to Front */ | ||
| 1601 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1602 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1603 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1604 | /* Enable unsolicited event for HP jack and Line-out jack */ | ||
| 1605 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 1606 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 1607 | {} | ||
| 1608 | }; | ||
| 1609 | |||
| 1610 | static void alc_automute_amp(struct hda_codec *codec) | ||
| 1611 | { | ||
| 1612 | struct alc_spec *spec = codec->spec; | ||
| 1613 | unsigned int mute; | ||
| 1614 | hda_nid_t nid; | ||
| 1615 | int i; | ||
| 1616 | |||
| 1617 | spec->jack_present = 0; | ||
| 1618 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | ||
| 1619 | nid = spec->autocfg.hp_pins[i]; | ||
| 1620 | if (!nid) | ||
| 1621 | break; | ||
| 1622 | if (snd_hda_jack_detect(codec, nid)) { | ||
| 1623 | spec->jack_present = 1; | ||
| 1624 | break; | ||
| 1625 | } | ||
| 1626 | } | ||
| 1627 | |||
| 1628 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | ||
| 1629 | /* Toggle internal speakers muting */ | ||
| 1630 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | ||
| 1631 | nid = spec->autocfg.speaker_pins[i]; | ||
| 1632 | if (!nid) | ||
| 1633 | break; | ||
| 1634 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
| 1635 | HDA_AMP_MUTE, mute); | ||
| 1636 | } | ||
| 1637 | } | ||
| 1638 | |||
| 1639 | static void alc_automute_amp_unsol_event(struct hda_codec *codec, | ||
| 1640 | unsigned int res) | ||
| 1641 | { | ||
| 1642 | if (codec->vendor_id == 0x10ec0880) | ||
| 1643 | res >>= 28; | ||
| 1644 | else | ||
| 1645 | res >>= 26; | ||
| 1646 | if (res == ALC880_HP_EVENT) | ||
| 1647 | alc_automute_amp(codec); | ||
| 1648 | } | ||
| 1649 | |||
| 1650 | static void alc889_automute_setup(struct hda_codec *codec) | ||
| 1651 | { | ||
| 1652 | struct alc_spec *spec = codec->spec; | ||
| 1653 | |||
| 1654 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 1655 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 1656 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 1657 | spec->autocfg.speaker_pins[2] = 0x17; | ||
| 1658 | spec->autocfg.speaker_pins[3] = 0x19; | ||
| 1659 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
| 1660 | } | ||
| 1661 | |||
| 1662 | static void alc889_intel_init_hook(struct hda_codec *codec) | ||
| 1663 | { | ||
| 1664 | alc889_coef_init(codec); | ||
| 1665 | alc_automute_amp(codec); | ||
| 1666 | } | ||
| 1667 | |||
| 1668 | static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec) | ||
| 1669 | { | ||
| 1670 | struct alc_spec *spec = codec->spec; | ||
| 1671 | |||
| 1672 | spec->autocfg.hp_pins[0] = 0x17; /* line-out */ | ||
| 1673 | spec->autocfg.hp_pins[1] = 0x1b; /* hp */ | ||
| 1674 | spec->autocfg.speaker_pins[0] = 0x14; /* speaker */ | ||
| 1675 | spec->autocfg.speaker_pins[1] = 0x15; /* bass */ | ||
| 1676 | } | ||
| 1677 | |||
| 1678 | /* | ||
| 1679 | * ALC888 Acer Aspire 4930G model | ||
| 1680 | */ | ||
| 1681 | |||
| 1682 | static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { | ||
| 1683 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
| 1684 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 1685 | /* Unselect Front Mic by default in input mixer 3 */ | ||
| 1686 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
| 1687 | /* Enable unsolicited event for HP jack */ | ||
| 1688 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 1689 | /* Connect Internal HP to front */ | ||
| 1690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1691 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1692 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1693 | /* Connect HP out to front */ | ||
| 1694 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1695 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1696 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1697 | { } | ||
| 1698 | }; | ||
| 1699 | |||
| 1700 | /* | ||
| 1701 | * ALC888 Acer Aspire 6530G model | ||
| 1702 | */ | ||
| 1703 | |||
| 1704 | static struct hda_verb alc888_acer_aspire_6530g_verbs[] = { | ||
| 1705 | /* Route to built-in subwoofer as well as speakers */ | ||
| 1706 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 1707 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 1708 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 1709 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 1710 | /* Bias voltage on for external mic port */ | ||
| 1711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80}, | ||
| 1712 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
| 1713 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 1714 | /* Unselect Front Mic by default in input mixer 3 */ | ||
| 1715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
| 1716 | /* Enable unsolicited event for HP jack */ | ||
| 1717 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 1718 | /* Enable speaker output */ | ||
| 1719 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1720 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1721 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 1722 | /* Enable headphone output */ | ||
| 1723 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | ||
| 1724 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1725 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1726 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 1727 | { } | ||
| 1728 | }; | ||
| 1729 | |||
| 1730 | /* | ||
| 1731 | * ALC889 Acer Aspire 8930G model | ||
| 1732 | */ | ||
| 1733 | |||
| 1734 | static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | ||
| 1735 | /* Front Mic: set to PIN_IN (empty by default) */ | ||
| 1736 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 1737 | /* Unselect Front Mic by default in input mixer 3 */ | ||
| 1738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, | ||
| 1739 | /* Enable unsolicited event for HP jack */ | ||
| 1740 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 1741 | /* Connect Internal Front to Front */ | ||
| 1742 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1743 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1744 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1745 | /* Connect Internal Rear to Rear */ | ||
| 1746 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1747 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1748 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 1749 | /* Connect Internal CLFE to CLFE */ | ||
| 1750 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 1751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1752 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 1753 | /* Connect HP out to Front */ | ||
| 1754 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP}, | ||
| 1755 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 1756 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 1757 | /* Enable all DACs */ | ||
| 1758 | /* DAC DISABLE/MUTE 1? */ | ||
| 1759 | /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */ | ||
| 1760 | {0x20, AC_VERB_SET_COEF_INDEX, 0x03}, | ||
| 1761 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | ||
| 1762 | /* DAC DISABLE/MUTE 2? */ | ||
| 1763 | /* some bit here disables the other DACs. Init=0x4900 */ | ||
| 1764 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | ||
| 1765 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | ||
| 1766 | /* DMIC fix | ||
| 1767 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | ||
| 1768 | * which makes the stereo useless. However, either the mic or the ALC889 | ||
| 1769 | * makes the signal become a difference/sum signal instead of standard | ||
| 1770 | * stereo, which is annoying. So instead we flip this bit which makes the | ||
| 1771 | * codec replicate the sum signal to both channels, turning it into a | ||
| 1772 | * normal mono mic. | ||
| 1773 | */ | ||
| 1774 | /* DMIC_CONTROL? Init value = 0x0001 */ | ||
| 1775 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
| 1776 | {0x20, AC_VERB_SET_PROC_COEF, 0x0003}, | ||
| 1777 | { } | ||
| 1778 | }; | ||
| 1779 | |||
| 1780 | static struct hda_input_mux alc888_2_capture_sources[2] = { | ||
| 1781 | /* Front mic only available on one ADC */ | ||
| 1782 | { | ||
| 1783 | .num_items = 4, | ||
| 1784 | .items = { | ||
| 1785 | { "Mic", 0x0 }, | ||
| 1786 | { "Line", 0x2 }, | ||
| 1787 | { "CD", 0x4 }, | ||
| 1788 | { "Front Mic", 0xb }, | ||
| 1789 | }, | ||
| 1790 | }, | ||
| 1791 | { | ||
| 1792 | .num_items = 3, | ||
| 1793 | .items = { | ||
| 1794 | { "Mic", 0x0 }, | ||
| 1795 | { "Line", 0x2 }, | ||
| 1796 | { "CD", 0x4 }, | ||
| 1797 | }, | ||
| 1798 | } | ||
| 1799 | }; | ||
| 1800 | |||
| 1801 | static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = { | ||
| 1802 | /* Interal mic only available on one ADC */ | ||
| 1803 | { | ||
| 1804 | .num_items = 5, | ||
| 1805 | .items = { | ||
| 1806 | { "Ext Mic", 0x0 }, | ||
| 1807 | { "Line In", 0x2 }, | ||
| 1808 | { "CD", 0x4 }, | ||
| 1809 | { "Input Mix", 0xa }, | ||
| 1810 | { "Int Mic", 0xb }, | ||
| 1811 | }, | ||
| 1812 | }, | ||
| 1813 | { | ||
| 1814 | .num_items = 4, | ||
| 1815 | .items = { | ||
| 1816 | { "Ext Mic", 0x0 }, | ||
| 1817 | { "Line In", 0x2 }, | ||
| 1818 | { "CD", 0x4 }, | ||
| 1819 | { "Input Mix", 0xa }, | ||
| 1820 | }, | ||
| 1821 | } | ||
| 1822 | }; | ||
| 1823 | |||
| 1824 | static struct hda_input_mux alc889_capture_sources[3] = { | ||
| 1825 | /* Digital mic only available on first "ADC" */ | ||
| 1826 | { | ||
| 1827 | .num_items = 5, | ||
| 1828 | .items = { | ||
| 1829 | { "Mic", 0x0 }, | ||
| 1830 | { "Line", 0x2 }, | ||
| 1831 | { "CD", 0x4 }, | ||
| 1832 | { "Front Mic", 0xb }, | ||
| 1833 | { "Input Mix", 0xa }, | ||
| 1834 | }, | ||
| 1835 | }, | ||
| 1836 | { | ||
| 1837 | .num_items = 4, | ||
| 1838 | .items = { | ||
| 1839 | { "Mic", 0x0 }, | ||
| 1840 | { "Line", 0x2 }, | ||
| 1841 | { "CD", 0x4 }, | ||
| 1842 | { "Input Mix", 0xa }, | ||
| 1843 | }, | ||
| 1844 | }, | ||
| 1845 | { | ||
| 1846 | .num_items = 4, | ||
| 1847 | .items = { | ||
| 1848 | { "Mic", 0x0 }, | ||
| 1849 | { "Line", 0x2 }, | ||
| 1850 | { "CD", 0x4 }, | ||
| 1851 | { "Input Mix", 0xa }, | ||
| 1852 | }, | ||
| 1853 | } | ||
| 1854 | }; | ||
| 1855 | |||
| 1856 | static struct snd_kcontrol_new alc888_base_mixer[] = { | ||
| 1857 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 1858 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 1859 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 1860 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 1861 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
| 1862 | HDA_OUTPUT), | ||
| 1863 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 1864 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 1865 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 1866 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 1867 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 1868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 1869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 1870 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 1871 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 1872 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 1873 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 1874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 1875 | { } /* end */ | ||
| 1876 | }; | ||
| 1877 | |||
| 1878 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
| 1879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 1880 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 1881 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 1882 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 1883 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
| 1884 | HDA_OUTPUT), | ||
| 1885 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 1886 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 1887 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 1888 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 1889 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 1890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 1891 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 1892 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 1893 | { } /* end */ | ||
| 1894 | }; | ||
| 1895 | |||
| 1896 | |||
| 1897 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | ||
| 1898 | { | ||
| 1899 | struct alc_spec *spec = codec->spec; | ||
| 1900 | |||
| 1901 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 1902 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 1903 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 1904 | spec->autocfg.speaker_pins[2] = 0x17; | ||
| 1905 | } | ||
| 1906 | |||
| 1907 | static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec) | ||
| 1908 | { | ||
| 1909 | struct alc_spec *spec = codec->spec; | ||
| 1910 | |||
| 1911 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 1912 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 1913 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 1914 | spec->autocfg.speaker_pins[2] = 0x17; | ||
| 1915 | } | ||
| 1916 | |||
| 1917 | static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | ||
| 1918 | { | ||
| 1919 | struct alc_spec *spec = codec->spec; | ||
| 1920 | |||
| 1921 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 1922 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 1923 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 1924 | spec->autocfg.speaker_pins[2] = 0x1b; | ||
| 1925 | } | ||
| 1926 | |||
| 1927 | /* | ||
| 1928 | * ALC880 3-stack model | ||
| 1929 | * | ||
| 1930 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) | ||
| 1931 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, | ||
| 1932 | * F-Mic = 0x1b, HP = 0x19 | ||
| 1933 | */ | ||
| 1934 | |||
| 1935 | static hda_nid_t alc880_dac_nids[4] = { | ||
| 1936 | /* front, rear, clfe, rear_surr */ | ||
| 1937 | 0x02, 0x05, 0x04, 0x03 | ||
| 1938 | }; | ||
| 1939 | |||
| 1940 | static hda_nid_t alc880_adc_nids[3] = { | ||
| 1941 | /* ADC0-2 */ | ||
| 1942 | 0x07, 0x08, 0x09, | ||
| 1943 | }; | ||
| 1944 | |||
| 1945 | /* The datasheet says the node 0x07 is connected from inputs, | ||
| 1946 | * but it shows zero connection in the real implementation on some devices. | ||
| 1947 | * Note: this is a 915GAV bug, fixed on 915GLV | ||
| 1948 | */ | ||
| 1949 | static hda_nid_t alc880_adc_nids_alt[2] = { | ||
| 1950 | /* ADC1-2 */ | ||
| 1951 | 0x08, 0x09, | ||
| 1952 | }; | ||
| 1953 | |||
| 1954 | #define ALC880_DIGOUT_NID 0x06 | ||
| 1955 | #define ALC880_DIGIN_NID 0x0a | ||
| 1956 | |||
| 1957 | static struct hda_input_mux alc880_capture_source = { | ||
| 1958 | .num_items = 4, | ||
| 1959 | .items = { | ||
| 1960 | { "Mic", 0x0 }, | ||
| 1961 | { "Front Mic", 0x3 }, | ||
| 1962 | { "Line", 0x2 }, | ||
| 1963 | { "CD", 0x4 }, | ||
| 1964 | }, | ||
| 1965 | }; | ||
| 1966 | |||
| 1967 | /* channel source setting (2/6 channel selection for 3-stack) */ | ||
| 1968 | /* 2ch mode */ | ||
| 1969 | static struct hda_verb alc880_threestack_ch2_init[] = { | ||
| 1970 | /* set line-in to input, mute it */ | ||
| 1971 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 1972 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 1973 | /* set mic-in to input vref 80%, mute it */ | ||
| 1974 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 1975 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 1976 | { } /* end */ | ||
| 1977 | }; | ||
| 1978 | |||
| 1979 | /* 6ch mode */ | ||
| 1980 | static struct hda_verb alc880_threestack_ch6_init[] = { | ||
| 1981 | /* set line-in to output, unmute it */ | ||
| 1982 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1983 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1984 | /* set mic-in to output, unmute it */ | ||
| 1985 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 1986 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 1987 | { } /* end */ | ||
| 1988 | }; | ||
| 1989 | |||
| 1990 | static struct hda_channel_mode alc880_threestack_modes[2] = { | ||
| 1991 | { 2, alc880_threestack_ch2_init }, | ||
| 1992 | { 6, alc880_threestack_ch6_init }, | ||
| 1993 | }; | ||
| 1994 | |||
| 1995 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { | ||
| 1996 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 1997 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 1998 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 1999 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 2000 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 2001 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 2002 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 2003 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 2004 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2005 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2006 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 2007 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 2008 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2009 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2010 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
| 2011 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
| 2012 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), | ||
| 2013 | { | ||
| 2014 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2015 | .name = "Channel Mode", | ||
| 2016 | .info = alc_ch_mode_info, | ||
| 2017 | .get = alc_ch_mode_get, | ||
| 2018 | .put = alc_ch_mode_put, | ||
| 2019 | }, | ||
| 2020 | { } /* end */ | ||
| 2021 | }; | ||
| 2022 | |||
| 2023 | /* capture mixer elements */ | ||
| 2024 | static int alc_cap_vol_info(struct snd_kcontrol *kcontrol, | ||
| 2025 | struct snd_ctl_elem_info *uinfo) | ||
| 2026 | { | ||
| 2027 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 2028 | struct alc_spec *spec = codec->spec; | ||
| 2029 | int err; | ||
| 2030 | |||
| 2031 | mutex_lock(&codec->control_mutex); | ||
| 2032 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | ||
| 2033 | HDA_INPUT); | ||
| 2034 | err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); | ||
| 2035 | mutex_unlock(&codec->control_mutex); | ||
| 2036 | return err; | ||
| 2037 | } | ||
| 2038 | |||
| 2039 | static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | ||
| 2040 | unsigned int size, unsigned int __user *tlv) | ||
| 2041 | { | ||
| 2042 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 2043 | struct alc_spec *spec = codec->spec; | ||
| 2044 | int err; | ||
| 2045 | |||
| 2046 | mutex_lock(&codec->control_mutex); | ||
| 2047 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, | ||
| 2048 | HDA_INPUT); | ||
| 2049 | err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); | ||
| 2050 | mutex_unlock(&codec->control_mutex); | ||
| 2051 | return err; | ||
| 2052 | } | ||
| 2053 | |||
| 2054 | typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol, | ||
| 2055 | struct snd_ctl_elem_value *ucontrol); | ||
| 2056 | |||
| 2057 | static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol, | ||
| 2058 | struct snd_ctl_elem_value *ucontrol, | ||
| 2059 | getput_call_t func) | ||
| 2060 | { | ||
| 2061 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 2062 | struct alc_spec *spec = codec->spec; | ||
| 2063 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
| 2064 | int err; | ||
| 2065 | |||
| 2066 | mutex_lock(&codec->control_mutex); | ||
| 2067 | kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], | ||
| 2068 | 3, 0, HDA_INPUT); | ||
| 2069 | err = func(kcontrol, ucontrol); | ||
| 2070 | mutex_unlock(&codec->control_mutex); | ||
| 2071 | return err; | ||
| 2072 | } | ||
| 2073 | |||
| 2074 | static int alc_cap_vol_get(struct snd_kcontrol *kcontrol, | ||
| 2075 | struct snd_ctl_elem_value *ucontrol) | ||
| 2076 | { | ||
| 2077 | return alc_cap_getput_caller(kcontrol, ucontrol, | ||
| 2078 | snd_hda_mixer_amp_volume_get); | ||
| 2079 | } | ||
| 2080 | |||
| 2081 | static int alc_cap_vol_put(struct snd_kcontrol *kcontrol, | ||
| 2082 | struct snd_ctl_elem_value *ucontrol) | ||
| 2083 | { | ||
| 2084 | return alc_cap_getput_caller(kcontrol, ucontrol, | ||
| 2085 | snd_hda_mixer_amp_volume_put); | ||
| 2086 | } | ||
| 2087 | |||
| 2088 | /* capture mixer elements */ | ||
| 2089 | #define alc_cap_sw_info snd_ctl_boolean_stereo_info | ||
| 2090 | |||
| 2091 | static int alc_cap_sw_get(struct snd_kcontrol *kcontrol, | ||
| 2092 | struct snd_ctl_elem_value *ucontrol) | ||
| 2093 | { | ||
| 2094 | return alc_cap_getput_caller(kcontrol, ucontrol, | ||
| 2095 | snd_hda_mixer_amp_switch_get); | ||
| 2096 | } | ||
| 2097 | |||
| 2098 | static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | ||
| 2099 | struct snd_ctl_elem_value *ucontrol) | ||
| 2100 | { | ||
| 2101 | return alc_cap_getput_caller(kcontrol, ucontrol, | ||
| 2102 | snd_hda_mixer_amp_switch_put); | ||
| 2103 | } | ||
| 2104 | |||
| 2105 | #define _DEFINE_CAPMIX(num) \ | ||
| 2106 | { \ | ||
| 2107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 2108 | .name = "Capture Switch", \ | ||
| 2109 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
| 2110 | .count = num, \ | ||
| 2111 | .info = alc_cap_sw_info, \ | ||
| 2112 | .get = alc_cap_sw_get, \ | ||
| 2113 | .put = alc_cap_sw_put, \ | ||
| 2114 | }, \ | ||
| 2115 | { \ | ||
| 2116 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 2117 | .name = "Capture Volume", \ | ||
| 2118 | .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
| 2119 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
| 2120 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \ | ||
| 2121 | .count = num, \ | ||
| 2122 | .info = alc_cap_vol_info, \ | ||
| 2123 | .get = alc_cap_vol_get, \ | ||
| 2124 | .put = alc_cap_vol_put, \ | ||
| 2125 | .tlv = { .c = alc_cap_vol_tlv }, \ | ||
| 2126 | } | ||
| 2127 | |||
| 2128 | #define _DEFINE_CAPSRC(num) \ | ||
| 2129 | { \ | ||
| 2130 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 2131 | /* .name = "Capture Source", */ \ | ||
| 2132 | .name = "Input Source", \ | ||
| 2133 | .count = num, \ | ||
| 2134 | .info = alc_mux_enum_info, \ | ||
| 2135 | .get = alc_mux_enum_get, \ | ||
| 2136 | .put = alc_mux_enum_put, \ | ||
| 2137 | } | ||
| 2138 | |||
| 2139 | #define DEFINE_CAPMIX(num) \ | ||
| 2140 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | ||
| 2141 | _DEFINE_CAPMIX(num), \ | ||
| 2142 | _DEFINE_CAPSRC(num), \ | ||
| 2143 | { } /* end */ \ | ||
| 2144 | } | ||
| 2145 | |||
| 2146 | #define DEFINE_CAPMIX_NOSRC(num) \ | ||
| 2147 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | ||
| 2148 | _DEFINE_CAPMIX(num), \ | ||
| 2149 | { } /* end */ \ | ||
| 2150 | } | ||
| 2151 | |||
| 2152 | /* up to three ADCs */ | ||
| 2153 | DEFINE_CAPMIX(1); | ||
| 2154 | DEFINE_CAPMIX(2); | ||
| 2155 | DEFINE_CAPMIX(3); | ||
| 2156 | DEFINE_CAPMIX_NOSRC(1); | ||
| 2157 | DEFINE_CAPMIX_NOSRC(2); | ||
| 2158 | DEFINE_CAPMIX_NOSRC(3); | ||
| 2159 | |||
| 2160 | /* | ||
| 2161 | * ALC880 5-stack model | ||
| 2162 | * | ||
| 2163 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), | ||
| 2164 | * Side = 0x02 (0xd) | ||
| 2165 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 | ||
| 2166 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 | ||
| 2167 | */ | ||
| 2168 | |||
| 2169 | /* additional mixers to alc880_three_stack_mixer */ | ||
| 2170 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { | ||
| 2171 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2172 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2173 | { } /* end */ | ||
| 2174 | }; | ||
| 2175 | |||
| 2176 | /* channel source setting (6/8 channel selection for 5-stack) */ | ||
| 2177 | /* 6ch mode */ | ||
| 2178 | static struct hda_verb alc880_fivestack_ch6_init[] = { | ||
| 2179 | /* set line-in to input, mute it */ | ||
| 2180 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 2181 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 2182 | { } /* end */ | ||
| 2183 | }; | ||
| 2184 | |||
| 2185 | /* 8ch mode */ | ||
| 2186 | static struct hda_verb alc880_fivestack_ch8_init[] = { | ||
| 2187 | /* set line-in to output, unmute it */ | ||
| 2188 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 2189 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 2190 | { } /* end */ | ||
| 2191 | }; | ||
| 2192 | |||
| 2193 | static struct hda_channel_mode alc880_fivestack_modes[2] = { | ||
| 2194 | { 6, alc880_fivestack_ch6_init }, | ||
| 2195 | { 8, alc880_fivestack_ch8_init }, | ||
| 2196 | }; | ||
| 2197 | |||
| 2198 | |||
| 2199 | /* | ||
| 2200 | * ALC880 6-stack model | ||
| 2201 | * | ||
| 2202 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), | ||
| 2203 | * Side = 0x05 (0x0f) | ||
| 2204 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, | ||
| 2205 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b | ||
| 2206 | */ | ||
| 2207 | |||
| 2208 | static hda_nid_t alc880_6st_dac_nids[4] = { | ||
| 2209 | /* front, rear, clfe, rear_surr */ | ||
| 2210 | 0x02, 0x03, 0x04, 0x05 | ||
| 2211 | }; | ||
| 2212 | |||
| 2213 | static struct hda_input_mux alc880_6stack_capture_source = { | ||
| 2214 | .num_items = 4, | ||
| 2215 | .items = { | ||
| 2216 | { "Mic", 0x0 }, | ||
| 2217 | { "Front Mic", 0x1 }, | ||
| 2218 | { "Line", 0x2 }, | ||
| 2219 | { "CD", 0x4 }, | ||
| 2220 | }, | ||
| 2221 | }; | ||
| 2222 | |||
| 2223 | /* fixed 8-channels */ | ||
| 2224 | static struct hda_channel_mode alc880_sixstack_modes[1] = { | ||
| 2225 | { 8, NULL }, | ||
| 2226 | }; | ||
| 2227 | |||
| 2228 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | ||
| 2229 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2230 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2231 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2232 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2233 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 2234 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 2235 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 2236 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 2237 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 2238 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 2239 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2240 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2241 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 2242 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 2243 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2244 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2245 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 2246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 2247 | { | ||
| 2248 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2249 | .name = "Channel Mode", | ||
| 2250 | .info = alc_ch_mode_info, | ||
| 2251 | .get = alc_ch_mode_get, | ||
| 2252 | .put = alc_ch_mode_put, | ||
| 2253 | }, | ||
| 2254 | { } /* end */ | ||
| 2255 | }; | ||
| 2256 | |||
| 2257 | |||
| 2258 | /* | ||
| 2259 | * ALC880 W810 model | ||
| 2260 | * | ||
| 2261 | * W810 has rear IO for: | ||
| 2262 | * Front (DAC 02) | ||
| 2263 | * Surround (DAC 03) | ||
| 2264 | * Center/LFE (DAC 04) | ||
| 2265 | * Digital out (06) | ||
| 2266 | * | ||
| 2267 | * The system also has a pair of internal speakers, and a headphone jack. | ||
| 2268 | * These are both connected to Line2 on the codec, hence to DAC 02. | ||
| 2269 | * | ||
| 2270 | * There is a variable resistor to control the speaker or headphone | ||
| 2271 | * volume. This is a hardware-only device without a software API. | ||
| 2272 | * | ||
| 2273 | * Plugging headphones in will disable the internal speakers. This is | ||
| 2274 | * implemented in hardware, not via the driver using jack sense. In | ||
| 2275 | * a similar fashion, plugging into the rear socket marked "front" will | ||
| 2276 | * disable both the speakers and headphones. | ||
| 2277 | * | ||
| 2278 | * For input, there's a microphone jack, and an "audio in" jack. | ||
| 2279 | * These may not do anything useful with this driver yet, because I | ||
| 2280 | * haven't setup any initialization verbs for these yet... | ||
| 2281 | */ | ||
| 2282 | |||
| 2283 | static hda_nid_t alc880_w810_dac_nids[3] = { | ||
| 2284 | /* front, rear/surround, clfe */ | ||
| 2285 | 0x02, 0x03, 0x04 | ||
| 2286 | }; | ||
| 2287 | |||
| 2288 | /* fixed 6 channels */ | ||
| 2289 | static struct hda_channel_mode alc880_w810_modes[1] = { | ||
| 2290 | { 6, NULL } | ||
| 2291 | }; | ||
| 2292 | |||
| 2293 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ | ||
| 2294 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { | ||
| 2295 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2296 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2297 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2298 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2299 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 2300 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 2301 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 2302 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 2303 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 2304 | { } /* end */ | ||
| 2305 | }; | ||
| 2306 | |||
| 2307 | |||
| 2308 | /* | ||
| 2309 | * Z710V model | ||
| 2310 | * | ||
| 2311 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) | ||
| 2312 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), | ||
| 2313 | * Line = 0x1a | ||
| 2314 | */ | ||
| 2315 | |||
| 2316 | static hda_nid_t alc880_z71v_dac_nids[1] = { | ||
| 2317 | 0x02 | ||
| 2318 | }; | ||
| 2319 | #define ALC880_Z71V_HP_DAC 0x03 | ||
| 2320 | |||
| 2321 | /* fixed 2 channels */ | ||
| 2322 | static struct hda_channel_mode alc880_2_jack_modes[1] = { | ||
| 2323 | { 2, NULL } | ||
| 2324 | }; | ||
| 2325 | |||
| 2326 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { | ||
| 2327 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2328 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2329 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2330 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2331 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2332 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2333 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2334 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2335 | { } /* end */ | ||
| 2336 | }; | ||
| 2337 | |||
| 2338 | |||
| 2339 | /* | ||
| 2340 | * ALC880 F1734 model | ||
| 2341 | * | ||
| 2342 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) | ||
| 2343 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 | ||
| 2344 | */ | ||
| 2345 | |||
| 2346 | static hda_nid_t alc880_f1734_dac_nids[1] = { | ||
| 2347 | 0x03 | ||
| 2348 | }; | ||
| 2349 | #define ALC880_F1734_HP_DAC 0x02 | ||
| 2350 | |||
| 2351 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { | ||
| 2352 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2353 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2354 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2355 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2356 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2357 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2358 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 2359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 2360 | { } /* end */ | ||
| 2361 | }; | ||
| 2362 | |||
| 2363 | static struct hda_input_mux alc880_f1734_capture_source = { | ||
| 2364 | .num_items = 2, | ||
| 2365 | .items = { | ||
| 2366 | { "Mic", 0x1 }, | ||
| 2367 | { "CD", 0x4 }, | ||
| 2368 | }, | ||
| 2369 | }; | ||
| 2370 | |||
| 2371 | |||
| 2372 | /* | ||
| 2373 | * ALC880 ASUS model | ||
| 2374 | * | ||
| 2375 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | ||
| 2376 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | ||
| 2377 | * Mic = 0x18, Line = 0x1a | ||
| 2378 | */ | ||
| 2379 | |||
| 2380 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ | ||
| 2381 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ | ||
| 2382 | |||
| 2383 | static struct snd_kcontrol_new alc880_asus_mixer[] = { | ||
| 2384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2385 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2386 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2387 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2388 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 2389 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 2390 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 2391 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 2392 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2393 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2394 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 2395 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 2396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2398 | { | ||
| 2399 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2400 | .name = "Channel Mode", | ||
| 2401 | .info = alc_ch_mode_info, | ||
| 2402 | .get = alc_ch_mode_get, | ||
| 2403 | .put = alc_ch_mode_put, | ||
| 2404 | }, | ||
| 2405 | { } /* end */ | ||
| 2406 | }; | ||
| 2407 | |||
| 2408 | /* | ||
| 2409 | * ALC880 ASUS W1V model | ||
| 2410 | * | ||
| 2411 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) | ||
| 2412 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, | ||
| 2413 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b | ||
| 2414 | */ | ||
| 2415 | |||
| 2416 | /* additional mixers to alc880_asus_mixer */ | ||
| 2417 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { | ||
| 2418 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), | ||
| 2419 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), | ||
| 2420 | { } /* end */ | ||
| 2421 | }; | ||
| 2422 | |||
| 2423 | /* TCL S700 */ | ||
| 2424 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | ||
| 2425 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2426 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 2427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 2428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), | ||
| 2429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), | ||
| 2430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), | ||
| 2431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), | ||
| 2432 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
| 2433 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
| 2434 | { } /* end */ | ||
| 2435 | }; | ||
| 2436 | |||
| 2437 | /* Uniwill */ | ||
| 2438 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | ||
| 2439 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2440 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2441 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2442 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2443 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 2444 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 2445 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 2446 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 2447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2449 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 2450 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 2451 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2452 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2453 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 2454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 2455 | { | ||
| 2456 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 2457 | .name = "Channel Mode", | ||
| 2458 | .info = alc_ch_mode_info, | ||
| 2459 | .get = alc_ch_mode_get, | ||
| 2460 | .put = alc_ch_mode_put, | ||
| 2461 | }, | ||
| 2462 | { } /* end */ | ||
| 2463 | }; | ||
| 2464 | |||
| 2465 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { | ||
| 2466 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2467 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2469 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2470 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 2471 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 2472 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2473 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2474 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 2475 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 2476 | { } /* end */ | ||
| 2477 | }; | ||
| 2478 | |||
| 2479 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { | ||
| 2480 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 2481 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 2482 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 2483 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 2484 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 2485 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 2486 | { } /* end */ | ||
| 2487 | }; | ||
| 2488 | |||
| 2489 | /* | ||
| 2490 | * virtual master controls | ||
| 2491 | */ | ||
| 2492 | |||
| 2493 | /* | ||
| 2494 | * slave controls for virtual master | ||
| 2495 | */ | ||
| 2496 | static const char *alc_slave_vols[] = { | ||
| 2497 | "Front Playback Volume", | ||
| 2498 | "Surround Playback Volume", | ||
| 2499 | "Center Playback Volume", | ||
| 2500 | "LFE Playback Volume", | ||
| 2501 | "Side Playback Volume", | ||
| 2502 | "Headphone Playback Volume", | ||
| 2503 | "Speaker Playback Volume", | ||
| 2504 | "Mono Playback Volume", | ||
| 2505 | "Line-Out Playback Volume", | ||
| 2506 | "PCM Playback Volume", | ||
| 2507 | NULL, | ||
| 2508 | }; | ||
| 2509 | |||
| 2510 | static const char *alc_slave_sws[] = { | ||
| 2511 | "Front Playback Switch", | ||
| 2512 | "Surround Playback Switch", | ||
| 2513 | "Center Playback Switch", | ||
| 2514 | "LFE Playback Switch", | ||
| 2515 | "Side Playback Switch", | ||
| 2516 | "Headphone Playback Switch", | ||
| 2517 | "Speaker Playback Switch", | ||
| 2518 | "Mono Playback Switch", | ||
| 2519 | "IEC958 Playback Switch", | ||
| 2520 | "Line-Out Playback Switch", | ||
| 2521 | "PCM Playback Switch", | ||
| 2522 | NULL, | ||
| 2523 | }; | ||
| 2524 | |||
| 2525 | /* | ||
| 2526 | * build control elements | ||
| 2527 | */ | ||
| 2528 | |||
| 2529 | #define NID_MAPPING (-1) | ||
| 2530 | |||
| 2531 | #define SUBDEV_SPEAKER_ (0 << 6) | ||
| 2532 | #define SUBDEV_HP_ (1 << 6) | ||
| 2533 | #define SUBDEV_LINE_ (2 << 6) | ||
| 2534 | #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f)) | ||
| 2535 | #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f)) | ||
| 2536 | #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f)) | ||
| 2537 | |||
| 2538 | static void alc_free_kctls(struct hda_codec *codec); | ||
| 2539 | |||
| 2540 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
| 2541 | /* additional beep mixers; the actual parameters are overwritten at build */ | ||
| 2542 | static struct snd_kcontrol_new alc_beep_mixer[] = { | ||
| 2543 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | ||
| 2544 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | ||
| 2545 | { } /* end */ | ||
| 2546 | }; | ||
| 2547 | #endif | ||
| 2548 | |||
| 2549 | static int alc_build_controls(struct hda_codec *codec) | ||
| 2550 | { | ||
| 2551 | struct alc_spec *spec = codec->spec; | ||
| 2552 | struct snd_kcontrol *kctl = NULL; | ||
| 2553 | struct snd_kcontrol_new *knew; | ||
| 2554 | int i, j, err; | ||
| 2555 | unsigned int u; | ||
| 2556 | hda_nid_t nid; | ||
| 2557 | |||
| 2558 | for (i = 0; i < spec->num_mixers; i++) { | ||
| 2559 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | ||
| 2560 | if (err < 0) | ||
| 2561 | return err; | ||
| 2562 | } | ||
| 2563 | if (spec->cap_mixer) { | ||
| 2564 | err = snd_hda_add_new_ctls(codec, spec->cap_mixer); | ||
| 2565 | if (err < 0) | ||
| 2566 | return err; | ||
| 2567 | } | ||
| 2568 | if (spec->multiout.dig_out_nid) { | ||
| 2569 | err = snd_hda_create_spdif_out_ctls(codec, | ||
| 2570 | spec->multiout.dig_out_nid); | ||
| 2571 | if (err < 0) | ||
| 2572 | return err; | ||
| 2573 | if (!spec->no_analog) { | ||
| 2574 | err = snd_hda_create_spdif_share_sw(codec, | ||
| 2575 | &spec->multiout); | ||
| 2576 | if (err < 0) | ||
| 2577 | return err; | ||
| 2578 | spec->multiout.share_spdif = 1; | ||
| 2579 | } | ||
| 2580 | } | ||
| 2581 | if (spec->dig_in_nid) { | ||
| 2582 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | ||
| 2583 | if (err < 0) | ||
| 2584 | return err; | ||
| 2585 | } | ||
| 2586 | |||
| 2587 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
| 2588 | /* create beep controls if needed */ | ||
| 2589 | if (spec->beep_amp) { | ||
| 2590 | struct snd_kcontrol_new *knew; | ||
| 2591 | for (knew = alc_beep_mixer; knew->name; knew++) { | ||
| 2592 | struct snd_kcontrol *kctl; | ||
| 2593 | kctl = snd_ctl_new1(knew, codec); | ||
| 2594 | if (!kctl) | ||
| 2595 | return -ENOMEM; | ||
| 2596 | kctl->private_value = spec->beep_amp; | ||
| 2597 | err = snd_hda_ctl_add(codec, 0, kctl); | ||
| 2598 | if (err < 0) | ||
| 2599 | return err; | ||
| 2600 | } | ||
| 2601 | } | ||
| 2602 | #endif | ||
| 2603 | |||
| 2604 | /* if we have no master control, let's create it */ | ||
| 2605 | if (!spec->no_analog && | ||
| 2606 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | ||
| 2607 | unsigned int vmaster_tlv[4]; | ||
| 2608 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | ||
| 2609 | HDA_OUTPUT, vmaster_tlv); | ||
| 2610 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | ||
| 2611 | vmaster_tlv, alc_slave_vols); | ||
| 2612 | if (err < 0) | ||
| 2613 | return err; | ||
| 2614 | } | ||
| 2615 | if (!spec->no_analog && | ||
| 2616 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | ||
| 2617 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | ||
| 2618 | NULL, alc_slave_sws); | ||
| 2619 | if (err < 0) | ||
| 2620 | return err; | ||
| 2621 | } | ||
| 2622 | |||
| 2623 | /* assign Capture Source enums to NID */ | ||
| 2624 | if (spec->capsrc_nids || spec->adc_nids) { | ||
| 2625 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | ||
| 2626 | if (!kctl) | ||
| 2627 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | ||
| 2628 | for (i = 0; kctl && i < kctl->count; i++) { | ||
| 2629 | hda_nid_t *nids = spec->capsrc_nids; | ||
| 2630 | if (!nids) | ||
| 2631 | nids = spec->adc_nids; | ||
| 2632 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
| 2633 | if (err < 0) | ||
| 2634 | return err; | ||
| 2635 | } | ||
| 2636 | } | ||
| 2637 | if (spec->cap_mixer) { | ||
| 2638 | const char *kname = kctl ? kctl->id.name : NULL; | ||
| 2639 | for (knew = spec->cap_mixer; knew->name; knew++) { | ||
| 2640 | if (kname && strcmp(knew->name, kname) == 0) | ||
| 2641 | continue; | ||
| 2642 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | ||
| 2643 | for (i = 0; kctl && i < kctl->count; i++) { | ||
| 2644 | err = snd_hda_add_nid(codec, kctl, i, | ||
| 2645 | spec->adc_nids[i]); | ||
| 2646 | if (err < 0) | ||
| 2647 | return err; | ||
| 2648 | } | ||
| 2649 | } | ||
| 2650 | } | ||
| 2651 | |||
| 2652 | /* other nid->control mapping */ | ||
| 2653 | for (i = 0; i < spec->num_mixers; i++) { | ||
| 2654 | for (knew = spec->mixers[i]; knew->name; knew++) { | ||
| 2655 | if (knew->iface != NID_MAPPING) | ||
| 2656 | continue; | ||
| 2657 | kctl = snd_hda_find_mixer_ctl(codec, knew->name); | ||
| 2658 | if (kctl == NULL) | ||
| 2659 | continue; | ||
| 2660 | u = knew->subdevice; | ||
| 2661 | for (j = 0; j < 4; j++, u >>= 8) { | ||
| 2662 | nid = u & 0x3f; | ||
| 2663 | if (nid == 0) | ||
| 2664 | continue; | ||
| 2665 | switch (u & 0xc0) { | ||
| 2666 | case SUBDEV_SPEAKER_: | ||
| 2667 | nid = spec->autocfg.speaker_pins[nid]; | ||
| 2668 | break; | ||
| 2669 | case SUBDEV_LINE_: | ||
| 2670 | nid = spec->autocfg.line_out_pins[nid]; | ||
| 2671 | break; | ||
| 2672 | case SUBDEV_HP_: | ||
| 2673 | nid = spec->autocfg.hp_pins[nid]; | ||
| 2674 | break; | ||
| 2675 | default: | ||
| 2676 | continue; | ||
| 2677 | } | ||
| 2678 | err = snd_hda_add_nid(codec, kctl, 0, nid); | ||
| 2679 | if (err < 0) | ||
| 2680 | return err; | ||
| 2681 | } | ||
| 2682 | u = knew->private_value; | ||
| 2683 | for (j = 0; j < 4; j++, u >>= 8) { | ||
| 2684 | nid = u & 0xff; | ||
| 2685 | if (nid == 0) | ||
| 2686 | continue; | ||
| 2687 | err = snd_hda_add_nid(codec, kctl, 0, nid); | ||
| 2688 | if (err < 0) | ||
| 2689 | return err; | ||
| 2690 | } | ||
| 2691 | } | ||
| 2692 | } | ||
| 2693 | |||
| 2694 | alc_free_kctls(codec); /* no longer needed */ | ||
| 2695 | |||
| 2696 | return 0; | ||
| 2697 | } | ||
| 2698 | |||
| 2699 | |||
| 2700 | /* | ||
| 2701 | * initialize the codec volumes, etc | ||
| 2702 | */ | ||
| 2703 | |||
| 2704 | /* | ||
| 2705 | * generic initialization of ADC, input mixers and output mixers | ||
| 2706 | */ | ||
| 2707 | static struct hda_verb alc880_volume_init_verbs[] = { | ||
| 2708 | /* | ||
| 2709 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 2710 | */ | ||
| 2711 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 2712 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 2713 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 2714 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 2715 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 2716 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 2717 | |||
| 2718 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 2719 | * mixer widget | ||
| 2720 | * Note: PASD motherboards uses the Line In 2 as the input for front | ||
| 2721 | * panel mic (mic 2) | ||
| 2722 | */ | ||
| 2723 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 2724 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 2725 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 2726 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 2727 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 2728 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 2729 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
| 2730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
| 2731 | |||
| 2732 | /* | ||
| 2733 | * Set up output mixers (0x0c - 0x0f) | ||
| 2734 | */ | ||
| 2735 | /* set vol=0 to output mixers */ | ||
| 2736 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 2737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 2738 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 2739 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 2740 | /* set up input amps for analog loopback */ | ||
| 2741 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 2742 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 2743 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 2744 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 2745 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 2746 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 2747 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 2748 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 2749 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 2750 | |||
| 2751 | { } | ||
| 2752 | }; | ||
| 2753 | |||
| 2754 | /* | ||
| 2755 | * 3-stack pin configuration: | ||
| 2756 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | ||
| 2757 | */ | ||
| 2758 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { | ||
| 2759 | /* | ||
| 2760 | * preset connection lists of input pins | ||
| 2761 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | ||
| 2762 | */ | ||
| 2763 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
| 2764 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 2765 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | ||
| 2766 | |||
| 2767 | /* | ||
| 2768 | * Set pin mode and muting | ||
| 2769 | */ | ||
| 2770 | /* set front pin widgets 0x14 for output */ | ||
| 2771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2772 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2773 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 2774 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2776 | /* Mic2 (as headphone out) for HP output */ | ||
| 2777 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2778 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2779 | /* Line In pin widget for input */ | ||
| 2780 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2781 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2782 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | ||
| 2783 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2784 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2785 | /* CD pin widget for input */ | ||
| 2786 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2787 | |||
| 2788 | { } | ||
| 2789 | }; | ||
| 2790 | |||
| 2791 | /* | ||
| 2792 | * 5-stack pin configuration: | ||
| 2793 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, | ||
| 2794 | * line-in/side = 0x1a, f-mic = 0x1b | ||
| 2795 | */ | ||
| 2796 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { | ||
| 2797 | /* | ||
| 2798 | * preset connection lists of input pins | ||
| 2799 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround | ||
| 2800 | */ | ||
| 2801 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 2802 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ | ||
| 2803 | |||
| 2804 | /* | ||
| 2805 | * Set pin mode and muting | ||
| 2806 | */ | ||
| 2807 | /* set pin widgets 0x14-0x17 for output */ | ||
| 2808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2810 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2811 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2812 | /* unmute pins for output (no gain on this amp) */ | ||
| 2813 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2816 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2817 | |||
| 2818 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 2819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2821 | /* Mic2 (as headphone out) for HP output */ | ||
| 2822 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2823 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2824 | /* Line In pin widget for input */ | ||
| 2825 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2826 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2827 | /* Line2 (as front mic) pin widget for input and vref at 80% */ | ||
| 2828 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2830 | /* CD pin widget for input */ | ||
| 2831 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2832 | |||
| 2833 | { } | ||
| 2834 | }; | ||
| 2835 | |||
| 2836 | /* | ||
| 2837 | * W810 pin configuration: | ||
| 2838 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b | ||
| 2839 | */ | ||
| 2840 | static struct hda_verb alc880_pin_w810_init_verbs[] = { | ||
| 2841 | /* hphone/speaker input selector: front DAC */ | ||
| 2842 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
| 2843 | |||
| 2844 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2845 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2849 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2850 | |||
| 2851 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2852 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2853 | |||
| 2854 | { } | ||
| 2855 | }; | ||
| 2856 | |||
| 2857 | /* | ||
| 2858 | * Z71V pin configuration: | ||
| 2859 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) | ||
| 2860 | */ | ||
| 2861 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { | ||
| 2862 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2863 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2864 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2865 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2866 | |||
| 2867 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2868 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2869 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2870 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2871 | |||
| 2872 | { } | ||
| 2873 | }; | ||
| 2874 | |||
| 2875 | /* | ||
| 2876 | * 6-stack pin configuration: | ||
| 2877 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, | ||
| 2878 | * f-mic = 0x19, line = 0x1a, HP = 0x1b | ||
| 2879 | */ | ||
| 2880 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { | ||
| 2881 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 2882 | |||
| 2883 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2884 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2885 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2886 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2887 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2888 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2889 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2890 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2891 | |||
| 2892 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2893 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2894 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2895 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2896 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2897 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2898 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2899 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2900 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2901 | |||
| 2902 | { } | ||
| 2903 | }; | ||
| 2904 | |||
| 2905 | /* | ||
| 2906 | * Uniwill pin configuration: | ||
| 2907 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, | ||
| 2908 | * line = 0x1a | ||
| 2909 | */ | ||
| 2910 | static struct hda_verb alc880_uniwill_init_verbs[] = { | ||
| 2911 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 2912 | |||
| 2913 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2914 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2915 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2916 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2917 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2918 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2919 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 2920 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2923 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2924 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2925 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2926 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2927 | |||
| 2928 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2929 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2930 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2931 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2932 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2933 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2934 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ | ||
| 2935 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | ||
| 2936 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2937 | |||
| 2938 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 2939 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 2940 | |||
| 2941 | { } | ||
| 2942 | }; | ||
| 2943 | |||
| 2944 | /* | ||
| 2945 | * Uniwill P53 | ||
| 2946 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | ||
| 2947 | */ | ||
| 2948 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | ||
| 2949 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 2950 | |||
| 2951 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2952 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2953 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2954 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2955 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 2956 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 2957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2959 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2960 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2961 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 2962 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 2963 | |||
| 2964 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2965 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2966 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 2967 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 2969 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 2970 | |||
| 2971 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 2972 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, | ||
| 2973 | |||
| 2974 | { } | ||
| 2975 | }; | ||
| 2976 | |||
| 2977 | static struct hda_verb alc880_beep_init_verbs[] = { | ||
| 2978 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, | ||
| 2979 | { } | ||
| 2980 | }; | ||
| 2981 | |||
| 2982 | /* auto-toggle front mic */ | ||
| 2983 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) | ||
| 2984 | { | ||
| 2985 | unsigned int present; | ||
| 2986 | unsigned char bits; | ||
| 2987 | |||
| 2988 | present = snd_hda_jack_detect(codec, 0x18); | ||
| 2989 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 2990 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | ||
| 2991 | } | ||
| 2992 | |||
| 2993 | static void alc880_uniwill_setup(struct hda_codec *codec) | ||
| 2994 | { | ||
| 2995 | struct alc_spec *spec = codec->spec; | ||
| 2996 | |||
| 2997 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 2998 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 2999 | spec->autocfg.speaker_pins[0] = 0x16; | ||
| 3000 | } | ||
| 3001 | |||
| 3002 | static void alc880_uniwill_init_hook(struct hda_codec *codec) | ||
| 3003 | { | ||
| 3004 | alc_automute_amp(codec); | ||
| 3005 | alc880_uniwill_mic_automute(codec); | ||
| 3006 | } | ||
| 3007 | |||
| 3008 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, | ||
| 3009 | unsigned int res) | ||
| 3010 | { | ||
| 3011 | /* Looks like the unsol event is incompatible with the standard | ||
| 3012 | * definition. 4bit tag is placed at 28 bit! | ||
| 3013 | */ | ||
| 3014 | switch (res >> 28) { | ||
| 3015 | case ALC880_MIC_EVENT: | ||
| 3016 | alc880_uniwill_mic_automute(codec); | ||
| 3017 | break; | ||
| 3018 | default: | ||
| 3019 | alc_automute_amp_unsol_event(codec, res); | ||
| 3020 | break; | ||
| 3021 | } | ||
| 3022 | } | ||
| 3023 | |||
| 3024 | static void alc880_uniwill_p53_setup(struct hda_codec *codec) | ||
| 3025 | { | ||
| 3026 | struct alc_spec *spec = codec->spec; | ||
| 3027 | |||
| 3028 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 3029 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 3030 | } | ||
| 3031 | |||
| 3032 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | ||
| 3033 | { | ||
| 3034 | unsigned int present; | ||
| 3035 | |||
| 3036 | present = snd_hda_codec_read(codec, 0x21, 0, | ||
| 3037 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | ||
| 3038 | present &= HDA_AMP_VOLMASK; | ||
| 3039 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, | ||
| 3040 | HDA_AMP_VOLMASK, present); | ||
| 3041 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, | ||
| 3042 | HDA_AMP_VOLMASK, present); | ||
| 3043 | } | ||
| 3044 | |||
| 3045 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, | ||
| 3046 | unsigned int res) | ||
| 3047 | { | ||
| 3048 | /* Looks like the unsol event is incompatible with the standard | ||
| 3049 | * definition. 4bit tag is placed at 28 bit! | ||
| 3050 | */ | ||
| 3051 | if ((res >> 28) == ALC880_DCVOL_EVENT) | ||
| 3052 | alc880_uniwill_p53_dcvol_automute(codec); | ||
| 3053 | else | ||
| 3054 | alc_automute_amp_unsol_event(codec, res); | ||
| 3055 | } | ||
| 3056 | |||
| 3057 | /* | ||
| 3058 | * F1734 pin configuration: | ||
| 3059 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 | ||
| 3060 | */ | ||
| 3061 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { | ||
| 3062 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 3063 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 3064 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 3065 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 3066 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 3067 | |||
| 3068 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3069 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3070 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3072 | |||
| 3073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3075 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 3076 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3078 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3079 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3080 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3081 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3082 | |||
| 3083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | ||
| 3084 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, | ||
| 3085 | |||
| 3086 | { } | ||
| 3087 | }; | ||
| 3088 | |||
| 3089 | /* | ||
| 3090 | * ASUS pin configuration: | ||
| 3091 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a | ||
| 3092 | */ | ||
| 3093 | static struct hda_verb alc880_pin_asus_init_verbs[] = { | ||
| 3094 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 3095 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 3096 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 3097 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 3098 | |||
| 3099 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3100 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3101 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3102 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3103 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3105 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3106 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3107 | |||
| 3108 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3109 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3110 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3111 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3112 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3113 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3114 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3115 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3116 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3117 | |||
| 3118 | { } | ||
| 3119 | }; | ||
| 3120 | |||
| 3121 | /* Enable GPIO mask and set output */ | ||
| 3122 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs | ||
| 3123 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs | ||
| 3124 | #define alc880_gpio3_init_verbs alc_gpio3_init_verbs | ||
| 3125 | |||
| 3126 | /* Clevo m520g init */ | ||
| 3127 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { | ||
| 3128 | /* headphone output */ | ||
| 3129 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 3130 | /* line-out */ | ||
| 3131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3133 | /* Line-in */ | ||
| 3134 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3135 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3136 | /* CD */ | ||
| 3137 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3138 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3139 | /* Mic1 (rear panel) */ | ||
| 3140 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3141 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3142 | /* Mic2 (front panel) */ | ||
| 3143 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3144 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3145 | /* headphone */ | ||
| 3146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3148 | /* change to EAPD mode */ | ||
| 3149 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 3150 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
| 3151 | |||
| 3152 | { } | ||
| 3153 | }; | ||
| 3154 | |||
| 3155 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { | ||
| 3156 | /* change to EAPD mode */ | ||
| 3157 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 3158 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
| 3159 | |||
| 3160 | /* Headphone output */ | ||
| 3161 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3162 | /* Front output*/ | ||
| 3163 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3164 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 3165 | |||
| 3166 | /* Line In pin widget for input */ | ||
| 3167 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3168 | /* CD pin widget for input */ | ||
| 3169 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3170 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 3171 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3172 | |||
| 3173 | /* change to EAPD mode */ | ||
| 3174 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 3175 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | ||
| 3176 | |||
| 3177 | { } | ||
| 3178 | }; | ||
| 3179 | |||
| 3180 | /* | ||
| 3181 | * LG m1 express dual | ||
| 3182 | * | ||
| 3183 | * Pin assignment: | ||
| 3184 | * Rear Line-In/Out (blue): 0x14 | ||
| 3185 | * Build-in Mic-In: 0x15 | ||
| 3186 | * Speaker-out: 0x17 | ||
| 3187 | * HP-Out (green): 0x1b | ||
| 3188 | * Mic-In/Out (red): 0x19 | ||
| 3189 | * SPDIF-Out: 0x1e | ||
| 3190 | */ | ||
| 3191 | |||
| 3192 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ | ||
| 3193 | static hda_nid_t alc880_lg_dac_nids[3] = { | ||
| 3194 | 0x05, 0x02, 0x03 | ||
| 3195 | }; | ||
| 3196 | |||
| 3197 | /* seems analog CD is not working */ | ||
| 3198 | static struct hda_input_mux alc880_lg_capture_source = { | ||
| 3199 | .num_items = 3, | ||
| 3200 | .items = { | ||
| 3201 | { "Mic", 0x1 }, | ||
| 3202 | { "Line", 0x5 }, | ||
| 3203 | { "Internal Mic", 0x6 }, | ||
| 3204 | }, | ||
| 3205 | }; | ||
| 3206 | |||
| 3207 | /* 2,4,6 channel modes */ | ||
| 3208 | static struct hda_verb alc880_lg_ch2_init[] = { | ||
| 3209 | /* set line-in and mic-in to input */ | ||
| 3210 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 3211 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 3212 | { } | ||
| 3213 | }; | ||
| 3214 | |||
| 3215 | static struct hda_verb alc880_lg_ch4_init[] = { | ||
| 3216 | /* set line-in to out and mic-in to input */ | ||
| 3217 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
| 3218 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 3219 | { } | ||
| 3220 | }; | ||
| 3221 | |||
| 3222 | static struct hda_verb alc880_lg_ch6_init[] = { | ||
| 3223 | /* set line-in and mic-in to output */ | ||
| 3224 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
| 3225 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
| 3226 | { } | ||
| 3227 | }; | ||
| 3228 | |||
| 3229 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { | ||
| 3230 | { 2, alc880_lg_ch2_init }, | ||
| 3231 | { 4, alc880_lg_ch4_init }, | ||
| 3232 | { 6, alc880_lg_ch6_init }, | ||
| 3233 | }; | ||
| 3234 | |||
| 3235 | static struct snd_kcontrol_new alc880_lg_mixer[] = { | ||
| 3236 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 3237 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 3238 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 3239 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 3240 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
| 3241 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
| 3242 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
| 3243 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
| 3244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 3245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 3246 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
| 3247 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
| 3248 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), | ||
| 3249 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), | ||
| 3250 | { | ||
| 3251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 3252 | .name = "Channel Mode", | ||
| 3253 | .info = alc_ch_mode_info, | ||
| 3254 | .get = alc_ch_mode_get, | ||
| 3255 | .put = alc_ch_mode_put, | ||
| 3256 | }, | ||
| 3257 | { } /* end */ | ||
| 3258 | }; | ||
| 3259 | |||
| 3260 | static struct hda_verb alc880_lg_init_verbs[] = { | ||
| 3261 | /* set capture source to mic-in */ | ||
| 3262 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 3263 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 3264 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 3265 | /* mute all amp mixer inputs */ | ||
| 3266 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, | ||
| 3267 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
| 3268 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
| 3269 | /* line-in to input */ | ||
| 3270 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 3271 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3272 | /* built-in mic */ | ||
| 3273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3275 | /* speaker-out */ | ||
| 3276 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3277 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3278 | /* mic-in to input */ | ||
| 3279 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 3280 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3282 | /* HP-out */ | ||
| 3283 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 3284 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3285 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3286 | /* jack sense */ | ||
| 3287 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 3288 | { } | ||
| 3289 | }; | ||
| 3290 | |||
| 3291 | /* toggle speaker-output according to the hp-jack state */ | ||
| 3292 | static void alc880_lg_setup(struct hda_codec *codec) | ||
| 3293 | { | ||
| 3294 | struct alc_spec *spec = codec->spec; | ||
| 3295 | |||
| 3296 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 3297 | spec->autocfg.speaker_pins[0] = 0x17; | ||
| 3298 | } | ||
| 3299 | |||
| 3300 | /* | ||
| 3301 | * LG LW20 | ||
| 3302 | * | ||
| 3303 | * Pin assignment: | ||
| 3304 | * Speaker-out: 0x14 | ||
| 3305 | * Mic-In: 0x18 | ||
| 3306 | * Built-in Mic-In: 0x19 | ||
| 3307 | * Line-In: 0x1b | ||
| 3308 | * HP-Out: 0x1a | ||
| 3309 | * SPDIF-Out: 0x1e | ||
| 3310 | */ | ||
| 3311 | |||
| 3312 | static struct hda_input_mux alc880_lg_lw_capture_source = { | ||
| 3313 | .num_items = 3, | ||
| 3314 | .items = { | ||
| 3315 | { "Mic", 0x0 }, | ||
| 3316 | { "Internal Mic", 0x1 }, | ||
| 3317 | { "Line In", 0x2 }, | ||
| 3318 | }, | ||
| 3319 | }; | ||
| 3320 | |||
| 3321 | #define alc880_lg_lw_modes alc880_threestack_modes | ||
| 3322 | |||
| 3323 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { | ||
| 3324 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 3325 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 3326 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 3327 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 3328 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 3329 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 3330 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 3331 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 3332 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 3333 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 3334 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 3335 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 3336 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 3337 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 3338 | { | ||
| 3339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 3340 | .name = "Channel Mode", | ||
| 3341 | .info = alc_ch_mode_info, | ||
| 3342 | .get = alc_ch_mode_get, | ||
| 3343 | .put = alc_ch_mode_put, | ||
| 3344 | }, | ||
| 3345 | { } /* end */ | ||
| 3346 | }; | ||
| 3347 | |||
| 3348 | static struct hda_verb alc880_lg_lw_init_verbs[] = { | ||
| 3349 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 3350 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
| 3351 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ | ||
| 3352 | |||
| 3353 | /* set capture source to mic-in */ | ||
| 3354 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 3355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 3356 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 3357 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
| 3358 | /* speaker-out */ | ||
| 3359 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3360 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3361 | /* HP-out */ | ||
| 3362 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3363 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3364 | /* mic-in to input */ | ||
| 3365 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3366 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3367 | /* built-in mic */ | ||
| 3368 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3370 | /* jack sense */ | ||
| 3371 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 3372 | { } | ||
| 3373 | }; | ||
| 3374 | |||
| 3375 | /* toggle speaker-output according to the hp-jack state */ | ||
| 3376 | static void alc880_lg_lw_setup(struct hda_codec *codec) | ||
| 3377 | { | ||
| 3378 | struct alc_spec *spec = codec->spec; | ||
| 3379 | |||
| 3380 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 3381 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 3382 | } | ||
| 3383 | |||
| 3384 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { | ||
| 3385 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 3386 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 3387 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 3388 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 3389 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 3390 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 3391 | { } /* end */ | ||
| 3392 | }; | ||
| 3393 | |||
| 3394 | static struct hda_input_mux alc880_medion_rim_capture_source = { | ||
| 3395 | .num_items = 2, | ||
| 3396 | .items = { | ||
| 3397 | { "Mic", 0x0 }, | ||
| 3398 | { "Internal Mic", 0x1 }, | ||
| 3399 | }, | ||
| 3400 | }; | ||
| 3401 | |||
| 3402 | static struct hda_verb alc880_medion_rim_init_verbs[] = { | ||
| 3403 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 3404 | |||
| 3405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3406 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3407 | |||
| 3408 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 3409 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 3410 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3411 | /* Mic2 (as headphone out) for HP output */ | ||
| 3412 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 3413 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 3414 | /* Internal Speaker */ | ||
| 3415 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 3416 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 3417 | |||
| 3418 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 3419 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
| 3420 | |||
| 3421 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 3422 | { } | ||
| 3423 | }; | ||
| 3424 | |||
| 3425 | /* toggle speaker-output according to the hp-jack state */ | ||
| 3426 | static void alc880_medion_rim_automute(struct hda_codec *codec) | ||
| 3427 | { | ||
| 3428 | struct alc_spec *spec = codec->spec; | ||
| 3429 | alc_automute_amp(codec); | ||
| 3430 | /* toggle EAPD */ | ||
| 3431 | if (spec->jack_present) | ||
| 3432 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); | ||
| 3433 | else | ||
| 3434 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); | ||
| 3435 | } | ||
| 3436 | |||
| 3437 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, | ||
| 3438 | unsigned int res) | ||
| 3439 | { | ||
| 3440 | /* Looks like the unsol event is incompatible with the standard | ||
| 3441 | * definition. 4bit tag is placed at 28 bit! | ||
| 3442 | */ | ||
| 3443 | if ((res >> 28) == ALC880_HP_EVENT) | ||
| 3444 | alc880_medion_rim_automute(codec); | ||
| 3445 | } | ||
| 3446 | |||
| 3447 | static void alc880_medion_rim_setup(struct hda_codec *codec) | ||
| 3448 | { | ||
| 3449 | struct alc_spec *spec = codec->spec; | ||
| 3450 | |||
| 3451 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 3452 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
| 3453 | } | ||
| 3454 | |||
| 3455 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3456 | static struct hda_amp_list alc880_loopbacks[] = { | ||
| 3457 | { 0x0b, HDA_INPUT, 0 }, | ||
| 3458 | { 0x0b, HDA_INPUT, 1 }, | ||
| 3459 | { 0x0b, HDA_INPUT, 2 }, | ||
| 3460 | { 0x0b, HDA_INPUT, 3 }, | ||
| 3461 | { 0x0b, HDA_INPUT, 4 }, | ||
| 3462 | { } /* end */ | ||
| 3463 | }; | ||
| 3464 | |||
| 3465 | static struct hda_amp_list alc880_lg_loopbacks[] = { | ||
| 3466 | { 0x0b, HDA_INPUT, 1 }, | ||
| 3467 | { 0x0b, HDA_INPUT, 6 }, | ||
| 3468 | { 0x0b, HDA_INPUT, 7 }, | ||
| 3469 | { } /* end */ | ||
| 3470 | }; | ||
| 3471 | #endif | ||
| 3472 | |||
| 3473 | /* | ||
| 3474 | * Common callbacks | ||
| 3475 | */ | ||
| 3476 | |||
| 3477 | static int alc_init(struct hda_codec *codec) | ||
| 3478 | { | ||
| 3479 | struct alc_spec *spec = codec->spec; | ||
| 3480 | unsigned int i; | ||
| 3481 | |||
| 3482 | alc_fix_pll(codec); | ||
| 3483 | alc_auto_init_amp(codec, spec->init_amp); | ||
| 3484 | |||
| 3485 | for (i = 0; i < spec->num_init_verbs; i++) | ||
| 3486 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | ||
| 3487 | |||
| 3488 | if (spec->init_hook) | ||
| 3489 | spec->init_hook(codec); | ||
| 3490 | |||
| 3491 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3492 | if (codec->patch_ops.check_power_status) | ||
| 3493 | codec->patch_ops.check_power_status(codec, 0x01); | ||
| 3494 | #endif | ||
| 3495 | return 0; | ||
| 3496 | } | ||
| 3497 | |||
| 3498 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 3499 | { | ||
| 3500 | struct alc_spec *spec = codec->spec; | ||
| 3501 | |||
| 3502 | if (spec->unsol_event) | ||
| 3503 | spec->unsol_event(codec, res); | ||
| 3504 | } | ||
| 3505 | |||
| 3506 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3507 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) | ||
| 3508 | { | ||
| 3509 | struct alc_spec *spec = codec->spec; | ||
| 3510 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); | ||
| 3511 | } | ||
| 3512 | #endif | ||
| 3513 | |||
| 3514 | /* | ||
| 3515 | * Analog playback callbacks | ||
| 3516 | */ | ||
| 3517 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
| 3518 | struct hda_codec *codec, | ||
| 3519 | struct snd_pcm_substream *substream) | ||
| 3520 | { | ||
| 3521 | struct alc_spec *spec = codec->spec; | ||
| 3522 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | ||
| 3523 | hinfo); | ||
| 3524 | } | ||
| 3525 | |||
| 3526 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
| 3527 | struct hda_codec *codec, | ||
| 3528 | unsigned int stream_tag, | ||
| 3529 | unsigned int format, | ||
| 3530 | struct snd_pcm_substream *substream) | ||
| 3531 | { | ||
| 3532 | struct alc_spec *spec = codec->spec; | ||
| 3533 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | ||
| 3534 | stream_tag, format, substream); | ||
| 3535 | } | ||
| 3536 | |||
| 3537 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
| 3538 | struct hda_codec *codec, | ||
| 3539 | struct snd_pcm_substream *substream) | ||
| 3540 | { | ||
| 3541 | struct alc_spec *spec = codec->spec; | ||
| 3542 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | ||
| 3543 | } | ||
| 3544 | |||
| 3545 | /* | ||
| 3546 | * Digital out | ||
| 3547 | */ | ||
| 3548 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
| 3549 | struct hda_codec *codec, | ||
| 3550 | struct snd_pcm_substream *substream) | ||
| 3551 | { | ||
| 3552 | struct alc_spec *spec = codec->spec; | ||
| 3553 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | ||
| 3554 | } | ||
| 3555 | |||
| 3556 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
| 3557 | struct hda_codec *codec, | ||
| 3558 | unsigned int stream_tag, | ||
| 3559 | unsigned int format, | ||
| 3560 | struct snd_pcm_substream *substream) | ||
| 3561 | { | ||
| 3562 | struct alc_spec *spec = codec->spec; | ||
| 3563 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, | ||
| 3564 | stream_tag, format, substream); | ||
| 3565 | } | ||
| 3566 | |||
| 3567 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
| 3568 | struct hda_codec *codec, | ||
| 3569 | struct snd_pcm_substream *substream) | ||
| 3570 | { | ||
| 3571 | struct alc_spec *spec = codec->spec; | ||
| 3572 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | ||
| 3573 | } | ||
| 3574 | |||
| 3575 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
| 3576 | struct hda_codec *codec, | ||
| 3577 | struct snd_pcm_substream *substream) | ||
| 3578 | { | ||
| 3579 | struct alc_spec *spec = codec->spec; | ||
| 3580 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | ||
| 3581 | } | ||
| 3582 | |||
| 3583 | /* | ||
| 3584 | * Analog capture | ||
| 3585 | */ | ||
| 3586 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
| 3587 | struct hda_codec *codec, | ||
| 3588 | unsigned int stream_tag, | ||
| 3589 | unsigned int format, | ||
| 3590 | struct snd_pcm_substream *substream) | ||
| 3591 | { | ||
| 3592 | struct alc_spec *spec = codec->spec; | ||
| 3593 | |||
| 3594 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], | ||
| 3595 | stream_tag, 0, format); | ||
| 3596 | return 0; | ||
| 3597 | } | ||
| 3598 | |||
| 3599 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
| 3600 | struct hda_codec *codec, | ||
| 3601 | struct snd_pcm_substream *substream) | ||
| 3602 | { | ||
| 3603 | struct alc_spec *spec = codec->spec; | ||
| 3604 | |||
| 3605 | snd_hda_codec_cleanup_stream(codec, | ||
| 3606 | spec->adc_nids[substream->number + 1]); | ||
| 3607 | return 0; | ||
| 3608 | } | ||
| 3609 | |||
| 3610 | |||
| 3611 | /* | ||
| 3612 | */ | ||
| 3613 | static struct hda_pcm_stream alc880_pcm_analog_playback = { | ||
| 3614 | .substreams = 1, | ||
| 3615 | .channels_min = 2, | ||
| 3616 | .channels_max = 8, | ||
| 3617 | /* NID is set in alc_build_pcms */ | ||
| 3618 | .ops = { | ||
| 3619 | .open = alc880_playback_pcm_open, | ||
| 3620 | .prepare = alc880_playback_pcm_prepare, | ||
| 3621 | .cleanup = alc880_playback_pcm_cleanup | ||
| 3622 | }, | ||
| 3623 | }; | ||
| 3624 | |||
| 3625 | static struct hda_pcm_stream alc880_pcm_analog_capture = { | ||
| 3626 | .substreams = 1, | ||
| 3627 | .channels_min = 2, | ||
| 3628 | .channels_max = 2, | ||
| 3629 | /* NID is set in alc_build_pcms */ | ||
| 3630 | }; | ||
| 3631 | |||
| 3632 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { | ||
| 3633 | .substreams = 1, | ||
| 3634 | .channels_min = 2, | ||
| 3635 | .channels_max = 2, | ||
| 3636 | /* NID is set in alc_build_pcms */ | ||
| 3637 | }; | ||
| 3638 | |||
| 3639 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { | ||
| 3640 | .substreams = 2, /* can be overridden */ | ||
| 3641 | .channels_min = 2, | ||
| 3642 | .channels_max = 2, | ||
| 3643 | /* NID is set in alc_build_pcms */ | ||
| 3644 | .ops = { | ||
| 3645 | .prepare = alc880_alt_capture_pcm_prepare, | ||
| 3646 | .cleanup = alc880_alt_capture_pcm_cleanup | ||
| 3647 | }, | ||
| 3648 | }; | ||
| 3649 | |||
| 3650 | static struct hda_pcm_stream alc880_pcm_digital_playback = { | ||
| 3651 | .substreams = 1, | ||
| 3652 | .channels_min = 2, | ||
| 3653 | .channels_max = 2, | ||
| 3654 | /* NID is set in alc_build_pcms */ | ||
| 3655 | .ops = { | ||
| 3656 | .open = alc880_dig_playback_pcm_open, | ||
| 3657 | .close = alc880_dig_playback_pcm_close, | ||
| 3658 | .prepare = alc880_dig_playback_pcm_prepare, | ||
| 3659 | .cleanup = alc880_dig_playback_pcm_cleanup | ||
| 3660 | }, | ||
| 3661 | }; | ||
| 3662 | |||
| 3663 | static struct hda_pcm_stream alc880_pcm_digital_capture = { | ||
| 3664 | .substreams = 1, | ||
| 3665 | .channels_min = 2, | ||
| 3666 | .channels_max = 2, | ||
| 3667 | /* NID is set in alc_build_pcms */ | ||
| 3668 | }; | ||
| 3669 | |||
| 3670 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ | ||
| 3671 | static struct hda_pcm_stream alc_pcm_null_stream = { | ||
| 3672 | .substreams = 0, | ||
| 3673 | .channels_min = 0, | ||
| 3674 | .channels_max = 0, | ||
| 3675 | }; | ||
| 3676 | |||
| 3677 | static int alc_build_pcms(struct hda_codec *codec) | ||
| 3678 | { | ||
| 3679 | struct alc_spec *spec = codec->spec; | ||
| 3680 | struct hda_pcm *info = spec->pcm_rec; | ||
| 3681 | int i; | ||
| 3682 | |||
| 3683 | codec->num_pcms = 1; | ||
| 3684 | codec->pcm_info = info; | ||
| 3685 | |||
| 3686 | if (spec->no_analog) | ||
| 3687 | goto skip_analog; | ||
| 3688 | |||
| 3689 | snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), | ||
| 3690 | "%s Analog", codec->chip_name); | ||
| 3691 | info->name = spec->stream_name_analog; | ||
| 3692 | |||
| 3693 | if (spec->stream_analog_playback) { | ||
| 3694 | if (snd_BUG_ON(!spec->multiout.dac_nids)) | ||
| 3695 | return -EINVAL; | ||
| 3696 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | ||
| 3697 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | ||
| 3698 | } | ||
| 3699 | if (spec->stream_analog_capture) { | ||
| 3700 | if (snd_BUG_ON(!spec->adc_nids)) | ||
| 3701 | return -EINVAL; | ||
| 3702 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | ||
| 3703 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | ||
| 3704 | } | ||
| 3705 | |||
| 3706 | if (spec->channel_mode) { | ||
| 3707 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; | ||
| 3708 | for (i = 0; i < spec->num_channel_mode; i++) { | ||
| 3709 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { | ||
| 3710 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; | ||
| 3711 | } | ||
| 3712 | } | ||
| 3713 | } | ||
| 3714 | |||
| 3715 | skip_analog: | ||
| 3716 | /* SPDIF for stream index #1 */ | ||
| 3717 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | ||
| 3718 | snprintf(spec->stream_name_digital, | ||
| 3719 | sizeof(spec->stream_name_digital), | ||
| 3720 | "%s Digital", codec->chip_name); | ||
| 3721 | codec->num_pcms = 2; | ||
| 3722 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | ||
| 3723 | info = spec->pcm_rec + 1; | ||
| 3724 | info->name = spec->stream_name_digital; | ||
| 3725 | if (spec->dig_out_type) | ||
| 3726 | info->pcm_type = spec->dig_out_type; | ||
| 3727 | else | ||
| 3728 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
| 3729 | if (spec->multiout.dig_out_nid && | ||
| 3730 | spec->stream_digital_playback) { | ||
| 3731 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | ||
| 3732 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | ||
| 3733 | } | ||
| 3734 | if (spec->dig_in_nid && | ||
| 3735 | spec->stream_digital_capture) { | ||
| 3736 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | ||
| 3737 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | ||
| 3738 | } | ||
| 3739 | /* FIXME: do we need this for all Realtek codec models? */ | ||
| 3740 | codec->spdif_status_reset = 1; | ||
| 3741 | } | ||
| 3742 | |||
| 3743 | if (spec->no_analog) | ||
| 3744 | return 0; | ||
| 3745 | |||
| 3746 | /* If the use of more than one ADC is requested for the current | ||
| 3747 | * model, configure a second analog capture-only PCM. | ||
| 3748 | */ | ||
| 3749 | /* Additional Analaog capture for index #2 */ | ||
| 3750 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || | ||
| 3751 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { | ||
| 3752 | codec->num_pcms = 3; | ||
| 3753 | info = spec->pcm_rec + 2; | ||
| 3754 | info->name = spec->stream_name_analog; | ||
| 3755 | if (spec->alt_dac_nid) { | ||
| 3756 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | ||
| 3757 | *spec->stream_analog_alt_playback; | ||
| 3758 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = | ||
| 3759 | spec->alt_dac_nid; | ||
| 3760 | } else { | ||
| 3761 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | ||
| 3762 | alc_pcm_null_stream; | ||
| 3763 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | ||
| 3764 | } | ||
| 3765 | if (spec->num_adc_nids > 1) { | ||
| 3766 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
| 3767 | *spec->stream_analog_alt_capture; | ||
| 3768 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = | ||
| 3769 | spec->adc_nids[1]; | ||
| 3770 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = | ||
| 3771 | spec->num_adc_nids - 1; | ||
| 3772 | } else { | ||
| 3773 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
| 3774 | alc_pcm_null_stream; | ||
| 3775 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; | ||
| 3776 | } | ||
| 3777 | } | ||
| 3778 | |||
| 3779 | return 0; | ||
| 3780 | } | ||
| 3781 | |||
| 3782 | static inline void alc_shutup(struct hda_codec *codec) | ||
| 3783 | { | ||
| 3784 | snd_hda_shutup_pins(codec); | ||
| 3785 | } | ||
| 3786 | |||
| 3787 | static void alc_free_kctls(struct hda_codec *codec) | ||
| 3788 | { | ||
| 3789 | struct alc_spec *spec = codec->spec; | ||
| 3790 | |||
| 3791 | if (spec->kctls.list) { | ||
| 3792 | struct snd_kcontrol_new *kctl = spec->kctls.list; | ||
| 3793 | int i; | ||
| 3794 | for (i = 0; i < spec->kctls.used; i++) | ||
| 3795 | kfree(kctl[i].name); | ||
| 3796 | } | ||
| 3797 | snd_array_free(&spec->kctls); | ||
| 3798 | } | ||
| 3799 | |||
| 3800 | static void alc_free(struct hda_codec *codec) | ||
| 3801 | { | ||
| 3802 | struct alc_spec *spec = codec->spec; | ||
| 3803 | |||
| 3804 | if (!spec) | ||
| 3805 | return; | ||
| 3806 | |||
| 3807 | alc_shutup(codec); | ||
| 3808 | alc_free_kctls(codec); | ||
| 3809 | kfree(spec); | ||
| 3810 | snd_hda_detach_beep_device(codec); | ||
| 3811 | } | ||
| 3812 | |||
| 3813 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3814 | static void alc_power_eapd(struct hda_codec *codec) | ||
| 3815 | { | ||
| 3816 | /* We currently only handle front, HP */ | ||
| 3817 | switch (codec->vendor_id) { | ||
| 3818 | case 0x10ec0260: | ||
| 3819 | set_eapd(codec, 0x0f, 0); | ||
| 3820 | set_eapd(codec, 0x10, 0); | ||
| 3821 | break; | ||
| 3822 | case 0x10ec0262: | ||
| 3823 | case 0x10ec0267: | ||
| 3824 | case 0x10ec0268: | ||
| 3825 | case 0x10ec0269: | ||
| 3826 | case 0x10ec0270: | ||
| 3827 | case 0x10ec0272: | ||
| 3828 | case 0x10ec0660: | ||
| 3829 | case 0x10ec0662: | ||
| 3830 | case 0x10ec0663: | ||
| 3831 | case 0x10ec0862: | ||
| 3832 | case 0x10ec0889: | ||
| 3833 | set_eapd(codec, 0x14, 0); | ||
| 3834 | set_eapd(codec, 0x15, 0); | ||
| 3835 | break; | ||
| 3836 | } | ||
| 3837 | } | ||
| 3838 | |||
| 3839 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | ||
| 3840 | { | ||
| 3841 | struct alc_spec *spec = codec->spec; | ||
| 3842 | alc_shutup(codec); | ||
| 3843 | if (spec && spec->power_hook) | ||
| 3844 | spec->power_hook(codec); | ||
| 3845 | return 0; | ||
| 3846 | } | ||
| 3847 | #endif | ||
| 3848 | |||
| 3849 | #ifdef SND_HDA_NEEDS_RESUME | ||
| 3850 | static int alc_resume(struct hda_codec *codec) | ||
| 3851 | { | ||
| 3852 | codec->patch_ops.init(codec); | ||
| 3853 | snd_hda_codec_resume_amp(codec); | ||
| 3854 | snd_hda_codec_resume_cache(codec); | ||
| 3855 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3856 | if (codec->patch_ops.check_power_status) | ||
| 3857 | codec->patch_ops.check_power_status(codec, 0x01); | ||
| 3858 | #endif | ||
| 3859 | return 0; | ||
| 3860 | } | ||
| 3861 | #endif | ||
| 3862 | |||
| 3863 | /* | ||
| 3864 | */ | ||
| 3865 | static struct hda_codec_ops alc_patch_ops = { | ||
| 3866 | .build_controls = alc_build_controls, | ||
| 3867 | .build_pcms = alc_build_pcms, | ||
| 3868 | .init = alc_init, | ||
| 3869 | .free = alc_free, | ||
| 3870 | .unsol_event = alc_unsol_event, | ||
| 3871 | #ifdef SND_HDA_NEEDS_RESUME | ||
| 3872 | .resume = alc_resume, | ||
| 3873 | #endif | ||
| 3874 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 3875 | .suspend = alc_suspend, | ||
| 3876 | .check_power_status = alc_check_power_status, | ||
| 3877 | #endif | ||
| 3878 | .reboot_notify = alc_shutup, | ||
| 3879 | }; | ||
| 3880 | |||
| 3881 | /* replace the codec chip_name with the given string */ | ||
| 3882 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | ||
| 3883 | { | ||
| 3884 | kfree(codec->chip_name); | ||
| 3885 | codec->chip_name = kstrdup(name, GFP_KERNEL); | ||
| 3886 | if (!codec->chip_name) { | ||
| 3887 | alc_free(codec); | ||
| 3888 | return -ENOMEM; | ||
| 3889 | } | ||
| 3890 | return 0; | ||
| 3891 | } | ||
| 3892 | |||
| 3893 | /* | ||
| 3894 | * Test configuration for debugging | ||
| 3895 | * | ||
| 3896 | * Almost all inputs/outputs are enabled. I/O pins can be configured via | ||
| 3897 | * enum controls. | ||
| 3898 | */ | ||
| 3899 | #ifdef CONFIG_SND_DEBUG | ||
| 3900 | static hda_nid_t alc880_test_dac_nids[4] = { | ||
| 3901 | 0x02, 0x03, 0x04, 0x05 | ||
| 3902 | }; | ||
| 3903 | |||
| 3904 | static struct hda_input_mux alc880_test_capture_source = { | ||
| 3905 | .num_items = 7, | ||
| 3906 | .items = { | ||
| 3907 | { "In-1", 0x0 }, | ||
| 3908 | { "In-2", 0x1 }, | ||
| 3909 | { "In-3", 0x2 }, | ||
| 3910 | { "In-4", 0x3 }, | ||
| 3911 | { "CD", 0x4 }, | ||
| 3912 | { "Front", 0x5 }, | ||
| 3913 | { "Surround", 0x6 }, | ||
| 3914 | }, | ||
| 3915 | }; | ||
| 3916 | |||
| 3917 | static struct hda_channel_mode alc880_test_modes[4] = { | ||
| 3918 | { 2, NULL }, | ||
| 3919 | { 4, NULL }, | ||
| 3920 | { 6, NULL }, | ||
| 3921 | { 8, NULL }, | ||
| 3922 | }; | ||
| 3923 | |||
| 3924 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, | ||
| 3925 | struct snd_ctl_elem_info *uinfo) | ||
| 3926 | { | ||
| 3927 | static char *texts[] = { | ||
| 3928 | "N/A", "Line Out", "HP Out", | ||
| 3929 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" | ||
| 3930 | }; | ||
| 3931 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
| 3932 | uinfo->count = 1; | ||
| 3933 | uinfo->value.enumerated.items = 8; | ||
| 3934 | if (uinfo->value.enumerated.item >= 8) | ||
| 3935 | uinfo->value.enumerated.item = 7; | ||
| 3936 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
| 3937 | return 0; | ||
| 3938 | } | ||
| 3939 | |||
| 3940 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, | ||
| 3941 | struct snd_ctl_elem_value *ucontrol) | ||
| 3942 | { | ||
| 3943 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 3944 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | ||
| 3945 | unsigned int pin_ctl, item = 0; | ||
| 3946 | |||
| 3947 | pin_ctl = snd_hda_codec_read(codec, nid, 0, | ||
| 3948 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
| 3949 | if (pin_ctl & AC_PINCTL_OUT_EN) { | ||
| 3950 | if (pin_ctl & AC_PINCTL_HP_EN) | ||
| 3951 | item = 2; | ||
| 3952 | else | ||
| 3953 | item = 1; | ||
| 3954 | } else if (pin_ctl & AC_PINCTL_IN_EN) { | ||
| 3955 | switch (pin_ctl & AC_PINCTL_VREFEN) { | ||
| 3956 | case AC_PINCTL_VREF_HIZ: item = 3; break; | ||
| 3957 | case AC_PINCTL_VREF_50: item = 4; break; | ||
| 3958 | case AC_PINCTL_VREF_GRD: item = 5; break; | ||
| 3959 | case AC_PINCTL_VREF_80: item = 6; break; | ||
| 3960 | case AC_PINCTL_VREF_100: item = 7; break; | ||
| 3961 | } | ||
| 3962 | } | ||
| 3963 | ucontrol->value.enumerated.item[0] = item; | ||
| 3964 | return 0; | ||
| 3965 | } | ||
| 3966 | |||
| 3967 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, | ||
| 3968 | struct snd_ctl_elem_value *ucontrol) | ||
| 3969 | { | ||
| 3970 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 3971 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | ||
| 3972 | static unsigned int ctls[] = { | ||
| 3973 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, | ||
| 3974 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, | ||
| 3975 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, | ||
| 3976 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, | ||
| 3977 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, | ||
| 3978 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, | ||
| 3979 | }; | ||
| 3980 | unsigned int old_ctl, new_ctl; | ||
| 3981 | |||
| 3982 | old_ctl = snd_hda_codec_read(codec, nid, 0, | ||
| 3983 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
| 3984 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; | ||
| 3985 | if (old_ctl != new_ctl) { | ||
| 3986 | int val; | ||
| 3987 | snd_hda_codec_write_cache(codec, nid, 0, | ||
| 3988 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 3989 | new_ctl); | ||
| 3990 | val = ucontrol->value.enumerated.item[0] >= 3 ? | ||
| 3991 | HDA_AMP_MUTE : 0; | ||
| 3992 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, | ||
| 3993 | HDA_AMP_MUTE, val); | ||
| 3994 | return 1; | ||
| 3995 | } | ||
| 3996 | return 0; | ||
| 3997 | } | ||
| 3998 | |||
| 3999 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, | ||
| 4000 | struct snd_ctl_elem_info *uinfo) | ||
| 4001 | { | ||
| 4002 | static char *texts[] = { | ||
| 4003 | "Front", "Surround", "CLFE", "Side" | ||
| 4004 | }; | ||
| 4005 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
| 4006 | uinfo->count = 1; | ||
| 4007 | uinfo->value.enumerated.items = 4; | ||
| 4008 | if (uinfo->value.enumerated.item >= 4) | ||
| 4009 | uinfo->value.enumerated.item = 3; | ||
| 4010 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
| 4011 | return 0; | ||
| 4012 | } | ||
| 4013 | |||
| 4014 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, | ||
| 4015 | struct snd_ctl_elem_value *ucontrol) | ||
| 4016 | { | ||
| 4017 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 4018 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | ||
| 4019 | unsigned int sel; | ||
| 4020 | |||
| 4021 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); | ||
| 4022 | ucontrol->value.enumerated.item[0] = sel & 3; | ||
| 4023 | return 0; | ||
| 4024 | } | ||
| 4025 | |||
| 4026 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, | ||
| 4027 | struct snd_ctl_elem_value *ucontrol) | ||
| 4028 | { | ||
| 4029 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 4030 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; | ||
| 4031 | unsigned int sel; | ||
| 4032 | |||
| 4033 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; | ||
| 4034 | if (ucontrol->value.enumerated.item[0] != sel) { | ||
| 4035 | sel = ucontrol->value.enumerated.item[0] & 3; | ||
| 4036 | snd_hda_codec_write_cache(codec, nid, 0, | ||
| 4037 | AC_VERB_SET_CONNECT_SEL, sel); | ||
| 4038 | return 1; | ||
| 4039 | } | ||
| 4040 | return 0; | ||
| 4041 | } | ||
| 4042 | |||
| 4043 | #define PIN_CTL_TEST(xname,nid) { \ | ||
| 4044 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 4045 | .name = xname, \ | ||
| 4046 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 4047 | .info = alc_test_pin_ctl_info, \ | ||
| 4048 | .get = alc_test_pin_ctl_get, \ | ||
| 4049 | .put = alc_test_pin_ctl_put, \ | ||
| 4050 | .private_value = nid \ | ||
| 4051 | } | ||
| 4052 | |||
| 4053 | #define PIN_SRC_TEST(xname,nid) { \ | ||
| 4054 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 4055 | .name = xname, \ | ||
| 4056 | .subdevice = HDA_SUBDEV_NID_FLAG | nid, \ | ||
| 4057 | .info = alc_test_pin_src_info, \ | ||
| 4058 | .get = alc_test_pin_src_get, \ | ||
| 4059 | .put = alc_test_pin_src_put, \ | ||
| 4060 | .private_value = nid \ | ||
| 4061 | } | ||
| 4062 | |||
| 4063 | static struct snd_kcontrol_new alc880_test_mixer[] = { | ||
| 4064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 4065 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 4066 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
| 4067 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 4068 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 4069 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 4070 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), | ||
| 4071 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 4072 | PIN_CTL_TEST("Front Pin Mode", 0x14), | ||
| 4073 | PIN_CTL_TEST("Surround Pin Mode", 0x15), | ||
| 4074 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), | ||
| 4075 | PIN_CTL_TEST("Side Pin Mode", 0x17), | ||
| 4076 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), | ||
| 4077 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), | ||
| 4078 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), | ||
| 4079 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), | ||
| 4080 | PIN_SRC_TEST("In-1 Pin Source", 0x18), | ||
| 4081 | PIN_SRC_TEST("In-2 Pin Source", 0x19), | ||
| 4082 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), | ||
| 4083 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), | ||
| 4084 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 4085 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 4086 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 4087 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 4088 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), | ||
| 4089 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), | ||
| 4090 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
| 4091 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
| 4092 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), | ||
| 4093 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), | ||
| 4094 | { | ||
| 4095 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 4096 | .name = "Channel Mode", | ||
| 4097 | .info = alc_ch_mode_info, | ||
| 4098 | .get = alc_ch_mode_get, | ||
| 4099 | .put = alc_ch_mode_put, | ||
| 4100 | }, | ||
| 4101 | { } /* end */ | ||
| 4102 | }; | ||
| 4103 | |||
| 4104 | static struct hda_verb alc880_test_init_verbs[] = { | ||
| 4105 | /* Unmute inputs of 0x0c - 0x0f */ | ||
| 4106 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 4107 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 4108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 4109 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 4110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 4111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 4112 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 4113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 4114 | /* Vol output for 0x0c-0x0f */ | ||
| 4115 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 4116 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 4117 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 4118 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 4119 | /* Set output pins 0x14-0x17 */ | ||
| 4120 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 4121 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 4122 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 4123 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 4124 | /* Unmute output pins 0x14-0x17 */ | ||
| 4125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 4126 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 4127 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 4128 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 4129 | /* Set input pins 0x18-0x1c */ | ||
| 4130 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 4131 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 4132 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 4133 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 4134 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 4135 | /* Mute input pins 0x18-0x1b */ | ||
| 4136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 4137 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 4138 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 4139 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 4140 | /* ADC set up */ | ||
| 4141 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 4142 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 4143 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 4144 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 4145 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 4146 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 4147 | /* Analog input/passthru */ | ||
| 4148 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 4149 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 4150 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 4151 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 4152 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 4153 | { } | ||
| 4154 | }; | ||
| 4155 | #endif | ||
| 4156 | |||
| 4157 | /* | ||
| 4158 | */ | ||
| 4159 | |||
| 4160 | static const char *alc880_models[ALC880_MODEL_LAST] = { | ||
| 4161 | [ALC880_3ST] = "3stack", | ||
| 4162 | [ALC880_TCL_S700] = "tcl", | ||
| 4163 | [ALC880_3ST_DIG] = "3stack-digout", | ||
| 4164 | [ALC880_CLEVO] = "clevo", | ||
| 4165 | [ALC880_5ST] = "5stack", | ||
| 4166 | [ALC880_5ST_DIG] = "5stack-digout", | ||
| 4167 | [ALC880_W810] = "w810", | ||
| 4168 | [ALC880_Z71V] = "z71v", | ||
| 4169 | [ALC880_6ST] = "6stack", | ||
| 4170 | [ALC880_6ST_DIG] = "6stack-digout", | ||
| 4171 | [ALC880_ASUS] = "asus", | ||
| 4172 | [ALC880_ASUS_W1V] = "asus-w1v", | ||
| 4173 | [ALC880_ASUS_DIG] = "asus-dig", | ||
| 4174 | [ALC880_ASUS_DIG2] = "asus-dig2", | ||
| 4175 | [ALC880_UNIWILL_DIG] = "uniwill", | ||
| 4176 | [ALC880_UNIWILL_P53] = "uniwill-p53", | ||
| 4177 | [ALC880_FUJITSU] = "fujitsu", | ||
| 4178 | [ALC880_F1734] = "F1734", | ||
| 4179 | [ALC880_LG] = "lg", | ||
| 4180 | [ALC880_LG_LW] = "lg-lw", | ||
| 4181 | [ALC880_MEDION_RIM] = "medion", | ||
| 4182 | #ifdef CONFIG_SND_DEBUG | ||
| 4183 | [ALC880_TEST] = "test", | ||
| 4184 | #endif | ||
| 4185 | [ALC880_AUTO] = "auto", | ||
| 4186 | }; | ||
| 4187 | |||
| 4188 | static struct snd_pci_quirk alc880_cfg_tbl[] = { | ||
| 4189 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), | ||
| 4190 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), | ||
| 4191 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), | ||
| 4192 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), | ||
| 4193 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), | ||
| 4194 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), | ||
| 4195 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), | ||
| 4196 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), | ||
| 4197 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), | ||
| 4198 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), | ||
| 4199 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), | ||
| 4200 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), | ||
| 4201 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), | ||
| 4202 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), | ||
| 4203 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), | ||
| 4204 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), | ||
| 4205 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), | ||
| 4206 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), | ||
| 4207 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ | ||
| 4208 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), | ||
| 4209 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), | ||
| 4210 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), | ||
| 4211 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | ||
| 4212 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | ||
| 4213 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | ||
| 4214 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ | ||
| 4215 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | ||
| 4216 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | ||
| 4217 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | ||
| 4218 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), | ||
| 4219 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), | ||
| 4220 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), | ||
| 4221 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), | ||
| 4222 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), | ||
| 4223 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), | ||
| 4224 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), | ||
| 4225 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), | ||
| 4226 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), | ||
| 4227 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), | ||
| 4228 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), | ||
| 4229 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), | ||
| 4230 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), | ||
| 4231 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), | ||
| 4232 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), | ||
| 4233 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), | ||
| 4234 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), | ||
| 4235 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), | ||
| 4236 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), | ||
| 4237 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), | ||
| 4238 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), | ||
| 4239 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), | ||
| 4240 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), | ||
| 4241 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), | ||
| 4242 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), | ||
| 4243 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), | ||
| 4244 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), | ||
| 4245 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ | ||
| 4246 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), | ||
| 4247 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), | ||
| 4248 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), | ||
| 4249 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), | ||
| 4250 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), | ||
| 4251 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), | ||
| 4252 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), | ||
| 4253 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), | ||
| 4254 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | ||
| 4255 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | ||
| 4256 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | ||
| 4257 | /* default Intel */ | ||
| 4258 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | ||
| 4259 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | ||
| 4260 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | ||
| 4261 | {} | ||
| 4262 | }; | ||
| 4263 | |||
| 4264 | /* | ||
| 4265 | * ALC880 codec presets | ||
| 4266 | */ | ||
| 4267 | static struct alc_config_preset alc880_presets[] = { | ||
| 4268 | [ALC880_3ST] = { | ||
| 4269 | .mixers = { alc880_three_stack_mixer }, | ||
| 4270 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4271 | alc880_pin_3stack_init_verbs }, | ||
| 4272 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4273 | .dac_nids = alc880_dac_nids, | ||
| 4274 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 4275 | .channel_mode = alc880_threestack_modes, | ||
| 4276 | .need_dac_fix = 1, | ||
| 4277 | .input_mux = &alc880_capture_source, | ||
| 4278 | }, | ||
| 4279 | [ALC880_3ST_DIG] = { | ||
| 4280 | .mixers = { alc880_three_stack_mixer }, | ||
| 4281 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4282 | alc880_pin_3stack_init_verbs }, | ||
| 4283 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4284 | .dac_nids = alc880_dac_nids, | ||
| 4285 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4286 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 4287 | .channel_mode = alc880_threestack_modes, | ||
| 4288 | .need_dac_fix = 1, | ||
| 4289 | .input_mux = &alc880_capture_source, | ||
| 4290 | }, | ||
| 4291 | [ALC880_TCL_S700] = { | ||
| 4292 | .mixers = { alc880_tcl_s700_mixer }, | ||
| 4293 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4294 | alc880_pin_tcl_S700_init_verbs, | ||
| 4295 | alc880_gpio2_init_verbs }, | ||
| 4296 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4297 | .dac_nids = alc880_dac_nids, | ||
| 4298 | .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */ | ||
| 4299 | .num_adc_nids = 1, /* single ADC */ | ||
| 4300 | .hp_nid = 0x03, | ||
| 4301 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
| 4302 | .channel_mode = alc880_2_jack_modes, | ||
| 4303 | .input_mux = &alc880_capture_source, | ||
| 4304 | }, | ||
| 4305 | [ALC880_5ST] = { | ||
| 4306 | .mixers = { alc880_three_stack_mixer, | ||
| 4307 | alc880_five_stack_mixer}, | ||
| 4308 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4309 | alc880_pin_5stack_init_verbs }, | ||
| 4310 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4311 | .dac_nids = alc880_dac_nids, | ||
| 4312 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | ||
| 4313 | .channel_mode = alc880_fivestack_modes, | ||
| 4314 | .input_mux = &alc880_capture_source, | ||
| 4315 | }, | ||
| 4316 | [ALC880_5ST_DIG] = { | ||
| 4317 | .mixers = { alc880_three_stack_mixer, | ||
| 4318 | alc880_five_stack_mixer }, | ||
| 4319 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4320 | alc880_pin_5stack_init_verbs }, | ||
| 4321 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4322 | .dac_nids = alc880_dac_nids, | ||
| 4323 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4324 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), | ||
| 4325 | .channel_mode = alc880_fivestack_modes, | ||
| 4326 | .input_mux = &alc880_capture_source, | ||
| 4327 | }, | ||
| 4328 | [ALC880_6ST] = { | ||
| 4329 | .mixers = { alc880_six_stack_mixer }, | ||
| 4330 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4331 | alc880_pin_6stack_init_verbs }, | ||
| 4332 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | ||
| 4333 | .dac_nids = alc880_6st_dac_nids, | ||
| 4334 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | ||
| 4335 | .channel_mode = alc880_sixstack_modes, | ||
| 4336 | .input_mux = &alc880_6stack_capture_source, | ||
| 4337 | }, | ||
| 4338 | [ALC880_6ST_DIG] = { | ||
| 4339 | .mixers = { alc880_six_stack_mixer }, | ||
| 4340 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4341 | alc880_pin_6stack_init_verbs }, | ||
| 4342 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), | ||
| 4343 | .dac_nids = alc880_6st_dac_nids, | ||
| 4344 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4345 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), | ||
| 4346 | .channel_mode = alc880_sixstack_modes, | ||
| 4347 | .input_mux = &alc880_6stack_capture_source, | ||
| 4348 | }, | ||
| 4349 | [ALC880_W810] = { | ||
| 4350 | .mixers = { alc880_w810_base_mixer }, | ||
| 4351 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4352 | alc880_pin_w810_init_verbs, | ||
| 4353 | alc880_gpio2_init_verbs }, | ||
| 4354 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), | ||
| 4355 | .dac_nids = alc880_w810_dac_nids, | ||
| 4356 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4357 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | ||
| 4358 | .channel_mode = alc880_w810_modes, | ||
| 4359 | .input_mux = &alc880_capture_source, | ||
| 4360 | }, | ||
| 4361 | [ALC880_Z71V] = { | ||
| 4362 | .mixers = { alc880_z71v_mixer }, | ||
| 4363 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4364 | alc880_pin_z71v_init_verbs }, | ||
| 4365 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), | ||
| 4366 | .dac_nids = alc880_z71v_dac_nids, | ||
| 4367 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4368 | .hp_nid = 0x03, | ||
| 4369 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
| 4370 | .channel_mode = alc880_2_jack_modes, | ||
| 4371 | .input_mux = &alc880_capture_source, | ||
| 4372 | }, | ||
| 4373 | [ALC880_F1734] = { | ||
| 4374 | .mixers = { alc880_f1734_mixer }, | ||
| 4375 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4376 | alc880_pin_f1734_init_verbs }, | ||
| 4377 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), | ||
| 4378 | .dac_nids = alc880_f1734_dac_nids, | ||
| 4379 | .hp_nid = 0x02, | ||
| 4380 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
| 4381 | .channel_mode = alc880_2_jack_modes, | ||
| 4382 | .input_mux = &alc880_f1734_capture_source, | ||
| 4383 | .unsol_event = alc880_uniwill_p53_unsol_event, | ||
| 4384 | .setup = alc880_uniwill_p53_setup, | ||
| 4385 | .init_hook = alc_automute_amp, | ||
| 4386 | }, | ||
| 4387 | [ALC880_ASUS] = { | ||
| 4388 | .mixers = { alc880_asus_mixer }, | ||
| 4389 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4390 | alc880_pin_asus_init_verbs, | ||
| 4391 | alc880_gpio1_init_verbs }, | ||
| 4392 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4393 | .dac_nids = alc880_asus_dac_nids, | ||
| 4394 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | ||
| 4395 | .channel_mode = alc880_asus_modes, | ||
| 4396 | .need_dac_fix = 1, | ||
| 4397 | .input_mux = &alc880_capture_source, | ||
| 4398 | }, | ||
| 4399 | [ALC880_ASUS_DIG] = { | ||
| 4400 | .mixers = { alc880_asus_mixer }, | ||
| 4401 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4402 | alc880_pin_asus_init_verbs, | ||
| 4403 | alc880_gpio1_init_verbs }, | ||
| 4404 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4405 | .dac_nids = alc880_asus_dac_nids, | ||
| 4406 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4407 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | ||
| 4408 | .channel_mode = alc880_asus_modes, | ||
| 4409 | .need_dac_fix = 1, | ||
| 4410 | .input_mux = &alc880_capture_source, | ||
| 4411 | }, | ||
| 4412 | [ALC880_ASUS_DIG2] = { | ||
| 4413 | .mixers = { alc880_asus_mixer }, | ||
| 4414 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4415 | alc880_pin_asus_init_verbs, | ||
| 4416 | alc880_gpio2_init_verbs }, /* use GPIO2 */ | ||
| 4417 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4418 | .dac_nids = alc880_asus_dac_nids, | ||
| 4419 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4420 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | ||
| 4421 | .channel_mode = alc880_asus_modes, | ||
| 4422 | .need_dac_fix = 1, | ||
| 4423 | .input_mux = &alc880_capture_source, | ||
| 4424 | }, | ||
| 4425 | [ALC880_ASUS_W1V] = { | ||
| 4426 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, | ||
| 4427 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4428 | alc880_pin_asus_init_verbs, | ||
| 4429 | alc880_gpio1_init_verbs }, | ||
| 4430 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4431 | .dac_nids = alc880_asus_dac_nids, | ||
| 4432 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4433 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | ||
| 4434 | .channel_mode = alc880_asus_modes, | ||
| 4435 | .need_dac_fix = 1, | ||
| 4436 | .input_mux = &alc880_capture_source, | ||
| 4437 | }, | ||
| 4438 | [ALC880_UNIWILL_DIG] = { | ||
| 4439 | .mixers = { alc880_asus_mixer }, | ||
| 4440 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4441 | alc880_pin_asus_init_verbs }, | ||
| 4442 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4443 | .dac_nids = alc880_asus_dac_nids, | ||
| 4444 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4445 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), | ||
| 4446 | .channel_mode = alc880_asus_modes, | ||
| 4447 | .need_dac_fix = 1, | ||
| 4448 | .input_mux = &alc880_capture_source, | ||
| 4449 | }, | ||
| 4450 | [ALC880_UNIWILL] = { | ||
| 4451 | .mixers = { alc880_uniwill_mixer }, | ||
| 4452 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4453 | alc880_uniwill_init_verbs }, | ||
| 4454 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4455 | .dac_nids = alc880_asus_dac_nids, | ||
| 4456 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4457 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 4458 | .channel_mode = alc880_threestack_modes, | ||
| 4459 | .need_dac_fix = 1, | ||
| 4460 | .input_mux = &alc880_capture_source, | ||
| 4461 | .unsol_event = alc880_uniwill_unsol_event, | ||
| 4462 | .setup = alc880_uniwill_setup, | ||
| 4463 | .init_hook = alc880_uniwill_init_hook, | ||
| 4464 | }, | ||
| 4465 | [ALC880_UNIWILL_P53] = { | ||
| 4466 | .mixers = { alc880_uniwill_p53_mixer }, | ||
| 4467 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4468 | alc880_uniwill_p53_init_verbs }, | ||
| 4469 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | ||
| 4470 | .dac_nids = alc880_asus_dac_nids, | ||
| 4471 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), | ||
| 4472 | .channel_mode = alc880_threestack_modes, | ||
| 4473 | .input_mux = &alc880_capture_source, | ||
| 4474 | .unsol_event = alc880_uniwill_p53_unsol_event, | ||
| 4475 | .setup = alc880_uniwill_p53_setup, | ||
| 4476 | .init_hook = alc_automute_amp, | ||
| 4477 | }, | ||
| 4478 | [ALC880_FUJITSU] = { | ||
| 4479 | .mixers = { alc880_fujitsu_mixer }, | ||
| 4480 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4481 | alc880_uniwill_p53_init_verbs, | ||
| 4482 | alc880_beep_init_verbs }, | ||
| 4483 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4484 | .dac_nids = alc880_dac_nids, | ||
| 4485 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4486 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
| 4487 | .channel_mode = alc880_2_jack_modes, | ||
| 4488 | .input_mux = &alc880_capture_source, | ||
| 4489 | .unsol_event = alc880_uniwill_p53_unsol_event, | ||
| 4490 | .setup = alc880_uniwill_p53_setup, | ||
| 4491 | .init_hook = alc_automute_amp, | ||
| 4492 | }, | ||
| 4493 | [ALC880_CLEVO] = { | ||
| 4494 | .mixers = { alc880_three_stack_mixer }, | ||
| 4495 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4496 | alc880_pin_clevo_init_verbs }, | ||
| 4497 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4498 | .dac_nids = alc880_dac_nids, | ||
| 4499 | .hp_nid = 0x03, | ||
| 4500 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 4501 | .channel_mode = alc880_threestack_modes, | ||
| 4502 | .need_dac_fix = 1, | ||
| 4503 | .input_mux = &alc880_capture_source, | ||
| 4504 | }, | ||
| 4505 | [ALC880_LG] = { | ||
| 4506 | .mixers = { alc880_lg_mixer }, | ||
| 4507 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4508 | alc880_lg_init_verbs }, | ||
| 4509 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), | ||
| 4510 | .dac_nids = alc880_lg_dac_nids, | ||
| 4511 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4512 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), | ||
| 4513 | .channel_mode = alc880_lg_ch_modes, | ||
| 4514 | .need_dac_fix = 1, | ||
| 4515 | .input_mux = &alc880_lg_capture_source, | ||
| 4516 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 4517 | .setup = alc880_lg_setup, | ||
| 4518 | .init_hook = alc_automute_amp, | ||
| 4519 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 4520 | .loopbacks = alc880_lg_loopbacks, | ||
| 4521 | #endif | ||
| 4522 | }, | ||
| 4523 | [ALC880_LG_LW] = { | ||
| 4524 | .mixers = { alc880_lg_lw_mixer }, | ||
| 4525 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4526 | alc880_lg_lw_init_verbs }, | ||
| 4527 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4528 | .dac_nids = alc880_dac_nids, | ||
| 4529 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4530 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), | ||
| 4531 | .channel_mode = alc880_lg_lw_modes, | ||
| 4532 | .input_mux = &alc880_lg_lw_capture_source, | ||
| 4533 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 4534 | .setup = alc880_lg_lw_setup, | ||
| 4535 | .init_hook = alc_automute_amp, | ||
| 4536 | }, | ||
| 4537 | [ALC880_MEDION_RIM] = { | ||
| 4538 | .mixers = { alc880_medion_rim_mixer }, | ||
| 4539 | .init_verbs = { alc880_volume_init_verbs, | ||
| 4540 | alc880_medion_rim_init_verbs, | ||
| 4541 | alc_gpio2_init_verbs }, | ||
| 4542 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), | ||
| 4543 | .dac_nids = alc880_dac_nids, | ||
| 4544 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4545 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), | ||
| 4546 | .channel_mode = alc880_2_jack_modes, | ||
| 4547 | .input_mux = &alc880_medion_rim_capture_source, | ||
| 4548 | .unsol_event = alc880_medion_rim_unsol_event, | ||
| 4549 | .setup = alc880_medion_rim_setup, | ||
| 4550 | .init_hook = alc880_medion_rim_automute, | ||
| 4551 | }, | ||
| 4552 | #ifdef CONFIG_SND_DEBUG | ||
| 4553 | [ALC880_TEST] = { | ||
| 4554 | .mixers = { alc880_test_mixer }, | ||
| 4555 | .init_verbs = { alc880_test_init_verbs }, | ||
| 4556 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), | ||
| 4557 | .dac_nids = alc880_test_dac_nids, | ||
| 4558 | .dig_out_nid = ALC880_DIGOUT_NID, | ||
| 4559 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), | ||
| 4560 | .channel_mode = alc880_test_modes, | ||
| 4561 | .input_mux = &alc880_test_capture_source, | ||
| 4562 | }, | ||
| 4563 | #endif | ||
| 4564 | }; | ||
| 4565 | |||
| 4566 | /* | ||
| 4567 | * Automatic parse of I/O pins from the BIOS configuration | ||
| 4568 | */ | ||
| 4569 | |||
| 4570 | enum { | ||
| 4571 | ALC_CTL_WIDGET_VOL, | ||
| 4572 | ALC_CTL_WIDGET_MUTE, | ||
| 4573 | ALC_CTL_BIND_MUTE, | ||
| 4574 | }; | ||
| 4575 | static struct snd_kcontrol_new alc880_control_templates[] = { | ||
| 4576 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | ||
| 4577 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | ||
| 4578 | HDA_BIND_MUTE(NULL, 0, 0, 0), | ||
| 4579 | }; | ||
| 4580 | |||
| 4581 | /* add dynamic controls */ | ||
| 4582 | static int add_control(struct alc_spec *spec, int type, const char *name, | ||
| 4583 | unsigned long val) | ||
| 4584 | { | ||
| 4585 | struct snd_kcontrol_new *knew; | ||
| 4586 | |||
| 4587 | snd_array_init(&spec->kctls, sizeof(*knew), 32); | ||
| 4588 | knew = snd_array_new(&spec->kctls); | ||
| 4589 | if (!knew) | ||
| 4590 | return -ENOMEM; | ||
| 4591 | *knew = alc880_control_templates[type]; | ||
| 4592 | knew->name = kstrdup(name, GFP_KERNEL); | ||
| 4593 | if (!knew->name) | ||
| 4594 | return -ENOMEM; | ||
| 4595 | if (get_amp_nid_(val)) | ||
| 4596 | knew->subdevice = HDA_SUBDEV_AMP_FLAG; | ||
| 4597 | knew->private_value = val; | ||
| 4598 | return 0; | ||
| 4599 | } | ||
| 4600 | |||
| 4601 | static int add_control_with_pfx(struct alc_spec *spec, int type, | ||
| 4602 | const char *pfx, const char *dir, | ||
| 4603 | const char *sfx, unsigned long val) | ||
| 4604 | { | ||
| 4605 | char name[32]; | ||
| 4606 | snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx); | ||
| 4607 | return add_control(spec, type, name, val); | ||
| 4608 | } | ||
| 4609 | |||
| 4610 | #define add_pb_vol_ctrl(spec, type, pfx, val) \ | ||
| 4611 | add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val) | ||
| 4612 | #define add_pb_sw_ctrl(spec, type, pfx, val) \ | ||
| 4613 | add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val) | ||
| 4614 | |||
| 4615 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) | ||
| 4616 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) | ||
| 4617 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) | ||
| 4618 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) | ||
| 4619 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) | ||
| 4620 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) | ||
| 4621 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) | ||
| 4622 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) | ||
| 4623 | #define ALC880_PIN_CD_NID 0x1c | ||
| 4624 | |||
| 4625 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
| 4626 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, | ||
| 4627 | const struct auto_pin_cfg *cfg) | ||
| 4628 | { | ||
| 4629 | hda_nid_t nid; | ||
| 4630 | int assigned[4]; | ||
| 4631 | int i, j; | ||
| 4632 | |||
| 4633 | memset(assigned, 0, sizeof(assigned)); | ||
| 4634 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 4635 | |||
| 4636 | /* check the pins hardwired to audio widget */ | ||
| 4637 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 4638 | nid = cfg->line_out_pins[i]; | ||
| 4639 | if (alc880_is_fixed_pin(nid)) { | ||
| 4640 | int idx = alc880_fixed_pin_idx(nid); | ||
| 4641 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); | ||
| 4642 | assigned[idx] = 1; | ||
| 4643 | } | ||
| 4644 | } | ||
| 4645 | /* left pins can be connect to any audio widget */ | ||
| 4646 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 4647 | nid = cfg->line_out_pins[i]; | ||
| 4648 | if (alc880_is_fixed_pin(nid)) | ||
| 4649 | continue; | ||
| 4650 | /* search for an empty channel */ | ||
| 4651 | for (j = 0; j < cfg->line_outs; j++) { | ||
| 4652 | if (!assigned[j]) { | ||
| 4653 | spec->multiout.dac_nids[i] = | ||
| 4654 | alc880_idx_to_dac(j); | ||
| 4655 | assigned[j] = 1; | ||
| 4656 | break; | ||
| 4657 | } | ||
| 4658 | } | ||
| 4659 | } | ||
| 4660 | spec->multiout.num_dacs = cfg->line_outs; | ||
| 4661 | return 0; | ||
| 4662 | } | ||
| 4663 | |||
| 4664 | /* add playback controls from the parsed DAC table */ | ||
| 4665 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | ||
| 4666 | const struct auto_pin_cfg *cfg) | ||
| 4667 | { | ||
| 4668 | static const char *chname[4] = { | ||
| 4669 | "Front", "Surround", NULL /*CLFE*/, "Side" | ||
| 4670 | }; | ||
| 4671 | hda_nid_t nid; | ||
| 4672 | int i, err; | ||
| 4673 | |||
| 4674 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 4675 | if (!spec->multiout.dac_nids[i]) | ||
| 4676 | continue; | ||
| 4677 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); | ||
| 4678 | if (i == 2) { | ||
| 4679 | /* Center/LFE */ | ||
| 4680 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | ||
| 4681 | "Center", | ||
| 4682 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, | ||
| 4683 | HDA_OUTPUT)); | ||
| 4684 | if (err < 0) | ||
| 4685 | return err; | ||
| 4686 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | ||
| 4687 | "LFE", | ||
| 4688 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, | ||
| 4689 | HDA_OUTPUT)); | ||
| 4690 | if (err < 0) | ||
| 4691 | return err; | ||
| 4692 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | ||
| 4693 | "Center", | ||
| 4694 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | ||
| 4695 | HDA_INPUT)); | ||
| 4696 | if (err < 0) | ||
| 4697 | return err; | ||
| 4698 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | ||
| 4699 | "LFE", | ||
| 4700 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | ||
| 4701 | HDA_INPUT)); | ||
| 4702 | if (err < 0) | ||
| 4703 | return err; | ||
| 4704 | } else { | ||
| 4705 | const char *pfx; | ||
| 4706 | if (cfg->line_outs == 1 && | ||
| 4707 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 4708 | pfx = "Speaker"; | ||
| 4709 | else | ||
| 4710 | pfx = chname[i]; | ||
| 4711 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | ||
| 4712 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | ||
| 4713 | HDA_OUTPUT)); | ||
| 4714 | if (err < 0) | ||
| 4715 | return err; | ||
| 4716 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | ||
| 4717 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | ||
| 4718 | HDA_INPUT)); | ||
| 4719 | if (err < 0) | ||
| 4720 | return err; | ||
| 4721 | } | ||
| 4722 | } | ||
| 4723 | return 0; | ||
| 4724 | } | ||
| 4725 | |||
| 4726 | /* add playback controls for speaker and HP outputs */ | ||
| 4727 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | ||
| 4728 | const char *pfx) | ||
| 4729 | { | ||
| 4730 | hda_nid_t nid; | ||
| 4731 | int err; | ||
| 4732 | |||
| 4733 | if (!pin) | ||
| 4734 | return 0; | ||
| 4735 | |||
| 4736 | if (alc880_is_fixed_pin(pin)) { | ||
| 4737 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | ||
| 4738 | /* specify the DAC as the extra output */ | ||
| 4739 | if (!spec->multiout.hp_nid) | ||
| 4740 | spec->multiout.hp_nid = nid; | ||
| 4741 | else | ||
| 4742 | spec->multiout.extra_out_nid[0] = nid; | ||
| 4743 | /* control HP volume/switch on the output mixer amp */ | ||
| 4744 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); | ||
| 4745 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | ||
| 4746 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
| 4747 | if (err < 0) | ||
| 4748 | return err; | ||
| 4749 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | ||
| 4750 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); | ||
| 4751 | if (err < 0) | ||
| 4752 | return err; | ||
| 4753 | } else if (alc880_is_multi_pin(pin)) { | ||
| 4754 | /* set manual connection */ | ||
| 4755 | /* we have only a switch on HP-out PIN */ | ||
| 4756 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | ||
| 4757 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
| 4758 | if (err < 0) | ||
| 4759 | return err; | ||
| 4760 | } | ||
| 4761 | return 0; | ||
| 4762 | } | ||
| 4763 | |||
| 4764 | /* create input playback/capture controls for the given pin */ | ||
| 4765 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | ||
| 4766 | const char *ctlname, | ||
| 4767 | int idx, hda_nid_t mix_nid) | ||
| 4768 | { | ||
| 4769 | int err; | ||
| 4770 | |||
| 4771 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | ||
| 4772 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | ||
| 4773 | if (err < 0) | ||
| 4774 | return err; | ||
| 4775 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | ||
| 4776 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | ||
| 4777 | if (err < 0) | ||
| 4778 | return err; | ||
| 4779 | return 0; | ||
| 4780 | } | ||
| 4781 | |||
| 4782 | static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
| 4783 | { | ||
| 4784 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
| 4785 | return (pincap & AC_PINCAP_IN) != 0; | ||
| 4786 | } | ||
| 4787 | |||
| 4788 | /* create playback/capture controls for input pins */ | ||
| 4789 | static int alc_auto_create_input_ctls(struct hda_codec *codec, | ||
| 4790 | const struct auto_pin_cfg *cfg, | ||
| 4791 | hda_nid_t mixer, | ||
| 4792 | hda_nid_t cap1, hda_nid_t cap2) | ||
| 4793 | { | ||
| 4794 | struct alc_spec *spec = codec->spec; | ||
| 4795 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
| 4796 | int i, err, idx; | ||
| 4797 | |||
| 4798 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 4799 | hda_nid_t pin; | ||
| 4800 | |||
| 4801 | pin = cfg->input_pins[i]; | ||
| 4802 | if (!alc_is_input_pin(codec, pin)) | ||
| 4803 | continue; | ||
| 4804 | |||
| 4805 | if (mixer) { | ||
| 4806 | idx = get_connection_index(codec, mixer, pin); | ||
| 4807 | if (idx >= 0) { | ||
| 4808 | err = new_analog_input(spec, pin, | ||
| 4809 | auto_pin_cfg_labels[i], | ||
| 4810 | idx, mixer); | ||
| 4811 | if (err < 0) | ||
| 4812 | return err; | ||
| 4813 | } | ||
| 4814 | } | ||
| 4815 | |||
| 4816 | if (!cap1) | ||
| 4817 | continue; | ||
| 4818 | idx = get_connection_index(codec, cap1, pin); | ||
| 4819 | if (idx < 0 && cap2) | ||
| 4820 | idx = get_connection_index(codec, cap2, pin); | ||
| 4821 | if (idx >= 0) { | ||
| 4822 | imux->items[imux->num_items].label = | ||
| 4823 | auto_pin_cfg_labels[i]; | ||
| 4824 | imux->items[imux->num_items].index = idx; | ||
| 4825 | imux->num_items++; | ||
| 4826 | } | ||
| 4827 | } | ||
| 4828 | return 0; | ||
| 4829 | } | ||
| 4830 | |||
| 4831 | static int alc880_auto_create_input_ctls(struct hda_codec *codec, | ||
| 4832 | const struct auto_pin_cfg *cfg) | ||
| 4833 | { | ||
| 4834 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09); | ||
| 4835 | } | ||
| 4836 | |||
| 4837 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, | ||
| 4838 | unsigned int pin_type) | ||
| 4839 | { | ||
| 4840 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 4841 | pin_type); | ||
| 4842 | /* unmute pin */ | ||
| 4843 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 4844 | AMP_OUT_UNMUTE); | ||
| 4845 | } | ||
| 4846 | |||
| 4847 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 4848 | hda_nid_t nid, int pin_type, | ||
| 4849 | int dac_idx) | ||
| 4850 | { | ||
| 4851 | alc_set_pin_output(codec, nid, pin_type); | ||
| 4852 | /* need the manual connection? */ | ||
| 4853 | if (alc880_is_multi_pin(nid)) { | ||
| 4854 | struct alc_spec *spec = codec->spec; | ||
| 4855 | int idx = alc880_multi_pin_idx(nid); | ||
| 4856 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, | ||
| 4857 | AC_VERB_SET_CONNECT_SEL, | ||
| 4858 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); | ||
| 4859 | } | ||
| 4860 | } | ||
| 4861 | |||
| 4862 | static int get_pin_type(int line_out_type) | ||
| 4863 | { | ||
| 4864 | if (line_out_type == AUTO_PIN_HP_OUT) | ||
| 4865 | return PIN_HP; | ||
| 4866 | else | ||
| 4867 | return PIN_OUT; | ||
| 4868 | } | ||
| 4869 | |||
| 4870 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | ||
| 4871 | { | ||
| 4872 | struct alc_spec *spec = codec->spec; | ||
| 4873 | int i; | ||
| 4874 | |||
| 4875 | for (i = 0; i < spec->autocfg.line_outs; i++) { | ||
| 4876 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
| 4877 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 4878 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); | ||
| 4879 | } | ||
| 4880 | } | ||
| 4881 | |||
| 4882 | static void alc880_auto_init_extra_out(struct hda_codec *codec) | ||
| 4883 | { | ||
| 4884 | struct alc_spec *spec = codec->spec; | ||
| 4885 | hda_nid_t pin; | ||
| 4886 | |||
| 4887 | pin = spec->autocfg.speaker_pins[0]; | ||
| 4888 | if (pin) /* connect to front */ | ||
| 4889 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
| 4890 | pin = spec->autocfg.hp_pins[0]; | ||
| 4891 | if (pin) /* connect to front */ | ||
| 4892 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | ||
| 4893 | } | ||
| 4894 | |||
| 4895 | static void alc880_auto_init_analog_input(struct hda_codec *codec) | ||
| 4896 | { | ||
| 4897 | struct alc_spec *spec = codec->spec; | ||
| 4898 | int i; | ||
| 4899 | |||
| 4900 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 4901 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 4902 | if (alc_is_input_pin(codec, nid)) { | ||
| 4903 | alc_set_input_pin(codec, nid, i); | ||
| 4904 | if (nid != ALC880_PIN_CD_NID && | ||
| 4905 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | ||
| 4906 | snd_hda_codec_write(codec, nid, 0, | ||
| 4907 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 4908 | AMP_OUT_MUTE); | ||
| 4909 | } | ||
| 4910 | } | ||
| 4911 | } | ||
| 4912 | |||
| 4913 | static void alc880_auto_init_input_src(struct hda_codec *codec) | ||
| 4914 | { | ||
| 4915 | struct alc_spec *spec = codec->spec; | ||
| 4916 | int c; | ||
| 4917 | |||
| 4918 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
| 4919 | unsigned int mux_idx; | ||
| 4920 | const struct hda_input_mux *imux; | ||
| 4921 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
| 4922 | imux = &spec->input_mux[mux_idx]; | ||
| 4923 | if (!imux->num_items && mux_idx > 0) | ||
| 4924 | imux = &spec->input_mux[0]; | ||
| 4925 | if (imux) | ||
| 4926 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | ||
| 4927 | AC_VERB_SET_CONNECT_SEL, | ||
| 4928 | imux->items[0].index); | ||
| 4929 | } | ||
| 4930 | } | ||
| 4931 | |||
| 4932 | /* parse the BIOS configuration and set up the alc_spec */ | ||
| 4933 | /* return 1 if successful, 0 if the proper config is not found, | ||
| 4934 | * or a negative error code | ||
| 4935 | */ | ||
| 4936 | static int alc880_parse_auto_config(struct hda_codec *codec) | ||
| 4937 | { | ||
| 4938 | struct alc_spec *spec = codec->spec; | ||
| 4939 | int i, err; | ||
| 4940 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | ||
| 4941 | |||
| 4942 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 4943 | alc880_ignore); | ||
| 4944 | if (err < 0) | ||
| 4945 | return err; | ||
| 4946 | if (!spec->autocfg.line_outs) | ||
| 4947 | return 0; /* can't find valid BIOS pin config */ | ||
| 4948 | |||
| 4949 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | ||
| 4950 | if (err < 0) | ||
| 4951 | return err; | ||
| 4952 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 4953 | if (err < 0) | ||
| 4954 | return err; | ||
| 4955 | err = alc880_auto_create_extra_out(spec, | ||
| 4956 | spec->autocfg.speaker_pins[0], | ||
| 4957 | "Speaker"); | ||
| 4958 | if (err < 0) | ||
| 4959 | return err; | ||
| 4960 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | ||
| 4961 | "Headphone"); | ||
| 4962 | if (err < 0) | ||
| 4963 | return err; | ||
| 4964 | err = alc880_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 4965 | if (err < 0) | ||
| 4966 | return err; | ||
| 4967 | |||
| 4968 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 4969 | |||
| 4970 | /* check multiple SPDIF-out (for recent codecs) */ | ||
| 4971 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | ||
| 4972 | hda_nid_t dig_nid; | ||
| 4973 | err = snd_hda_get_connections(codec, | ||
| 4974 | spec->autocfg.dig_out_pins[i], | ||
| 4975 | &dig_nid, 1); | ||
| 4976 | if (err < 0) | ||
| 4977 | continue; | ||
| 4978 | if (!i) | ||
| 4979 | spec->multiout.dig_out_nid = dig_nid; | ||
| 4980 | else { | ||
| 4981 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | ||
| 4982 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | ||
| 4983 | break; | ||
| 4984 | spec->slave_dig_outs[i - 1] = dig_nid; | ||
| 4985 | } | ||
| 4986 | } | ||
| 4987 | if (spec->autocfg.dig_in_pin) | ||
| 4988 | spec->dig_in_nid = ALC880_DIGIN_NID; | ||
| 4989 | |||
| 4990 | if (spec->kctls.list) | ||
| 4991 | add_mixer(spec, spec->kctls.list); | ||
| 4992 | |||
| 4993 | add_verb(spec, alc880_volume_init_verbs); | ||
| 4994 | |||
| 4995 | spec->num_mux_defs = 1; | ||
| 4996 | spec->input_mux = &spec->private_imux[0]; | ||
| 4997 | |||
| 4998 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 4999 | |||
| 5000 | return 1; | ||
| 5001 | } | ||
| 5002 | |||
| 5003 | /* additional initialization for auto-configuration model */ | ||
| 5004 | static void alc880_auto_init(struct hda_codec *codec) | ||
| 5005 | { | ||
| 5006 | struct alc_spec *spec = codec->spec; | ||
| 5007 | alc880_auto_init_multi_out(codec); | ||
| 5008 | alc880_auto_init_extra_out(codec); | ||
| 5009 | alc880_auto_init_analog_input(codec); | ||
| 5010 | alc880_auto_init_input_src(codec); | ||
| 5011 | if (spec->unsol_event) | ||
| 5012 | alc_inithook(codec); | ||
| 5013 | } | ||
| 5014 | |||
| 5015 | /* check the ADC/MUX contains all input pins; some ADC/MUX contains only | ||
| 5016 | * one of two digital mic pins, e.g. on ALC272 | ||
| 5017 | */ | ||
| 5018 | static void fixup_automic_adc(struct hda_codec *codec) | ||
| 5019 | { | ||
| 5020 | struct alc_spec *spec = codec->spec; | ||
| 5021 | int i; | ||
| 5022 | |||
| 5023 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
| 5024 | hda_nid_t cap = spec->capsrc_nids ? | ||
| 5025 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
| 5026 | int iidx, eidx; | ||
| 5027 | |||
| 5028 | iidx = get_connection_index(codec, cap, spec->int_mic.pin); | ||
| 5029 | if (iidx < 0) | ||
| 5030 | continue; | ||
| 5031 | eidx = get_connection_index(codec, cap, spec->ext_mic.pin); | ||
| 5032 | if (eidx < 0) | ||
| 5033 | continue; | ||
| 5034 | spec->int_mic.mux_idx = iidx; | ||
| 5035 | spec->ext_mic.mux_idx = eidx; | ||
| 5036 | if (spec->capsrc_nids) | ||
| 5037 | spec->capsrc_nids += i; | ||
| 5038 | spec->adc_nids += i; | ||
| 5039 | spec->num_adc_nids = 1; | ||
| 5040 | return; | ||
| 5041 | } | ||
| 5042 | snd_printd(KERN_INFO "hda_codec: %s: " | ||
| 5043 | "No ADC/MUX containing both 0x%x and 0x%x pins\n", | ||
| 5044 | codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin); | ||
| 5045 | spec->auto_mic = 0; /* disable auto-mic to be sure */ | ||
| 5046 | } | ||
| 5047 | |||
| 5048 | /* choose the ADC/MUX containing the input pin and initialize the setup */ | ||
| 5049 | static void fixup_single_adc(struct hda_codec *codec) | ||
| 5050 | { | ||
| 5051 | struct alc_spec *spec = codec->spec; | ||
| 5052 | hda_nid_t pin = 0; | ||
| 5053 | int i; | ||
| 5054 | |||
| 5055 | /* search for the input pin; there must be only one */ | ||
| 5056 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 5057 | if (spec->autocfg.input_pins[i]) { | ||
| 5058 | pin = spec->autocfg.input_pins[i]; | ||
| 5059 | break; | ||
| 5060 | } | ||
| 5061 | } | ||
| 5062 | if (!pin) | ||
| 5063 | return; | ||
| 5064 | |||
| 5065 | /* set the default connection to that pin */ | ||
| 5066 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
| 5067 | hda_nid_t cap = spec->capsrc_nids ? | ||
| 5068 | spec->capsrc_nids[i] : spec->adc_nids[i]; | ||
| 5069 | int idx; | ||
| 5070 | |||
| 5071 | idx = get_connection_index(codec, cap, pin); | ||
| 5072 | if (idx < 0) | ||
| 5073 | continue; | ||
| 5074 | /* use only this ADC */ | ||
| 5075 | if (spec->capsrc_nids) | ||
| 5076 | spec->capsrc_nids += i; | ||
| 5077 | spec->adc_nids += i; | ||
| 5078 | spec->num_adc_nids = 1; | ||
| 5079 | /* select or unmute this route */ | ||
| 5080 | if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { | ||
| 5081 | snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, | ||
| 5082 | HDA_AMP_MUTE, 0); | ||
| 5083 | } else { | ||
| 5084 | snd_hda_codec_write_cache(codec, cap, 0, | ||
| 5085 | AC_VERB_SET_CONNECT_SEL, idx); | ||
| 5086 | } | ||
| 5087 | return; | ||
| 5088 | } | ||
| 5089 | } | ||
| 5090 | |||
| 5091 | static void set_capture_mixer(struct hda_codec *codec) | ||
| 5092 | { | ||
| 5093 | struct alc_spec *spec = codec->spec; | ||
| 5094 | static struct snd_kcontrol_new *caps[2][3] = { | ||
| 5095 | { alc_capture_mixer_nosrc1, | ||
| 5096 | alc_capture_mixer_nosrc2, | ||
| 5097 | alc_capture_mixer_nosrc3 }, | ||
| 5098 | { alc_capture_mixer1, | ||
| 5099 | alc_capture_mixer2, | ||
| 5100 | alc_capture_mixer3 }, | ||
| 5101 | }; | ||
| 5102 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { | ||
| 5103 | int mux = 0; | ||
| 5104 | if (spec->auto_mic) | ||
| 5105 | fixup_automic_adc(codec); | ||
| 5106 | else if (spec->input_mux) { | ||
| 5107 | if (spec->input_mux->num_items > 1) | ||
| 5108 | mux = 1; | ||
| 5109 | else if (spec->input_mux->num_items == 1) | ||
| 5110 | fixup_single_adc(codec); | ||
| 5111 | } | ||
| 5112 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | ||
| 5113 | } | ||
| 5114 | } | ||
| 5115 | |||
| 5116 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ | ||
| 5117 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | ||
| 5118 | int num_nids) | ||
| 5119 | { | ||
| 5120 | struct alc_spec *spec = codec->spec; | ||
| 5121 | int n; | ||
| 5122 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | ||
| 5123 | |||
| 5124 | for (n = 0; n < num_nids; n++) { | ||
| 5125 | hda_nid_t adc, cap; | ||
| 5126 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
| 5127 | int nconns, i, j; | ||
| 5128 | |||
| 5129 | adc = nids[n]; | ||
| 5130 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | ||
| 5131 | continue; | ||
| 5132 | cap = adc; | ||
| 5133 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
| 5134 | ARRAY_SIZE(conn)); | ||
| 5135 | if (nconns == 1) { | ||
| 5136 | cap = conn[0]; | ||
| 5137 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
| 5138 | ARRAY_SIZE(conn)); | ||
| 5139 | } | ||
| 5140 | if (nconns <= 0) | ||
| 5141 | continue; | ||
| 5142 | if (!fallback_adc) { | ||
| 5143 | fallback_adc = adc; | ||
| 5144 | fallback_cap = cap; | ||
| 5145 | } | ||
| 5146 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 5147 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 5148 | if (!nid) | ||
| 5149 | continue; | ||
| 5150 | for (j = 0; j < nconns; j++) { | ||
| 5151 | if (conn[j] == nid) | ||
| 5152 | break; | ||
| 5153 | } | ||
| 5154 | if (j >= nconns) | ||
| 5155 | break; | ||
| 5156 | } | ||
| 5157 | if (i >= AUTO_PIN_LAST) { | ||
| 5158 | int num_adcs = spec->num_adc_nids; | ||
| 5159 | spec->private_adc_nids[num_adcs] = adc; | ||
| 5160 | spec->private_capsrc_nids[num_adcs] = cap; | ||
| 5161 | spec->num_adc_nids++; | ||
| 5162 | spec->adc_nids = spec->private_adc_nids; | ||
| 5163 | if (adc != cap) | ||
| 5164 | spec->capsrc_nids = spec->private_capsrc_nids; | ||
| 5165 | } | ||
| 5166 | } | ||
| 5167 | if (!spec->num_adc_nids) { | ||
| 5168 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | ||
| 5169 | " using fallback 0x%x\n", | ||
| 5170 | codec->chip_name, fallback_adc); | ||
| 5171 | spec->private_adc_nids[0] = fallback_adc; | ||
| 5172 | spec->adc_nids = spec->private_adc_nids; | ||
| 5173 | if (fallback_adc != fallback_cap) { | ||
| 5174 | spec->private_capsrc_nids[0] = fallback_cap; | ||
| 5175 | spec->capsrc_nids = spec->private_adc_nids; | ||
| 5176 | } | ||
| 5177 | } | ||
| 5178 | } | ||
| 5179 | |||
| 5180 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
| 5181 | #define set_beep_amp(spec, nid, idx, dir) \ | ||
| 5182 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | ||
| 5183 | |||
| 5184 | static struct snd_pci_quirk beep_white_list[] = { | ||
| 5185 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), | ||
| 5186 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), | ||
| 5187 | {} | ||
| 5188 | }; | ||
| 5189 | |||
| 5190 | static inline int has_cdefine_beep(struct hda_codec *codec) | ||
| 5191 | { | ||
| 5192 | struct alc_spec *spec = codec->spec; | ||
| 5193 | const struct snd_pci_quirk *q; | ||
| 5194 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | ||
| 5195 | if (q) | ||
| 5196 | return q->value; | ||
| 5197 | return spec->cdefine.enable_pcbeep; | ||
| 5198 | } | ||
| 5199 | #else | ||
| 5200 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | ||
| 5201 | #define has_cdefine_beep(codec) 0 | ||
| 5202 | #endif | ||
| 5203 | |||
| 5204 | /* | ||
| 5205 | * OK, here we have finally the patch for ALC880 | ||
| 5206 | */ | ||
| 5207 | |||
| 5208 | static int patch_alc880(struct hda_codec *codec) | ||
| 5209 | { | ||
| 5210 | struct alc_spec *spec; | ||
| 5211 | int board_config; | ||
| 5212 | int err; | ||
| 5213 | |||
| 5214 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 5215 | if (spec == NULL) | ||
| 5216 | return -ENOMEM; | ||
| 5217 | |||
| 5218 | codec->spec = spec; | ||
| 5219 | |||
| 5220 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, | ||
| 5221 | alc880_models, | ||
| 5222 | alc880_cfg_tbl); | ||
| 5223 | if (board_config < 0) { | ||
| 5224 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 5225 | codec->chip_name); | ||
| 5226 | board_config = ALC880_AUTO; | ||
| 5227 | } | ||
| 5228 | |||
| 5229 | if (board_config == ALC880_AUTO) { | ||
| 5230 | /* automatic parse from the BIOS config */ | ||
| 5231 | err = alc880_parse_auto_config(codec); | ||
| 5232 | if (err < 0) { | ||
| 5233 | alc_free(codec); | ||
| 5234 | return err; | ||
| 5235 | } else if (!err) { | ||
| 5236 | printk(KERN_INFO | ||
| 5237 | "hda_codec: Cannot set up configuration " | ||
| 5238 | "from BIOS. Using 3-stack mode...\n"); | ||
| 5239 | board_config = ALC880_3ST; | ||
| 5240 | } | ||
| 5241 | } | ||
| 5242 | |||
| 5243 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 5244 | if (err < 0) { | ||
| 5245 | alc_free(codec); | ||
| 5246 | return err; | ||
| 5247 | } | ||
| 5248 | |||
| 5249 | if (board_config != ALC880_AUTO) | ||
| 5250 | setup_preset(codec, &alc880_presets[board_config]); | ||
| 5251 | |||
| 5252 | spec->stream_analog_playback = &alc880_pcm_analog_playback; | ||
| 5253 | spec->stream_analog_capture = &alc880_pcm_analog_capture; | ||
| 5254 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | ||
| 5255 | |||
| 5256 | spec->stream_digital_playback = &alc880_pcm_digital_playback; | ||
| 5257 | spec->stream_digital_capture = &alc880_pcm_digital_capture; | ||
| 5258 | |||
| 5259 | if (!spec->adc_nids && spec->input_mux) { | ||
| 5260 | /* check whether NID 0x07 is valid */ | ||
| 5261 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); | ||
| 5262 | /* get type */ | ||
| 5263 | wcap = get_wcaps_type(wcap); | ||
| 5264 | if (wcap != AC_WID_AUD_IN) { | ||
| 5265 | spec->adc_nids = alc880_adc_nids_alt; | ||
| 5266 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); | ||
| 5267 | } else { | ||
| 5268 | spec->adc_nids = alc880_adc_nids; | ||
| 5269 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); | ||
| 5270 | } | ||
| 5271 | } | ||
| 5272 | set_capture_mixer(codec); | ||
| 5273 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
| 5274 | |||
| 5275 | spec->vmaster_nid = 0x0c; | ||
| 5276 | |||
| 5277 | codec->patch_ops = alc_patch_ops; | ||
| 5278 | if (board_config == ALC880_AUTO) | ||
| 5279 | spec->init_hook = alc880_auto_init; | ||
| 5280 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 5281 | if (!spec->loopback.amplist) | ||
| 5282 | spec->loopback.amplist = alc880_loopbacks; | ||
| 5283 | #endif | ||
| 5284 | |||
| 5285 | return 0; | ||
| 5286 | } | ||
| 5287 | |||
| 5288 | |||
| 5289 | /* | ||
| 5290 | * ALC260 support | ||
| 5291 | */ | ||
| 5292 | |||
| 5293 | static hda_nid_t alc260_dac_nids[1] = { | ||
| 5294 | /* front */ | ||
| 5295 | 0x02, | ||
| 5296 | }; | ||
| 5297 | |||
| 5298 | static hda_nid_t alc260_adc_nids[1] = { | ||
| 5299 | /* ADC0 */ | ||
| 5300 | 0x04, | ||
| 5301 | }; | ||
| 5302 | |||
| 5303 | static hda_nid_t alc260_adc_nids_alt[1] = { | ||
| 5304 | /* ADC1 */ | ||
| 5305 | 0x05, | ||
| 5306 | }; | ||
| 5307 | |||
| 5308 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that | ||
| 5309 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. | ||
| 5310 | */ | ||
| 5311 | static hda_nid_t alc260_dual_adc_nids[2] = { | ||
| 5312 | /* ADC0, ADC1 */ | ||
| 5313 | 0x04, 0x05 | ||
| 5314 | }; | ||
| 5315 | |||
| 5316 | #define ALC260_DIGOUT_NID 0x03 | ||
| 5317 | #define ALC260_DIGIN_NID 0x06 | ||
| 5318 | |||
| 5319 | static struct hda_input_mux alc260_capture_source = { | ||
| 5320 | .num_items = 4, | ||
| 5321 | .items = { | ||
| 5322 | { "Mic", 0x0 }, | ||
| 5323 | { "Front Mic", 0x1 }, | ||
| 5324 | { "Line", 0x2 }, | ||
| 5325 | { "CD", 0x4 }, | ||
| 5326 | }, | ||
| 5327 | }; | ||
| 5328 | |||
| 5329 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, | ||
| 5330 | * headphone jack and the internal CD lines since these are the only pins at | ||
| 5331 | * which audio can appear. For flexibility, also allow the option of | ||
| 5332 | * recording the mixer output on the second ADC (ADC0 doesn't have a | ||
| 5333 | * connection to the mixer output). | ||
| 5334 | */ | ||
| 5335 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { | ||
| 5336 | { | ||
| 5337 | .num_items = 3, | ||
| 5338 | .items = { | ||
| 5339 | { "Mic/Line", 0x0 }, | ||
| 5340 | { "CD", 0x4 }, | ||
| 5341 | { "Headphone", 0x2 }, | ||
| 5342 | }, | ||
| 5343 | }, | ||
| 5344 | { | ||
| 5345 | .num_items = 4, | ||
| 5346 | .items = { | ||
| 5347 | { "Mic/Line", 0x0 }, | ||
| 5348 | { "CD", 0x4 }, | ||
| 5349 | { "Headphone", 0x2 }, | ||
| 5350 | { "Mixer", 0x5 }, | ||
| 5351 | }, | ||
| 5352 | }, | ||
| 5353 | |||
| 5354 | }; | ||
| 5355 | |||
| 5356 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to | ||
| 5357 | * the Fujitsu S702x, but jacks are marked differently. | ||
| 5358 | */ | ||
| 5359 | static struct hda_input_mux alc260_acer_capture_sources[2] = { | ||
| 5360 | { | ||
| 5361 | .num_items = 4, | ||
| 5362 | .items = { | ||
| 5363 | { "Mic", 0x0 }, | ||
| 5364 | { "Line", 0x2 }, | ||
| 5365 | { "CD", 0x4 }, | ||
| 5366 | { "Headphone", 0x5 }, | ||
| 5367 | }, | ||
| 5368 | }, | ||
| 5369 | { | ||
| 5370 | .num_items = 5, | ||
| 5371 | .items = { | ||
| 5372 | { "Mic", 0x0 }, | ||
| 5373 | { "Line", 0x2 }, | ||
| 5374 | { "CD", 0x4 }, | ||
| 5375 | { "Headphone", 0x6 }, | ||
| 5376 | { "Mixer", 0x5 }, | ||
| 5377 | }, | ||
| 5378 | }, | ||
| 5379 | }; | ||
| 5380 | |||
| 5381 | /* Maxdata Favorit 100XS */ | ||
| 5382 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | ||
| 5383 | { | ||
| 5384 | .num_items = 2, | ||
| 5385 | .items = { | ||
| 5386 | { "Line/Mic", 0x0 }, | ||
| 5387 | { "CD", 0x4 }, | ||
| 5388 | }, | ||
| 5389 | }, | ||
| 5390 | { | ||
| 5391 | .num_items = 3, | ||
| 5392 | .items = { | ||
| 5393 | { "Line/Mic", 0x0 }, | ||
| 5394 | { "CD", 0x4 }, | ||
| 5395 | { "Mixer", 0x5 }, | ||
| 5396 | }, | ||
| 5397 | }, | ||
| 5398 | }; | ||
| 5399 | |||
| 5400 | /* | ||
| 5401 | * This is just place-holder, so there's something for alc_build_pcms to look | ||
| 5402 | * at when it calculates the maximum number of channels. ALC260 has no mixer | ||
| 5403 | * element which allows changing the channel mode, so the verb list is | ||
| 5404 | * never used. | ||
| 5405 | */ | ||
| 5406 | static struct hda_channel_mode alc260_modes[1] = { | ||
| 5407 | { 2, NULL }, | ||
| 5408 | }; | ||
| 5409 | |||
| 5410 | |||
| 5411 | /* Mixer combinations | ||
| 5412 | * | ||
| 5413 | * basic: base_output + input + pc_beep + capture | ||
| 5414 | * HP: base_output + input + capture_alt | ||
| 5415 | * HP_3013: hp_3013 + input + capture | ||
| 5416 | * fujitsu: fujitsu + capture | ||
| 5417 | * acer: acer + capture | ||
| 5418 | */ | ||
| 5419 | |||
| 5420 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { | ||
| 5421 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5422 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 5423 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
| 5424 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | ||
| 5425 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | ||
| 5426 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | ||
| 5427 | { } /* end */ | ||
| 5428 | }; | ||
| 5429 | |||
| 5430 | static struct snd_kcontrol_new alc260_input_mixer[] = { | ||
| 5431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
| 5432 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
| 5433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | ||
| 5434 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | ||
| 5435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5437 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), | ||
| 5438 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), | ||
| 5439 | { } /* end */ | ||
| 5440 | }; | ||
| 5441 | |||
| 5442 | /* update HP, line and mono out pins according to the master switch */ | ||
| 5443 | static void alc260_hp_master_update(struct hda_codec *codec, | ||
| 5444 | hda_nid_t hp, hda_nid_t line, | ||
| 5445 | hda_nid_t mono) | ||
| 5446 | { | ||
| 5447 | struct alc_spec *spec = codec->spec; | ||
| 5448 | unsigned int val = spec->master_sw ? PIN_HP : 0; | ||
| 5449 | /* change HP and line-out pins */ | ||
| 5450 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5451 | val); | ||
| 5452 | snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5453 | val); | ||
| 5454 | /* mono (speaker) depending on the HP jack sense */ | ||
| 5455 | val = (val && !spec->jack_present) ? PIN_OUT : 0; | ||
| 5456 | snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5457 | val); | ||
| 5458 | } | ||
| 5459 | |||
| 5460 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, | ||
| 5461 | struct snd_ctl_elem_value *ucontrol) | ||
| 5462 | { | ||
| 5463 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 5464 | struct alc_spec *spec = codec->spec; | ||
| 5465 | *ucontrol->value.integer.value = spec->master_sw; | ||
| 5466 | return 0; | ||
| 5467 | } | ||
| 5468 | |||
| 5469 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 5470 | struct snd_ctl_elem_value *ucontrol) | ||
| 5471 | { | ||
| 5472 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 5473 | struct alc_spec *spec = codec->spec; | ||
| 5474 | int val = !!*ucontrol->value.integer.value; | ||
| 5475 | hda_nid_t hp, line, mono; | ||
| 5476 | |||
| 5477 | if (val == spec->master_sw) | ||
| 5478 | return 0; | ||
| 5479 | spec->master_sw = val; | ||
| 5480 | hp = (kcontrol->private_value >> 16) & 0xff; | ||
| 5481 | line = (kcontrol->private_value >> 8) & 0xff; | ||
| 5482 | mono = kcontrol->private_value & 0xff; | ||
| 5483 | alc260_hp_master_update(codec, hp, line, mono); | ||
| 5484 | return 1; | ||
| 5485 | } | ||
| 5486 | |||
| 5487 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { | ||
| 5488 | { | ||
| 5489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 5490 | .name = "Master Playback Switch", | ||
| 5491 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | ||
| 5492 | .info = snd_ctl_boolean_mono_info, | ||
| 5493 | .get = alc260_hp_master_sw_get, | ||
| 5494 | .put = alc260_hp_master_sw_put, | ||
| 5495 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 | ||
| 5496 | }, | ||
| 5497 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5498 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 5499 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
| 5500 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), | ||
| 5501 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | ||
| 5502 | HDA_OUTPUT), | ||
| 5503 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), | ||
| 5504 | { } /* end */ | ||
| 5505 | }; | ||
| 5506 | |||
| 5507 | static struct hda_verb alc260_hp_unsol_verbs[] = { | ||
| 5508 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 5509 | {}, | ||
| 5510 | }; | ||
| 5511 | |||
| 5512 | static void alc260_hp_automute(struct hda_codec *codec) | ||
| 5513 | { | ||
| 5514 | struct alc_spec *spec = codec->spec; | ||
| 5515 | |||
| 5516 | spec->jack_present = snd_hda_jack_detect(codec, 0x10); | ||
| 5517 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); | ||
| 5518 | } | ||
| 5519 | |||
| 5520 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 5521 | { | ||
| 5522 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 5523 | alc260_hp_automute(codec); | ||
| 5524 | } | ||
| 5525 | |||
| 5526 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | ||
| 5527 | { | ||
| 5528 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 5529 | .name = "Master Playback Switch", | ||
| 5530 | .subdevice = HDA_SUBDEV_NID_FLAG | 0x11, | ||
| 5531 | .info = snd_ctl_boolean_mono_info, | ||
| 5532 | .get = alc260_hp_master_sw_get, | ||
| 5533 | .put = alc260_hp_master_sw_put, | ||
| 5534 | .private_value = (0x15 << 16) | (0x10 << 8) | 0x11 | ||
| 5535 | }, | ||
| 5536 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
| 5537 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
| 5538 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), | ||
| 5539 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), | ||
| 5540 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 5542 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | ||
| 5543 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), | ||
| 5544 | { } /* end */ | ||
| 5545 | }; | ||
| 5546 | |||
| 5547 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | ||
| 5548 | .ops = &snd_hda_bind_vol, | ||
| 5549 | .values = { | ||
| 5550 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | ||
| 5551 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | ||
| 5552 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | ||
| 5553 | 0 | ||
| 5554 | }, | ||
| 5555 | }; | ||
| 5556 | |||
| 5557 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | ||
| 5558 | .ops = &snd_hda_bind_sw, | ||
| 5559 | .values = { | ||
| 5560 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | ||
| 5561 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
| 5562 | 0 | ||
| 5563 | }, | ||
| 5564 | }; | ||
| 5565 | |||
| 5566 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | ||
| 5567 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | ||
| 5568 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | ||
| 5569 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | ||
| 5570 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
| 5571 | { } /* end */ | ||
| 5572 | }; | ||
| 5573 | |||
| 5574 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | ||
| 5575 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 5576 | {}, | ||
| 5577 | }; | ||
| 5578 | |||
| 5579 | static void alc260_hp_3013_automute(struct hda_codec *codec) | ||
| 5580 | { | ||
| 5581 | struct alc_spec *spec = codec->spec; | ||
| 5582 | |||
| 5583 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | ||
| 5584 | alc260_hp_master_update(codec, 0x15, 0x10, 0x11); | ||
| 5585 | } | ||
| 5586 | |||
| 5587 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | ||
| 5588 | unsigned int res) | ||
| 5589 | { | ||
| 5590 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 5591 | alc260_hp_3013_automute(codec); | ||
| 5592 | } | ||
| 5593 | |||
| 5594 | static void alc260_hp_3012_automute(struct hda_codec *codec) | ||
| 5595 | { | ||
| 5596 | unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT; | ||
| 5597 | |||
| 5598 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5599 | bits); | ||
| 5600 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5601 | bits); | ||
| 5602 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 5603 | bits); | ||
| 5604 | } | ||
| 5605 | |||
| 5606 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | ||
| 5607 | unsigned int res) | ||
| 5608 | { | ||
| 5609 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 5610 | alc260_hp_3012_automute(codec); | ||
| 5611 | } | ||
| 5612 | |||
| 5613 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | ||
| 5614 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | ||
| 5615 | */ | ||
| 5616 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | ||
| 5617 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5618 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 5619 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 5620 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
| 5621 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
| 5622 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5623 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5624 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
| 5625 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
| 5626 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | ||
| 5627 | { } /* end */ | ||
| 5628 | }; | ||
| 5629 | |||
| 5630 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current | ||
| 5631 | * versions of the ALC260 don't act on requests to enable mic bias from NID | ||
| 5632 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 | ||
| 5633 | * datasheet doesn't mention this restriction. At this stage it's not clear | ||
| 5634 | * whether this behaviour is intentional or is a hardware bug in chip | ||
| 5635 | * revisions available in early 2006. Therefore for now allow the | ||
| 5636 | * "Headphone Jack Mode" control to span all choices, but if it turns out | ||
| 5637 | * that the lack of mic bias for this NID is intentional we could change the | ||
| 5638 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
| 5639 | * | ||
| 5640 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 | ||
| 5641 | * don't appear to make the mic bias available from the "line" jack, even | ||
| 5642 | * though the NID used for this jack (0x14) can supply it. The theory is | ||
| 5643 | * that perhaps Acer have included blocking capacitors between the ALC260 | ||
| 5644 | * and the output jack. If this turns out to be the case for all such | ||
| 5645 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT | ||
| 5646 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
| 5647 | * | ||
| 5648 | * The C20x Tablet series have a mono internal speaker which is controlled | ||
| 5649 | * via the chip's Mono sum widget and pin complex, so include the necessary | ||
| 5650 | * controls for such models. On models without a "mono speaker" the control | ||
| 5651 | * won't do anything. | ||
| 5652 | */ | ||
| 5653 | static struct snd_kcontrol_new alc260_acer_mixer[] = { | ||
| 5654 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5655 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 5656 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | ||
| 5657 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, | ||
| 5658 | HDA_OUTPUT), | ||
| 5659 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, | ||
| 5660 | HDA_INPUT), | ||
| 5661 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
| 5662 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
| 5663 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5664 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5665 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
| 5666 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | ||
| 5667 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | ||
| 5668 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 5669 | { } /* end */ | ||
| 5670 | }; | ||
| 5671 | |||
| 5672 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack | ||
| 5673 | */ | ||
| 5674 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | ||
| 5675 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5676 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 5677 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | ||
| 5678 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5679 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5680 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
| 5681 | { } /* end */ | ||
| 5682 | }; | ||
| 5683 | |||
| 5684 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, | ||
| 5685 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. | ||
| 5686 | */ | ||
| 5687 | static struct snd_kcontrol_new alc260_will_mixer[] = { | ||
| 5688 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5689 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | ||
| 5690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5692 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
| 5693 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | ||
| 5694 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | ||
| 5695 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 5696 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
| 5697 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
| 5698 | { } /* end */ | ||
| 5699 | }; | ||
| 5700 | |||
| 5701 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, | ||
| 5702 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. | ||
| 5703 | */ | ||
| 5704 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { | ||
| 5705 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 5706 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), | ||
| 5707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
| 5708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
| 5709 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
| 5710 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), | ||
| 5711 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), | ||
| 5712 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | ||
| 5713 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | ||
| 5714 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 5715 | { } /* end */ | ||
| 5716 | }; | ||
| 5717 | |||
| 5718 | /* | ||
| 5719 | * initialization verbs | ||
| 5720 | */ | ||
| 5721 | static struct hda_verb alc260_init_verbs[] = { | ||
| 5722 | /* Line In pin widget for input */ | ||
| 5723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 5724 | /* CD pin widget for input */ | ||
| 5725 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 5726 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 5727 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 5728 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | ||
| 5729 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 5730 | /* LINE-2 is used for line-out in rear */ | ||
| 5731 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 5732 | /* select line-out */ | ||
| 5733 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 5734 | /* LINE-OUT pin */ | ||
| 5735 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 5736 | /* enable HP */ | ||
| 5737 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 5738 | /* enable Mono */ | ||
| 5739 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 5740 | /* mute capture amp left and right */ | ||
| 5741 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 5742 | /* set connection select to line in (default select for this ADC) */ | ||
| 5743 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 5744 | /* mute capture amp left and right */ | ||
| 5745 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 5746 | /* set connection select to line in (default select for this ADC) */ | ||
| 5747 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 5748 | /* set vol=0 Line-Out mixer amp left and right */ | ||
| 5749 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5750 | /* unmute pin widget amp left and right (no gain on this amp) */ | ||
| 5751 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5752 | /* set vol=0 HP mixer amp left and right */ | ||
| 5753 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5754 | /* unmute pin widget amp left and right (no gain on this amp) */ | ||
| 5755 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5756 | /* set vol=0 Mono mixer amp left and right */ | ||
| 5757 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5758 | /* unmute pin widget amp left and right (no gain on this amp) */ | ||
| 5759 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5760 | /* unmute LINE-2 out pin */ | ||
| 5761 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5762 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | ||
| 5763 | * Line In 2 = 0x03 | ||
| 5764 | */ | ||
| 5765 | /* mute analog inputs */ | ||
| 5766 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5767 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5768 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 5769 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 5770 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 5771 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | ||
| 5772 | /* mute Front out path */ | ||
| 5773 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5774 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5775 | /* mute Headphone out path */ | ||
| 5776 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5777 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5778 | /* mute Mono out path */ | ||
| 5779 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5780 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5781 | { } | ||
| 5782 | }; | ||
| 5783 | |||
| 5784 | #if 0 /* should be identical with alc260_init_verbs? */ | ||
| 5785 | static struct hda_verb alc260_hp_init_verbs[] = { | ||
| 5786 | /* Headphone and output */ | ||
| 5787 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 5788 | /* mono output */ | ||
| 5789 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 5790 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 5791 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 5792 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | ||
| 5793 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 5794 | /* Line In pin widget for input */ | ||
| 5795 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 5796 | /* Line-2 pin widget for output */ | ||
| 5797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 5798 | /* CD pin widget for input */ | ||
| 5799 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 5800 | /* unmute amp left and right */ | ||
| 5801 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | ||
| 5802 | /* set connection select to line in (default select for this ADC) */ | ||
| 5803 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 5804 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | ||
| 5805 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
| 5806 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
| 5807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 5808 | /* unmute HP mixer amp left and right (volume = 0) */ | ||
| 5809 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
| 5810 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
| 5811 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 5812 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | ||
| 5813 | * Line In 2 = 0x03 | ||
| 5814 | */ | ||
| 5815 | /* mute analog inputs */ | ||
| 5816 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5817 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5818 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 5819 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 5820 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 5821 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | ||
| 5822 | /* Unmute Front out path */ | ||
| 5823 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5825 | /* Unmute Headphone out path */ | ||
| 5826 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5827 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5828 | /* Unmute Mono out path */ | ||
| 5829 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5830 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5831 | { } | ||
| 5832 | }; | ||
| 5833 | #endif | ||
| 5834 | |||
| 5835 | static struct hda_verb alc260_hp_3013_init_verbs[] = { | ||
| 5836 | /* Line out and output */ | ||
| 5837 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 5838 | /* mono output */ | ||
| 5839 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 5840 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ | ||
| 5841 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 5842 | /* Mic2 (front panel) pin widget for input and vref at 80% */ | ||
| 5843 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 5844 | /* Line In pin widget for input */ | ||
| 5845 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 5846 | /* Headphone pin widget for output */ | ||
| 5847 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 5848 | /* CD pin widget for input */ | ||
| 5849 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 5850 | /* unmute amp left and right */ | ||
| 5851 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, | ||
| 5852 | /* set connection select to line in (default select for this ADC) */ | ||
| 5853 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 5854 | /* unmute Line-Out mixer amp left and right (volume = 0) */ | ||
| 5855 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
| 5856 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
| 5857 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 5858 | /* unmute HP mixer amp left and right (volume = 0) */ | ||
| 5859 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | ||
| 5860 | /* mute pin widget amp left and right (no gain on this amp) */ | ||
| 5861 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 5862 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & | ||
| 5863 | * Line In 2 = 0x03 | ||
| 5864 | */ | ||
| 5865 | /* mute analog inputs */ | ||
| 5866 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5867 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5868 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 5869 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 5870 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 5871 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ | ||
| 5872 | /* Unmute Front out path */ | ||
| 5873 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5874 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5875 | /* Unmute Headphone out path */ | ||
| 5876 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5877 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5878 | /* Unmute Mono out path */ | ||
| 5879 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 5880 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 5881 | { } | ||
| 5882 | }; | ||
| 5883 | |||
| 5884 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x | ||
| 5885 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD | ||
| 5886 | * audio = 0x16, internal speaker = 0x10. | ||
| 5887 | */ | ||
| 5888 | static struct hda_verb alc260_fujitsu_init_verbs[] = { | ||
| 5889 | /* Disable all GPIOs */ | ||
| 5890 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, | ||
| 5891 | /* Internal speaker is connected to headphone pin */ | ||
| 5892 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 5893 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ | ||
| 5894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 5895 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ | ||
| 5896 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 5897 | /* Ensure all other unused pins are disabled and muted. */ | ||
| 5898 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5899 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5900 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5901 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5902 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5903 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5904 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5906 | |||
| 5907 | /* Disable digital (SPDIF) pins */ | ||
| 5908 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 5909 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 5910 | |||
| 5911 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | ||
| 5912 | * when acting as an output. | ||
| 5913 | */ | ||
| 5914 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 5915 | |||
| 5916 | /* Start with output sum widgets muted and their output gains at min */ | ||
| 5917 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5918 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5919 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5921 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5923 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5924 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 5925 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 5926 | |||
| 5927 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | ||
| 5928 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5929 | /* Unmute Line1 pin widget output buffer since it starts as an output. | ||
| 5930 | * If the pin mode is changed by the user the pin mode control will | ||
| 5931 | * take care of enabling the pin's input/output buffers as needed. | ||
| 5932 | * Therefore there's no need to enable the input buffer at this | ||
| 5933 | * stage. | ||
| 5934 | */ | ||
| 5935 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 5936 | /* Unmute input buffer of pin widget used for Line-in (no equiv | ||
| 5937 | * mixer ctrl) | ||
| 5938 | */ | ||
| 5939 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 5940 | |||
| 5941 | /* Mute capture amp left and right */ | ||
| 5942 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5943 | /* Set ADC connection select to match default mixer setting - line | ||
| 5944 | * in (on mic1 pin) | ||
| 5945 | */ | ||
| 5946 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 5947 | |||
| 5948 | /* Do the same for the second ADC: mute capture input amp and | ||
| 5949 | * set ADC connection to line in (on mic1 pin) | ||
| 5950 | */ | ||
| 5951 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5952 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 5953 | |||
| 5954 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
| 5955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
| 5956 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
| 5957 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
| 5958 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
| 5959 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
| 5960 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
| 5961 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
| 5962 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
| 5963 | |||
| 5964 | { } | ||
| 5965 | }; | ||
| 5966 | |||
| 5967 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and | ||
| 5968 | * similar laptops (adapted from Fujitsu init verbs). | ||
| 5969 | */ | ||
| 5970 | static struct hda_verb alc260_acer_init_verbs[] = { | ||
| 5971 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and | ||
| 5972 | * the headphone jack. Turn this on and rely on the standard mute | ||
| 5973 | * methods whenever the user wants to turn these outputs off. | ||
| 5974 | */ | ||
| 5975 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | ||
| 5976 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 5977 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
| 5978 | /* Internal speaker/Headphone jack is connected to Line-out pin */ | ||
| 5979 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 5980 | /* Internal microphone/Mic jack is connected to Mic1 pin */ | ||
| 5981 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 5982 | /* Line In jack is connected to Line1 pin */ | ||
| 5983 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 5984 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ | ||
| 5985 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 5986 | /* Ensure all other unused pins are disabled and muted. */ | ||
| 5987 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5988 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5989 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5990 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5991 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 5992 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 5993 | /* Disable digital (SPDIF) pins */ | ||
| 5994 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 5995 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 5996 | |||
| 5997 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | ||
| 5998 | * bus when acting as outputs. | ||
| 5999 | */ | ||
| 6000 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6001 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6002 | |||
| 6003 | /* Start with output sum widgets muted and their output gains at min */ | ||
| 6004 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6005 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6006 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6007 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6008 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6009 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6010 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6011 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6012 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6013 | |||
| 6014 | /* Unmute Line-out pin widget amp left and right | ||
| 6015 | * (no equiv mixer ctrl) | ||
| 6016 | */ | ||
| 6017 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6018 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ | ||
| 6019 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6020 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | ||
| 6021 | * inputs. If the pin mode is changed by the user the pin mode control | ||
| 6022 | * will take care of enabling the pin's input/output buffers as needed. | ||
| 6023 | * Therefore there's no need to enable the input buffer at this | ||
| 6024 | * stage. | ||
| 6025 | */ | ||
| 6026 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6027 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6028 | |||
| 6029 | /* Mute capture amp left and right */ | ||
| 6030 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6031 | /* Set ADC connection select to match default mixer setting - mic | ||
| 6032 | * (on mic1 pin) | ||
| 6033 | */ | ||
| 6034 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6035 | |||
| 6036 | /* Do similar with the second ADC: mute capture input amp and | ||
| 6037 | * set ADC connection to mic to match ALSA's default state. | ||
| 6038 | */ | ||
| 6039 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6040 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6041 | |||
| 6042 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
| 6043 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
| 6044 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
| 6045 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
| 6046 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
| 6047 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
| 6048 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
| 6049 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
| 6050 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
| 6051 | |||
| 6052 | { } | ||
| 6053 | }; | ||
| 6054 | |||
| 6055 | /* Initialisation sequence for Maxdata Favorit 100XS | ||
| 6056 | * (adapted from Acer init verbs). | ||
| 6057 | */ | ||
| 6058 | static struct hda_verb alc260_favorit100_init_verbs[] = { | ||
| 6059 | /* GPIO 0 enables the output jack. | ||
| 6060 | * Turn this on and rely on the standard mute | ||
| 6061 | * methods whenever the user wants to turn these outputs off. | ||
| 6062 | */ | ||
| 6063 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | ||
| 6064 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 6065 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
| 6066 | /* Line/Mic input jack is connected to Mic1 pin */ | ||
| 6067 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 6068 | /* Ensure all other unused pins are disabled and muted. */ | ||
| 6069 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 6070 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6071 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 6072 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6073 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 6074 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6075 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 6076 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
| 6078 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6079 | /* Disable digital (SPDIF) pins */ | ||
| 6080 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 6081 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 6082 | |||
| 6083 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | ||
| 6084 | * bus when acting as outputs. | ||
| 6085 | */ | ||
| 6086 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6087 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6088 | |||
| 6089 | /* Start with output sum widgets muted and their output gains at min */ | ||
| 6090 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6091 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6092 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6093 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6094 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6095 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6096 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6097 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6098 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6099 | |||
| 6100 | /* Unmute Line-out pin widget amp left and right | ||
| 6101 | * (no equiv mixer ctrl) | ||
| 6102 | */ | ||
| 6103 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6104 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | ||
| 6105 | * inputs. If the pin mode is changed by the user the pin mode control | ||
| 6106 | * will take care of enabling the pin's input/output buffers as needed. | ||
| 6107 | * Therefore there's no need to enable the input buffer at this | ||
| 6108 | * stage. | ||
| 6109 | */ | ||
| 6110 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6111 | |||
| 6112 | /* Mute capture amp left and right */ | ||
| 6113 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6114 | /* Set ADC connection select to match default mixer setting - mic | ||
| 6115 | * (on mic1 pin) | ||
| 6116 | */ | ||
| 6117 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6118 | |||
| 6119 | /* Do similar with the second ADC: mute capture input amp and | ||
| 6120 | * set ADC connection to mic to match ALSA's default state. | ||
| 6121 | */ | ||
| 6122 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6123 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6124 | |||
| 6125 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
| 6126 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
| 6127 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
| 6128 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
| 6129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
| 6130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
| 6131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
| 6132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
| 6133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
| 6134 | |||
| 6135 | { } | ||
| 6136 | }; | ||
| 6137 | |||
| 6138 | static struct hda_verb alc260_will_verbs[] = { | ||
| 6139 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 6140 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6141 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6142 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
| 6143 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 6144 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, | ||
| 6145 | {} | ||
| 6146 | }; | ||
| 6147 | |||
| 6148 | static struct hda_verb alc260_replacer_672v_verbs[] = { | ||
| 6149 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
| 6150 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 6151 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, | ||
| 6152 | |||
| 6153 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | ||
| 6154 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 6155 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | ||
| 6156 | |||
| 6157 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 6158 | {} | ||
| 6159 | }; | ||
| 6160 | |||
| 6161 | /* toggle speaker-output according to the hp-jack state */ | ||
| 6162 | static void alc260_replacer_672v_automute(struct hda_codec *codec) | ||
| 6163 | { | ||
| 6164 | unsigned int present; | ||
| 6165 | |||
| 6166 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ | ||
| 6167 | present = snd_hda_jack_detect(codec, 0x0f); | ||
| 6168 | if (present) { | ||
| 6169 | snd_hda_codec_write_cache(codec, 0x01, 0, | ||
| 6170 | AC_VERB_SET_GPIO_DATA, 1); | ||
| 6171 | snd_hda_codec_write_cache(codec, 0x0f, 0, | ||
| 6172 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 6173 | PIN_HP); | ||
| 6174 | } else { | ||
| 6175 | snd_hda_codec_write_cache(codec, 0x01, 0, | ||
| 6176 | AC_VERB_SET_GPIO_DATA, 0); | ||
| 6177 | snd_hda_codec_write_cache(codec, 0x0f, 0, | ||
| 6178 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 6179 | PIN_OUT); | ||
| 6180 | } | ||
| 6181 | } | ||
| 6182 | |||
| 6183 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | ||
| 6184 | unsigned int res) | ||
| 6185 | { | ||
| 6186 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 6187 | alc260_replacer_672v_automute(codec); | ||
| 6188 | } | ||
| 6189 | |||
| 6190 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | ||
| 6191 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 6192 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 6193 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6194 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 6195 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6196 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6197 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 6198 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 6199 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 6200 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 6201 | {} | ||
| 6202 | }; | ||
| 6203 | |||
| 6204 | /* Test configuration for debugging, modelled after the ALC880 test | ||
| 6205 | * configuration. | ||
| 6206 | */ | ||
| 6207 | #ifdef CONFIG_SND_DEBUG | ||
| 6208 | static hda_nid_t alc260_test_dac_nids[1] = { | ||
| 6209 | 0x02, | ||
| 6210 | }; | ||
| 6211 | static hda_nid_t alc260_test_adc_nids[2] = { | ||
| 6212 | 0x04, 0x05, | ||
| 6213 | }; | ||
| 6214 | /* For testing the ALC260, each input MUX needs its own definition since | ||
| 6215 | * the signal assignments are different. This assumes that the first ADC | ||
| 6216 | * is NID 0x04. | ||
| 6217 | */ | ||
| 6218 | static struct hda_input_mux alc260_test_capture_sources[2] = { | ||
| 6219 | { | ||
| 6220 | .num_items = 7, | ||
| 6221 | .items = { | ||
| 6222 | { "MIC1 pin", 0x0 }, | ||
| 6223 | { "MIC2 pin", 0x1 }, | ||
| 6224 | { "LINE1 pin", 0x2 }, | ||
| 6225 | { "LINE2 pin", 0x3 }, | ||
| 6226 | { "CD pin", 0x4 }, | ||
| 6227 | { "LINE-OUT pin", 0x5 }, | ||
| 6228 | { "HP-OUT pin", 0x6 }, | ||
| 6229 | }, | ||
| 6230 | }, | ||
| 6231 | { | ||
| 6232 | .num_items = 8, | ||
| 6233 | .items = { | ||
| 6234 | { "MIC1 pin", 0x0 }, | ||
| 6235 | { "MIC2 pin", 0x1 }, | ||
| 6236 | { "LINE1 pin", 0x2 }, | ||
| 6237 | { "LINE2 pin", 0x3 }, | ||
| 6238 | { "CD pin", 0x4 }, | ||
| 6239 | { "Mixer", 0x5 }, | ||
| 6240 | { "LINE-OUT pin", 0x6 }, | ||
| 6241 | { "HP-OUT pin", 0x7 }, | ||
| 6242 | }, | ||
| 6243 | }, | ||
| 6244 | }; | ||
| 6245 | static struct snd_kcontrol_new alc260_test_mixer[] = { | ||
| 6246 | /* Output driver widgets */ | ||
| 6247 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), | ||
| 6248 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), | ||
| 6249 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), | ||
| 6250 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), | ||
| 6251 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
| 6252 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), | ||
| 6253 | |||
| 6254 | /* Modes for retasking pin widgets | ||
| 6255 | * Note: the ALC260 doesn't seem to act on requests to enable mic | ||
| 6256 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't | ||
| 6257 | * mention this restriction. At this stage it's not clear whether | ||
| 6258 | * this behaviour is intentional or is a hardware bug in chip | ||
| 6259 | * revisions available at least up until early 2006. Therefore for | ||
| 6260 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all | ||
| 6261 | * choices, but if it turns out that the lack of mic bias for these | ||
| 6262 | * NIDs is intentional we could change their modes from | ||
| 6263 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. | ||
| 6264 | */ | ||
| 6265 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), | ||
| 6266 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), | ||
| 6267 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), | ||
| 6268 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 6269 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), | ||
| 6270 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), | ||
| 6271 | |||
| 6272 | /* Loopback mixer controls */ | ||
| 6273 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), | ||
| 6274 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), | ||
| 6275 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), | ||
| 6276 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), | ||
| 6277 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), | ||
| 6278 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), | ||
| 6279 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), | ||
| 6280 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | ||
| 6281 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | ||
| 6282 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | ||
| 6283 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | ||
| 6284 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | ||
| 6285 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | ||
| 6286 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), | ||
| 6287 | |||
| 6288 | /* Controls for GPIO pins, assuming they are configured as outputs */ | ||
| 6289 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | ||
| 6290 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | ||
| 6291 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | ||
| 6292 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | ||
| 6293 | |||
| 6294 | /* Switches to allow the digital IO pins to be enabled. The datasheet | ||
| 6295 | * is ambigious as to which NID is which; testing on laptops which | ||
| 6296 | * make this output available should provide clarification. | ||
| 6297 | */ | ||
| 6298 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | ||
| 6299 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | ||
| 6300 | |||
| 6301 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | ||
| 6302 | * this output to turn on an external amplifier. | ||
| 6303 | */ | ||
| 6304 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | ||
| 6305 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | ||
| 6306 | |||
| 6307 | { } /* end */ | ||
| 6308 | }; | ||
| 6309 | static struct hda_verb alc260_test_init_verbs[] = { | ||
| 6310 | /* Enable all GPIOs as outputs with an initial value of 0 */ | ||
| 6311 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, | ||
| 6312 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | ||
| 6313 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, | ||
| 6314 | |||
| 6315 | /* Enable retasking pins as output, initially without power amp */ | ||
| 6316 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6317 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6318 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6319 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6320 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6321 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 6322 | |||
| 6323 | /* Disable digital (SPDIF) pins initially, but users can enable | ||
| 6324 | * them via a mixer switch. In the case of SPDIF-out, this initverb | ||
| 6325 | * payload also sets the generation to 0, output to be in "consumer" | ||
| 6326 | * PCM format, copyright asserted, no pre-emphasis and no validity | ||
| 6327 | * control. | ||
| 6328 | */ | ||
| 6329 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 6330 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
| 6331 | |||
| 6332 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | ||
| 6333 | * OUT1 sum bus when acting as an output. | ||
| 6334 | */ | ||
| 6335 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6336 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6337 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6338 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, | ||
| 6339 | |||
| 6340 | /* Start with output sum widgets muted and their output gains at min */ | ||
| 6341 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6342 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6343 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6344 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6345 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6346 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6347 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6348 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6349 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6350 | |||
| 6351 | /* Unmute retasking pin widget output buffers since the default | ||
| 6352 | * state appears to be output. As the pin mode is changed by the | ||
| 6353 | * user the pin mode control will take care of enabling the pin's | ||
| 6354 | * input/output buffers as needed. | ||
| 6355 | */ | ||
| 6356 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6357 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6359 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6360 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6361 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6362 | /* Also unmute the mono-out pin widget */ | ||
| 6363 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 6364 | |||
| 6365 | /* Mute capture amp left and right */ | ||
| 6366 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6367 | /* Set ADC connection select to match default mixer setting (mic1 | ||
| 6368 | * pin) | ||
| 6369 | */ | ||
| 6370 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6371 | |||
| 6372 | /* Do the same for the second ADC: mute capture input amp and | ||
| 6373 | * set ADC connection to mic1 pin | ||
| 6374 | */ | ||
| 6375 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6376 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6377 | |||
| 6378 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
| 6379 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
| 6380 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
| 6381 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
| 6382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
| 6383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
| 6384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
| 6385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
| 6386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
| 6387 | |||
| 6388 | { } | ||
| 6389 | }; | ||
| 6390 | #endif | ||
| 6391 | |||
| 6392 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback | ||
| 6393 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture | ||
| 6394 | |||
| 6395 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback | ||
| 6396 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture | ||
| 6397 | |||
| 6398 | /* | ||
| 6399 | * for BIOS auto-configuration | ||
| 6400 | */ | ||
| 6401 | |||
| 6402 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | ||
| 6403 | const char *pfx, int *vol_bits) | ||
| 6404 | { | ||
| 6405 | hda_nid_t nid_vol; | ||
| 6406 | unsigned long vol_val, sw_val; | ||
| 6407 | int err; | ||
| 6408 | |||
| 6409 | if (nid >= 0x0f && nid < 0x11) { | ||
| 6410 | nid_vol = nid - 0x7; | ||
| 6411 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | ||
| 6412 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
| 6413 | } else if (nid == 0x11) { | ||
| 6414 | nid_vol = nid - 0x7; | ||
| 6415 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | ||
| 6416 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | ||
| 6417 | } else if (nid >= 0x12 && nid <= 0x15) { | ||
| 6418 | nid_vol = 0x08; | ||
| 6419 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | ||
| 6420 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
| 6421 | } else | ||
| 6422 | return 0; /* N/A */ | ||
| 6423 | |||
| 6424 | if (!(*vol_bits & (1 << nid_vol))) { | ||
| 6425 | /* first control for the volume widget */ | ||
| 6426 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val); | ||
| 6427 | if (err < 0) | ||
| 6428 | return err; | ||
| 6429 | *vol_bits |= (1 << nid_vol); | ||
| 6430 | } | ||
| 6431 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val); | ||
| 6432 | if (err < 0) | ||
| 6433 | return err; | ||
| 6434 | return 1; | ||
| 6435 | } | ||
| 6436 | |||
| 6437 | /* add playback controls from the parsed DAC table */ | ||
| 6438 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | ||
| 6439 | const struct auto_pin_cfg *cfg) | ||
| 6440 | { | ||
| 6441 | hda_nid_t nid; | ||
| 6442 | int err; | ||
| 6443 | int vols = 0; | ||
| 6444 | |||
| 6445 | spec->multiout.num_dacs = 1; | ||
| 6446 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 6447 | spec->multiout.dac_nids[0] = 0x02; | ||
| 6448 | |||
| 6449 | nid = cfg->line_out_pins[0]; | ||
| 6450 | if (nid) { | ||
| 6451 | const char *pfx; | ||
| 6452 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | ||
| 6453 | pfx = "Master"; | ||
| 6454 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 6455 | pfx = "Speaker"; | ||
| 6456 | else | ||
| 6457 | pfx = "Front"; | ||
| 6458 | err = alc260_add_playback_controls(spec, nid, pfx, &vols); | ||
| 6459 | if (err < 0) | ||
| 6460 | return err; | ||
| 6461 | } | ||
| 6462 | |||
| 6463 | nid = cfg->speaker_pins[0]; | ||
| 6464 | if (nid) { | ||
| 6465 | err = alc260_add_playback_controls(spec, nid, "Speaker", &vols); | ||
| 6466 | if (err < 0) | ||
| 6467 | return err; | ||
| 6468 | } | ||
| 6469 | |||
| 6470 | nid = cfg->hp_pins[0]; | ||
| 6471 | if (nid) { | ||
| 6472 | err = alc260_add_playback_controls(spec, nid, "Headphone", | ||
| 6473 | &vols); | ||
| 6474 | if (err < 0) | ||
| 6475 | return err; | ||
| 6476 | } | ||
| 6477 | return 0; | ||
| 6478 | } | ||
| 6479 | |||
| 6480 | /* create playback/capture controls for input pins */ | ||
| 6481 | static int alc260_auto_create_input_ctls(struct hda_codec *codec, | ||
| 6482 | const struct auto_pin_cfg *cfg) | ||
| 6483 | { | ||
| 6484 | return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05); | ||
| 6485 | } | ||
| 6486 | |||
| 6487 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 6488 | hda_nid_t nid, int pin_type, | ||
| 6489 | int sel_idx) | ||
| 6490 | { | ||
| 6491 | alc_set_pin_output(codec, nid, pin_type); | ||
| 6492 | /* need the manual connection? */ | ||
| 6493 | if (nid >= 0x12) { | ||
| 6494 | int idx = nid - 0x12; | ||
| 6495 | snd_hda_codec_write(codec, idx + 0x0b, 0, | ||
| 6496 | AC_VERB_SET_CONNECT_SEL, sel_idx); | ||
| 6497 | } | ||
| 6498 | } | ||
| 6499 | |||
| 6500 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | ||
| 6501 | { | ||
| 6502 | struct alc_spec *spec = codec->spec; | ||
| 6503 | hda_nid_t nid; | ||
| 6504 | |||
| 6505 | nid = spec->autocfg.line_out_pins[0]; | ||
| 6506 | if (nid) { | ||
| 6507 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 6508 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | ||
| 6509 | } | ||
| 6510 | |||
| 6511 | nid = spec->autocfg.speaker_pins[0]; | ||
| 6512 | if (nid) | ||
| 6513 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | ||
| 6514 | |||
| 6515 | nid = spec->autocfg.hp_pins[0]; | ||
| 6516 | if (nid) | ||
| 6517 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); | ||
| 6518 | } | ||
| 6519 | |||
| 6520 | #define ALC260_PIN_CD_NID 0x16 | ||
| 6521 | static void alc260_auto_init_analog_input(struct hda_codec *codec) | ||
| 6522 | { | ||
| 6523 | struct alc_spec *spec = codec->spec; | ||
| 6524 | int i; | ||
| 6525 | |||
| 6526 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 6527 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 6528 | if (nid >= 0x12) { | ||
| 6529 | alc_set_input_pin(codec, nid, i); | ||
| 6530 | if (nid != ALC260_PIN_CD_NID && | ||
| 6531 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | ||
| 6532 | snd_hda_codec_write(codec, nid, 0, | ||
| 6533 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 6534 | AMP_OUT_MUTE); | ||
| 6535 | } | ||
| 6536 | } | ||
| 6537 | } | ||
| 6538 | |||
| 6539 | #define alc260_auto_init_input_src alc880_auto_init_input_src | ||
| 6540 | |||
| 6541 | /* | ||
| 6542 | * generic initialization of ADC, input mixers and output mixers | ||
| 6543 | */ | ||
| 6544 | static struct hda_verb alc260_volume_init_verbs[] = { | ||
| 6545 | /* | ||
| 6546 | * Unmute ADC0-1 and set the default input to mic-in | ||
| 6547 | */ | ||
| 6548 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6549 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6550 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 6551 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6552 | |||
| 6553 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 6554 | * mixer widget | ||
| 6555 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
| 6556 | * front panel mic (mic 2) | ||
| 6557 | */ | ||
| 6558 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 6559 | /* mute analog inputs */ | ||
| 6560 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 6561 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 6562 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 6563 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 6564 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 6565 | |||
| 6566 | /* | ||
| 6567 | * Set up output mixers (0x08 - 0x0a) | ||
| 6568 | */ | ||
| 6569 | /* set vol=0 to output mixers */ | ||
| 6570 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6571 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6572 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 6573 | /* set up input amps for analog loopback */ | ||
| 6574 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 6575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 6577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6578 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 6579 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 6580 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 6581 | |||
| 6582 | { } | ||
| 6583 | }; | ||
| 6584 | |||
| 6585 | static int alc260_parse_auto_config(struct hda_codec *codec) | ||
| 6586 | { | ||
| 6587 | struct alc_spec *spec = codec->spec; | ||
| 6588 | int err; | ||
| 6589 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; | ||
| 6590 | |||
| 6591 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 6592 | alc260_ignore); | ||
| 6593 | if (err < 0) | ||
| 6594 | return err; | ||
| 6595 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 6596 | if (err < 0) | ||
| 6597 | return err; | ||
| 6598 | if (!spec->kctls.list) | ||
| 6599 | return 0; /* can't find valid BIOS pin config */ | ||
| 6600 | err = alc260_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 6601 | if (err < 0) | ||
| 6602 | return err; | ||
| 6603 | |||
| 6604 | spec->multiout.max_channels = 2; | ||
| 6605 | |||
| 6606 | if (spec->autocfg.dig_outs) | ||
| 6607 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | ||
| 6608 | if (spec->kctls.list) | ||
| 6609 | add_mixer(spec, spec->kctls.list); | ||
| 6610 | |||
| 6611 | add_verb(spec, alc260_volume_init_verbs); | ||
| 6612 | |||
| 6613 | spec->num_mux_defs = 1; | ||
| 6614 | spec->input_mux = &spec->private_imux[0]; | ||
| 6615 | |||
| 6616 | alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0); | ||
| 6617 | |||
| 6618 | return 1; | ||
| 6619 | } | ||
| 6620 | |||
| 6621 | /* additional initialization for auto-configuration model */ | ||
| 6622 | static void alc260_auto_init(struct hda_codec *codec) | ||
| 6623 | { | ||
| 6624 | struct alc_spec *spec = codec->spec; | ||
| 6625 | alc260_auto_init_multi_out(codec); | ||
| 6626 | alc260_auto_init_analog_input(codec); | ||
| 6627 | alc260_auto_init_input_src(codec); | ||
| 6628 | if (spec->unsol_event) | ||
| 6629 | alc_inithook(codec); | ||
| 6630 | } | ||
| 6631 | |||
| 6632 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 6633 | static struct hda_amp_list alc260_loopbacks[] = { | ||
| 6634 | { 0x07, HDA_INPUT, 0 }, | ||
| 6635 | { 0x07, HDA_INPUT, 1 }, | ||
| 6636 | { 0x07, HDA_INPUT, 2 }, | ||
| 6637 | { 0x07, HDA_INPUT, 3 }, | ||
| 6638 | { 0x07, HDA_INPUT, 4 }, | ||
| 6639 | { } /* end */ | ||
| 6640 | }; | ||
| 6641 | #endif | ||
| 6642 | |||
| 6643 | /* | ||
| 6644 | * ALC260 configurations | ||
| 6645 | */ | ||
| 6646 | static const char *alc260_models[ALC260_MODEL_LAST] = { | ||
| 6647 | [ALC260_BASIC] = "basic", | ||
| 6648 | [ALC260_HP] = "hp", | ||
| 6649 | [ALC260_HP_3013] = "hp-3013", | ||
| 6650 | [ALC260_HP_DC7600] = "hp-dc7600", | ||
| 6651 | [ALC260_FUJITSU_S702X] = "fujitsu", | ||
| 6652 | [ALC260_ACER] = "acer", | ||
| 6653 | [ALC260_WILL] = "will", | ||
| 6654 | [ALC260_REPLACER_672V] = "replacer", | ||
| 6655 | [ALC260_FAVORIT100] = "favorit100", | ||
| 6656 | #ifdef CONFIG_SND_DEBUG | ||
| 6657 | [ALC260_TEST] = "test", | ||
| 6658 | #endif | ||
| 6659 | [ALC260_AUTO] = "auto", | ||
| 6660 | }; | ||
| 6661 | |||
| 6662 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | ||
| 6663 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | ||
| 6664 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | ||
| 6665 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | ||
| 6666 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | ||
| 6667 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | ||
| 6668 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */ | ||
| 6669 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | ||
| 6670 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | ||
| 6671 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), | ||
| 6672 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | ||
| 6673 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | ||
| 6674 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | ||
| 6675 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), | ||
| 6676 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), | ||
| 6677 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), | ||
| 6678 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), | ||
| 6679 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), | ||
| 6680 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), | ||
| 6681 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), | ||
| 6682 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), | ||
| 6683 | {} | ||
| 6684 | }; | ||
| 6685 | |||
| 6686 | static struct alc_config_preset alc260_presets[] = { | ||
| 6687 | [ALC260_BASIC] = { | ||
| 6688 | .mixers = { alc260_base_output_mixer, | ||
| 6689 | alc260_input_mixer }, | ||
| 6690 | .init_verbs = { alc260_init_verbs }, | ||
| 6691 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6692 | .dac_nids = alc260_dac_nids, | ||
| 6693 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | ||
| 6694 | .adc_nids = alc260_dual_adc_nids, | ||
| 6695 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6696 | .channel_mode = alc260_modes, | ||
| 6697 | .input_mux = &alc260_capture_source, | ||
| 6698 | }, | ||
| 6699 | [ALC260_HP] = { | ||
| 6700 | .mixers = { alc260_hp_output_mixer, | ||
| 6701 | alc260_input_mixer }, | ||
| 6702 | .init_verbs = { alc260_init_verbs, | ||
| 6703 | alc260_hp_unsol_verbs }, | ||
| 6704 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6705 | .dac_nids = alc260_dac_nids, | ||
| 6706 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
| 6707 | .adc_nids = alc260_adc_nids_alt, | ||
| 6708 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6709 | .channel_mode = alc260_modes, | ||
| 6710 | .input_mux = &alc260_capture_source, | ||
| 6711 | .unsol_event = alc260_hp_unsol_event, | ||
| 6712 | .init_hook = alc260_hp_automute, | ||
| 6713 | }, | ||
| 6714 | [ALC260_HP_DC7600] = { | ||
| 6715 | .mixers = { alc260_hp_dc7600_mixer, | ||
| 6716 | alc260_input_mixer }, | ||
| 6717 | .init_verbs = { alc260_init_verbs, | ||
| 6718 | alc260_hp_dc7600_verbs }, | ||
| 6719 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6720 | .dac_nids = alc260_dac_nids, | ||
| 6721 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
| 6722 | .adc_nids = alc260_adc_nids_alt, | ||
| 6723 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6724 | .channel_mode = alc260_modes, | ||
| 6725 | .input_mux = &alc260_capture_source, | ||
| 6726 | .unsol_event = alc260_hp_3012_unsol_event, | ||
| 6727 | .init_hook = alc260_hp_3012_automute, | ||
| 6728 | }, | ||
| 6729 | [ALC260_HP_3013] = { | ||
| 6730 | .mixers = { alc260_hp_3013_mixer, | ||
| 6731 | alc260_input_mixer }, | ||
| 6732 | .init_verbs = { alc260_hp_3013_init_verbs, | ||
| 6733 | alc260_hp_3013_unsol_verbs }, | ||
| 6734 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6735 | .dac_nids = alc260_dac_nids, | ||
| 6736 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt), | ||
| 6737 | .adc_nids = alc260_adc_nids_alt, | ||
| 6738 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6739 | .channel_mode = alc260_modes, | ||
| 6740 | .input_mux = &alc260_capture_source, | ||
| 6741 | .unsol_event = alc260_hp_3013_unsol_event, | ||
| 6742 | .init_hook = alc260_hp_3013_automute, | ||
| 6743 | }, | ||
| 6744 | [ALC260_FUJITSU_S702X] = { | ||
| 6745 | .mixers = { alc260_fujitsu_mixer }, | ||
| 6746 | .init_verbs = { alc260_fujitsu_init_verbs }, | ||
| 6747 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6748 | .dac_nids = alc260_dac_nids, | ||
| 6749 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | ||
| 6750 | .adc_nids = alc260_dual_adc_nids, | ||
| 6751 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6752 | .channel_mode = alc260_modes, | ||
| 6753 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), | ||
| 6754 | .input_mux = alc260_fujitsu_capture_sources, | ||
| 6755 | }, | ||
| 6756 | [ALC260_ACER] = { | ||
| 6757 | .mixers = { alc260_acer_mixer }, | ||
| 6758 | .init_verbs = { alc260_acer_init_verbs }, | ||
| 6759 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6760 | .dac_nids = alc260_dac_nids, | ||
| 6761 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | ||
| 6762 | .adc_nids = alc260_dual_adc_nids, | ||
| 6763 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6764 | .channel_mode = alc260_modes, | ||
| 6765 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), | ||
| 6766 | .input_mux = alc260_acer_capture_sources, | ||
| 6767 | }, | ||
| 6768 | [ALC260_FAVORIT100] = { | ||
| 6769 | .mixers = { alc260_favorit100_mixer }, | ||
| 6770 | .init_verbs = { alc260_favorit100_init_verbs }, | ||
| 6771 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6772 | .dac_nids = alc260_dac_nids, | ||
| 6773 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | ||
| 6774 | .adc_nids = alc260_dual_adc_nids, | ||
| 6775 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6776 | .channel_mode = alc260_modes, | ||
| 6777 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | ||
| 6778 | .input_mux = alc260_favorit100_capture_sources, | ||
| 6779 | }, | ||
| 6780 | [ALC260_WILL] = { | ||
| 6781 | .mixers = { alc260_will_mixer }, | ||
| 6782 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | ||
| 6783 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6784 | .dac_nids = alc260_dac_nids, | ||
| 6785 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | ||
| 6786 | .adc_nids = alc260_adc_nids, | ||
| 6787 | .dig_out_nid = ALC260_DIGOUT_NID, | ||
| 6788 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6789 | .channel_mode = alc260_modes, | ||
| 6790 | .input_mux = &alc260_capture_source, | ||
| 6791 | }, | ||
| 6792 | [ALC260_REPLACER_672V] = { | ||
| 6793 | .mixers = { alc260_replacer_672v_mixer }, | ||
| 6794 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, | ||
| 6795 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
| 6796 | .dac_nids = alc260_dac_nids, | ||
| 6797 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), | ||
| 6798 | .adc_nids = alc260_adc_nids, | ||
| 6799 | .dig_out_nid = ALC260_DIGOUT_NID, | ||
| 6800 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6801 | .channel_mode = alc260_modes, | ||
| 6802 | .input_mux = &alc260_capture_source, | ||
| 6803 | .unsol_event = alc260_replacer_672v_unsol_event, | ||
| 6804 | .init_hook = alc260_replacer_672v_automute, | ||
| 6805 | }, | ||
| 6806 | #ifdef CONFIG_SND_DEBUG | ||
| 6807 | [ALC260_TEST] = { | ||
| 6808 | .mixers = { alc260_test_mixer }, | ||
| 6809 | .init_verbs = { alc260_test_init_verbs }, | ||
| 6810 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), | ||
| 6811 | .dac_nids = alc260_test_dac_nids, | ||
| 6812 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), | ||
| 6813 | .adc_nids = alc260_test_adc_nids, | ||
| 6814 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
| 6815 | .channel_mode = alc260_modes, | ||
| 6816 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), | ||
| 6817 | .input_mux = alc260_test_capture_sources, | ||
| 6818 | }, | ||
| 6819 | #endif | ||
| 6820 | }; | ||
| 6821 | |||
| 6822 | static int patch_alc260(struct hda_codec *codec) | ||
| 6823 | { | ||
| 6824 | struct alc_spec *spec; | ||
| 6825 | int err, board_config; | ||
| 6826 | |||
| 6827 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 6828 | if (spec == NULL) | ||
| 6829 | return -ENOMEM; | ||
| 6830 | |||
| 6831 | codec->spec = spec; | ||
| 6832 | |||
| 6833 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, | ||
| 6834 | alc260_models, | ||
| 6835 | alc260_cfg_tbl); | ||
| 6836 | if (board_config < 0) { | ||
| 6837 | snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 6838 | codec->chip_name); | ||
| 6839 | board_config = ALC260_AUTO; | ||
| 6840 | } | ||
| 6841 | |||
| 6842 | if (board_config == ALC260_AUTO) { | ||
| 6843 | /* automatic parse from the BIOS config */ | ||
| 6844 | err = alc260_parse_auto_config(codec); | ||
| 6845 | if (err < 0) { | ||
| 6846 | alc_free(codec); | ||
| 6847 | return err; | ||
| 6848 | } else if (!err) { | ||
| 6849 | printk(KERN_INFO | ||
| 6850 | "hda_codec: Cannot set up configuration " | ||
| 6851 | "from BIOS. Using base mode...\n"); | ||
| 6852 | board_config = ALC260_BASIC; | ||
| 6853 | } | ||
| 6854 | } | ||
| 6855 | |||
| 6856 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 6857 | if (err < 0) { | ||
| 6858 | alc_free(codec); | ||
| 6859 | return err; | ||
| 6860 | } | ||
| 6861 | |||
| 6862 | if (board_config != ALC260_AUTO) | ||
| 6863 | setup_preset(codec, &alc260_presets[board_config]); | ||
| 6864 | |||
| 6865 | spec->stream_analog_playback = &alc260_pcm_analog_playback; | ||
| 6866 | spec->stream_analog_capture = &alc260_pcm_analog_capture; | ||
| 6867 | spec->stream_analog_alt_capture = &alc260_pcm_analog_capture; | ||
| 6868 | |||
| 6869 | spec->stream_digital_playback = &alc260_pcm_digital_playback; | ||
| 6870 | spec->stream_digital_capture = &alc260_pcm_digital_capture; | ||
| 6871 | |||
| 6872 | if (!spec->adc_nids && spec->input_mux) { | ||
| 6873 | /* check whether NID 0x04 is valid */ | ||
| 6874 | unsigned int wcap = get_wcaps(codec, 0x04); | ||
| 6875 | wcap = get_wcaps_type(wcap); | ||
| 6876 | /* get type */ | ||
| 6877 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | ||
| 6878 | spec->adc_nids = alc260_adc_nids_alt; | ||
| 6879 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); | ||
| 6880 | } else { | ||
| 6881 | spec->adc_nids = alc260_adc_nids; | ||
| 6882 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); | ||
| 6883 | } | ||
| 6884 | } | ||
| 6885 | set_capture_mixer(codec); | ||
| 6886 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | ||
| 6887 | |||
| 6888 | spec->vmaster_nid = 0x08; | ||
| 6889 | |||
| 6890 | codec->patch_ops = alc_patch_ops; | ||
| 6891 | if (board_config == ALC260_AUTO) | ||
| 6892 | spec->init_hook = alc260_auto_init; | ||
| 6893 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 6894 | if (!spec->loopback.amplist) | ||
| 6895 | spec->loopback.amplist = alc260_loopbacks; | ||
| 6896 | #endif | ||
| 6897 | |||
| 6898 | return 0; | ||
| 6899 | } | ||
| 6900 | |||
| 6901 | |||
| 6902 | /* | ||
| 6903 | * ALC882/883/885/888/889 support | ||
| 6904 | * | ||
| 6905 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | ||
| 6906 | * configuration. Each pin widget can choose any input DACs and a mixer. | ||
| 6907 | * Each ADC is connected from a mixer of all inputs. This makes possible | ||
| 6908 | * 6-channel independent captures. | ||
| 6909 | * | ||
| 6910 | * In addition, an independent DAC for the multi-playback (not used in this | ||
| 6911 | * driver yet). | ||
| 6912 | */ | ||
| 6913 | #define ALC882_DIGOUT_NID 0x06 | ||
| 6914 | #define ALC882_DIGIN_NID 0x0a | ||
| 6915 | #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID | ||
| 6916 | #define ALC883_DIGIN_NID ALC882_DIGIN_NID | ||
| 6917 | #define ALC1200_DIGOUT_NID 0x10 | ||
| 6918 | |||
| 6919 | |||
| 6920 | static struct hda_channel_mode alc882_ch_modes[1] = { | ||
| 6921 | { 8, NULL } | ||
| 6922 | }; | ||
| 6923 | |||
| 6924 | /* DACs */ | ||
| 6925 | static hda_nid_t alc882_dac_nids[4] = { | ||
| 6926 | /* front, rear, clfe, rear_surr */ | ||
| 6927 | 0x02, 0x03, 0x04, 0x05 | ||
| 6928 | }; | ||
| 6929 | #define alc883_dac_nids alc882_dac_nids | ||
| 6930 | |||
| 6931 | /* ADCs */ | ||
| 6932 | #define alc882_adc_nids alc880_adc_nids | ||
| 6933 | #define alc882_adc_nids_alt alc880_adc_nids_alt | ||
| 6934 | #define alc883_adc_nids alc882_adc_nids_alt | ||
| 6935 | static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 }; | ||
| 6936 | static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 }; | ||
| 6937 | #define alc889_adc_nids alc880_adc_nids | ||
| 6938 | |||
| 6939 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | ||
| 6940 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | ||
| 6941 | #define alc883_capsrc_nids alc882_capsrc_nids_alt | ||
| 6942 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | ||
| 6943 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
| 6944 | |||
| 6945 | /* input MUX */ | ||
| 6946 | /* FIXME: should be a matrix-type input source selection */ | ||
| 6947 | |||
| 6948 | static struct hda_input_mux alc882_capture_source = { | ||
| 6949 | .num_items = 4, | ||
| 6950 | .items = { | ||
| 6951 | { "Mic", 0x0 }, | ||
| 6952 | { "Front Mic", 0x1 }, | ||
| 6953 | { "Line", 0x2 }, | ||
| 6954 | { "CD", 0x4 }, | ||
| 6955 | }, | ||
| 6956 | }; | ||
| 6957 | |||
| 6958 | #define alc883_capture_source alc882_capture_source | ||
| 6959 | |||
| 6960 | static struct hda_input_mux alc889_capture_source = { | ||
| 6961 | .num_items = 3, | ||
| 6962 | .items = { | ||
| 6963 | { "Front Mic", 0x0 }, | ||
| 6964 | { "Mic", 0x3 }, | ||
| 6965 | { "Line", 0x2 }, | ||
| 6966 | }, | ||
| 6967 | }; | ||
| 6968 | |||
| 6969 | static struct hda_input_mux mb5_capture_source = { | ||
| 6970 | .num_items = 3, | ||
| 6971 | .items = { | ||
| 6972 | { "Mic", 0x1 }, | ||
| 6973 | { "Line", 0x7 }, | ||
| 6974 | { "CD", 0x4 }, | ||
| 6975 | }, | ||
| 6976 | }; | ||
| 6977 | |||
| 6978 | static struct hda_input_mux macmini3_capture_source = { | ||
| 6979 | .num_items = 2, | ||
| 6980 | .items = { | ||
| 6981 | { "Line", 0x2 }, | ||
| 6982 | { "CD", 0x4 }, | ||
| 6983 | }, | ||
| 6984 | }; | ||
| 6985 | |||
| 6986 | static struct hda_input_mux alc883_3stack_6ch_intel = { | ||
| 6987 | .num_items = 4, | ||
| 6988 | .items = { | ||
| 6989 | { "Mic", 0x1 }, | ||
| 6990 | { "Front Mic", 0x0 }, | ||
| 6991 | { "Line", 0x2 }, | ||
| 6992 | { "CD", 0x4 }, | ||
| 6993 | }, | ||
| 6994 | }; | ||
| 6995 | |||
| 6996 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { | ||
| 6997 | .num_items = 2, | ||
| 6998 | .items = { | ||
| 6999 | { "Mic", 0x1 }, | ||
| 7000 | { "Line", 0x2 }, | ||
| 7001 | }, | ||
| 7002 | }; | ||
| 7003 | |||
| 7004 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | ||
| 7005 | .num_items = 4, | ||
| 7006 | .items = { | ||
| 7007 | { "Mic", 0x0 }, | ||
| 7008 | { "Int Mic", 0x1 }, | ||
| 7009 | { "Line", 0x2 }, | ||
| 7010 | { "CD", 0x4 }, | ||
| 7011 | }, | ||
| 7012 | }; | ||
| 7013 | |||
| 7014 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | ||
| 7015 | .num_items = 2, | ||
| 7016 | .items = { | ||
| 7017 | { "Mic", 0x0 }, | ||
| 7018 | { "Int Mic", 0x1 }, | ||
| 7019 | }, | ||
| 7020 | }; | ||
| 7021 | |||
| 7022 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
| 7023 | .num_items = 3, | ||
| 7024 | .items = { | ||
| 7025 | { "Mic", 0x0 }, | ||
| 7026 | { "Front Mic", 0x1 }, | ||
| 7027 | { "Line", 0x4 }, | ||
| 7028 | }, | ||
| 7029 | }; | ||
| 7030 | |||
| 7031 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
| 7032 | .num_items = 2, | ||
| 7033 | .items = { | ||
| 7034 | { "Mic", 0x0 }, | ||
| 7035 | { "Line", 0x2 }, | ||
| 7036 | }, | ||
| 7037 | }; | ||
| 7038 | |||
| 7039 | static struct hda_input_mux alc889A_mb31_capture_source = { | ||
| 7040 | .num_items = 2, | ||
| 7041 | .items = { | ||
| 7042 | { "Mic", 0x0 }, | ||
| 7043 | /* Front Mic (0x01) unused */ | ||
| 7044 | { "Line", 0x2 }, | ||
| 7045 | /* Line 2 (0x03) unused */ | ||
| 7046 | /* CD (0x04) unused? */ | ||
| 7047 | }, | ||
| 7048 | }; | ||
| 7049 | |||
| 7050 | static struct hda_input_mux alc889A_imac91_capture_source = { | ||
| 7051 | .num_items = 2, | ||
| 7052 | .items = { | ||
| 7053 | { "Mic", 0x01 }, | ||
| 7054 | { "Line", 0x2 }, /* Not sure! */ | ||
| 7055 | }, | ||
| 7056 | }; | ||
| 7057 | |||
| 7058 | /* | ||
| 7059 | * 2ch mode | ||
| 7060 | */ | ||
| 7061 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { | ||
| 7062 | { 2, NULL } | ||
| 7063 | }; | ||
| 7064 | |||
| 7065 | /* | ||
| 7066 | * 2ch mode | ||
| 7067 | */ | ||
| 7068 | static struct hda_verb alc882_3ST_ch2_init[] = { | ||
| 7069 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7070 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7071 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7072 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7073 | { } /* end */ | ||
| 7074 | }; | ||
| 7075 | |||
| 7076 | /* | ||
| 7077 | * 4ch mode | ||
| 7078 | */ | ||
| 7079 | static struct hda_verb alc882_3ST_ch4_init[] = { | ||
| 7080 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7081 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7082 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7083 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7084 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7085 | { } /* end */ | ||
| 7086 | }; | ||
| 7087 | |||
| 7088 | /* | ||
| 7089 | * 6ch mode | ||
| 7090 | */ | ||
| 7091 | static struct hda_verb alc882_3ST_ch6_init[] = { | ||
| 7092 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7093 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7094 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7095 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7096 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7097 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7098 | { } /* end */ | ||
| 7099 | }; | ||
| 7100 | |||
| 7101 | static struct hda_channel_mode alc882_3ST_6ch_modes[3] = { | ||
| 7102 | { 2, alc882_3ST_ch2_init }, | ||
| 7103 | { 4, alc882_3ST_ch4_init }, | ||
| 7104 | { 6, alc882_3ST_ch6_init }, | ||
| 7105 | }; | ||
| 7106 | |||
| 7107 | #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes | ||
| 7108 | |||
| 7109 | /* | ||
| 7110 | * 2ch mode | ||
| 7111 | */ | ||
| 7112 | static struct hda_verb alc883_3ST_ch2_clevo_init[] = { | ||
| 7113 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | ||
| 7114 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7115 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7116 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7117 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7118 | { } /* end */ | ||
| 7119 | }; | ||
| 7120 | |||
| 7121 | /* | ||
| 7122 | * 4ch mode | ||
| 7123 | */ | ||
| 7124 | static struct hda_verb alc883_3ST_ch4_clevo_init[] = { | ||
| 7125 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7126 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7127 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7128 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7129 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7130 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7131 | { } /* end */ | ||
| 7132 | }; | ||
| 7133 | |||
| 7134 | /* | ||
| 7135 | * 6ch mode | ||
| 7136 | */ | ||
| 7137 | static struct hda_verb alc883_3ST_ch6_clevo_init[] = { | ||
| 7138 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7139 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7140 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7141 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7142 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7143 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7144 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7145 | { } /* end */ | ||
| 7146 | }; | ||
| 7147 | |||
| 7148 | static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = { | ||
| 7149 | { 2, alc883_3ST_ch2_clevo_init }, | ||
| 7150 | { 4, alc883_3ST_ch4_clevo_init }, | ||
| 7151 | { 6, alc883_3ST_ch6_clevo_init }, | ||
| 7152 | }; | ||
| 7153 | |||
| 7154 | |||
| 7155 | /* | ||
| 7156 | * 6ch mode | ||
| 7157 | */ | ||
| 7158 | static struct hda_verb alc882_sixstack_ch6_init[] = { | ||
| 7159 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 7160 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7161 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7162 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7163 | { } /* end */ | ||
| 7164 | }; | ||
| 7165 | |||
| 7166 | /* | ||
| 7167 | * 8ch mode | ||
| 7168 | */ | ||
| 7169 | static struct hda_verb alc882_sixstack_ch8_init[] = { | ||
| 7170 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7171 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7172 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7173 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7174 | { } /* end */ | ||
| 7175 | }; | ||
| 7176 | |||
| 7177 | static struct hda_channel_mode alc882_sixstack_modes[2] = { | ||
| 7178 | { 6, alc882_sixstack_ch6_init }, | ||
| 7179 | { 8, alc882_sixstack_ch8_init }, | ||
| 7180 | }; | ||
| 7181 | |||
| 7182 | |||
| 7183 | /* Macbook Air 2,1 */ | ||
| 7184 | |||
| 7185 | static struct hda_channel_mode alc885_mba21_ch_modes[1] = { | ||
| 7186 | { 2, NULL }, | ||
| 7187 | }; | ||
| 7188 | |||
| 7189 | /* | ||
| 7190 | * macbook pro ALC885 can switch LineIn to LineOut without losing Mic | ||
| 7191 | */ | ||
| 7192 | |||
| 7193 | /* | ||
| 7194 | * 2ch mode | ||
| 7195 | */ | ||
| 7196 | static struct hda_verb alc885_mbp_ch2_init[] = { | ||
| 7197 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7198 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7199 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7200 | { } /* end */ | ||
| 7201 | }; | ||
| 7202 | |||
| 7203 | /* | ||
| 7204 | * 4ch mode | ||
| 7205 | */ | ||
| 7206 | static struct hda_verb alc885_mbp_ch4_init[] = { | ||
| 7207 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7208 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7209 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7210 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7211 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7212 | { } /* end */ | ||
| 7213 | }; | ||
| 7214 | |||
| 7215 | static struct hda_channel_mode alc885_mbp_4ch_modes[2] = { | ||
| 7216 | { 2, alc885_mbp_ch2_init }, | ||
| 7217 | { 4, alc885_mbp_ch4_init }, | ||
| 7218 | }; | ||
| 7219 | |||
| 7220 | /* | ||
| 7221 | * 2ch | ||
| 7222 | * Speakers/Woofer/HP = Front | ||
| 7223 | * LineIn = Input | ||
| 7224 | */ | ||
| 7225 | static struct hda_verb alc885_mb5_ch2_init[] = { | ||
| 7226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7227 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7228 | { } /* end */ | ||
| 7229 | }; | ||
| 7230 | |||
| 7231 | /* | ||
| 7232 | * 6ch mode | ||
| 7233 | * Speakers/HP = Front | ||
| 7234 | * Woofer = LFE | ||
| 7235 | * LineIn = Surround | ||
| 7236 | */ | ||
| 7237 | static struct hda_verb alc885_mb5_ch6_init[] = { | ||
| 7238 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7239 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7240 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 7241 | { } /* end */ | ||
| 7242 | }; | ||
| 7243 | |||
| 7244 | static struct hda_channel_mode alc885_mb5_6ch_modes[2] = { | ||
| 7245 | { 2, alc885_mb5_ch2_init }, | ||
| 7246 | { 6, alc885_mb5_ch6_init }, | ||
| 7247 | }; | ||
| 7248 | |||
| 7249 | #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes | ||
| 7250 | |||
| 7251 | /* | ||
| 7252 | * 2ch mode | ||
| 7253 | */ | ||
| 7254 | static struct hda_verb alc883_4ST_ch2_init[] = { | ||
| 7255 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7256 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7257 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7258 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7259 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7260 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7261 | { } /* end */ | ||
| 7262 | }; | ||
| 7263 | |||
| 7264 | /* | ||
| 7265 | * 4ch mode | ||
| 7266 | */ | ||
| 7267 | static struct hda_verb alc883_4ST_ch4_init[] = { | ||
| 7268 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7269 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7270 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7271 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7272 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7273 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7274 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7275 | { } /* end */ | ||
| 7276 | }; | ||
| 7277 | |||
| 7278 | /* | ||
| 7279 | * 6ch mode | ||
| 7280 | */ | ||
| 7281 | static struct hda_verb alc883_4ST_ch6_init[] = { | ||
| 7282 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7283 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7284 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7285 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7286 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7287 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7288 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7289 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7290 | { } /* end */ | ||
| 7291 | }; | ||
| 7292 | |||
| 7293 | /* | ||
| 7294 | * 8ch mode | ||
| 7295 | */ | ||
| 7296 | static struct hda_verb alc883_4ST_ch8_init[] = { | ||
| 7297 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7298 | { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7299 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
| 7300 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7301 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7302 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7303 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7304 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7305 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7306 | { } /* end */ | ||
| 7307 | }; | ||
| 7308 | |||
| 7309 | static struct hda_channel_mode alc883_4ST_8ch_modes[4] = { | ||
| 7310 | { 2, alc883_4ST_ch2_init }, | ||
| 7311 | { 4, alc883_4ST_ch4_init }, | ||
| 7312 | { 6, alc883_4ST_ch6_init }, | ||
| 7313 | { 8, alc883_4ST_ch8_init }, | ||
| 7314 | }; | ||
| 7315 | |||
| 7316 | |||
| 7317 | /* | ||
| 7318 | * 2ch mode | ||
| 7319 | */ | ||
| 7320 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { | ||
| 7321 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7322 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7323 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7324 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7325 | { } /* end */ | ||
| 7326 | }; | ||
| 7327 | |||
| 7328 | /* | ||
| 7329 | * 4ch mode | ||
| 7330 | */ | ||
| 7331 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { | ||
| 7332 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 7333 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7334 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7335 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7336 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7337 | { } /* end */ | ||
| 7338 | }; | ||
| 7339 | |||
| 7340 | /* | ||
| 7341 | * 6ch mode | ||
| 7342 | */ | ||
| 7343 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { | ||
| 7344 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7345 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7346 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7347 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7348 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7349 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7350 | { } /* end */ | ||
| 7351 | }; | ||
| 7352 | |||
| 7353 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { | ||
| 7354 | { 2, alc883_3ST_ch2_intel_init }, | ||
| 7355 | { 4, alc883_3ST_ch4_intel_init }, | ||
| 7356 | { 6, alc883_3ST_ch6_intel_init }, | ||
| 7357 | }; | ||
| 7358 | |||
| 7359 | /* | ||
| 7360 | * 2ch mode | ||
| 7361 | */ | ||
| 7362 | static struct hda_verb alc889_ch2_intel_init[] = { | ||
| 7363 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7364 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7365 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7366 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7367 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7368 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7369 | { } /* end */ | ||
| 7370 | }; | ||
| 7371 | |||
| 7372 | /* | ||
| 7373 | * 6ch mode | ||
| 7374 | */ | ||
| 7375 | static struct hda_verb alc889_ch6_intel_init[] = { | ||
| 7376 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7377 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7378 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7379 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
| 7380 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 7381 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 7382 | { } /* end */ | ||
| 7383 | }; | ||
| 7384 | |||
| 7385 | /* | ||
| 7386 | * 8ch mode | ||
| 7387 | */ | ||
| 7388 | static struct hda_verb alc889_ch8_intel_init[] = { | ||
| 7389 | { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 7390 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 7391 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 7392 | { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
| 7393 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 }, | ||
| 7394 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7395 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 7396 | { } /* end */ | ||
| 7397 | }; | ||
| 7398 | |||
| 7399 | static struct hda_channel_mode alc889_8ch_intel_modes[3] = { | ||
| 7400 | { 2, alc889_ch2_intel_init }, | ||
| 7401 | { 6, alc889_ch6_intel_init }, | ||
| 7402 | { 8, alc889_ch8_intel_init }, | ||
| 7403 | }; | ||
| 7404 | |||
| 7405 | /* | ||
| 7406 | * 6ch mode | ||
| 7407 | */ | ||
| 7408 | static struct hda_verb alc883_sixstack_ch6_init[] = { | ||
| 7409 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 7410 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7411 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7412 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7413 | { } /* end */ | ||
| 7414 | }; | ||
| 7415 | |||
| 7416 | /* | ||
| 7417 | * 8ch mode | ||
| 7418 | */ | ||
| 7419 | static struct hda_verb alc883_sixstack_ch8_init[] = { | ||
| 7420 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7421 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7422 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7423 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 7424 | { } /* end */ | ||
| 7425 | }; | ||
| 7426 | |||
| 7427 | static struct hda_channel_mode alc883_sixstack_modes[2] = { | ||
| 7428 | { 6, alc883_sixstack_ch6_init }, | ||
| 7429 | { 8, alc883_sixstack_ch8_init }, | ||
| 7430 | }; | ||
| 7431 | |||
| 7432 | |||
| 7433 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
| 7434 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
| 7435 | */ | ||
| 7436 | static struct snd_kcontrol_new alc882_base_mixer[] = { | ||
| 7437 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7438 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 7439 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 7440 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 7441 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 7442 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 7443 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 7444 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 7445 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 7446 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 7447 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 7448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 7449 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 7450 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7451 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7452 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 7453 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 7454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 7455 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 7456 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 7457 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 7458 | { } /* end */ | ||
| 7459 | }; | ||
| 7460 | |||
| 7461 | /* Macbook Air 2,1 same control for HP and internal Speaker */ | ||
| 7462 | |||
| 7463 | static struct snd_kcontrol_new alc885_mba21_mixer[] = { | ||
| 7464 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 7465 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), | ||
| 7466 | { } | ||
| 7467 | }; | ||
| 7468 | |||
| 7469 | |||
| 7470 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { | ||
| 7471 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 7472 | HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
| 7473 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | ||
| 7474 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT), | ||
| 7475 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
| 7476 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7477 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7478 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | ||
| 7479 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | ||
| 7480 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | ||
| 7481 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | ||
| 7482 | { } /* end */ | ||
| 7483 | }; | ||
| 7484 | |||
| 7485 | static struct snd_kcontrol_new alc885_mb5_mixer[] = { | ||
| 7486 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 7487 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
| 7488 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
| 7489 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | ||
| 7490 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | ||
| 7491 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | ||
| 7492 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | ||
| 7493 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | ||
| 7494 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | ||
| 7495 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | ||
| 7496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 7497 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 7498 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | ||
| 7499 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT), | ||
| 7500 | { } /* end */ | ||
| 7501 | }; | ||
| 7502 | |||
| 7503 | static struct snd_kcontrol_new alc885_macmini3_mixer[] = { | ||
| 7504 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 7505 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
| 7506 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
| 7507 | HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | ||
| 7508 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), | ||
| 7509 | HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), | ||
| 7510 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), | ||
| 7511 | HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), | ||
| 7512 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), | ||
| 7513 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), | ||
| 7514 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), | ||
| 7515 | { } /* end */ | ||
| 7516 | }; | ||
| 7517 | |||
| 7518 | static struct snd_kcontrol_new alc885_imac91_mixer[] = { | ||
| 7519 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 7520 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
| 7521 | { } /* end */ | ||
| 7522 | }; | ||
| 7523 | |||
| 7524 | |||
| 7525 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | ||
| 7526 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7527 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 7528 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 7529 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 7530 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7531 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7532 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 7533 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 7534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 7535 | { } /* end */ | ||
| 7536 | }; | ||
| 7537 | |||
| 7538 | static struct snd_kcontrol_new alc882_targa_mixer[] = { | ||
| 7539 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7540 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 7541 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 7542 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 7543 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 7544 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7545 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 7547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 7548 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 7549 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 7550 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 7551 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 7552 | { } /* end */ | ||
| 7553 | }; | ||
| 7554 | |||
| 7555 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? | ||
| 7556 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c | ||
| 7557 | */ | ||
| 7558 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { | ||
| 7559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7560 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 7561 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 7562 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), | ||
| 7563 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 7564 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 7565 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7566 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7567 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), | ||
| 7568 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), | ||
| 7569 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 7570 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 7571 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 7572 | { } /* end */ | ||
| 7573 | }; | ||
| 7574 | |||
| 7575 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | ||
| 7576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7577 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 7578 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 7579 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 7580 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 7581 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7582 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 7584 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 7585 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 7586 | { } /* end */ | ||
| 7587 | }; | ||
| 7588 | |||
| 7589 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { | ||
| 7590 | { | ||
| 7591 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 7592 | .name = "Channel Mode", | ||
| 7593 | .info = alc_ch_mode_info, | ||
| 7594 | .get = alc_ch_mode_get, | ||
| 7595 | .put = alc_ch_mode_put, | ||
| 7596 | }, | ||
| 7597 | { } /* end */ | ||
| 7598 | }; | ||
| 7599 | |||
| 7600 | static struct hda_verb alc882_base_init_verbs[] = { | ||
| 7601 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
| 7602 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7604 | /* Rear mixer */ | ||
| 7605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7607 | /* CLFE mixer */ | ||
| 7608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7610 | /* Side mixer */ | ||
| 7611 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7612 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7613 | |||
| 7614 | /* Front Pin: output 0 (0x0c) */ | ||
| 7615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7617 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7618 | /* Rear Pin: output 1 (0x0d) */ | ||
| 7619 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7620 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7621 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 7622 | /* CLFE Pin: output 2 (0x0e) */ | ||
| 7623 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7624 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7625 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 7626 | /* Side Pin: output 3 (0x0f) */ | ||
| 7627 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7628 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7629 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 7630 | /* Mic (rear) pin: input vref at 80% */ | ||
| 7631 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7633 | /* Front Mic pin: input vref at 80% */ | ||
| 7634 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7635 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7636 | /* Line In pin: input */ | ||
| 7637 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7638 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7639 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
| 7640 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 7641 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7642 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7643 | /* CD pin widget for input */ | ||
| 7644 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7645 | |||
| 7646 | /* FIXME: use matrix-type input source selection */ | ||
| 7647 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 7648 | /* Input mixer2 */ | ||
| 7649 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7650 | /* Input mixer3 */ | ||
| 7651 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7652 | /* ADC2: mute amp left and right */ | ||
| 7653 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7654 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7655 | /* ADC3: mute amp left and right */ | ||
| 7656 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7657 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7658 | |||
| 7659 | { } | ||
| 7660 | }; | ||
| 7661 | |||
| 7662 | static struct hda_verb alc882_adc1_init_verbs[] = { | ||
| 7663 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 7664 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7665 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7666 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7667 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7668 | /* ADC1: mute amp left and right */ | ||
| 7669 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7670 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7671 | { } | ||
| 7672 | }; | ||
| 7673 | |||
| 7674 | static struct hda_verb alc882_eapd_verbs[] = { | ||
| 7675 | /* change to EAPD mode */ | ||
| 7676 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 7677 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, | ||
| 7678 | { } | ||
| 7679 | }; | ||
| 7680 | |||
| 7681 | static struct hda_verb alc889_eapd_verbs[] = { | ||
| 7682 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 7683 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 7684 | { } | ||
| 7685 | }; | ||
| 7686 | |||
| 7687 | static struct hda_verb alc_hp15_unsol_verbs[] = { | ||
| 7688 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 7689 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 7690 | {} | ||
| 7691 | }; | ||
| 7692 | |||
| 7693 | static struct hda_verb alc885_init_verbs[] = { | ||
| 7694 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
| 7695 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7696 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7697 | /* Rear mixer */ | ||
| 7698 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7699 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7700 | /* CLFE mixer */ | ||
| 7701 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7702 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7703 | /* Side mixer */ | ||
| 7704 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7705 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7706 | |||
| 7707 | /* Front HP Pin: output 0 (0x0c) */ | ||
| 7708 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 7709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7710 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7711 | /* Front Pin: output 0 (0x0c) */ | ||
| 7712 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7713 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7714 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7715 | /* Rear Pin: output 1 (0x0d) */ | ||
| 7716 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7717 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7718 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 7719 | /* CLFE Pin: output 2 (0x0e) */ | ||
| 7720 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7721 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7722 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 7723 | /* Side Pin: output 3 (0x0f) */ | ||
| 7724 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7725 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7726 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 7727 | /* Mic (rear) pin: input vref at 80% */ | ||
| 7728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7729 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7730 | /* Front Mic pin: input vref at 80% */ | ||
| 7731 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7732 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7733 | /* Line In pin: input */ | ||
| 7734 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7735 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7736 | |||
| 7737 | /* Mixer elements: 0x18, , 0x1a, 0x1b */ | ||
| 7738 | /* Input mixer1 */ | ||
| 7739 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7740 | /* Input mixer2 */ | ||
| 7741 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7742 | /* Input mixer3 */ | ||
| 7743 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7744 | /* ADC2: mute amp left and right */ | ||
| 7745 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7746 | /* ADC3: mute amp left and right */ | ||
| 7747 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7748 | |||
| 7749 | { } | ||
| 7750 | }; | ||
| 7751 | |||
| 7752 | static struct hda_verb alc885_init_input_verbs[] = { | ||
| 7753 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7754 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 7755 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
| 7756 | { } | ||
| 7757 | }; | ||
| 7758 | |||
| 7759 | |||
| 7760 | /* Unmute Selector 24h and set the default input to front mic */ | ||
| 7761 | static struct hda_verb alc889_init_input_verbs[] = { | ||
| 7762 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7764 | { } | ||
| 7765 | }; | ||
| 7766 | |||
| 7767 | |||
| 7768 | #define alc883_init_verbs alc882_base_init_verbs | ||
| 7769 | |||
| 7770 | /* Mac Pro test */ | ||
| 7771 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { | ||
| 7772 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 7773 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 7774 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
| 7775 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 7776 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 7777 | /* FIXME: this looks suspicious... | ||
| 7778 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 7779 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 7780 | */ | ||
| 7781 | { } /* end */ | ||
| 7782 | }; | ||
| 7783 | |||
| 7784 | static struct hda_verb alc882_macpro_init_verbs[] = { | ||
| 7785 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
| 7786 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7787 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7789 | /* Front Pin: output 0 (0x0c) */ | ||
| 7790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7791 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7792 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7793 | /* Front Mic pin: input vref at 80% */ | ||
| 7794 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7795 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7796 | /* Speaker: output */ | ||
| 7797 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7798 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7799 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, | ||
| 7800 | /* Headphone output (output 0 - 0x0c) */ | ||
| 7801 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 7802 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7803 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7804 | |||
| 7805 | /* FIXME: use matrix-type input source selection */ | ||
| 7806 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 7807 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 7808 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7809 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7810 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7811 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7812 | /* Input mixer2 */ | ||
| 7813 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7814 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7815 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7816 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7817 | /* Input mixer3 */ | ||
| 7818 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7819 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7820 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7821 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7822 | /* ADC1: mute amp left and right */ | ||
| 7823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7824 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7825 | /* ADC2: mute amp left and right */ | ||
| 7826 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7827 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7828 | /* ADC3: mute amp left and right */ | ||
| 7829 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7830 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7831 | |||
| 7832 | { } | ||
| 7833 | }; | ||
| 7834 | |||
| 7835 | /* Macbook 5,1 */ | ||
| 7836 | static struct hda_verb alc885_mb5_init_verbs[] = { | ||
| 7837 | /* DACs */ | ||
| 7838 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7839 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7840 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7841 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7842 | /* Front mixer */ | ||
| 7843 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7844 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7846 | /* Surround mixer */ | ||
| 7847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7849 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7850 | /* LFE mixer */ | ||
| 7851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7852 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7853 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7854 | /* HP mixer */ | ||
| 7855 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7856 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7857 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7858 | /* Front Pin (0x0c) */ | ||
| 7859 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
| 7860 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7861 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7862 | /* LFE Pin (0x0e) */ | ||
| 7863 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
| 7864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7865 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 7866 | /* HP Pin (0x0f) */ | ||
| 7867 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7868 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7869 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 7870 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 7871 | /* Front Mic pin: input vref at 80% */ | ||
| 7872 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7873 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7874 | /* Line In pin */ | ||
| 7875 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7876 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7877 | |||
| 7878 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)}, | ||
| 7879 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)}, | ||
| 7880 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)}, | ||
| 7881 | { } | ||
| 7882 | }; | ||
| 7883 | |||
| 7884 | /* Macmini 3,1 */ | ||
| 7885 | static struct hda_verb alc885_macmini3_init_verbs[] = { | ||
| 7886 | /* DACs */ | ||
| 7887 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7888 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7889 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7890 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7891 | /* Front mixer */ | ||
| 7892 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7893 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7894 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7895 | /* Surround mixer */ | ||
| 7896 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7897 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7898 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7899 | /* LFE mixer */ | ||
| 7900 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7901 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7902 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7903 | /* HP mixer */ | ||
| 7904 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7905 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7906 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7907 | /* Front Pin (0x0c) */ | ||
| 7908 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
| 7909 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7910 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7911 | /* LFE Pin (0x0e) */ | ||
| 7912 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, | ||
| 7913 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7914 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 7915 | /* HP Pin (0x0f) */ | ||
| 7916 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7917 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7918 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 7919 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 7920 | /* Line In pin */ | ||
| 7921 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7922 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7923 | |||
| 7924 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7925 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7926 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7927 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7928 | { } | ||
| 7929 | }; | ||
| 7930 | |||
| 7931 | |||
| 7932 | static struct hda_verb alc885_mba21_init_verbs[] = { | ||
| 7933 | /*Internal and HP Speaker Mixer*/ | ||
| 7934 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7935 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7936 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 7937 | /*Internal Speaker Pin (0x0c)*/ | ||
| 7938 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | ||
| 7939 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7940 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7941 | /* HP Pin: output 0 (0x0e) */ | ||
| 7942 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | ||
| 7943 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7944 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7945 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | ||
| 7946 | /* Line in (is hp when jack connected)*/ | ||
| 7947 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | ||
| 7948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7949 | |||
| 7950 | { } | ||
| 7951 | }; | ||
| 7952 | |||
| 7953 | |||
| 7954 | /* Macbook Pro rev3 */ | ||
| 7955 | static struct hda_verb alc885_mbp3_init_verbs[] = { | ||
| 7956 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ | ||
| 7957 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7958 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7959 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7960 | /* Rear mixer */ | ||
| 7961 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7962 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7963 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7964 | /* HP mixer */ | ||
| 7965 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 7966 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 7967 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 7968 | /* Front Pin: output 0 (0x0c) */ | ||
| 7969 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 7970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7971 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 7972 | /* HP Pin: output 0 (0x0e) */ | ||
| 7973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, | ||
| 7974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 7975 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 7976 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 7977 | /* Mic (rear) pin: input vref at 80% */ | ||
| 7978 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7980 | /* Front Mic pin: input vref at 80% */ | ||
| 7981 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 7982 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7983 | /* Line In pin: use output 1 when in LineOut mode */ | ||
| 7984 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 7985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 7986 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 7987 | |||
| 7988 | /* FIXME: use matrix-type input source selection */ | ||
| 7989 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 7990 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 7991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 7995 | /* Input mixer2 */ | ||
| 7996 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 7997 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 7998 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 7999 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 8000 | /* Input mixer3 */ | ||
| 8001 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8002 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 8003 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 8004 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 8005 | /* ADC1: mute amp left and right */ | ||
| 8006 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8007 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8008 | /* ADC2: mute amp left and right */ | ||
| 8009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8010 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8011 | /* ADC3: mute amp left and right */ | ||
| 8012 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8013 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8014 | |||
| 8015 | { } | ||
| 8016 | }; | ||
| 8017 | |||
| 8018 | /* iMac 9,1 */ | ||
| 8019 | static struct hda_verb alc885_imac91_init_verbs[] = { | ||
| 8020 | /* Internal Speaker Pin (0x0c) */ | ||
| 8021 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | ||
| 8022 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8023 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8024 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, | ||
| 8025 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8026 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8027 | /* HP Pin: Rear */ | ||
| 8028 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8029 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8030 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8031 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, | ||
| 8032 | /* Line in Rear */ | ||
| 8033 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, | ||
| 8034 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 8035 | /* Front Mic pin: input vref at 80% */ | ||
| 8036 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 8037 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 8038 | /* Rear mixer */ | ||
| 8039 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8041 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 8042 | /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */ | ||
| 8043 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8044 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8045 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 8046 | /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | ||
| 8047 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8048 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 8049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 8050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 8051 | /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | ||
| 8052 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8053 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 8054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 8055 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 8056 | /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */ | ||
| 8057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 8059 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 8060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 8061 | /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | ||
| 8062 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8063 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8064 | /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | ||
| 8065 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8066 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8067 | /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */ | ||
| 8068 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 8069 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8070 | { } | ||
| 8071 | }; | ||
| 8072 | |||
| 8073 | /* iMac 24 mixer. */ | ||
| 8074 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { | ||
| 8075 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 8076 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), | ||
| 8077 | { } /* end */ | ||
| 8078 | }; | ||
| 8079 | |||
| 8080 | /* iMac 24 init verbs. */ | ||
| 8081 | static struct hda_verb alc885_imac24_init_verbs[] = { | ||
| 8082 | /* Internal speakers: output 0 (0x0c) */ | ||
| 8083 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8084 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8085 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8086 | /* Internal speakers: output 0 (0x0c) */ | ||
| 8087 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8088 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8089 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8090 | /* Headphone: output 0 (0x0c) */ | ||
| 8091 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8092 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8093 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8094 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8095 | /* Front Mic: input vref at 80% */ | ||
| 8096 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 8097 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 8098 | { } | ||
| 8099 | }; | ||
| 8100 | |||
| 8101 | /* Toggle speaker-output according to the hp-jack state */ | ||
| 8102 | static void alc885_imac24_setup(struct hda_codec *codec) | ||
| 8103 | { | ||
| 8104 | struct alc_spec *spec = codec->spec; | ||
| 8105 | |||
| 8106 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 8107 | spec->autocfg.speaker_pins[0] = 0x18; | ||
| 8108 | spec->autocfg.speaker_pins[1] = 0x1a; | ||
| 8109 | } | ||
| 8110 | |||
| 8111 | #define alc885_mb5_setup alc885_imac24_setup | ||
| 8112 | #define alc885_macmini3_setup alc885_imac24_setup | ||
| 8113 | |||
| 8114 | /* Macbook Air 2,1 */ | ||
| 8115 | static void alc885_mba21_setup(struct hda_codec *codec) | ||
| 8116 | { | ||
| 8117 | struct alc_spec *spec = codec->spec; | ||
| 8118 | |||
| 8119 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 8120 | spec->autocfg.speaker_pins[0] = 0x18; | ||
| 8121 | } | ||
| 8122 | |||
| 8123 | |||
| 8124 | |||
| 8125 | static void alc885_mbp3_setup(struct hda_codec *codec) | ||
| 8126 | { | ||
| 8127 | struct alc_spec *spec = codec->spec; | ||
| 8128 | |||
| 8129 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 8130 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 8131 | } | ||
| 8132 | |||
| 8133 | static void alc885_imac91_setup(struct hda_codec *codec) | ||
| 8134 | { | ||
| 8135 | struct alc_spec *spec = codec->spec; | ||
| 8136 | |||
| 8137 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 8138 | spec->autocfg.speaker_pins[0] = 0x18; | ||
| 8139 | spec->autocfg.speaker_pins[1] = 0x1a; | ||
| 8140 | } | ||
| 8141 | |||
| 8142 | static struct hda_verb alc882_targa_verbs[] = { | ||
| 8143 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8144 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8145 | |||
| 8146 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8148 | |||
| 8149 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
| 8150 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
| 8151 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 8152 | |||
| 8153 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8154 | { } /* end */ | ||
| 8155 | }; | ||
| 8156 | |||
| 8157 | /* toggle speaker-output according to the hp-jack state */ | ||
| 8158 | static void alc882_targa_automute(struct hda_codec *codec) | ||
| 8159 | { | ||
| 8160 | struct alc_spec *spec = codec->spec; | ||
| 8161 | alc_automute_amp(codec); | ||
| 8162 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, | ||
| 8163 | spec->jack_present ? 1 : 3); | ||
| 8164 | } | ||
| 8165 | |||
| 8166 | static void alc882_targa_setup(struct hda_codec *codec) | ||
| 8167 | { | ||
| 8168 | struct alc_spec *spec = codec->spec; | ||
| 8169 | |||
| 8170 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 8171 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
| 8172 | } | ||
| 8173 | |||
| 8174 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 8175 | { | ||
| 8176 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 8177 | alc882_targa_automute(codec); | ||
| 8178 | } | ||
| 8179 | |||
| 8180 | static struct hda_verb alc882_asus_a7j_verbs[] = { | ||
| 8181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8183 | |||
| 8184 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8185 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8186 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8187 | |||
| 8188 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
| 8189 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 8190 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
| 8191 | |||
| 8192 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
| 8193 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
| 8194 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 8195 | { } /* end */ | ||
| 8196 | }; | ||
| 8197 | |||
| 8198 | static struct hda_verb alc882_asus_a7m_verbs[] = { | ||
| 8199 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8200 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8201 | |||
| 8202 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8204 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8205 | |||
| 8206 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
| 8207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 8208 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | ||
| 8209 | |||
| 8210 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | ||
| 8211 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | ||
| 8212 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | ||
| 8213 | { } /* end */ | ||
| 8214 | }; | ||
| 8215 | |||
| 8216 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | ||
| 8217 | { | ||
| 8218 | unsigned int gpiostate, gpiomask, gpiodir; | ||
| 8219 | |||
| 8220 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | ||
| 8221 | AC_VERB_GET_GPIO_DATA, 0); | ||
| 8222 | |||
| 8223 | if (!muted) | ||
| 8224 | gpiostate |= (1 << pin); | ||
| 8225 | else | ||
| 8226 | gpiostate &= ~(1 << pin); | ||
| 8227 | |||
| 8228 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | ||
| 8229 | AC_VERB_GET_GPIO_MASK, 0); | ||
| 8230 | gpiomask |= (1 << pin); | ||
| 8231 | |||
| 8232 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | ||
| 8233 | AC_VERB_GET_GPIO_DIRECTION, 0); | ||
| 8234 | gpiodir |= (1 << pin); | ||
| 8235 | |||
| 8236 | |||
| 8237 | snd_hda_codec_write(codec, codec->afg, 0, | ||
| 8238 | AC_VERB_SET_GPIO_MASK, gpiomask); | ||
| 8239 | snd_hda_codec_write(codec, codec->afg, 0, | ||
| 8240 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | ||
| 8241 | |||
| 8242 | msleep(1); | ||
| 8243 | |||
| 8244 | snd_hda_codec_write(codec, codec->afg, 0, | ||
| 8245 | AC_VERB_SET_GPIO_DATA, gpiostate); | ||
| 8246 | } | ||
| 8247 | |||
| 8248 | /* set up GPIO at initialization */ | ||
| 8249 | static void alc885_macpro_init_hook(struct hda_codec *codec) | ||
| 8250 | { | ||
| 8251 | alc882_gpio_mute(codec, 0, 0); | ||
| 8252 | alc882_gpio_mute(codec, 1, 0); | ||
| 8253 | } | ||
| 8254 | |||
| 8255 | /* set up GPIO and update auto-muting at initialization */ | ||
| 8256 | static void alc885_imac24_init_hook(struct hda_codec *codec) | ||
| 8257 | { | ||
| 8258 | alc885_macpro_init_hook(codec); | ||
| 8259 | alc_automute_amp(codec); | ||
| 8260 | } | ||
| 8261 | |||
| 8262 | /* | ||
| 8263 | * generic initialization of ADC, input mixers and output mixers | ||
| 8264 | */ | ||
| 8265 | static struct hda_verb alc883_auto_init_verbs[] = { | ||
| 8266 | /* | ||
| 8267 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 8268 | */ | ||
| 8269 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8270 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8271 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8273 | |||
| 8274 | /* | ||
| 8275 | * Set up output mixers (0x0c - 0x0f) | ||
| 8276 | */ | ||
| 8277 | /* set vol=0 to output mixers */ | ||
| 8278 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8279 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8280 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 8282 | /* set up input amps for analog loopback */ | ||
| 8283 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 8284 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8285 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8286 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8287 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8288 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8289 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8290 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8291 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8292 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8293 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8294 | |||
| 8295 | /* FIXME: use matrix-type input source selection */ | ||
| 8296 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 8297 | /* Input mixer2 */ | ||
| 8298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8299 | /* Input mixer3 */ | ||
| 8300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8301 | { } | ||
| 8302 | }; | ||
| 8303 | |||
| 8304 | /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ | ||
| 8305 | static struct hda_verb alc889A_mb31_ch2_init[] = { | ||
| 8306 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | ||
| 8307 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | ||
| 8308 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | ||
| 8309 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | ||
| 8310 | { } /* end */ | ||
| 8311 | }; | ||
| 8312 | |||
| 8313 | /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */ | ||
| 8314 | static struct hda_verb alc889A_mb31_ch4_init[] = { | ||
| 8315 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ | ||
| 8316 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | ||
| 8317 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | ||
| 8318 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | ||
| 8319 | { } /* end */ | ||
| 8320 | }; | ||
| 8321 | |||
| 8322 | /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */ | ||
| 8323 | static struct hda_verb alc889A_mb31_ch5_init[] = { | ||
| 8324 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */ | ||
| 8325 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */ | ||
| 8326 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */ | ||
| 8327 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */ | ||
| 8328 | { } /* end */ | ||
| 8329 | }; | ||
| 8330 | |||
| 8331 | /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */ | ||
| 8332 | static struct hda_verb alc889A_mb31_ch6_init[] = { | ||
| 8333 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */ | ||
| 8334 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */ | ||
| 8335 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */ | ||
| 8336 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */ | ||
| 8337 | { } /* end */ | ||
| 8338 | }; | ||
| 8339 | |||
| 8340 | static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = { | ||
| 8341 | { 2, alc889A_mb31_ch2_init }, | ||
| 8342 | { 4, alc889A_mb31_ch4_init }, | ||
| 8343 | { 5, alc889A_mb31_ch5_init }, | ||
| 8344 | { 6, alc889A_mb31_ch6_init }, | ||
| 8345 | }; | ||
| 8346 | |||
| 8347 | static struct hda_verb alc883_medion_eapd_verbs[] = { | ||
| 8348 | /* eanable EAPD on medion laptop */ | ||
| 8349 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 8350 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | ||
| 8351 | { } | ||
| 8352 | }; | ||
| 8353 | |||
| 8354 | #define alc883_base_mixer alc882_base_mixer | ||
| 8355 | |||
| 8356 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { | ||
| 8357 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8358 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8359 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 8360 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8361 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8362 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8363 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8364 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8365 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8366 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8367 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8368 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8369 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8370 | { } /* end */ | ||
| 8371 | }; | ||
| 8372 | |||
| 8373 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { | ||
| 8374 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8375 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8376 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8377 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8379 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8381 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8382 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8383 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8384 | { } /* end */ | ||
| 8385 | }; | ||
| 8386 | |||
| 8387 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { | ||
| 8388 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8389 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8390 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8391 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8393 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8395 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8396 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8397 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8398 | { } /* end */ | ||
| 8399 | }; | ||
| 8400 | |||
| 8401 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | ||
| 8402 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8403 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8404 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8405 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8406 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8407 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8408 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8409 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8410 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8411 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8412 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8413 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8414 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8415 | { } /* end */ | ||
| 8416 | }; | ||
| 8417 | |||
| 8418 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | ||
| 8419 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8420 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8421 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8422 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8423 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 8424 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8425 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8426 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8428 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8429 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8430 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8431 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8432 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8433 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8434 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8435 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8436 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8437 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8438 | { } /* end */ | ||
| 8439 | }; | ||
| 8440 | |||
| 8441 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | ||
| 8442 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8443 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8444 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8445 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8446 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
| 8447 | HDA_OUTPUT), | ||
| 8448 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8449 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8450 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8451 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8453 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8455 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8457 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8458 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8459 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8460 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8462 | { } /* end */ | ||
| 8463 | }; | ||
| 8464 | |||
| 8465 | static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = { | ||
| 8466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8467 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8468 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8469 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8470 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
| 8471 | HDA_OUTPUT), | ||
| 8472 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8473 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8474 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8475 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 8476 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 8477 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8478 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8479 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | ||
| 8481 | HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT), | ||
| 8482 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | ||
| 8483 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8484 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8486 | { } /* end */ | ||
| 8487 | }; | ||
| 8488 | |||
| 8489 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | ||
| 8490 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8491 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8492 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8493 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8494 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 8495 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8496 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8497 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8498 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8499 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8500 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8501 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8502 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8503 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8504 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8505 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8506 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8507 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8508 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8509 | { } /* end */ | ||
| 8510 | }; | ||
| 8511 | |||
| 8512 | static struct snd_kcontrol_new alc883_targa_mixer[] = { | ||
| 8513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8516 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8517 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8518 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8519 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 8520 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 8521 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 8522 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 8523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8524 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8525 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8526 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8527 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8528 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8529 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8530 | { } /* end */ | ||
| 8531 | }; | ||
| 8532 | |||
| 8533 | static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = { | ||
| 8534 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8535 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8536 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8537 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8540 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8541 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8542 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8543 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8544 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8545 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8546 | { } /* end */ | ||
| 8547 | }; | ||
| 8548 | |||
| 8549 | static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = { | ||
| 8550 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 8551 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 8552 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8553 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8554 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8555 | { } /* end */ | ||
| 8556 | }; | ||
| 8557 | |||
| 8558 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { | ||
| 8559 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8560 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8561 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 8562 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 8563 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 8564 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8565 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8566 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8567 | { } /* end */ | ||
| 8568 | }; | ||
| 8569 | |||
| 8570 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { | ||
| 8571 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8572 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8573 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8574 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8575 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8576 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8577 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8578 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8579 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8580 | { } /* end */ | ||
| 8581 | }; | ||
| 8582 | |||
| 8583 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | ||
| 8584 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8585 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8586 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8587 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8588 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8592 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8593 | { } /* end */ | ||
| 8594 | }; | ||
| 8595 | |||
| 8596 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | ||
| 8597 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8598 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8599 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8600 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
| 8601 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | ||
| 8602 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | ||
| 8603 | { } /* end */ | ||
| 8604 | }; | ||
| 8605 | |||
| 8606 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | ||
| 8607 | /* Unmute front mixer */ | ||
| 8608 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8609 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8610 | |||
| 8611 | /* Set speaker pin to front mixer */ | ||
| 8612 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8613 | |||
| 8614 | /* Init headphone pin */ | ||
| 8615 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8616 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8617 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8618 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8619 | |||
| 8620 | { } /* end */ | ||
| 8621 | }; | ||
| 8622 | |||
| 8623 | /* toggle speaker-output according to the hp-jack state */ | ||
| 8624 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | ||
| 8625 | { | ||
| 8626 | struct alc_spec *spec = codec->spec; | ||
| 8627 | |||
| 8628 | spec->autocfg.hp_pins[0] = 0x1a; | ||
| 8629 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 8630 | } | ||
| 8631 | |||
| 8632 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | ||
| 8633 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8634 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8636 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8637 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8639 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8640 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8641 | { } /* end */ | ||
| 8642 | }; | ||
| 8643 | |||
| 8644 | static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = { | ||
| 8645 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8646 | HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 8647 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8648 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8649 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8650 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8652 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8653 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8654 | { } /* end */ | ||
| 8655 | }; | ||
| 8656 | |||
| 8657 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | ||
| 8658 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8659 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8660 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
| 8661 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
| 8662 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | ||
| 8663 | 0x0d, 1, 0x0, HDA_OUTPUT), | ||
| 8664 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
| 8665 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
| 8666 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
| 8667 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
| 8668 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 8669 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 8670 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 8671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8673 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8674 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8676 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8677 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8678 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8679 | { } /* end */ | ||
| 8680 | }; | ||
| 8681 | |||
| 8682 | static struct snd_kcontrol_new alc889A_mb31_mixer[] = { | ||
| 8683 | /* Output mixers */ | ||
| 8684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), | ||
| 8685 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), | ||
| 8686 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), | ||
| 8687 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), | ||
| 8688 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00, | ||
| 8689 | HDA_OUTPUT), | ||
| 8690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT), | ||
| 8691 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT), | ||
| 8692 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT), | ||
| 8693 | /* Output switches */ | ||
| 8694 | HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT), | ||
| 8695 | HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT), | ||
| 8696 | HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT), | ||
| 8697 | /* Boost mixers */ | ||
| 8698 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), | ||
| 8699 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), | ||
| 8700 | /* Input mixers */ | ||
| 8701 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), | ||
| 8702 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), | ||
| 8703 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8704 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8705 | { } /* end */ | ||
| 8706 | }; | ||
| 8707 | |||
| 8708 | static struct snd_kcontrol_new alc883_vaiott_mixer[] = { | ||
| 8709 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8710 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8711 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8712 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 8713 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 8714 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 8715 | { } /* end */ | ||
| 8716 | }; | ||
| 8717 | |||
| 8718 | static struct hda_bind_ctls alc883_bind_cap_vol = { | ||
| 8719 | .ops = &snd_hda_bind_vol, | ||
| 8720 | .values = { | ||
| 8721 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
| 8722 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
| 8723 | 0 | ||
| 8724 | }, | ||
| 8725 | }; | ||
| 8726 | |||
| 8727 | static struct hda_bind_ctls alc883_bind_cap_switch = { | ||
| 8728 | .ops = &snd_hda_bind_sw, | ||
| 8729 | .values = { | ||
| 8730 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
| 8731 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
| 8732 | 0 | ||
| 8733 | }, | ||
| 8734 | }; | ||
| 8735 | |||
| 8736 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | ||
| 8737 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8738 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8739 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 8740 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 8741 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 8742 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 8743 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 8744 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 8745 | { } /* end */ | ||
| 8746 | }; | ||
| 8747 | |||
| 8748 | static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = { | ||
| 8749 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | ||
| 8750 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | ||
| 8751 | { | ||
| 8752 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 8753 | /* .name = "Capture Source", */ | ||
| 8754 | .name = "Input Source", | ||
| 8755 | .count = 1, | ||
| 8756 | .info = alc_mux_enum_info, | ||
| 8757 | .get = alc_mux_enum_get, | ||
| 8758 | .put = alc_mux_enum_put, | ||
| 8759 | }, | ||
| 8760 | { } /* end */ | ||
| 8761 | }; | ||
| 8762 | |||
| 8763 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | ||
| 8764 | { | ||
| 8765 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 8766 | .name = "Channel Mode", | ||
| 8767 | .info = alc_ch_mode_info, | ||
| 8768 | .get = alc_ch_mode_get, | ||
| 8769 | .put = alc_ch_mode_put, | ||
| 8770 | }, | ||
| 8771 | { } /* end */ | ||
| 8772 | }; | ||
| 8773 | |||
| 8774 | /* toggle speaker-output according to the hp-jack state */ | ||
| 8775 | static void alc883_mitac_setup(struct hda_codec *codec) | ||
| 8776 | { | ||
| 8777 | struct alc_spec *spec = codec->spec; | ||
| 8778 | |||
| 8779 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 8780 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 8781 | spec->autocfg.speaker_pins[1] = 0x17; | ||
| 8782 | } | ||
| 8783 | |||
| 8784 | /* auto-toggle front mic */ | ||
| 8785 | /* | ||
| 8786 | static void alc883_mitac_mic_automute(struct hda_codec *codec) | ||
| 8787 | { | ||
| 8788 | unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0; | ||
| 8789 | |||
| 8790 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); | ||
| 8791 | } | ||
| 8792 | */ | ||
| 8793 | |||
| 8794 | static struct hda_verb alc883_mitac_verbs[] = { | ||
| 8795 | /* HP */ | ||
| 8796 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8798 | /* Subwoofer */ | ||
| 8799 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 8800 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8801 | |||
| 8802 | /* enable unsolicited event */ | ||
| 8803 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8804 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ | ||
| 8805 | |||
| 8806 | { } /* end */ | ||
| 8807 | }; | ||
| 8808 | |||
| 8809 | static struct hda_verb alc883_clevo_m540r_verbs[] = { | ||
| 8810 | /* HP */ | ||
| 8811 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8813 | /* Int speaker */ | ||
| 8814 | /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/ | ||
| 8815 | |||
| 8816 | /* enable unsolicited event */ | ||
| 8817 | /* | ||
| 8818 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8819 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
| 8820 | */ | ||
| 8821 | |||
| 8822 | { } /* end */ | ||
| 8823 | }; | ||
| 8824 | |||
| 8825 | static struct hda_verb alc883_clevo_m720_verbs[] = { | ||
| 8826 | /* HP */ | ||
| 8827 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8829 | /* Int speaker */ | ||
| 8830 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 8831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8832 | |||
| 8833 | /* enable unsolicited event */ | ||
| 8834 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8835 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
| 8836 | |||
| 8837 | { } /* end */ | ||
| 8838 | }; | ||
| 8839 | |||
| 8840 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { | ||
| 8841 | /* HP */ | ||
| 8842 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8843 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8844 | /* Subwoofer */ | ||
| 8845 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 8846 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8847 | |||
| 8848 | /* enable unsolicited event */ | ||
| 8849 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8850 | |||
| 8851 | { } /* end */ | ||
| 8852 | }; | ||
| 8853 | |||
| 8854 | static struct hda_verb alc883_targa_verbs[] = { | ||
| 8855 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8856 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8857 | |||
| 8858 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8859 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8860 | |||
| 8861 | /* Connect Line-Out side jack (SPDIF) to Side */ | ||
| 8862 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8863 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8864 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 8865 | /* Connect Mic jack to CLFE */ | ||
| 8866 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8867 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8868 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 8869 | /* Connect Line-in jack to Surround */ | ||
| 8870 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8871 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8872 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 8873 | /* Connect HP out jack to Front */ | ||
| 8874 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8875 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8876 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8877 | |||
| 8878 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8879 | |||
| 8880 | { } /* end */ | ||
| 8881 | }; | ||
| 8882 | |||
| 8883 | static struct hda_verb alc883_lenovo_101e_verbs[] = { | ||
| 8884 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8885 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, | ||
| 8886 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, | ||
| 8887 | { } /* end */ | ||
| 8888 | }; | ||
| 8889 | |||
| 8890 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { | ||
| 8891 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8892 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8893 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8894 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8895 | { } /* end */ | ||
| 8896 | }; | ||
| 8897 | |||
| 8898 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { | ||
| 8899 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8900 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8901 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8902 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, | ||
| 8903 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8904 | { } /* end */ | ||
| 8905 | }; | ||
| 8906 | |||
| 8907 | static struct hda_verb alc883_haier_w66_verbs[] = { | ||
| 8908 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8909 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8910 | |||
| 8911 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8912 | |||
| 8913 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8914 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8915 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8916 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8917 | { } /* end */ | ||
| 8918 | }; | ||
| 8919 | |||
| 8920 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | ||
| 8921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8923 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8924 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8925 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8926 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 8927 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8928 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8929 | { } /* end */ | ||
| 8930 | }; | ||
| 8931 | |||
| 8932 | static struct hda_verb alc888_6st_dell_verbs[] = { | ||
| 8933 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8934 | { } | ||
| 8935 | }; | ||
| 8936 | |||
| 8937 | static struct hda_verb alc883_vaiott_verbs[] = { | ||
| 8938 | /* HP */ | ||
| 8939 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8941 | |||
| 8942 | /* enable unsolicited event */ | ||
| 8943 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8944 | |||
| 8945 | { } /* end */ | ||
| 8946 | }; | ||
| 8947 | |||
| 8948 | static void alc888_3st_hp_setup(struct hda_codec *codec) | ||
| 8949 | { | ||
| 8950 | struct alc_spec *spec = codec->spec; | ||
| 8951 | |||
| 8952 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 8953 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 8954 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 8955 | spec->autocfg.speaker_pins[2] = 0x18; | ||
| 8956 | } | ||
| 8957 | |||
| 8958 | static struct hda_verb alc888_3st_hp_verbs[] = { | ||
| 8959 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | ||
| 8960 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | ||
| 8961 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | ||
| 8962 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8963 | { } /* end */ | ||
| 8964 | }; | ||
| 8965 | |||
| 8966 | /* | ||
| 8967 | * 2ch mode | ||
| 8968 | */ | ||
| 8969 | static struct hda_verb alc888_3st_hp_2ch_init[] = { | ||
| 8970 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 8971 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 8972 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 8973 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 8974 | { } /* end */ | ||
| 8975 | }; | ||
| 8976 | |||
| 8977 | /* | ||
| 8978 | * 4ch mode | ||
| 8979 | */ | ||
| 8980 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | ||
| 8981 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 8982 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 8983 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 8984 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 8985 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 8986 | { } /* end */ | ||
| 8987 | }; | ||
| 8988 | |||
| 8989 | /* | ||
| 8990 | * 6ch mode | ||
| 8991 | */ | ||
| 8992 | static struct hda_verb alc888_3st_hp_6ch_init[] = { | ||
| 8993 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 8994 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 8995 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 8996 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 8997 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 8998 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 8999 | { } /* end */ | ||
| 9000 | }; | ||
| 9001 | |||
| 9002 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { | ||
| 9003 | { 2, alc888_3st_hp_2ch_init }, | ||
| 9004 | { 4, alc888_3st_hp_4ch_init }, | ||
| 9005 | { 6, alc888_3st_hp_6ch_init }, | ||
| 9006 | }; | ||
| 9007 | |||
| 9008 | /* toggle front-jack and RCA according to the hp-jack state */ | ||
| 9009 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | ||
| 9010 | { | ||
| 9011 | unsigned int present = snd_hda_jack_detect(codec, 0x1b); | ||
| 9012 | |||
| 9013 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 9014 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9015 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 9016 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9017 | } | ||
| 9018 | |||
| 9019 | /* toggle RCA according to the front-jack state */ | ||
| 9020 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | ||
| 9021 | { | ||
| 9022 | unsigned int present = snd_hda_jack_detect(codec, 0x14); | ||
| 9023 | |||
| 9024 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 9025 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9026 | } | ||
| 9027 | |||
| 9028 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, | ||
| 9029 | unsigned int res) | ||
| 9030 | { | ||
| 9031 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 9032 | alc888_lenovo_ms7195_front_automute(codec); | ||
| 9033 | if ((res >> 26) == ALC880_FRONT_EVENT) | ||
| 9034 | alc888_lenovo_ms7195_rca_automute(codec); | ||
| 9035 | } | ||
| 9036 | |||
| 9037 | static struct hda_verb alc883_medion_md2_verbs[] = { | ||
| 9038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 9039 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 9040 | |||
| 9041 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 9042 | |||
| 9043 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9044 | { } /* end */ | ||
| 9045 | }; | ||
| 9046 | |||
| 9047 | /* toggle speaker-output according to the hp-jack state */ | ||
| 9048 | static void alc883_medion_md2_setup(struct hda_codec *codec) | ||
| 9049 | { | ||
| 9050 | struct alc_spec *spec = codec->spec; | ||
| 9051 | |||
| 9052 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 9053 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 9054 | } | ||
| 9055 | |||
| 9056 | /* toggle speaker-output according to the hp-jack state */ | ||
| 9057 | #define alc883_targa_init_hook alc882_targa_init_hook | ||
| 9058 | #define alc883_targa_unsol_event alc882_targa_unsol_event | ||
| 9059 | |||
| 9060 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) | ||
| 9061 | { | ||
| 9062 | unsigned int present; | ||
| 9063 | |||
| 9064 | present = snd_hda_jack_detect(codec, 0x18); | ||
| 9065 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | ||
| 9066 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9067 | } | ||
| 9068 | |||
| 9069 | static void alc883_clevo_m720_setup(struct hda_codec *codec) | ||
| 9070 | { | ||
| 9071 | struct alc_spec *spec = codec->spec; | ||
| 9072 | |||
| 9073 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 9074 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9075 | } | ||
| 9076 | |||
| 9077 | static void alc883_clevo_m720_init_hook(struct hda_codec *codec) | ||
| 9078 | { | ||
| 9079 | alc_automute_amp(codec); | ||
| 9080 | alc883_clevo_m720_mic_automute(codec); | ||
| 9081 | } | ||
| 9082 | |||
| 9083 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, | ||
| 9084 | unsigned int res) | ||
| 9085 | { | ||
| 9086 | switch (res >> 26) { | ||
| 9087 | case ALC880_MIC_EVENT: | ||
| 9088 | alc883_clevo_m720_mic_automute(codec); | ||
| 9089 | break; | ||
| 9090 | default: | ||
| 9091 | alc_automute_amp_unsol_event(codec, res); | ||
| 9092 | break; | ||
| 9093 | } | ||
| 9094 | } | ||
| 9095 | |||
| 9096 | /* toggle speaker-output according to the hp-jack state */ | ||
| 9097 | static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec) | ||
| 9098 | { | ||
| 9099 | struct alc_spec *spec = codec->spec; | ||
| 9100 | |||
| 9101 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 9102 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 9103 | } | ||
| 9104 | |||
| 9105 | static void alc883_haier_w66_setup(struct hda_codec *codec) | ||
| 9106 | { | ||
| 9107 | struct alc_spec *spec = codec->spec; | ||
| 9108 | |||
| 9109 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 9110 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9111 | } | ||
| 9112 | |||
| 9113 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | ||
| 9114 | { | ||
| 9115 | int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0; | ||
| 9116 | |||
| 9117 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 9118 | HDA_AMP_MUTE, bits); | ||
| 9119 | } | ||
| 9120 | |||
| 9121 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) | ||
| 9122 | { | ||
| 9123 | int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0; | ||
| 9124 | |||
| 9125 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 9126 | HDA_AMP_MUTE, bits); | ||
| 9127 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 9128 | HDA_AMP_MUTE, bits); | ||
| 9129 | } | ||
| 9130 | |||
| 9131 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | ||
| 9132 | unsigned int res) | ||
| 9133 | { | ||
| 9134 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 9135 | alc883_lenovo_101e_all_automute(codec); | ||
| 9136 | if ((res >> 26) == ALC880_FRONT_EVENT) | ||
| 9137 | alc883_lenovo_101e_ispeaker_automute(codec); | ||
| 9138 | } | ||
| 9139 | |||
| 9140 | /* toggle speaker-output according to the hp-jack state */ | ||
| 9141 | static void alc883_acer_aspire_setup(struct hda_codec *codec) | ||
| 9142 | { | ||
| 9143 | struct alc_spec *spec = codec->spec; | ||
| 9144 | |||
| 9145 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 9146 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 9147 | spec->autocfg.speaker_pins[1] = 0x16; | ||
| 9148 | } | ||
| 9149 | |||
| 9150 | static struct hda_verb alc883_acer_eapd_verbs[] = { | ||
| 9151 | /* HP Pin: output 0 (0x0c) */ | ||
| 9152 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 9153 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 9154 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 9155 | /* Front Pin: output 0 (0x0c) */ | ||
| 9156 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 9157 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 9158 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 9159 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 9160 | /* eanable EAPD on medion laptop */ | ||
| 9161 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 9162 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | ||
| 9163 | /* enable unsolicited event */ | ||
| 9164 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9165 | { } | ||
| 9166 | }; | ||
| 9167 | |||
| 9168 | static struct hda_verb alc888_acer_aspire_7730G_verbs[] = { | ||
| 9169 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 9170 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 9171 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9172 | { } /* end */ | ||
| 9173 | }; | ||
| 9174 | |||
| 9175 | static void alc888_6st_dell_setup(struct hda_codec *codec) | ||
| 9176 | { | ||
| 9177 | struct alc_spec *spec = codec->spec; | ||
| 9178 | |||
| 9179 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 9180 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9181 | spec->autocfg.speaker_pins[1] = 0x15; | ||
| 9182 | spec->autocfg.speaker_pins[2] = 0x16; | ||
| 9183 | spec->autocfg.speaker_pins[3] = 0x17; | ||
| 9184 | } | ||
| 9185 | |||
| 9186 | static void alc888_lenovo_sky_setup(struct hda_codec *codec) | ||
| 9187 | { | ||
| 9188 | struct alc_spec *spec = codec->spec; | ||
| 9189 | |||
| 9190 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 9191 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9192 | spec->autocfg.speaker_pins[1] = 0x15; | ||
| 9193 | spec->autocfg.speaker_pins[2] = 0x16; | ||
| 9194 | spec->autocfg.speaker_pins[3] = 0x17; | ||
| 9195 | spec->autocfg.speaker_pins[4] = 0x1a; | ||
| 9196 | } | ||
| 9197 | |||
| 9198 | static void alc883_vaiott_setup(struct hda_codec *codec) | ||
| 9199 | { | ||
| 9200 | struct alc_spec *spec = codec->spec; | ||
| 9201 | |||
| 9202 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 9203 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9204 | spec->autocfg.speaker_pins[1] = 0x17; | ||
| 9205 | } | ||
| 9206 | |||
| 9207 | static struct hda_verb alc888_asus_m90v_verbs[] = { | ||
| 9208 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 9209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 9210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 9211 | /* enable unsolicited event */ | ||
| 9212 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9213 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
| 9214 | { } /* end */ | ||
| 9215 | }; | ||
| 9216 | |||
| 9217 | static void alc883_mode2_setup(struct hda_codec *codec) | ||
| 9218 | { | ||
| 9219 | struct alc_spec *spec = codec->spec; | ||
| 9220 | |||
| 9221 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 9222 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 9223 | spec->autocfg.speaker_pins[1] = 0x15; | ||
| 9224 | spec->autocfg.speaker_pins[2] = 0x16; | ||
| 9225 | spec->ext_mic.pin = 0x18; | ||
| 9226 | spec->int_mic.pin = 0x19; | ||
| 9227 | spec->ext_mic.mux_idx = 0; | ||
| 9228 | spec->int_mic.mux_idx = 1; | ||
| 9229 | spec->auto_mic = 1; | ||
| 9230 | } | ||
| 9231 | |||
| 9232 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | ||
| 9233 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 9234 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 9235 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 9236 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 9237 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 9238 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
| 9239 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | ||
| 9240 | /* enable unsolicited event */ | ||
| 9241 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9242 | { } /* end */ | ||
| 9243 | }; | ||
| 9244 | |||
| 9245 | static void alc883_eee1601_inithook(struct hda_codec *codec) | ||
| 9246 | { | ||
| 9247 | struct alc_spec *spec = codec->spec; | ||
| 9248 | |||
| 9249 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 9250 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
| 9251 | alc_automute_pin(codec); | ||
| 9252 | } | ||
| 9253 | |||
| 9254 | static struct hda_verb alc889A_mb31_verbs[] = { | ||
| 9255 | /* Init rear pin (used as headphone output) */ | ||
| 9256 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ | ||
| 9257 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */ | ||
| 9258 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 9259 | /* Init line pin (used as output in 4ch and 6ch mode) */ | ||
| 9260 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */ | ||
| 9261 | /* Init line 2 pin (used as headphone out by default) */ | ||
| 9262 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */ | ||
| 9263 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */ | ||
| 9264 | { } /* end */ | ||
| 9265 | }; | ||
| 9266 | |||
| 9267 | /* Mute speakers according to the headphone jack state */ | ||
| 9268 | static void alc889A_mb31_automute(struct hda_codec *codec) | ||
| 9269 | { | ||
| 9270 | unsigned int present; | ||
| 9271 | |||
| 9272 | /* Mute only in 2ch or 4ch mode */ | ||
| 9273 | if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0) | ||
| 9274 | == 0x00) { | ||
| 9275 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 9276 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 9277 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9278 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
| 9279 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 9280 | } | ||
| 9281 | } | ||
| 9282 | |||
| 9283 | static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 9284 | { | ||
| 9285 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 9286 | alc889A_mb31_automute(codec); | ||
| 9287 | } | ||
| 9288 | |||
| 9289 | |||
| 9290 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 9291 | #define alc882_loopbacks alc880_loopbacks | ||
| 9292 | #endif | ||
| 9293 | |||
| 9294 | /* pcm configuration: identical with ALC880 */ | ||
| 9295 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback | ||
| 9296 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture | ||
| 9297 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback | ||
| 9298 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture | ||
| 9299 | |||
| 9300 | static hda_nid_t alc883_slave_dig_outs[] = { | ||
| 9301 | ALC1200_DIGOUT_NID, 0, | ||
| 9302 | }; | ||
| 9303 | |||
| 9304 | static hda_nid_t alc1200_slave_dig_outs[] = { | ||
| 9305 | ALC883_DIGOUT_NID, 0, | ||
| 9306 | }; | ||
| 9307 | |||
| 9308 | /* | ||
| 9309 | * configuration and preset | ||
| 9310 | */ | ||
| 9311 | static const char *alc882_models[ALC882_MODEL_LAST] = { | ||
| 9312 | [ALC882_3ST_DIG] = "3stack-dig", | ||
| 9313 | [ALC882_6ST_DIG] = "6stack-dig", | ||
| 9314 | [ALC882_ARIMA] = "arima", | ||
| 9315 | [ALC882_W2JC] = "w2jc", | ||
| 9316 | [ALC882_TARGA] = "targa", | ||
| 9317 | [ALC882_ASUS_A7J] = "asus-a7j", | ||
| 9318 | [ALC882_ASUS_A7M] = "asus-a7m", | ||
| 9319 | [ALC885_MACPRO] = "macpro", | ||
| 9320 | [ALC885_MB5] = "mb5", | ||
| 9321 | [ALC885_MACMINI3] = "macmini3", | ||
| 9322 | [ALC885_MBA21] = "mba21", | ||
| 9323 | [ALC885_MBP3] = "mbp3", | ||
| 9324 | [ALC885_IMAC24] = "imac24", | ||
| 9325 | [ALC885_IMAC91] = "imac91", | ||
| 9326 | [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig", | ||
| 9327 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", | ||
| 9328 | [ALC883_3ST_6ch] = "3stack-6ch", | ||
| 9329 | [ALC883_6ST_DIG] = "alc883-6stack-dig", | ||
| 9330 | [ALC883_TARGA_DIG] = "targa-dig", | ||
| 9331 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", | ||
| 9332 | [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig", | ||
| 9333 | [ALC883_ACER] = "acer", | ||
| 9334 | [ALC883_ACER_ASPIRE] = "acer-aspire", | ||
| 9335 | [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", | ||
| 9336 | [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g", | ||
| 9337 | [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g", | ||
| 9338 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | ||
| 9339 | [ALC883_MEDION] = "medion", | ||
| 9340 | [ALC883_MEDION_MD2] = "medion-md2", | ||
| 9341 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | ||
| 9342 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | ||
| 9343 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | ||
| 9344 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | ||
| 9345 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | ||
| 9346 | [ALC888_LENOVO_SKY] = "lenovo-sky", | ||
| 9347 | [ALC883_HAIER_W66] = "haier-w66", | ||
| 9348 | [ALC888_3ST_HP] = "3stack-hp", | ||
| 9349 | [ALC888_6ST_DELL] = "6stack-dell", | ||
| 9350 | [ALC883_MITAC] = "mitac", | ||
| 9351 | [ALC883_CLEVO_M540R] = "clevo-m540r", | ||
| 9352 | [ALC883_CLEVO_M720] = "clevo-m720", | ||
| 9353 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", | ||
| 9354 | [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", | ||
| 9355 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", | ||
| 9356 | [ALC889A_INTEL] = "intel-alc889a", | ||
| 9357 | [ALC889_INTEL] = "intel-x58", | ||
| 9358 | [ALC1200_ASUS_P5Q] = "asus-p5q", | ||
| 9359 | [ALC889A_MB31] = "mb31", | ||
| 9360 | [ALC883_SONY_VAIO_TT] = "sony-vaio-tt", | ||
| 9361 | [ALC882_AUTO] = "auto", | ||
| 9362 | }; | ||
| 9363 | |||
| 9364 | static struct snd_pci_quirk alc882_cfg_tbl[] = { | ||
| 9365 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), | ||
| 9366 | |||
| 9367 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | ||
| 9368 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | ||
| 9369 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | ||
| 9370 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | ||
| 9371 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | ||
| 9372 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | ||
| 9373 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", | ||
| 9374 | ALC888_ACER_ASPIRE_4930G), | ||
| 9375 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | ||
| 9376 | ALC888_ACER_ASPIRE_4930G), | ||
| 9377 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | ||
| 9378 | ALC888_ACER_ASPIRE_8930G), | ||
| 9379 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | ||
| 9380 | ALC888_ACER_ASPIRE_8930G), | ||
| 9381 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO), | ||
| 9382 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO), | ||
| 9383 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | ||
| 9384 | ALC888_ACER_ASPIRE_6530G), | ||
| 9385 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | ||
| 9386 | ALC888_ACER_ASPIRE_6530G), | ||
| 9387 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | ||
| 9388 | ALC888_ACER_ASPIRE_7730G), | ||
| 9389 | /* default Acer -- disabled as it causes more problems. | ||
| 9390 | * model=auto should work fine now | ||
| 9391 | */ | ||
| 9392 | /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */ | ||
| 9393 | |||
| 9394 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | ||
| 9395 | |||
| 9396 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | ||
| 9397 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | ||
| 9398 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | ||
| 9399 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | ||
| 9400 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | ||
| 9401 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | ||
| 9402 | |||
| 9403 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), | ||
| 9404 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), | ||
| 9405 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), | ||
| 9406 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | ||
| 9407 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), | ||
| 9408 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), | ||
| 9409 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), | ||
| 9410 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | ||
| 9411 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | ||
| 9412 | SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), | ||
| 9413 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | ||
| 9414 | |||
| 9415 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT), | ||
| 9416 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | ||
| 9417 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), | ||
| 9418 | SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), | ||
| 9419 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | ||
| 9420 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | ||
| 9421 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | ||
| 9422 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | ||
| 9423 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), | ||
| 9424 | |||
| 9425 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9426 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9427 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9428 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | ||
| 9429 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), | ||
| 9430 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | ||
| 9431 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | ||
| 9432 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | ||
| 9433 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9434 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), | ||
| 9435 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), | ||
| 9436 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), | ||
| 9437 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), | ||
| 9438 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), | ||
| 9439 | SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG), | ||
| 9440 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), | ||
| 9441 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), | ||
| 9442 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), | ||
| 9443 | SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG), | ||
| 9444 | SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG), | ||
| 9445 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), | ||
| 9446 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), | ||
| 9447 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), | ||
| 9448 | SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), | ||
| 9449 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), | ||
| 9450 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), | ||
| 9451 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), | ||
| 9452 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG), | ||
| 9453 | SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG), | ||
| 9454 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9455 | SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG), | ||
| 9456 | |||
| 9457 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | ||
| 9458 | SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG), | ||
| 9459 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | ||
| 9460 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | ||
| 9461 | SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R), | ||
| 9462 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), | ||
| 9463 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | ||
| 9464 | /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */ | ||
| 9465 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | ||
| 9466 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", | ||
| 9467 | ALC883_FUJITSU_PI2515), | ||
| 9468 | SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", | ||
| 9469 | ALC888_FUJITSU_XA3530), | ||
| 9470 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), | ||
| 9471 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
| 9472 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
| 9473 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | ||
| 9474 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | ||
| 9475 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | ||
| 9476 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), | ||
| 9477 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | ||
| 9478 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | ||
| 9479 | |||
| 9480 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), | ||
| 9481 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), | ||
| 9482 | SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), | ||
| 9483 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL), | ||
| 9484 | SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL), | ||
| 9485 | SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL), | ||
| 9486 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG), | ||
| 9487 | |||
| 9488 | {} | ||
| 9489 | }; | ||
| 9490 | |||
| 9491 | /* codec SSID table for Intel Mac */ | ||
| 9492 | static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { | ||
| 9493 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), | ||
| 9494 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), | ||
| 9495 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), | ||
| 9496 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO), | ||
| 9497 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24), | ||
| 9498 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24), | ||
| 9499 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), | ||
| 9500 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), | ||
| 9501 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M), | ||
| 9502 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), | ||
| 9503 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), | ||
| 9504 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), | ||
| 9505 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), | ||
| 9506 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), | ||
| 9507 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), | ||
| 9508 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), | ||
| 9509 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), | ||
| 9510 | /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, | ||
| 9511 | * so apparently no perfect solution yet | ||
| 9512 | */ | ||
| 9513 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), | ||
| 9514 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), | ||
| 9515 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3), | ||
| 9516 | {} /* terminator */ | ||
| 9517 | }; | ||
| 9518 | |||
| 9519 | static struct alc_config_preset alc882_presets[] = { | ||
| 9520 | [ALC882_3ST_DIG] = { | ||
| 9521 | .mixers = { alc882_base_mixer }, | ||
| 9522 | .init_verbs = { alc882_base_init_verbs, | ||
| 9523 | alc882_adc1_init_verbs }, | ||
| 9524 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9525 | .dac_nids = alc882_dac_nids, | ||
| 9526 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9527 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9528 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
| 9529 | .channel_mode = alc882_ch_modes, | ||
| 9530 | .need_dac_fix = 1, | ||
| 9531 | .input_mux = &alc882_capture_source, | ||
| 9532 | }, | ||
| 9533 | [ALC882_6ST_DIG] = { | ||
| 9534 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
| 9535 | .init_verbs = { alc882_base_init_verbs, | ||
| 9536 | alc882_adc1_init_verbs }, | ||
| 9537 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9538 | .dac_nids = alc882_dac_nids, | ||
| 9539 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9540 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9541 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
| 9542 | .channel_mode = alc882_sixstack_modes, | ||
| 9543 | .input_mux = &alc882_capture_source, | ||
| 9544 | }, | ||
| 9545 | [ALC882_ARIMA] = { | ||
| 9546 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, | ||
| 9547 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
| 9548 | alc882_eapd_verbs }, | ||
| 9549 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9550 | .dac_nids = alc882_dac_nids, | ||
| 9551 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), | ||
| 9552 | .channel_mode = alc882_sixstack_modes, | ||
| 9553 | .input_mux = &alc882_capture_source, | ||
| 9554 | }, | ||
| 9555 | [ALC882_W2JC] = { | ||
| 9556 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, | ||
| 9557 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
| 9558 | alc882_eapd_verbs, alc880_gpio1_init_verbs }, | ||
| 9559 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9560 | .dac_nids = alc882_dac_nids, | ||
| 9561 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 9562 | .channel_mode = alc880_threestack_modes, | ||
| 9563 | .need_dac_fix = 1, | ||
| 9564 | .input_mux = &alc882_capture_source, | ||
| 9565 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9566 | }, | ||
| 9567 | [ALC885_MBA21] = { | ||
| 9568 | .mixers = { alc885_mba21_mixer }, | ||
| 9569 | .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, | ||
| 9570 | .num_dacs = 2, | ||
| 9571 | .dac_nids = alc882_dac_nids, | ||
| 9572 | .channel_mode = alc885_mba21_ch_modes, | ||
| 9573 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | ||
| 9574 | .input_mux = &alc882_capture_source, | ||
| 9575 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9576 | .setup = alc885_mba21_setup, | ||
| 9577 | .init_hook = alc_automute_amp, | ||
| 9578 | }, | ||
| 9579 | [ALC885_MBP3] = { | ||
| 9580 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, | ||
| 9581 | .init_verbs = { alc885_mbp3_init_verbs, | ||
| 9582 | alc880_gpio1_init_verbs }, | ||
| 9583 | .num_dacs = 2, | ||
| 9584 | .dac_nids = alc882_dac_nids, | ||
| 9585 | .hp_nid = 0x04, | ||
| 9586 | .channel_mode = alc885_mbp_4ch_modes, | ||
| 9587 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes), | ||
| 9588 | .input_mux = &alc882_capture_source, | ||
| 9589 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9590 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9591 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9592 | .setup = alc885_mbp3_setup, | ||
| 9593 | .init_hook = alc_automute_amp, | ||
| 9594 | }, | ||
| 9595 | [ALC885_MB5] = { | ||
| 9596 | .mixers = { alc885_mb5_mixer, alc882_chmode_mixer }, | ||
| 9597 | .init_verbs = { alc885_mb5_init_verbs, | ||
| 9598 | alc880_gpio1_init_verbs }, | ||
| 9599 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9600 | .dac_nids = alc882_dac_nids, | ||
| 9601 | .channel_mode = alc885_mb5_6ch_modes, | ||
| 9602 | .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes), | ||
| 9603 | .input_mux = &mb5_capture_source, | ||
| 9604 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9605 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9606 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9607 | .setup = alc885_mb5_setup, | ||
| 9608 | .init_hook = alc_automute_amp, | ||
| 9609 | }, | ||
| 9610 | [ALC885_MACMINI3] = { | ||
| 9611 | .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, | ||
| 9612 | .init_verbs = { alc885_macmini3_init_verbs, | ||
| 9613 | alc880_gpio1_init_verbs }, | ||
| 9614 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9615 | .dac_nids = alc882_dac_nids, | ||
| 9616 | .channel_mode = alc885_macmini3_6ch_modes, | ||
| 9617 | .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), | ||
| 9618 | .input_mux = &macmini3_capture_source, | ||
| 9619 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9620 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9621 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9622 | .setup = alc885_macmini3_setup, | ||
| 9623 | .init_hook = alc_automute_amp, | ||
| 9624 | }, | ||
| 9625 | [ALC885_MACPRO] = { | ||
| 9626 | .mixers = { alc882_macpro_mixer }, | ||
| 9627 | .init_verbs = { alc882_macpro_init_verbs }, | ||
| 9628 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9629 | .dac_nids = alc882_dac_nids, | ||
| 9630 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9631 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9632 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
| 9633 | .channel_mode = alc882_ch_modes, | ||
| 9634 | .input_mux = &alc882_capture_source, | ||
| 9635 | .init_hook = alc885_macpro_init_hook, | ||
| 9636 | }, | ||
| 9637 | [ALC885_IMAC24] = { | ||
| 9638 | .mixers = { alc885_imac24_mixer }, | ||
| 9639 | .init_verbs = { alc885_imac24_init_verbs }, | ||
| 9640 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9641 | .dac_nids = alc882_dac_nids, | ||
| 9642 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9643 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9644 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), | ||
| 9645 | .channel_mode = alc882_ch_modes, | ||
| 9646 | .input_mux = &alc882_capture_source, | ||
| 9647 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9648 | .setup = alc885_imac24_setup, | ||
| 9649 | .init_hook = alc885_imac24_init_hook, | ||
| 9650 | }, | ||
| 9651 | [ALC885_IMAC91] = { | ||
| 9652 | .mixers = {alc885_imac91_mixer}, | ||
| 9653 | .init_verbs = { alc885_imac91_init_verbs, | ||
| 9654 | alc880_gpio1_init_verbs }, | ||
| 9655 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9656 | .dac_nids = alc882_dac_nids, | ||
| 9657 | .channel_mode = alc885_mba21_ch_modes, | ||
| 9658 | .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), | ||
| 9659 | .input_mux = &alc889A_imac91_capture_source, | ||
| 9660 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9661 | .dig_in_nid = ALC882_DIGIN_NID, | ||
| 9662 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9663 | .setup = alc885_imac91_setup, | ||
| 9664 | .init_hook = alc_automute_amp, | ||
| 9665 | }, | ||
| 9666 | [ALC882_TARGA] = { | ||
| 9667 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | ||
| 9668 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
| 9669 | alc880_gpio3_init_verbs, alc882_targa_verbs}, | ||
| 9670 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9671 | .dac_nids = alc882_dac_nids, | ||
| 9672 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9673 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
| 9674 | .adc_nids = alc882_adc_nids, | ||
| 9675 | .capsrc_nids = alc882_capsrc_nids, | ||
| 9676 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
| 9677 | .channel_mode = alc882_3ST_6ch_modes, | ||
| 9678 | .need_dac_fix = 1, | ||
| 9679 | .input_mux = &alc882_capture_source, | ||
| 9680 | .unsol_event = alc882_targa_unsol_event, | ||
| 9681 | .setup = alc882_targa_setup, | ||
| 9682 | .init_hook = alc882_targa_automute, | ||
| 9683 | }, | ||
| 9684 | [ALC882_ASUS_A7J] = { | ||
| 9685 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, | ||
| 9686 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
| 9687 | alc882_asus_a7j_verbs}, | ||
| 9688 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9689 | .dac_nids = alc882_dac_nids, | ||
| 9690 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9691 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | ||
| 9692 | .adc_nids = alc882_adc_nids, | ||
| 9693 | .capsrc_nids = alc882_capsrc_nids, | ||
| 9694 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | ||
| 9695 | .channel_mode = alc882_3ST_6ch_modes, | ||
| 9696 | .need_dac_fix = 1, | ||
| 9697 | .input_mux = &alc882_capture_source, | ||
| 9698 | }, | ||
| 9699 | [ALC882_ASUS_A7M] = { | ||
| 9700 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | ||
| 9701 | .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs, | ||
| 9702 | alc882_eapd_verbs, alc880_gpio1_init_verbs, | ||
| 9703 | alc882_asus_a7m_verbs }, | ||
| 9704 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | ||
| 9705 | .dac_nids = alc882_dac_nids, | ||
| 9706 | .dig_out_nid = ALC882_DIGOUT_NID, | ||
| 9707 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), | ||
| 9708 | .channel_mode = alc880_threestack_modes, | ||
| 9709 | .need_dac_fix = 1, | ||
| 9710 | .input_mux = &alc882_capture_source, | ||
| 9711 | }, | ||
| 9712 | [ALC883_3ST_2ch_DIG] = { | ||
| 9713 | .mixers = { alc883_3ST_2ch_mixer }, | ||
| 9714 | .init_verbs = { alc883_init_verbs }, | ||
| 9715 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9716 | .dac_nids = alc883_dac_nids, | ||
| 9717 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9718 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9719 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9720 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9721 | .input_mux = &alc883_capture_source, | ||
| 9722 | }, | ||
| 9723 | [ALC883_3ST_6ch_DIG] = { | ||
| 9724 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 9725 | .init_verbs = { alc883_init_verbs }, | ||
| 9726 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9727 | .dac_nids = alc883_dac_nids, | ||
| 9728 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9729 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9730 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9731 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9732 | .need_dac_fix = 1, | ||
| 9733 | .input_mux = &alc883_capture_source, | ||
| 9734 | }, | ||
| 9735 | [ALC883_3ST_6ch] = { | ||
| 9736 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 9737 | .init_verbs = { alc883_init_verbs }, | ||
| 9738 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9739 | .dac_nids = alc883_dac_nids, | ||
| 9740 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9741 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9742 | .need_dac_fix = 1, | ||
| 9743 | .input_mux = &alc883_capture_source, | ||
| 9744 | }, | ||
| 9745 | [ALC883_3ST_6ch_INTEL] = { | ||
| 9746 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, | ||
| 9747 | .init_verbs = { alc883_init_verbs }, | ||
| 9748 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9749 | .dac_nids = alc883_dac_nids, | ||
| 9750 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9751 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9752 | .slave_dig_outs = alc883_slave_dig_outs, | ||
| 9753 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), | ||
| 9754 | .channel_mode = alc883_3ST_6ch_intel_modes, | ||
| 9755 | .need_dac_fix = 1, | ||
| 9756 | .input_mux = &alc883_3stack_6ch_intel, | ||
| 9757 | }, | ||
| 9758 | [ALC889A_INTEL] = { | ||
| 9759 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
| 9760 | .init_verbs = { alc885_init_verbs, alc885_init_input_verbs, | ||
| 9761 | alc_hp15_unsol_verbs }, | ||
| 9762 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9763 | .dac_nids = alc883_dac_nids, | ||
| 9764 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
| 9765 | .adc_nids = alc889_adc_nids, | ||
| 9766 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9767 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9768 | .slave_dig_outs = alc883_slave_dig_outs, | ||
| 9769 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
| 9770 | .channel_mode = alc889_8ch_intel_modes, | ||
| 9771 | .capsrc_nids = alc889_capsrc_nids, | ||
| 9772 | .input_mux = &alc889_capture_source, | ||
| 9773 | .setup = alc889_automute_setup, | ||
| 9774 | .init_hook = alc_automute_amp, | ||
| 9775 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9776 | .need_dac_fix = 1, | ||
| 9777 | }, | ||
| 9778 | [ALC889_INTEL] = { | ||
| 9779 | .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer }, | ||
| 9780 | .init_verbs = { alc885_init_verbs, alc889_init_input_verbs, | ||
| 9781 | alc889_eapd_verbs, alc_hp15_unsol_verbs}, | ||
| 9782 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9783 | .dac_nids = alc883_dac_nids, | ||
| 9784 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
| 9785 | .adc_nids = alc889_adc_nids, | ||
| 9786 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9787 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9788 | .slave_dig_outs = alc883_slave_dig_outs, | ||
| 9789 | .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes), | ||
| 9790 | .channel_mode = alc889_8ch_intel_modes, | ||
| 9791 | .capsrc_nids = alc889_capsrc_nids, | ||
| 9792 | .input_mux = &alc889_capture_source, | ||
| 9793 | .setup = alc889_automute_setup, | ||
| 9794 | .init_hook = alc889_intel_init_hook, | ||
| 9795 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9796 | .need_dac_fix = 1, | ||
| 9797 | }, | ||
| 9798 | [ALC883_6ST_DIG] = { | ||
| 9799 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
| 9800 | .init_verbs = { alc883_init_verbs }, | ||
| 9801 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9802 | .dac_nids = alc883_dac_nids, | ||
| 9803 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9804 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9805 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
| 9806 | .channel_mode = alc883_sixstack_modes, | ||
| 9807 | .input_mux = &alc883_capture_source, | ||
| 9808 | }, | ||
| 9809 | [ALC883_TARGA_DIG] = { | ||
| 9810 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | ||
| 9811 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
| 9812 | alc883_targa_verbs}, | ||
| 9813 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9814 | .dac_nids = alc883_dac_nids, | ||
| 9815 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9816 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9817 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9818 | .need_dac_fix = 1, | ||
| 9819 | .input_mux = &alc883_capture_source, | ||
| 9820 | .unsol_event = alc883_targa_unsol_event, | ||
| 9821 | .setup = alc882_targa_setup, | ||
| 9822 | .init_hook = alc882_targa_automute, | ||
| 9823 | }, | ||
| 9824 | [ALC883_TARGA_2ch_DIG] = { | ||
| 9825 | .mixers = { alc883_targa_2ch_mixer}, | ||
| 9826 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
| 9827 | alc883_targa_verbs}, | ||
| 9828 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9829 | .dac_nids = alc883_dac_nids, | ||
| 9830 | .adc_nids = alc883_adc_nids_alt, | ||
| 9831 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
| 9832 | .capsrc_nids = alc883_capsrc_nids, | ||
| 9833 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9834 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9835 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9836 | .input_mux = &alc883_capture_source, | ||
| 9837 | .unsol_event = alc883_targa_unsol_event, | ||
| 9838 | .setup = alc882_targa_setup, | ||
| 9839 | .init_hook = alc882_targa_automute, | ||
| 9840 | }, | ||
| 9841 | [ALC883_TARGA_8ch_DIG] = { | ||
| 9842 | .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer, | ||
| 9843 | alc883_chmode_mixer }, | ||
| 9844 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, | ||
| 9845 | alc883_targa_verbs }, | ||
| 9846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9847 | .dac_nids = alc883_dac_nids, | ||
| 9848 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
| 9849 | .adc_nids = alc883_adc_nids_rev, | ||
| 9850 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
| 9851 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9852 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 9853 | .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes), | ||
| 9854 | .channel_mode = alc883_4ST_8ch_modes, | ||
| 9855 | .need_dac_fix = 1, | ||
| 9856 | .input_mux = &alc883_capture_source, | ||
| 9857 | .unsol_event = alc883_targa_unsol_event, | ||
| 9858 | .setup = alc882_targa_setup, | ||
| 9859 | .init_hook = alc882_targa_automute, | ||
| 9860 | }, | ||
| 9861 | [ALC883_ACER] = { | ||
| 9862 | .mixers = { alc883_base_mixer }, | ||
| 9863 | /* On TravelMate laptops, GPIO 0 enables the internal speaker | ||
| 9864 | * and the headphone jack. Turn this on and rely on the | ||
| 9865 | * standard mute methods whenever the user wants to turn | ||
| 9866 | * these outputs off. | ||
| 9867 | */ | ||
| 9868 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | ||
| 9869 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9870 | .dac_nids = alc883_dac_nids, | ||
| 9871 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9872 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9873 | .input_mux = &alc883_capture_source, | ||
| 9874 | }, | ||
| 9875 | [ALC883_ACER_ASPIRE] = { | ||
| 9876 | .mixers = { alc883_acer_aspire_mixer }, | ||
| 9877 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, | ||
| 9878 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9879 | .dac_nids = alc883_dac_nids, | ||
| 9880 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9881 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9882 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9883 | .input_mux = &alc883_capture_source, | ||
| 9884 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9885 | .setup = alc883_acer_aspire_setup, | ||
| 9886 | .init_hook = alc_automute_amp, | ||
| 9887 | }, | ||
| 9888 | [ALC888_ACER_ASPIRE_4930G] = { | ||
| 9889 | .mixers = { alc888_base_mixer, | ||
| 9890 | alc883_chmode_mixer }, | ||
| 9891 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
| 9892 | alc888_acer_aspire_4930g_verbs }, | ||
| 9893 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9894 | .dac_nids = alc883_dac_nids, | ||
| 9895 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
| 9896 | .adc_nids = alc883_adc_nids_rev, | ||
| 9897 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
| 9898 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9899 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9900 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9901 | .need_dac_fix = 1, | ||
| 9902 | .const_channel_count = 6, | ||
| 9903 | .num_mux_defs = | ||
| 9904 | ARRAY_SIZE(alc888_2_capture_sources), | ||
| 9905 | .input_mux = alc888_2_capture_sources, | ||
| 9906 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9907 | .setup = alc888_acer_aspire_4930g_setup, | ||
| 9908 | .init_hook = alc_automute_amp, | ||
| 9909 | }, | ||
| 9910 | [ALC888_ACER_ASPIRE_6530G] = { | ||
| 9911 | .mixers = { alc888_acer_aspire_6530_mixer }, | ||
| 9912 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
| 9913 | alc888_acer_aspire_6530g_verbs }, | ||
| 9914 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9915 | .dac_nids = alc883_dac_nids, | ||
| 9916 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
| 9917 | .adc_nids = alc883_adc_nids_rev, | ||
| 9918 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
| 9919 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9920 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9921 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9922 | .num_mux_defs = | ||
| 9923 | ARRAY_SIZE(alc888_2_capture_sources), | ||
| 9924 | .input_mux = alc888_acer_aspire_6530_sources, | ||
| 9925 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9926 | .setup = alc888_acer_aspire_6530g_setup, | ||
| 9927 | .init_hook = alc_automute_amp, | ||
| 9928 | }, | ||
| 9929 | [ALC888_ACER_ASPIRE_8930G] = { | ||
| 9930 | .mixers = { alc889_acer_aspire_8930g_mixer, | ||
| 9931 | alc883_chmode_mixer }, | ||
| 9932 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
| 9933 | alc889_acer_aspire_8930g_verbs, | ||
| 9934 | alc889_eapd_verbs}, | ||
| 9935 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9936 | .dac_nids = alc883_dac_nids, | ||
| 9937 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | ||
| 9938 | .adc_nids = alc889_adc_nids, | ||
| 9939 | .capsrc_nids = alc889_capsrc_nids, | ||
| 9940 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9941 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9942 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9943 | .need_dac_fix = 1, | ||
| 9944 | .const_channel_count = 6, | ||
| 9945 | .num_mux_defs = | ||
| 9946 | ARRAY_SIZE(alc889_capture_sources), | ||
| 9947 | .input_mux = alc889_capture_sources, | ||
| 9948 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9949 | .setup = alc889_acer_aspire_8930g_setup, | ||
| 9950 | .init_hook = alc_automute_amp, | ||
| 9951 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 9952 | .power_hook = alc_power_eapd, | ||
| 9953 | #endif | ||
| 9954 | }, | ||
| 9955 | [ALC888_ACER_ASPIRE_7730G] = { | ||
| 9956 | .mixers = { alc883_3ST_6ch_mixer, | ||
| 9957 | alc883_chmode_mixer }, | ||
| 9958 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | ||
| 9959 | alc888_acer_aspire_7730G_verbs }, | ||
| 9960 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9961 | .dac_nids = alc883_dac_nids, | ||
| 9962 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
| 9963 | .adc_nids = alc883_adc_nids_rev, | ||
| 9964 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
| 9965 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9966 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 9967 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 9968 | .need_dac_fix = 1, | ||
| 9969 | .const_channel_count = 6, | ||
| 9970 | .input_mux = &alc883_capture_source, | ||
| 9971 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9972 | .setup = alc888_acer_aspire_6530g_setup, | ||
| 9973 | .init_hook = alc_automute_amp, | ||
| 9974 | }, | ||
| 9975 | [ALC883_MEDION] = { | ||
| 9976 | .mixers = { alc883_fivestack_mixer, | ||
| 9977 | alc883_chmode_mixer }, | ||
| 9978 | .init_verbs = { alc883_init_verbs, | ||
| 9979 | alc883_medion_eapd_verbs }, | ||
| 9980 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9981 | .dac_nids = alc883_dac_nids, | ||
| 9982 | .adc_nids = alc883_adc_nids_alt, | ||
| 9983 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
| 9984 | .capsrc_nids = alc883_capsrc_nids, | ||
| 9985 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
| 9986 | .channel_mode = alc883_sixstack_modes, | ||
| 9987 | .input_mux = &alc883_capture_source, | ||
| 9988 | }, | ||
| 9989 | [ALC883_MEDION_MD2] = { | ||
| 9990 | .mixers = { alc883_medion_md2_mixer}, | ||
| 9991 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, | ||
| 9992 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9993 | .dac_nids = alc883_dac_nids, | ||
| 9994 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9995 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9996 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9997 | .input_mux = &alc883_capture_source, | ||
| 9998 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9999 | .setup = alc883_medion_md2_setup, | ||
| 10000 | .init_hook = alc_automute_amp, | ||
| 10001 | }, | ||
| 10002 | [ALC883_MEDION_WIM2160] = { | ||
| 10003 | .mixers = { alc883_medion_wim2160_mixer }, | ||
| 10004 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | ||
| 10005 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10006 | .dac_nids = alc883_dac_nids, | ||
| 10007 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10008 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
| 10009 | .adc_nids = alc883_adc_nids, | ||
| 10010 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10011 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10012 | .input_mux = &alc883_capture_source, | ||
| 10013 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10014 | .setup = alc883_medion_wim2160_setup, | ||
| 10015 | .init_hook = alc_automute_amp, | ||
| 10016 | }, | ||
| 10017 | [ALC883_LAPTOP_EAPD] = { | ||
| 10018 | .mixers = { alc883_base_mixer }, | ||
| 10019 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | ||
| 10020 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10021 | .dac_nids = alc883_dac_nids, | ||
| 10022 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10023 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10024 | .input_mux = &alc883_capture_source, | ||
| 10025 | }, | ||
| 10026 | [ALC883_CLEVO_M540R] = { | ||
| 10027 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 10028 | .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs }, | ||
| 10029 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10030 | .dac_nids = alc883_dac_nids, | ||
| 10031 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10032 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 10033 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes), | ||
| 10034 | .channel_mode = alc883_3ST_6ch_clevo_modes, | ||
| 10035 | .need_dac_fix = 1, | ||
| 10036 | .input_mux = &alc883_capture_source, | ||
| 10037 | /* This machine has the hardware HP auto-muting, thus | ||
| 10038 | * we need no software mute via unsol event | ||
| 10039 | */ | ||
| 10040 | }, | ||
| 10041 | [ALC883_CLEVO_M720] = { | ||
| 10042 | .mixers = { alc883_clevo_m720_mixer }, | ||
| 10043 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, | ||
| 10044 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10045 | .dac_nids = alc883_dac_nids, | ||
| 10046 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10047 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10048 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10049 | .input_mux = &alc883_capture_source, | ||
| 10050 | .unsol_event = alc883_clevo_m720_unsol_event, | ||
| 10051 | .setup = alc883_clevo_m720_setup, | ||
| 10052 | .init_hook = alc883_clevo_m720_init_hook, | ||
| 10053 | }, | ||
| 10054 | [ALC883_LENOVO_101E_2ch] = { | ||
| 10055 | .mixers = { alc883_lenovo_101e_2ch_mixer}, | ||
| 10056 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | ||
| 10057 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10058 | .dac_nids = alc883_dac_nids, | ||
| 10059 | .adc_nids = alc883_adc_nids_alt, | ||
| 10060 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | ||
| 10061 | .capsrc_nids = alc883_capsrc_nids, | ||
| 10062 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10063 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10064 | .input_mux = &alc883_lenovo_101e_capture_source, | ||
| 10065 | .unsol_event = alc883_lenovo_101e_unsol_event, | ||
| 10066 | .init_hook = alc883_lenovo_101e_all_automute, | ||
| 10067 | }, | ||
| 10068 | [ALC883_LENOVO_NB0763] = { | ||
| 10069 | .mixers = { alc883_lenovo_nb0763_mixer }, | ||
| 10070 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | ||
| 10071 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10072 | .dac_nids = alc883_dac_nids, | ||
| 10073 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10074 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10075 | .need_dac_fix = 1, | ||
| 10076 | .input_mux = &alc883_lenovo_nb0763_capture_source, | ||
| 10077 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10078 | .setup = alc883_medion_md2_setup, | ||
| 10079 | .init_hook = alc_automute_amp, | ||
| 10080 | }, | ||
| 10081 | [ALC888_LENOVO_MS7195_DIG] = { | ||
| 10082 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 10083 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, | ||
| 10084 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10085 | .dac_nids = alc883_dac_nids, | ||
| 10086 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10087 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 10088 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 10089 | .need_dac_fix = 1, | ||
| 10090 | .input_mux = &alc883_capture_source, | ||
| 10091 | .unsol_event = alc883_lenovo_ms7195_unsol_event, | ||
| 10092 | .init_hook = alc888_lenovo_ms7195_front_automute, | ||
| 10093 | }, | ||
| 10094 | [ALC883_HAIER_W66] = { | ||
| 10095 | .mixers = { alc883_targa_2ch_mixer}, | ||
| 10096 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, | ||
| 10097 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10098 | .dac_nids = alc883_dac_nids, | ||
| 10099 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10100 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10101 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10102 | .input_mux = &alc883_capture_source, | ||
| 10103 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10104 | .setup = alc883_haier_w66_setup, | ||
| 10105 | .init_hook = alc_automute_amp, | ||
| 10106 | }, | ||
| 10107 | [ALC888_3ST_HP] = { | ||
| 10108 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 10109 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | ||
| 10110 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10111 | .dac_nids = alc883_dac_nids, | ||
| 10112 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | ||
| 10113 | .channel_mode = alc888_3st_hp_modes, | ||
| 10114 | .need_dac_fix = 1, | ||
| 10115 | .input_mux = &alc883_capture_source, | ||
| 10116 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10117 | .setup = alc888_3st_hp_setup, | ||
| 10118 | .init_hook = alc_automute_amp, | ||
| 10119 | }, | ||
| 10120 | [ALC888_6ST_DELL] = { | ||
| 10121 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
| 10122 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, | ||
| 10123 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10124 | .dac_nids = alc883_dac_nids, | ||
| 10125 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10126 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 10127 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
| 10128 | .channel_mode = alc883_sixstack_modes, | ||
| 10129 | .input_mux = &alc883_capture_source, | ||
| 10130 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10131 | .setup = alc888_6st_dell_setup, | ||
| 10132 | .init_hook = alc_automute_amp, | ||
| 10133 | }, | ||
| 10134 | [ALC883_MITAC] = { | ||
| 10135 | .mixers = { alc883_mitac_mixer }, | ||
| 10136 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | ||
| 10137 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10138 | .dac_nids = alc883_dac_nids, | ||
| 10139 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10140 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10141 | .input_mux = &alc883_capture_source, | ||
| 10142 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10143 | .setup = alc883_mitac_setup, | ||
| 10144 | .init_hook = alc_automute_amp, | ||
| 10145 | }, | ||
| 10146 | [ALC883_FUJITSU_PI2515] = { | ||
| 10147 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, | ||
| 10148 | .init_verbs = { alc883_init_verbs, | ||
| 10149 | alc883_2ch_fujitsu_pi2515_verbs}, | ||
| 10150 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10151 | .dac_nids = alc883_dac_nids, | ||
| 10152 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10153 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10154 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10155 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
| 10156 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10157 | .setup = alc883_2ch_fujitsu_pi2515_setup, | ||
| 10158 | .init_hook = alc_automute_amp, | ||
| 10159 | }, | ||
| 10160 | [ALC888_FUJITSU_XA3530] = { | ||
| 10161 | .mixers = { alc888_base_mixer, alc883_chmode_mixer }, | ||
| 10162 | .init_verbs = { alc883_init_verbs, | ||
| 10163 | alc888_fujitsu_xa3530_verbs }, | ||
| 10164 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10165 | .dac_nids = alc883_dac_nids, | ||
| 10166 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), | ||
| 10167 | .adc_nids = alc883_adc_nids_rev, | ||
| 10168 | .capsrc_nids = alc883_capsrc_nids_rev, | ||
| 10169 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10170 | .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), | ||
| 10171 | .channel_mode = alc888_4ST_8ch_intel_modes, | ||
| 10172 | .num_mux_defs = | ||
| 10173 | ARRAY_SIZE(alc888_2_capture_sources), | ||
| 10174 | .input_mux = alc888_2_capture_sources, | ||
| 10175 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10176 | .setup = alc888_fujitsu_xa3530_setup, | ||
| 10177 | .init_hook = alc_automute_amp, | ||
| 10178 | }, | ||
| 10179 | [ALC888_LENOVO_SKY] = { | ||
| 10180 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | ||
| 10181 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | ||
| 10182 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10183 | .dac_nids = alc883_dac_nids, | ||
| 10184 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10185 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
| 10186 | .channel_mode = alc883_sixstack_modes, | ||
| 10187 | .need_dac_fix = 1, | ||
| 10188 | .input_mux = &alc883_lenovo_sky_capture_source, | ||
| 10189 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10190 | .setup = alc888_lenovo_sky_setup, | ||
| 10191 | .init_hook = alc_automute_amp, | ||
| 10192 | }, | ||
| 10193 | [ALC888_ASUS_M90V] = { | ||
| 10194 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
| 10195 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | ||
| 10196 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10197 | .dac_nids = alc883_dac_nids, | ||
| 10198 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10199 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 10200 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
| 10201 | .channel_mode = alc883_3ST_6ch_modes, | ||
| 10202 | .need_dac_fix = 1, | ||
| 10203 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
| 10204 | .unsol_event = alc_sku_unsol_event, | ||
| 10205 | .setup = alc883_mode2_setup, | ||
| 10206 | .init_hook = alc_inithook, | ||
| 10207 | }, | ||
| 10208 | [ALC888_ASUS_EEE1601] = { | ||
| 10209 | .mixers = { alc883_asus_eee1601_mixer }, | ||
| 10210 | .cap_mixer = alc883_asus_eee1601_cap_mixer, | ||
| 10211 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | ||
| 10212 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10213 | .dac_nids = alc883_dac_nids, | ||
| 10214 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10215 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 10216 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10217 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10218 | .need_dac_fix = 1, | ||
| 10219 | .input_mux = &alc883_asus_eee1601_capture_source, | ||
| 10220 | .unsol_event = alc_sku_unsol_event, | ||
| 10221 | .init_hook = alc883_eee1601_inithook, | ||
| 10222 | }, | ||
| 10223 | [ALC1200_ASUS_P5Q] = { | ||
| 10224 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | ||
| 10225 | .init_verbs = { alc883_init_verbs }, | ||
| 10226 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10227 | .dac_nids = alc883_dac_nids, | ||
| 10228 | .dig_out_nid = ALC1200_DIGOUT_NID, | ||
| 10229 | .dig_in_nid = ALC883_DIGIN_NID, | ||
| 10230 | .slave_dig_outs = alc1200_slave_dig_outs, | ||
| 10231 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
| 10232 | .channel_mode = alc883_sixstack_modes, | ||
| 10233 | .input_mux = &alc883_capture_source, | ||
| 10234 | }, | ||
| 10235 | [ALC889A_MB31] = { | ||
| 10236 | .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, | ||
| 10237 | .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, | ||
| 10238 | alc880_gpio1_init_verbs }, | ||
| 10239 | .adc_nids = alc883_adc_nids, | ||
| 10240 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
| 10241 | .capsrc_nids = alc883_capsrc_nids, | ||
| 10242 | .dac_nids = alc883_dac_nids, | ||
| 10243 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10244 | .channel_mode = alc889A_mb31_6ch_modes, | ||
| 10245 | .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes), | ||
| 10246 | .input_mux = &alc889A_mb31_capture_source, | ||
| 10247 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 10248 | .unsol_event = alc889A_mb31_unsol_event, | ||
| 10249 | .init_hook = alc889A_mb31_automute, | ||
| 10250 | }, | ||
| 10251 | [ALC883_SONY_VAIO_TT] = { | ||
| 10252 | .mixers = { alc883_vaiott_mixer }, | ||
| 10253 | .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs }, | ||
| 10254 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 10255 | .dac_nids = alc883_dac_nids, | ||
| 10256 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 10257 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 10258 | .input_mux = &alc883_capture_source, | ||
| 10259 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 10260 | .setup = alc883_vaiott_setup, | ||
| 10261 | .init_hook = alc_automute_amp, | ||
| 10262 | }, | ||
| 10263 | }; | ||
| 10264 | |||
| 10265 | |||
| 10266 | /* | ||
| 10267 | * Pin config fixes | ||
| 10268 | */ | ||
| 10269 | enum { | ||
| 10270 | PINFIX_ABIT_AW9D_MAX | ||
| 10271 | }; | ||
| 10272 | |||
| 10273 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { | ||
| 10274 | { 0x15, 0x01080104 }, /* side */ | ||
| 10275 | { 0x16, 0x01011012 }, /* rear */ | ||
| 10276 | { 0x17, 0x01016011 }, /* clfe */ | ||
| 10277 | { } | ||
| 10278 | }; | ||
| 10279 | |||
| 10280 | static const struct alc_fixup alc882_fixups[] = { | ||
| 10281 | [PINFIX_ABIT_AW9D_MAX] = { | ||
| 10282 | .pins = alc882_abit_aw9d_pinfix | ||
| 10283 | }, | ||
| 10284 | }; | ||
| 10285 | |||
| 10286 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | ||
| 10287 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | ||
| 10288 | {} | ||
| 10289 | }; | ||
| 10290 | |||
| 10291 | /* | ||
| 10292 | * BIOS auto configuration | ||
| 10293 | */ | ||
| 10294 | static int alc882_auto_create_input_ctls(struct hda_codec *codec, | ||
| 10295 | const struct auto_pin_cfg *cfg) | ||
| 10296 | { | ||
| 10297 | return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22); | ||
| 10298 | } | ||
| 10299 | |||
| 10300 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 10301 | hda_nid_t nid, int pin_type, | ||
| 10302 | hda_nid_t dac) | ||
| 10303 | { | ||
| 10304 | int idx; | ||
| 10305 | |||
| 10306 | /* set as output */ | ||
| 10307 | alc_set_pin_output(codec, nid, pin_type); | ||
| 10308 | |||
| 10309 | if (dac == 0x25) | ||
| 10310 | idx = 4; | ||
| 10311 | else if (dac >= 0x02 && dac <= 0x05) | ||
| 10312 | idx = dac - 2; | ||
| 10313 | else | ||
| 10314 | return; | ||
| 10315 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | ||
| 10316 | } | ||
| 10317 | |||
| 10318 | static void alc882_auto_init_multi_out(struct hda_codec *codec) | ||
| 10319 | { | ||
| 10320 | struct alc_spec *spec = codec->spec; | ||
| 10321 | int i; | ||
| 10322 | |||
| 10323 | for (i = 0; i <= HDA_SIDE; i++) { | ||
| 10324 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
| 10325 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 10326 | if (nid) | ||
| 10327 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, | ||
| 10328 | spec->multiout.dac_nids[i]); | ||
| 10329 | } | ||
| 10330 | } | ||
| 10331 | |||
| 10332 | static void alc882_auto_init_hp_out(struct hda_codec *codec) | ||
| 10333 | { | ||
| 10334 | struct alc_spec *spec = codec->spec; | ||
| 10335 | hda_nid_t pin, dac; | ||
| 10336 | |||
| 10337 | pin = spec->autocfg.hp_pins[0]; | ||
| 10338 | if (pin) { | ||
| 10339 | dac = spec->multiout.hp_nid; | ||
| 10340 | if (!dac) | ||
| 10341 | dac = spec->multiout.dac_nids[0]; /* to front */ | ||
| 10342 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | ||
| 10343 | } | ||
| 10344 | pin = spec->autocfg.speaker_pins[0]; | ||
| 10345 | if (pin) { | ||
| 10346 | dac = spec->multiout.extra_out_nid[0]; | ||
| 10347 | if (!dac) | ||
| 10348 | dac = spec->multiout.dac_nids[0]; /* to front */ | ||
| 10349 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | ||
| 10350 | } | ||
| 10351 | } | ||
| 10352 | |||
| 10353 | static void alc882_auto_init_analog_input(struct hda_codec *codec) | ||
| 10354 | { | ||
| 10355 | struct alc_spec *spec = codec->spec; | ||
| 10356 | int i; | ||
| 10357 | |||
| 10358 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 10359 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 10360 | if (!nid) | ||
| 10361 | continue; | ||
| 10362 | alc_set_input_pin(codec, nid, i); | ||
| 10363 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | ||
| 10364 | snd_hda_codec_write(codec, nid, 0, | ||
| 10365 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 10366 | AMP_OUT_MUTE); | ||
| 10367 | } | ||
| 10368 | } | ||
| 10369 | |||
| 10370 | static void alc882_auto_init_input_src(struct hda_codec *codec) | ||
| 10371 | { | ||
| 10372 | struct alc_spec *spec = codec->spec; | ||
| 10373 | int c; | ||
| 10374 | |||
| 10375 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
| 10376 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | ||
| 10377 | hda_nid_t nid = spec->capsrc_nids[c]; | ||
| 10378 | unsigned int mux_idx; | ||
| 10379 | const struct hda_input_mux *imux; | ||
| 10380 | int conns, mute, idx, item; | ||
| 10381 | |||
| 10382 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
| 10383 | ARRAY_SIZE(conn_list)); | ||
| 10384 | if (conns < 0) | ||
| 10385 | continue; | ||
| 10386 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
| 10387 | imux = &spec->input_mux[mux_idx]; | ||
| 10388 | if (!imux->num_items && mux_idx > 0) | ||
| 10389 | imux = &spec->input_mux[0]; | ||
| 10390 | for (idx = 0; idx < conns; idx++) { | ||
| 10391 | /* if the current connection is the selected one, | ||
| 10392 | * unmute it as default - otherwise mute it | ||
| 10393 | */ | ||
| 10394 | mute = AMP_IN_MUTE(idx); | ||
| 10395 | for (item = 0; item < imux->num_items; item++) { | ||
| 10396 | if (imux->items[item].index == idx) { | ||
| 10397 | if (spec->cur_mux[c] == item) | ||
| 10398 | mute = AMP_IN_UNMUTE(idx); | ||
| 10399 | break; | ||
| 10400 | } | ||
| 10401 | } | ||
| 10402 | /* check if we have a selector or mixer | ||
| 10403 | * we could check for the widget type instead, but | ||
| 10404 | * just check for Amp-In presence (in case of mixer | ||
| 10405 | * without amp-in there is something wrong, this | ||
| 10406 | * function shouldn't be used or capsrc nid is wrong) | ||
| 10407 | */ | ||
| 10408 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
| 10409 | snd_hda_codec_write(codec, nid, 0, | ||
| 10410 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 10411 | mute); | ||
| 10412 | else if (mute != AMP_IN_MUTE(idx)) | ||
| 10413 | snd_hda_codec_write(codec, nid, 0, | ||
| 10414 | AC_VERB_SET_CONNECT_SEL, | ||
| 10415 | idx); | ||
| 10416 | } | ||
| 10417 | } | ||
| 10418 | } | ||
| 10419 | |||
| 10420 | /* add mic boosts if needed */ | ||
| 10421 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
| 10422 | { | ||
| 10423 | struct alc_spec *spec = codec->spec; | ||
| 10424 | int err; | ||
| 10425 | hda_nid_t nid; | ||
| 10426 | |||
| 10427 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
| 10428 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
| 10429 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
| 10430 | "Mic Boost", | ||
| 10431 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
| 10432 | if (err < 0) | ||
| 10433 | return err; | ||
| 10434 | } | ||
| 10435 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
| 10436 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { | ||
| 10437 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
| 10438 | "Front Mic Boost", | ||
| 10439 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
| 10440 | if (err < 0) | ||
| 10441 | return err; | ||
| 10442 | } | ||
| 10443 | return 0; | ||
| 10444 | } | ||
| 10445 | |||
| 10446 | /* almost identical with ALC880 parser... */ | ||
| 10447 | static int alc882_parse_auto_config(struct hda_codec *codec) | ||
| 10448 | { | ||
| 10449 | struct alc_spec *spec = codec->spec; | ||
| 10450 | static hda_nid_t alc882_ignore[] = { 0x1d, 0 }; | ||
| 10451 | int i, err; | ||
| 10452 | |||
| 10453 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 10454 | alc882_ignore); | ||
| 10455 | if (err < 0) | ||
| 10456 | return err; | ||
| 10457 | if (!spec->autocfg.line_outs) | ||
| 10458 | return 0; /* can't find valid BIOS pin config */ | ||
| 10459 | |||
| 10460 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | ||
| 10461 | if (err < 0) | ||
| 10462 | return err; | ||
| 10463 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 10464 | if (err < 0) | ||
| 10465 | return err; | ||
| 10466 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], | ||
| 10467 | "Headphone"); | ||
| 10468 | if (err < 0) | ||
| 10469 | return err; | ||
| 10470 | err = alc880_auto_create_extra_out(spec, | ||
| 10471 | spec->autocfg.speaker_pins[0], | ||
| 10472 | "Speaker"); | ||
| 10473 | if (err < 0) | ||
| 10474 | return err; | ||
| 10475 | err = alc882_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 10476 | if (err < 0) | ||
| 10477 | return err; | ||
| 10478 | |||
| 10479 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 10480 | |||
| 10481 | /* check multiple SPDIF-out (for recent codecs) */ | ||
| 10482 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | ||
| 10483 | hda_nid_t dig_nid; | ||
| 10484 | err = snd_hda_get_connections(codec, | ||
| 10485 | spec->autocfg.dig_out_pins[i], | ||
| 10486 | &dig_nid, 1); | ||
| 10487 | if (err < 0) | ||
| 10488 | continue; | ||
| 10489 | if (!i) | ||
| 10490 | spec->multiout.dig_out_nid = dig_nid; | ||
| 10491 | else { | ||
| 10492 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | ||
| 10493 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | ||
| 10494 | break; | ||
| 10495 | spec->slave_dig_outs[i - 1] = dig_nid; | ||
| 10496 | } | ||
| 10497 | } | ||
| 10498 | if (spec->autocfg.dig_in_pin) | ||
| 10499 | spec->dig_in_nid = ALC880_DIGIN_NID; | ||
| 10500 | |||
| 10501 | if (spec->kctls.list) | ||
| 10502 | add_mixer(spec, spec->kctls.list); | ||
| 10503 | |||
| 10504 | add_verb(spec, alc883_auto_init_verbs); | ||
| 10505 | /* if ADC 0x07 is available, initialize it, too */ | ||
| 10506 | if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN) | ||
| 10507 | add_verb(spec, alc882_adc1_init_verbs); | ||
| 10508 | |||
| 10509 | spec->num_mux_defs = 1; | ||
| 10510 | spec->input_mux = &spec->private_imux[0]; | ||
| 10511 | |||
| 10512 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 10513 | |||
| 10514 | err = alc_auto_add_mic_boost(codec); | ||
| 10515 | if (err < 0) | ||
| 10516 | return err; | ||
| 10517 | |||
| 10518 | return 1; /* config found */ | ||
| 10519 | } | ||
| 10520 | |||
| 10521 | /* additional initialization for auto-configuration model */ | ||
| 10522 | static void alc882_auto_init(struct hda_codec *codec) | ||
| 10523 | { | ||
| 10524 | struct alc_spec *spec = codec->spec; | ||
| 10525 | alc882_auto_init_multi_out(codec); | ||
| 10526 | alc882_auto_init_hp_out(codec); | ||
| 10527 | alc882_auto_init_analog_input(codec); | ||
| 10528 | alc882_auto_init_input_src(codec); | ||
| 10529 | if (spec->unsol_event) | ||
| 10530 | alc_inithook(codec); | ||
| 10531 | } | ||
| 10532 | |||
| 10533 | static int patch_alc882(struct hda_codec *codec) | ||
| 10534 | { | ||
| 10535 | struct alc_spec *spec; | ||
| 10536 | int err, board_config; | ||
| 10537 | |||
| 10538 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 10539 | if (spec == NULL) | ||
| 10540 | return -ENOMEM; | ||
| 10541 | |||
| 10542 | codec->spec = spec; | ||
| 10543 | |||
| 10544 | alc_auto_parse_customize_define(codec); | ||
| 10545 | |||
| 10546 | switch (codec->vendor_id) { | ||
| 10547 | case 0x10ec0882: | ||
| 10548 | case 0x10ec0885: | ||
| 10549 | break; | ||
| 10550 | default: | ||
| 10551 | /* ALC883 and variants */ | ||
| 10552 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | ||
| 10553 | break; | ||
| 10554 | } | ||
| 10555 | |||
| 10556 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, | ||
| 10557 | alc882_models, | ||
| 10558 | alc882_cfg_tbl); | ||
| 10559 | |||
| 10560 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) | ||
| 10561 | board_config = snd_hda_check_board_codec_sid_config(codec, | ||
| 10562 | ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); | ||
| 10563 | |||
| 10564 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { | ||
| 10565 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 10566 | codec->chip_name); | ||
| 10567 | board_config = ALC882_AUTO; | ||
| 10568 | } | ||
| 10569 | |||
| 10570 | if (board_config == ALC882_AUTO) | ||
| 10571 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); | ||
| 10572 | |||
| 10573 | if (board_config == ALC882_AUTO) { | ||
| 10574 | /* automatic parse from the BIOS config */ | ||
| 10575 | err = alc882_parse_auto_config(codec); | ||
| 10576 | if (err < 0) { | ||
| 10577 | alc_free(codec); | ||
| 10578 | return err; | ||
| 10579 | } else if (!err) { | ||
| 10580 | printk(KERN_INFO | ||
| 10581 | "hda_codec: Cannot set up configuration " | ||
| 10582 | "from BIOS. Using base mode...\n"); | ||
| 10583 | board_config = ALC882_3ST_DIG; | ||
| 10584 | } | ||
| 10585 | } | ||
| 10586 | |||
| 10587 | if (has_cdefine_beep(codec)) { | ||
| 10588 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 10589 | if (err < 0) { | ||
| 10590 | alc_free(codec); | ||
| 10591 | return err; | ||
| 10592 | } | ||
| 10593 | } | ||
| 10594 | |||
| 10595 | if (board_config != ALC882_AUTO) | ||
| 10596 | setup_preset(codec, &alc882_presets[board_config]); | ||
| 10597 | |||
| 10598 | spec->stream_analog_playback = &alc882_pcm_analog_playback; | ||
| 10599 | spec->stream_analog_capture = &alc882_pcm_analog_capture; | ||
| 10600 | /* FIXME: setup DAC5 */ | ||
| 10601 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ | ||
| 10602 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; | ||
| 10603 | |||
| 10604 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | ||
| 10605 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | ||
| 10606 | |||
| 10607 | if (!spec->adc_nids && spec->input_mux) { | ||
| 10608 | int i, j; | ||
| 10609 | spec->num_adc_nids = 0; | ||
| 10610 | for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) { | ||
| 10611 | const struct hda_input_mux *imux = spec->input_mux; | ||
| 10612 | hda_nid_t cap; | ||
| 10613 | hda_nid_t items[16]; | ||
| 10614 | hda_nid_t nid = alc882_adc_nids[i]; | ||
| 10615 | unsigned int wcap = get_wcaps(codec, nid); | ||
| 10616 | /* get type */ | ||
| 10617 | wcap = get_wcaps_type(wcap); | ||
| 10618 | if (wcap != AC_WID_AUD_IN) | ||
| 10619 | continue; | ||
| 10620 | spec->private_adc_nids[spec->num_adc_nids] = nid; | ||
| 10621 | err = snd_hda_get_connections(codec, nid, &cap, 1); | ||
| 10622 | if (err < 0) | ||
| 10623 | continue; | ||
| 10624 | err = snd_hda_get_connections(codec, cap, items, | ||
| 10625 | ARRAY_SIZE(items)); | ||
| 10626 | if (err < 0) | ||
| 10627 | continue; | ||
| 10628 | for (j = 0; j < imux->num_items; j++) | ||
| 10629 | if (imux->items[j].index >= err) | ||
| 10630 | break; | ||
| 10631 | if (j < imux->num_items) | ||
| 10632 | continue; | ||
| 10633 | spec->private_capsrc_nids[spec->num_adc_nids] = cap; | ||
| 10634 | spec->num_adc_nids++; | ||
| 10635 | } | ||
| 10636 | spec->adc_nids = spec->private_adc_nids; | ||
| 10637 | spec->capsrc_nids = spec->private_capsrc_nids; | ||
| 10638 | } | ||
| 10639 | |||
| 10640 | set_capture_mixer(codec); | ||
| 10641 | |||
| 10642 | if (has_cdefine_beep(codec)) | ||
| 10643 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
| 10644 | |||
| 10645 | if (board_config == ALC882_AUTO) | ||
| 10646 | alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0); | ||
| 10647 | |||
| 10648 | spec->vmaster_nid = 0x0c; | ||
| 10649 | |||
| 10650 | codec->patch_ops = alc_patch_ops; | ||
| 10651 | if (board_config == ALC882_AUTO) | ||
| 10652 | spec->init_hook = alc882_auto_init; | ||
| 10653 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 10654 | if (!spec->loopback.amplist) | ||
| 10655 | spec->loopback.amplist = alc882_loopbacks; | ||
| 10656 | #endif | ||
| 10657 | |||
| 10658 | return 0; | ||
| 10659 | } | ||
| 10660 | |||
| 10661 | |||
| 10662 | /* | ||
| 10663 | * ALC262 support | ||
| 10664 | */ | ||
| 10665 | |||
| 10666 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | ||
| 10667 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | ||
| 10668 | |||
| 10669 | #define alc262_dac_nids alc260_dac_nids | ||
| 10670 | #define alc262_adc_nids alc882_adc_nids | ||
| 10671 | #define alc262_adc_nids_alt alc882_adc_nids_alt | ||
| 10672 | #define alc262_capsrc_nids alc882_capsrc_nids | ||
| 10673 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | ||
| 10674 | |||
| 10675 | #define alc262_modes alc260_modes | ||
| 10676 | #define alc262_capture_source alc882_capture_source | ||
| 10677 | |||
| 10678 | static hda_nid_t alc262_dmic_adc_nids[1] = { | ||
| 10679 | /* ADC0 */ | ||
| 10680 | 0x09 | ||
| 10681 | }; | ||
| 10682 | |||
| 10683 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | ||
| 10684 | |||
| 10685 | static struct snd_kcontrol_new alc262_base_mixer[] = { | ||
| 10686 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10687 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 10688 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 10689 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 10690 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 10691 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 10692 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10693 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10694 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10695 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10696 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10697 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 10698 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | ||
| 10699 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 10700 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
| 10701 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | ||
| 10702 | { } /* end */ | ||
| 10703 | }; | ||
| 10704 | |||
| 10705 | /* update HP, line and mono-out pins according to the master switch */ | ||
| 10706 | static void alc262_hp_master_update(struct hda_codec *codec) | ||
| 10707 | { | ||
| 10708 | struct alc_spec *spec = codec->spec; | ||
| 10709 | int val = spec->master_sw; | ||
| 10710 | |||
| 10711 | /* HP & line-out */ | ||
| 10712 | snd_hda_codec_write_cache(codec, 0x1b, 0, | ||
| 10713 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 10714 | val ? PIN_HP : 0); | ||
| 10715 | snd_hda_codec_write_cache(codec, 0x15, 0, | ||
| 10716 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 10717 | val ? PIN_HP : 0); | ||
| 10718 | /* mono (speaker) depending on the HP jack sense */ | ||
| 10719 | val = val && !spec->jack_present; | ||
| 10720 | snd_hda_codec_write_cache(codec, 0x16, 0, | ||
| 10721 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 10722 | val ? PIN_OUT : 0); | ||
| 10723 | } | ||
| 10724 | |||
| 10725 | static void alc262_hp_bpc_automute(struct hda_codec *codec) | ||
| 10726 | { | ||
| 10727 | struct alc_spec *spec = codec->spec; | ||
| 10728 | |||
| 10729 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | ||
| 10730 | alc262_hp_master_update(codec); | ||
| 10731 | } | ||
| 10732 | |||
| 10733 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 10734 | { | ||
| 10735 | if ((res >> 26) != ALC880_HP_EVENT) | ||
| 10736 | return; | ||
| 10737 | alc262_hp_bpc_automute(codec); | ||
| 10738 | } | ||
| 10739 | |||
| 10740 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) | ||
| 10741 | { | ||
| 10742 | struct alc_spec *spec = codec->spec; | ||
| 10743 | |||
| 10744 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | ||
| 10745 | alc262_hp_master_update(codec); | ||
| 10746 | } | ||
| 10747 | |||
| 10748 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, | ||
| 10749 | unsigned int res) | ||
| 10750 | { | ||
| 10751 | if ((res >> 26) != ALC880_HP_EVENT) | ||
| 10752 | return; | ||
| 10753 | alc262_hp_wildwest_automute(codec); | ||
| 10754 | } | ||
| 10755 | |||
| 10756 | #define alc262_hp_master_sw_get alc260_hp_master_sw_get | ||
| 10757 | |||
| 10758 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 10759 | struct snd_ctl_elem_value *ucontrol) | ||
| 10760 | { | ||
| 10761 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 10762 | struct alc_spec *spec = codec->spec; | ||
| 10763 | int val = !!*ucontrol->value.integer.value; | ||
| 10764 | |||
| 10765 | if (val == spec->master_sw) | ||
| 10766 | return 0; | ||
| 10767 | spec->master_sw = val; | ||
| 10768 | alc262_hp_master_update(codec); | ||
| 10769 | return 1; | ||
| 10770 | } | ||
| 10771 | |||
| 10772 | #define ALC262_HP_MASTER_SWITCH \ | ||
| 10773 | { \ | ||
| 10774 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 10775 | .name = "Master Playback Switch", \ | ||
| 10776 | .info = snd_ctl_boolean_mono_info, \ | ||
| 10777 | .get = alc262_hp_master_sw_get, \ | ||
| 10778 | .put = alc262_hp_master_sw_put, \ | ||
| 10779 | }, \ | ||
| 10780 | { \ | ||
| 10781 | .iface = NID_MAPPING, \ | ||
| 10782 | .name = "Master Playback Switch", \ | ||
| 10783 | .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \ | ||
| 10784 | } | ||
| 10785 | |||
| 10786 | |||
| 10787 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | ||
| 10788 | ALC262_HP_MASTER_SWITCH, | ||
| 10789 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10790 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 10791 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 10792 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | ||
| 10793 | HDA_OUTPUT), | ||
| 10794 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | ||
| 10795 | HDA_OUTPUT), | ||
| 10796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10799 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10800 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10801 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 10802 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 10803 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 10804 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 10805 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 10806 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
| 10807 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
| 10808 | { } /* end */ | ||
| 10809 | }; | ||
| 10810 | |||
| 10811 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | ||
| 10812 | ALC262_HP_MASTER_SWITCH, | ||
| 10813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10814 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 10815 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 10816 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 10817 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, | ||
| 10818 | HDA_OUTPUT), | ||
| 10819 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, | ||
| 10820 | HDA_OUTPUT), | ||
| 10821 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 10822 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 10823 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), | ||
| 10824 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10825 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10826 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 10827 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 10828 | { } /* end */ | ||
| 10829 | }; | ||
| 10830 | |||
| 10831 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | ||
| 10832 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10833 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10834 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10835 | { } /* end */ | ||
| 10836 | }; | ||
| 10837 | |||
| 10838 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 10839 | static void alc262_hp_t5735_setup(struct hda_codec *codec) | ||
| 10840 | { | ||
| 10841 | struct alc_spec *spec = codec->spec; | ||
| 10842 | |||
| 10843 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 10844 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 10845 | } | ||
| 10846 | |||
| 10847 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { | ||
| 10848 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10849 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 10850 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 10851 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 10852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10854 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10855 | { } /* end */ | ||
| 10856 | }; | ||
| 10857 | |||
| 10858 | static struct hda_verb alc262_hp_t5735_verbs[] = { | ||
| 10859 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 10860 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 10861 | |||
| 10862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 10863 | { } | ||
| 10864 | }; | ||
| 10865 | |||
| 10866 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { | ||
| 10867 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10868 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 10869 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
| 10870 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), | ||
| 10871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10873 | { } /* end */ | ||
| 10874 | }; | ||
| 10875 | |||
| 10876 | static struct hda_verb alc262_hp_rp5700_verbs[] = { | ||
| 10877 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 10878 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 10879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 10880 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 10881 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 10882 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 10883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 10884 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 10885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | ||
| 10886 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, | ||
| 10887 | {} | ||
| 10888 | }; | ||
| 10889 | |||
| 10890 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { | ||
| 10891 | .num_items = 1, | ||
| 10892 | .items = { | ||
| 10893 | { "Line", 0x1 }, | ||
| 10894 | }, | ||
| 10895 | }; | ||
| 10896 | |||
| 10897 | /* bind hp and internal speaker mute (with plug check) as master switch */ | ||
| 10898 | static void alc262_hippo_master_update(struct hda_codec *codec) | ||
| 10899 | { | ||
| 10900 | struct alc_spec *spec = codec->spec; | ||
| 10901 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | ||
| 10902 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | ||
| 10903 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | ||
| 10904 | unsigned int mute; | ||
| 10905 | |||
| 10906 | /* HP */ | ||
| 10907 | mute = spec->master_sw ? 0 : HDA_AMP_MUTE; | ||
| 10908 | snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0, | ||
| 10909 | HDA_AMP_MUTE, mute); | ||
| 10910 | /* mute internal speaker per jack sense */ | ||
| 10911 | if (spec->jack_present) | ||
| 10912 | mute = HDA_AMP_MUTE; | ||
| 10913 | if (line_nid) | ||
| 10914 | snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0, | ||
| 10915 | HDA_AMP_MUTE, mute); | ||
| 10916 | if (speaker_nid && speaker_nid != line_nid) | ||
| 10917 | snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0, | ||
| 10918 | HDA_AMP_MUTE, mute); | ||
| 10919 | } | ||
| 10920 | |||
| 10921 | #define alc262_hippo_master_sw_get alc262_hp_master_sw_get | ||
| 10922 | |||
| 10923 | static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 10924 | struct snd_ctl_elem_value *ucontrol) | ||
| 10925 | { | ||
| 10926 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 10927 | struct alc_spec *spec = codec->spec; | ||
| 10928 | int val = !!*ucontrol->value.integer.value; | ||
| 10929 | |||
| 10930 | if (val == spec->master_sw) | ||
| 10931 | return 0; | ||
| 10932 | spec->master_sw = val; | ||
| 10933 | alc262_hippo_master_update(codec); | ||
| 10934 | return 1; | ||
| 10935 | } | ||
| 10936 | |||
| 10937 | #define ALC262_HIPPO_MASTER_SWITCH \ | ||
| 10938 | { \ | ||
| 10939 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
| 10940 | .name = "Master Playback Switch", \ | ||
| 10941 | .info = snd_ctl_boolean_mono_info, \ | ||
| 10942 | .get = alc262_hippo_master_sw_get, \ | ||
| 10943 | .put = alc262_hippo_master_sw_put, \ | ||
| 10944 | }, \ | ||
| 10945 | { \ | ||
| 10946 | .iface = NID_MAPPING, \ | ||
| 10947 | .name = "Master Playback Switch", \ | ||
| 10948 | .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ | ||
| 10949 | (SUBDEV_SPEAKER(0) << 16), \ | ||
| 10950 | } | ||
| 10951 | |||
| 10952 | static struct snd_kcontrol_new alc262_hippo_mixer[] = { | ||
| 10953 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 10954 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10955 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 10956 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 10957 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 10958 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 10959 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10960 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10962 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10963 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10964 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 10965 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 10966 | { } /* end */ | ||
| 10967 | }; | ||
| 10968 | |||
| 10969 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | ||
| 10970 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 10971 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 10972 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 10973 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 10974 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 10975 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 10976 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 10977 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 10978 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 10979 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 10980 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 10981 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 10982 | { } /* end */ | ||
| 10983 | }; | ||
| 10984 | |||
| 10985 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 10986 | static void alc262_hippo_automute(struct hda_codec *codec) | ||
| 10987 | { | ||
| 10988 | struct alc_spec *spec = codec->spec; | ||
| 10989 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | ||
| 10990 | |||
| 10991 | spec->jack_present = snd_hda_jack_detect(codec, hp_nid); | ||
| 10992 | alc262_hippo_master_update(codec); | ||
| 10993 | } | ||
| 10994 | |||
| 10995 | static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res) | ||
| 10996 | { | ||
| 10997 | if ((res >> 26) != ALC880_HP_EVENT) | ||
| 10998 | return; | ||
| 10999 | alc262_hippo_automute(codec); | ||
| 11000 | } | ||
| 11001 | |||
| 11002 | static void alc262_hippo_setup(struct hda_codec *codec) | ||
| 11003 | { | ||
| 11004 | struct alc_spec *spec = codec->spec; | ||
| 11005 | |||
| 11006 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 11007 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 11008 | } | ||
| 11009 | |||
| 11010 | static void alc262_hippo1_setup(struct hda_codec *codec) | ||
| 11011 | { | ||
| 11012 | struct alc_spec *spec = codec->spec; | ||
| 11013 | |||
| 11014 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 11015 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 11016 | } | ||
| 11017 | |||
| 11018 | |||
| 11019 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | ||
| 11020 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 11021 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 11022 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11023 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11024 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 11025 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 11026 | { } /* end */ | ||
| 11027 | }; | ||
| 11028 | |||
| 11029 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | ||
| 11030 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 11031 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 11032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 11033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11035 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 11036 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 11037 | { } /* end */ | ||
| 11038 | }; | ||
| 11039 | |||
| 11040 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { | ||
| 11041 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 11042 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 11043 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
| 11044 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
| 11045 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 11046 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 11047 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11048 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11049 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 11050 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 11051 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 11052 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 11053 | { } /* end */ | ||
| 11054 | }; | ||
| 11055 | |||
| 11056 | static struct hda_verb alc262_tyan_verbs[] = { | ||
| 11057 | /* Headphone automute */ | ||
| 11058 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11059 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11060 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11061 | |||
| 11062 | /* P11 AUX_IN, white 4-pin connector */ | ||
| 11063 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 11064 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | ||
| 11065 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | ||
| 11066 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | ||
| 11067 | |||
| 11068 | {} | ||
| 11069 | }; | ||
| 11070 | |||
| 11071 | /* unsolicited event for HP jack sensing */ | ||
| 11072 | static void alc262_tyan_setup(struct hda_codec *codec) | ||
| 11073 | { | ||
| 11074 | struct alc_spec *spec = codec->spec; | ||
| 11075 | |||
| 11076 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 11077 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 11078 | } | ||
| 11079 | |||
| 11080 | |||
| 11081 | #define alc262_capture_mixer alc882_capture_mixer | ||
| 11082 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | ||
| 11083 | |||
| 11084 | /* | ||
| 11085 | * generic initialization of ADC, input mixers and output mixers | ||
| 11086 | */ | ||
| 11087 | static struct hda_verb alc262_init_verbs[] = { | ||
| 11088 | /* | ||
| 11089 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 11090 | */ | ||
| 11091 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11092 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11093 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11094 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11095 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11096 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11097 | |||
| 11098 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 11099 | * mixer widget | ||
| 11100 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
| 11101 | * front panel mic (mic 2) | ||
| 11102 | */ | ||
| 11103 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 11104 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11105 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11106 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 11107 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 11108 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 11109 | |||
| 11110 | /* | ||
| 11111 | * Set up output mixers (0x0c - 0x0e) | ||
| 11112 | */ | ||
| 11113 | /* set vol=0 to output mixers */ | ||
| 11114 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11115 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11116 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11117 | /* set up input amps for analog loopback */ | ||
| 11118 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 11119 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11120 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11121 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11122 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11123 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11124 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11125 | |||
| 11126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 11127 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 11128 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 11129 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 11130 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 11131 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 11132 | |||
| 11133 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11135 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11136 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11137 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11138 | |||
| 11139 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11140 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 11141 | |||
| 11142 | /* FIXME: use matrix-type input source selection */ | ||
| 11143 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 11144 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 11145 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11146 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11147 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11148 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11149 | /* Input mixer2 */ | ||
| 11150 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11151 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11152 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11153 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11154 | /* Input mixer3 */ | ||
| 11155 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11156 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11157 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11158 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11159 | |||
| 11160 | { } | ||
| 11161 | }; | ||
| 11162 | |||
| 11163 | static struct hda_verb alc262_eapd_verbs[] = { | ||
| 11164 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 11165 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 11166 | { } | ||
| 11167 | }; | ||
| 11168 | |||
| 11169 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { | ||
| 11170 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 11171 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11172 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | ||
| 11173 | |||
| 11174 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11175 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11176 | {} | ||
| 11177 | }; | ||
| 11178 | |||
| 11179 | static struct hda_verb alc262_sony_unsol_verbs[] = { | ||
| 11180 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 11181 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11182 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic | ||
| 11183 | |||
| 11184 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11186 | {} | ||
| 11187 | }; | ||
| 11188 | |||
| 11189 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | ||
| 11190 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 11191 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 11192 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 11193 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11194 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11195 | { } /* end */ | ||
| 11196 | }; | ||
| 11197 | |||
| 11198 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | ||
| 11199 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 11200 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 11201 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11202 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11203 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | ||
| 11204 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 11205 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 11206 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11207 | {} | ||
| 11208 | }; | ||
| 11209 | |||
| 11210 | static void alc262_toshiba_s06_setup(struct hda_codec *codec) | ||
| 11211 | { | ||
| 11212 | struct alc_spec *spec = codec->spec; | ||
| 11213 | |||
| 11214 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 11215 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 11216 | spec->ext_mic.pin = 0x18; | ||
| 11217 | spec->ext_mic.mux_idx = 0; | ||
| 11218 | spec->int_mic.pin = 0x12; | ||
| 11219 | spec->int_mic.mux_idx = 9; | ||
| 11220 | spec->auto_mic = 1; | ||
| 11221 | } | ||
| 11222 | |||
| 11223 | /* | ||
| 11224 | * nec model | ||
| 11225 | * 0x15 = headphone | ||
| 11226 | * 0x16 = internal speaker | ||
| 11227 | * 0x18 = external mic | ||
| 11228 | */ | ||
| 11229 | |||
| 11230 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | ||
| 11231 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
| 11232 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | ||
| 11233 | |||
| 11234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11236 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 11237 | |||
| 11238 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
| 11239 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 11240 | { } /* end */ | ||
| 11241 | }; | ||
| 11242 | |||
| 11243 | static struct hda_verb alc262_nec_verbs[] = { | ||
| 11244 | /* Unmute Speaker */ | ||
| 11245 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 11246 | |||
| 11247 | /* Headphone */ | ||
| 11248 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11249 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 11250 | |||
| 11251 | /* External mic to headphone */ | ||
| 11252 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11253 | /* External mic to speaker */ | ||
| 11254 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11255 | {} | ||
| 11256 | }; | ||
| 11257 | |||
| 11258 | /* | ||
| 11259 | * fujitsu model | ||
| 11260 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | ||
| 11261 | * 0x1b = port replicator headphone out | ||
| 11262 | */ | ||
| 11263 | |||
| 11264 | #define ALC_HP_EVENT 0x37 | ||
| 11265 | |||
| 11266 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { | ||
| 11267 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
| 11268 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11269 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
| 11270 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11271 | {} | ||
| 11272 | }; | ||
| 11273 | |||
| 11274 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | ||
| 11275 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
| 11276 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11277 | {} | ||
| 11278 | }; | ||
| 11279 | |||
| 11280 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
| 11281 | /* Front Mic pin: input vref at 50% */ | ||
| 11282 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 11283 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 11284 | {} | ||
| 11285 | }; | ||
| 11286 | |||
| 11287 | static struct hda_input_mux alc262_fujitsu_capture_source = { | ||
| 11288 | .num_items = 3, | ||
| 11289 | .items = { | ||
| 11290 | { "Mic", 0x0 }, | ||
| 11291 | { "Int Mic", 0x1 }, | ||
| 11292 | { "CD", 0x4 }, | ||
| 11293 | }, | ||
| 11294 | }; | ||
| 11295 | |||
| 11296 | static struct hda_input_mux alc262_HP_capture_source = { | ||
| 11297 | .num_items = 5, | ||
| 11298 | .items = { | ||
| 11299 | { "Mic", 0x0 }, | ||
| 11300 | { "Front Mic", 0x1 }, | ||
| 11301 | { "Line", 0x2 }, | ||
| 11302 | { "CD", 0x4 }, | ||
| 11303 | { "AUX IN", 0x6 }, | ||
| 11304 | }, | ||
| 11305 | }; | ||
| 11306 | |||
| 11307 | static struct hda_input_mux alc262_HP_D7000_capture_source = { | ||
| 11308 | .num_items = 4, | ||
| 11309 | .items = { | ||
| 11310 | { "Mic", 0x0 }, | ||
| 11311 | { "Front Mic", 0x2 }, | ||
| 11312 | { "Line", 0x1 }, | ||
| 11313 | { "CD", 0x4 }, | ||
| 11314 | }, | ||
| 11315 | }; | ||
| 11316 | |||
| 11317 | /* mute/unmute internal speaker according to the hp jacks and mute state */ | ||
| 11318 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) | ||
| 11319 | { | ||
| 11320 | struct alc_spec *spec = codec->spec; | ||
| 11321 | unsigned int mute; | ||
| 11322 | |||
| 11323 | if (force || !spec->sense_updated) { | ||
| 11324 | spec->jack_present = snd_hda_jack_detect(codec, 0x14) || | ||
| 11325 | snd_hda_jack_detect(codec, 0x1b); | ||
| 11326 | spec->sense_updated = 1; | ||
| 11327 | } | ||
| 11328 | /* unmute internal speaker only if both HPs are unplugged and | ||
| 11329 | * master switch is on | ||
| 11330 | */ | ||
| 11331 | if (spec->jack_present) | ||
| 11332 | mute = HDA_AMP_MUTE; | ||
| 11333 | else | ||
| 11334 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | ||
| 11335 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 11336 | HDA_AMP_MUTE, mute); | ||
| 11337 | } | ||
| 11338 | |||
| 11339 | /* unsolicited event for HP jack sensing */ | ||
| 11340 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, | ||
| 11341 | unsigned int res) | ||
| 11342 | { | ||
| 11343 | if ((res >> 26) != ALC_HP_EVENT) | ||
| 11344 | return; | ||
| 11345 | alc262_fujitsu_automute(codec, 1); | ||
| 11346 | } | ||
| 11347 | |||
| 11348 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) | ||
| 11349 | { | ||
| 11350 | alc262_fujitsu_automute(codec, 1); | ||
| 11351 | } | ||
| 11352 | |||
| 11353 | /* bind volumes of both NID 0x0c and 0x0d */ | ||
| 11354 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { | ||
| 11355 | .ops = &snd_hda_bind_vol, | ||
| 11356 | .values = { | ||
| 11357 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), | ||
| 11358 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), | ||
| 11359 | 0 | ||
| 11360 | }, | ||
| 11361 | }; | ||
| 11362 | |||
| 11363 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 11364 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) | ||
| 11365 | { | ||
| 11366 | struct alc_spec *spec = codec->spec; | ||
| 11367 | unsigned int mute; | ||
| 11368 | |||
| 11369 | if (force || !spec->sense_updated) { | ||
| 11370 | spec->jack_present = snd_hda_jack_detect(codec, 0x1b); | ||
| 11371 | spec->sense_updated = 1; | ||
| 11372 | } | ||
| 11373 | if (spec->jack_present) { | ||
| 11374 | /* mute internal speaker */ | ||
| 11375 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 11376 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 11377 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
| 11378 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 11379 | } else { | ||
| 11380 | /* unmute internal speaker if necessary */ | ||
| 11381 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | ||
| 11382 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 11383 | HDA_AMP_MUTE, mute); | ||
| 11384 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
| 11385 | HDA_AMP_MUTE, mute); | ||
| 11386 | } | ||
| 11387 | } | ||
| 11388 | |||
| 11389 | /* unsolicited event for HP jack sensing */ | ||
| 11390 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, | ||
| 11391 | unsigned int res) | ||
| 11392 | { | ||
| 11393 | if ((res >> 26) != ALC_HP_EVENT) | ||
| 11394 | return; | ||
| 11395 | alc262_lenovo_3000_automute(codec, 1); | ||
| 11396 | } | ||
| 11397 | |||
| 11398 | static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, | ||
| 11399 | int dir, int idx, long *valp) | ||
| 11400 | { | ||
| 11401 | int i, change = 0; | ||
| 11402 | |||
| 11403 | for (i = 0; i < 2; i++, valp++) | ||
| 11404 | change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, | ||
| 11405 | HDA_AMP_MUTE, | ||
| 11406 | *valp ? 0 : HDA_AMP_MUTE); | ||
| 11407 | return change; | ||
| 11408 | } | ||
| 11409 | |||
| 11410 | /* bind hp and internal speaker mute (with plug check) */ | ||
| 11411 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 11412 | struct snd_ctl_elem_value *ucontrol) | ||
| 11413 | { | ||
| 11414 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 11415 | long *valp = ucontrol->value.integer.value; | ||
| 11416 | int change; | ||
| 11417 | |||
| 11418 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | ||
| 11419 | change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | ||
| 11420 | if (change) | ||
| 11421 | alc262_fujitsu_automute(codec, 0); | ||
| 11422 | return change; | ||
| 11423 | } | ||
| 11424 | |||
| 11425 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | ||
| 11426 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
| 11427 | { | ||
| 11428 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 11429 | .name = "Master Playback Switch", | ||
| 11430 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 11431 | .info = snd_hda_mixer_amp_switch_info, | ||
| 11432 | .get = snd_hda_mixer_amp_switch_get, | ||
| 11433 | .put = alc262_fujitsu_master_sw_put, | ||
| 11434 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 11435 | }, | ||
| 11436 | { | ||
| 11437 | .iface = NID_MAPPING, | ||
| 11438 | .name = "Master Playback Switch", | ||
| 11439 | .private_value = 0x1b, | ||
| 11440 | }, | ||
| 11441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 11442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 11443 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 11444 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11445 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11446 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 11447 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 11448 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 11449 | { } /* end */ | ||
| 11450 | }; | ||
| 11451 | |||
| 11452 | /* bind hp and internal speaker mute (with plug check) */ | ||
| 11453 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 11454 | struct snd_ctl_elem_value *ucontrol) | ||
| 11455 | { | ||
| 11456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 11457 | long *valp = ucontrol->value.integer.value; | ||
| 11458 | int change; | ||
| 11459 | |||
| 11460 | change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); | ||
| 11461 | if (change) | ||
| 11462 | alc262_lenovo_3000_automute(codec, 0); | ||
| 11463 | return change; | ||
| 11464 | } | ||
| 11465 | |||
| 11466 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | ||
| 11467 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
| 11468 | { | ||
| 11469 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 11470 | .name = "Master Playback Switch", | ||
| 11471 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 11472 | .info = snd_hda_mixer_amp_switch_info, | ||
| 11473 | .get = snd_hda_mixer_amp_switch_get, | ||
| 11474 | .put = alc262_lenovo_3000_master_sw_put, | ||
| 11475 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
| 11476 | }, | ||
| 11477 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 11478 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 11479 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 11480 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11481 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11482 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 11483 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 11484 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 11485 | { } /* end */ | ||
| 11486 | }; | ||
| 11487 | |||
| 11488 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | ||
| 11489 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
| 11490 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 11491 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 11492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 11493 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 11494 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 11495 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 11496 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 11497 | { } /* end */ | ||
| 11498 | }; | ||
| 11499 | |||
| 11500 | /* additional init verbs for Benq laptops */ | ||
| 11501 | static struct hda_verb alc262_EAPD_verbs[] = { | ||
| 11502 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 11503 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, | ||
| 11504 | {} | ||
| 11505 | }; | ||
| 11506 | |||
| 11507 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { | ||
| 11508 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11509 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 11510 | |||
| 11511 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | ||
| 11512 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, | ||
| 11513 | {} | ||
| 11514 | }; | ||
| 11515 | |||
| 11516 | /* Samsung Q1 Ultra Vista model setup */ | ||
| 11517 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { | ||
| 11518 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 11519 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 11520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 11521 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 11522 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 11523 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), | ||
| 11524 | { } /* end */ | ||
| 11525 | }; | ||
| 11526 | |||
| 11527 | static struct hda_verb alc262_ultra_verbs[] = { | ||
| 11528 | /* output mixer */ | ||
| 11529 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11530 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11531 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11532 | /* speaker */ | ||
| 11533 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 11534 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 11535 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11536 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11537 | /* HP */ | ||
| 11538 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11539 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 11540 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11541 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11542 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 11543 | /* internal mic */ | ||
| 11544 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 11545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11546 | /* ADC, choose mic */ | ||
| 11547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11548 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11549 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11550 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 11551 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 11552 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 11553 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
| 11554 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
| 11555 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
| 11556 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | ||
| 11557 | {} | ||
| 11558 | }; | ||
| 11559 | |||
| 11560 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 11561 | static void alc262_ultra_automute(struct hda_codec *codec) | ||
| 11562 | { | ||
| 11563 | struct alc_spec *spec = codec->spec; | ||
| 11564 | unsigned int mute; | ||
| 11565 | |||
| 11566 | mute = 0; | ||
| 11567 | /* auto-mute only when HP is used as HP */ | ||
| 11568 | if (!spec->cur_mux[0]) { | ||
| 11569 | spec->jack_present = snd_hda_jack_detect(codec, 0x15); | ||
| 11570 | if (spec->jack_present) | ||
| 11571 | mute = HDA_AMP_MUTE; | ||
| 11572 | } | ||
| 11573 | /* mute/unmute internal speaker */ | ||
| 11574 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 11575 | HDA_AMP_MUTE, mute); | ||
| 11576 | /* mute/unmute HP */ | ||
| 11577 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 11578 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | ||
| 11579 | } | ||
| 11580 | |||
| 11581 | /* unsolicited event for HP jack sensing */ | ||
| 11582 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | ||
| 11583 | unsigned int res) | ||
| 11584 | { | ||
| 11585 | if ((res >> 26) != ALC880_HP_EVENT) | ||
| 11586 | return; | ||
| 11587 | alc262_ultra_automute(codec); | ||
| 11588 | } | ||
| 11589 | |||
| 11590 | static struct hda_input_mux alc262_ultra_capture_source = { | ||
| 11591 | .num_items = 2, | ||
| 11592 | .items = { | ||
| 11593 | { "Mic", 0x1 }, | ||
| 11594 | { "Headphone", 0x7 }, | ||
| 11595 | }, | ||
| 11596 | }; | ||
| 11597 | |||
| 11598 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
| 11599 | struct snd_ctl_elem_value *ucontrol) | ||
| 11600 | { | ||
| 11601 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 11602 | struct alc_spec *spec = codec->spec; | ||
| 11603 | int ret; | ||
| 11604 | |||
| 11605 | ret = alc_mux_enum_put(kcontrol, ucontrol); | ||
| 11606 | if (!ret) | ||
| 11607 | return 0; | ||
| 11608 | /* reprogram the HP pin as mic or HP according to the input source */ | ||
| 11609 | snd_hda_codec_write_cache(codec, 0x15, 0, | ||
| 11610 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 11611 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | ||
| 11612 | alc262_ultra_automute(codec); /* mute/unmute HP */ | ||
| 11613 | return ret; | ||
| 11614 | } | ||
| 11615 | |||
| 11616 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | ||
| 11617 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | ||
| 11618 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | ||
| 11619 | { | ||
| 11620 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 11621 | .name = "Capture Source", | ||
| 11622 | .info = alc_mux_enum_info, | ||
| 11623 | .get = alc_mux_enum_get, | ||
| 11624 | .put = alc262_ultra_mux_enum_put, | ||
| 11625 | }, | ||
| 11626 | { | ||
| 11627 | .iface = NID_MAPPING, | ||
| 11628 | .name = "Capture Source", | ||
| 11629 | .private_value = 0x15, | ||
| 11630 | }, | ||
| 11631 | { } /* end */ | ||
| 11632 | }; | ||
| 11633 | |||
| 11634 | /* We use two mixers depending on the output pin; 0x16 is a mono output | ||
| 11635 | * and thus it's bound with a different mixer. | ||
| 11636 | * This function returns which mixer amp should be used. | ||
| 11637 | */ | ||
| 11638 | static int alc262_check_volbit(hda_nid_t nid) | ||
| 11639 | { | ||
| 11640 | if (!nid) | ||
| 11641 | return 0; | ||
| 11642 | else if (nid == 0x16) | ||
| 11643 | return 2; | ||
| 11644 | else | ||
| 11645 | return 1; | ||
| 11646 | } | ||
| 11647 | |||
| 11648 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
| 11649 | const char *pfx, int *vbits) | ||
| 11650 | { | ||
| 11651 | unsigned long val; | ||
| 11652 | int vbit; | ||
| 11653 | |||
| 11654 | vbit = alc262_check_volbit(nid); | ||
| 11655 | if (!vbit) | ||
| 11656 | return 0; | ||
| 11657 | if (*vbits & vbit) /* a volume control for this mixer already there */ | ||
| 11658 | return 0; | ||
| 11659 | *vbits |= vbit; | ||
| 11660 | if (vbit == 2) | ||
| 11661 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | ||
| 11662 | else | ||
| 11663 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | ||
| 11664 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); | ||
| 11665 | } | ||
| 11666 | |||
| 11667 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | ||
| 11668 | const char *pfx) | ||
| 11669 | { | ||
| 11670 | unsigned long val; | ||
| 11671 | |||
| 11672 | if (!nid) | ||
| 11673 | return 0; | ||
| 11674 | if (nid == 0x16) | ||
| 11675 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | ||
| 11676 | else | ||
| 11677 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
| 11678 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | ||
| 11679 | } | ||
| 11680 | |||
| 11681 | /* add playback controls from the parsed DAC table */ | ||
| 11682 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | ||
| 11683 | const struct auto_pin_cfg *cfg) | ||
| 11684 | { | ||
| 11685 | const char *pfx; | ||
| 11686 | int vbits; | ||
| 11687 | int err; | ||
| 11688 | |||
| 11689 | spec->multiout.num_dacs = 1; /* only use one dac */ | ||
| 11690 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 11691 | spec->multiout.dac_nids[0] = 2; | ||
| 11692 | |||
| 11693 | if (!cfg->speaker_pins[0] && !cfg->hp_pins[0]) | ||
| 11694 | pfx = "Master"; | ||
| 11695 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 11696 | pfx = "Speaker"; | ||
| 11697 | else | ||
| 11698 | pfx = "Front"; | ||
| 11699 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); | ||
| 11700 | if (err < 0) | ||
| 11701 | return err; | ||
| 11702 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); | ||
| 11703 | if (err < 0) | ||
| 11704 | return err; | ||
| 11705 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); | ||
| 11706 | if (err < 0) | ||
| 11707 | return err; | ||
| 11708 | |||
| 11709 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | | ||
| 11710 | alc262_check_volbit(cfg->speaker_pins[0]) | | ||
| 11711 | alc262_check_volbit(cfg->hp_pins[0]); | ||
| 11712 | if (vbits == 1 || vbits == 2) | ||
| 11713 | pfx = "Master"; /* only one mixer is used */ | ||
| 11714 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 11715 | pfx = "Speaker"; | ||
| 11716 | else | ||
| 11717 | pfx = "Front"; | ||
| 11718 | vbits = 0; | ||
| 11719 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | ||
| 11720 | if (err < 0) | ||
| 11721 | return err; | ||
| 11722 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | ||
| 11723 | &vbits); | ||
| 11724 | if (err < 0) | ||
| 11725 | return err; | ||
| 11726 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | ||
| 11727 | &vbits); | ||
| 11728 | if (err < 0) | ||
| 11729 | return err; | ||
| 11730 | return 0; | ||
| 11731 | } | ||
| 11732 | |||
| 11733 | #define alc262_auto_create_input_ctls \ | ||
| 11734 | alc882_auto_create_input_ctls | ||
| 11735 | |||
| 11736 | /* | ||
| 11737 | * generic initialization of ADC, input mixers and output mixers | ||
| 11738 | */ | ||
| 11739 | static struct hda_verb alc262_volume_init_verbs[] = { | ||
| 11740 | /* | ||
| 11741 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 11742 | */ | ||
| 11743 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11744 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11745 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11746 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11747 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11748 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11749 | |||
| 11750 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 11751 | * mixer widget | ||
| 11752 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
| 11753 | * front panel mic (mic 2) | ||
| 11754 | */ | ||
| 11755 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 11756 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11757 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 11759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 11760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 11761 | |||
| 11762 | /* | ||
| 11763 | * Set up output mixers (0x0c - 0x0f) | ||
| 11764 | */ | ||
| 11765 | /* set vol=0 to output mixers */ | ||
| 11766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11767 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11768 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11769 | |||
| 11770 | /* set up input amps for analog loopback */ | ||
| 11771 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 11772 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11774 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11775 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11776 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11777 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11778 | |||
| 11779 | /* FIXME: use matrix-type input source selection */ | ||
| 11780 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 11781 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 11782 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11783 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11784 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11785 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11786 | /* Input mixer2 */ | ||
| 11787 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11788 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11789 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11790 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11791 | /* Input mixer3 */ | ||
| 11792 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11793 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11794 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11795 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11796 | |||
| 11797 | { } | ||
| 11798 | }; | ||
| 11799 | |||
| 11800 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { | ||
| 11801 | /* | ||
| 11802 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 11803 | */ | ||
| 11804 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11805 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11806 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11807 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11808 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11809 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11810 | |||
| 11811 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 11812 | * mixer widget | ||
| 11813 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
| 11814 | * front panel mic (mic 2) | ||
| 11815 | */ | ||
| 11816 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 11817 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11818 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11819 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 11820 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 11821 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 11822 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
| 11823 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
| 11824 | |||
| 11825 | /* | ||
| 11826 | * Set up output mixers (0x0c - 0x0e) | ||
| 11827 | */ | ||
| 11828 | /* set vol=0 to output mixers */ | ||
| 11829 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11830 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11831 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11832 | |||
| 11833 | /* set up input amps for analog loopback */ | ||
| 11834 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 11835 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11836 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11837 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11838 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11839 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11840 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11841 | |||
| 11842 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 11843 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 11844 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 11845 | |||
| 11846 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 11847 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 11848 | |||
| 11849 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11850 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11851 | |||
| 11852 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 11853 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 11854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 11855 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 11856 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 11857 | |||
| 11858 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11859 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11860 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11861 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11862 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11863 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11864 | |||
| 11865 | |||
| 11866 | /* FIXME: use matrix-type input source selection */ | ||
| 11867 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */ | ||
| 11868 | /* Input mixer1: only unmute Mic */ | ||
| 11869 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11870 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
| 11871 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11872 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11873 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11874 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
| 11875 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
| 11876 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
| 11877 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
| 11878 | /* Input mixer2 */ | ||
| 11879 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11880 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
| 11881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11882 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11884 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
| 11885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
| 11886 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
| 11887 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
| 11888 | /* Input mixer3 */ | ||
| 11889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))}, | ||
| 11891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, | ||
| 11892 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, | ||
| 11893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, | ||
| 11894 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))}, | ||
| 11895 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))}, | ||
| 11896 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))}, | ||
| 11897 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))}, | ||
| 11898 | |||
| 11899 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 11900 | |||
| 11901 | { } | ||
| 11902 | }; | ||
| 11903 | |||
| 11904 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | ||
| 11905 | /* | ||
| 11906 | * Unmute ADC0-2 and set the default input to mic-in | ||
| 11907 | */ | ||
| 11908 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11909 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11910 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11911 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11912 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11914 | |||
| 11915 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | ||
| 11916 | * mixer widget | ||
| 11917 | * Note: PASD motherboards uses the Line In 2 as the input for front | ||
| 11918 | * panel mic (mic 2) | ||
| 11919 | */ | ||
| 11920 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 11921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 11922 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 11923 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 11924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 11925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 11926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
| 11927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
| 11928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
| 11929 | /* | ||
| 11930 | * Set up output mixers (0x0c - 0x0e) | ||
| 11931 | */ | ||
| 11932 | /* set vol=0 to output mixers */ | ||
| 11933 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11934 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11935 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 11936 | |||
| 11937 | /* set up input amps for analog loopback */ | ||
| 11938 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 11939 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11940 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11941 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11942 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11943 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 11944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 11945 | |||
| 11946 | |||
| 11947 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ | ||
| 11948 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ | ||
| 11949 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ | ||
| 11950 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ | ||
| 11951 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
| 11952 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ | ||
| 11953 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ | ||
| 11954 | |||
| 11955 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 11956 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 11957 | |||
| 11958 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 11959 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 11960 | |||
| 11961 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ | ||
| 11962 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11963 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11964 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, | ||
| 11965 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11966 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, | ||
| 11967 | |||
| 11968 | /* FIXME: use matrix-type input source selection */ | ||
| 11969 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 11970 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 11971 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ | ||
| 11972 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ | ||
| 11973 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ | ||
| 11974 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ | ||
| 11975 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ | ||
| 11976 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
| 11977 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ | ||
| 11978 | /* Input mixer2 */ | ||
| 11979 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11980 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 11981 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | ||
| 11982 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | ||
| 11983 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | ||
| 11984 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
| 11985 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | ||
| 11986 | /* Input mixer3 */ | ||
| 11987 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, | ||
| 11988 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, | ||
| 11989 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, | ||
| 11990 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, | ||
| 11991 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, | ||
| 11992 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ | ||
| 11993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, | ||
| 11994 | |||
| 11995 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 11996 | |||
| 11997 | { } | ||
| 11998 | }; | ||
| 11999 | |||
| 12000 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | ||
| 12001 | |||
| 12002 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | ||
| 12003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 12004 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 12005 | |||
| 12006 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | ||
| 12007 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
| 12008 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
| 12009 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
| 12010 | |||
| 12011 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | ||
| 12012 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 12013 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 12014 | {} | ||
| 12015 | }; | ||
| 12016 | |||
| 12017 | |||
| 12018 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 12019 | #define alc262_loopbacks alc880_loopbacks | ||
| 12020 | #endif | ||
| 12021 | |||
| 12022 | /* pcm configuration: identical with ALC880 */ | ||
| 12023 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback | ||
| 12024 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture | ||
| 12025 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback | ||
| 12026 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture | ||
| 12027 | |||
| 12028 | /* | ||
| 12029 | * BIOS auto configuration | ||
| 12030 | */ | ||
| 12031 | static int alc262_parse_auto_config(struct hda_codec *codec) | ||
| 12032 | { | ||
| 12033 | struct alc_spec *spec = codec->spec; | ||
| 12034 | int err; | ||
| 12035 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; | ||
| 12036 | |||
| 12037 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 12038 | alc262_ignore); | ||
| 12039 | if (err < 0) | ||
| 12040 | return err; | ||
| 12041 | if (!spec->autocfg.line_outs) { | ||
| 12042 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | ||
| 12043 | spec->multiout.max_channels = 2; | ||
| 12044 | spec->no_analog = 1; | ||
| 12045 | goto dig_only; | ||
| 12046 | } | ||
| 12047 | return 0; /* can't find valid BIOS pin config */ | ||
| 12048 | } | ||
| 12049 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 12050 | if (err < 0) | ||
| 12051 | return err; | ||
| 12052 | err = alc262_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 12053 | if (err < 0) | ||
| 12054 | return err; | ||
| 12055 | |||
| 12056 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 12057 | |||
| 12058 | dig_only: | ||
| 12059 | if (spec->autocfg.dig_outs) { | ||
| 12060 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | ||
| 12061 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | ||
| 12062 | } | ||
| 12063 | if (spec->autocfg.dig_in_pin) | ||
| 12064 | spec->dig_in_nid = ALC262_DIGIN_NID; | ||
| 12065 | |||
| 12066 | if (spec->kctls.list) | ||
| 12067 | add_mixer(spec, spec->kctls.list); | ||
| 12068 | |||
| 12069 | add_verb(spec, alc262_volume_init_verbs); | ||
| 12070 | spec->num_mux_defs = 1; | ||
| 12071 | spec->input_mux = &spec->private_imux[0]; | ||
| 12072 | |||
| 12073 | err = alc_auto_add_mic_boost(codec); | ||
| 12074 | if (err < 0) | ||
| 12075 | return err; | ||
| 12076 | |||
| 12077 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 12078 | |||
| 12079 | return 1; | ||
| 12080 | } | ||
| 12081 | |||
| 12082 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out | ||
| 12083 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out | ||
| 12084 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input | ||
| 12085 | #define alc262_auto_init_input_src alc882_auto_init_input_src | ||
| 12086 | |||
| 12087 | |||
| 12088 | /* init callback for auto-configuration model -- overriding the default init */ | ||
| 12089 | static void alc262_auto_init(struct hda_codec *codec) | ||
| 12090 | { | ||
| 12091 | struct alc_spec *spec = codec->spec; | ||
| 12092 | alc262_auto_init_multi_out(codec); | ||
| 12093 | alc262_auto_init_hp_out(codec); | ||
| 12094 | alc262_auto_init_analog_input(codec); | ||
| 12095 | alc262_auto_init_input_src(codec); | ||
| 12096 | if (spec->unsol_event) | ||
| 12097 | alc_inithook(codec); | ||
| 12098 | } | ||
| 12099 | |||
| 12100 | /* | ||
| 12101 | * configuration and preset | ||
| 12102 | */ | ||
| 12103 | static const char *alc262_models[ALC262_MODEL_LAST] = { | ||
| 12104 | [ALC262_BASIC] = "basic", | ||
| 12105 | [ALC262_HIPPO] = "hippo", | ||
| 12106 | [ALC262_HIPPO_1] = "hippo_1", | ||
| 12107 | [ALC262_FUJITSU] = "fujitsu", | ||
| 12108 | [ALC262_HP_BPC] = "hp-bpc", | ||
| 12109 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", | ||
| 12110 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", | ||
| 12111 | [ALC262_HP_RP5700] = "hp-rp5700", | ||
| 12112 | [ALC262_BENQ_ED8] = "benq", | ||
| 12113 | [ALC262_BENQ_T31] = "benq-t31", | ||
| 12114 | [ALC262_SONY_ASSAMD] = "sony-assamd", | ||
| 12115 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | ||
| 12116 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | ||
| 12117 | [ALC262_ULTRA] = "ultra", | ||
| 12118 | [ALC262_LENOVO_3000] = "lenovo-3000", | ||
| 12119 | [ALC262_NEC] = "nec", | ||
| 12120 | [ALC262_TYAN] = "tyan", | ||
| 12121 | [ALC262_AUTO] = "auto", | ||
| 12122 | }; | ||
| 12123 | |||
| 12124 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | ||
| 12125 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | ||
| 12126 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | ||
| 12127 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", | ||
| 12128 | ALC262_HP_BPC), | ||
| 12129 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", | ||
| 12130 | ALC262_HP_BPC), | ||
| 12131 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", | ||
| 12132 | ALC262_HP_BPC), | ||
| 12133 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
| 12134 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
| 12135 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
| 12136 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
| 12137 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
| 12138 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
| 12139 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), | ||
| 12140 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), | ||
| 12141 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), | ||
| 12142 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), | ||
| 12143 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), | ||
| 12144 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", | ||
| 12145 | ALC262_HP_TC_T5735), | ||
| 12146 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), | ||
| 12147 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | ||
| 12148 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | ||
| 12149 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | ||
| 12150 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ | ||
| 12151 | SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06), | ||
| 12152 | SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO), | ||
| 12153 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO), | ||
| 12154 | #if 0 /* disable the quirk since model=auto works better in recent versions */ | ||
| 12155 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", | ||
| 12156 | ALC262_SONY_ASSAMD), | ||
| 12157 | #endif | ||
| 12158 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | ||
| 12159 | ALC262_TOSHIBA_RX1), | ||
| 12160 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | ||
| 12161 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | ||
| 12162 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | ||
| 12163 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), | ||
| 12164 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | ||
| 12165 | ALC262_ULTRA), | ||
| 12166 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | ||
| 12167 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | ||
| 12168 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | ||
| 12169 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), | ||
| 12170 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), | ||
| 12171 | {} | ||
| 12172 | }; | ||
| 12173 | |||
| 12174 | static struct alc_config_preset alc262_presets[] = { | ||
| 12175 | [ALC262_BASIC] = { | ||
| 12176 | .mixers = { alc262_base_mixer }, | ||
| 12177 | .init_verbs = { alc262_init_verbs }, | ||
| 12178 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12179 | .dac_nids = alc262_dac_nids, | ||
| 12180 | .hp_nid = 0x03, | ||
| 12181 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12182 | .channel_mode = alc262_modes, | ||
| 12183 | .input_mux = &alc262_capture_source, | ||
| 12184 | }, | ||
| 12185 | [ALC262_HIPPO] = { | ||
| 12186 | .mixers = { alc262_hippo_mixer }, | ||
| 12187 | .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs}, | ||
| 12188 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12189 | .dac_nids = alc262_dac_nids, | ||
| 12190 | .hp_nid = 0x03, | ||
| 12191 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12192 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12193 | .channel_mode = alc262_modes, | ||
| 12194 | .input_mux = &alc262_capture_source, | ||
| 12195 | .unsol_event = alc262_hippo_unsol_event, | ||
| 12196 | .setup = alc262_hippo_setup, | ||
| 12197 | .init_hook = alc262_hippo_automute, | ||
| 12198 | }, | ||
| 12199 | [ALC262_HIPPO_1] = { | ||
| 12200 | .mixers = { alc262_hippo1_mixer }, | ||
| 12201 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, | ||
| 12202 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12203 | .dac_nids = alc262_dac_nids, | ||
| 12204 | .hp_nid = 0x02, | ||
| 12205 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12206 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12207 | .channel_mode = alc262_modes, | ||
| 12208 | .input_mux = &alc262_capture_source, | ||
| 12209 | .unsol_event = alc262_hippo_unsol_event, | ||
| 12210 | .setup = alc262_hippo1_setup, | ||
| 12211 | .init_hook = alc262_hippo_automute, | ||
| 12212 | }, | ||
| 12213 | [ALC262_FUJITSU] = { | ||
| 12214 | .mixers = { alc262_fujitsu_mixer }, | ||
| 12215 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | ||
| 12216 | alc262_fujitsu_unsol_verbs }, | ||
| 12217 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12218 | .dac_nids = alc262_dac_nids, | ||
| 12219 | .hp_nid = 0x03, | ||
| 12220 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12221 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12222 | .channel_mode = alc262_modes, | ||
| 12223 | .input_mux = &alc262_fujitsu_capture_source, | ||
| 12224 | .unsol_event = alc262_fujitsu_unsol_event, | ||
| 12225 | .init_hook = alc262_fujitsu_init_hook, | ||
| 12226 | }, | ||
| 12227 | [ALC262_HP_BPC] = { | ||
| 12228 | .mixers = { alc262_HP_BPC_mixer }, | ||
| 12229 | .init_verbs = { alc262_HP_BPC_init_verbs }, | ||
| 12230 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12231 | .dac_nids = alc262_dac_nids, | ||
| 12232 | .hp_nid = 0x03, | ||
| 12233 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12234 | .channel_mode = alc262_modes, | ||
| 12235 | .input_mux = &alc262_HP_capture_source, | ||
| 12236 | .unsol_event = alc262_hp_bpc_unsol_event, | ||
| 12237 | .init_hook = alc262_hp_bpc_automute, | ||
| 12238 | }, | ||
| 12239 | [ALC262_HP_BPC_D7000_WF] = { | ||
| 12240 | .mixers = { alc262_HP_BPC_WildWest_mixer }, | ||
| 12241 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | ||
| 12242 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12243 | .dac_nids = alc262_dac_nids, | ||
| 12244 | .hp_nid = 0x03, | ||
| 12245 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12246 | .channel_mode = alc262_modes, | ||
| 12247 | .input_mux = &alc262_HP_D7000_capture_source, | ||
| 12248 | .unsol_event = alc262_hp_wildwest_unsol_event, | ||
| 12249 | .init_hook = alc262_hp_wildwest_automute, | ||
| 12250 | }, | ||
| 12251 | [ALC262_HP_BPC_D7000_WL] = { | ||
| 12252 | .mixers = { alc262_HP_BPC_WildWest_mixer, | ||
| 12253 | alc262_HP_BPC_WildWest_option_mixer }, | ||
| 12254 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, | ||
| 12255 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12256 | .dac_nids = alc262_dac_nids, | ||
| 12257 | .hp_nid = 0x03, | ||
| 12258 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12259 | .channel_mode = alc262_modes, | ||
| 12260 | .input_mux = &alc262_HP_D7000_capture_source, | ||
| 12261 | .unsol_event = alc262_hp_wildwest_unsol_event, | ||
| 12262 | .init_hook = alc262_hp_wildwest_automute, | ||
| 12263 | }, | ||
| 12264 | [ALC262_HP_TC_T5735] = { | ||
| 12265 | .mixers = { alc262_hp_t5735_mixer }, | ||
| 12266 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, | ||
| 12267 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12268 | .dac_nids = alc262_dac_nids, | ||
| 12269 | .hp_nid = 0x03, | ||
| 12270 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12271 | .channel_mode = alc262_modes, | ||
| 12272 | .input_mux = &alc262_capture_source, | ||
| 12273 | .unsol_event = alc_sku_unsol_event, | ||
| 12274 | .setup = alc262_hp_t5735_setup, | ||
| 12275 | .init_hook = alc_inithook, | ||
| 12276 | }, | ||
| 12277 | [ALC262_HP_RP5700] = { | ||
| 12278 | .mixers = { alc262_hp_rp5700_mixer }, | ||
| 12279 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, | ||
| 12280 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12281 | .dac_nids = alc262_dac_nids, | ||
| 12282 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12283 | .channel_mode = alc262_modes, | ||
| 12284 | .input_mux = &alc262_hp_rp5700_capture_source, | ||
| 12285 | }, | ||
| 12286 | [ALC262_BENQ_ED8] = { | ||
| 12287 | .mixers = { alc262_base_mixer }, | ||
| 12288 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, | ||
| 12289 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12290 | .dac_nids = alc262_dac_nids, | ||
| 12291 | .hp_nid = 0x03, | ||
| 12292 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12293 | .channel_mode = alc262_modes, | ||
| 12294 | .input_mux = &alc262_capture_source, | ||
| 12295 | }, | ||
| 12296 | [ALC262_SONY_ASSAMD] = { | ||
| 12297 | .mixers = { alc262_sony_mixer }, | ||
| 12298 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, | ||
| 12299 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12300 | .dac_nids = alc262_dac_nids, | ||
| 12301 | .hp_nid = 0x02, | ||
| 12302 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12303 | .channel_mode = alc262_modes, | ||
| 12304 | .input_mux = &alc262_capture_source, | ||
| 12305 | .unsol_event = alc262_hippo_unsol_event, | ||
| 12306 | .setup = alc262_hippo_setup, | ||
| 12307 | .init_hook = alc262_hippo_automute, | ||
| 12308 | }, | ||
| 12309 | [ALC262_BENQ_T31] = { | ||
| 12310 | .mixers = { alc262_benq_t31_mixer }, | ||
| 12311 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, | ||
| 12312 | alc_hp15_unsol_verbs }, | ||
| 12313 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12314 | .dac_nids = alc262_dac_nids, | ||
| 12315 | .hp_nid = 0x03, | ||
| 12316 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12317 | .channel_mode = alc262_modes, | ||
| 12318 | .input_mux = &alc262_capture_source, | ||
| 12319 | .unsol_event = alc262_hippo_unsol_event, | ||
| 12320 | .setup = alc262_hippo_setup, | ||
| 12321 | .init_hook = alc262_hippo_automute, | ||
| 12322 | }, | ||
| 12323 | [ALC262_ULTRA] = { | ||
| 12324 | .mixers = { alc262_ultra_mixer }, | ||
| 12325 | .cap_mixer = alc262_ultra_capture_mixer, | ||
| 12326 | .init_verbs = { alc262_ultra_verbs }, | ||
| 12327 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12328 | .dac_nids = alc262_dac_nids, | ||
| 12329 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12330 | .channel_mode = alc262_modes, | ||
| 12331 | .input_mux = &alc262_ultra_capture_source, | ||
| 12332 | .adc_nids = alc262_adc_nids, /* ADC0 */ | ||
| 12333 | .capsrc_nids = alc262_capsrc_nids, | ||
| 12334 | .num_adc_nids = 1, /* single ADC */ | ||
| 12335 | .unsol_event = alc262_ultra_unsol_event, | ||
| 12336 | .init_hook = alc262_ultra_automute, | ||
| 12337 | }, | ||
| 12338 | [ALC262_LENOVO_3000] = { | ||
| 12339 | .mixers = { alc262_lenovo_3000_mixer }, | ||
| 12340 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | ||
| 12341 | alc262_lenovo_3000_unsol_verbs, | ||
| 12342 | alc262_lenovo_3000_init_verbs }, | ||
| 12343 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12344 | .dac_nids = alc262_dac_nids, | ||
| 12345 | .hp_nid = 0x03, | ||
| 12346 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12347 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12348 | .channel_mode = alc262_modes, | ||
| 12349 | .input_mux = &alc262_fujitsu_capture_source, | ||
| 12350 | .unsol_event = alc262_lenovo_3000_unsol_event, | ||
| 12351 | }, | ||
| 12352 | [ALC262_NEC] = { | ||
| 12353 | .mixers = { alc262_nec_mixer }, | ||
| 12354 | .init_verbs = { alc262_nec_verbs }, | ||
| 12355 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12356 | .dac_nids = alc262_dac_nids, | ||
| 12357 | .hp_nid = 0x03, | ||
| 12358 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12359 | .channel_mode = alc262_modes, | ||
| 12360 | .input_mux = &alc262_capture_source, | ||
| 12361 | }, | ||
| 12362 | [ALC262_TOSHIBA_S06] = { | ||
| 12363 | .mixers = { alc262_toshiba_s06_mixer }, | ||
| 12364 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | ||
| 12365 | alc262_eapd_verbs }, | ||
| 12366 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12367 | .capsrc_nids = alc262_dmic_capsrc_nids, | ||
| 12368 | .dac_nids = alc262_dac_nids, | ||
| 12369 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | ||
| 12370 | .num_adc_nids = 1, /* single ADC */ | ||
| 12371 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12372 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12373 | .channel_mode = alc262_modes, | ||
| 12374 | .unsol_event = alc_sku_unsol_event, | ||
| 12375 | .setup = alc262_toshiba_s06_setup, | ||
| 12376 | .init_hook = alc_inithook, | ||
| 12377 | }, | ||
| 12378 | [ALC262_TOSHIBA_RX1] = { | ||
| 12379 | .mixers = { alc262_toshiba_rx1_mixer }, | ||
| 12380 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | ||
| 12381 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12382 | .dac_nids = alc262_dac_nids, | ||
| 12383 | .hp_nid = 0x03, | ||
| 12384 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12385 | .channel_mode = alc262_modes, | ||
| 12386 | .input_mux = &alc262_capture_source, | ||
| 12387 | .unsol_event = alc262_hippo_unsol_event, | ||
| 12388 | .setup = alc262_hippo_setup, | ||
| 12389 | .init_hook = alc262_hippo_automute, | ||
| 12390 | }, | ||
| 12391 | [ALC262_TYAN] = { | ||
| 12392 | .mixers = { alc262_tyan_mixer }, | ||
| 12393 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | ||
| 12394 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
| 12395 | .dac_nids = alc262_dac_nids, | ||
| 12396 | .hp_nid = 0x02, | ||
| 12397 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
| 12398 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
| 12399 | .channel_mode = alc262_modes, | ||
| 12400 | .input_mux = &alc262_capture_source, | ||
| 12401 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 12402 | .setup = alc262_tyan_setup, | ||
| 12403 | .init_hook = alc_automute_amp, | ||
| 12404 | }, | ||
| 12405 | }; | ||
| 12406 | |||
| 12407 | static int patch_alc262(struct hda_codec *codec) | ||
| 12408 | { | ||
| 12409 | struct alc_spec *spec; | ||
| 12410 | int board_config; | ||
| 12411 | int err; | ||
| 12412 | |||
| 12413 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 12414 | if (spec == NULL) | ||
| 12415 | return -ENOMEM; | ||
| 12416 | |||
| 12417 | codec->spec = spec; | ||
| 12418 | #if 0 | ||
| 12419 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | ||
| 12420 | * under-run | ||
| 12421 | */ | ||
| 12422 | { | ||
| 12423 | int tmp; | ||
| 12424 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
| 12425 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | ||
| 12426 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); | ||
| 12427 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); | ||
| 12428 | } | ||
| 12429 | #endif | ||
| 12430 | alc_auto_parse_customize_define(codec); | ||
| 12431 | |||
| 12432 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | ||
| 12433 | |||
| 12434 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, | ||
| 12435 | alc262_models, | ||
| 12436 | alc262_cfg_tbl); | ||
| 12437 | |||
| 12438 | if (board_config < 0) { | ||
| 12439 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 12440 | codec->chip_name); | ||
| 12441 | board_config = ALC262_AUTO; | ||
| 12442 | } | ||
| 12443 | |||
| 12444 | if (board_config == ALC262_AUTO) { | ||
| 12445 | /* automatic parse from the BIOS config */ | ||
| 12446 | err = alc262_parse_auto_config(codec); | ||
| 12447 | if (err < 0) { | ||
| 12448 | alc_free(codec); | ||
| 12449 | return err; | ||
| 12450 | } else if (!err) { | ||
| 12451 | printk(KERN_INFO | ||
| 12452 | "hda_codec: Cannot set up configuration " | ||
| 12453 | "from BIOS. Using base mode...\n"); | ||
| 12454 | board_config = ALC262_BASIC; | ||
| 12455 | } | ||
| 12456 | } | ||
| 12457 | |||
| 12458 | if (!spec->no_analog && has_cdefine_beep(codec)) { | ||
| 12459 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 12460 | if (err < 0) { | ||
| 12461 | alc_free(codec); | ||
| 12462 | return err; | ||
| 12463 | } | ||
| 12464 | } | ||
| 12465 | |||
| 12466 | if (board_config != ALC262_AUTO) | ||
| 12467 | setup_preset(codec, &alc262_presets[board_config]); | ||
| 12468 | |||
| 12469 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | ||
| 12470 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | ||
| 12471 | |||
| 12472 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | ||
| 12473 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | ||
| 12474 | |||
| 12475 | if (!spec->adc_nids && spec->input_mux) { | ||
| 12476 | int i; | ||
| 12477 | /* check whether the digital-mic has to be supported */ | ||
| 12478 | for (i = 0; i < spec->input_mux->num_items; i++) { | ||
| 12479 | if (spec->input_mux->items[i].index >= 9) | ||
| 12480 | break; | ||
| 12481 | } | ||
| 12482 | if (i < spec->input_mux->num_items) { | ||
| 12483 | /* use only ADC0 */ | ||
| 12484 | spec->adc_nids = alc262_dmic_adc_nids; | ||
| 12485 | spec->num_adc_nids = 1; | ||
| 12486 | spec->capsrc_nids = alc262_dmic_capsrc_nids; | ||
| 12487 | } else { | ||
| 12488 | /* all analog inputs */ | ||
| 12489 | /* check whether NID 0x07 is valid */ | ||
| 12490 | unsigned int wcap = get_wcaps(codec, 0x07); | ||
| 12491 | |||
| 12492 | /* get type */ | ||
| 12493 | wcap = get_wcaps_type(wcap); | ||
| 12494 | if (wcap != AC_WID_AUD_IN) { | ||
| 12495 | spec->adc_nids = alc262_adc_nids_alt; | ||
| 12496 | spec->num_adc_nids = | ||
| 12497 | ARRAY_SIZE(alc262_adc_nids_alt); | ||
| 12498 | spec->capsrc_nids = alc262_capsrc_nids_alt; | ||
| 12499 | } else { | ||
| 12500 | spec->adc_nids = alc262_adc_nids; | ||
| 12501 | spec->num_adc_nids = | ||
| 12502 | ARRAY_SIZE(alc262_adc_nids); | ||
| 12503 | spec->capsrc_nids = alc262_capsrc_nids; | ||
| 12504 | } | ||
| 12505 | } | ||
| 12506 | } | ||
| 12507 | if (!spec->cap_mixer && !spec->no_analog) | ||
| 12508 | set_capture_mixer(codec); | ||
| 12509 | if (!spec->no_analog && has_cdefine_beep(codec)) | ||
| 12510 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
| 12511 | |||
| 12512 | spec->vmaster_nid = 0x0c; | ||
| 12513 | |||
| 12514 | codec->patch_ops = alc_patch_ops; | ||
| 12515 | if (board_config == ALC262_AUTO) | ||
| 12516 | spec->init_hook = alc262_auto_init; | ||
| 12517 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 12518 | if (!spec->loopback.amplist) | ||
| 12519 | spec->loopback.amplist = alc262_loopbacks; | ||
| 12520 | #endif | ||
| 12521 | |||
| 12522 | return 0; | ||
| 12523 | } | ||
| 12524 | |||
| 12525 | /* | ||
| 12526 | * ALC268 channel source setting (2 channel) | ||
| 12527 | */ | ||
| 12528 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | ||
| 12529 | #define alc268_modes alc260_modes | ||
| 12530 | |||
| 12531 | static hda_nid_t alc268_dac_nids[2] = { | ||
| 12532 | /* front, hp */ | ||
| 12533 | 0x02, 0x03 | ||
| 12534 | }; | ||
| 12535 | |||
| 12536 | static hda_nid_t alc268_adc_nids[2] = { | ||
| 12537 | /* ADC0-1 */ | ||
| 12538 | 0x08, 0x07 | ||
| 12539 | }; | ||
| 12540 | |||
| 12541 | static hda_nid_t alc268_adc_nids_alt[1] = { | ||
| 12542 | /* ADC0 */ | ||
| 12543 | 0x08 | ||
| 12544 | }; | ||
| 12545 | |||
| 12546 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | ||
| 12547 | |||
| 12548 | static struct snd_kcontrol_new alc268_base_mixer[] = { | ||
| 12549 | /* output mixer control */ | ||
| 12550 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
| 12551 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 12552 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
| 12553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 12554 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12555 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 12556 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | ||
| 12557 | { } | ||
| 12558 | }; | ||
| 12559 | |||
| 12560 | static struct snd_kcontrol_new alc268_toshiba_mixer[] = { | ||
| 12561 | /* output mixer control */ | ||
| 12562 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
| 12563 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
| 12564 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 12565 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12566 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 12567 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | ||
| 12568 | { } | ||
| 12569 | }; | ||
| 12570 | |||
| 12571 | /* bind Beep switches of both NID 0x0f and 0x10 */ | ||
| 12572 | static struct hda_bind_ctls alc268_bind_beep_sw = { | ||
| 12573 | .ops = &snd_hda_bind_sw, | ||
| 12574 | .values = { | ||
| 12575 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | ||
| 12576 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | ||
| 12577 | 0 | ||
| 12578 | }, | ||
| 12579 | }; | ||
| 12580 | |||
| 12581 | static struct snd_kcontrol_new alc268_beep_mixer[] = { | ||
| 12582 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | ||
| 12583 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | ||
| 12584 | { } | ||
| 12585 | }; | ||
| 12586 | |||
| 12587 | static struct hda_verb alc268_eapd_verbs[] = { | ||
| 12588 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 12589 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 12590 | { } | ||
| 12591 | }; | ||
| 12592 | |||
| 12593 | /* Toshiba specific */ | ||
| 12594 | static struct hda_verb alc268_toshiba_verbs[] = { | ||
| 12595 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 12596 | { } /* end */ | ||
| 12597 | }; | ||
| 12598 | |||
| 12599 | /* Acer specific */ | ||
| 12600 | /* bind volumes of both NID 0x02 and 0x03 */ | ||
| 12601 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | ||
| 12602 | .ops = &snd_hda_bind_vol, | ||
| 12603 | .values = { | ||
| 12604 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
| 12605 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
| 12606 | 0 | ||
| 12607 | }, | ||
| 12608 | }; | ||
| 12609 | |||
| 12610 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 12611 | static void alc268_acer_automute(struct hda_codec *codec, int force) | ||
| 12612 | { | ||
| 12613 | struct alc_spec *spec = codec->spec; | ||
| 12614 | unsigned int mute; | ||
| 12615 | |||
| 12616 | if (force || !spec->sense_updated) { | ||
| 12617 | spec->jack_present = snd_hda_jack_detect(codec, 0x14); | ||
| 12618 | spec->sense_updated = 1; | ||
| 12619 | } | ||
| 12620 | if (spec->jack_present) | ||
| 12621 | mute = HDA_AMP_MUTE; /* mute internal speaker */ | ||
| 12622 | else /* unmute internal speaker if necessary */ | ||
| 12623 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | ||
| 12624 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 12625 | HDA_AMP_MUTE, mute); | ||
| 12626 | } | ||
| 12627 | |||
| 12628 | |||
| 12629 | /* bind hp and internal speaker mute (with plug check) */ | ||
| 12630 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | ||
| 12631 | struct snd_ctl_elem_value *ucontrol) | ||
| 12632 | { | ||
| 12633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
| 12634 | long *valp = ucontrol->value.integer.value; | ||
| 12635 | int change; | ||
| 12636 | |||
| 12637 | change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); | ||
| 12638 | if (change) | ||
| 12639 | alc268_acer_automute(codec, 0); | ||
| 12640 | return change; | ||
| 12641 | } | ||
| 12642 | |||
| 12643 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | ||
| 12644 | /* output mixer control */ | ||
| 12645 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
| 12646 | { | ||
| 12647 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 12648 | .name = "Master Playback Switch", | ||
| 12649 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 12650 | .info = snd_hda_mixer_amp_switch_info, | ||
| 12651 | .get = snd_hda_mixer_amp_switch_get, | ||
| 12652 | .put = alc268_acer_master_sw_put, | ||
| 12653 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 12654 | }, | ||
| 12655 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | ||
| 12656 | { } | ||
| 12657 | }; | ||
| 12658 | |||
| 12659 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | ||
| 12660 | /* output mixer control */ | ||
| 12661 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
| 12662 | { | ||
| 12663 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 12664 | .name = "Master Playback Switch", | ||
| 12665 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 12666 | .info = snd_hda_mixer_amp_switch_info, | ||
| 12667 | .get = snd_hda_mixer_amp_switch_get, | ||
| 12668 | .put = alc268_acer_master_sw_put, | ||
| 12669 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 12670 | }, | ||
| 12671 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12672 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 12673 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | ||
| 12674 | { } | ||
| 12675 | }; | ||
| 12676 | |||
| 12677 | static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = { | ||
| 12678 | /* output mixer control */ | ||
| 12679 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
| 12680 | { | ||
| 12681 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 12682 | .name = "Master Playback Switch", | ||
| 12683 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 12684 | .info = snd_hda_mixer_amp_switch_info, | ||
| 12685 | .get = snd_hda_mixer_amp_switch_get, | ||
| 12686 | .put = alc268_acer_master_sw_put, | ||
| 12687 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 12688 | }, | ||
| 12689 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12690 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), | ||
| 12691 | { } | ||
| 12692 | }; | ||
| 12693 | |||
| 12694 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | ||
| 12695 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 12696 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 12697 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 12698 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 12699 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
| 12700 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | ||
| 12701 | { } | ||
| 12702 | }; | ||
| 12703 | |||
| 12704 | static struct hda_verb alc268_acer_verbs[] = { | ||
| 12705 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | ||
| 12706 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 12707 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 12708 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 12709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 12710 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 12711 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 12712 | { } | ||
| 12713 | }; | ||
| 12714 | |||
| 12715 | /* unsolicited event for HP jack sensing */ | ||
| 12716 | #define alc268_toshiba_unsol_event alc262_hippo_unsol_event | ||
| 12717 | #define alc268_toshiba_setup alc262_hippo_setup | ||
| 12718 | #define alc268_toshiba_automute alc262_hippo_automute | ||
| 12719 | |||
| 12720 | static void alc268_acer_unsol_event(struct hda_codec *codec, | ||
| 12721 | unsigned int res) | ||
| 12722 | { | ||
| 12723 | if ((res >> 26) != ALC880_HP_EVENT) | ||
| 12724 | return; | ||
| 12725 | alc268_acer_automute(codec, 1); | ||
| 12726 | } | ||
| 12727 | |||
| 12728 | static void alc268_acer_init_hook(struct hda_codec *codec) | ||
| 12729 | { | ||
| 12730 | alc268_acer_automute(codec, 1); | ||
| 12731 | } | ||
| 12732 | |||
| 12733 | /* toggle speaker-output according to the hp-jack state */ | ||
| 12734 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | ||
| 12735 | { | ||
| 12736 | unsigned int present; | ||
| 12737 | unsigned char bits; | ||
| 12738 | |||
| 12739 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 12740 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 12741 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | ||
| 12742 | HDA_AMP_MUTE, bits); | ||
| 12743 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | ||
| 12744 | HDA_AMP_MUTE, bits); | ||
| 12745 | } | ||
| 12746 | |||
| 12747 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | ||
| 12748 | unsigned int res) | ||
| 12749 | { | ||
| 12750 | switch (res >> 26) { | ||
| 12751 | case ALC880_HP_EVENT: | ||
| 12752 | alc268_aspire_one_speaker_automute(codec); | ||
| 12753 | break; | ||
| 12754 | case ALC880_MIC_EVENT: | ||
| 12755 | alc_mic_automute(codec); | ||
| 12756 | break; | ||
| 12757 | } | ||
| 12758 | } | ||
| 12759 | |||
| 12760 | static void alc268_acer_lc_setup(struct hda_codec *codec) | ||
| 12761 | { | ||
| 12762 | struct alc_spec *spec = codec->spec; | ||
| 12763 | spec->ext_mic.pin = 0x18; | ||
| 12764 | spec->ext_mic.mux_idx = 0; | ||
| 12765 | spec->int_mic.pin = 0x12; | ||
| 12766 | spec->int_mic.mux_idx = 6; | ||
| 12767 | spec->auto_mic = 1; | ||
| 12768 | } | ||
| 12769 | |||
| 12770 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | ||
| 12771 | { | ||
| 12772 | alc268_aspire_one_speaker_automute(codec); | ||
| 12773 | alc_mic_automute(codec); | ||
| 12774 | } | ||
| 12775 | |||
| 12776 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | ||
| 12777 | /* output mixer control */ | ||
| 12778 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 12779 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 12780 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 12781 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 12782 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12783 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 12784 | { } | ||
| 12785 | }; | ||
| 12786 | |||
| 12787 | static struct hda_verb alc268_dell_verbs[] = { | ||
| 12788 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 12789 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 12790 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 12791 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
| 12792 | { } | ||
| 12793 | }; | ||
| 12794 | |||
| 12795 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
| 12796 | static void alc268_dell_setup(struct hda_codec *codec) | ||
| 12797 | { | ||
| 12798 | struct alc_spec *spec = codec->spec; | ||
| 12799 | |||
| 12800 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 12801 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 12802 | spec->ext_mic.pin = 0x18; | ||
| 12803 | spec->ext_mic.mux_idx = 0; | ||
| 12804 | spec->int_mic.pin = 0x19; | ||
| 12805 | spec->int_mic.mux_idx = 1; | ||
| 12806 | spec->auto_mic = 1; | ||
| 12807 | } | ||
| 12808 | |||
| 12809 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { | ||
| 12810 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
| 12811 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 12812 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
| 12813 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 12814 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
| 12815 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), | ||
| 12816 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 12817 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 12818 | { } | ||
| 12819 | }; | ||
| 12820 | |||
| 12821 | static struct hda_verb alc267_quanta_il1_verbs[] = { | ||
| 12822 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 12823 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
| 12824 | { } | ||
| 12825 | }; | ||
| 12826 | |||
| 12827 | static void alc267_quanta_il1_setup(struct hda_codec *codec) | ||
| 12828 | { | ||
| 12829 | struct alc_spec *spec = codec->spec; | ||
| 12830 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 12831 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 12832 | spec->ext_mic.pin = 0x18; | ||
| 12833 | spec->ext_mic.mux_idx = 0; | ||
| 12834 | spec->int_mic.pin = 0x19; | ||
| 12835 | spec->int_mic.mux_idx = 1; | ||
| 12836 | spec->auto_mic = 1; | ||
| 12837 | } | ||
| 12838 | |||
| 12839 | /* | ||
| 12840 | * generic initialization of ADC, input mixers and output mixers | ||
| 12841 | */ | ||
| 12842 | static struct hda_verb alc268_base_init_verbs[] = { | ||
| 12843 | /* Unmute DAC0-1 and set vol = 0 */ | ||
| 12844 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 12845 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 12846 | |||
| 12847 | /* | ||
| 12848 | * Set up output mixers (0x0c - 0x0e) | ||
| 12849 | */ | ||
| 12850 | /* set vol=0 to output mixers */ | ||
| 12851 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12852 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 12853 | |||
| 12854 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12855 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12856 | |||
| 12857 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 12858 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, | ||
| 12859 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, | ||
| 12860 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 12861 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 12862 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12863 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12864 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12865 | |||
| 12866 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12867 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12868 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12869 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12870 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12871 | |||
| 12872 | /* set PCBEEP vol = 0, mute connections */ | ||
| 12873 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12874 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 12875 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 12876 | |||
| 12877 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | ||
| 12878 | |||
| 12879 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 12880 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 12881 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 12882 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 12883 | |||
| 12884 | { } | ||
| 12885 | }; | ||
| 12886 | |||
| 12887 | /* | ||
| 12888 | * generic initialization of ADC, input mixers and output mixers | ||
| 12889 | */ | ||
| 12890 | static struct hda_verb alc268_volume_init_verbs[] = { | ||
| 12891 | /* set output DAC */ | ||
| 12892 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 12893 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 12894 | |||
| 12895 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 12896 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
| 12897 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12898 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12899 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | ||
| 12900 | |||
| 12901 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12902 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12903 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12904 | |||
| 12905 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12906 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 12907 | |||
| 12908 | /* set PCBEEP vol = 0, mute connections */ | ||
| 12909 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 12910 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 12911 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 12912 | |||
| 12913 | { } | ||
| 12914 | }; | ||
| 12915 | |||
| 12916 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | ||
| 12917 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
| 12918 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
| 12919 | { } /* end */ | ||
| 12920 | }; | ||
| 12921 | |||
| 12922 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | ||
| 12923 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
| 12924 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
| 12925 | _DEFINE_CAPSRC(1), | ||
| 12926 | { } /* end */ | ||
| 12927 | }; | ||
| 12928 | |||
| 12929 | static struct snd_kcontrol_new alc268_capture_mixer[] = { | ||
| 12930 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
| 12931 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
| 12932 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | ||
| 12933 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | ||
| 12934 | _DEFINE_CAPSRC(2), | ||
| 12935 | { } /* end */ | ||
| 12936 | }; | ||
| 12937 | |||
| 12938 | static struct hda_input_mux alc268_capture_source = { | ||
| 12939 | .num_items = 4, | ||
| 12940 | .items = { | ||
| 12941 | { "Mic", 0x0 }, | ||
| 12942 | { "Front Mic", 0x1 }, | ||
| 12943 | { "Line", 0x2 }, | ||
| 12944 | { "CD", 0x3 }, | ||
| 12945 | }, | ||
| 12946 | }; | ||
| 12947 | |||
| 12948 | static struct hda_input_mux alc268_acer_capture_source = { | ||
| 12949 | .num_items = 3, | ||
| 12950 | .items = { | ||
| 12951 | { "Mic", 0x0 }, | ||
| 12952 | { "Internal Mic", 0x1 }, | ||
| 12953 | { "Line", 0x2 }, | ||
| 12954 | }, | ||
| 12955 | }; | ||
| 12956 | |||
| 12957 | static struct hda_input_mux alc268_acer_dmic_capture_source = { | ||
| 12958 | .num_items = 3, | ||
| 12959 | .items = { | ||
| 12960 | { "Mic", 0x0 }, | ||
| 12961 | { "Internal Mic", 0x6 }, | ||
| 12962 | { "Line", 0x2 }, | ||
| 12963 | }, | ||
| 12964 | }; | ||
| 12965 | |||
| 12966 | #ifdef CONFIG_SND_DEBUG | ||
| 12967 | static struct snd_kcontrol_new alc268_test_mixer[] = { | ||
| 12968 | /* Volume widgets */ | ||
| 12969 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 12970 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 12971 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 12972 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 12973 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), | ||
| 12974 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), | ||
| 12975 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), | ||
| 12976 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), | ||
| 12977 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), | ||
| 12978 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), | ||
| 12979 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), | ||
| 12980 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), | ||
| 12981 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), | ||
| 12982 | /* The below appears problematic on some hardwares */ | ||
| 12983 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ | ||
| 12984 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
| 12985 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), | ||
| 12986 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), | ||
| 12987 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), | ||
| 12988 | |||
| 12989 | /* Modes for retasking pin widgets */ | ||
| 12990 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), | ||
| 12991 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), | ||
| 12992 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), | ||
| 12993 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), | ||
| 12994 | |||
| 12995 | /* Controls for GPIO pins, assuming they are configured as outputs */ | ||
| 12996 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), | ||
| 12997 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), | ||
| 12998 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), | ||
| 12999 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), | ||
| 13000 | |||
| 13001 | /* Switches to allow the digital SPDIF output pin to be enabled. | ||
| 13002 | * The ALC268 does not have an SPDIF input. | ||
| 13003 | */ | ||
| 13004 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), | ||
| 13005 | |||
| 13006 | /* A switch allowing EAPD to be enabled. Some laptops seem to use | ||
| 13007 | * this output to turn on an external amplifier. | ||
| 13008 | */ | ||
| 13009 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), | ||
| 13010 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), | ||
| 13011 | |||
| 13012 | { } /* end */ | ||
| 13013 | }; | ||
| 13014 | #endif | ||
| 13015 | |||
| 13016 | /* create input playback/capture controls for the given pin */ | ||
| 13017 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | ||
| 13018 | const char *ctlname, int idx) | ||
| 13019 | { | ||
| 13020 | hda_nid_t dac; | ||
| 13021 | int err; | ||
| 13022 | |||
| 13023 | switch (nid) { | ||
| 13024 | case 0x14: | ||
| 13025 | case 0x16: | ||
| 13026 | dac = 0x02; | ||
| 13027 | break; | ||
| 13028 | case 0x15: | ||
| 13029 | case 0x1a: /* ALC259/269 only */ | ||
| 13030 | case 0x1b: /* ALC259/269 only */ | ||
| 13031 | case 0x21: /* ALC269vb has this pin, too */ | ||
| 13032 | dac = 0x03; | ||
| 13033 | break; | ||
| 13034 | default: | ||
| 13035 | return 0; | ||
| 13036 | } | ||
| 13037 | if (spec->multiout.dac_nids[0] != dac && | ||
| 13038 | spec->multiout.dac_nids[1] != dac) { | ||
| 13039 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, | ||
| 13040 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, | ||
| 13041 | HDA_OUTPUT)); | ||
| 13042 | if (err < 0) | ||
| 13043 | return err; | ||
| 13044 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | ||
| 13045 | } | ||
| 13046 | |||
| 13047 | if (nid != 0x16) | ||
| 13048 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | ||
| 13049 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | ||
| 13050 | else /* mono */ | ||
| 13051 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, | ||
| 13052 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | ||
| 13053 | if (err < 0) | ||
| 13054 | return err; | ||
| 13055 | return 0; | ||
| 13056 | } | ||
| 13057 | |||
| 13058 | /* add playback controls from the parsed DAC table */ | ||
| 13059 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | ||
| 13060 | const struct auto_pin_cfg *cfg) | ||
| 13061 | { | ||
| 13062 | hda_nid_t nid; | ||
| 13063 | int err; | ||
| 13064 | |||
| 13065 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 13066 | |||
| 13067 | nid = cfg->line_out_pins[0]; | ||
| 13068 | if (nid) { | ||
| 13069 | const char *name; | ||
| 13070 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 13071 | name = "Speaker"; | ||
| 13072 | else | ||
| 13073 | name = "Front"; | ||
| 13074 | err = alc268_new_analog_output(spec, nid, name, 0); | ||
| 13075 | if (err < 0) | ||
| 13076 | return err; | ||
| 13077 | } | ||
| 13078 | |||
| 13079 | nid = cfg->speaker_pins[0]; | ||
| 13080 | if (nid == 0x1d) { | ||
| 13081 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker", | ||
| 13082 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
| 13083 | if (err < 0) | ||
| 13084 | return err; | ||
| 13085 | } else { | ||
| 13086 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | ||
| 13087 | if (err < 0) | ||
| 13088 | return err; | ||
| 13089 | } | ||
| 13090 | nid = cfg->hp_pins[0]; | ||
| 13091 | if (nid) { | ||
| 13092 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); | ||
| 13093 | if (err < 0) | ||
| 13094 | return err; | ||
| 13095 | } | ||
| 13096 | |||
| 13097 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | ||
| 13098 | if (nid == 0x16) { | ||
| 13099 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono", | ||
| 13100 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); | ||
| 13101 | if (err < 0) | ||
| 13102 | return err; | ||
| 13103 | } | ||
| 13104 | return 0; | ||
| 13105 | } | ||
| 13106 | |||
| 13107 | /* create playback/capture controls for input pins */ | ||
| 13108 | static int alc268_auto_create_input_ctls(struct hda_codec *codec, | ||
| 13109 | const struct auto_pin_cfg *cfg) | ||
| 13110 | { | ||
| 13111 | return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24); | ||
| 13112 | } | ||
| 13113 | |||
| 13114 | static void alc268_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 13115 | hda_nid_t nid, int pin_type) | ||
| 13116 | { | ||
| 13117 | int idx; | ||
| 13118 | |||
| 13119 | alc_set_pin_output(codec, nid, pin_type); | ||
| 13120 | if (nid == 0x14 || nid == 0x16) | ||
| 13121 | idx = 0; | ||
| 13122 | else | ||
| 13123 | idx = 1; | ||
| 13124 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); | ||
| 13125 | } | ||
| 13126 | |||
| 13127 | static void alc268_auto_init_multi_out(struct hda_codec *codec) | ||
| 13128 | { | ||
| 13129 | struct alc_spec *spec = codec->spec; | ||
| 13130 | hda_nid_t nid = spec->autocfg.line_out_pins[0]; | ||
| 13131 | if (nid) { | ||
| 13132 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 13133 | alc268_auto_set_output_and_unmute(codec, nid, pin_type); | ||
| 13134 | } | ||
| 13135 | } | ||
| 13136 | |||
| 13137 | static void alc268_auto_init_hp_out(struct hda_codec *codec) | ||
| 13138 | { | ||
| 13139 | struct alc_spec *spec = codec->spec; | ||
| 13140 | hda_nid_t pin; | ||
| 13141 | |||
| 13142 | pin = spec->autocfg.hp_pins[0]; | ||
| 13143 | if (pin) | ||
| 13144 | alc268_auto_set_output_and_unmute(codec, pin, PIN_HP); | ||
| 13145 | pin = spec->autocfg.speaker_pins[0]; | ||
| 13146 | if (pin) | ||
| 13147 | alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT); | ||
| 13148 | } | ||
| 13149 | |||
| 13150 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | ||
| 13151 | { | ||
| 13152 | struct alc_spec *spec = codec->spec; | ||
| 13153 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; | ||
| 13154 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; | ||
| 13155 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; | ||
| 13156 | unsigned int dac_vol1, dac_vol2; | ||
| 13157 | |||
| 13158 | if (line_nid == 0x1d || speaker_nid == 0x1d) { | ||
| 13159 | snd_hda_codec_write(codec, speaker_nid, 0, | ||
| 13160 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 13161 | /* mute mixer inputs from 0x1d */ | ||
| 13162 | snd_hda_codec_write(codec, 0x0f, 0, | ||
| 13163 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 13164 | AMP_IN_UNMUTE(1)); | ||
| 13165 | snd_hda_codec_write(codec, 0x10, 0, | ||
| 13166 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 13167 | AMP_IN_UNMUTE(1)); | ||
| 13168 | } else { | ||
| 13169 | /* unmute mixer inputs from 0x1d */ | ||
| 13170 | snd_hda_codec_write(codec, 0x0f, 0, | ||
| 13171 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | ||
| 13172 | snd_hda_codec_write(codec, 0x10, 0, | ||
| 13173 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); | ||
| 13174 | } | ||
| 13175 | |||
| 13176 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | ||
| 13177 | if (line_nid == 0x14) | ||
| 13178 | dac_vol2 = AMP_OUT_ZERO; | ||
| 13179 | else if (line_nid == 0x15) | ||
| 13180 | dac_vol1 = AMP_OUT_ZERO; | ||
| 13181 | if (hp_nid == 0x14) | ||
| 13182 | dac_vol2 = AMP_OUT_ZERO; | ||
| 13183 | else if (hp_nid == 0x15) | ||
| 13184 | dac_vol1 = AMP_OUT_ZERO; | ||
| 13185 | if (line_nid != 0x16 || hp_nid != 0x16 || | ||
| 13186 | spec->autocfg.line_out_pins[1] != 0x16 || | ||
| 13187 | spec->autocfg.line_out_pins[2] != 0x16) | ||
| 13188 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; | ||
| 13189 | |||
| 13190 | snd_hda_codec_write(codec, 0x02, 0, | ||
| 13191 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); | ||
| 13192 | snd_hda_codec_write(codec, 0x03, 0, | ||
| 13193 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); | ||
| 13194 | } | ||
| 13195 | |||
| 13196 | /* pcm configuration: identical with ALC880 */ | ||
| 13197 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback | ||
| 13198 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture | ||
| 13199 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture | ||
| 13200 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback | ||
| 13201 | |||
| 13202 | /* | ||
| 13203 | * BIOS auto configuration | ||
| 13204 | */ | ||
| 13205 | static int alc268_parse_auto_config(struct hda_codec *codec) | ||
| 13206 | { | ||
| 13207 | struct alc_spec *spec = codec->spec; | ||
| 13208 | int err; | ||
| 13209 | static hda_nid_t alc268_ignore[] = { 0 }; | ||
| 13210 | |||
| 13211 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 13212 | alc268_ignore); | ||
| 13213 | if (err < 0) | ||
| 13214 | return err; | ||
| 13215 | if (!spec->autocfg.line_outs) { | ||
| 13216 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | ||
| 13217 | spec->multiout.max_channels = 2; | ||
| 13218 | spec->no_analog = 1; | ||
| 13219 | goto dig_only; | ||
| 13220 | } | ||
| 13221 | return 0; /* can't find valid BIOS pin config */ | ||
| 13222 | } | ||
| 13223 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 13224 | if (err < 0) | ||
| 13225 | return err; | ||
| 13226 | err = alc268_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 13227 | if (err < 0) | ||
| 13228 | return err; | ||
| 13229 | |||
| 13230 | spec->multiout.max_channels = 2; | ||
| 13231 | |||
| 13232 | dig_only: | ||
| 13233 | /* digital only support output */ | ||
| 13234 | if (spec->autocfg.dig_outs) { | ||
| 13235 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | ||
| 13236 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | ||
| 13237 | } | ||
| 13238 | if (spec->kctls.list) | ||
| 13239 | add_mixer(spec, spec->kctls.list); | ||
| 13240 | |||
| 13241 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) | ||
| 13242 | add_mixer(spec, alc268_beep_mixer); | ||
| 13243 | |||
| 13244 | add_verb(spec, alc268_volume_init_verbs); | ||
| 13245 | spec->num_mux_defs = 2; | ||
| 13246 | spec->input_mux = &spec->private_imux[0]; | ||
| 13247 | |||
| 13248 | err = alc_auto_add_mic_boost(codec); | ||
| 13249 | if (err < 0) | ||
| 13250 | return err; | ||
| 13251 | |||
| 13252 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 13253 | |||
| 13254 | return 1; | ||
| 13255 | } | ||
| 13256 | |||
| 13257 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | ||
| 13258 | |||
| 13259 | /* init callback for auto-configuration model -- overriding the default init */ | ||
| 13260 | static void alc268_auto_init(struct hda_codec *codec) | ||
| 13261 | { | ||
| 13262 | struct alc_spec *spec = codec->spec; | ||
| 13263 | alc268_auto_init_multi_out(codec); | ||
| 13264 | alc268_auto_init_hp_out(codec); | ||
| 13265 | alc268_auto_init_mono_speaker_out(codec); | ||
| 13266 | alc268_auto_init_analog_input(codec); | ||
| 13267 | if (spec->unsol_event) | ||
| 13268 | alc_inithook(codec); | ||
| 13269 | } | ||
| 13270 | |||
| 13271 | /* | ||
| 13272 | * configuration and preset | ||
| 13273 | */ | ||
| 13274 | static const char *alc268_models[ALC268_MODEL_LAST] = { | ||
| 13275 | [ALC267_QUANTA_IL1] = "quanta-il1", | ||
| 13276 | [ALC268_3ST] = "3stack", | ||
| 13277 | [ALC268_TOSHIBA] = "toshiba", | ||
| 13278 | [ALC268_ACER] = "acer", | ||
| 13279 | [ALC268_ACER_DMIC] = "acer-dmic", | ||
| 13280 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | ||
| 13281 | [ALC268_DELL] = "dell", | ||
| 13282 | [ALC268_ZEPTO] = "zepto", | ||
| 13283 | #ifdef CONFIG_SND_DEBUG | ||
| 13284 | [ALC268_TEST] = "test", | ||
| 13285 | #endif | ||
| 13286 | [ALC268_AUTO] = "auto", | ||
| 13287 | }; | ||
| 13288 | |||
| 13289 | static struct snd_pci_quirk alc268_cfg_tbl[] = { | ||
| 13290 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), | ||
| 13291 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), | ||
| 13292 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | ||
| 13293 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | ||
| 13294 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | ||
| 13295 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | ||
| 13296 | ALC268_ACER_ASPIRE_ONE), | ||
| 13297 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | ||
| 13298 | SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0, | ||
| 13299 | "Dell Inspiron Mini9/Vostro A90", ALC268_DELL), | ||
| 13300 | /* almost compatible with toshiba but with optional digital outs; | ||
| 13301 | * auto-probing seems working fine | ||
| 13302 | */ | ||
| 13303 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series", | ||
| 13304 | ALC268_AUTO), | ||
| 13305 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | ||
| 13306 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), | ||
| 13307 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | ||
| 13308 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | ||
| 13309 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | ||
| 13310 | {} | ||
| 13311 | }; | ||
| 13312 | |||
| 13313 | /* Toshiba laptops have no unique PCI SSID but only codec SSID */ | ||
| 13314 | static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = { | ||
| 13315 | SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO), | ||
| 13316 | SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO), | ||
| 13317 | SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05", | ||
| 13318 | ALC268_TOSHIBA), | ||
| 13319 | {} | ||
| 13320 | }; | ||
| 13321 | |||
| 13322 | static struct alc_config_preset alc268_presets[] = { | ||
| 13323 | [ALC267_QUANTA_IL1] = { | ||
| 13324 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, | ||
| 13325 | alc268_capture_nosrc_mixer }, | ||
| 13326 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13327 | alc267_quanta_il1_verbs }, | ||
| 13328 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13329 | .dac_nids = alc268_dac_nids, | ||
| 13330 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13331 | .adc_nids = alc268_adc_nids_alt, | ||
| 13332 | .hp_nid = 0x03, | ||
| 13333 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13334 | .channel_mode = alc268_modes, | ||
| 13335 | .unsol_event = alc_sku_unsol_event, | ||
| 13336 | .setup = alc267_quanta_il1_setup, | ||
| 13337 | .init_hook = alc_inithook, | ||
| 13338 | }, | ||
| 13339 | [ALC268_3ST] = { | ||
| 13340 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | ||
| 13341 | alc268_beep_mixer }, | ||
| 13342 | .init_verbs = { alc268_base_init_verbs }, | ||
| 13343 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13344 | .dac_nids = alc268_dac_nids, | ||
| 13345 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13346 | .adc_nids = alc268_adc_nids_alt, | ||
| 13347 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13348 | .hp_nid = 0x03, | ||
| 13349 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
| 13350 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13351 | .channel_mode = alc268_modes, | ||
| 13352 | .input_mux = &alc268_capture_source, | ||
| 13353 | }, | ||
| 13354 | [ALC268_TOSHIBA] = { | ||
| 13355 | .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer, | ||
| 13356 | alc268_beep_mixer }, | ||
| 13357 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13358 | alc268_toshiba_verbs }, | ||
| 13359 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13360 | .dac_nids = alc268_dac_nids, | ||
| 13361 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13362 | .adc_nids = alc268_adc_nids_alt, | ||
| 13363 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13364 | .hp_nid = 0x03, | ||
| 13365 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13366 | .channel_mode = alc268_modes, | ||
| 13367 | .input_mux = &alc268_capture_source, | ||
| 13368 | .unsol_event = alc268_toshiba_unsol_event, | ||
| 13369 | .setup = alc268_toshiba_setup, | ||
| 13370 | .init_hook = alc268_toshiba_automute, | ||
| 13371 | }, | ||
| 13372 | [ALC268_ACER] = { | ||
| 13373 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | ||
| 13374 | alc268_beep_mixer }, | ||
| 13375 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13376 | alc268_acer_verbs }, | ||
| 13377 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13378 | .dac_nids = alc268_dac_nids, | ||
| 13379 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13380 | .adc_nids = alc268_adc_nids_alt, | ||
| 13381 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13382 | .hp_nid = 0x02, | ||
| 13383 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13384 | .channel_mode = alc268_modes, | ||
| 13385 | .input_mux = &alc268_acer_capture_source, | ||
| 13386 | .unsol_event = alc268_acer_unsol_event, | ||
| 13387 | .init_hook = alc268_acer_init_hook, | ||
| 13388 | }, | ||
| 13389 | [ALC268_ACER_DMIC] = { | ||
| 13390 | .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer, | ||
| 13391 | alc268_beep_mixer }, | ||
| 13392 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13393 | alc268_acer_verbs }, | ||
| 13394 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13395 | .dac_nids = alc268_dac_nids, | ||
| 13396 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13397 | .adc_nids = alc268_adc_nids_alt, | ||
| 13398 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13399 | .hp_nid = 0x02, | ||
| 13400 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13401 | .channel_mode = alc268_modes, | ||
| 13402 | .input_mux = &alc268_acer_dmic_capture_source, | ||
| 13403 | .unsol_event = alc268_acer_unsol_event, | ||
| 13404 | .init_hook = alc268_acer_init_hook, | ||
| 13405 | }, | ||
| 13406 | [ALC268_ACER_ASPIRE_ONE] = { | ||
| 13407 | .mixers = { alc268_acer_aspire_one_mixer, | ||
| 13408 | alc268_beep_mixer, | ||
| 13409 | alc268_capture_nosrc_mixer }, | ||
| 13410 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13411 | alc268_acer_aspire_one_verbs }, | ||
| 13412 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13413 | .dac_nids = alc268_dac_nids, | ||
| 13414 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13415 | .adc_nids = alc268_adc_nids_alt, | ||
| 13416 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13417 | .hp_nid = 0x03, | ||
| 13418 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13419 | .channel_mode = alc268_modes, | ||
| 13420 | .unsol_event = alc268_acer_lc_unsol_event, | ||
| 13421 | .setup = alc268_acer_lc_setup, | ||
| 13422 | .init_hook = alc268_acer_lc_init_hook, | ||
| 13423 | }, | ||
| 13424 | [ALC268_DELL] = { | ||
| 13425 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, | ||
| 13426 | alc268_capture_nosrc_mixer }, | ||
| 13427 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13428 | alc268_dell_verbs }, | ||
| 13429 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13430 | .dac_nids = alc268_dac_nids, | ||
| 13431 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13432 | .adc_nids = alc268_adc_nids_alt, | ||
| 13433 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13434 | .hp_nid = 0x02, | ||
| 13435 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13436 | .channel_mode = alc268_modes, | ||
| 13437 | .unsol_event = alc_sku_unsol_event, | ||
| 13438 | .setup = alc268_dell_setup, | ||
| 13439 | .init_hook = alc_inithook, | ||
| 13440 | }, | ||
| 13441 | [ALC268_ZEPTO] = { | ||
| 13442 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, | ||
| 13443 | alc268_beep_mixer }, | ||
| 13444 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13445 | alc268_toshiba_verbs }, | ||
| 13446 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13447 | .dac_nids = alc268_dac_nids, | ||
| 13448 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13449 | .adc_nids = alc268_adc_nids_alt, | ||
| 13450 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13451 | .hp_nid = 0x03, | ||
| 13452 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
| 13453 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13454 | .channel_mode = alc268_modes, | ||
| 13455 | .input_mux = &alc268_capture_source, | ||
| 13456 | .setup = alc268_toshiba_setup, | ||
| 13457 | .init_hook = alc268_toshiba_automute, | ||
| 13458 | }, | ||
| 13459 | #ifdef CONFIG_SND_DEBUG | ||
| 13460 | [ALC268_TEST] = { | ||
| 13461 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, | ||
| 13462 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
| 13463 | alc268_volume_init_verbs }, | ||
| 13464 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
| 13465 | .dac_nids = alc268_dac_nids, | ||
| 13466 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
| 13467 | .adc_nids = alc268_adc_nids_alt, | ||
| 13468 | .capsrc_nids = alc268_capsrc_nids, | ||
| 13469 | .hp_nid = 0x03, | ||
| 13470 | .dig_out_nid = ALC268_DIGOUT_NID, | ||
| 13471 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
| 13472 | .channel_mode = alc268_modes, | ||
| 13473 | .input_mux = &alc268_capture_source, | ||
| 13474 | }, | ||
| 13475 | #endif | ||
| 13476 | }; | ||
| 13477 | |||
| 13478 | static int patch_alc268(struct hda_codec *codec) | ||
| 13479 | { | ||
| 13480 | struct alc_spec *spec; | ||
| 13481 | int board_config; | ||
| 13482 | int i, has_beep, err; | ||
| 13483 | |||
| 13484 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 13485 | if (spec == NULL) | ||
| 13486 | return -ENOMEM; | ||
| 13487 | |||
| 13488 | codec->spec = spec; | ||
| 13489 | |||
| 13490 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, | ||
| 13491 | alc268_models, | ||
| 13492 | alc268_cfg_tbl); | ||
| 13493 | |||
| 13494 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) | ||
| 13495 | board_config = snd_hda_check_board_codec_sid_config(codec, | ||
| 13496 | ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl); | ||
| 13497 | |||
| 13498 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { | ||
| 13499 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 13500 | codec->chip_name); | ||
| 13501 | board_config = ALC268_AUTO; | ||
| 13502 | } | ||
| 13503 | |||
| 13504 | if (board_config == ALC268_AUTO) { | ||
| 13505 | /* automatic parse from the BIOS config */ | ||
| 13506 | err = alc268_parse_auto_config(codec); | ||
| 13507 | if (err < 0) { | ||
| 13508 | alc_free(codec); | ||
| 13509 | return err; | ||
| 13510 | } else if (!err) { | ||
| 13511 | printk(KERN_INFO | ||
| 13512 | "hda_codec: Cannot set up configuration " | ||
| 13513 | "from BIOS. Using base mode...\n"); | ||
| 13514 | board_config = ALC268_3ST; | ||
| 13515 | } | ||
| 13516 | } | ||
| 13517 | |||
| 13518 | if (board_config != ALC268_AUTO) | ||
| 13519 | setup_preset(codec, &alc268_presets[board_config]); | ||
| 13520 | |||
| 13521 | spec->stream_analog_playback = &alc268_pcm_analog_playback; | ||
| 13522 | spec->stream_analog_capture = &alc268_pcm_analog_capture; | ||
| 13523 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; | ||
| 13524 | |||
| 13525 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | ||
| 13526 | |||
| 13527 | has_beep = 0; | ||
| 13528 | for (i = 0; i < spec->num_mixers; i++) { | ||
| 13529 | if (spec->mixers[i] == alc268_beep_mixer) { | ||
| 13530 | has_beep = 1; | ||
| 13531 | break; | ||
| 13532 | } | ||
| 13533 | } | ||
| 13534 | |||
| 13535 | if (has_beep) { | ||
| 13536 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 13537 | if (err < 0) { | ||
| 13538 | alc_free(codec); | ||
| 13539 | return err; | ||
| 13540 | } | ||
| 13541 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | ||
| 13542 | /* override the amp caps for beep generator */ | ||
| 13543 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | ||
| 13544 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | ||
| 13545 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
| 13546 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
| 13547 | (0 << AC_AMPCAP_MUTE_SHIFT)); | ||
| 13548 | } | ||
| 13549 | |||
| 13550 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { | ||
| 13551 | /* check whether NID 0x07 is valid */ | ||
| 13552 | unsigned int wcap = get_wcaps(codec, 0x07); | ||
| 13553 | int i; | ||
| 13554 | |||
| 13555 | spec->capsrc_nids = alc268_capsrc_nids; | ||
| 13556 | /* get type */ | ||
| 13557 | wcap = get_wcaps_type(wcap); | ||
| 13558 | if (spec->auto_mic || | ||
| 13559 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | ||
| 13560 | spec->adc_nids = alc268_adc_nids_alt; | ||
| 13561 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | ||
| 13562 | if (spec->auto_mic) | ||
| 13563 | fixup_automic_adc(codec); | ||
| 13564 | if (spec->auto_mic || spec->input_mux->num_items == 1) | ||
| 13565 | add_mixer(spec, alc268_capture_nosrc_mixer); | ||
| 13566 | else | ||
| 13567 | add_mixer(spec, alc268_capture_alt_mixer); | ||
| 13568 | } else { | ||
| 13569 | spec->adc_nids = alc268_adc_nids; | ||
| 13570 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | ||
| 13571 | add_mixer(spec, alc268_capture_mixer); | ||
| 13572 | } | ||
| 13573 | /* set default input source */ | ||
| 13574 | for (i = 0; i < spec->num_adc_nids; i++) | ||
| 13575 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | ||
| 13576 | 0, AC_VERB_SET_CONNECT_SEL, | ||
| 13577 | i < spec->num_mux_defs ? | ||
| 13578 | spec->input_mux[i].items[0].index : | ||
| 13579 | spec->input_mux->items[0].index); | ||
| 13580 | } | ||
| 13581 | |||
| 13582 | spec->vmaster_nid = 0x02; | ||
| 13583 | |||
| 13584 | codec->patch_ops = alc_patch_ops; | ||
| 13585 | if (board_config == ALC268_AUTO) | ||
| 13586 | spec->init_hook = alc268_auto_init; | ||
| 13587 | |||
| 13588 | return 0; | ||
| 13589 | } | ||
| 13590 | |||
| 13591 | /* | ||
| 13592 | * ALC269 channel source setting (2 channel) | ||
| 13593 | */ | ||
| 13594 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID | ||
| 13595 | |||
| 13596 | #define alc269_dac_nids alc260_dac_nids | ||
| 13597 | |||
| 13598 | static hda_nid_t alc269_adc_nids[1] = { | ||
| 13599 | /* ADC1 */ | ||
| 13600 | 0x08, | ||
| 13601 | }; | ||
| 13602 | |||
| 13603 | static hda_nid_t alc269_capsrc_nids[1] = { | ||
| 13604 | 0x23, | ||
| 13605 | }; | ||
| 13606 | |||
| 13607 | static hda_nid_t alc269vb_adc_nids[1] = { | ||
| 13608 | /* ADC1 */ | ||
| 13609 | 0x09, | ||
| 13610 | }; | ||
| 13611 | |||
| 13612 | static hda_nid_t alc269vb_capsrc_nids[1] = { | ||
| 13613 | 0x22, | ||
| 13614 | }; | ||
| 13615 | |||
| 13616 | static hda_nid_t alc269_adc_candidates[] = { | ||
| 13617 | 0x08, 0x09, 0x07, | ||
| 13618 | }; | ||
| 13619 | |||
| 13620 | #define alc269_modes alc260_modes | ||
| 13621 | #define alc269_capture_source alc880_lg_lw_capture_source | ||
| 13622 | |||
| 13623 | static struct snd_kcontrol_new alc269_base_mixer[] = { | ||
| 13624 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 13625 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 13626 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 13627 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 13628 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 13629 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 13630 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13631 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 13632 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 13633 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 13634 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 13635 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), | ||
| 13636 | { } /* end */ | ||
| 13637 | }; | ||
| 13638 | |||
| 13639 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | ||
| 13640 | /* output mixer control */ | ||
| 13641 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
| 13642 | { | ||
| 13643 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 13644 | .name = "Master Playback Switch", | ||
| 13645 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 13646 | .info = snd_hda_mixer_amp_switch_info, | ||
| 13647 | .get = snd_hda_mixer_amp_switch_get, | ||
| 13648 | .put = alc268_acer_master_sw_put, | ||
| 13649 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 13650 | }, | ||
| 13651 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 13652 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 13653 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13654 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 13655 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 13656 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 13657 | { } | ||
| 13658 | }; | ||
| 13659 | |||
| 13660 | static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | ||
| 13661 | /* output mixer control */ | ||
| 13662 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
| 13663 | { | ||
| 13664 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 13665 | .name = "Master Playback Switch", | ||
| 13666 | .subdevice = HDA_SUBDEV_AMP_FLAG, | ||
| 13667 | .info = snd_hda_mixer_amp_switch_info, | ||
| 13668 | .get = snd_hda_mixer_amp_switch_get, | ||
| 13669 | .put = alc268_acer_master_sw_put, | ||
| 13670 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 13671 | }, | ||
| 13672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 13673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 13674 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13675 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
| 13676 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
| 13677 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 13678 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | ||
| 13679 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | ||
| 13680 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | ||
| 13681 | { } | ||
| 13682 | }; | ||
| 13683 | |||
| 13684 | static struct snd_kcontrol_new alc269_laptop_mixer[] = { | ||
| 13685 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 13686 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 13687 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 13688 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 13689 | { } /* end */ | ||
| 13690 | }; | ||
| 13691 | |||
| 13692 | static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { | ||
| 13693 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 13694 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 13695 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 13696 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 13697 | { } /* end */ | ||
| 13698 | }; | ||
| 13699 | |||
| 13700 | /* capture mixer elements */ | ||
| 13701 | static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { | ||
| 13702 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
| 13703 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
| 13704 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13705 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | ||
| 13706 | { } /* end */ | ||
| 13707 | }; | ||
| 13708 | |||
| 13709 | static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = { | ||
| 13710 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
| 13711 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
| 13712 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13713 | { } /* end */ | ||
| 13714 | }; | ||
| 13715 | |||
| 13716 | static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { | ||
| 13717 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
| 13718 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
| 13719 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13720 | HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), | ||
| 13721 | { } /* end */ | ||
| 13722 | }; | ||
| 13723 | |||
| 13724 | static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { | ||
| 13725 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
| 13726 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
| 13727 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 13728 | { } /* end */ | ||
| 13729 | }; | ||
| 13730 | |||
| 13731 | /* FSC amilo */ | ||
| 13732 | #define alc269_fujitsu_mixer alc269_laptop_mixer | ||
| 13733 | |||
| 13734 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | ||
| 13735 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13736 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13737 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 13738 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 13739 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13740 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13741 | { } | ||
| 13742 | }; | ||
| 13743 | |||
| 13744 | static struct hda_verb alc269_lifebook_verbs[] = { | ||
| 13745 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13746 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13747 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13748 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 13749 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 13750 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 13751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 13752 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 13753 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13754 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13755 | { } | ||
| 13756 | }; | ||
| 13757 | |||
| 13758 | /* toggle speaker-output according to the hp-jack state */ | ||
| 13759 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) | ||
| 13760 | { | ||
| 13761 | unsigned int present; | ||
| 13762 | unsigned char bits; | ||
| 13763 | |||
| 13764 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 13765 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 13766 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 13767 | HDA_AMP_MUTE, bits); | ||
| 13768 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 13769 | HDA_AMP_MUTE, bits); | ||
| 13770 | |||
| 13771 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13772 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
| 13773 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13774 | AC_VERB_SET_PROC_COEF, 0x680); | ||
| 13775 | |||
| 13776 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13777 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
| 13778 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13779 | AC_VERB_SET_PROC_COEF, 0x480); | ||
| 13780 | } | ||
| 13781 | |||
| 13782 | /* toggle speaker-output according to the hp-jacks state */ | ||
| 13783 | static void alc269_lifebook_speaker_automute(struct hda_codec *codec) | ||
| 13784 | { | ||
| 13785 | unsigned int present; | ||
| 13786 | unsigned char bits; | ||
| 13787 | |||
| 13788 | /* Check laptop headphone socket */ | ||
| 13789 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 13790 | |||
| 13791 | /* Check port replicator headphone socket */ | ||
| 13792 | present |= snd_hda_jack_detect(codec, 0x1a); | ||
| 13793 | |||
| 13794 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 13795 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 13796 | HDA_AMP_MUTE, bits); | ||
| 13797 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 13798 | HDA_AMP_MUTE, bits); | ||
| 13799 | |||
| 13800 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13801 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
| 13802 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13803 | AC_VERB_SET_PROC_COEF, 0x680); | ||
| 13804 | |||
| 13805 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13806 | AC_VERB_SET_COEF_INDEX, 0x0c); | ||
| 13807 | snd_hda_codec_write(codec, 0x20, 0, | ||
| 13808 | AC_VERB_SET_PROC_COEF, 0x480); | ||
| 13809 | } | ||
| 13810 | |||
| 13811 | static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec) | ||
| 13812 | { | ||
| 13813 | unsigned int present_laptop; | ||
| 13814 | unsigned int present_dock; | ||
| 13815 | |||
| 13816 | present_laptop = snd_hda_jack_detect(codec, 0x18); | ||
| 13817 | present_dock = snd_hda_jack_detect(codec, 0x1b); | ||
| 13818 | |||
| 13819 | /* Laptop mic port overrides dock mic port, design decision */ | ||
| 13820 | if (present_dock) | ||
| 13821 | snd_hda_codec_write(codec, 0x23, 0, | ||
| 13822 | AC_VERB_SET_CONNECT_SEL, 0x3); | ||
| 13823 | if (present_laptop) | ||
| 13824 | snd_hda_codec_write(codec, 0x23, 0, | ||
| 13825 | AC_VERB_SET_CONNECT_SEL, 0x0); | ||
| 13826 | if (!present_dock && !present_laptop) | ||
| 13827 | snd_hda_codec_write(codec, 0x23, 0, | ||
| 13828 | AC_VERB_SET_CONNECT_SEL, 0x1); | ||
| 13829 | } | ||
| 13830 | |||
| 13831 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, | ||
| 13832 | unsigned int res) | ||
| 13833 | { | ||
| 13834 | switch (res >> 26) { | ||
| 13835 | case ALC880_HP_EVENT: | ||
| 13836 | alc269_quanta_fl1_speaker_automute(codec); | ||
| 13837 | break; | ||
| 13838 | case ALC880_MIC_EVENT: | ||
| 13839 | alc_mic_automute(codec); | ||
| 13840 | break; | ||
| 13841 | } | ||
| 13842 | } | ||
| 13843 | |||
| 13844 | static void alc269_lifebook_unsol_event(struct hda_codec *codec, | ||
| 13845 | unsigned int res) | ||
| 13846 | { | ||
| 13847 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 13848 | alc269_lifebook_speaker_automute(codec); | ||
| 13849 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
| 13850 | alc269_lifebook_mic_autoswitch(codec); | ||
| 13851 | } | ||
| 13852 | |||
| 13853 | static void alc269_quanta_fl1_setup(struct hda_codec *codec) | ||
| 13854 | { | ||
| 13855 | struct alc_spec *spec = codec->spec; | ||
| 13856 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 13857 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13858 | spec->ext_mic.pin = 0x18; | ||
| 13859 | spec->ext_mic.mux_idx = 0; | ||
| 13860 | spec->int_mic.pin = 0x19; | ||
| 13861 | spec->int_mic.mux_idx = 1; | ||
| 13862 | spec->auto_mic = 1; | ||
| 13863 | } | ||
| 13864 | |||
| 13865 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | ||
| 13866 | { | ||
| 13867 | alc269_quanta_fl1_speaker_automute(codec); | ||
| 13868 | alc_mic_automute(codec); | ||
| 13869 | } | ||
| 13870 | |||
| 13871 | static void alc269_lifebook_init_hook(struct hda_codec *codec) | ||
| 13872 | { | ||
| 13873 | alc269_lifebook_speaker_automute(codec); | ||
| 13874 | alc269_lifebook_mic_autoswitch(codec); | ||
| 13875 | } | ||
| 13876 | |||
| 13877 | static struct hda_verb alc269_laptop_dmic_init_verbs[] = { | ||
| 13878 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13879 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, | ||
| 13880 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
| 13881 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
| 13882 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13883 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13884 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 13885 | {} | ||
| 13886 | }; | ||
| 13887 | |||
| 13888 | static struct hda_verb alc269_laptop_amic_init_verbs[] = { | ||
| 13889 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13890 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13891 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
| 13892 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))}, | ||
| 13893 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13894 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 13895 | {} | ||
| 13896 | }; | ||
| 13897 | |||
| 13898 | static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { | ||
| 13899 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13900 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
| 13901 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
| 13902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
| 13903 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13904 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13905 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 13906 | {} | ||
| 13907 | }; | ||
| 13908 | |||
| 13909 | static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { | ||
| 13910 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13911 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 13912 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, | ||
| 13913 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, | ||
| 13914 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 13915 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 13916 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 13917 | {} | ||
| 13918 | }; | ||
| 13919 | |||
| 13920 | /* toggle speaker-output according to the hp-jack state */ | ||
| 13921 | static void alc269_speaker_automute(struct hda_codec *codec) | ||
| 13922 | { | ||
| 13923 | struct alc_spec *spec = codec->spec; | ||
| 13924 | unsigned int nid = spec->autocfg.hp_pins[0]; | ||
| 13925 | unsigned int present; | ||
| 13926 | unsigned char bits; | ||
| 13927 | |||
| 13928 | present = snd_hda_jack_detect(codec, nid); | ||
| 13929 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 13930 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 13931 | HDA_AMP_MUTE, bits); | ||
| 13932 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 13933 | HDA_AMP_MUTE, bits); | ||
| 13934 | } | ||
| 13935 | |||
| 13936 | /* unsolicited event for HP jack sensing */ | ||
| 13937 | static void alc269_laptop_unsol_event(struct hda_codec *codec, | ||
| 13938 | unsigned int res) | ||
| 13939 | { | ||
| 13940 | switch (res >> 26) { | ||
| 13941 | case ALC880_HP_EVENT: | ||
| 13942 | alc269_speaker_automute(codec); | ||
| 13943 | break; | ||
| 13944 | case ALC880_MIC_EVENT: | ||
| 13945 | alc_mic_automute(codec); | ||
| 13946 | break; | ||
| 13947 | } | ||
| 13948 | } | ||
| 13949 | |||
| 13950 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | ||
| 13951 | { | ||
| 13952 | struct alc_spec *spec = codec->spec; | ||
| 13953 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 13954 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13955 | spec->ext_mic.pin = 0x18; | ||
| 13956 | spec->ext_mic.mux_idx = 0; | ||
| 13957 | spec->int_mic.pin = 0x19; | ||
| 13958 | spec->int_mic.mux_idx = 1; | ||
| 13959 | spec->auto_mic = 1; | ||
| 13960 | } | ||
| 13961 | |||
| 13962 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | ||
| 13963 | { | ||
| 13964 | struct alc_spec *spec = codec->spec; | ||
| 13965 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 13966 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13967 | spec->ext_mic.pin = 0x18; | ||
| 13968 | spec->ext_mic.mux_idx = 0; | ||
| 13969 | spec->int_mic.pin = 0x12; | ||
| 13970 | spec->int_mic.mux_idx = 5; | ||
| 13971 | spec->auto_mic = 1; | ||
| 13972 | } | ||
| 13973 | |||
| 13974 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) | ||
| 13975 | { | ||
| 13976 | struct alc_spec *spec = codec->spec; | ||
| 13977 | spec->autocfg.hp_pins[0] = 0x21; | ||
| 13978 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13979 | spec->ext_mic.pin = 0x18; | ||
| 13980 | spec->ext_mic.mux_idx = 0; | ||
| 13981 | spec->int_mic.pin = 0x19; | ||
| 13982 | spec->int_mic.mux_idx = 1; | ||
| 13983 | spec->auto_mic = 1; | ||
| 13984 | } | ||
| 13985 | |||
| 13986 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | ||
| 13987 | { | ||
| 13988 | struct alc_spec *spec = codec->spec; | ||
| 13989 | spec->autocfg.hp_pins[0] = 0x21; | ||
| 13990 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13991 | spec->ext_mic.pin = 0x18; | ||
| 13992 | spec->ext_mic.mux_idx = 0; | ||
| 13993 | spec->int_mic.pin = 0x12; | ||
| 13994 | spec->int_mic.mux_idx = 6; | ||
| 13995 | spec->auto_mic = 1; | ||
| 13996 | } | ||
| 13997 | |||
| 13998 | static void alc269_laptop_inithook(struct hda_codec *codec) | ||
| 13999 | { | ||
| 14000 | alc269_speaker_automute(codec); | ||
| 14001 | alc_mic_automute(codec); | ||
| 14002 | } | ||
| 14003 | |||
| 14004 | /* | ||
| 14005 | * generic initialization of ADC, input mixers and output mixers | ||
| 14006 | */ | ||
| 14007 | static struct hda_verb alc269_init_verbs[] = { | ||
| 14008 | /* | ||
| 14009 | * Unmute ADC0 and set the default input to mic-in | ||
| 14010 | */ | ||
| 14011 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14012 | |||
| 14013 | /* | ||
| 14014 | * Set up output mixers (0x02 - 0x03) | ||
| 14015 | */ | ||
| 14016 | /* set vol=0 to output mixers */ | ||
| 14017 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 14018 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 14019 | |||
| 14020 | /* set up input amps for analog loopback */ | ||
| 14021 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 14022 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14024 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14025 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14026 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14028 | |||
| 14029 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 14030 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 14031 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 14032 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 14033 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 14034 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 14035 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 14036 | |||
| 14037 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14039 | |||
| 14040 | /* FIXME: use Mux-type input source selection */ | ||
| 14041 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
| 14042 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 14043 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 14044 | |||
| 14045 | /* set EAPD */ | ||
| 14046 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 14047 | { } | ||
| 14048 | }; | ||
| 14049 | |||
| 14050 | static struct hda_verb alc269vb_init_verbs[] = { | ||
| 14051 | /* | ||
| 14052 | * Unmute ADC0 and set the default input to mic-in | ||
| 14053 | */ | ||
| 14054 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14055 | |||
| 14056 | /* | ||
| 14057 | * Set up output mixers (0x02 - 0x03) | ||
| 14058 | */ | ||
| 14059 | /* set vol=0 to output mixers */ | ||
| 14060 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 14061 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 14062 | |||
| 14063 | /* set up input amps for analog loopback */ | ||
| 14064 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 14065 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14066 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14067 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14068 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14069 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14070 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14071 | |||
| 14072 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 14073 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 14074 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 14075 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 14076 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 14077 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 14078 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 14079 | |||
| 14080 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14081 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14082 | |||
| 14083 | /* FIXME: use Mux-type input source selection */ | ||
| 14084 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
| 14085 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 14086 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 14087 | |||
| 14088 | /* set EAPD */ | ||
| 14089 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 14090 | { } | ||
| 14091 | }; | ||
| 14092 | |||
| 14093 | #define alc269_auto_create_multi_out_ctls \ | ||
| 14094 | alc268_auto_create_multi_out_ctls | ||
| 14095 | #define alc269_auto_create_input_ctls \ | ||
| 14096 | alc268_auto_create_input_ctls | ||
| 14097 | |||
| 14098 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 14099 | #define alc269_loopbacks alc880_loopbacks | ||
| 14100 | #endif | ||
| 14101 | |||
| 14102 | /* pcm configuration: identical with ALC880 */ | ||
| 14103 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback | ||
| 14104 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture | ||
| 14105 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | ||
| 14106 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | ||
| 14107 | |||
| 14108 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | ||
| 14109 | .substreams = 1, | ||
| 14110 | .channels_min = 2, | ||
| 14111 | .channels_max = 8, | ||
| 14112 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | ||
| 14113 | /* NID is set in alc_build_pcms */ | ||
| 14114 | .ops = { | ||
| 14115 | .open = alc880_playback_pcm_open, | ||
| 14116 | .prepare = alc880_playback_pcm_prepare, | ||
| 14117 | .cleanup = alc880_playback_pcm_cleanup | ||
| 14118 | }, | ||
| 14119 | }; | ||
| 14120 | |||
| 14121 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | ||
| 14122 | .substreams = 1, | ||
| 14123 | .channels_min = 2, | ||
| 14124 | .channels_max = 2, | ||
| 14125 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | ||
| 14126 | /* NID is set in alc_build_pcms */ | ||
| 14127 | }; | ||
| 14128 | |||
| 14129 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 14130 | static int alc269_mic2_for_mute_led(struct hda_codec *codec) | ||
| 14131 | { | ||
| 14132 | switch (codec->subsystem_id) { | ||
| 14133 | case 0x103c1586: | ||
| 14134 | return 1; | ||
| 14135 | } | ||
| 14136 | return 0; | ||
| 14137 | } | ||
| 14138 | |||
| 14139 | static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid) | ||
| 14140 | { | ||
| 14141 | /* update mute-LED according to the speaker mute state */ | ||
| 14142 | if (nid == 0x01 || nid == 0x14) { | ||
| 14143 | int pinval; | ||
| 14144 | if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) & | ||
| 14145 | HDA_AMP_MUTE) | ||
| 14146 | pinval = 0x24; | ||
| 14147 | else | ||
| 14148 | pinval = 0x20; | ||
| 14149 | /* mic2 vref pin is used for mute LED control */ | ||
| 14150 | snd_hda_codec_update_cache(codec, 0x19, 0, | ||
| 14151 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 14152 | pinval); | ||
| 14153 | } | ||
| 14154 | return alc_check_power_status(codec, nid); | ||
| 14155 | } | ||
| 14156 | #endif /* CONFIG_SND_HDA_POWER_SAVE */ | ||
| 14157 | |||
| 14158 | /* | ||
| 14159 | * BIOS auto configuration | ||
| 14160 | */ | ||
| 14161 | static int alc269_parse_auto_config(struct hda_codec *codec) | ||
| 14162 | { | ||
| 14163 | struct alc_spec *spec = codec->spec; | ||
| 14164 | int err; | ||
| 14165 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | ||
| 14166 | |||
| 14167 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 14168 | alc269_ignore); | ||
| 14169 | if (err < 0) | ||
| 14170 | return err; | ||
| 14171 | |||
| 14172 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 14173 | if (err < 0) | ||
| 14174 | return err; | ||
| 14175 | err = alc269_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 14176 | if (err < 0) | ||
| 14177 | return err; | ||
| 14178 | |||
| 14179 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 14180 | |||
| 14181 | if (spec->autocfg.dig_outs) | ||
| 14182 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | ||
| 14183 | |||
| 14184 | if (spec->kctls.list) | ||
| 14185 | add_mixer(spec, spec->kctls.list); | ||
| 14186 | |||
| 14187 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { | ||
| 14188 | add_verb(spec, alc269vb_init_verbs); | ||
| 14189 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); | ||
| 14190 | } else { | ||
| 14191 | add_verb(spec, alc269_init_verbs); | ||
| 14192 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 14193 | } | ||
| 14194 | |||
| 14195 | spec->num_mux_defs = 1; | ||
| 14196 | spec->input_mux = &spec->private_imux[0]; | ||
| 14197 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | ||
| 14198 | sizeof(alc269_adc_candidates)); | ||
| 14199 | |||
| 14200 | /* set default input source */ | ||
| 14201 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], | ||
| 14202 | 0, AC_VERB_SET_CONNECT_SEL, | ||
| 14203 | spec->input_mux->items[0].index); | ||
| 14204 | |||
| 14205 | err = alc_auto_add_mic_boost(codec); | ||
| 14206 | if (err < 0) | ||
| 14207 | return err; | ||
| 14208 | |||
| 14209 | if (!spec->cap_mixer && !spec->no_analog) | ||
| 14210 | set_capture_mixer(codec); | ||
| 14211 | |||
| 14212 | return 1; | ||
| 14213 | } | ||
| 14214 | |||
| 14215 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out | ||
| 14216 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | ||
| 14217 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | ||
| 14218 | |||
| 14219 | |||
| 14220 | /* init callback for auto-configuration model -- overriding the default init */ | ||
| 14221 | static void alc269_auto_init(struct hda_codec *codec) | ||
| 14222 | { | ||
| 14223 | struct alc_spec *spec = codec->spec; | ||
| 14224 | alc269_auto_init_multi_out(codec); | ||
| 14225 | alc269_auto_init_hp_out(codec); | ||
| 14226 | alc269_auto_init_analog_input(codec); | ||
| 14227 | if (spec->unsol_event) | ||
| 14228 | alc_inithook(codec); | ||
| 14229 | } | ||
| 14230 | |||
| 14231 | enum { | ||
| 14232 | ALC269_FIXUP_SONY_VAIO, | ||
| 14233 | ALC269_FIXUP_DELL_M101Z, | ||
| 14234 | }; | ||
| 14235 | |||
| 14236 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { | ||
| 14237 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, | ||
| 14238 | {} | ||
| 14239 | }; | ||
| 14240 | |||
| 14241 | static const struct alc_fixup alc269_fixups[] = { | ||
| 14242 | [ALC269_FIXUP_SONY_VAIO] = { | ||
| 14243 | .verbs = alc269_sony_vaio_fixup_verbs | ||
| 14244 | }, | ||
| 14245 | [ALC269_FIXUP_DELL_M101Z] = { | ||
| 14246 | .verbs = (const struct hda_verb[]) { | ||
| 14247 | /* Enables internal speaker */ | ||
| 14248 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | ||
| 14249 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | ||
| 14250 | {} | ||
| 14251 | } | ||
| 14252 | }, | ||
| 14253 | }; | ||
| 14254 | |||
| 14255 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | ||
| 14256 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | ||
| 14257 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | ||
| 14258 | {} | ||
| 14259 | }; | ||
| 14260 | |||
| 14261 | |||
| 14262 | /* | ||
| 14263 | * configuration and preset | ||
| 14264 | */ | ||
| 14265 | static const char *alc269_models[ALC269_MODEL_LAST] = { | ||
| 14266 | [ALC269_BASIC] = "basic", | ||
| 14267 | [ALC269_QUANTA_FL1] = "quanta", | ||
| 14268 | [ALC269_AMIC] = "laptop-amic", | ||
| 14269 | [ALC269_DMIC] = "laptop-dmic", | ||
| 14270 | [ALC269_FUJITSU] = "fujitsu", | ||
| 14271 | [ALC269_LIFEBOOK] = "lifebook", | ||
| 14272 | [ALC269_AUTO] = "auto", | ||
| 14273 | }; | ||
| 14274 | |||
| 14275 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | ||
| 14276 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | ||
| 14277 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | ||
| 14278 | ALC269_AMIC), | ||
| 14279 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), | ||
| 14280 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), | ||
| 14281 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), | ||
| 14282 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), | ||
| 14283 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), | ||
| 14284 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), | ||
| 14285 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | ||
| 14286 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | ||
| 14287 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | ||
| 14288 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | ||
| 14289 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | ||
| 14290 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | ||
| 14291 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | ||
| 14292 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), | ||
| 14293 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), | ||
| 14294 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), | ||
| 14295 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), | ||
| 14296 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), | ||
| 14297 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), | ||
| 14298 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), | ||
| 14299 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), | ||
| 14300 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), | ||
| 14301 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), | ||
| 14302 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), | ||
| 14303 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), | ||
| 14304 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), | ||
| 14305 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), | ||
| 14306 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), | ||
| 14307 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), | ||
| 14308 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), | ||
| 14309 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), | ||
| 14310 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), | ||
| 14311 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), | ||
| 14312 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), | ||
| 14313 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), | ||
| 14314 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC), | ||
| 14315 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | ||
| 14316 | ALC269_DMIC), | ||
| 14317 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | ||
| 14318 | ALC269_DMIC), | ||
| 14319 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), | ||
| 14320 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), | ||
| 14321 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO), | ||
| 14322 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | ||
| 14323 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), | ||
| 14324 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | ||
| 14325 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), | ||
| 14326 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), | ||
| 14327 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), | ||
| 14328 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC), | ||
| 14329 | {} | ||
| 14330 | }; | ||
| 14331 | |||
| 14332 | static struct alc_config_preset alc269_presets[] = { | ||
| 14333 | [ALC269_BASIC] = { | ||
| 14334 | .mixers = { alc269_base_mixer }, | ||
| 14335 | .init_verbs = { alc269_init_verbs }, | ||
| 14336 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14337 | .dac_nids = alc269_dac_nids, | ||
| 14338 | .hp_nid = 0x03, | ||
| 14339 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14340 | .channel_mode = alc269_modes, | ||
| 14341 | .input_mux = &alc269_capture_source, | ||
| 14342 | }, | ||
| 14343 | [ALC269_QUANTA_FL1] = { | ||
| 14344 | .mixers = { alc269_quanta_fl1_mixer }, | ||
| 14345 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | ||
| 14346 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14347 | .dac_nids = alc269_dac_nids, | ||
| 14348 | .hp_nid = 0x03, | ||
| 14349 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14350 | .channel_mode = alc269_modes, | ||
| 14351 | .input_mux = &alc269_capture_source, | ||
| 14352 | .unsol_event = alc269_quanta_fl1_unsol_event, | ||
| 14353 | .setup = alc269_quanta_fl1_setup, | ||
| 14354 | .init_hook = alc269_quanta_fl1_init_hook, | ||
| 14355 | }, | ||
| 14356 | [ALC269_AMIC] = { | ||
| 14357 | .mixers = { alc269_laptop_mixer }, | ||
| 14358 | .cap_mixer = alc269_laptop_analog_capture_mixer, | ||
| 14359 | .init_verbs = { alc269_init_verbs, | ||
| 14360 | alc269_laptop_amic_init_verbs }, | ||
| 14361 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14362 | .dac_nids = alc269_dac_nids, | ||
| 14363 | .hp_nid = 0x03, | ||
| 14364 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14365 | .channel_mode = alc269_modes, | ||
| 14366 | .unsol_event = alc269_laptop_unsol_event, | ||
| 14367 | .setup = alc269_laptop_amic_setup, | ||
| 14368 | .init_hook = alc269_laptop_inithook, | ||
| 14369 | }, | ||
| 14370 | [ALC269_DMIC] = { | ||
| 14371 | .mixers = { alc269_laptop_mixer }, | ||
| 14372 | .cap_mixer = alc269_laptop_digital_capture_mixer, | ||
| 14373 | .init_verbs = { alc269_init_verbs, | ||
| 14374 | alc269_laptop_dmic_init_verbs }, | ||
| 14375 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14376 | .dac_nids = alc269_dac_nids, | ||
| 14377 | .hp_nid = 0x03, | ||
| 14378 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14379 | .channel_mode = alc269_modes, | ||
| 14380 | .unsol_event = alc269_laptop_unsol_event, | ||
| 14381 | .setup = alc269_laptop_dmic_setup, | ||
| 14382 | .init_hook = alc269_laptop_inithook, | ||
| 14383 | }, | ||
| 14384 | [ALC269VB_AMIC] = { | ||
| 14385 | .mixers = { alc269vb_laptop_mixer }, | ||
| 14386 | .cap_mixer = alc269vb_laptop_analog_capture_mixer, | ||
| 14387 | .init_verbs = { alc269vb_init_verbs, | ||
| 14388 | alc269vb_laptop_amic_init_verbs }, | ||
| 14389 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14390 | .dac_nids = alc269_dac_nids, | ||
| 14391 | .hp_nid = 0x03, | ||
| 14392 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14393 | .channel_mode = alc269_modes, | ||
| 14394 | .unsol_event = alc269_laptop_unsol_event, | ||
| 14395 | .setup = alc269vb_laptop_amic_setup, | ||
| 14396 | .init_hook = alc269_laptop_inithook, | ||
| 14397 | }, | ||
| 14398 | [ALC269VB_DMIC] = { | ||
| 14399 | .mixers = { alc269vb_laptop_mixer }, | ||
| 14400 | .cap_mixer = alc269vb_laptop_digital_capture_mixer, | ||
| 14401 | .init_verbs = { alc269vb_init_verbs, | ||
| 14402 | alc269vb_laptop_dmic_init_verbs }, | ||
| 14403 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14404 | .dac_nids = alc269_dac_nids, | ||
| 14405 | .hp_nid = 0x03, | ||
| 14406 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14407 | .channel_mode = alc269_modes, | ||
| 14408 | .unsol_event = alc269_laptop_unsol_event, | ||
| 14409 | .setup = alc269vb_laptop_dmic_setup, | ||
| 14410 | .init_hook = alc269_laptop_inithook, | ||
| 14411 | }, | ||
| 14412 | [ALC269_FUJITSU] = { | ||
| 14413 | .mixers = { alc269_fujitsu_mixer }, | ||
| 14414 | .cap_mixer = alc269_laptop_digital_capture_mixer, | ||
| 14415 | .init_verbs = { alc269_init_verbs, | ||
| 14416 | alc269_laptop_dmic_init_verbs }, | ||
| 14417 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14418 | .dac_nids = alc269_dac_nids, | ||
| 14419 | .hp_nid = 0x03, | ||
| 14420 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14421 | .channel_mode = alc269_modes, | ||
| 14422 | .unsol_event = alc269_laptop_unsol_event, | ||
| 14423 | .setup = alc269_laptop_dmic_setup, | ||
| 14424 | .init_hook = alc269_laptop_inithook, | ||
| 14425 | }, | ||
| 14426 | [ALC269_LIFEBOOK] = { | ||
| 14427 | .mixers = { alc269_lifebook_mixer }, | ||
| 14428 | .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs }, | ||
| 14429 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
| 14430 | .dac_nids = alc269_dac_nids, | ||
| 14431 | .hp_nid = 0x03, | ||
| 14432 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
| 14433 | .channel_mode = alc269_modes, | ||
| 14434 | .input_mux = &alc269_capture_source, | ||
| 14435 | .unsol_event = alc269_lifebook_unsol_event, | ||
| 14436 | .init_hook = alc269_lifebook_init_hook, | ||
| 14437 | }, | ||
| 14438 | }; | ||
| 14439 | |||
| 14440 | static int patch_alc269(struct hda_codec *codec) | ||
| 14441 | { | ||
| 14442 | struct alc_spec *spec; | ||
| 14443 | int board_config; | ||
| 14444 | int err; | ||
| 14445 | int is_alc269vb = 0; | ||
| 14446 | |||
| 14447 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 14448 | if (spec == NULL) | ||
| 14449 | return -ENOMEM; | ||
| 14450 | |||
| 14451 | codec->spec = spec; | ||
| 14452 | |||
| 14453 | alc_auto_parse_customize_define(codec); | ||
| 14454 | |||
| 14455 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | ||
| 14456 | if (codec->bus->pci->subsystem_vendor == 0x1025 && | ||
| 14457 | spec->cdefine.platform_type == 1) | ||
| 14458 | alc_codec_rename(codec, "ALC271X"); | ||
| 14459 | else | ||
| 14460 | alc_codec_rename(codec, "ALC259"); | ||
| 14461 | is_alc269vb = 1; | ||
| 14462 | } else | ||
| 14463 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | ||
| 14464 | |||
| 14465 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | ||
| 14466 | alc269_models, | ||
| 14467 | alc269_cfg_tbl); | ||
| 14468 | |||
| 14469 | if (board_config < 0) { | ||
| 14470 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 14471 | codec->chip_name); | ||
| 14472 | board_config = ALC269_AUTO; | ||
| 14473 | } | ||
| 14474 | |||
| 14475 | if (board_config == ALC269_AUTO) | ||
| 14476 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); | ||
| 14477 | |||
| 14478 | if (board_config == ALC269_AUTO) { | ||
| 14479 | /* automatic parse from the BIOS config */ | ||
| 14480 | err = alc269_parse_auto_config(codec); | ||
| 14481 | if (err < 0) { | ||
| 14482 | alc_free(codec); | ||
| 14483 | return err; | ||
| 14484 | } else if (!err) { | ||
| 14485 | printk(KERN_INFO | ||
| 14486 | "hda_codec: Cannot set up configuration " | ||
| 14487 | "from BIOS. Using base mode...\n"); | ||
| 14488 | board_config = ALC269_BASIC; | ||
| 14489 | } | ||
| 14490 | } | ||
| 14491 | |||
| 14492 | if (has_cdefine_beep(codec)) { | ||
| 14493 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 14494 | if (err < 0) { | ||
| 14495 | alc_free(codec); | ||
| 14496 | return err; | ||
| 14497 | } | ||
| 14498 | } | ||
| 14499 | |||
| 14500 | if (board_config != ALC269_AUTO) | ||
| 14501 | setup_preset(codec, &alc269_presets[board_config]); | ||
| 14502 | |||
| 14503 | if (board_config == ALC269_QUANTA_FL1) { | ||
| 14504 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | ||
| 14505 | * fix the sample rate of analog I/O to 44.1kHz | ||
| 14506 | */ | ||
| 14507 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | ||
| 14508 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | ||
| 14509 | } else { | ||
| 14510 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | ||
| 14511 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | ||
| 14512 | } | ||
| 14513 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | ||
| 14514 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | ||
| 14515 | |||
| 14516 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ | ||
| 14517 | if (!is_alc269vb) { | ||
| 14518 | spec->adc_nids = alc269_adc_nids; | ||
| 14519 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | ||
| 14520 | spec->capsrc_nids = alc269_capsrc_nids; | ||
| 14521 | } else { | ||
| 14522 | spec->adc_nids = alc269vb_adc_nids; | ||
| 14523 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | ||
| 14524 | spec->capsrc_nids = alc269vb_capsrc_nids; | ||
| 14525 | } | ||
| 14526 | } | ||
| 14527 | |||
| 14528 | if (!spec->cap_mixer) | ||
| 14529 | set_capture_mixer(codec); | ||
| 14530 | if (has_cdefine_beep(codec)) | ||
| 14531 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | ||
| 14532 | |||
| 14533 | if (board_config == ALC269_AUTO) | ||
| 14534 | alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0); | ||
| 14535 | |||
| 14536 | spec->vmaster_nid = 0x02; | ||
| 14537 | |||
| 14538 | codec->patch_ops = alc_patch_ops; | ||
| 14539 | if (board_config == ALC269_AUTO) | ||
| 14540 | spec->init_hook = alc269_auto_init; | ||
| 14541 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 14542 | if (!spec->loopback.amplist) | ||
| 14543 | spec->loopback.amplist = alc269_loopbacks; | ||
| 14544 | if (alc269_mic2_for_mute_led(codec)) | ||
| 14545 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | ||
| 14546 | #endif | ||
| 14547 | |||
| 14548 | return 0; | ||
| 14549 | } | ||
| 14550 | |||
| 14551 | /* | ||
| 14552 | * ALC861 channel source setting (2/6 channel selection for 3-stack) | ||
| 14553 | */ | ||
| 14554 | |||
| 14555 | /* | ||
| 14556 | * set the path ways for 2 channel output | ||
| 14557 | * need to set the codec line out and mic 1 pin widgets to inputs | ||
| 14558 | */ | ||
| 14559 | static struct hda_verb alc861_threestack_ch2_init[] = { | ||
| 14560 | /* set pin widget 1Ah (line in) for input */ | ||
| 14561 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14562 | /* set pin widget 18h (mic1/2) for input, for mic also enable | ||
| 14563 | * the vref | ||
| 14564 | */ | ||
| 14565 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14566 | |||
| 14567 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | ||
| 14568 | #if 0 | ||
| 14569 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
| 14570 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | ||
| 14571 | #endif | ||
| 14572 | { } /* end */ | ||
| 14573 | }; | ||
| 14574 | /* | ||
| 14575 | * 6ch mode | ||
| 14576 | * need to set the codec line out and mic 1 pin widgets to outputs | ||
| 14577 | */ | ||
| 14578 | static struct hda_verb alc861_threestack_ch6_init[] = { | ||
| 14579 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | ||
| 14580 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14581 | /* set pin widget 18h (mic1) for output (CLFE)*/ | ||
| 14582 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14583 | |||
| 14584 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14585 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14586 | |||
| 14587 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | ||
| 14588 | #if 0 | ||
| 14589 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
| 14590 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | ||
| 14591 | #endif | ||
| 14592 | { } /* end */ | ||
| 14593 | }; | ||
| 14594 | |||
| 14595 | static struct hda_channel_mode alc861_threestack_modes[2] = { | ||
| 14596 | { 2, alc861_threestack_ch2_init }, | ||
| 14597 | { 6, alc861_threestack_ch6_init }, | ||
| 14598 | }; | ||
| 14599 | /* Set mic1 as input and unmute the mixer */ | ||
| 14600 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { | ||
| 14601 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14602 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
| 14603 | { } /* end */ | ||
| 14604 | }; | ||
| 14605 | /* Set mic1 as output and mute mixer */ | ||
| 14606 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { | ||
| 14607 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14608 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
| 14609 | { } /* end */ | ||
| 14610 | }; | ||
| 14611 | |||
| 14612 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { | ||
| 14613 | { 2, alc861_uniwill_m31_ch2_init }, | ||
| 14614 | { 4, alc861_uniwill_m31_ch4_init }, | ||
| 14615 | }; | ||
| 14616 | |||
| 14617 | /* Set mic1 and line-in as input and unmute the mixer */ | ||
| 14618 | static struct hda_verb alc861_asus_ch2_init[] = { | ||
| 14619 | /* set pin widget 1Ah (line in) for input */ | ||
| 14620 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14621 | /* set pin widget 18h (mic1/2) for input, for mic also enable | ||
| 14622 | * the vref | ||
| 14623 | */ | ||
| 14624 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14625 | |||
| 14626 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, | ||
| 14627 | #if 0 | ||
| 14628 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ | ||
| 14629 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ | ||
| 14630 | #endif | ||
| 14631 | { } /* end */ | ||
| 14632 | }; | ||
| 14633 | /* Set mic1 nad line-in as output and mute mixer */ | ||
| 14634 | static struct hda_verb alc861_asus_ch6_init[] = { | ||
| 14635 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ | ||
| 14636 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14637 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | ||
| 14638 | /* set pin widget 18h (mic1) for output (CLFE)*/ | ||
| 14639 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14640 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ | ||
| 14641 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14642 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14643 | |||
| 14644 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, | ||
| 14645 | #if 0 | ||
| 14646 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ | ||
| 14647 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ | ||
| 14648 | #endif | ||
| 14649 | { } /* end */ | ||
| 14650 | }; | ||
| 14651 | |||
| 14652 | static struct hda_channel_mode alc861_asus_modes[2] = { | ||
| 14653 | { 2, alc861_asus_ch2_init }, | ||
| 14654 | { 6, alc861_asus_ch6_init }, | ||
| 14655 | }; | ||
| 14656 | |||
| 14657 | /* patch-ALC861 */ | ||
| 14658 | |||
| 14659 | static struct snd_kcontrol_new alc861_base_mixer[] = { | ||
| 14660 | /* output mixer control */ | ||
| 14661 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
| 14662 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
| 14663 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
| 14664 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
| 14665 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | ||
| 14666 | |||
| 14667 | /*Input mixer control */ | ||
| 14668 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
| 14669 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
| 14670 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
| 14671 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
| 14672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
| 14673 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
| 14674 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
| 14675 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
| 14676 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
| 14677 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
| 14678 | |||
| 14679 | { } /* end */ | ||
| 14680 | }; | ||
| 14681 | |||
| 14682 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { | ||
| 14683 | /* output mixer control */ | ||
| 14684 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
| 14685 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
| 14686 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
| 14687 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
| 14688 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | ||
| 14689 | |||
| 14690 | /* Input mixer control */ | ||
| 14691 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
| 14692 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
| 14693 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
| 14694 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
| 14695 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
| 14696 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
| 14697 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
| 14698 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
| 14699 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
| 14700 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
| 14701 | |||
| 14702 | { | ||
| 14703 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 14704 | .name = "Channel Mode", | ||
| 14705 | .info = alc_ch_mode_info, | ||
| 14706 | .get = alc_ch_mode_get, | ||
| 14707 | .put = alc_ch_mode_put, | ||
| 14708 | .private_value = ARRAY_SIZE(alc861_threestack_modes), | ||
| 14709 | }, | ||
| 14710 | { } /* end */ | ||
| 14711 | }; | ||
| 14712 | |||
| 14713 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | ||
| 14714 | /* output mixer control */ | ||
| 14715 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
| 14716 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
| 14717 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
| 14718 | |||
| 14719 | { } /* end */ | ||
| 14720 | }; | ||
| 14721 | |||
| 14722 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { | ||
| 14723 | /* output mixer control */ | ||
| 14724 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
| 14725 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
| 14726 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
| 14727 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
| 14728 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ | ||
| 14729 | |||
| 14730 | /* Input mixer control */ | ||
| 14731 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
| 14732 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ | ||
| 14733 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
| 14734 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
| 14735 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
| 14736 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
| 14737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
| 14738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
| 14739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
| 14740 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), | ||
| 14741 | |||
| 14742 | { | ||
| 14743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 14744 | .name = "Channel Mode", | ||
| 14745 | .info = alc_ch_mode_info, | ||
| 14746 | .get = alc_ch_mode_get, | ||
| 14747 | .put = alc_ch_mode_put, | ||
| 14748 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), | ||
| 14749 | }, | ||
| 14750 | { } /* end */ | ||
| 14751 | }; | ||
| 14752 | |||
| 14753 | static struct snd_kcontrol_new alc861_asus_mixer[] = { | ||
| 14754 | /* output mixer control */ | ||
| 14755 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), | ||
| 14756 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), | ||
| 14757 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), | ||
| 14758 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), | ||
| 14759 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), | ||
| 14760 | |||
| 14761 | /* Input mixer control */ | ||
| 14762 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), | ||
| 14763 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 14764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
| 14765 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
| 14766 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), | ||
| 14767 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), | ||
| 14768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | ||
| 14769 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | ||
| 14770 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), | ||
| 14771 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), | ||
| 14772 | |||
| 14773 | { | ||
| 14774 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 14775 | .name = "Channel Mode", | ||
| 14776 | .info = alc_ch_mode_info, | ||
| 14777 | .get = alc_ch_mode_get, | ||
| 14778 | .put = alc_ch_mode_put, | ||
| 14779 | .private_value = ARRAY_SIZE(alc861_asus_modes), | ||
| 14780 | }, | ||
| 14781 | { } | ||
| 14782 | }; | ||
| 14783 | |||
| 14784 | /* additional mixer */ | ||
| 14785 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | ||
| 14786 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | ||
| 14787 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | ||
| 14788 | { } | ||
| 14789 | }; | ||
| 14790 | |||
| 14791 | /* | ||
| 14792 | * generic initialization of ADC, input mixers and output mixers | ||
| 14793 | */ | ||
| 14794 | static struct hda_verb alc861_base_init_verbs[] = { | ||
| 14795 | /* | ||
| 14796 | * Unmute ADC0 and set the default input to mic-in | ||
| 14797 | */ | ||
| 14798 | /* port-A for surround (rear panel) */ | ||
| 14799 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14800 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14801 | /* port-B for mic-in (rear panel) with vref */ | ||
| 14802 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14803 | /* port-C for line-in (rear panel) */ | ||
| 14804 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14805 | /* port-D for Front */ | ||
| 14806 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14807 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14808 | /* port-E for HP out (front panel) */ | ||
| 14809 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | ||
| 14810 | /* route front PCM to HP */ | ||
| 14811 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14812 | /* port-F for mic-in (front panel) with vref */ | ||
| 14813 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14814 | /* port-G for CLFE (rear panel) */ | ||
| 14815 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14816 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14817 | /* port-H for side (rear panel) */ | ||
| 14818 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14819 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14820 | /* CD-in */ | ||
| 14821 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14822 | /* route front mic to ADC1*/ | ||
| 14823 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 14824 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14825 | |||
| 14826 | /* Unmute DAC0~3 & spdif out*/ | ||
| 14827 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14828 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14829 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14830 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14831 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14832 | |||
| 14833 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
| 14834 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14835 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14836 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14837 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14838 | |||
| 14839 | /* Unmute Stereo Mixer 15 */ | ||
| 14840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14841 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14842 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14843 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
| 14844 | |||
| 14845 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14846 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14847 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14848 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14849 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14850 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14851 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14852 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14853 | /* hp used DAC 3 (Front) */ | ||
| 14854 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
| 14855 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14856 | |||
| 14857 | { } | ||
| 14858 | }; | ||
| 14859 | |||
| 14860 | static struct hda_verb alc861_threestack_init_verbs[] = { | ||
| 14861 | /* | ||
| 14862 | * Unmute ADC0 and set the default input to mic-in | ||
| 14863 | */ | ||
| 14864 | /* port-A for surround (rear panel) */ | ||
| 14865 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14866 | /* port-B for mic-in (rear panel) with vref */ | ||
| 14867 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14868 | /* port-C for line-in (rear panel) */ | ||
| 14869 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14870 | /* port-D for Front */ | ||
| 14871 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14872 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14873 | /* port-E for HP out (front panel) */ | ||
| 14874 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, | ||
| 14875 | /* route front PCM to HP */ | ||
| 14876 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14877 | /* port-F for mic-in (front panel) with vref */ | ||
| 14878 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14879 | /* port-G for CLFE (rear panel) */ | ||
| 14880 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14881 | /* port-H for side (rear panel) */ | ||
| 14882 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14883 | /* CD-in */ | ||
| 14884 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14885 | /* route front mic to ADC1*/ | ||
| 14886 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 14887 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14888 | /* Unmute DAC0~3 & spdif out*/ | ||
| 14889 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14890 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14891 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14892 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14893 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14894 | |||
| 14895 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
| 14896 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14897 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14898 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14899 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14900 | |||
| 14901 | /* Unmute Stereo Mixer 15 */ | ||
| 14902 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14903 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14904 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14905 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
| 14906 | |||
| 14907 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14908 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14909 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14910 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14911 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14912 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14913 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14914 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14915 | /* hp used DAC 3 (Front) */ | ||
| 14916 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
| 14917 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14918 | { } | ||
| 14919 | }; | ||
| 14920 | |||
| 14921 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | ||
| 14922 | /* | ||
| 14923 | * Unmute ADC0 and set the default input to mic-in | ||
| 14924 | */ | ||
| 14925 | /* port-A for surround (rear panel) */ | ||
| 14926 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14927 | /* port-B for mic-in (rear panel) with vref */ | ||
| 14928 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14929 | /* port-C for line-in (rear panel) */ | ||
| 14930 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14931 | /* port-D for Front */ | ||
| 14932 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14933 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14934 | /* port-E for HP out (front panel) */ | ||
| 14935 | /* this has to be set to VREF80 */ | ||
| 14936 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14937 | /* route front PCM to HP */ | ||
| 14938 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 14939 | /* port-F for mic-in (front panel) with vref */ | ||
| 14940 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14941 | /* port-G for CLFE (rear panel) */ | ||
| 14942 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14943 | /* port-H for side (rear panel) */ | ||
| 14944 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 14945 | /* CD-in */ | ||
| 14946 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14947 | /* route front mic to ADC1*/ | ||
| 14948 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 14949 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14950 | /* Unmute DAC0~3 & spdif out*/ | ||
| 14951 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14952 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14953 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14954 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14955 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 14956 | |||
| 14957 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
| 14958 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14959 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14960 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14961 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14962 | |||
| 14963 | /* Unmute Stereo Mixer 15 */ | ||
| 14964 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14965 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14967 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
| 14968 | |||
| 14969 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14970 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14971 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14972 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14973 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14974 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14975 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 14976 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 14977 | /* hp used DAC 3 (Front) */ | ||
| 14978 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
| 14979 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 14980 | { } | ||
| 14981 | }; | ||
| 14982 | |||
| 14983 | static struct hda_verb alc861_asus_init_verbs[] = { | ||
| 14984 | /* | ||
| 14985 | * Unmute ADC0 and set the default input to mic-in | ||
| 14986 | */ | ||
| 14987 | /* port-A for surround (rear panel) | ||
| 14988 | * according to codec#0 this is the HP jack | ||
| 14989 | */ | ||
| 14990 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ | ||
| 14991 | /* route front PCM to HP */ | ||
| 14992 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 14993 | /* port-B for mic-in (rear panel) with vref */ | ||
| 14994 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 14995 | /* port-C for line-in (rear panel) */ | ||
| 14996 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 14997 | /* port-D for Front */ | ||
| 14998 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 14999 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 15000 | /* port-E for HP out (front panel) */ | ||
| 15001 | /* this has to be set to VREF80 */ | ||
| 15002 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 15003 | /* route front PCM to HP */ | ||
| 15004 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, | ||
| 15005 | /* port-F for mic-in (front panel) with vref */ | ||
| 15006 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, | ||
| 15007 | /* port-G for CLFE (rear panel) */ | ||
| 15008 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 15009 | /* port-H for side (rear panel) */ | ||
| 15010 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, | ||
| 15011 | /* CD-in */ | ||
| 15012 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, | ||
| 15013 | /* route front mic to ADC1*/ | ||
| 15014 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 15015 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15016 | /* Unmute DAC0~3 & spdif out*/ | ||
| 15017 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15018 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15019 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15020 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15021 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15022 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
| 15023 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15024 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15025 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15026 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15027 | |||
| 15028 | /* Unmute Stereo Mixer 15 */ | ||
| 15029 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15030 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15031 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 15032 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ | ||
| 15033 | |||
| 15034 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15035 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15036 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15037 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15039 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15040 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15041 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15042 | /* hp used DAC 3 (Front) */ | ||
| 15043 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, | ||
| 15044 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 15045 | { } | ||
| 15046 | }; | ||
| 15047 | |||
| 15048 | /* additional init verbs for ASUS laptops */ | ||
| 15049 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { | ||
| 15050 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ | ||
| 15051 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ | ||
| 15052 | { } | ||
| 15053 | }; | ||
| 15054 | |||
| 15055 | /* | ||
| 15056 | * generic initialization of ADC, input mixers and output mixers | ||
| 15057 | */ | ||
| 15058 | static struct hda_verb alc861_auto_init_verbs[] = { | ||
| 15059 | /* | ||
| 15060 | * Unmute ADC0 and set the default input to mic-in | ||
| 15061 | */ | ||
| 15062 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | ||
| 15063 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15064 | |||
| 15065 | /* Unmute DAC0~3 & spdif out*/ | ||
| 15066 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15067 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15068 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15069 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15070 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15071 | |||
| 15072 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | ||
| 15073 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15074 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15075 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15076 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15077 | |||
| 15078 | /* Unmute Stereo Mixer 15 */ | ||
| 15079 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15080 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15081 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 15082 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, | ||
| 15083 | |||
| 15084 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15085 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15086 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15087 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15088 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15089 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15090 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15091 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15092 | |||
| 15093 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15094 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15095 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 15096 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 15097 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15098 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15099 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 15100 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 15101 | |||
| 15102 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ | ||
| 15103 | |||
| 15104 | { } | ||
| 15105 | }; | ||
| 15106 | |||
| 15107 | static struct hda_verb alc861_toshiba_init_verbs[] = { | ||
| 15108 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 15109 | |||
| 15110 | { } | ||
| 15111 | }; | ||
| 15112 | |||
| 15113 | /* toggle speaker-output according to the hp-jack state */ | ||
| 15114 | static void alc861_toshiba_automute(struct hda_codec *codec) | ||
| 15115 | { | ||
| 15116 | unsigned int present = snd_hda_jack_detect(codec, 0x0f); | ||
| 15117 | |||
| 15118 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, | ||
| 15119 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | ||
| 15120 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, | ||
| 15121 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); | ||
| 15122 | } | ||
| 15123 | |||
| 15124 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, | ||
| 15125 | unsigned int res) | ||
| 15126 | { | ||
| 15127 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 15128 | alc861_toshiba_automute(codec); | ||
| 15129 | } | ||
| 15130 | |||
| 15131 | /* pcm configuration: identical with ALC880 */ | ||
| 15132 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback | ||
| 15133 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture | ||
| 15134 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback | ||
| 15135 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture | ||
| 15136 | |||
| 15137 | |||
| 15138 | #define ALC861_DIGOUT_NID 0x07 | ||
| 15139 | |||
| 15140 | static struct hda_channel_mode alc861_8ch_modes[1] = { | ||
| 15141 | { 8, NULL } | ||
| 15142 | }; | ||
| 15143 | |||
| 15144 | static hda_nid_t alc861_dac_nids[4] = { | ||
| 15145 | /* front, surround, clfe, side */ | ||
| 15146 | 0x03, 0x06, 0x05, 0x04 | ||
| 15147 | }; | ||
| 15148 | |||
| 15149 | static hda_nid_t alc660_dac_nids[3] = { | ||
| 15150 | /* front, clfe, surround */ | ||
| 15151 | 0x03, 0x05, 0x06 | ||
| 15152 | }; | ||
| 15153 | |||
| 15154 | static hda_nid_t alc861_adc_nids[1] = { | ||
| 15155 | /* ADC0-2 */ | ||
| 15156 | 0x08, | ||
| 15157 | }; | ||
| 15158 | |||
| 15159 | static struct hda_input_mux alc861_capture_source = { | ||
| 15160 | .num_items = 5, | ||
| 15161 | .items = { | ||
| 15162 | { "Mic", 0x0 }, | ||
| 15163 | { "Front Mic", 0x3 }, | ||
| 15164 | { "Line", 0x1 }, | ||
| 15165 | { "CD", 0x4 }, | ||
| 15166 | { "Mixer", 0x5 }, | ||
| 15167 | }, | ||
| 15168 | }; | ||
| 15169 | |||
| 15170 | static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | ||
| 15171 | { | ||
| 15172 | struct alc_spec *spec = codec->spec; | ||
| 15173 | hda_nid_t mix, srcs[5]; | ||
| 15174 | int i, j, num; | ||
| 15175 | |||
| 15176 | if (snd_hda_get_connections(codec, pin, &mix, 1) != 1) | ||
| 15177 | return 0; | ||
| 15178 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
| 15179 | if (num < 0) | ||
| 15180 | return 0; | ||
| 15181 | for (i = 0; i < num; i++) { | ||
| 15182 | unsigned int type; | ||
| 15183 | type = get_wcaps_type(get_wcaps(codec, srcs[i])); | ||
| 15184 | if (type != AC_WID_AUD_OUT) | ||
| 15185 | continue; | ||
| 15186 | for (j = 0; j < spec->multiout.num_dacs; j++) | ||
| 15187 | if (spec->multiout.dac_nids[j] == srcs[i]) | ||
| 15188 | break; | ||
| 15189 | if (j >= spec->multiout.num_dacs) | ||
| 15190 | return srcs[i]; | ||
| 15191 | } | ||
| 15192 | return 0; | ||
| 15193 | } | ||
| 15194 | |||
| 15195 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
| 15196 | static int alc861_auto_fill_dac_nids(struct hda_codec *codec, | ||
| 15197 | const struct auto_pin_cfg *cfg) | ||
| 15198 | { | ||
| 15199 | struct alc_spec *spec = codec->spec; | ||
| 15200 | int i; | ||
| 15201 | hda_nid_t nid, dac; | ||
| 15202 | |||
| 15203 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 15204 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 15205 | nid = cfg->line_out_pins[i]; | ||
| 15206 | dac = alc861_look_for_dac(codec, nid); | ||
| 15207 | if (!dac) | ||
| 15208 | continue; | ||
| 15209 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | ||
| 15210 | } | ||
| 15211 | return 0; | ||
| 15212 | } | ||
| 15213 | |||
| 15214 | static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx, | ||
| 15215 | hda_nid_t nid, unsigned int chs) | ||
| 15216 | { | ||
| 15217 | return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx, | ||
| 15218 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | ||
| 15219 | } | ||
| 15220 | |||
| 15221 | /* add playback controls from the parsed DAC table */ | ||
| 15222 | static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec, | ||
| 15223 | const struct auto_pin_cfg *cfg) | ||
| 15224 | { | ||
| 15225 | struct alc_spec *spec = codec->spec; | ||
| 15226 | static const char *chname[4] = { | ||
| 15227 | "Front", "Surround", NULL /*CLFE*/, "Side" | ||
| 15228 | }; | ||
| 15229 | hda_nid_t nid; | ||
| 15230 | int i, err; | ||
| 15231 | |||
| 15232 | if (cfg->line_outs == 1) { | ||
| 15233 | const char *pfx = NULL; | ||
| 15234 | if (!cfg->hp_outs) | ||
| 15235 | pfx = "Master"; | ||
| 15236 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 15237 | pfx = "Speaker"; | ||
| 15238 | if (pfx) { | ||
| 15239 | nid = spec->multiout.dac_nids[0]; | ||
| 15240 | return alc861_create_out_sw(codec, pfx, nid, 3); | ||
| 15241 | } | ||
| 15242 | } | ||
| 15243 | |||
| 15244 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 15245 | nid = spec->multiout.dac_nids[i]; | ||
| 15246 | if (!nid) | ||
| 15247 | continue; | ||
| 15248 | if (i == 2) { | ||
| 15249 | /* Center/LFE */ | ||
| 15250 | err = alc861_create_out_sw(codec, "Center", nid, 1); | ||
| 15251 | if (err < 0) | ||
| 15252 | return err; | ||
| 15253 | err = alc861_create_out_sw(codec, "LFE", nid, 2); | ||
| 15254 | if (err < 0) | ||
| 15255 | return err; | ||
| 15256 | } else { | ||
| 15257 | err = alc861_create_out_sw(codec, chname[i], nid, 3); | ||
| 15258 | if (err < 0) | ||
| 15259 | return err; | ||
| 15260 | } | ||
| 15261 | } | ||
| 15262 | return 0; | ||
| 15263 | } | ||
| 15264 | |||
| 15265 | static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin) | ||
| 15266 | { | ||
| 15267 | struct alc_spec *spec = codec->spec; | ||
| 15268 | int err; | ||
| 15269 | hda_nid_t nid; | ||
| 15270 | |||
| 15271 | if (!pin) | ||
| 15272 | return 0; | ||
| 15273 | |||
| 15274 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { | ||
| 15275 | nid = alc861_look_for_dac(codec, pin); | ||
| 15276 | if (nid) { | ||
| 15277 | err = alc861_create_out_sw(codec, "Headphone", nid, 3); | ||
| 15278 | if (err < 0) | ||
| 15279 | return err; | ||
| 15280 | spec->multiout.hp_nid = nid; | ||
| 15281 | } | ||
| 15282 | } | ||
| 15283 | return 0; | ||
| 15284 | } | ||
| 15285 | |||
| 15286 | /* create playback/capture controls for input pins */ | ||
| 15287 | static int alc861_auto_create_input_ctls(struct hda_codec *codec, | ||
| 15288 | const struct auto_pin_cfg *cfg) | ||
| 15289 | { | ||
| 15290 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0); | ||
| 15291 | } | ||
| 15292 | |||
| 15293 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 15294 | hda_nid_t nid, | ||
| 15295 | int pin_type, hda_nid_t dac) | ||
| 15296 | { | ||
| 15297 | hda_nid_t mix, srcs[5]; | ||
| 15298 | int i, num; | ||
| 15299 | |||
| 15300 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
| 15301 | pin_type); | ||
| 15302 | snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 15303 | AMP_OUT_UNMUTE); | ||
| 15304 | if (snd_hda_get_connections(codec, nid, &mix, 1) != 1) | ||
| 15305 | return; | ||
| 15306 | num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs)); | ||
| 15307 | if (num < 0) | ||
| 15308 | return; | ||
| 15309 | for (i = 0; i < num; i++) { | ||
| 15310 | unsigned int mute; | ||
| 15311 | if (srcs[i] == dac || srcs[i] == 0x15) | ||
| 15312 | mute = AMP_IN_UNMUTE(i); | ||
| 15313 | else | ||
| 15314 | mute = AMP_IN_MUTE(i); | ||
| 15315 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 15316 | mute); | ||
| 15317 | } | ||
| 15318 | } | ||
| 15319 | |||
| 15320 | static void alc861_auto_init_multi_out(struct hda_codec *codec) | ||
| 15321 | { | ||
| 15322 | struct alc_spec *spec = codec->spec; | ||
| 15323 | int i; | ||
| 15324 | |||
| 15325 | for (i = 0; i < spec->autocfg.line_outs; i++) { | ||
| 15326 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
| 15327 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 15328 | if (nid) | ||
| 15329 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, | ||
| 15330 | spec->multiout.dac_nids[i]); | ||
| 15331 | } | ||
| 15332 | } | ||
| 15333 | |||
| 15334 | static void alc861_auto_init_hp_out(struct hda_codec *codec) | ||
| 15335 | { | ||
| 15336 | struct alc_spec *spec = codec->spec; | ||
| 15337 | |||
| 15338 | if (spec->autocfg.hp_outs) | ||
| 15339 | alc861_auto_set_output_and_unmute(codec, | ||
| 15340 | spec->autocfg.hp_pins[0], | ||
| 15341 | PIN_HP, | ||
| 15342 | spec->multiout.hp_nid); | ||
| 15343 | if (spec->autocfg.speaker_outs) | ||
| 15344 | alc861_auto_set_output_and_unmute(codec, | ||
| 15345 | spec->autocfg.speaker_pins[0], | ||
| 15346 | PIN_OUT, | ||
| 15347 | spec->multiout.dac_nids[0]); | ||
| 15348 | } | ||
| 15349 | |||
| 15350 | static void alc861_auto_init_analog_input(struct hda_codec *codec) | ||
| 15351 | { | ||
| 15352 | struct alc_spec *spec = codec->spec; | ||
| 15353 | int i; | ||
| 15354 | |||
| 15355 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 15356 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 15357 | if (nid >= 0x0c && nid <= 0x11) | ||
| 15358 | alc_set_input_pin(codec, nid, i); | ||
| 15359 | } | ||
| 15360 | } | ||
| 15361 | |||
| 15362 | /* parse the BIOS configuration and set up the alc_spec */ | ||
| 15363 | /* return 1 if successful, 0 if the proper config is not found, | ||
| 15364 | * or a negative error code | ||
| 15365 | */ | ||
| 15366 | static int alc861_parse_auto_config(struct hda_codec *codec) | ||
| 15367 | { | ||
| 15368 | struct alc_spec *spec = codec->spec; | ||
| 15369 | int err; | ||
| 15370 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; | ||
| 15371 | |||
| 15372 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 15373 | alc861_ignore); | ||
| 15374 | if (err < 0) | ||
| 15375 | return err; | ||
| 15376 | if (!spec->autocfg.line_outs) | ||
| 15377 | return 0; /* can't find valid BIOS pin config */ | ||
| 15378 | |||
| 15379 | err = alc861_auto_fill_dac_nids(codec, &spec->autocfg); | ||
| 15380 | if (err < 0) | ||
| 15381 | return err; | ||
| 15382 | err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg); | ||
| 15383 | if (err < 0) | ||
| 15384 | return err; | ||
| 15385 | err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]); | ||
| 15386 | if (err < 0) | ||
| 15387 | return err; | ||
| 15388 | err = alc861_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 15389 | if (err < 0) | ||
| 15390 | return err; | ||
| 15391 | |||
| 15392 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 15393 | |||
| 15394 | if (spec->autocfg.dig_outs) | ||
| 15395 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | ||
| 15396 | |||
| 15397 | if (spec->kctls.list) | ||
| 15398 | add_mixer(spec, spec->kctls.list); | ||
| 15399 | |||
| 15400 | add_verb(spec, alc861_auto_init_verbs); | ||
| 15401 | |||
| 15402 | spec->num_mux_defs = 1; | ||
| 15403 | spec->input_mux = &spec->private_imux[0]; | ||
| 15404 | |||
| 15405 | spec->adc_nids = alc861_adc_nids; | ||
| 15406 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | ||
| 15407 | set_capture_mixer(codec); | ||
| 15408 | |||
| 15409 | alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0); | ||
| 15410 | |||
| 15411 | return 1; | ||
| 15412 | } | ||
| 15413 | |||
| 15414 | /* additional initialization for auto-configuration model */ | ||
| 15415 | static void alc861_auto_init(struct hda_codec *codec) | ||
| 15416 | { | ||
| 15417 | struct alc_spec *spec = codec->spec; | ||
| 15418 | alc861_auto_init_multi_out(codec); | ||
| 15419 | alc861_auto_init_hp_out(codec); | ||
| 15420 | alc861_auto_init_analog_input(codec); | ||
| 15421 | if (spec->unsol_event) | ||
| 15422 | alc_inithook(codec); | ||
| 15423 | } | ||
| 15424 | |||
| 15425 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 15426 | static struct hda_amp_list alc861_loopbacks[] = { | ||
| 15427 | { 0x15, HDA_INPUT, 0 }, | ||
| 15428 | { 0x15, HDA_INPUT, 1 }, | ||
| 15429 | { 0x15, HDA_INPUT, 2 }, | ||
| 15430 | { 0x15, HDA_INPUT, 3 }, | ||
| 15431 | { } /* end */ | ||
| 15432 | }; | ||
| 15433 | #endif | ||
| 15434 | |||
| 15435 | |||
| 15436 | /* | ||
| 15437 | * configuration and preset | ||
| 15438 | */ | ||
| 15439 | static const char *alc861_models[ALC861_MODEL_LAST] = { | ||
| 15440 | [ALC861_3ST] = "3stack", | ||
| 15441 | [ALC660_3ST] = "3stack-660", | ||
| 15442 | [ALC861_3ST_DIG] = "3stack-dig", | ||
| 15443 | [ALC861_6ST_DIG] = "6stack-dig", | ||
| 15444 | [ALC861_UNIWILL_M31] = "uniwill-m31", | ||
| 15445 | [ALC861_TOSHIBA] = "toshiba", | ||
| 15446 | [ALC861_ASUS] = "asus", | ||
| 15447 | [ALC861_ASUS_LAPTOP] = "asus-laptop", | ||
| 15448 | [ALC861_AUTO] = "auto", | ||
| 15449 | }; | ||
| 15450 | |||
| 15451 | static struct snd_pci_quirk alc861_cfg_tbl[] = { | ||
| 15452 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), | ||
| 15453 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), | ||
| 15454 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), | ||
| 15455 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), | ||
| 15456 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), | ||
| 15457 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), | ||
| 15458 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), | ||
| 15459 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) | ||
| 15460 | * Any other models that need this preset? | ||
| 15461 | */ | ||
| 15462 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ | ||
| 15463 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), | ||
| 15464 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), | ||
| 15465 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), | ||
| 15466 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), | ||
| 15467 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), | ||
| 15468 | /* FIXME: the below seems conflict */ | ||
| 15469 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ | ||
| 15470 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), | ||
| 15471 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), | ||
| 15472 | {} | ||
| 15473 | }; | ||
| 15474 | |||
| 15475 | static struct alc_config_preset alc861_presets[] = { | ||
| 15476 | [ALC861_3ST] = { | ||
| 15477 | .mixers = { alc861_3ST_mixer }, | ||
| 15478 | .init_verbs = { alc861_threestack_init_verbs }, | ||
| 15479 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15480 | .dac_nids = alc861_dac_nids, | ||
| 15481 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
| 15482 | .channel_mode = alc861_threestack_modes, | ||
| 15483 | .need_dac_fix = 1, | ||
| 15484 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15485 | .adc_nids = alc861_adc_nids, | ||
| 15486 | .input_mux = &alc861_capture_source, | ||
| 15487 | }, | ||
| 15488 | [ALC861_3ST_DIG] = { | ||
| 15489 | .mixers = { alc861_base_mixer }, | ||
| 15490 | .init_verbs = { alc861_threestack_init_verbs }, | ||
| 15491 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15492 | .dac_nids = alc861_dac_nids, | ||
| 15493 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
| 15494 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
| 15495 | .channel_mode = alc861_threestack_modes, | ||
| 15496 | .need_dac_fix = 1, | ||
| 15497 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15498 | .adc_nids = alc861_adc_nids, | ||
| 15499 | .input_mux = &alc861_capture_source, | ||
| 15500 | }, | ||
| 15501 | [ALC861_6ST_DIG] = { | ||
| 15502 | .mixers = { alc861_base_mixer }, | ||
| 15503 | .init_verbs = { alc861_base_init_verbs }, | ||
| 15504 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15505 | .dac_nids = alc861_dac_nids, | ||
| 15506 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
| 15507 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), | ||
| 15508 | .channel_mode = alc861_8ch_modes, | ||
| 15509 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15510 | .adc_nids = alc861_adc_nids, | ||
| 15511 | .input_mux = &alc861_capture_source, | ||
| 15512 | }, | ||
| 15513 | [ALC660_3ST] = { | ||
| 15514 | .mixers = { alc861_3ST_mixer }, | ||
| 15515 | .init_verbs = { alc861_threestack_init_verbs }, | ||
| 15516 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), | ||
| 15517 | .dac_nids = alc660_dac_nids, | ||
| 15518 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), | ||
| 15519 | .channel_mode = alc861_threestack_modes, | ||
| 15520 | .need_dac_fix = 1, | ||
| 15521 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15522 | .adc_nids = alc861_adc_nids, | ||
| 15523 | .input_mux = &alc861_capture_source, | ||
| 15524 | }, | ||
| 15525 | [ALC861_UNIWILL_M31] = { | ||
| 15526 | .mixers = { alc861_uniwill_m31_mixer }, | ||
| 15527 | .init_verbs = { alc861_uniwill_m31_init_verbs }, | ||
| 15528 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15529 | .dac_nids = alc861_dac_nids, | ||
| 15530 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
| 15531 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), | ||
| 15532 | .channel_mode = alc861_uniwill_m31_modes, | ||
| 15533 | .need_dac_fix = 1, | ||
| 15534 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15535 | .adc_nids = alc861_adc_nids, | ||
| 15536 | .input_mux = &alc861_capture_source, | ||
| 15537 | }, | ||
| 15538 | [ALC861_TOSHIBA] = { | ||
| 15539 | .mixers = { alc861_toshiba_mixer }, | ||
| 15540 | .init_verbs = { alc861_base_init_verbs, | ||
| 15541 | alc861_toshiba_init_verbs }, | ||
| 15542 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15543 | .dac_nids = alc861_dac_nids, | ||
| 15544 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 15545 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 15546 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15547 | .adc_nids = alc861_adc_nids, | ||
| 15548 | .input_mux = &alc861_capture_source, | ||
| 15549 | .unsol_event = alc861_toshiba_unsol_event, | ||
| 15550 | .init_hook = alc861_toshiba_automute, | ||
| 15551 | }, | ||
| 15552 | [ALC861_ASUS] = { | ||
| 15553 | .mixers = { alc861_asus_mixer }, | ||
| 15554 | .init_verbs = { alc861_asus_init_verbs }, | ||
| 15555 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15556 | .dac_nids = alc861_dac_nids, | ||
| 15557 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
| 15558 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), | ||
| 15559 | .channel_mode = alc861_asus_modes, | ||
| 15560 | .need_dac_fix = 1, | ||
| 15561 | .hp_nid = 0x06, | ||
| 15562 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15563 | .adc_nids = alc861_adc_nids, | ||
| 15564 | .input_mux = &alc861_capture_source, | ||
| 15565 | }, | ||
| 15566 | [ALC861_ASUS_LAPTOP] = { | ||
| 15567 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, | ||
| 15568 | .init_verbs = { alc861_asus_init_verbs, | ||
| 15569 | alc861_asus_laptop_init_verbs }, | ||
| 15570 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), | ||
| 15571 | .dac_nids = alc861_dac_nids, | ||
| 15572 | .dig_out_nid = ALC861_DIGOUT_NID, | ||
| 15573 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 15574 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 15575 | .need_dac_fix = 1, | ||
| 15576 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), | ||
| 15577 | .adc_nids = alc861_adc_nids, | ||
| 15578 | .input_mux = &alc861_capture_source, | ||
| 15579 | }, | ||
| 15580 | }; | ||
| 15581 | |||
| 15582 | /* Pin config fixes */ | ||
| 15583 | enum { | ||
| 15584 | PINFIX_FSC_AMILO_PI1505, | ||
| 15585 | }; | ||
| 15586 | |||
| 15587 | static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = { | ||
| 15588 | { 0x0b, 0x0221101f }, /* HP */ | ||
| 15589 | { 0x0f, 0x90170310 }, /* speaker */ | ||
| 15590 | { } | ||
| 15591 | }; | ||
| 15592 | |||
| 15593 | static const struct alc_fixup alc861_fixups[] = { | ||
| 15594 | [PINFIX_FSC_AMILO_PI1505] = { | ||
| 15595 | .pins = alc861_fsc_amilo_pi1505_pinfix | ||
| 15596 | }, | ||
| 15597 | }; | ||
| 15598 | |||
| 15599 | static struct snd_pci_quirk alc861_fixup_tbl[] = { | ||
| 15600 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505), | ||
| 15601 | {} | ||
| 15602 | }; | ||
| 15603 | |||
| 15604 | static int patch_alc861(struct hda_codec *codec) | ||
| 15605 | { | ||
| 15606 | struct alc_spec *spec; | ||
| 15607 | int board_config; | ||
| 15608 | int err; | ||
| 15609 | |||
| 15610 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 15611 | if (spec == NULL) | ||
| 15612 | return -ENOMEM; | ||
| 15613 | |||
| 15614 | codec->spec = spec; | ||
| 15615 | |||
| 15616 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, | ||
| 15617 | alc861_models, | ||
| 15618 | alc861_cfg_tbl); | ||
| 15619 | |||
| 15620 | if (board_config < 0) { | ||
| 15621 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 15622 | codec->chip_name); | ||
| 15623 | board_config = ALC861_AUTO; | ||
| 15624 | } | ||
| 15625 | |||
| 15626 | if (board_config == ALC861_AUTO) | ||
| 15627 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); | ||
| 15628 | |||
| 15629 | if (board_config == ALC861_AUTO) { | ||
| 15630 | /* automatic parse from the BIOS config */ | ||
| 15631 | err = alc861_parse_auto_config(codec); | ||
| 15632 | if (err < 0) { | ||
| 15633 | alc_free(codec); | ||
| 15634 | return err; | ||
| 15635 | } else if (!err) { | ||
| 15636 | printk(KERN_INFO | ||
| 15637 | "hda_codec: Cannot set up configuration " | ||
| 15638 | "from BIOS. Using base mode...\n"); | ||
| 15639 | board_config = ALC861_3ST_DIG; | ||
| 15640 | } | ||
| 15641 | } | ||
| 15642 | |||
| 15643 | err = snd_hda_attach_beep_device(codec, 0x23); | ||
| 15644 | if (err < 0) { | ||
| 15645 | alc_free(codec); | ||
| 15646 | return err; | ||
| 15647 | } | ||
| 15648 | |||
| 15649 | if (board_config != ALC861_AUTO) | ||
| 15650 | setup_preset(codec, &alc861_presets[board_config]); | ||
| 15651 | |||
| 15652 | spec->stream_analog_playback = &alc861_pcm_analog_playback; | ||
| 15653 | spec->stream_analog_capture = &alc861_pcm_analog_capture; | ||
| 15654 | |||
| 15655 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | ||
| 15656 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | ||
| 15657 | |||
| 15658 | if (!spec->cap_mixer) | ||
| 15659 | set_capture_mixer(codec); | ||
| 15660 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | ||
| 15661 | |||
| 15662 | spec->vmaster_nid = 0x03; | ||
| 15663 | |||
| 15664 | if (board_config == ALC861_AUTO) | ||
| 15665 | alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0); | ||
| 15666 | |||
| 15667 | codec->patch_ops = alc_patch_ops; | ||
| 15668 | if (board_config == ALC861_AUTO) { | ||
| 15669 | spec->init_hook = alc861_auto_init; | ||
| 15670 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 15671 | spec->power_hook = alc_power_eapd; | ||
| 15672 | #endif | ||
| 15673 | } | ||
| 15674 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 15675 | if (!spec->loopback.amplist) | ||
| 15676 | spec->loopback.amplist = alc861_loopbacks; | ||
| 15677 | #endif | ||
| 15678 | |||
| 15679 | return 0; | ||
| 15680 | } | ||
| 15681 | |||
| 15682 | /* | ||
| 15683 | * ALC861-VD support | ||
| 15684 | * | ||
| 15685 | * Based on ALC882 | ||
| 15686 | * | ||
| 15687 | * In addition, an independent DAC | ||
| 15688 | */ | ||
| 15689 | #define ALC861VD_DIGOUT_NID 0x06 | ||
| 15690 | |||
| 15691 | static hda_nid_t alc861vd_dac_nids[4] = { | ||
| 15692 | /* front, surr, clfe, side surr */ | ||
| 15693 | 0x02, 0x03, 0x04, 0x05 | ||
| 15694 | }; | ||
| 15695 | |||
| 15696 | /* dac_nids for ALC660vd are in a different order - according to | ||
| 15697 | * Realtek's driver. | ||
| 15698 | * This should probably result in a different mixer for 6stack models | ||
| 15699 | * of ALC660vd codecs, but for now there is only 3stack mixer | ||
| 15700 | * - and it is the same as in 861vd. | ||
| 15701 | * adc_nids in ALC660vd are (is) the same as in 861vd | ||
| 15702 | */ | ||
| 15703 | static hda_nid_t alc660vd_dac_nids[3] = { | ||
| 15704 | /* front, rear, clfe, rear_surr */ | ||
| 15705 | 0x02, 0x04, 0x03 | ||
| 15706 | }; | ||
| 15707 | |||
| 15708 | static hda_nid_t alc861vd_adc_nids[1] = { | ||
| 15709 | /* ADC0 */ | ||
| 15710 | 0x09, | ||
| 15711 | }; | ||
| 15712 | |||
| 15713 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | ||
| 15714 | |||
| 15715 | /* input MUX */ | ||
| 15716 | /* FIXME: should be a matrix-type input source selection */ | ||
| 15717 | static struct hda_input_mux alc861vd_capture_source = { | ||
| 15718 | .num_items = 4, | ||
| 15719 | .items = { | ||
| 15720 | { "Mic", 0x0 }, | ||
| 15721 | { "Front Mic", 0x1 }, | ||
| 15722 | { "Line", 0x2 }, | ||
| 15723 | { "CD", 0x4 }, | ||
| 15724 | }, | ||
| 15725 | }; | ||
| 15726 | |||
| 15727 | static struct hda_input_mux alc861vd_dallas_capture_source = { | ||
| 15728 | .num_items = 2, | ||
| 15729 | .items = { | ||
| 15730 | { "Ext Mic", 0x0 }, | ||
| 15731 | { "Int Mic", 0x1 }, | ||
| 15732 | }, | ||
| 15733 | }; | ||
| 15734 | |||
| 15735 | static struct hda_input_mux alc861vd_hp_capture_source = { | ||
| 15736 | .num_items = 2, | ||
| 15737 | .items = { | ||
| 15738 | { "Front Mic", 0x0 }, | ||
| 15739 | { "ATAPI Mic", 0x1 }, | ||
| 15740 | }, | ||
| 15741 | }; | ||
| 15742 | |||
| 15743 | /* | ||
| 15744 | * 2ch mode | ||
| 15745 | */ | ||
| 15746 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { | ||
| 15747 | { 2, NULL } | ||
| 15748 | }; | ||
| 15749 | |||
| 15750 | /* | ||
| 15751 | * 6ch mode | ||
| 15752 | */ | ||
| 15753 | static struct hda_verb alc861vd_6stack_ch6_init[] = { | ||
| 15754 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 15755 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15756 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15757 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15758 | { } /* end */ | ||
| 15759 | }; | ||
| 15760 | |||
| 15761 | /* | ||
| 15762 | * 8ch mode | ||
| 15763 | */ | ||
| 15764 | static struct hda_verb alc861vd_6stack_ch8_init[] = { | ||
| 15765 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15766 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15767 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15768 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 15769 | { } /* end */ | ||
| 15770 | }; | ||
| 15771 | |||
| 15772 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { | ||
| 15773 | { 6, alc861vd_6stack_ch6_init }, | ||
| 15774 | { 8, alc861vd_6stack_ch8_init }, | ||
| 15775 | }; | ||
| 15776 | |||
| 15777 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { | ||
| 15778 | { | ||
| 15779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 15780 | .name = "Channel Mode", | ||
| 15781 | .info = alc_ch_mode_info, | ||
| 15782 | .get = alc_ch_mode_get, | ||
| 15783 | .put = alc_ch_mode_put, | ||
| 15784 | }, | ||
| 15785 | { } /* end */ | ||
| 15786 | }; | ||
| 15787 | |||
| 15788 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
| 15789 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
| 15790 | */ | ||
| 15791 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | ||
| 15792 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 15793 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 15794 | |||
| 15795 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 15796 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 15797 | |||
| 15798 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, | ||
| 15799 | HDA_OUTPUT), | ||
| 15800 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, | ||
| 15801 | HDA_OUTPUT), | ||
| 15802 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
| 15803 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
| 15804 | |||
| 15805 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), | ||
| 15806 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
| 15807 | |||
| 15808 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 15809 | |||
| 15810 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 15811 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 15812 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 15813 | |||
| 15814 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 15815 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 15816 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 15817 | |||
| 15818 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 15819 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 15820 | |||
| 15821 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 15822 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 15823 | |||
| 15824 | { } /* end */ | ||
| 15825 | }; | ||
| 15826 | |||
| 15827 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | ||
| 15828 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 15829 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 15830 | |||
| 15831 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 15832 | |||
| 15833 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 15834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 15835 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 15836 | |||
| 15837 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 15838 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 15839 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 15840 | |||
| 15841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 15842 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 15843 | |||
| 15844 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 15845 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 15846 | |||
| 15847 | { } /* end */ | ||
| 15848 | }; | ||
| 15849 | |||
| 15850 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { | ||
| 15851 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 15852 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ | ||
| 15853 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 15854 | |||
| 15855 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 15856 | |||
| 15857 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 15858 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 15859 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 15860 | |||
| 15861 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 15862 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 15863 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 15864 | |||
| 15865 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 15866 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 15867 | |||
| 15868 | { } /* end */ | ||
| 15869 | }; | ||
| 15870 | |||
| 15871 | /* Pin assignment: Speaker=0x14, HP = 0x15, | ||
| 15872 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d | ||
| 15873 | */ | ||
| 15874 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | ||
| 15875 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 15876 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 15877 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 15878 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 15879 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 15880 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 15881 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 15882 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 15883 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 15884 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 15885 | { } /* end */ | ||
| 15886 | }; | ||
| 15887 | |||
| 15888 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, | ||
| 15889 | * Front Mic=0x18, ATAPI Mic = 0x19, | ||
| 15890 | */ | ||
| 15891 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | ||
| 15892 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 15893 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 15894 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 15895 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), | ||
| 15896 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 15897 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 15898 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 15899 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 15900 | |||
| 15901 | { } /* end */ | ||
| 15902 | }; | ||
| 15903 | |||
| 15904 | /* | ||
| 15905 | * generic initialization of ADC, input mixers and output mixers | ||
| 15906 | */ | ||
| 15907 | static struct hda_verb alc861vd_volume_init_verbs[] = { | ||
| 15908 | /* | ||
| 15909 | * Unmute ADC0 and set the default input to mic-in | ||
| 15910 | */ | ||
| 15911 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 15912 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15913 | |||
| 15914 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of | ||
| 15915 | * the analog-loopback mixer widget | ||
| 15916 | */ | ||
| 15917 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
| 15918 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15919 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15920 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 15921 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 15922 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 15923 | |||
| 15924 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ | ||
| 15925 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 15926 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 15927 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | ||
| 15928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | ||
| 15929 | |||
| 15930 | /* | ||
| 15931 | * Set up output mixers (0x02 - 0x05) | ||
| 15932 | */ | ||
| 15933 | /* set vol=0 to output mixers */ | ||
| 15934 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 15935 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 15936 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 15937 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 15938 | |||
| 15939 | /* set up input amps for analog loopback */ | ||
| 15940 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
| 15941 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15944 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15945 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15946 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15947 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 15948 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 15949 | |||
| 15950 | { } | ||
| 15951 | }; | ||
| 15952 | |||
| 15953 | /* | ||
| 15954 | * 3-stack pin configuration: | ||
| 15955 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b | ||
| 15956 | */ | ||
| 15957 | static struct hda_verb alc861vd_3stack_init_verbs[] = { | ||
| 15958 | /* | ||
| 15959 | * Set pin mode and muting | ||
| 15960 | */ | ||
| 15961 | /* set front pin widgets 0x14 for output */ | ||
| 15962 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 15963 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15964 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 15965 | |||
| 15966 | /* Mic (rear) pin: input vref at 80% */ | ||
| 15967 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 15968 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15969 | /* Front Mic pin: input vref at 80% */ | ||
| 15970 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 15971 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15972 | /* Line In pin: input */ | ||
| 15973 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 15974 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 15975 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
| 15976 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 15977 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15978 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 15979 | /* CD pin widget for input */ | ||
| 15980 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 15981 | |||
| 15982 | { } | ||
| 15983 | }; | ||
| 15984 | |||
| 15985 | /* | ||
| 15986 | * 6-stack pin configuration: | ||
| 15987 | */ | ||
| 15988 | static struct hda_verb alc861vd_6stack_init_verbs[] = { | ||
| 15989 | /* | ||
| 15990 | * Set pin mode and muting | ||
| 15991 | */ | ||
| 15992 | /* set front pin widgets 0x14 for output */ | ||
| 15993 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 15994 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 15995 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 15996 | |||
| 15997 | /* Rear Pin: output 1 (0x0d) */ | ||
| 15998 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 15999 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16000 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 16001 | /* CLFE Pin: output 2 (0x0e) */ | ||
| 16002 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16003 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16004 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, | ||
| 16005 | /* Side Pin: output 3 (0x0f) */ | ||
| 16006 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16007 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16008 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, | ||
| 16009 | |||
| 16010 | /* Mic (rear) pin: input vref at 80% */ | ||
| 16011 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 16012 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 16013 | /* Front Mic pin: input vref at 80% */ | ||
| 16014 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 16015 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 16016 | /* Line In pin: input */ | ||
| 16017 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16018 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 16019 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
| 16020 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 16021 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16022 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 16023 | /* CD pin widget for input */ | ||
| 16024 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16025 | |||
| 16026 | { } | ||
| 16027 | }; | ||
| 16028 | |||
| 16029 | static struct hda_verb alc861vd_eapd_verbs[] = { | ||
| 16030 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 16031 | { } | ||
| 16032 | }; | ||
| 16033 | |||
| 16034 | static struct hda_verb alc660vd_eapd_verbs[] = { | ||
| 16035 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 16036 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 16037 | { } | ||
| 16038 | }; | ||
| 16039 | |||
| 16040 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | ||
| 16041 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 16042 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 16043 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
| 16044 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 16045 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 16046 | {} | ||
| 16047 | }; | ||
| 16048 | |||
| 16049 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) | ||
| 16050 | { | ||
| 16051 | unsigned int present; | ||
| 16052 | unsigned char bits; | ||
| 16053 | |||
| 16054 | present = snd_hda_jack_detect(codec, 0x18); | ||
| 16055 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 16056 | |||
| 16057 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, | ||
| 16058 | HDA_AMP_MUTE, bits); | ||
| 16059 | } | ||
| 16060 | |||
| 16061 | static void alc861vd_lenovo_setup(struct hda_codec *codec) | ||
| 16062 | { | ||
| 16063 | struct alc_spec *spec = codec->spec; | ||
| 16064 | spec->autocfg.hp_pins[0] = 0x1b; | ||
| 16065 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 16066 | } | ||
| 16067 | |||
| 16068 | static void alc861vd_lenovo_init_hook(struct hda_codec *codec) | ||
| 16069 | { | ||
| 16070 | alc_automute_amp(codec); | ||
| 16071 | alc861vd_lenovo_mic_automute(codec); | ||
| 16072 | } | ||
| 16073 | |||
| 16074 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, | ||
| 16075 | unsigned int res) | ||
| 16076 | { | ||
| 16077 | switch (res >> 26) { | ||
| 16078 | case ALC880_MIC_EVENT: | ||
| 16079 | alc861vd_lenovo_mic_automute(codec); | ||
| 16080 | break; | ||
| 16081 | default: | ||
| 16082 | alc_automute_amp_unsol_event(codec, res); | ||
| 16083 | break; | ||
| 16084 | } | ||
| 16085 | } | ||
| 16086 | |||
| 16087 | static struct hda_verb alc861vd_dallas_verbs[] = { | ||
| 16088 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 16089 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 16090 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 16091 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
| 16092 | |||
| 16093 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 16094 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 16095 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 16096 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 16097 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 16098 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 16099 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 16100 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
| 16101 | |||
| 16102 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16103 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16104 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16105 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16106 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16107 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16108 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 16109 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 16110 | |||
| 16111 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 16112 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 16113 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
| 16114 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 16115 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16116 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16117 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16118 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 16119 | |||
| 16120 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 16121 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
| 16122 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
| 16123 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
| 16124 | |||
| 16125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 16126 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 16127 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 16128 | |||
| 16129 | { } /* end */ | ||
| 16130 | }; | ||
| 16131 | |||
| 16132 | /* toggle speaker-output according to the hp-jack state */ | ||
| 16133 | static void alc861vd_dallas_setup(struct hda_codec *codec) | ||
| 16134 | { | ||
| 16135 | struct alc_spec *spec = codec->spec; | ||
| 16136 | |||
| 16137 | spec->autocfg.hp_pins[0] = 0x15; | ||
| 16138 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 16139 | } | ||
| 16140 | |||
| 16141 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 16142 | #define alc861vd_loopbacks alc880_loopbacks | ||
| 16143 | #endif | ||
| 16144 | |||
| 16145 | /* pcm configuration: identical with ALC880 */ | ||
| 16146 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback | ||
| 16147 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture | ||
| 16148 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback | ||
| 16149 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture | ||
| 16150 | |||
| 16151 | /* | ||
| 16152 | * configuration and preset | ||
| 16153 | */ | ||
| 16154 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { | ||
| 16155 | [ALC660VD_3ST] = "3stack-660", | ||
| 16156 | [ALC660VD_3ST_DIG] = "3stack-660-digout", | ||
| 16157 | [ALC660VD_ASUS_V1S] = "asus-v1s", | ||
| 16158 | [ALC861VD_3ST] = "3stack", | ||
| 16159 | [ALC861VD_3ST_DIG] = "3stack-digout", | ||
| 16160 | [ALC861VD_6ST_DIG] = "6stack-digout", | ||
| 16161 | [ALC861VD_LENOVO] = "lenovo", | ||
| 16162 | [ALC861VD_DALLAS] = "dallas", | ||
| 16163 | [ALC861VD_HP] = "hp", | ||
| 16164 | [ALC861VD_AUTO] = "auto", | ||
| 16165 | }; | ||
| 16166 | |||
| 16167 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | ||
| 16168 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), | ||
| 16169 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), | ||
| 16170 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), | ||
| 16171 | /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */ | ||
| 16172 | SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), | ||
| 16173 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), | ||
| 16174 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), | ||
| 16175 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), | ||
| 16176 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ | ||
| 16177 | SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO), | ||
| 16178 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | ||
| 16179 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | ||
| 16180 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | ||
| 16181 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), | ||
| 16182 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | ||
| 16183 | {} | ||
| 16184 | }; | ||
| 16185 | |||
| 16186 | static struct alc_config_preset alc861vd_presets[] = { | ||
| 16187 | [ALC660VD_3ST] = { | ||
| 16188 | .mixers = { alc861vd_3st_mixer }, | ||
| 16189 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16190 | alc861vd_3stack_init_verbs }, | ||
| 16191 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
| 16192 | .dac_nids = alc660vd_dac_nids, | ||
| 16193 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16194 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16195 | .input_mux = &alc861vd_capture_source, | ||
| 16196 | }, | ||
| 16197 | [ALC660VD_3ST_DIG] = { | ||
| 16198 | .mixers = { alc861vd_3st_mixer }, | ||
| 16199 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16200 | alc861vd_3stack_init_verbs }, | ||
| 16201 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
| 16202 | .dac_nids = alc660vd_dac_nids, | ||
| 16203 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
| 16204 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16205 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16206 | .input_mux = &alc861vd_capture_source, | ||
| 16207 | }, | ||
| 16208 | [ALC861VD_3ST] = { | ||
| 16209 | .mixers = { alc861vd_3st_mixer }, | ||
| 16210 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16211 | alc861vd_3stack_init_verbs }, | ||
| 16212 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
| 16213 | .dac_nids = alc861vd_dac_nids, | ||
| 16214 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16215 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16216 | .input_mux = &alc861vd_capture_source, | ||
| 16217 | }, | ||
| 16218 | [ALC861VD_3ST_DIG] = { | ||
| 16219 | .mixers = { alc861vd_3st_mixer }, | ||
| 16220 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16221 | alc861vd_3stack_init_verbs }, | ||
| 16222 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
| 16223 | .dac_nids = alc861vd_dac_nids, | ||
| 16224 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
| 16225 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16226 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16227 | .input_mux = &alc861vd_capture_source, | ||
| 16228 | }, | ||
| 16229 | [ALC861VD_6ST_DIG] = { | ||
| 16230 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, | ||
| 16231 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16232 | alc861vd_6stack_init_verbs }, | ||
| 16233 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
| 16234 | .dac_nids = alc861vd_dac_nids, | ||
| 16235 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
| 16236 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), | ||
| 16237 | .channel_mode = alc861vd_6stack_modes, | ||
| 16238 | .input_mux = &alc861vd_capture_source, | ||
| 16239 | }, | ||
| 16240 | [ALC861VD_LENOVO] = { | ||
| 16241 | .mixers = { alc861vd_lenovo_mixer }, | ||
| 16242 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16243 | alc861vd_3stack_init_verbs, | ||
| 16244 | alc861vd_eapd_verbs, | ||
| 16245 | alc861vd_lenovo_unsol_verbs }, | ||
| 16246 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
| 16247 | .dac_nids = alc660vd_dac_nids, | ||
| 16248 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16249 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16250 | .input_mux = &alc861vd_capture_source, | ||
| 16251 | .unsol_event = alc861vd_lenovo_unsol_event, | ||
| 16252 | .setup = alc861vd_lenovo_setup, | ||
| 16253 | .init_hook = alc861vd_lenovo_init_hook, | ||
| 16254 | }, | ||
| 16255 | [ALC861VD_DALLAS] = { | ||
| 16256 | .mixers = { alc861vd_dallas_mixer }, | ||
| 16257 | .init_verbs = { alc861vd_dallas_verbs }, | ||
| 16258 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
| 16259 | .dac_nids = alc861vd_dac_nids, | ||
| 16260 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16261 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16262 | .input_mux = &alc861vd_dallas_capture_source, | ||
| 16263 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 16264 | .setup = alc861vd_dallas_setup, | ||
| 16265 | .init_hook = alc_automute_amp, | ||
| 16266 | }, | ||
| 16267 | [ALC861VD_HP] = { | ||
| 16268 | .mixers = { alc861vd_hp_mixer }, | ||
| 16269 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | ||
| 16270 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | ||
| 16271 | .dac_nids = alc861vd_dac_nids, | ||
| 16272 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
| 16273 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16274 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16275 | .input_mux = &alc861vd_hp_capture_source, | ||
| 16276 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 16277 | .setup = alc861vd_dallas_setup, | ||
| 16278 | .init_hook = alc_automute_amp, | ||
| 16279 | }, | ||
| 16280 | [ALC660VD_ASUS_V1S] = { | ||
| 16281 | .mixers = { alc861vd_lenovo_mixer }, | ||
| 16282 | .init_verbs = { alc861vd_volume_init_verbs, | ||
| 16283 | alc861vd_3stack_init_verbs, | ||
| 16284 | alc861vd_eapd_verbs, | ||
| 16285 | alc861vd_lenovo_unsol_verbs }, | ||
| 16286 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | ||
| 16287 | .dac_nids = alc660vd_dac_nids, | ||
| 16288 | .dig_out_nid = ALC861VD_DIGOUT_NID, | ||
| 16289 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | ||
| 16290 | .channel_mode = alc861vd_3stack_2ch_modes, | ||
| 16291 | .input_mux = &alc861vd_capture_source, | ||
| 16292 | .unsol_event = alc861vd_lenovo_unsol_event, | ||
| 16293 | .setup = alc861vd_lenovo_setup, | ||
| 16294 | .init_hook = alc861vd_lenovo_init_hook, | ||
| 16295 | }, | ||
| 16296 | }; | ||
| 16297 | |||
| 16298 | /* | ||
| 16299 | * BIOS auto configuration | ||
| 16300 | */ | ||
| 16301 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, | ||
| 16302 | const struct auto_pin_cfg *cfg) | ||
| 16303 | { | ||
| 16304 | return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); | ||
| 16305 | } | ||
| 16306 | |||
| 16307 | |||
| 16308 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 16309 | hda_nid_t nid, int pin_type, int dac_idx) | ||
| 16310 | { | ||
| 16311 | alc_set_pin_output(codec, nid, pin_type); | ||
| 16312 | } | ||
| 16313 | |||
| 16314 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) | ||
| 16315 | { | ||
| 16316 | struct alc_spec *spec = codec->spec; | ||
| 16317 | int i; | ||
| 16318 | |||
| 16319 | for (i = 0; i <= HDA_SIDE; i++) { | ||
| 16320 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
| 16321 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 16322 | if (nid) | ||
| 16323 | alc861vd_auto_set_output_and_unmute(codec, nid, | ||
| 16324 | pin_type, i); | ||
| 16325 | } | ||
| 16326 | } | ||
| 16327 | |||
| 16328 | |||
| 16329 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) | ||
| 16330 | { | ||
| 16331 | struct alc_spec *spec = codec->spec; | ||
| 16332 | hda_nid_t pin; | ||
| 16333 | |||
| 16334 | pin = spec->autocfg.hp_pins[0]; | ||
| 16335 | if (pin) /* connect to front and use dac 0 */ | ||
| 16336 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); | ||
| 16337 | pin = spec->autocfg.speaker_pins[0]; | ||
| 16338 | if (pin) | ||
| 16339 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | ||
| 16340 | } | ||
| 16341 | |||
| 16342 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID | ||
| 16343 | |||
| 16344 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | ||
| 16345 | { | ||
| 16346 | struct alc_spec *spec = codec->spec; | ||
| 16347 | int i; | ||
| 16348 | |||
| 16349 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 16350 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 16351 | if (alc_is_input_pin(codec, nid)) { | ||
| 16352 | alc_set_input_pin(codec, nid, i); | ||
| 16353 | if (nid != ALC861VD_PIN_CD_NID && | ||
| 16354 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | ||
| 16355 | snd_hda_codec_write(codec, nid, 0, | ||
| 16356 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 16357 | AMP_OUT_MUTE); | ||
| 16358 | } | ||
| 16359 | } | ||
| 16360 | } | ||
| 16361 | |||
| 16362 | #define alc861vd_auto_init_input_src alc882_auto_init_input_src | ||
| 16363 | |||
| 16364 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) | ||
| 16365 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) | ||
| 16366 | |||
| 16367 | /* add playback controls from the parsed DAC table */ | ||
| 16368 | /* Based on ALC880 version. But ALC861VD has separate, | ||
| 16369 | * different NIDs for mute/unmute switch and volume control */ | ||
| 16370 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, | ||
| 16371 | const struct auto_pin_cfg *cfg) | ||
| 16372 | { | ||
| 16373 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; | ||
| 16374 | hda_nid_t nid_v, nid_s; | ||
| 16375 | int i, err; | ||
| 16376 | |||
| 16377 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 16378 | if (!spec->multiout.dac_nids[i]) | ||
| 16379 | continue; | ||
| 16380 | nid_v = alc861vd_idx_to_mixer_vol( | ||
| 16381 | alc880_dac_to_idx( | ||
| 16382 | spec->multiout.dac_nids[i])); | ||
| 16383 | nid_s = alc861vd_idx_to_mixer_switch( | ||
| 16384 | alc880_dac_to_idx( | ||
| 16385 | spec->multiout.dac_nids[i])); | ||
| 16386 | |||
| 16387 | if (i == 2) { | ||
| 16388 | /* Center/LFE */ | ||
| 16389 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | ||
| 16390 | "Center", | ||
| 16391 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, | ||
| 16392 | HDA_OUTPUT)); | ||
| 16393 | if (err < 0) | ||
| 16394 | return err; | ||
| 16395 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | ||
| 16396 | "LFE", | ||
| 16397 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, | ||
| 16398 | HDA_OUTPUT)); | ||
| 16399 | if (err < 0) | ||
| 16400 | return err; | ||
| 16401 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | ||
| 16402 | "Center", | ||
| 16403 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, | ||
| 16404 | HDA_INPUT)); | ||
| 16405 | if (err < 0) | ||
| 16406 | return err; | ||
| 16407 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | ||
| 16408 | "LFE", | ||
| 16409 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, | ||
| 16410 | HDA_INPUT)); | ||
| 16411 | if (err < 0) | ||
| 16412 | return err; | ||
| 16413 | } else { | ||
| 16414 | const char *pfx; | ||
| 16415 | if (cfg->line_outs == 1 && | ||
| 16416 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
| 16417 | if (!cfg->hp_pins) | ||
| 16418 | pfx = "Speaker"; | ||
| 16419 | else | ||
| 16420 | pfx = "PCM"; | ||
| 16421 | } else | ||
| 16422 | pfx = chname[i]; | ||
| 16423 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | ||
| 16424 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, | ||
| 16425 | HDA_OUTPUT)); | ||
| 16426 | if (err < 0) | ||
| 16427 | return err; | ||
| 16428 | if (cfg->line_outs == 1 && | ||
| 16429 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 16430 | pfx = "Speaker"; | ||
| 16431 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | ||
| 16432 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, | ||
| 16433 | HDA_INPUT)); | ||
| 16434 | if (err < 0) | ||
| 16435 | return err; | ||
| 16436 | } | ||
| 16437 | } | ||
| 16438 | return 0; | ||
| 16439 | } | ||
| 16440 | |||
| 16441 | /* add playback controls for speaker and HP outputs */ | ||
| 16442 | /* Based on ALC880 version. But ALC861VD has separate, | ||
| 16443 | * different NIDs for mute/unmute switch and volume control */ | ||
| 16444 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, | ||
| 16445 | hda_nid_t pin, const char *pfx) | ||
| 16446 | { | ||
| 16447 | hda_nid_t nid_v, nid_s; | ||
| 16448 | int err; | ||
| 16449 | |||
| 16450 | if (!pin) | ||
| 16451 | return 0; | ||
| 16452 | |||
| 16453 | if (alc880_is_fixed_pin(pin)) { | ||
| 16454 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | ||
| 16455 | /* specify the DAC as the extra output */ | ||
| 16456 | if (!spec->multiout.hp_nid) | ||
| 16457 | spec->multiout.hp_nid = nid_v; | ||
| 16458 | else | ||
| 16459 | spec->multiout.extra_out_nid[0] = nid_v; | ||
| 16460 | /* control HP volume/switch on the output mixer amp */ | ||
| 16461 | nid_v = alc861vd_idx_to_mixer_vol( | ||
| 16462 | alc880_fixed_pin_idx(pin)); | ||
| 16463 | nid_s = alc861vd_idx_to_mixer_switch( | ||
| 16464 | alc880_fixed_pin_idx(pin)); | ||
| 16465 | |||
| 16466 | err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | ||
| 16467 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); | ||
| 16468 | if (err < 0) | ||
| 16469 | return err; | ||
| 16470 | err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx, | ||
| 16471 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); | ||
| 16472 | if (err < 0) | ||
| 16473 | return err; | ||
| 16474 | } else if (alc880_is_multi_pin(pin)) { | ||
| 16475 | /* set manual connection */ | ||
| 16476 | /* we have only a switch on HP-out PIN */ | ||
| 16477 | err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | ||
| 16478 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
| 16479 | if (err < 0) | ||
| 16480 | return err; | ||
| 16481 | } | ||
| 16482 | return 0; | ||
| 16483 | } | ||
| 16484 | |||
| 16485 | /* parse the BIOS configuration and set up the alc_spec | ||
| 16486 | * return 1 if successful, 0 if the proper config is not found, | ||
| 16487 | * or a negative error code | ||
| 16488 | * Based on ALC880 version - had to change it to override | ||
| 16489 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ | ||
| 16490 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | ||
| 16491 | { | ||
| 16492 | struct alc_spec *spec = codec->spec; | ||
| 16493 | int err; | ||
| 16494 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | ||
| 16495 | |||
| 16496 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 16497 | alc861vd_ignore); | ||
| 16498 | if (err < 0) | ||
| 16499 | return err; | ||
| 16500 | if (!spec->autocfg.line_outs) | ||
| 16501 | return 0; /* can't find valid BIOS pin config */ | ||
| 16502 | |||
| 16503 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); | ||
| 16504 | if (err < 0) | ||
| 16505 | return err; | ||
| 16506 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); | ||
| 16507 | if (err < 0) | ||
| 16508 | return err; | ||
| 16509 | err = alc861vd_auto_create_extra_out(spec, | ||
| 16510 | spec->autocfg.speaker_pins[0], | ||
| 16511 | "Speaker"); | ||
| 16512 | if (err < 0) | ||
| 16513 | return err; | ||
| 16514 | err = alc861vd_auto_create_extra_out(spec, | ||
| 16515 | spec->autocfg.hp_pins[0], | ||
| 16516 | "Headphone"); | ||
| 16517 | if (err < 0) | ||
| 16518 | return err; | ||
| 16519 | err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 16520 | if (err < 0) | ||
| 16521 | return err; | ||
| 16522 | |||
| 16523 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 16524 | |||
| 16525 | if (spec->autocfg.dig_outs) | ||
| 16526 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | ||
| 16527 | |||
| 16528 | if (spec->kctls.list) | ||
| 16529 | add_mixer(spec, spec->kctls.list); | ||
| 16530 | |||
| 16531 | add_verb(spec, alc861vd_volume_init_verbs); | ||
| 16532 | |||
| 16533 | spec->num_mux_defs = 1; | ||
| 16534 | spec->input_mux = &spec->private_imux[0]; | ||
| 16535 | |||
| 16536 | err = alc_auto_add_mic_boost(codec); | ||
| 16537 | if (err < 0) | ||
| 16538 | return err; | ||
| 16539 | |||
| 16540 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 16541 | |||
| 16542 | return 1; | ||
| 16543 | } | ||
| 16544 | |||
| 16545 | /* additional initialization for auto-configuration model */ | ||
| 16546 | static void alc861vd_auto_init(struct hda_codec *codec) | ||
| 16547 | { | ||
| 16548 | struct alc_spec *spec = codec->spec; | ||
| 16549 | alc861vd_auto_init_multi_out(codec); | ||
| 16550 | alc861vd_auto_init_hp_out(codec); | ||
| 16551 | alc861vd_auto_init_analog_input(codec); | ||
| 16552 | alc861vd_auto_init_input_src(codec); | ||
| 16553 | if (spec->unsol_event) | ||
| 16554 | alc_inithook(codec); | ||
| 16555 | } | ||
| 16556 | |||
| 16557 | enum { | ||
| 16558 | ALC660VD_FIX_ASUS_GPIO1 | ||
| 16559 | }; | ||
| 16560 | |||
| 16561 | /* reset GPIO1 */ | ||
| 16562 | static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = { | ||
| 16563 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
| 16564 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
| 16565 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
| 16566 | { } | ||
| 16567 | }; | ||
| 16568 | |||
| 16569 | static const struct alc_fixup alc861vd_fixups[] = { | ||
| 16570 | [ALC660VD_FIX_ASUS_GPIO1] = { | ||
| 16571 | .verbs = alc660vd_fix_asus_gpio1_verbs, | ||
| 16572 | }, | ||
| 16573 | }; | ||
| 16574 | |||
| 16575 | static struct snd_pci_quirk alc861vd_fixup_tbl[] = { | ||
| 16576 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), | ||
| 16577 | {} | ||
| 16578 | }; | ||
| 16579 | |||
| 16580 | static int patch_alc861vd(struct hda_codec *codec) | ||
| 16581 | { | ||
| 16582 | struct alc_spec *spec; | ||
| 16583 | int err, board_config; | ||
| 16584 | |||
| 16585 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 16586 | if (spec == NULL) | ||
| 16587 | return -ENOMEM; | ||
| 16588 | |||
| 16589 | codec->spec = spec; | ||
| 16590 | |||
| 16591 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, | ||
| 16592 | alc861vd_models, | ||
| 16593 | alc861vd_cfg_tbl); | ||
| 16594 | |||
| 16595 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { | ||
| 16596 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 16597 | codec->chip_name); | ||
| 16598 | board_config = ALC861VD_AUTO; | ||
| 16599 | } | ||
| 16600 | |||
| 16601 | if (board_config == ALC861VD_AUTO) | ||
| 16602 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); | ||
| 16603 | |||
| 16604 | if (board_config == ALC861VD_AUTO) { | ||
| 16605 | /* automatic parse from the BIOS config */ | ||
| 16606 | err = alc861vd_parse_auto_config(codec); | ||
| 16607 | if (err < 0) { | ||
| 16608 | alc_free(codec); | ||
| 16609 | return err; | ||
| 16610 | } else if (!err) { | ||
| 16611 | printk(KERN_INFO | ||
| 16612 | "hda_codec: Cannot set up configuration " | ||
| 16613 | "from BIOS. Using base mode...\n"); | ||
| 16614 | board_config = ALC861VD_3ST; | ||
| 16615 | } | ||
| 16616 | } | ||
| 16617 | |||
| 16618 | err = snd_hda_attach_beep_device(codec, 0x23); | ||
| 16619 | if (err < 0) { | ||
| 16620 | alc_free(codec); | ||
| 16621 | return err; | ||
| 16622 | } | ||
| 16623 | |||
| 16624 | if (board_config != ALC861VD_AUTO) | ||
| 16625 | setup_preset(codec, &alc861vd_presets[board_config]); | ||
| 16626 | |||
| 16627 | if (codec->vendor_id == 0x10ec0660) { | ||
| 16628 | /* always turn on EAPD */ | ||
| 16629 | add_verb(spec, alc660vd_eapd_verbs); | ||
| 16630 | } | ||
| 16631 | |||
| 16632 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; | ||
| 16633 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; | ||
| 16634 | |||
| 16635 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; | ||
| 16636 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; | ||
| 16637 | |||
| 16638 | if (!spec->adc_nids) { | ||
| 16639 | spec->adc_nids = alc861vd_adc_nids; | ||
| 16640 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | ||
| 16641 | } | ||
| 16642 | if (!spec->capsrc_nids) | ||
| 16643 | spec->capsrc_nids = alc861vd_capsrc_nids; | ||
| 16644 | |||
| 16645 | set_capture_mixer(codec); | ||
| 16646 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
| 16647 | |||
| 16648 | spec->vmaster_nid = 0x02; | ||
| 16649 | |||
| 16650 | if (board_config == ALC861VD_AUTO) | ||
| 16651 | alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0); | ||
| 16652 | |||
| 16653 | codec->patch_ops = alc_patch_ops; | ||
| 16654 | |||
| 16655 | if (board_config == ALC861VD_AUTO) | ||
| 16656 | spec->init_hook = alc861vd_auto_init; | ||
| 16657 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 16658 | if (!spec->loopback.amplist) | ||
| 16659 | spec->loopback.amplist = alc861vd_loopbacks; | ||
| 16660 | #endif | ||
| 16661 | |||
| 16662 | return 0; | ||
| 16663 | } | ||
| 16664 | |||
| 16665 | /* | ||
| 16666 | * ALC662 support | ||
| 16667 | * | ||
| 16668 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | ||
| 16669 | * configuration. Each pin widget can choose any input DACs and a mixer. | ||
| 16670 | * Each ADC is connected from a mixer of all inputs. This makes possible | ||
| 16671 | * 6-channel independent captures. | ||
| 16672 | * | ||
| 16673 | * In addition, an independent DAC for the multi-playback (not used in this | ||
| 16674 | * driver yet). | ||
| 16675 | */ | ||
| 16676 | #define ALC662_DIGOUT_NID 0x06 | ||
| 16677 | #define ALC662_DIGIN_NID 0x0a | ||
| 16678 | |||
| 16679 | static hda_nid_t alc662_dac_nids[4] = { | ||
| 16680 | /* front, rear, clfe, rear_surr */ | ||
| 16681 | 0x02, 0x03, 0x04 | ||
| 16682 | }; | ||
| 16683 | |||
| 16684 | static hda_nid_t alc272_dac_nids[2] = { | ||
| 16685 | 0x02, 0x03 | ||
| 16686 | }; | ||
| 16687 | |||
| 16688 | static hda_nid_t alc662_adc_nids[2] = { | ||
| 16689 | /* ADC1-2 */ | ||
| 16690 | 0x09, 0x08 | ||
| 16691 | }; | ||
| 16692 | |||
| 16693 | static hda_nid_t alc272_adc_nids[1] = { | ||
| 16694 | /* ADC1-2 */ | ||
| 16695 | 0x08, | ||
| 16696 | }; | ||
| 16697 | |||
| 16698 | static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 }; | ||
| 16699 | static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; | ||
| 16700 | |||
| 16701 | |||
| 16702 | /* input MUX */ | ||
| 16703 | /* FIXME: should be a matrix-type input source selection */ | ||
| 16704 | static struct hda_input_mux alc662_capture_source = { | ||
| 16705 | .num_items = 4, | ||
| 16706 | .items = { | ||
| 16707 | { "Mic", 0x0 }, | ||
| 16708 | { "Front Mic", 0x1 }, | ||
| 16709 | { "Line", 0x2 }, | ||
| 16710 | { "CD", 0x4 }, | ||
| 16711 | }, | ||
| 16712 | }; | ||
| 16713 | |||
| 16714 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { | ||
| 16715 | .num_items = 2, | ||
| 16716 | .items = { | ||
| 16717 | { "Mic", 0x1 }, | ||
| 16718 | { "Line", 0x2 }, | ||
| 16719 | }, | ||
| 16720 | }; | ||
| 16721 | |||
| 16722 | static struct hda_input_mux alc663_capture_source = { | ||
| 16723 | .num_items = 3, | ||
| 16724 | .items = { | ||
| 16725 | { "Mic", 0x0 }, | ||
| 16726 | { "Front Mic", 0x1 }, | ||
| 16727 | { "Line", 0x2 }, | ||
| 16728 | }, | ||
| 16729 | }; | ||
| 16730 | |||
| 16731 | #if 0 /* set to 1 for testing other input sources below */ | ||
| 16732 | static struct hda_input_mux alc272_nc10_capture_source = { | ||
| 16733 | .num_items = 16, | ||
| 16734 | .items = { | ||
| 16735 | { "Autoselect Mic", 0x0 }, | ||
| 16736 | { "Internal Mic", 0x1 }, | ||
| 16737 | { "In-0x02", 0x2 }, | ||
| 16738 | { "In-0x03", 0x3 }, | ||
| 16739 | { "In-0x04", 0x4 }, | ||
| 16740 | { "In-0x05", 0x5 }, | ||
| 16741 | { "In-0x06", 0x6 }, | ||
| 16742 | { "In-0x07", 0x7 }, | ||
| 16743 | { "In-0x08", 0x8 }, | ||
| 16744 | { "In-0x09", 0x9 }, | ||
| 16745 | { "In-0x0a", 0x0a }, | ||
| 16746 | { "In-0x0b", 0x0b }, | ||
| 16747 | { "In-0x0c", 0x0c }, | ||
| 16748 | { "In-0x0d", 0x0d }, | ||
| 16749 | { "In-0x0e", 0x0e }, | ||
| 16750 | { "In-0x0f", 0x0f }, | ||
| 16751 | }, | ||
| 16752 | }; | ||
| 16753 | #endif | ||
| 16754 | |||
| 16755 | /* | ||
| 16756 | * 2ch mode | ||
| 16757 | */ | ||
| 16758 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { | ||
| 16759 | { 2, NULL } | ||
| 16760 | }; | ||
| 16761 | |||
| 16762 | /* | ||
| 16763 | * 2ch mode | ||
| 16764 | */ | ||
| 16765 | static struct hda_verb alc662_3ST_ch2_init[] = { | ||
| 16766 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
| 16767 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 16768 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | ||
| 16769 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
| 16770 | { } /* end */ | ||
| 16771 | }; | ||
| 16772 | |||
| 16773 | /* | ||
| 16774 | * 6ch mode | ||
| 16775 | */ | ||
| 16776 | static struct hda_verb alc662_3ST_ch6_init[] = { | ||
| 16777 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16778 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 16779 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
| 16780 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16781 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
| 16782 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
| 16783 | { } /* end */ | ||
| 16784 | }; | ||
| 16785 | |||
| 16786 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { | ||
| 16787 | { 2, alc662_3ST_ch2_init }, | ||
| 16788 | { 6, alc662_3ST_ch6_init }, | ||
| 16789 | }; | ||
| 16790 | |||
| 16791 | /* | ||
| 16792 | * 2ch mode | ||
| 16793 | */ | ||
| 16794 | static struct hda_verb alc662_sixstack_ch6_init[] = { | ||
| 16795 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 16796 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, | ||
| 16797 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16798 | { } /* end */ | ||
| 16799 | }; | ||
| 16800 | |||
| 16801 | /* | ||
| 16802 | * 6ch mode | ||
| 16803 | */ | ||
| 16804 | static struct hda_verb alc662_sixstack_ch8_init[] = { | ||
| 16805 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16806 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16807 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
| 16808 | { } /* end */ | ||
| 16809 | }; | ||
| 16810 | |||
| 16811 | static struct hda_channel_mode alc662_5stack_modes[2] = { | ||
| 16812 | { 2, alc662_sixstack_ch6_init }, | ||
| 16813 | { 6, alc662_sixstack_ch8_init }, | ||
| 16814 | }; | ||
| 16815 | |||
| 16816 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 | ||
| 16817 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b | ||
| 16818 | */ | ||
| 16819 | |||
| 16820 | static struct snd_kcontrol_new alc662_base_mixer[] = { | ||
| 16821 | /* output mixer control */ | ||
| 16822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | ||
| 16823 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
| 16824 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), | ||
| 16825 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | ||
| 16826 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
| 16827 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
| 16828 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | ||
| 16829 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | ||
| 16830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 16831 | |||
| 16832 | /*Input mixer control */ | ||
| 16833 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), | ||
| 16834 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), | ||
| 16835 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), | ||
| 16836 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), | ||
| 16837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), | ||
| 16838 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), | ||
| 16839 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), | ||
| 16840 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), | ||
| 16841 | { } /* end */ | ||
| 16842 | }; | ||
| 16843 | |||
| 16844 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | ||
| 16845 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16846 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
| 16847 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 16848 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 16849 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 16850 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 16851 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 16852 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16853 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16854 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16855 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16856 | { } /* end */ | ||
| 16857 | }; | ||
| 16858 | |||
| 16859 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | ||
| 16860 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16861 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), | ||
| 16862 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 16863 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), | ||
| 16864 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
| 16865 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
| 16866 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), | ||
| 16867 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), | ||
| 16868 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 16869 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
| 16870 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
| 16871 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 16872 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 16873 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16874 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16875 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16876 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16877 | { } /* end */ | ||
| 16878 | }; | ||
| 16879 | |||
| 16880 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { | ||
| 16881 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16882 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), | ||
| 16883 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 16884 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), | ||
| 16885 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 16886 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 16887 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 16888 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16889 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16890 | { } /* end */ | ||
| 16891 | }; | ||
| 16892 | |||
| 16893 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { | ||
| 16894 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16895 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 16896 | |||
| 16897 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 16898 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16899 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16900 | |||
| 16901 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 16902 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16903 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16904 | { } /* end */ | ||
| 16905 | }; | ||
| 16906 | |||
| 16907 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | ||
| 16908 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 16909 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16910 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 16911 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), | ||
| 16912 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), | ||
| 16913 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 16914 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 16915 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 16916 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16917 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16918 | { } /* end */ | ||
| 16919 | }; | ||
| 16920 | |||
| 16921 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | ||
| 16922 | .ops = &snd_hda_bind_vol, | ||
| 16923 | .values = { | ||
| 16924 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
| 16925 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
| 16926 | 0 | ||
| 16927 | }, | ||
| 16928 | }; | ||
| 16929 | |||
| 16930 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | ||
| 16931 | .ops = &snd_hda_bind_sw, | ||
| 16932 | .values = { | ||
| 16933 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 16934 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
| 16935 | 0 | ||
| 16936 | }, | ||
| 16937 | }; | ||
| 16938 | |||
| 16939 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | ||
| 16940 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
| 16941 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | ||
| 16942 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16944 | { } /* end */ | ||
| 16945 | }; | ||
| 16946 | |||
| 16947 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | ||
| 16948 | .ops = &snd_hda_bind_sw, | ||
| 16949 | .values = { | ||
| 16950 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 16951 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
| 16952 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
| 16953 | 0 | ||
| 16954 | }, | ||
| 16955 | }; | ||
| 16956 | |||
| 16957 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | ||
| 16958 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
| 16959 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | ||
| 16960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16962 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16963 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16964 | |||
| 16965 | { } /* end */ | ||
| 16966 | }; | ||
| 16967 | |||
| 16968 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | ||
| 16969 | .ops = &snd_hda_bind_sw, | ||
| 16970 | .values = { | ||
| 16971 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 16972 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
| 16973 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
| 16974 | 0 | ||
| 16975 | }, | ||
| 16976 | }; | ||
| 16977 | |||
| 16978 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | ||
| 16979 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
| 16980 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | ||
| 16981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16982 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16983 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16984 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16985 | { } /* end */ | ||
| 16986 | }; | ||
| 16987 | |||
| 16988 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | ||
| 16989 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 16990 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 16991 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 16992 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 16993 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 16994 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 16995 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 16996 | { } /* end */ | ||
| 16997 | }; | ||
| 16998 | |||
| 16999 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | ||
| 17000 | .ops = &snd_hda_bind_vol, | ||
| 17001 | .values = { | ||
| 17002 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
| 17003 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | ||
| 17004 | 0 | ||
| 17005 | }, | ||
| 17006 | }; | ||
| 17007 | |||
| 17008 | static struct hda_bind_ctls alc663_asus_two_bind_switch = { | ||
| 17009 | .ops = &snd_hda_bind_sw, | ||
| 17010 | .values = { | ||
| 17011 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 17012 | HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT), | ||
| 17013 | 0 | ||
| 17014 | }, | ||
| 17015 | }; | ||
| 17016 | |||
| 17017 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | ||
| 17018 | HDA_BIND_VOL("Master Playback Volume", | ||
| 17019 | &alc663_asus_two_bind_master_vol), | ||
| 17020 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
| 17021 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 17022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17023 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17024 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17025 | { } /* end */ | ||
| 17026 | }; | ||
| 17027 | |||
| 17028 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | ||
| 17029 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
| 17030 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
| 17031 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 17032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 17033 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17034 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17035 | { } /* end */ | ||
| 17036 | }; | ||
| 17037 | |||
| 17038 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { | ||
| 17039 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 17040 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 17041 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 17042 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 17043 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17044 | |||
| 17045 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17046 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17047 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 17048 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 17049 | { } /* end */ | ||
| 17050 | }; | ||
| 17051 | |||
| 17052 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { | ||
| 17053 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 17054 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 17055 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17056 | |||
| 17057 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17058 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17059 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 17060 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 17061 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
| 17062 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
| 17063 | { } /* end */ | ||
| 17064 | }; | ||
| 17065 | |||
| 17066 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | ||
| 17067 | .ops = &snd_hda_bind_sw, | ||
| 17068 | .values = { | ||
| 17069 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 17070 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
| 17071 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
| 17072 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
| 17073 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
| 17074 | 0 | ||
| 17075 | }, | ||
| 17076 | }; | ||
| 17077 | |||
| 17078 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | ||
| 17079 | .ops = &snd_hda_bind_sw, | ||
| 17080 | .values = { | ||
| 17081 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
| 17082 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
| 17083 | 0 | ||
| 17084 | }, | ||
| 17085 | }; | ||
| 17086 | |||
| 17087 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | ||
| 17088 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
| 17089 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
| 17090 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
| 17091 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
| 17092 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17093 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17094 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17095 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 17096 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 17097 | { } /* end */ | ||
| 17098 | }; | ||
| 17099 | |||
| 17100 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | ||
| 17101 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
| 17102 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
| 17103 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
| 17104 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 17105 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17106 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17107 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17108 | { } /* end */ | ||
| 17109 | }; | ||
| 17110 | |||
| 17111 | |||
| 17112 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | ||
| 17113 | { | ||
| 17114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
| 17115 | .name = "Channel Mode", | ||
| 17116 | .info = alc_ch_mode_info, | ||
| 17117 | .get = alc_ch_mode_get, | ||
| 17118 | .put = alc_ch_mode_put, | ||
| 17119 | }, | ||
| 17120 | { } /* end */ | ||
| 17121 | }; | ||
| 17122 | |||
| 17123 | static struct hda_verb alc662_init_verbs[] = { | ||
| 17124 | /* ADC: mute amp left and right */ | ||
| 17125 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17126 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 17127 | |||
| 17128 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17129 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17130 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17131 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17132 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17133 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17134 | |||
| 17135 | /* Front Pin: output 0 (0x0c) */ | ||
| 17136 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17137 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17138 | |||
| 17139 | /* Rear Pin: output 1 (0x0d) */ | ||
| 17140 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17141 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17142 | |||
| 17143 | /* CLFE Pin: output 2 (0x0e) */ | ||
| 17144 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17145 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17146 | |||
| 17147 | /* Mic (rear) pin: input vref at 80% */ | ||
| 17148 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 17149 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 17150 | /* Front Mic pin: input vref at 80% */ | ||
| 17151 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
| 17152 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 17153 | /* Line In pin: input */ | ||
| 17154 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17155 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 17156 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ | ||
| 17157 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17158 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17159 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 17160 | /* CD pin widget for input */ | ||
| 17161 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17162 | |||
| 17163 | /* FIXME: use matrix-type input source selection */ | ||
| 17164 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | ||
| 17165 | /* Input mixer */ | ||
| 17166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17167 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17168 | |||
| 17169 | /* always trun on EAPD */ | ||
| 17170 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 17171 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
| 17172 | |||
| 17173 | { } | ||
| 17174 | }; | ||
| 17175 | |||
| 17176 | static struct hda_verb alc663_init_verbs[] = { | ||
| 17177 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17178 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17179 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17180 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17181 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17182 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17183 | { } | ||
| 17184 | }; | ||
| 17185 | |||
| 17186 | static struct hda_verb alc272_init_verbs[] = { | ||
| 17187 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17188 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
| 17189 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17190 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17191 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17192 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17193 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 17194 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17195 | { } | ||
| 17196 | }; | ||
| 17197 | |||
| 17198 | static struct hda_verb alc662_sue_init_verbs[] = { | ||
| 17199 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | ||
| 17200 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | ||
| 17201 | {} | ||
| 17202 | }; | ||
| 17203 | |||
| 17204 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { | ||
| 17205 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17206 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17207 | {} | ||
| 17208 | }; | ||
| 17209 | |||
| 17210 | /* Set Unsolicited Event*/ | ||
| 17211 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { | ||
| 17212 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17213 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17214 | {} | ||
| 17215 | }; | ||
| 17216 | |||
| 17217 | static struct hda_verb alc663_m51va_init_verbs[] = { | ||
| 17218 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17219 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17220 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17221 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17222 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17223 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17224 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
| 17225 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17226 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17227 | {} | ||
| 17228 | }; | ||
| 17229 | |||
| 17230 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { | ||
| 17231 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17232 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17233 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17234 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17235 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17236 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17237 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17238 | {} | ||
| 17239 | }; | ||
| 17240 | |||
| 17241 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | ||
| 17242 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17243 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17244 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17245 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
| 17246 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17247 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17248 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17249 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17250 | {} | ||
| 17251 | }; | ||
| 17252 | |||
| 17253 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | ||
| 17254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17255 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17256 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17257 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17258 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17259 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17260 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17261 | {} | ||
| 17262 | }; | ||
| 17263 | |||
| 17264 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | ||
| 17265 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17266 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17267 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17268 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
| 17269 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17270 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17271 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
| 17272 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17273 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17274 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17275 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17276 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17277 | {} | ||
| 17278 | }; | ||
| 17279 | |||
| 17280 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | ||
| 17281 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17282 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17283 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17284 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17285 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17286 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17288 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 17290 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17291 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17292 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17293 | {} | ||
| 17294 | }; | ||
| 17295 | |||
| 17296 | static struct hda_verb alc663_g71v_init_verbs[] = { | ||
| 17297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17298 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ | ||
| 17299 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ | ||
| 17300 | |||
| 17301 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17302 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17303 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
| 17304 | |||
| 17305 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, | ||
| 17306 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, | ||
| 17307 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, | ||
| 17308 | {} | ||
| 17309 | }; | ||
| 17310 | |||
| 17311 | static struct hda_verb alc663_g50v_init_verbs[] = { | ||
| 17312 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17313 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17314 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
| 17315 | |||
| 17316 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17317 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17318 | {} | ||
| 17319 | }; | ||
| 17320 | |||
| 17321 | static struct hda_verb alc662_ecs_init_verbs[] = { | ||
| 17322 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | ||
| 17323 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17324 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17325 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17326 | {} | ||
| 17327 | }; | ||
| 17328 | |||
| 17329 | static struct hda_verb alc272_dell_zm1_init_verbs[] = { | ||
| 17330 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17331 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17332 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17333 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17334 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17335 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17336 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17337 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17338 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
| 17339 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17340 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17341 | {} | ||
| 17342 | }; | ||
| 17343 | |||
| 17344 | static struct hda_verb alc272_dell_init_verbs[] = { | ||
| 17345 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17346 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17348 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17349 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17350 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17351 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17352 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17353 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
| 17354 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17355 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17356 | {} | ||
| 17357 | }; | ||
| 17358 | |||
| 17359 | static struct hda_verb alc663_mode7_init_verbs[] = { | ||
| 17360 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17361 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17362 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17363 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17364 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17365 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17366 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 17367 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17368 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17369 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
| 17372 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17373 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17374 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17375 | {} | ||
| 17376 | }; | ||
| 17377 | |||
| 17378 | static struct hda_verb alc663_mode8_init_verbs[] = { | ||
| 17379 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17380 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17381 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17382 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
| 17383 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17384 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
| 17385 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17386 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
| 17387 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 17388 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 17389 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
| 17390 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
| 17391 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
| 17392 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17393 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
| 17394 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
| 17395 | {} | ||
| 17396 | }; | ||
| 17397 | |||
| 17398 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | ||
| 17399 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
| 17400 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
| 17401 | { } /* end */ | ||
| 17402 | }; | ||
| 17403 | |||
| 17404 | static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { | ||
| 17405 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
| 17406 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
| 17407 | { } /* end */ | ||
| 17408 | }; | ||
| 17409 | |||
| 17410 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | ||
| 17411 | { | ||
| 17412 | unsigned int present; | ||
| 17413 | unsigned char bits; | ||
| 17414 | |||
| 17415 | present = snd_hda_jack_detect(codec, 0x14); | ||
| 17416 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17417 | |||
| 17418 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 17419 | HDA_AMP_MUTE, bits); | ||
| 17420 | } | ||
| 17421 | |||
| 17422 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) | ||
| 17423 | { | ||
| 17424 | unsigned int present; | ||
| 17425 | unsigned char bits; | ||
| 17426 | |||
| 17427 | present = snd_hda_jack_detect(codec, 0x1b); | ||
| 17428 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17429 | |||
| 17430 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 17431 | HDA_AMP_MUTE, bits); | ||
| 17432 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 17433 | HDA_AMP_MUTE, bits); | ||
| 17434 | } | ||
| 17435 | |||
| 17436 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, | ||
| 17437 | unsigned int res) | ||
| 17438 | { | ||
| 17439 | if ((res >> 26) == ALC880_HP_EVENT) | ||
| 17440 | alc662_lenovo_101e_all_automute(codec); | ||
| 17441 | if ((res >> 26) == ALC880_FRONT_EVENT) | ||
| 17442 | alc662_lenovo_101e_ispeaker_automute(codec); | ||
| 17443 | } | ||
| 17444 | |||
| 17445 | /* unsolicited event for HP jack sensing */ | ||
| 17446 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, | ||
| 17447 | unsigned int res) | ||
| 17448 | { | ||
| 17449 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
| 17450 | alc_mic_automute(codec); | ||
| 17451 | else | ||
| 17452 | alc262_hippo_unsol_event(codec, res); | ||
| 17453 | } | ||
| 17454 | |||
| 17455 | static void alc662_eeepc_setup(struct hda_codec *codec) | ||
| 17456 | { | ||
| 17457 | struct alc_spec *spec = codec->spec; | ||
| 17458 | |||
| 17459 | alc262_hippo1_setup(codec); | ||
| 17460 | spec->ext_mic.pin = 0x18; | ||
| 17461 | spec->ext_mic.mux_idx = 0; | ||
| 17462 | spec->int_mic.pin = 0x19; | ||
| 17463 | spec->int_mic.mux_idx = 1; | ||
| 17464 | spec->auto_mic = 1; | ||
| 17465 | } | ||
| 17466 | |||
| 17467 | static void alc662_eeepc_inithook(struct hda_codec *codec) | ||
| 17468 | { | ||
| 17469 | alc262_hippo_automute(codec); | ||
| 17470 | alc_mic_automute(codec); | ||
| 17471 | } | ||
| 17472 | |||
| 17473 | static void alc662_eeepc_ep20_setup(struct hda_codec *codec) | ||
| 17474 | { | ||
| 17475 | struct alc_spec *spec = codec->spec; | ||
| 17476 | |||
| 17477 | spec->autocfg.hp_pins[0] = 0x14; | ||
| 17478 | spec->autocfg.speaker_pins[0] = 0x1b; | ||
| 17479 | } | ||
| 17480 | |||
| 17481 | #define alc662_eeepc_ep20_inithook alc262_hippo_master_update | ||
| 17482 | |||
| 17483 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) | ||
| 17484 | { | ||
| 17485 | unsigned int present; | ||
| 17486 | unsigned char bits; | ||
| 17487 | |||
| 17488 | present = snd_hda_jack_detect(codec, 0x21); | ||
| 17489 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17490 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 17491 | HDA_AMP_MUTE, bits); | ||
| 17492 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 17493 | HDA_AMP_MUTE, bits); | ||
| 17494 | } | ||
| 17495 | |||
| 17496 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | ||
| 17497 | { | ||
| 17498 | unsigned int present; | ||
| 17499 | unsigned char bits; | ||
| 17500 | |||
| 17501 | present = snd_hda_jack_detect(codec, 0x21); | ||
| 17502 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17503 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 17504 | HDA_AMP_MUTE, bits); | ||
| 17505 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 17506 | HDA_AMP_MUTE, bits); | ||
| 17507 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
| 17508 | HDA_AMP_MUTE, bits); | ||
| 17509 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
| 17510 | HDA_AMP_MUTE, bits); | ||
| 17511 | } | ||
| 17512 | |||
| 17513 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | ||
| 17514 | { | ||
| 17515 | unsigned int present; | ||
| 17516 | unsigned char bits; | ||
| 17517 | |||
| 17518 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 17519 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17520 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 17521 | HDA_AMP_MUTE, bits); | ||
| 17522 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 17523 | HDA_AMP_MUTE, bits); | ||
| 17524 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
| 17525 | HDA_AMP_MUTE, bits); | ||
| 17526 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
| 17527 | HDA_AMP_MUTE, bits); | ||
| 17528 | } | ||
| 17529 | |||
| 17530 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | ||
| 17531 | { | ||
| 17532 | unsigned int present; | ||
| 17533 | unsigned char bits; | ||
| 17534 | |||
| 17535 | present = snd_hda_jack_detect(codec, 0x1b); | ||
| 17536 | bits = present ? 0 : PIN_OUT; | ||
| 17537 | snd_hda_codec_write(codec, 0x14, 0, | ||
| 17538 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | ||
| 17539 | } | ||
| 17540 | |||
| 17541 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | ||
| 17542 | { | ||
| 17543 | unsigned int present1, present2; | ||
| 17544 | |||
| 17545 | present1 = snd_hda_jack_detect(codec, 0x21); | ||
| 17546 | present2 = snd_hda_jack_detect(codec, 0x15); | ||
| 17547 | |||
| 17548 | if (present1 || present2) { | ||
| 17549 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17550 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 17551 | } else { | ||
| 17552 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17553 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 17554 | } | ||
| 17555 | } | ||
| 17556 | |||
| 17557 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | ||
| 17558 | { | ||
| 17559 | unsigned int present1, present2; | ||
| 17560 | |||
| 17561 | present1 = snd_hda_jack_detect(codec, 0x1b); | ||
| 17562 | present2 = snd_hda_jack_detect(codec, 0x15); | ||
| 17563 | |||
| 17564 | if (present1 || present2) { | ||
| 17565 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 17566 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 17567 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 17568 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
| 17569 | } else { | ||
| 17570 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
| 17571 | HDA_AMP_MUTE, 0); | ||
| 17572 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
| 17573 | HDA_AMP_MUTE, 0); | ||
| 17574 | } | ||
| 17575 | } | ||
| 17576 | |||
| 17577 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | ||
| 17578 | { | ||
| 17579 | unsigned int present1, present2; | ||
| 17580 | |||
| 17581 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | ||
| 17582 | AC_VERB_GET_PIN_SENSE, 0) | ||
| 17583 | & AC_PINSENSE_PRESENCE; | ||
| 17584 | present2 = snd_hda_codec_read(codec, 0x21, 0, | ||
| 17585 | AC_VERB_GET_PIN_SENSE, 0) | ||
| 17586 | & AC_PINSENSE_PRESENCE; | ||
| 17587 | |||
| 17588 | if (present1 || present2) { | ||
| 17589 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17590 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 17591 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
| 17592 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 17593 | } else { | ||
| 17594 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17595 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 17596 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
| 17597 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 17598 | } | ||
| 17599 | } | ||
| 17600 | |||
| 17601 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | ||
| 17602 | { | ||
| 17603 | unsigned int present1, present2; | ||
| 17604 | |||
| 17605 | present1 = snd_hda_codec_read(codec, 0x21, 0, | ||
| 17606 | AC_VERB_GET_PIN_SENSE, 0) | ||
| 17607 | & AC_PINSENSE_PRESENCE; | ||
| 17608 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
| 17609 | AC_VERB_GET_PIN_SENSE, 0) | ||
| 17610 | & AC_PINSENSE_PRESENCE; | ||
| 17611 | |||
| 17612 | if (present1 || present2) { | ||
| 17613 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17614 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 17615 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
| 17616 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
| 17617 | } else { | ||
| 17618 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
| 17619 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 17620 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
| 17621 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
| 17622 | } | ||
| 17623 | } | ||
| 17624 | |||
| 17625 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | ||
| 17626 | unsigned int res) | ||
| 17627 | { | ||
| 17628 | switch (res >> 26) { | ||
| 17629 | case ALC880_HP_EVENT: | ||
| 17630 | alc663_m51va_speaker_automute(codec); | ||
| 17631 | break; | ||
| 17632 | case ALC880_MIC_EVENT: | ||
| 17633 | alc_mic_automute(codec); | ||
| 17634 | break; | ||
| 17635 | } | ||
| 17636 | } | ||
| 17637 | |||
| 17638 | static void alc663_m51va_setup(struct hda_codec *codec) | ||
| 17639 | { | ||
| 17640 | struct alc_spec *spec = codec->spec; | ||
| 17641 | spec->ext_mic.pin = 0x18; | ||
| 17642 | spec->ext_mic.mux_idx = 0; | ||
| 17643 | spec->int_mic.pin = 0x12; | ||
| 17644 | spec->int_mic.mux_idx = 9; | ||
| 17645 | spec->auto_mic = 1; | ||
| 17646 | } | ||
| 17647 | |||
| 17648 | static void alc663_m51va_inithook(struct hda_codec *codec) | ||
| 17649 | { | ||
| 17650 | alc663_m51va_speaker_automute(codec); | ||
| 17651 | alc_mic_automute(codec); | ||
| 17652 | } | ||
| 17653 | |||
| 17654 | /* ***************** Mode1 ******************************/ | ||
| 17655 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | ||
| 17656 | |||
| 17657 | static void alc663_mode1_setup(struct hda_codec *codec) | ||
| 17658 | { | ||
| 17659 | struct alc_spec *spec = codec->spec; | ||
| 17660 | spec->ext_mic.pin = 0x18; | ||
| 17661 | spec->ext_mic.mux_idx = 0; | ||
| 17662 | spec->int_mic.pin = 0x19; | ||
| 17663 | spec->int_mic.mux_idx = 1; | ||
| 17664 | spec->auto_mic = 1; | ||
| 17665 | } | ||
| 17666 | |||
| 17667 | #define alc663_mode1_inithook alc663_m51va_inithook | ||
| 17668 | |||
| 17669 | /* ***************** Mode2 ******************************/ | ||
| 17670 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | ||
| 17671 | unsigned int res) | ||
| 17672 | { | ||
| 17673 | switch (res >> 26) { | ||
| 17674 | case ALC880_HP_EVENT: | ||
| 17675 | alc662_f5z_speaker_automute(codec); | ||
| 17676 | break; | ||
| 17677 | case ALC880_MIC_EVENT: | ||
| 17678 | alc_mic_automute(codec); | ||
| 17679 | break; | ||
| 17680 | } | ||
| 17681 | } | ||
| 17682 | |||
| 17683 | #define alc662_mode2_setup alc663_mode1_setup | ||
| 17684 | |||
| 17685 | static void alc662_mode2_inithook(struct hda_codec *codec) | ||
| 17686 | { | ||
| 17687 | alc662_f5z_speaker_automute(codec); | ||
| 17688 | alc_mic_automute(codec); | ||
| 17689 | } | ||
| 17690 | /* ***************** Mode3 ******************************/ | ||
| 17691 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | ||
| 17692 | unsigned int res) | ||
| 17693 | { | ||
| 17694 | switch (res >> 26) { | ||
| 17695 | case ALC880_HP_EVENT: | ||
| 17696 | alc663_two_hp_m1_speaker_automute(codec); | ||
| 17697 | break; | ||
| 17698 | case ALC880_MIC_EVENT: | ||
| 17699 | alc_mic_automute(codec); | ||
| 17700 | break; | ||
| 17701 | } | ||
| 17702 | } | ||
| 17703 | |||
| 17704 | #define alc663_mode3_setup alc663_mode1_setup | ||
| 17705 | |||
| 17706 | static void alc663_mode3_inithook(struct hda_codec *codec) | ||
| 17707 | { | ||
| 17708 | alc663_two_hp_m1_speaker_automute(codec); | ||
| 17709 | alc_mic_automute(codec); | ||
| 17710 | } | ||
| 17711 | /* ***************** Mode4 ******************************/ | ||
| 17712 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | ||
| 17713 | unsigned int res) | ||
| 17714 | { | ||
| 17715 | switch (res >> 26) { | ||
| 17716 | case ALC880_HP_EVENT: | ||
| 17717 | alc663_21jd_two_speaker_automute(codec); | ||
| 17718 | break; | ||
| 17719 | case ALC880_MIC_EVENT: | ||
| 17720 | alc_mic_automute(codec); | ||
| 17721 | break; | ||
| 17722 | } | ||
| 17723 | } | ||
| 17724 | |||
| 17725 | #define alc663_mode4_setup alc663_mode1_setup | ||
| 17726 | |||
| 17727 | static void alc663_mode4_inithook(struct hda_codec *codec) | ||
| 17728 | { | ||
| 17729 | alc663_21jd_two_speaker_automute(codec); | ||
| 17730 | alc_mic_automute(codec); | ||
| 17731 | } | ||
| 17732 | /* ***************** Mode5 ******************************/ | ||
| 17733 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | ||
| 17734 | unsigned int res) | ||
| 17735 | { | ||
| 17736 | switch (res >> 26) { | ||
| 17737 | case ALC880_HP_EVENT: | ||
| 17738 | alc663_15jd_two_speaker_automute(codec); | ||
| 17739 | break; | ||
| 17740 | case ALC880_MIC_EVENT: | ||
| 17741 | alc_mic_automute(codec); | ||
| 17742 | break; | ||
| 17743 | } | ||
| 17744 | } | ||
| 17745 | |||
| 17746 | #define alc663_mode5_setup alc663_mode1_setup | ||
| 17747 | |||
| 17748 | static void alc663_mode5_inithook(struct hda_codec *codec) | ||
| 17749 | { | ||
| 17750 | alc663_15jd_two_speaker_automute(codec); | ||
| 17751 | alc_mic_automute(codec); | ||
| 17752 | } | ||
| 17753 | /* ***************** Mode6 ******************************/ | ||
| 17754 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | ||
| 17755 | unsigned int res) | ||
| 17756 | { | ||
| 17757 | switch (res >> 26) { | ||
| 17758 | case ALC880_HP_EVENT: | ||
| 17759 | alc663_two_hp_m2_speaker_automute(codec); | ||
| 17760 | break; | ||
| 17761 | case ALC880_MIC_EVENT: | ||
| 17762 | alc_mic_automute(codec); | ||
| 17763 | break; | ||
| 17764 | } | ||
| 17765 | } | ||
| 17766 | |||
| 17767 | #define alc663_mode6_setup alc663_mode1_setup | ||
| 17768 | |||
| 17769 | static void alc663_mode6_inithook(struct hda_codec *codec) | ||
| 17770 | { | ||
| 17771 | alc663_two_hp_m2_speaker_automute(codec); | ||
| 17772 | alc_mic_automute(codec); | ||
| 17773 | } | ||
| 17774 | |||
| 17775 | /* ***************** Mode7 ******************************/ | ||
| 17776 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | ||
| 17777 | unsigned int res) | ||
| 17778 | { | ||
| 17779 | switch (res >> 26) { | ||
| 17780 | case ALC880_HP_EVENT: | ||
| 17781 | alc663_two_hp_m7_speaker_automute(codec); | ||
| 17782 | break; | ||
| 17783 | case ALC880_MIC_EVENT: | ||
| 17784 | alc_mic_automute(codec); | ||
| 17785 | break; | ||
| 17786 | } | ||
| 17787 | } | ||
| 17788 | |||
| 17789 | #define alc663_mode7_setup alc663_mode1_setup | ||
| 17790 | |||
| 17791 | static void alc663_mode7_inithook(struct hda_codec *codec) | ||
| 17792 | { | ||
| 17793 | alc663_two_hp_m7_speaker_automute(codec); | ||
| 17794 | alc_mic_automute(codec); | ||
| 17795 | } | ||
| 17796 | |||
| 17797 | /* ***************** Mode8 ******************************/ | ||
| 17798 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | ||
| 17799 | unsigned int res) | ||
| 17800 | { | ||
| 17801 | switch (res >> 26) { | ||
| 17802 | case ALC880_HP_EVENT: | ||
| 17803 | alc663_two_hp_m8_speaker_automute(codec); | ||
| 17804 | break; | ||
| 17805 | case ALC880_MIC_EVENT: | ||
| 17806 | alc_mic_automute(codec); | ||
| 17807 | break; | ||
| 17808 | } | ||
| 17809 | } | ||
| 17810 | |||
| 17811 | #define alc663_mode8_setup alc663_m51va_setup | ||
| 17812 | |||
| 17813 | static void alc663_mode8_inithook(struct hda_codec *codec) | ||
| 17814 | { | ||
| 17815 | alc663_two_hp_m8_speaker_automute(codec); | ||
| 17816 | alc_mic_automute(codec); | ||
| 17817 | } | ||
| 17818 | |||
| 17819 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | ||
| 17820 | { | ||
| 17821 | unsigned int present; | ||
| 17822 | unsigned char bits; | ||
| 17823 | |||
| 17824 | present = snd_hda_jack_detect(codec, 0x21); | ||
| 17825 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17826 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
| 17827 | HDA_AMP_MUTE, bits); | ||
| 17828 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 17829 | HDA_AMP_MUTE, bits); | ||
| 17830 | } | ||
| 17831 | |||
| 17832 | static void alc663_g71v_front_automute(struct hda_codec *codec) | ||
| 17833 | { | ||
| 17834 | unsigned int present; | ||
| 17835 | unsigned char bits; | ||
| 17836 | |||
| 17837 | present = snd_hda_jack_detect(codec, 0x15); | ||
| 17838 | bits = present ? HDA_AMP_MUTE : 0; | ||
| 17839 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
| 17840 | HDA_AMP_MUTE, bits); | ||
| 17841 | } | ||
| 17842 | |||
| 17843 | static void alc663_g71v_unsol_event(struct hda_codec *codec, | ||
| 17844 | unsigned int res) | ||
| 17845 | { | ||
| 17846 | switch (res >> 26) { | ||
| 17847 | case ALC880_HP_EVENT: | ||
| 17848 | alc663_g71v_hp_automute(codec); | ||
| 17849 | break; | ||
| 17850 | case ALC880_FRONT_EVENT: | ||
| 17851 | alc663_g71v_front_automute(codec); | ||
| 17852 | break; | ||
| 17853 | case ALC880_MIC_EVENT: | ||
| 17854 | alc_mic_automute(codec); | ||
| 17855 | break; | ||
| 17856 | } | ||
| 17857 | } | ||
| 17858 | |||
| 17859 | #define alc663_g71v_setup alc663_m51va_setup | ||
| 17860 | |||
| 17861 | static void alc663_g71v_inithook(struct hda_codec *codec) | ||
| 17862 | { | ||
| 17863 | alc663_g71v_front_automute(codec); | ||
| 17864 | alc663_g71v_hp_automute(codec); | ||
| 17865 | alc_mic_automute(codec); | ||
| 17866 | } | ||
| 17867 | |||
| 17868 | static void alc663_g50v_unsol_event(struct hda_codec *codec, | ||
| 17869 | unsigned int res) | ||
| 17870 | { | ||
| 17871 | switch (res >> 26) { | ||
| 17872 | case ALC880_HP_EVENT: | ||
| 17873 | alc663_m51va_speaker_automute(codec); | ||
| 17874 | break; | ||
| 17875 | case ALC880_MIC_EVENT: | ||
| 17876 | alc_mic_automute(codec); | ||
| 17877 | break; | ||
| 17878 | } | ||
| 17879 | } | ||
| 17880 | |||
| 17881 | #define alc663_g50v_setup alc663_m51va_setup | ||
| 17882 | |||
| 17883 | static void alc663_g50v_inithook(struct hda_codec *codec) | ||
| 17884 | { | ||
| 17885 | alc663_m51va_speaker_automute(codec); | ||
| 17886 | alc_mic_automute(codec); | ||
| 17887 | } | ||
| 17888 | |||
| 17889 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | ||
| 17890 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 17891 | ALC262_HIPPO_MASTER_SWITCH, | ||
| 17892 | |||
| 17893 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | ||
| 17894 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17895 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17896 | |||
| 17897 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 17898 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 17899 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 17900 | { } /* end */ | ||
| 17901 | }; | ||
| 17902 | |||
| 17903 | static struct snd_kcontrol_new alc272_nc10_mixer[] = { | ||
| 17904 | /* Master Playback automatically created from Speaker and Headphone */ | ||
| 17905 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
| 17906 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
| 17907 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
| 17908 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
| 17909 | |||
| 17910 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
| 17911 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
| 17912 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), | ||
| 17913 | |||
| 17914 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
| 17915 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
| 17916 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | ||
| 17917 | { } /* end */ | ||
| 17918 | }; | ||
| 17919 | |||
| 17920 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 17921 | #define alc662_loopbacks alc880_loopbacks | ||
| 17922 | #endif | ||
| 17923 | |||
| 17924 | |||
| 17925 | /* pcm configuration: identical with ALC880 */ | ||
| 17926 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback | ||
| 17927 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture | ||
| 17928 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback | ||
| 17929 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture | ||
| 17930 | |||
| 17931 | /* | ||
| 17932 | * configuration and preset | ||
| 17933 | */ | ||
| 17934 | static const char *alc662_models[ALC662_MODEL_LAST] = { | ||
| 17935 | [ALC662_3ST_2ch_DIG] = "3stack-dig", | ||
| 17936 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", | ||
| 17937 | [ALC662_3ST_6ch] = "3stack-6ch", | ||
| 17938 | [ALC662_5ST_DIG] = "6stack-dig", | ||
| 17939 | [ALC662_LENOVO_101E] = "lenovo-101e", | ||
| 17940 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | ||
| 17941 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | ||
| 17942 | [ALC662_ECS] = "ecs", | ||
| 17943 | [ALC663_ASUS_M51VA] = "m51va", | ||
| 17944 | [ALC663_ASUS_G71V] = "g71v", | ||
| 17945 | [ALC663_ASUS_H13] = "h13", | ||
| 17946 | [ALC663_ASUS_G50V] = "g50v", | ||
| 17947 | [ALC663_ASUS_MODE1] = "asus-mode1", | ||
| 17948 | [ALC662_ASUS_MODE2] = "asus-mode2", | ||
| 17949 | [ALC663_ASUS_MODE3] = "asus-mode3", | ||
| 17950 | [ALC663_ASUS_MODE4] = "asus-mode4", | ||
| 17951 | [ALC663_ASUS_MODE5] = "asus-mode5", | ||
| 17952 | [ALC663_ASUS_MODE6] = "asus-mode6", | ||
| 17953 | [ALC663_ASUS_MODE7] = "asus-mode7", | ||
| 17954 | [ALC663_ASUS_MODE8] = "asus-mode8", | ||
| 17955 | [ALC272_DELL] = "dell", | ||
| 17956 | [ALC272_DELL_ZM1] = "dell-zm1", | ||
| 17957 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | ||
| 17958 | [ALC662_AUTO] = "auto", | ||
| 17959 | }; | ||
| 17960 | |||
| 17961 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | ||
| 17962 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | ||
| 17963 | SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), | ||
| 17964 | SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), | ||
| 17965 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | ||
| 17966 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | ||
| 17967 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1), | ||
| 17968 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | ||
| 17969 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | ||
| 17970 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17971 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | ||
| 17972 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | ||
| 17973 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | ||
| 17974 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17975 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | ||
| 17976 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | ||
| 17977 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | ||
| 17978 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | ||
| 17979 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | ||
| 17980 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17981 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | ||
| 17982 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | ||
| 17983 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17984 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | ||
| 17985 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | ||
| 17986 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17987 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | ||
| 17988 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | ||
| 17989 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | ||
| 17990 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | ||
| 17991 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17992 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | ||
| 17993 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | ||
| 17994 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17995 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), | ||
| 17996 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17997 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 17998 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | ||
| 17999 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ | ||
| 18000 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | ||
| 18001 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | ||
| 18002 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), | ||
| 18003 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1), | ||
| 18004 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), | ||
| 18005 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), | ||
| 18006 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | ||
| 18007 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | ||
| 18008 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
| 18009 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), | ||
| 18010 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | ||
| 18011 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
| 18012 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), | ||
| 18013 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
| 18014 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | ||
| 18015 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | ||
| 18016 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | ||
| 18017 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
| 18018 | SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), | ||
| 18019 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
| 18020 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | ||
| 18021 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | ||
| 18022 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | ||
| 18023 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | ||
| 18024 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | ||
| 18025 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | ||
| 18026 | ALC662_3ST_6ch_DIG), | ||
| 18027 | SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), | ||
| 18028 | SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), | ||
| 18029 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | ||
| 18030 | ALC662_3ST_6ch_DIG), | ||
| 18031 | SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13), | ||
| 18032 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | ||
| 18033 | SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), | ||
| 18034 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | ||
| 18035 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | ||
| 18036 | ALC662_3ST_6ch_DIG), | ||
| 18037 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", | ||
| 18038 | ALC663_ASUS_H13), | ||
| 18039 | {} | ||
| 18040 | }; | ||
| 18041 | |||
| 18042 | static struct alc_config_preset alc662_presets[] = { | ||
| 18043 | [ALC662_3ST_2ch_DIG] = { | ||
| 18044 | .mixers = { alc662_3ST_2ch_mixer }, | ||
| 18045 | .init_verbs = { alc662_init_verbs }, | ||
| 18046 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18047 | .dac_nids = alc662_dac_nids, | ||
| 18048 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18049 | .dig_in_nid = ALC662_DIGIN_NID, | ||
| 18050 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18051 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18052 | .input_mux = &alc662_capture_source, | ||
| 18053 | }, | ||
| 18054 | [ALC662_3ST_6ch_DIG] = { | ||
| 18055 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | ||
| 18056 | .init_verbs = { alc662_init_verbs }, | ||
| 18057 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18058 | .dac_nids = alc662_dac_nids, | ||
| 18059 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18060 | .dig_in_nid = ALC662_DIGIN_NID, | ||
| 18061 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
| 18062 | .channel_mode = alc662_3ST_6ch_modes, | ||
| 18063 | .need_dac_fix = 1, | ||
| 18064 | .input_mux = &alc662_capture_source, | ||
| 18065 | }, | ||
| 18066 | [ALC662_3ST_6ch] = { | ||
| 18067 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer }, | ||
| 18068 | .init_verbs = { alc662_init_verbs }, | ||
| 18069 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18070 | .dac_nids = alc662_dac_nids, | ||
| 18071 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
| 18072 | .channel_mode = alc662_3ST_6ch_modes, | ||
| 18073 | .need_dac_fix = 1, | ||
| 18074 | .input_mux = &alc662_capture_source, | ||
| 18075 | }, | ||
| 18076 | [ALC662_5ST_DIG] = { | ||
| 18077 | .mixers = { alc662_base_mixer, alc662_chmode_mixer }, | ||
| 18078 | .init_verbs = { alc662_init_verbs }, | ||
| 18079 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18080 | .dac_nids = alc662_dac_nids, | ||
| 18081 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18082 | .dig_in_nid = ALC662_DIGIN_NID, | ||
| 18083 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | ||
| 18084 | .channel_mode = alc662_5stack_modes, | ||
| 18085 | .input_mux = &alc662_capture_source, | ||
| 18086 | }, | ||
| 18087 | [ALC662_LENOVO_101E] = { | ||
| 18088 | .mixers = { alc662_lenovo_101e_mixer }, | ||
| 18089 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | ||
| 18090 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18091 | .dac_nids = alc662_dac_nids, | ||
| 18092 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18093 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18094 | .input_mux = &alc662_lenovo_101e_capture_source, | ||
| 18095 | .unsol_event = alc662_lenovo_101e_unsol_event, | ||
| 18096 | .init_hook = alc662_lenovo_101e_all_automute, | ||
| 18097 | }, | ||
| 18098 | [ALC662_ASUS_EEEPC_P701] = { | ||
| 18099 | .mixers = { alc662_eeepc_p701_mixer }, | ||
| 18100 | .init_verbs = { alc662_init_verbs, | ||
| 18101 | alc662_eeepc_sue_init_verbs }, | ||
| 18102 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18103 | .dac_nids = alc662_dac_nids, | ||
| 18104 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18105 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18106 | .unsol_event = alc662_eeepc_unsol_event, | ||
| 18107 | .setup = alc662_eeepc_setup, | ||
| 18108 | .init_hook = alc662_eeepc_inithook, | ||
| 18109 | }, | ||
| 18110 | [ALC662_ASUS_EEEPC_EP20] = { | ||
| 18111 | .mixers = { alc662_eeepc_ep20_mixer, | ||
| 18112 | alc662_chmode_mixer }, | ||
| 18113 | .init_verbs = { alc662_init_verbs, | ||
| 18114 | alc662_eeepc_ep20_sue_init_verbs }, | ||
| 18115 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18116 | .dac_nids = alc662_dac_nids, | ||
| 18117 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
| 18118 | .channel_mode = alc662_3ST_6ch_modes, | ||
| 18119 | .input_mux = &alc662_lenovo_101e_capture_source, | ||
| 18120 | .unsol_event = alc662_eeepc_unsol_event, | ||
| 18121 | .setup = alc662_eeepc_ep20_setup, | ||
| 18122 | .init_hook = alc662_eeepc_ep20_inithook, | ||
| 18123 | }, | ||
| 18124 | [ALC662_ECS] = { | ||
| 18125 | .mixers = { alc662_ecs_mixer }, | ||
| 18126 | .init_verbs = { alc662_init_verbs, | ||
| 18127 | alc662_ecs_init_verbs }, | ||
| 18128 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18129 | .dac_nids = alc662_dac_nids, | ||
| 18130 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18131 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18132 | .unsol_event = alc662_eeepc_unsol_event, | ||
| 18133 | .setup = alc662_eeepc_setup, | ||
| 18134 | .init_hook = alc662_eeepc_inithook, | ||
| 18135 | }, | ||
| 18136 | [ALC663_ASUS_M51VA] = { | ||
| 18137 | .mixers = { alc663_m51va_mixer }, | ||
| 18138 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | ||
| 18139 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18140 | .dac_nids = alc662_dac_nids, | ||
| 18141 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18142 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18143 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18144 | .unsol_event = alc663_m51va_unsol_event, | ||
| 18145 | .setup = alc663_m51va_setup, | ||
| 18146 | .init_hook = alc663_m51va_inithook, | ||
| 18147 | }, | ||
| 18148 | [ALC663_ASUS_G71V] = { | ||
| 18149 | .mixers = { alc663_g71v_mixer }, | ||
| 18150 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, | ||
| 18151 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18152 | .dac_nids = alc662_dac_nids, | ||
| 18153 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18154 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18155 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18156 | .unsol_event = alc663_g71v_unsol_event, | ||
| 18157 | .setup = alc663_g71v_setup, | ||
| 18158 | .init_hook = alc663_g71v_inithook, | ||
| 18159 | }, | ||
| 18160 | [ALC663_ASUS_H13] = { | ||
| 18161 | .mixers = { alc663_m51va_mixer }, | ||
| 18162 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | ||
| 18163 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18164 | .dac_nids = alc662_dac_nids, | ||
| 18165 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18166 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18167 | .unsol_event = alc663_m51va_unsol_event, | ||
| 18168 | .init_hook = alc663_m51va_inithook, | ||
| 18169 | }, | ||
| 18170 | [ALC663_ASUS_G50V] = { | ||
| 18171 | .mixers = { alc663_g50v_mixer }, | ||
| 18172 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, | ||
| 18173 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18174 | .dac_nids = alc662_dac_nids, | ||
| 18175 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18176 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | ||
| 18177 | .channel_mode = alc662_3ST_6ch_modes, | ||
| 18178 | .input_mux = &alc663_capture_source, | ||
| 18179 | .unsol_event = alc663_g50v_unsol_event, | ||
| 18180 | .setup = alc663_g50v_setup, | ||
| 18181 | .init_hook = alc663_g50v_inithook, | ||
| 18182 | }, | ||
| 18183 | [ALC663_ASUS_MODE1] = { | ||
| 18184 | .mixers = { alc663_m51va_mixer }, | ||
| 18185 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18186 | .init_verbs = { alc662_init_verbs, | ||
| 18187 | alc663_21jd_amic_init_verbs }, | ||
| 18188 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18189 | .hp_nid = 0x03, | ||
| 18190 | .dac_nids = alc662_dac_nids, | ||
| 18191 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18192 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18193 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18194 | .unsol_event = alc663_mode1_unsol_event, | ||
| 18195 | .setup = alc663_mode1_setup, | ||
| 18196 | .init_hook = alc663_mode1_inithook, | ||
| 18197 | }, | ||
| 18198 | [ALC662_ASUS_MODE2] = { | ||
| 18199 | .mixers = { alc662_1bjd_mixer }, | ||
| 18200 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18201 | .init_verbs = { alc662_init_verbs, | ||
| 18202 | alc662_1bjd_amic_init_verbs }, | ||
| 18203 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18204 | .dac_nids = alc662_dac_nids, | ||
| 18205 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18206 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18207 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18208 | .unsol_event = alc662_mode2_unsol_event, | ||
| 18209 | .setup = alc662_mode2_setup, | ||
| 18210 | .init_hook = alc662_mode2_inithook, | ||
| 18211 | }, | ||
| 18212 | [ALC663_ASUS_MODE3] = { | ||
| 18213 | .mixers = { alc663_two_hp_m1_mixer }, | ||
| 18214 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18215 | .init_verbs = { alc662_init_verbs, | ||
| 18216 | alc663_two_hp_amic_m1_init_verbs }, | ||
| 18217 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18218 | .hp_nid = 0x03, | ||
| 18219 | .dac_nids = alc662_dac_nids, | ||
| 18220 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18221 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18222 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18223 | .unsol_event = alc663_mode3_unsol_event, | ||
| 18224 | .setup = alc663_mode3_setup, | ||
| 18225 | .init_hook = alc663_mode3_inithook, | ||
| 18226 | }, | ||
| 18227 | [ALC663_ASUS_MODE4] = { | ||
| 18228 | .mixers = { alc663_asus_21jd_clfe_mixer }, | ||
| 18229 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18230 | .init_verbs = { alc662_init_verbs, | ||
| 18231 | alc663_21jd_amic_init_verbs}, | ||
| 18232 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18233 | .hp_nid = 0x03, | ||
| 18234 | .dac_nids = alc662_dac_nids, | ||
| 18235 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18236 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18237 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18238 | .unsol_event = alc663_mode4_unsol_event, | ||
| 18239 | .setup = alc663_mode4_setup, | ||
| 18240 | .init_hook = alc663_mode4_inithook, | ||
| 18241 | }, | ||
| 18242 | [ALC663_ASUS_MODE5] = { | ||
| 18243 | .mixers = { alc663_asus_15jd_clfe_mixer }, | ||
| 18244 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18245 | .init_verbs = { alc662_init_verbs, | ||
| 18246 | alc663_15jd_amic_init_verbs }, | ||
| 18247 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18248 | .hp_nid = 0x03, | ||
| 18249 | .dac_nids = alc662_dac_nids, | ||
| 18250 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18251 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18252 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18253 | .unsol_event = alc663_mode5_unsol_event, | ||
| 18254 | .setup = alc663_mode5_setup, | ||
| 18255 | .init_hook = alc663_mode5_inithook, | ||
| 18256 | }, | ||
| 18257 | [ALC663_ASUS_MODE6] = { | ||
| 18258 | .mixers = { alc663_two_hp_m2_mixer }, | ||
| 18259 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18260 | .init_verbs = { alc662_init_verbs, | ||
| 18261 | alc663_two_hp_amic_m2_init_verbs }, | ||
| 18262 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18263 | .hp_nid = 0x03, | ||
| 18264 | .dac_nids = alc662_dac_nids, | ||
| 18265 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18266 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18267 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18268 | .unsol_event = alc663_mode6_unsol_event, | ||
| 18269 | .setup = alc663_mode6_setup, | ||
| 18270 | .init_hook = alc663_mode6_inithook, | ||
| 18271 | }, | ||
| 18272 | [ALC663_ASUS_MODE7] = { | ||
| 18273 | .mixers = { alc663_mode7_mixer }, | ||
| 18274 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18275 | .init_verbs = { alc662_init_verbs, | ||
| 18276 | alc663_mode7_init_verbs }, | ||
| 18277 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18278 | .hp_nid = 0x03, | ||
| 18279 | .dac_nids = alc662_dac_nids, | ||
| 18280 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18281 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18282 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18283 | .unsol_event = alc663_mode7_unsol_event, | ||
| 18284 | .setup = alc663_mode7_setup, | ||
| 18285 | .init_hook = alc663_mode7_inithook, | ||
| 18286 | }, | ||
| 18287 | [ALC663_ASUS_MODE8] = { | ||
| 18288 | .mixers = { alc663_mode8_mixer }, | ||
| 18289 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18290 | .init_verbs = { alc662_init_verbs, | ||
| 18291 | alc663_mode8_init_verbs }, | ||
| 18292 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
| 18293 | .hp_nid = 0x03, | ||
| 18294 | .dac_nids = alc662_dac_nids, | ||
| 18295 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
| 18296 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18297 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18298 | .unsol_event = alc663_mode8_unsol_event, | ||
| 18299 | .setup = alc663_mode8_setup, | ||
| 18300 | .init_hook = alc663_mode8_inithook, | ||
| 18301 | }, | ||
| 18302 | [ALC272_DELL] = { | ||
| 18303 | .mixers = { alc663_m51va_mixer }, | ||
| 18304 | .cap_mixer = alc272_auto_capture_mixer, | ||
| 18305 | .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, | ||
| 18306 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
| 18307 | .dac_nids = alc662_dac_nids, | ||
| 18308 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18309 | .adc_nids = alc272_adc_nids, | ||
| 18310 | .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), | ||
| 18311 | .capsrc_nids = alc272_capsrc_nids, | ||
| 18312 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18313 | .unsol_event = alc663_m51va_unsol_event, | ||
| 18314 | .setup = alc663_m51va_setup, | ||
| 18315 | .init_hook = alc663_m51va_inithook, | ||
| 18316 | }, | ||
| 18317 | [ALC272_DELL_ZM1] = { | ||
| 18318 | .mixers = { alc663_m51va_mixer }, | ||
| 18319 | .cap_mixer = alc662_auto_capture_mixer, | ||
| 18320 | .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, | ||
| 18321 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
| 18322 | .dac_nids = alc662_dac_nids, | ||
| 18323 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18324 | .adc_nids = alc662_adc_nids, | ||
| 18325 | .num_adc_nids = 1, | ||
| 18326 | .capsrc_nids = alc662_capsrc_nids, | ||
| 18327 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18328 | .unsol_event = alc663_m51va_unsol_event, | ||
| 18329 | .setup = alc663_m51va_setup, | ||
| 18330 | .init_hook = alc663_m51va_inithook, | ||
| 18331 | }, | ||
| 18332 | [ALC272_SAMSUNG_NC10] = { | ||
| 18333 | .mixers = { alc272_nc10_mixer }, | ||
| 18334 | .init_verbs = { alc662_init_verbs, | ||
| 18335 | alc663_21jd_amic_init_verbs }, | ||
| 18336 | .num_dacs = ARRAY_SIZE(alc272_dac_nids), | ||
| 18337 | .dac_nids = alc272_dac_nids, | ||
| 18338 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
| 18339 | .channel_mode = alc662_3ST_2ch_modes, | ||
| 18340 | /*.input_mux = &alc272_nc10_capture_source,*/ | ||
| 18341 | .unsol_event = alc663_mode4_unsol_event, | ||
| 18342 | .setup = alc663_mode4_setup, | ||
| 18343 | .init_hook = alc663_mode4_inithook, | ||
| 18344 | }, | ||
| 18345 | }; | ||
| 18346 | |||
| 18347 | |||
| 18348 | /* | ||
| 18349 | * BIOS auto configuration | ||
| 18350 | */ | ||
| 18351 | |||
| 18352 | /* convert from MIX nid to DAC */ | ||
| 18353 | static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) | ||
| 18354 | { | ||
| 18355 | if (nid == 0x0f) | ||
| 18356 | return 0x02; | ||
| 18357 | else if (nid >= 0x0c && nid <= 0x0e) | ||
| 18358 | return nid - 0x0c + 0x02; | ||
| 18359 | else | ||
| 18360 | return 0; | ||
| 18361 | } | ||
| 18362 | |||
| 18363 | /* get MIX nid connected to the given pin targeted to DAC */ | ||
| 18364 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, | ||
| 18365 | hda_nid_t dac) | ||
| 18366 | { | ||
| 18367 | hda_nid_t mix[4]; | ||
| 18368 | int i, num; | ||
| 18369 | |||
| 18370 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); | ||
| 18371 | for (i = 0; i < num; i++) { | ||
| 18372 | if (alc662_mix_to_dac(mix[i]) == dac) | ||
| 18373 | return mix[i]; | ||
| 18374 | } | ||
| 18375 | return 0; | ||
| 18376 | } | ||
| 18377 | |||
| 18378 | /* look for an empty DAC slot */ | ||
| 18379 | static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin) | ||
| 18380 | { | ||
| 18381 | struct alc_spec *spec = codec->spec; | ||
| 18382 | hda_nid_t srcs[5]; | ||
| 18383 | int i, j, num; | ||
| 18384 | |||
| 18385 | num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs)); | ||
| 18386 | if (num < 0) | ||
| 18387 | return 0; | ||
| 18388 | for (i = 0; i < num; i++) { | ||
| 18389 | hda_nid_t nid = alc662_mix_to_dac(srcs[i]); | ||
| 18390 | if (!nid) | ||
| 18391 | continue; | ||
| 18392 | for (j = 0; j < spec->multiout.num_dacs; j++) | ||
| 18393 | if (spec->multiout.dac_nids[j] == nid) | ||
| 18394 | break; | ||
| 18395 | if (j >= spec->multiout.num_dacs) | ||
| 18396 | return nid; | ||
| 18397 | } | ||
| 18398 | return 0; | ||
| 18399 | } | ||
| 18400 | |||
| 18401 | /* fill in the dac_nids table from the parsed pin configuration */ | ||
| 18402 | static int alc662_auto_fill_dac_nids(struct hda_codec *codec, | ||
| 18403 | const struct auto_pin_cfg *cfg) | ||
| 18404 | { | ||
| 18405 | struct alc_spec *spec = codec->spec; | ||
| 18406 | int i; | ||
| 18407 | hda_nid_t dac; | ||
| 18408 | |||
| 18409 | spec->multiout.dac_nids = spec->private_dac_nids; | ||
| 18410 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 18411 | dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]); | ||
| 18412 | if (!dac) | ||
| 18413 | continue; | ||
| 18414 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; | ||
| 18415 | } | ||
| 18416 | return 0; | ||
| 18417 | } | ||
| 18418 | |||
| 18419 | static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx, | ||
| 18420 | hda_nid_t nid, unsigned int chs) | ||
| 18421 | { | ||
| 18422 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, | ||
| 18423 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | ||
| 18424 | } | ||
| 18425 | |||
| 18426 | static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx, | ||
| 18427 | hda_nid_t nid, unsigned int chs) | ||
| 18428 | { | ||
| 18429 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | ||
| 18430 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT)); | ||
| 18431 | } | ||
| 18432 | |||
| 18433 | #define alc662_add_stereo_vol(spec, pfx, nid) \ | ||
| 18434 | alc662_add_vol_ctl(spec, pfx, nid, 3) | ||
| 18435 | #define alc662_add_stereo_sw(spec, pfx, nid) \ | ||
| 18436 | alc662_add_sw_ctl(spec, pfx, nid, 3) | ||
| 18437 | |||
| 18438 | /* add playback controls from the parsed DAC table */ | ||
| 18439 | static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec, | ||
| 18440 | const struct auto_pin_cfg *cfg) | ||
| 18441 | { | ||
| 18442 | struct alc_spec *spec = codec->spec; | ||
| 18443 | static const char *chname[4] = { | ||
| 18444 | "Front", "Surround", NULL /*CLFE*/, "Side" | ||
| 18445 | }; | ||
| 18446 | hda_nid_t nid, mix; | ||
| 18447 | int i, err; | ||
| 18448 | |||
| 18449 | for (i = 0; i < cfg->line_outs; i++) { | ||
| 18450 | nid = spec->multiout.dac_nids[i]; | ||
| 18451 | if (!nid) | ||
| 18452 | continue; | ||
| 18453 | mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid); | ||
| 18454 | if (!mix) | ||
| 18455 | continue; | ||
| 18456 | if (i == 2) { | ||
| 18457 | /* Center/LFE */ | ||
| 18458 | err = alc662_add_vol_ctl(spec, "Center", nid, 1); | ||
| 18459 | if (err < 0) | ||
| 18460 | return err; | ||
| 18461 | err = alc662_add_vol_ctl(spec, "LFE", nid, 2); | ||
| 18462 | if (err < 0) | ||
| 18463 | return err; | ||
| 18464 | err = alc662_add_sw_ctl(spec, "Center", mix, 1); | ||
| 18465 | if (err < 0) | ||
| 18466 | return err; | ||
| 18467 | err = alc662_add_sw_ctl(spec, "LFE", mix, 2); | ||
| 18468 | if (err < 0) | ||
| 18469 | return err; | ||
| 18470 | } else { | ||
| 18471 | const char *pfx; | ||
| 18472 | if (cfg->line_outs == 1 && | ||
| 18473 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { | ||
| 18474 | if (cfg->hp_outs) | ||
| 18475 | pfx = "Speaker"; | ||
| 18476 | else | ||
| 18477 | pfx = "PCM"; | ||
| 18478 | } else | ||
| 18479 | pfx = chname[i]; | ||
| 18480 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | ||
| 18481 | if (err < 0) | ||
| 18482 | return err; | ||
| 18483 | if (cfg->line_outs == 1 && | ||
| 18484 | cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
| 18485 | pfx = "Speaker"; | ||
| 18486 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | ||
| 18487 | if (err < 0) | ||
| 18488 | return err; | ||
| 18489 | } | ||
| 18490 | } | ||
| 18491 | return 0; | ||
| 18492 | } | ||
| 18493 | |||
| 18494 | /* add playback controls for speaker and HP outputs */ | ||
| 18495 | /* return DAC nid if any new DAC is assigned */ | ||
| 18496 | static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | ||
| 18497 | const char *pfx) | ||
| 18498 | { | ||
| 18499 | struct alc_spec *spec = codec->spec; | ||
| 18500 | hda_nid_t nid, mix; | ||
| 18501 | int err; | ||
| 18502 | |||
| 18503 | if (!pin) | ||
| 18504 | return 0; | ||
| 18505 | nid = alc662_look_for_dac(codec, pin); | ||
| 18506 | if (!nid) { | ||
| 18507 | /* the corresponding DAC is already occupied */ | ||
| 18508 | if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)) | ||
| 18509 | return 0; /* no way */ | ||
| 18510 | /* create a switch only */ | ||
| 18511 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, | ||
| 18512 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); | ||
| 18513 | } | ||
| 18514 | |||
| 18515 | mix = alc662_dac_to_mix(codec, pin, nid); | ||
| 18516 | if (!mix) | ||
| 18517 | return 0; | ||
| 18518 | err = alc662_add_vol_ctl(spec, pfx, nid, 3); | ||
| 18519 | if (err < 0) | ||
| 18520 | return err; | ||
| 18521 | err = alc662_add_sw_ctl(spec, pfx, mix, 3); | ||
| 18522 | if (err < 0) | ||
| 18523 | return err; | ||
| 18524 | return nid; | ||
| 18525 | } | ||
| 18526 | |||
| 18527 | /* create playback/capture controls for input pins */ | ||
| 18528 | #define alc662_auto_create_input_ctls \ | ||
| 18529 | alc882_auto_create_input_ctls | ||
| 18530 | |||
| 18531 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, | ||
| 18532 | hda_nid_t nid, int pin_type, | ||
| 18533 | hda_nid_t dac) | ||
| 18534 | { | ||
| 18535 | int i, num; | ||
| 18536 | hda_nid_t srcs[4]; | ||
| 18537 | |||
| 18538 | alc_set_pin_output(codec, nid, pin_type); | ||
| 18539 | /* need the manual connection? */ | ||
| 18540 | num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs)); | ||
| 18541 | if (num <= 1) | ||
| 18542 | return; | ||
| 18543 | for (i = 0; i < num; i++) { | ||
| 18544 | if (alc662_mix_to_dac(srcs[i]) != dac) | ||
| 18545 | continue; | ||
| 18546 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i); | ||
| 18547 | return; | ||
| 18548 | } | ||
| 18549 | } | ||
| 18550 | |||
| 18551 | static void alc662_auto_init_multi_out(struct hda_codec *codec) | ||
| 18552 | { | ||
| 18553 | struct alc_spec *spec = codec->spec; | ||
| 18554 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | ||
| 18555 | int i; | ||
| 18556 | |||
| 18557 | for (i = 0; i <= HDA_SIDE; i++) { | ||
| 18558 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | ||
| 18559 | if (nid) | ||
| 18560 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, | ||
| 18561 | spec->multiout.dac_nids[i]); | ||
| 18562 | } | ||
| 18563 | } | ||
| 18564 | |||
| 18565 | static void alc662_auto_init_hp_out(struct hda_codec *codec) | ||
| 18566 | { | ||
| 18567 | struct alc_spec *spec = codec->spec; | ||
| 18568 | hda_nid_t pin; | ||
| 18569 | |||
| 18570 | pin = spec->autocfg.hp_pins[0]; | ||
| 18571 | if (pin) | ||
| 18572 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, | ||
| 18573 | spec->multiout.hp_nid); | ||
| 18574 | pin = spec->autocfg.speaker_pins[0]; | ||
| 18575 | if (pin) | ||
| 18576 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, | ||
| 18577 | spec->multiout.extra_out_nid[0]); | ||
| 18578 | } | ||
| 18579 | |||
| 18580 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | ||
| 18581 | |||
| 18582 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | ||
| 18583 | { | ||
| 18584 | struct alc_spec *spec = codec->spec; | ||
| 18585 | int i; | ||
| 18586 | |||
| 18587 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
| 18588 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
| 18589 | if (alc_is_input_pin(codec, nid)) { | ||
| 18590 | alc_set_input_pin(codec, nid, i); | ||
| 18591 | if (nid != ALC662_PIN_CD_NID && | ||
| 18592 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) | ||
| 18593 | snd_hda_codec_write(codec, nid, 0, | ||
| 18594 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
| 18595 | AMP_OUT_MUTE); | ||
| 18596 | } | ||
| 18597 | } | ||
| 18598 | } | ||
| 18599 | |||
| 18600 | #define alc662_auto_init_input_src alc882_auto_init_input_src | ||
| 18601 | |||
| 18602 | static int alc662_parse_auto_config(struct hda_codec *codec) | ||
| 18603 | { | ||
| 18604 | struct alc_spec *spec = codec->spec; | ||
| 18605 | int err; | ||
| 18606 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; | ||
| 18607 | |||
| 18608 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | ||
| 18609 | alc662_ignore); | ||
| 18610 | if (err < 0) | ||
| 18611 | return err; | ||
| 18612 | if (!spec->autocfg.line_outs) | ||
| 18613 | return 0; /* can't find valid BIOS pin config */ | ||
| 18614 | |||
| 18615 | err = alc662_auto_fill_dac_nids(codec, &spec->autocfg); | ||
| 18616 | if (err < 0) | ||
| 18617 | return err; | ||
| 18618 | err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg); | ||
| 18619 | if (err < 0) | ||
| 18620 | return err; | ||
| 18621 | err = alc662_auto_create_extra_out(codec, | ||
| 18622 | spec->autocfg.speaker_pins[0], | ||
| 18623 | "Speaker"); | ||
| 18624 | if (err < 0) | ||
| 18625 | return err; | ||
| 18626 | if (err) | ||
| 18627 | spec->multiout.extra_out_nid[0] = err; | ||
| 18628 | err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], | ||
| 18629 | "Headphone"); | ||
| 18630 | if (err < 0) | ||
| 18631 | return err; | ||
| 18632 | if (err) | ||
| 18633 | spec->multiout.hp_nid = err; | ||
| 18634 | err = alc662_auto_create_input_ctls(codec, &spec->autocfg); | ||
| 18635 | if (err < 0) | ||
| 18636 | return err; | ||
| 18637 | |||
| 18638 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | ||
| 18639 | |||
| 18640 | if (spec->autocfg.dig_outs) | ||
| 18641 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | ||
| 18642 | |||
| 18643 | if (spec->kctls.list) | ||
| 18644 | add_mixer(spec, spec->kctls.list); | ||
| 18645 | |||
| 18646 | spec->num_mux_defs = 1; | ||
| 18647 | spec->input_mux = &spec->private_imux[0]; | ||
| 18648 | |||
| 18649 | add_verb(spec, alc662_init_verbs); | ||
| 18650 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | ||
| 18651 | codec->vendor_id == 0x10ec0665) | ||
| 18652 | add_verb(spec, alc663_init_verbs); | ||
| 18653 | |||
| 18654 | if (codec->vendor_id == 0x10ec0272) | ||
| 18655 | add_verb(spec, alc272_init_verbs); | ||
| 18656 | |||
| 18657 | err = alc_auto_add_mic_boost(codec); | ||
| 18658 | if (err < 0) | ||
| 18659 | return err; | ||
| 18660 | |||
| 18661 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || | ||
| 18662 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) | ||
| 18663 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); | ||
| 18664 | else | ||
| 18665 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | ||
| 18666 | |||
| 18667 | return 1; | ||
| 18668 | } | ||
| 18669 | |||
| 18670 | /* additional initialization for auto-configuration model */ | ||
| 18671 | static void alc662_auto_init(struct hda_codec *codec) | ||
| 18672 | { | ||
| 18673 | struct alc_spec *spec = codec->spec; | ||
| 18674 | alc662_auto_init_multi_out(codec); | ||
| 18675 | alc662_auto_init_hp_out(codec); | ||
| 18676 | alc662_auto_init_analog_input(codec); | ||
| 18677 | alc662_auto_init_input_src(codec); | ||
| 18678 | if (spec->unsol_event) | ||
| 18679 | alc_inithook(codec); | ||
| 18680 | } | ||
| 18681 | |||
| 18682 | static int patch_alc662(struct hda_codec *codec) | ||
| 18683 | { | ||
| 18684 | struct alc_spec *spec; | ||
| 18685 | int err, board_config; | ||
| 18686 | |||
| 18687 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
| 18688 | if (!spec) | ||
| 18689 | return -ENOMEM; | ||
| 18690 | |||
| 18691 | codec->spec = spec; | ||
| 18692 | |||
| 18693 | alc_auto_parse_customize_define(codec); | ||
| 18694 | |||
| 18695 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | ||
| 18696 | |||
| 18697 | if (alc_read_coef_idx(codec, 0) == 0x8020) | ||
| 18698 | alc_codec_rename(codec, "ALC661"); | ||
| 18699 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && | ||
| 18700 | codec->bus->pci->subsystem_vendor == 0x1025 && | ||
| 18701 | spec->cdefine.platform_type == 1) | ||
| 18702 | alc_codec_rename(codec, "ALC272X"); | ||
| 18703 | |||
| 18704 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | ||
| 18705 | alc662_models, | ||
| 18706 | alc662_cfg_tbl); | ||
| 18707 | if (board_config < 0) { | ||
| 18708 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
| 18709 | codec->chip_name); | ||
| 18710 | board_config = ALC662_AUTO; | ||
| 18711 | } | ||
| 18712 | |||
| 18713 | if (board_config == ALC662_AUTO) { | ||
| 18714 | /* automatic parse from the BIOS config */ | ||
| 18715 | err = alc662_parse_auto_config(codec); | ||
| 18716 | if (err < 0) { | ||
| 18717 | alc_free(codec); | ||
| 18718 | return err; | ||
| 18719 | } else if (!err) { | ||
| 18720 | printk(KERN_INFO | ||
| 18721 | "hda_codec: Cannot set up configuration " | ||
| 18722 | "from BIOS. Using base mode...\n"); | ||
| 18723 | board_config = ALC662_3ST_2ch_DIG; | ||
| 18724 | } | ||
| 18725 | } | ||
| 18726 | |||
| 18727 | if (has_cdefine_beep(codec)) { | ||
| 18728 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
| 18729 | if (err < 0) { | ||
| 18730 | alc_free(codec); | ||
| 18731 | return err; | ||
| 18732 | } | ||
| 18733 | } | ||
| 18734 | |||
| 18735 | if (board_config != ALC662_AUTO) | ||
| 18736 | setup_preset(codec, &alc662_presets[board_config]); | ||
| 18737 | |||
| 18738 | spec->stream_analog_playback = &alc662_pcm_analog_playback; | ||
| 18739 | spec->stream_analog_capture = &alc662_pcm_analog_capture; | ||
| 18740 | |||
| 18741 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | ||
| 18742 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | ||
| 18743 | |||
| 18744 | if (!spec->adc_nids) { | ||
| 18745 | spec->adc_nids = alc662_adc_nids; | ||
| 18746 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | ||
| 18747 | } | ||
| 18748 | if (!spec->capsrc_nids) | ||
| 18749 | spec->capsrc_nids = alc662_capsrc_nids; | ||
| 18750 | |||
| 18751 | if (!spec->cap_mixer) | ||
| 18752 | set_capture_mixer(codec); | ||
| 18753 | |||
| 18754 | if (has_cdefine_beep(codec)) { | ||
| 18755 | switch (codec->vendor_id) { | ||
| 18756 | case 0x10ec0662: | ||
| 18757 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
| 18758 | break; | ||
| 18759 | case 0x10ec0272: | ||
| 18760 | case 0x10ec0663: | ||
| 18761 | case 0x10ec0665: | ||
| 18762 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | ||
| 18763 | break; | ||
| 18764 | case 0x10ec0273: | ||
| 18765 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | ||
| 18766 | break; | ||
| 18767 | } | ||
| 18768 | } | ||
| 18769 | spec->vmaster_nid = 0x02; | ||
| 18770 | |||
| 18771 | codec->patch_ops = alc_patch_ops; | ||
| 18772 | if (board_config == ALC662_AUTO) | ||
| 18773 | spec->init_hook = alc662_auto_init; | ||
| 18774 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
| 18775 | if (!spec->loopback.amplist) | ||
| 18776 | spec->loopback.amplist = alc662_loopbacks; | ||
| 18777 | #endif | ||
| 18778 | |||
| 18779 | return 0; | ||
| 18780 | } | ||
| 18781 | |||
| 18782 | static int patch_alc888(struct hda_codec *codec) | ||
| 18783 | { | ||
| 18784 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ | ||
| 18785 | kfree(codec->chip_name); | ||
| 18786 | codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); | ||
| 18787 | if (!codec->chip_name) { | ||
| 18788 | alc_free(codec); | ||
| 18789 | return -ENOMEM; | ||
| 18790 | } | ||
| 18791 | return patch_alc662(codec); | ||
| 18792 | } | ||
| 18793 | return patch_alc882(codec); | ||
| 18794 | } | ||
| 18795 | |||
| 18796 | /* | ||
| 18797 | * patch entries | ||
| 18798 | */ | ||
| 18799 | static struct hda_codec_preset snd_hda_preset_realtek[] = { | ||
| 18800 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, | ||
| 18801 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, | ||
| 18802 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | ||
| 18803 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | ||
| 18804 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | ||
| 18805 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | ||
| 18806 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | ||
| 18807 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | ||
| 18808 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | ||
| 18809 | .patch = patch_alc861 }, | ||
| 18810 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | ||
| 18811 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | ||
| 18812 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | ||
| 18813 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", | ||
| 18814 | .patch = patch_alc882 }, | ||
| 18815 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", | ||
| 18816 | .patch = patch_alc662 }, | ||
| 18817 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, | ||
| 18818 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, | ||
| 18819 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, | ||
| 18820 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | ||
| 18821 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | ||
| 18822 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, | ||
| 18823 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | ||
| 18824 | .patch = patch_alc882 }, | ||
| 18825 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | ||
| 18826 | .patch = patch_alc882 }, | ||
| 18827 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | ||
| 18828 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, | ||
| 18829 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", | ||
| 18830 | .patch = patch_alc882 }, | ||
| 18831 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, | ||
| 18832 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, | ||
| 18833 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, | ||
| 18834 | {} /* terminator */ | ||
| 18835 | }; | ||
| 18836 | |||
| 18837 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | ||
| 18838 | |||
| 18839 | MODULE_LICENSE("GPL"); | ||
| 18840 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | ||
| 18841 | |||
| 18842 | static struct hda_codec_preset_list realtek_list = { | ||
| 18843 | .preset = snd_hda_preset_realtek, | ||
| 18844 | .owner = THIS_MODULE, | ||
| 18845 | }; | ||
| 18846 | |||
| 18847 | static int __init patch_realtek_init(void) | ||
| 18848 | { | ||
| 18849 | return snd_hda_add_codec_preset(&realtek_list); | ||
| 18850 | } | ||
| 18851 | |||
| 18852 | static void __exit patch_realtek_exit(void) | ||
| 18853 | { | ||
| 18854 | snd_hda_delete_codec_preset(&realtek_list); | ||
| 18855 | } | ||
| 18856 | |||
| 18857 | module_init(patch_realtek_init) | ||
| 18858 | module_exit(patch_realtek_exit) | ||
