linux/sound/pci/hda/alc882_quirks.c
<<
>>
Prefs
   1/*
   2 * ALC882/ALC883/ALC888/ALC889 quirk models
   3 * included by patch_realtek.c
   4 */
   5
   6/* ALC882 models */
   7enum {
   8        ALC882_AUTO,
   9        ALC882_3ST_DIG,
  10        ALC882_6ST_DIG,
  11        ALC882_ARIMA,
  12        ALC882_W2JC,
  13        ALC882_TARGA,
  14        ALC882_ASUS_A7J,
  15        ALC882_ASUS_A7M,
  16        ALC885_MACPRO,
  17        ALC885_MBA21,
  18        ALC885_MBP3,
  19        ALC885_MB5,
  20        ALC885_MACMINI3,
  21        ALC885_IMAC24,
  22        ALC885_IMAC91,
  23        ALC883_3ST_2ch_DIG,
  24        ALC883_3ST_6ch_DIG,
  25        ALC883_3ST_6ch,
  26        ALC883_6ST_DIG,
  27        ALC883_TARGA_DIG,
  28        ALC883_TARGA_2ch_DIG,
  29        ALC883_TARGA_8ch_DIG,
  30        ALC883_ACER,
  31        ALC883_ACER_ASPIRE,
  32        ALC888_ACER_ASPIRE_4930G,
  33        ALC888_ACER_ASPIRE_6530G,
  34        ALC888_ACER_ASPIRE_8930G,
  35        ALC888_ACER_ASPIRE_7730G,
  36        ALC883_MEDION,
  37        ALC883_MEDION_WIM2160,
  38        ALC883_LAPTOP_EAPD,
  39        ALC883_LENOVO_101E_2ch,
  40        ALC883_LENOVO_NB0763,
  41        ALC888_LENOVO_MS7195_DIG,
  42        ALC888_LENOVO_SKY,
  43        ALC883_HAIER_W66,
  44        ALC888_3ST_HP,
  45        ALC888_6ST_DELL,
  46        ALC883_MITAC,
  47        ALC883_CLEVO_M540R,
  48        ALC883_CLEVO_M720,
  49        ALC883_FUJITSU_PI2515,
  50        ALC888_FUJITSU_XA3530,
  51        ALC883_3ST_6ch_INTEL,
  52        ALC889A_INTEL,
  53        ALC889_INTEL,
  54        ALC888_ASUS_M90V,
  55        ALC888_ASUS_EEE1601,
  56        ALC889A_MB31,
  57        ALC1200_ASUS_P5Q,
  58        ALC883_SONY_VAIO_TT,
  59        ALC882_MODEL_LAST,
  60};
  61
  62/*
  63 * 2ch mode
  64 */
  65static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
  66/* Mic-in jack as mic in */
  67        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
  68        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
  69/* Line-in jack as Line in */
  70        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
  71        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
  72/* Line-Out as Front */
  73        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
  74        { } /* end */
  75};
  76
  77/*
  78 * 4ch mode
  79 */
  80static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
  81/* Mic-in jack as mic in */
  82        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
  83        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
  84/* Line-in jack as Surround */
  85        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
  86        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
  87/* Line-Out as Front */
  88        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
  89        { } /* end */
  90};
  91
  92/*
  93 * 6ch mode
  94 */
  95static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
  96/* Mic-in jack as CLFE */
  97        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
  98        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
  99/* Line-in jack as Surround */
 100        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 101        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 102/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
 103        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
 104        { } /* end */
 105};
 106
 107/*
 108 * 8ch mode
 109 */
 110static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
 111/* Mic-in jack as CLFE */
 112        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 113        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 114/* Line-in jack as Surround */
 115        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 116        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 117/* Line-Out as Side */
 118        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
 119        { } /* end */
 120};
 121
 122static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
 123        { 2, alc888_4ST_ch2_intel_init },
 124        { 4, alc888_4ST_ch4_intel_init },
 125        { 6, alc888_4ST_ch6_intel_init },
 126        { 8, alc888_4ST_ch8_intel_init },
 127};
 128
 129/*
 130 * ALC888 Fujitsu Siemens Amillo xa3530
 131 */
 132
 133static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
 134/* Front Mic: set to PIN_IN (empty by default) */
 135        {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 136/* Connect Internal HP to Front */
 137        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 138        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 139        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
 140/* Connect Bass HP to Front */
 141        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 142        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 143        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
 144/* Connect Line-Out side jack (SPDIF) to Side */
 145        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 146        {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 147        {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
 148/* Connect Mic jack to CLFE */
 149        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 150        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 151        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
 152/* Connect Line-in jack to Surround */
 153        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 154        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 155        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
 156/* Connect HP out jack to Front */
 157        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 158        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 159        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
 160/* Enable unsolicited event for HP jack and Line-out jack */
 161        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 162        {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 163        {}
 164};
 165
 166static void alc889_automute_setup(struct hda_codec *codec)
 167{
 168        struct alc_spec *spec = codec->spec;
 169
 170        spec->autocfg.hp_pins[0] = 0x15;
 171        spec->autocfg.speaker_pins[0] = 0x14;
 172        spec->autocfg.speaker_pins[1] = 0x16;
 173        spec->autocfg.speaker_pins[2] = 0x17;
 174        spec->autocfg.speaker_pins[3] = 0x19;
 175        spec->autocfg.speaker_pins[4] = 0x1a;
 176        spec->automute = 1;
 177        spec->automute_mode = ALC_AUTOMUTE_AMP;
 178}
 179
 180static void alc889_intel_init_hook(struct hda_codec *codec)
 181{
 182        alc889_coef_init(codec);
 183        alc_hp_automute(codec);
 184}
 185
 186static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
 187{
 188        struct alc_spec *spec = codec->spec;
 189
 190        spec->autocfg.hp_pins[0] = 0x17; /* line-out */
 191        spec->autocfg.hp_pins[1] = 0x1b; /* hp */
 192        spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
 193        spec->autocfg.speaker_pins[1] = 0x15; /* bass */
 194        spec->automute = 1;
 195        spec->automute_mode = ALC_AUTOMUTE_AMP;
 196}
 197
 198/*
 199 * ALC888 Acer Aspire 4930G model
 200 */
 201
 202static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
 203/* Front Mic: set to PIN_IN (empty by default) */
 204        {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 205/* Unselect Front Mic by default in input mixer 3 */
 206        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
 207/* Enable unsolicited event for HP jack */
 208        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 209/* Connect Internal HP to front */
 210        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 211        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 212        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
 213/* Connect HP out to front */
 214        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 215        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 216        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
 217        {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
 218        { }
 219};
 220
 221/*
 222 * ALC888 Acer Aspire 6530G model
 223 */
 224
 225static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
 226/* Route to built-in subwoofer as well as speakers */
 227        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 228        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 229        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 230        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 231/* Bias voltage on for external mic port */
 232        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
 233/* Front Mic: set to PIN_IN (empty by default) */
 234        {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 235/* Unselect Front Mic by default in input mixer 3 */
 236        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
 237/* Enable unsolicited event for HP jack */
 238        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 239/* Enable speaker output */
 240        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 241        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 242        {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
 243/* Enable headphone output */
 244        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
 245        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 246        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
 247        {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
 248        { }
 249};
 250
 251/*
 252 *ALC888 Acer Aspire 7730G model
 253 */
 254
 255static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
 256/* Bias voltage on for external mic port */
 257        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
 258/* Front Mic: set to PIN_IN (empty by default) */
 259        {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 260/* Unselect Front Mic by default in input mixer 3 */
 261        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
 262/* Enable unsolicited event for HP jack */
 263        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 264/* Enable speaker output */
 265        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 266        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 267        {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
 268/* Enable headphone output */
 269        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
 270        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 271        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
 272        {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
 273/*Enable internal subwoofer */
 274        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 275        {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 276        {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
 277        {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
 278        { }
 279};
 280
 281/*
 282 * ALC889 Acer Aspire 8930G model
 283 */
 284
 285static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
 286/* Front Mic: set to PIN_IN (empty by default) */
 287        {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 288/* Unselect Front Mic by default in input mixer 3 */
 289        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
 290/* Enable unsolicited event for HP jack */
 291        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
 292/* Connect Internal Front to Front */
 293        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 294        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 295        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
 296/* Connect Internal Rear to Rear */
 297        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 298        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 299        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
 300/* Connect Internal CLFE to CLFE */
 301        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 302        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 303        {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
 304/* Connect HP out to Front */
 305        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
 306        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 307        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
 308/* Enable all DACs */
 309/*  DAC DISABLE/MUTE 1? */
 310/*  setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
 311        {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
 312        {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
 313/*  DAC DISABLE/MUTE 2? */
 314/*  some bit here disables the other DACs. Init=0x4900 */
 315        {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
 316        {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
 317/* DMIC fix
 318 * This laptop has a stereo digital microphone. The mics are only 1cm apart
 319 * which makes the stereo useless. However, either the mic or the ALC889
 320 * makes the signal become a difference/sum signal instead of standard
 321 * stereo, which is annoying. So instead we flip this bit which makes the
 322 * codec replicate the sum signal to both channels, turning it into a
 323 * normal mono mic.
 324 */
 325/*  DMIC_CONTROL? Init value = 0x0001 */
 326        {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
 327        {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
 328        { }
 329};
 330
 331static const struct hda_input_mux alc888_2_capture_sources[2] = {
 332        /* Front mic only available on one ADC */
 333        {
 334                .num_items = 4,
 335                .items = {
 336                        { "Mic", 0x0 },
 337                        { "Line", 0x2 },
 338                        { "CD", 0x4 },
 339                        { "Front Mic", 0xb },
 340                },
 341        },
 342        {
 343                .num_items = 3,
 344                .items = {
 345                        { "Mic", 0x0 },
 346                        { "Line", 0x2 },
 347                        { "CD", 0x4 },
 348                },
 349        }
 350};
 351
 352static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
 353        /* Interal mic only available on one ADC */
 354        {
 355                .num_items = 5,
 356                .items = {
 357                        { "Mic", 0x0 },
 358                        { "Line In", 0x2 },
 359                        { "CD", 0x4 },
 360                        { "Input Mix", 0xa },
 361                        { "Internal Mic", 0xb },
 362                },
 363        },
 364        {
 365                .num_items = 4,
 366                .items = {
 367                        { "Mic", 0x0 },
 368                        { "Line In", 0x2 },
 369                        { "CD", 0x4 },
 370                        { "Input Mix", 0xa },
 371                },
 372        }
 373};
 374
 375static const struct hda_input_mux alc889_capture_sources[3] = {
 376        /* Digital mic only available on first "ADC" */
 377        {
 378                .num_items = 5,
 379                .items = {
 380                        { "Mic", 0x0 },
 381                        { "Line", 0x2 },
 382                        { "CD", 0x4 },
 383                        { "Front Mic", 0xb },
 384                        { "Input Mix", 0xa },
 385                },
 386        },
 387        {
 388                .num_items = 4,
 389                .items = {
 390                        { "Mic", 0x0 },
 391                        { "Line", 0x2 },
 392                        { "CD", 0x4 },
 393                        { "Input Mix", 0xa },
 394                },
 395        },
 396        {
 397                .num_items = 4,
 398                .items = {
 399                        { "Mic", 0x0 },
 400                        { "Line", 0x2 },
 401                        { "CD", 0x4 },
 402                        { "Input Mix", 0xa },
 403                },
 404        }
 405};
 406
 407static const struct snd_kcontrol_new alc888_base_mixer[] = {
 408        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
 409        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
 410        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
 411        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
 412        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
 413                HDA_OUTPUT),
 414        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
 415        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
 416        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
 417        HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
 418        HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
 419        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
 420        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
 421        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
 422        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
 423        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
 424        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
 425        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
 426        { } /* end */
 427};
 428
 429static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
 430        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
 431        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
 432        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
 433        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
 434        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
 435                HDA_OUTPUT),
 436        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
 437        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
 438        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
 439        HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
 440        HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
 441        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
 442        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
 443        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
 444        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
 445        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
 446        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
 447        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
 448        { } /* end */
 449};
 450
 451static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
 452        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
 453        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
 454        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
 455        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
 456        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
 457                HDA_OUTPUT),
 458        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
 459        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
 460        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
 461        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
 462        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
 463        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
 464        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
 465        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
 466        { } /* end */
 467};
 468
 469
 470static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
 471{
 472        struct alc_spec *spec = codec->spec;
 473
 474        spec->autocfg.hp_pins[0] = 0x15;
 475        spec->autocfg.speaker_pins[0] = 0x14;
 476        spec->autocfg.speaker_pins[1] = 0x16;
 477        spec->autocfg.speaker_pins[2] = 0x17;
 478        spec->automute = 1;
 479        spec->automute_mode = ALC_AUTOMUTE_AMP;
 480}
 481
 482static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
 483{
 484        struct alc_spec *spec = codec->spec;
 485
 486        spec->autocfg.hp_pins[0] = 0x15;
 487        spec->autocfg.speaker_pins[0] = 0x14;
 488        spec->autocfg.speaker_pins[1] = 0x16;
 489        spec->autocfg.speaker_pins[2] = 0x17;
 490        spec->automute = 1;
 491        spec->automute_mode = ALC_AUTOMUTE_AMP;
 492}
 493
 494static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
 495{
 496        struct alc_spec *spec = codec->spec;
 497
 498        spec->autocfg.hp_pins[0] = 0x15;
 499        spec->autocfg.speaker_pins[0] = 0x14;
 500        spec->autocfg.speaker_pins[1] = 0x16;
 501        spec->autocfg.speaker_pins[2] = 0x17;
 502        spec->automute = 1;
 503        spec->automute_mode = ALC_AUTOMUTE_AMP;
 504}
 505
 506static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
 507{
 508        struct alc_spec *spec = codec->spec;
 509
 510        spec->autocfg.hp_pins[0] = 0x15;
 511        spec->autocfg.speaker_pins[0] = 0x14;
 512        spec->autocfg.speaker_pins[1] = 0x16;
 513        spec->autocfg.speaker_pins[2] = 0x1b;
 514        spec->automute = 1;
 515        spec->automute_mode = ALC_AUTOMUTE_AMP;
 516}
 517
 518#define ALC882_DIGOUT_NID       0x06
 519#define ALC882_DIGIN_NID        0x0a
 520#define ALC883_DIGOUT_NID       ALC882_DIGOUT_NID
 521#define ALC883_DIGIN_NID        ALC882_DIGIN_NID
 522#define ALC1200_DIGOUT_NID      0x10
 523
 524
 525static const struct hda_channel_mode alc882_ch_modes[1] = {
 526        { 8, NULL }
 527};
 528
 529/* DACs */
 530static const hda_nid_t alc882_dac_nids[4] = {
 531        /* front, rear, clfe, rear_surr */
 532        0x02, 0x03, 0x04, 0x05
 533};
 534#define alc883_dac_nids         alc882_dac_nids
 535
 536/* ADCs */
 537#define alc882_adc_nids         alc880_adc_nids
 538#define alc882_adc_nids_alt     alc880_adc_nids_alt
 539#define alc883_adc_nids         alc882_adc_nids_alt
 540static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
 541static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
 542#define alc889_adc_nids         alc880_adc_nids
 543
 544static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
 545static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
 546#define alc883_capsrc_nids      alc882_capsrc_nids_alt
 547static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
 548#define alc889_capsrc_nids      alc882_capsrc_nids
 549
 550/* input MUX */
 551/* FIXME: should be a matrix-type input source selection */
 552
 553static const struct hda_input_mux alc882_capture_source = {
 554        .num_items = 4,
 555        .items = {
 556                { "Mic", 0x0 },
 557                { "Front Mic", 0x1 },
 558                { "Line", 0x2 },
 559                { "CD", 0x4 },
 560        },
 561};
 562
 563#define alc883_capture_source   alc882_capture_source
 564
 565static const struct hda_input_mux alc889_capture_source = {
 566        .num_items = 3,
 567        .items = {
 568                { "Front Mic", 0x0 },
 569                { "Mic", 0x3 },
 570                { "Line", 0x2 },
 571        },
 572};
 573
 574static const struct hda_input_mux mb5_capture_source = {
 575        .num_items = 3,
 576        .items = {
 577                { "Mic", 0x1 },
 578                { "Line", 0x7 },
 579                { "CD", 0x4 },
 580        },
 581};
 582
 583static const struct hda_input_mux macmini3_capture_source = {
 584        .num_items = 2,
 585        .items = {
 586                { "Line", 0x2 },
 587                { "CD", 0x4 },
 588        },
 589};
 590
 591static const struct hda_input_mux alc883_3stack_6ch_intel = {
 592        .num_items = 4,
 593        .items = {
 594                { "Mic", 0x1 },
 595                { "Front Mic", 0x0 },
 596                { "Line", 0x2 },
 597                { "CD", 0x4 },
 598        },
 599};
 600
 601static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
 602        .num_items = 2,
 603        .items = {
 604                { "Mic", 0x1 },
 605                { "Line", 0x2 },
 606        },
 607};
 608
 609static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
 610        .num_items = 4,
 611        .items = {
 612                { "Mic", 0x0 },
 613                { "Internal Mic", 0x1 },
 614                { "Line", 0x2 },
 615                { "CD", 0x4 },
 616        },
 617};
 618
 619static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
 620        .num_items = 2,
 621        .items = {
 622                { "Mic", 0x0 },
 623                { "Internal Mic", 0x1 },
 624        },
 625};
 626
 627static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
 628        .num_items = 3,
 629        .items = {
 630                { "Mic", 0x0 },
 631                { "Front Mic", 0x1 },
 632                { "Line", 0x4 },
 633        },
 634};
 635
 636static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
 637        .num_items = 2,
 638        .items = {
 639                { "Mic", 0x0 },
 640                { "Line", 0x2 },
 641        },
 642};
 643
 644static const struct hda_input_mux alc889A_mb31_capture_source = {
 645        .num_items = 2,
 646        .items = {
 647                { "Mic", 0x0 },
 648                /* Front Mic (0x01) unused */
 649                { "Line", 0x2 },
 650                /* Line 2 (0x03) unused */
 651                /* CD (0x04) unused? */
 652        },
 653};
 654
 655static const struct hda_input_mux alc889A_imac91_capture_source = {
 656        .num_items = 2,
 657        .items = {
 658                { "Mic", 0x01 },
 659                { "Line", 0x2 }, /* Not sure! */
 660        },
 661};
 662
 663/*
 664 * 2ch mode
 665 */
 666static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
 667        { 2, NULL }
 668};
 669
 670/*
 671 * 2ch mode
 672 */
 673static const struct hda_verb alc882_3ST_ch2_init[] = {
 674        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 675        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 676        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 677        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 678        { } /* end */
 679};
 680
 681/*
 682 * 4ch mode
 683 */
 684static const struct hda_verb alc882_3ST_ch4_init[] = {
 685        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 686        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 687        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 688        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 689        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 690        { } /* end */
 691};
 692
 693/*
 694 * 6ch mode
 695 */
 696static const struct hda_verb alc882_3ST_ch6_init[] = {
 697        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 698        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 699        { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
 700        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 701        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 702        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 703        { } /* end */
 704};
 705
 706static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
 707        { 2, alc882_3ST_ch2_init },
 708        { 4, alc882_3ST_ch4_init },
 709        { 6, alc882_3ST_ch6_init },
 710};
 711
 712#define alc883_3ST_6ch_modes    alc882_3ST_6ch_modes
 713
 714/*
 715 * 2ch mode
 716 */
 717static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
 718        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
 719        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 720        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 721        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 722        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 723        { } /* end */
 724};
 725
 726/*
 727 * 4ch mode
 728 */
 729static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
 730        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 731        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 732        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 733        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 734        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 735        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 736        { } /* end */
 737};
 738
 739/*
 740 * 6ch mode
 741 */
 742static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
 743        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 744        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 745        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 746        { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
 747        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 748        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 749        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 750        { } /* end */
 751};
 752
 753static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
 754        { 2, alc883_3ST_ch2_clevo_init },
 755        { 4, alc883_3ST_ch4_clevo_init },
 756        { 6, alc883_3ST_ch6_clevo_init },
 757};
 758
 759
 760/*
 761 * 6ch mode
 762 */
 763static const struct hda_verb alc882_sixstack_ch6_init[] = {
 764        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
 765        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 766        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 767        { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 768        { } /* end */
 769};
 770
 771/*
 772 * 8ch mode
 773 */
 774static const struct hda_verb alc882_sixstack_ch8_init[] = {
 775        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 776        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 777        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 778        { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 779        { } /* end */
 780};
 781
 782static const struct hda_channel_mode alc882_sixstack_modes[2] = {
 783        { 6, alc882_sixstack_ch6_init },
 784        { 8, alc882_sixstack_ch8_init },
 785};
 786
 787
 788/* Macbook Air 2,1 */
 789
 790static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
 791      { 2, NULL },
 792};
 793
 794/*
 795 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
 796 */
 797
 798/*
 799 * 2ch mode
 800 */
 801static const struct hda_verb alc885_mbp_ch2_init[] = {
 802        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 803        { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
 804        { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
 805        { } /* end */
 806};
 807
 808/*
 809 * 4ch mode
 810 */
 811static const struct hda_verb alc885_mbp_ch4_init[] = {
 812        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 813        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 814        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 815        { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 816        { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 817        { } /* end */
 818};
 819
 820static const struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
 821        { 2, alc885_mbp_ch2_init },
 822        { 4, alc885_mbp_ch4_init },
 823};
 824
 825/*
 826 * 2ch
 827 * Speakers/Woofer/HP = Front
 828 * LineIn = Input
 829 */
 830static const struct hda_verb alc885_mb5_ch2_init[] = {
 831        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 832        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
 833        { } /* end */
 834};
 835
 836/*
 837 * 6ch mode
 838 * Speakers/HP = Front
 839 * Woofer = LFE
 840 * LineIn = Surround
 841 */
 842static const struct hda_verb alc885_mb5_ch6_init[] = {
 843        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
 844        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
 845        {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
 846        { } /* end */
 847};
 848
 849static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
 850        { 2, alc885_mb5_ch2_init },
 851        { 6, alc885_mb5_ch6_init },
 852};
 853
 854#define alc885_macmini3_6ch_modes       alc885_mb5_6ch_modes
 855
 856/*
 857 * 2ch mode
 858 */
 859static const struct hda_verb alc883_4ST_ch2_init[] = {
 860        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 861        { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 862        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 863        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 864        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 865        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 866        { } /* end */
 867};
 868
 869/*
 870 * 4ch mode
 871 */
 872static const struct hda_verb alc883_4ST_ch4_init[] = {
 873        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 874        { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 875        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 876        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 877        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 878        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 879        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 880        { } /* end */
 881};
 882
 883/*
 884 * 6ch mode
 885 */
 886static const struct hda_verb alc883_4ST_ch6_init[] = {
 887        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 888        { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 889        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 890        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 891        { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
 892        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 893        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 894        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 895        { } /* end */
 896};
 897
 898/*
 899 * 8ch mode
 900 */
 901static const struct hda_verb alc883_4ST_ch8_init[] = {
 902        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 903        { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 904        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
 905        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 906        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 907        { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
 908        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 909        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 910        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 911        { } /* end */
 912};
 913
 914static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
 915        { 2, alc883_4ST_ch2_init },
 916        { 4, alc883_4ST_ch4_init },
 917        { 6, alc883_4ST_ch6_init },
 918        { 8, alc883_4ST_ch8_init },
 919};
 920
 921
 922/*
 923 * 2ch mode
 924 */
 925static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
 926        { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 927        { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 928        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 929        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 930        { } /* end */
 931};
 932
 933/*
 934 * 4ch mode
 935 */
 936static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
 937        { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
 938        { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 939        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 940        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 941        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 942        { } /* end */
 943};
 944
 945/*
 946 * 6ch mode
 947 */
 948static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
 949        { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 950        { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 951        { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
 952        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
 953        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
 954        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
 955        { } /* end */
 956};
 957
 958static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
 959        { 2, alc883_3ST_ch2_intel_init },
 960        { 4, alc883_3ST_ch4_intel_init },
 961        { 6, alc883_3ST_ch6_intel_init },
 962};
 963
 964/*
 965 * 2ch mode
 966 */
 967static const struct hda_verb alc889_ch2_intel_init[] = {
 968        { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
 969        { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
 970        { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
 971        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
 972        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 973        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 974        { } /* end */
 975};
 976
 977/*
 978 * 6ch mode
 979 */
 980static const struct hda_verb alc889_ch6_intel_init[] = {
 981        { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
 982        { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
 983        { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
 984        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
 985        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
 986        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
 987        { } /* end */
 988};
 989
 990/*
 991 * 8ch mode
 992 */
 993static const struct hda_verb alc889_ch8_intel_init[] = {
 994        { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
 995        { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
 996        { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
 997        { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
 998        { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
 999        { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1000        { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1001        { } /* end */
1002};
1003
1004static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
1005        { 2, alc889_ch2_intel_init },
1006        { 6, alc889_ch6_intel_init },
1007        { 8, alc889_ch8_intel_init },
1008};
1009
1010/*
1011 * 6ch mode
1012 */
1013static const struct hda_verb alc883_sixstack_ch6_init[] = {
1014        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
1015        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1016        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1017        { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1018        { } /* end */
1019};
1020
1021/*
1022 * 8ch mode
1023 */
1024static const struct hda_verb alc883_sixstack_ch8_init[] = {
1025        { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1026        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1027        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1028        { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1029        { } /* end */
1030};
1031
1032static const struct hda_channel_mode alc883_sixstack_modes[2] = {
1033        { 6, alc883_sixstack_ch6_init },
1034        { 8, alc883_sixstack_ch8_init },
1035};
1036
1037
1038/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
1039 *                 Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
1040 */
1041static const struct snd_kcontrol_new alc882_base_mixer[] = {
1042        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1043        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1044        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1045        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1046        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1047        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1048        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1049        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1050        HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1051        HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1052        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1053        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1054        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1055        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1056        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1057        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1058        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1059        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1060        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1061        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1062        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1063        { } /* end */
1064};
1065
1066/* Macbook Air 2,1 same control for HP and internal Speaker */
1067
1068static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
1069      HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1070      HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
1071     { }
1072};
1073
1074
1075static const struct snd_kcontrol_new alc885_mbp3_mixer[] = {
1076        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1077        HDA_BIND_MUTE   ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
1078        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
1079        HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
1080        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
1081        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1082        HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1083        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
1084        HDA_CODEC_MUTE  ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
1085        HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
1086        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
1087        { } /* end */
1088};
1089
1090static const struct snd_kcontrol_new alc885_mb5_mixer[] = {
1091        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1092        HDA_BIND_MUTE   ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
1093        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
1094        HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
1095        HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
1096        HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
1097        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
1098        HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
1099        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
1100        HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
1101        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1102        HDA_CODEC_MUTE  ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1103        HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
1104        HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0x00, HDA_INPUT),
1105        { } /* end */
1106};
1107
1108static const struct snd_kcontrol_new alc885_macmini3_mixer[] = {
1109        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1110        HDA_BIND_MUTE   ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
1111        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
1112        HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
1113        HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
1114        HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
1115        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
1116        HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
1117        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
1118        HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
1119        HDA_CODEC_VOLUME("Line Boost Volume", 0x15, 0x00, HDA_INPUT),
1120        { } /* end */
1121};
1122
1123static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
1124        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1125        HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
1126        { } /* end */
1127};
1128
1129
1130static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
1131        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1132        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1133        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1134        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1135        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1136        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1137        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1138        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1139        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1140        { } /* end */
1141};
1142
1143static const struct snd_kcontrol_new alc882_targa_mixer[] = {
1144        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1145        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1146        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1147        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1148        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1149        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1150        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1151        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1152        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1153        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1154        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1155        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1156        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1157        { } /* end */
1158};
1159
1160/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
1161 *                 Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
1162 */
1163static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
1164        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1165        HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1166        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1167        HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
1168        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1169        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1170        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1171        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1172        HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
1173        HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
1174        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1175        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1176        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1177        { } /* end */
1178};
1179
1180static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
1181        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1182        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1183        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1184        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1185        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1186        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1187        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1188        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1189        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1190        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1191        { } /* end */
1192};
1193
1194static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
1195        {
1196                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1197                .name = "Channel Mode",
1198                .info = alc_ch_mode_info,
1199                .get = alc_ch_mode_get,
1200                .put = alc_ch_mode_put,
1201        },
1202        { } /* end */
1203};
1204
1205static const struct hda_verb alc882_base_init_verbs[] = {
1206        /* Front mixer: unmute input/output amp left and right (volume = 0) */
1207        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1208        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1209        /* Rear mixer */
1210        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1211        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1212        /* CLFE mixer */
1213        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1214        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1215        /* Side mixer */
1216        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1217        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1218
1219        /* Front Pin: output 0 (0x0c) */
1220        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1221        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1222        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1223        /* Rear Pin: output 1 (0x0d) */
1224        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1225        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1226        {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
1227        /* CLFE Pin: output 2 (0x0e) */
1228        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1229        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1230        {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1231        /* Side Pin: output 3 (0x0f) */
1232        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1233        {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1234        {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1235        /* Mic (rear) pin: input vref at 80% */
1236        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1237        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1238        /* Front Mic pin: input vref at 80% */
1239        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1240        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1241        /* Line In pin: input */
1242        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1243        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1244        /* Line-2 In: Headphone output (output 0 - 0x0c) */
1245        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1246        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1247        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1248        /* CD pin widget for input */
1249        {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1250
1251        /* FIXME: use matrix-type input source selection */
1252        /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1253        /* Input mixer2 */
1254        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1255        /* Input mixer3 */
1256        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1257        /* ADC2: mute amp left and right */
1258        {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1259        {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1260        /* ADC3: mute amp left and right */
1261        {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1262        {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1263
1264        { }
1265};
1266
1267static const struct hda_verb alc882_adc1_init_verbs[] = {
1268        /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1269        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1270        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1271        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1272        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1273        /* ADC1: mute amp left and right */
1274        {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1275        {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1276        { }
1277};
1278
1279static const struct hda_verb alc882_eapd_verbs[] = {
1280        /* change to EAPD mode */
1281        {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1282        {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1283        { }
1284};
1285
1286static const struct hda_verb alc889_eapd_verbs[] = {
1287        {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1288        {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1289        { }
1290};
1291
1292static const struct hda_verb alc_hp15_unsol_verbs[] = {
1293        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1294        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1295        {}
1296};
1297
1298static const struct hda_verb alc885_init_verbs[] = {
1299        /* Front mixer: unmute input/output amp left and right (volume = 0) */
1300        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1301        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1302        /* Rear mixer */
1303        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1304        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1305        /* CLFE mixer */
1306        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1307        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1308        /* Side mixer */
1309        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1310        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1311
1312        /* Front HP Pin: output 0 (0x0c) */
1313        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1314        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1315        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1316        /* Front Pin: output 0 (0x0c) */
1317        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1318        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1319        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1320        /* Rear Pin: output 1 (0x0d) */
1321        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1322        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1323        {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
1324        /* CLFE Pin: output 2 (0x0e) */
1325        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1326        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1327        {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1328        /* Side Pin: output 3 (0x0f) */
1329        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1330        {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1331        {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1332        /* Mic (rear) pin: input vref at 80% */
1333        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1334        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1335        /* Front Mic pin: input vref at 80% */
1336        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1337        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1338        /* Line In pin: input */
1339        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1340        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1341
1342        /* Mixer elements: 0x18, , 0x1a, 0x1b */
1343        /* Input mixer1 */
1344        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1345        /* Input mixer2 */
1346        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1347        /* Input mixer3 */
1348        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1349        /* ADC2: mute amp left and right */
1350        {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1351        /* ADC3: mute amp left and right */
1352        {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1353
1354        { }
1355};
1356
1357static const struct hda_verb alc885_init_input_verbs[] = {
1358        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1359        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1360        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
1361        { }
1362};
1363
1364
1365/* Unmute Selector 24h and set the default input to front mic */
1366static const struct hda_verb alc889_init_input_verbs[] = {
1367        {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
1368        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1369        { }
1370};
1371
1372
1373#define alc883_init_verbs       alc882_base_init_verbs
1374
1375/* Mac Pro test */
1376static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
1377        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1378        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1379        HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
1380        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
1381        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
1382        /* FIXME: this looks suspicious...
1383        HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
1384        HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
1385        */
1386        { } /* end */
1387};
1388
1389static const struct hda_verb alc882_macpro_init_verbs[] = {
1390        /* Front mixer: unmute input/output amp left and right (volume = 0) */
1391        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1392        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1393        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1394        /* Front Pin: output 0 (0x0c) */
1395        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1396        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1397        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1398        /* Front Mic pin: input vref at 80% */
1399        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1400        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1401        /* Speaker:  output */
1402        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1403        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1404        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
1405        /* Headphone output (output 0 - 0x0c) */
1406        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1407        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1408        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1409
1410        /* FIXME: use matrix-type input source selection */
1411        /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1412        /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1413        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1414        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1415        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1416        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1417        /* Input mixer2 */
1418        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1419        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1420        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1421        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1422        /* Input mixer3 */
1423        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1424        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1425        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1426        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1427        /* ADC1: mute amp left and right */
1428        {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1429        {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1430        /* ADC2: mute amp left and right */
1431        {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1432        {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1433        /* ADC3: mute amp left and right */
1434        {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1435        {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1436
1437        { }
1438};
1439
1440/* Macbook 5,1 */
1441static const struct hda_verb alc885_mb5_init_verbs[] = {
1442        /* DACs */
1443        {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1444        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1445        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1446        {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1447        /* Front mixer */
1448        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1449        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1450        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1451        /* Surround mixer */
1452        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1453        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1454        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1455        /* LFE mixer */
1456        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1457        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1458        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1459        /* HP mixer */
1460        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1461        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1462        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1463        /* Front Pin (0x0c) */
1464        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1465        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1466        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1467        /* LFE Pin (0x0e) */
1468        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1469        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1470        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
1471        /* HP Pin (0x0f) */
1472        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1473        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1474        {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
1475        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1476        /* Front Mic pin: input vref at 80% */
1477        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1478        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1479        /* Line In pin */
1480        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1481        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1482
1483        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
1484        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
1485        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
1486        { }
1487};
1488
1489/* Macmini 3,1 */
1490static const struct hda_verb alc885_macmini3_init_verbs[] = {
1491        /* DACs */
1492        {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1493        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495        {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1496        /* Front mixer */
1497        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1498        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1499        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1500        /* Surround mixer */
1501        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1502        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1503        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1504        /* LFE mixer */
1505        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1506        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1507        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1508        /* HP mixer */
1509        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1510        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1511        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1512        /* Front Pin (0x0c) */
1513        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1514        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1515        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1516        /* LFE Pin (0x0e) */
1517        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
1518        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1519        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
1520        /* HP Pin (0x0f) */
1521        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1522        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1523        {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
1524        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1525        /* Line In pin */
1526        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1527        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1528
1529        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1530        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1531        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1532        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1533        { }
1534};
1535
1536
1537static const struct hda_verb alc885_mba21_init_verbs[] = {
1538        /*Internal and HP Speaker Mixer*/
1539        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1540        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1541        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1542        /*Internal Speaker Pin (0x0c)*/
1543        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1544        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1545        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1546        /* HP Pin: output 0 (0x0e) */
1547        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
1548        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1549        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1550        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
1551        /* Line in (is hp when jack connected)*/
1552        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
1553        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1554
1555        { }
1556 };
1557
1558
1559/* Macbook Pro rev3 */
1560static const struct hda_verb alc885_mbp3_init_verbs[] = {
1561        /* Front mixer: unmute input/output amp left and right (volume = 0) */
1562        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1563        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1564        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1565        /* Rear mixer */
1566        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1567        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1568        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1569        /* HP mixer */
1570        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1571        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1572        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1573        /* Front Pin: output 0 (0x0c) */
1574        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1575        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1576        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1577        /* HP Pin: output 0 (0x0e) */
1578        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
1579        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1580        {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
1581        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1582        /* Mic (rear) pin: input vref at 80% */
1583        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1584        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1585        /* Front Mic pin: input vref at 80% */
1586        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1587        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1588        /* Line In pin: use output 1 when in LineOut mode */
1589        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1590        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1591        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1592
1593        /* FIXME: use matrix-type input source selection */
1594        /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1595        /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1596        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1597        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1598        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1599        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1600        /* Input mixer2 */
1601        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1602        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1603        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1604        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1605        /* Input mixer3 */
1606        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1607        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1608        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1609        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1610        /* ADC1: mute amp left and right */
1611        {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1612        {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1613        /* ADC2: mute amp left and right */
1614        {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1615        {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1616        /* ADC3: mute amp left and right */
1617        {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1618        {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1619
1620        { }
1621};
1622
1623/* iMac 9,1 */
1624static const struct hda_verb alc885_imac91_init_verbs[] = {
1625        /* Internal Speaker Pin (0x0c) */
1626        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1627        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1628        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1629        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
1630        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1631        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1632        /* HP Pin: Rear */
1633        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1634        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1635        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1636        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC_HP_EVENT | AC_USRSP_EN)},
1637        /* Line in Rear */
1638        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
1639        {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1640        /* Front Mic pin: input vref at 80% */
1641        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1642        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1643        /* Rear mixer */
1644        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1645        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1646        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1647        /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
1648        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1649        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1650        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1651        /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1652        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1653        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1654        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1655        {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1656        /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1657        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1658        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1659        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1660        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1661        /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
1662        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1663        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1664        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1665        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1666        /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1667        {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1668        {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1669        /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1670        {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1671        {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1672        /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
1673        {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1674        {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1675        { }
1676};
1677
1678/* iMac 24 mixer. */
1679static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
1680        HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1681        HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
1682        { } /* end */
1683};
1684
1685/* iMac 24 init verbs. */
1686static const struct hda_verb alc885_imac24_init_verbs[] = {
1687        /* Internal speakers: output 0 (0x0c) */
1688        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1689        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1690        {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1691        /* Internal speakers: output 0 (0x0c) */
1692        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1693        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1694        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1695        /* Headphone: output 0 (0x0c) */
1696        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1697        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1698        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1699        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1700        /* Front Mic: input vref at 80% */
1701        {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1702        {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1703        { }
1704};
1705
1706/* Toggle speaker-output according to the hp-jack state */
1707static void alc885_imac24_setup(struct hda_codec *codec)
1708{
1709        struct alc_spec *spec = codec->spec;
1710
1711        spec->autocfg.hp_pins[0] = 0x14;
1712        spec->autocfg.speaker_pins[0] = 0x18;
1713        spec->autocfg.speaker_pins[1] = 0x1a;
1714        spec->automute = 1;
1715        spec->automute_mode = ALC_AUTOMUTE_AMP;
1716}
1717
1718#define alc885_mb5_setup        alc885_imac24_setup
1719#define alc885_macmini3_setup   alc885_imac24_setup
1720
1721/* Macbook Air 2,1 */
1722static void alc885_mba21_setup(struct hda_codec *codec)
1723{
1724       struct alc_spec *spec = codec->spec;
1725
1726       spec->autocfg.hp_pins[0] = 0x14;
1727       spec->autocfg.speaker_pins[0] = 0x18;
1728        spec->automute = 1;
1729        spec->automute_mode = ALC_AUTOMUTE_AMP;
1730}
1731
1732
1733
1734static void alc885_mbp3_setup(struct hda_codec *codec)
1735{
1736        struct alc_spec *spec = codec->spec;
1737
1738        spec->autocfg.hp_pins[0] = 0x15;
1739        spec->autocfg.speaker_pins[0] = 0x14;
1740        spec->automute = 1;
1741        spec->automute_mode = ALC_AUTOMUTE_AMP;
1742}
1743
1744static void alc885_imac91_setup(struct hda_codec *codec)
1745{
1746        struct alc_spec *spec = codec->spec;
1747
1748        spec->autocfg.hp_pins[0] = 0x14;
1749        spec->autocfg.speaker_pins[0] = 0x18;
1750        spec->autocfg.speaker_pins[1] = 0x1a;
1751        spec->automute = 1;
1752        spec->automute_mode = ALC_AUTOMUTE_AMP;
1753}
1754
1755static const struct hda_verb alc882_targa_verbs[] = {
1756        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1757        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1758
1759        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1760        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1761
1762        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1763        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1764        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1765
1766        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1767        { } /* end */
1768};
1769
1770/* toggle speaker-output according to the hp-jack state */
1771static void alc882_targa_automute(struct hda_codec *codec)
1772{
1773        struct alc_spec *spec = codec->spec;
1774        alc_hp_automute(codec);
1775        snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
1776                                  spec->jack_present ? 1 : 3);
1777}
1778
1779static void alc882_targa_setup(struct hda_codec *codec)
1780{
1781        struct alc_spec *spec = codec->spec;
1782
1783        spec->autocfg.hp_pins[0] = 0x14;
1784        spec->autocfg.speaker_pins[0] = 0x1b;
1785        spec->automute = 1;
1786        spec->automute_mode = ALC_AUTOMUTE_AMP;
1787}
1788
1789static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
1790{
1791        if ((res >> 26) == ALC_HP_EVENT)
1792                alc882_targa_automute(codec);
1793}
1794
1795static const struct hda_verb alc882_asus_a7j_verbs[] = {
1796        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1797        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1798
1799        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1800        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1801        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1802
1803        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1804        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1805        {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1806
1807        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1808        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1809        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1810        { } /* end */
1811};
1812
1813static const struct hda_verb alc882_asus_a7m_verbs[] = {
1814        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1815        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1816
1817        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1818        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1819        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1820
1821        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1822        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1823        {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1824
1825        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1826        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1827        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1828        { } /* end */
1829};
1830
1831static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1832{
1833        unsigned int gpiostate, gpiomask, gpiodir;
1834
1835        gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1836                                       AC_VERB_GET_GPIO_DATA, 0);
1837
1838        if (!muted)
1839                gpiostate |= (1 << pin);
1840        else
1841                gpiostate &= ~(1 << pin);
1842
1843        gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1844                                      AC_VERB_GET_GPIO_MASK, 0);
1845        gpiomask |= (1 << pin);
1846
1847        gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1848                                     AC_VERB_GET_GPIO_DIRECTION, 0);
1849        gpiodir |= (1 << pin);
1850
1851
1852        snd_hda_codec_write(codec, codec->afg, 0,
1853                            AC_VERB_SET_GPIO_MASK, gpiomask);
1854        snd_hda_codec_write(codec, codec->afg, 0,
1855                            AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1856
1857        msleep(1);
1858
1859        snd_hda_codec_write(codec, codec->afg, 0,
1860                            AC_VERB_SET_GPIO_DATA, gpiostate);
1861}
1862
1863/* set up GPIO at initialization */
1864static void alc885_macpro_init_hook(struct hda_codec *codec)
1865{
1866        alc882_gpio_mute(codec, 0, 0);
1867        alc882_gpio_mute(codec, 1, 0);
1868}
1869
1870/* set up GPIO and update auto-muting at initialization */
1871static void alc885_imac24_init_hook(struct hda_codec *codec)
1872{
1873        alc885_macpro_init_hook(codec);
1874        alc_hp_automute(codec);
1875}
1876
1877/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
1878static const struct hda_verb alc889A_mb31_ch2_init[] = {
1879        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},             /* HP as front */
1880        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1881        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},    /* Line as input */
1882        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Line off */
1883        { } /* end */
1884};
1885
1886/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
1887static const struct hda_verb alc889A_mb31_ch4_init[] = {
1888        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},             /* HP as front */
1889        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1890        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},   /* Line as output */
1891        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
1892        { } /* end */
1893};
1894
1895/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
1896static const struct hda_verb alc889A_mb31_ch5_init[] = {
1897        {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},             /* HP as rear */
1898        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
1899        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},    /* Line as input */
1900        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Line off */
1901        { } /* end */
1902};
1903
1904/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
1905static const struct hda_verb alc889A_mb31_ch6_init[] = {
1906        {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},             /* HP as front */
1907        {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},   /* Subwoofer off */
1908        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},   /* Line as output */
1909        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
1910        { } /* end */
1911};
1912
1913static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
1914        { 2, alc889A_mb31_ch2_init },
1915        { 4, alc889A_mb31_ch4_init },
1916        { 5, alc889A_mb31_ch5_init },
1917        { 6, alc889A_mb31_ch6_init },
1918};
1919
1920static const struct hda_verb alc883_medion_eapd_verbs[] = {
1921        /* eanable EAPD on medion laptop */
1922        {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1923        {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1924        { }
1925};
1926
1927#define alc883_base_mixer       alc882_base_mixer
1928
1929static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
1930        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1931        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1932        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1933        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1934        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1935        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1936        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1937        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1938        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1939        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1940        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1941        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1942        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1943        { } /* end */
1944};
1945
1946static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
1947        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1948        HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1949        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1950        HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1951        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1952        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1953        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1954        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1955        HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1956        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1957        { } /* end */
1958};
1959
1960static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
1961        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1962        HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1963        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1964        HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1965        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1966        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1967        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1968        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1969        HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1970        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1971        { } /* end */
1972};
1973
1974static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
1975        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1976        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1977        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1978        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1979        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1980        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1981        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1982        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1983        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1984        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1985        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1986        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1987        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1988        { } /* end */
1989};
1990
1991static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
1992        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1993        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1994        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1995        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1996        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1997        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1998        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1999        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2000        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2001        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2002        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2003        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2004        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2005        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2006        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2007        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2008        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2009        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
2010        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2011        { } /* end */
2012};
2013
2014static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
2015        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2016        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2017        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2018        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2019        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2020                              HDA_OUTPUT),
2021        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2022        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2023        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2024        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2025        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2026        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2027        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2028        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2029        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2030        HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
2031        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2032        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2033        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
2034        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2035        { } /* end */
2036};
2037
2038static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
2039        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2040        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2041        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2042        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2043        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2044                              HDA_OUTPUT),
2045        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2046        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2047        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2048        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2049        HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
2050        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2051        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2052        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2053        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2054        HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
2055        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2056        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2057        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
2058        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2059        { } /* end */
2060};
2061
2062static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
2063        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2064        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2065        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2066        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2067        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2068        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2069        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2070        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2071        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2072        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2073        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2074        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2075        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2076        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2077        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2078        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2079        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2080        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
2081        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2082        { } /* end */
2083};
2084
2085static const struct snd_kcontrol_new alc883_targa_mixer[] = {
2086        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2087        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2088        HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2089        HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2090        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2091        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2092        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2093        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2094        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2095        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2096        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2097        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2098        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2099        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2100        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2101        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2102        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2103        { } /* end */
2104};
2105
2106static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
2107        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2108        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2109        HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2110        HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2111        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2112        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2113        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2114        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2115        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2116        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2117        HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
2118        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2119        { } /* end */
2120};
2121
2122static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
2123        HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2124        HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2125        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2126        HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
2127        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2128        { } /* end */
2129};
2130
2131static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
2132        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2133        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2134        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2135        HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2136        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2137        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2138        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2139        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2140        { } /* end */
2141};
2142
2143static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
2144        HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2145        HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
2146        HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2147        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2148        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2149        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2150        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2151        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2152        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2153        { } /* end */
2154};
2155
2156static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
2157        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2158        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2159        HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2160        HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
2161        HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
2162        HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
2163        { } /* end */
2164};
2165
2166static const struct hda_verb alc883_medion_wim2160_verbs[] = {
2167        /* Unmute front mixer */
2168        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2169        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2170
2171        /* Set speaker pin to front mixer */
2172        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2173
2174        /* Init headphone pin */
2175        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2176        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2177        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
2178        {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2179
2180        { } /* end */
2181};
2182
2183/* toggle speaker-output according to the hp-jack state */
2184static void alc883_medion_wim2160_setup(struct hda_codec *codec)
2185{
2186        struct alc_spec *spec = codec->spec;
2187
2188        spec->autocfg.hp_pins[0] = 0x1a;
2189        spec->autocfg.speaker_pins[0] = 0x15;
2190        spec->automute = 1;
2191        spec->automute_mode = ALC_AUTOMUTE_AMP;
2192}
2193
2194static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
2195        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2196        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2197        HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2198        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2199        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2200        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2201        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2202        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2203        { } /* end */
2204};
2205
2206static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
2207        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2208        HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2209        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2210        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2211        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2212        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2213        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2214        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2215        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2216        { } /* end */
2217};
2218
2219static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
2220        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2221        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2222        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2223        HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
2224        HDA_CODEC_VOLUME_MONO("Center Playback Volume",
2225                                                0x0d, 1, 0x0, HDA_OUTPUT),
2226        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2227        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2228        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2229        HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2230        HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2231        HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2232        HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2233        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2234        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2235        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2236        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2237        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2238        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2239        HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
2240        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2241        { } /* end */
2242};
2243
2244static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
2245        /* Output mixers */
2246        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
2247        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
2248        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
2249        HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
2250        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
2251                HDA_OUTPUT),
2252        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
2253        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
2254        HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
2255        /* Output switches */
2256        HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
2257        HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
2258        HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
2259        /* Boost mixers */
2260        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0x00, HDA_INPUT),
2261        HDA_CODEC_VOLUME("Line Boost Volume", 0x1a, 0x00, HDA_INPUT),
2262        /* Input mixers */
2263        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
2264        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
2265        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2266        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2267        { } /* end */
2268};
2269
2270static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
2271        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2272        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2273        HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2274        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2275        HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
2276        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2277        { } /* end */
2278};
2279
2280static const struct hda_bind_ctls alc883_bind_cap_vol = {
2281        .ops = &snd_hda_bind_vol,
2282        .values = {
2283                HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
2284                HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
2285                0
2286        },
2287};
2288
2289static const struct hda_bind_ctls alc883_bind_cap_switch = {
2290        .ops = &snd_hda_bind_sw,
2291        .values = {
2292                HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
2293                HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
2294                0
2295        },
2296};
2297
2298static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
2299        HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2300        HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2301        HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2302        HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2303        HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2304        HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2305        HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2306        HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2307        { } /* end */
2308};
2309
2310static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
2311        HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
2312        HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
2313        {
2314                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2315                /* .name = "Capture Source", */
2316                .name = "Input Source",
2317                .count = 1,
2318                .info = alc_mux_enum_info,
2319                .get = alc_mux_enum_get,
2320                .put = alc_mux_enum_put,
2321        },
2322        { } /* end */
2323};
2324
2325static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
2326        {
2327                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2328                .name = "Channel Mode",
2329                .info = alc_ch_mode_info,
2330                .get = alc_ch_mode_get,
2331                .put = alc_ch_mode_put,
2332        },
2333        { } /* end */
2334};
2335
2336/* toggle speaker-output according to the hp-jack state */
2337static void alc883_mitac_setup(struct hda_codec *codec)
2338{
2339        struct alc_spec *spec = codec->spec;
2340
2341        spec->autocfg.hp_pins[0] = 0x15;
2342        spec->autocfg.speaker_pins[0] = 0x14;
2343        spec->autocfg.speaker_pins[1] = 0x17;
2344        spec->automute = 1;
2345        spec->automute_mode = ALC_AUTOMUTE_AMP;
2346}
2347
2348static const struct hda_verb alc883_mitac_verbs[] = {
2349        /* HP */
2350        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2351        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2352        /* Subwoofer */
2353        {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2354        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2355
2356        /* enable unsolicited event */
2357        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2358        /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, */
2359
2360        { } /* end */
2361};
2362
2363static const struct hda_verb alc883_clevo_m540r_verbs[] = {
2364        /* HP */
2365        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2366        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2367        /* Int speaker */
2368        /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
2369
2370        /* enable unsolicited event */
2371        /*
2372        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2373        {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2374        */
2375
2376        { } /* end */
2377};
2378
2379static const struct hda_verb alc883_clevo_m720_verbs[] = {
2380        /* HP */
2381        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2382        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2383        /* Int speaker */
2384        {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
2385        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2386
2387        /* enable unsolicited event */
2388        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2389        {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2390
2391        { } /* end */
2392};
2393
2394static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
2395        /* HP */
2396        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2397        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2398        /* Subwoofer */
2399        {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
2400        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2401
2402        /* enable unsolicited event */
2403        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2404
2405        { } /* end */
2406};
2407
2408static const struct hda_verb alc883_targa_verbs[] = {
2409        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2410        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2411
2412        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2413        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2414
2415/* Connect Line-Out side jack (SPDIF) to Side */
2416        {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2417        {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2418        {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2419/* Connect Mic jack to CLFE */
2420        {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2421        {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2422        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2423/* Connect Line-in jack to Surround */
2424        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2425        {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2426        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2427/* Connect HP out jack to Front */
2428        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2429        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2430        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2431
2432        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2433
2434        { } /* end */
2435};
2436
2437static const struct hda_verb alc883_lenovo_101e_verbs[] = {
2438        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2439        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT|AC_USRSP_EN},
2440        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT|AC_USRSP_EN},
2441        { } /* end */
2442};
2443
2444static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
2445        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2446        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2447        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2448        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2449        { } /* end */
2450};
2451
2452static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
2453        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2454        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2455        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2456        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT | AC_USRSP_EN},
2457        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT    | AC_USRSP_EN},
2458        { } /* end */
2459};
2460
2461static const struct hda_verb alc883_haier_w66_verbs[] = {
2462        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2463        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2464
2465        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2466
2467        {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2468        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2469        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2470        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2471        { } /* end */
2472};
2473
2474static const struct hda_verb alc888_lenovo_sky_verbs[] = {
2475        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2476        {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2477        {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2478        {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2479        {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2480        {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2481        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
2482        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2483        { } /* end */
2484};
2485
2486static const struct hda_verb alc888_6st_dell_verbs[] = {
2487        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2488        { }
2489};
2490
2491static const struct hda_verb alc883_vaiott_verbs[] = {
2492        /* HP */
2493        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2494        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2495
2496        /* enable unsolicited event */
2497        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2498
2499        { } /* end */
2500};
2501
2502static void alc888_3st_hp_setup(struct hda_codec *codec)
2503{
2504        struct alc_spec *spec = codec->spec;
2505
2506        spec->autocfg.hp_pins[0] = 0x1b;
2507        spec->autocfg.speaker_pins[0] = 0x14;
2508        spec->autocfg.speaker_pins[1] = 0x16;
2509        spec->autocfg.speaker_pins[2] = 0x18;
2510        spec->automute = 1;
2511        spec->automute_mode = ALC_AUTOMUTE_AMP;
2512}
2513
2514static const struct hda_verb alc888_3st_hp_verbs[] = {
2515        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},  /* Front: output 0 (0x0c) */
2516        {0x16, AC_VERB_SET_CONNECT_SEL, 0x01},  /* Rear : output 1 (0x0d) */
2517        {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},  /* CLFE : output 2 (0x0e) */
2518        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2519        { } /* end */
2520};
2521
2522/*
2523 * 2ch mode
2524 */
2525static const struct hda_verb alc888_3st_hp_2ch_init[] = {
2526        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2527        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2528        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2529        { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2530        { } /* end */
2531};
2532
2533/*
2534 * 4ch mode
2535 */
2536static const struct hda_verb alc888_3st_hp_4ch_init[] = {
2537        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2538        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2539        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2540        { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2541        { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
2542        { } /* end */
2543};
2544
2545/*
2546 * 6ch mode
2547 */
2548static const struct hda_verb alc888_3st_hp_6ch_init[] = {
2549        { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2550        { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2551        { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
2552        { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2553        { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2554        { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
2555        { } /* end */
2556};
2557
2558static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
2559        { 2, alc888_3st_hp_2ch_init },
2560        { 4, alc888_3st_hp_4ch_init },
2561        { 6, alc888_3st_hp_6ch_init },
2562};
2563
2564static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
2565{
2566        struct alc_spec *spec = codec->spec;
2567
2568        spec->autocfg.hp_pins[0] = 0x1b;
2569        spec->autocfg.line_out_pins[0] = 0x14;
2570        spec->autocfg.speaker_pins[0] = 0x15;
2571        spec->automute = 1;
2572        spec->automute_mode = ALC_AUTOMUTE_AMP;
2573}
2574
2575/* toggle speaker-output according to the hp-jack state */
2576static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
2577{
2578        struct alc_spec *spec = codec->spec;
2579
2580        spec->autocfg.hp_pins[0] = 0x14;
2581        spec->autocfg.speaker_pins[0] = 0x15;
2582        spec->automute = 1;
2583        spec->automute_mode = ALC_AUTOMUTE_AMP;
2584}
2585
2586/* toggle speaker-output according to the hp-jack state */
2587#define alc883_targa_init_hook          alc882_targa_init_hook
2588#define alc883_targa_unsol_event        alc882_targa_unsol_event
2589
2590static void alc883_clevo_m720_setup(struct hda_codec *codec)
2591{
2592        struct alc_spec *spec = codec->spec;
2593
2594        spec->autocfg.hp_pins[0] = 0x15;
2595        spec->autocfg.speaker_pins[0] = 0x14;
2596        spec->automute = 1;
2597        spec->automute_mode = ALC_AUTOMUTE_AMP;
2598}
2599
2600static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
2601{
2602        alc_hp_automute(codec);
2603        alc88x_simple_mic_automute(codec);
2604}
2605
2606static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
2607                                           unsigned int res)
2608{
2609        switch (res >> 26) {
2610        case ALC_MIC_EVENT:
2611                alc88x_simple_mic_automute(codec);
2612                break;
2613        default:
2614                alc_sku_unsol_event(codec, res);
2615                break;
2616        }
2617}
2618
2619/* toggle speaker-output according to the hp-jack state */
2620static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
2621{
2622        struct alc_spec *spec = codec->spec;
2623
2624        spec->autocfg.hp_pins[0] = 0x14;
2625        spec->autocfg.speaker_pins[0] = 0x15;
2626        spec->automute = 1;
2627        spec->automute_mode = ALC_AUTOMUTE_AMP;
2628}
2629
2630static void alc883_haier_w66_setup(struct hda_codec *codec)
2631{
2632        struct alc_spec *spec = codec->spec;
2633
2634        spec->autocfg.hp_pins[0] = 0x1b;
2635        spec->autocfg.speaker_pins[0] = 0x14;
2636        spec->automute = 1;
2637        spec->automute_mode = ALC_AUTOMUTE_AMP;
2638}
2639
2640static void alc883_lenovo_101e_setup(struct hda_codec *codec)
2641{
2642        struct alc_spec *spec = codec->spec;
2643
2644        spec->autocfg.hp_pins[0] = 0x1b;
2645        spec->autocfg.line_out_pins[0] = 0x14;
2646        spec->autocfg.speaker_pins[0] = 0x15;
2647        spec->automute = 1;
2648        spec->detect_line = 1;
2649        spec->automute_lines = 1;
2650        spec->automute_mode = ALC_AUTOMUTE_AMP;
2651}
2652
2653/* toggle speaker-output according to the hp-jack state */
2654static void alc883_acer_aspire_setup(struct hda_codec *codec)
2655{
2656        struct alc_spec *spec = codec->spec;
2657
2658        spec->autocfg.hp_pins[0] = 0x14;
2659        spec->autocfg.speaker_pins[0] = 0x15;
2660        spec->autocfg.speaker_pins[1] = 0x16;
2661        spec->automute = 1;
2662        spec->automute_mode = ALC_AUTOMUTE_AMP;
2663}
2664
2665static const struct hda_verb alc883_acer_eapd_verbs[] = {
2666        /* HP Pin: output 0 (0x0c) */
2667        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2668        {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2669        {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2670        /* Front Pin: output 0 (0x0c) */
2671        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2672        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2673        {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2674        {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
2675        /* eanable EAPD on medion laptop */
2676        {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2677        {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
2678        /* enable unsolicited event */
2679        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2680        { }
2681};
2682
2683static void alc888_6st_dell_setup(struct hda_codec *codec)
2684{
2685        struct alc_spec *spec = codec->spec;
2686
2687        spec->autocfg.hp_pins[0] = 0x1b;
2688        spec->autocfg.speaker_pins[0] = 0x14;
2689        spec->autocfg.speaker_pins[1] = 0x15;
2690        spec->autocfg.speaker_pins[2] = 0x16;
2691        spec->autocfg.speaker_pins[3] = 0x17;
2692        spec->automute = 1;
2693        spec->automute_mode = ALC_AUTOMUTE_AMP;
2694}
2695
2696static void alc888_lenovo_sky_setup(struct hda_codec *codec)
2697{
2698        struct alc_spec *spec = codec->spec;
2699
2700        spec->autocfg.hp_pins[0] = 0x1b;
2701        spec->autocfg.speaker_pins[0] = 0x14;
2702        spec->autocfg.speaker_pins[1] = 0x15;
2703        spec->autocfg.speaker_pins[2] = 0x16;
2704        spec->autocfg.speaker_pins[3] = 0x17;
2705        spec->autocfg.speaker_pins[4] = 0x1a;
2706        spec->automute = 1;
2707        spec->automute_mode = ALC_AUTOMUTE_AMP;
2708}
2709
2710static void alc883_vaiott_setup(struct hda_codec *codec)
2711{
2712        struct alc_spec *spec = codec->spec;
2713
2714        spec->autocfg.hp_pins[0] = 0x15;
2715        spec->autocfg.speaker_pins[0] = 0x14;
2716        spec->autocfg.speaker_pins[1] = 0x17;
2717        spec->automute = 1;
2718        spec->automute_mode = ALC_AUTOMUTE_AMP;
2719}
2720
2721static const struct hda_verb alc888_asus_m90v_verbs[] = {
2722        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2723        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2724        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2725        /* enable unsolicited event */
2726        {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2727        {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2728        { } /* end */
2729};
2730
2731static void alc883_mode2_setup(struct hda_codec *codec)
2732{
2733        struct alc_spec *spec = codec->spec;
2734
2735        spec->autocfg.hp_pins[0] = 0x1b;
2736        spec->autocfg.speaker_pins[0] = 0x14;
2737        spec->autocfg.speaker_pins[1] = 0x15;
2738        spec->autocfg.speaker_pins[2] = 0x16;
2739        spec->ext_mic_pin = 0x18;
2740        spec->int_mic_pin = 0x19;
2741        spec->auto_mic = 1;
2742        spec->automute = 1;
2743        spec->automute_mode = ALC_AUTOMUTE_AMP;
2744}
2745
2746static const struct hda_verb alc888_asus_eee1601_verbs[] = {
2747        {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2749        {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2750        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2751        {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2752        {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2753        {0x20, AC_VERB_SET_PROC_COEF,  0x0838},
2754        /* enable unsolicited event */
2755        {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2756        { } /* end */
2757};
2758
2759static void alc883_eee1601_inithook(struct hda_codec *codec)
2760{
2761        struct alc_spec *spec = codec->spec;
2762
2763        spec->autocfg.hp_pins[0] = 0x14;
2764        spec->autocfg.speaker_pins[0] = 0x1b;
2765        alc_hp_automute(codec);
2766}
2767
2768static const struct hda_verb alc889A_mb31_verbs[] = {
2769        /* Init rear pin (used as headphone output) */
2770        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},    /* Apple Headphones */
2771        {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},           /* Connect to front */
2772        {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2773        /* Init line pin (used as output in 4ch and 6ch mode) */
2774        {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},           /* Connect to CLFE */
2775        /* Init line 2 pin (used as headphone out by default) */
2776        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},  /* Use as input */
2777        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
2778        { } /* end */
2779};
2780
2781/* Mute speakers according to the headphone jack state */
2782static void alc889A_mb31_automute(struct hda_codec *codec)
2783{
2784        unsigned int present;
2785
2786        /* Mute only in 2ch or 4ch mode */
2787        if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
2788            == 0x00) {
2789                present = snd_hda_jack_detect(codec, 0x15);
2790                snd_hda_codec_amp_stereo(codec, 0x14,  HDA_OUTPUT, 0,
2791                        HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
2792                snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2793                        HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
2794        }
2795}
2796
2797static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
2798{
2799        if ((res >> 26) == ALC_HP_EVENT)
2800                alc889A_mb31_automute(codec);
2801}
2802
2803static const hda_nid_t alc883_slave_dig_outs[] = {
2804        ALC1200_DIGOUT_NID, 0,
2805};
2806
2807static const hda_nid_t alc1200_slave_dig_outs[] = {
2808        ALC883_DIGOUT_NID, 0,
2809};
2810
2811/*
2812 * configuration and preset
2813 */
2814static const char * const alc882_models[ALC882_MODEL_LAST] = {
2815        [ALC882_3ST_DIG]        = "3stack-dig",
2816        [ALC882_6ST_DIG]        = "6stack-dig",
2817        [ALC882_ARIMA]          = "arima",
2818        [ALC882_W2JC]           = "w2jc",
2819        [ALC882_TARGA]          = "targa",
2820        [ALC882_ASUS_A7J]       = "asus-a7j",
2821        [ALC882_ASUS_A7M]       = "asus-a7m",
2822        [ALC885_MACPRO]         = "macpro",
2823        [ALC885_MB5]            = "mb5",
2824        [ALC885_MACMINI3]       = "macmini3",
2825        [ALC885_MBA21]          = "mba21",
2826        [ALC885_MBP3]           = "mbp3",
2827        [ALC885_IMAC24]         = "imac24",
2828        [ALC885_IMAC91]         = "imac91",
2829        [ALC883_3ST_2ch_DIG]    = "3stack-2ch-dig",
2830        [ALC883_3ST_6ch_DIG]    = "3stack-6ch-dig",
2831        [ALC883_3ST_6ch]        = "3stack-6ch",
2832        [ALC883_6ST_DIG]        = "alc883-6stack-dig",
2833        [ALC883_TARGA_DIG]      = "targa-dig",
2834        [ALC883_TARGA_2ch_DIG]  = "targa-2ch-dig",
2835        [ALC883_TARGA_8ch_DIG]  = "targa-8ch-dig",
2836        [ALC883_ACER]           = "acer",
2837        [ALC883_ACER_ASPIRE]    = "acer-aspire",
2838        [ALC888_ACER_ASPIRE_4930G]      = "acer-aspire-4930g",
2839        [ALC888_ACER_ASPIRE_6530G]      = "acer-aspire-6530g",
2840        [ALC888_ACER_ASPIRE_8930G]      = "acer-aspire-8930g",
2841        [ALC888_ACER_ASPIRE_7730G]      = "acer-aspire-7730g",
2842        [ALC883_MEDION]         = "medion",
2843        [ALC883_MEDION_WIM2160] = "medion-wim2160",
2844        [ALC883_LAPTOP_EAPD]    = "laptop-eapd",
2845        [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
2846        [ALC883_LENOVO_NB0763]  = "lenovo-nb0763",
2847        [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
2848        [ALC888_LENOVO_SKY] = "lenovo-sky",
2849        [ALC883_HAIER_W66]      = "haier-w66",
2850        [ALC888_3ST_HP]         = "3stack-hp",
2851        [ALC888_6ST_DELL]       = "6stack-dell",
2852        [ALC883_MITAC]          = "mitac",
2853        [ALC883_CLEVO_M540R]    = "clevo-m540r",
2854        [ALC883_CLEVO_M720]     = "clevo-m720",
2855        [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
2856        [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
2857        [ALC883_3ST_6ch_INTEL]  = "3stack-6ch-intel",
2858        [ALC889A_INTEL]         = "intel-alc889a",
2859        [ALC889_INTEL]          = "intel-x58",
2860        [ALC1200_ASUS_P5Q]      = "asus-p5q",
2861        [ALC889A_MB31]          = "mb31",
2862        [ALC883_SONY_VAIO_TT]   = "sony-vaio-tt",
2863        [ALC882_AUTO]           = "auto",
2864};
2865
2866static const struct snd_pci_quirk alc882_cfg_tbl[] = {
2867        SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
2868
2869        SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
2870        SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
2871        SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
2872        SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
2873        SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
2874        SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
2875        SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2876                ALC888_ACER_ASPIRE_4930G),
2877        SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2878                ALC888_ACER_ASPIRE_4930G),
2879        SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2880                ALC888_ACER_ASPIRE_8930G),
2881        SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2882                ALC888_ACER_ASPIRE_8930G),
2883        SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
2884        SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
2885        SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2886                ALC888_ACER_ASPIRE_6530G),
2887        SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2888                ALC888_ACER_ASPIRE_6530G),
2889        SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2890                ALC888_ACER_ASPIRE_7730G),
2891        /* default Acer -- disabled as it causes more problems.
2892         *    model=auto should work fine now
2893         */
2894        /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
2895
2896        SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
2897
2898        SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
2899        SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
2900        SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
2901        SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
2902        SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
2903        SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
2904
2905        SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
2906        SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
2907        SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
2908        SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
2909        SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
2910        SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
2911        SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
2912        SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
2913        SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
2914        SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
2915        SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
2916
2917        SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
2918        SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
2919        SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
2920        SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
2921        SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
2922        SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
2923        SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
2924        SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
2925        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
2926
2927        SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
2928        SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
2929        SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
2930        SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8  */
2931        SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
2932        SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
2933        SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
2934        SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
2935        SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
2936        SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
2937        SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
2938        SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
2939        SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
2940        SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
2941        SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
2942        SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
2943        SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
2944        SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
2945        SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
2946        SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
2947        SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
2948        SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
2949        SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
2950        SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
2951        SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
2952        SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
2953        SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
2954        SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
2955        SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
2956        SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
2957        SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
2958
2959        SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
2960        SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
2961        SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
2962        SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
2963        SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
2964        SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
2965        SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
2966        /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
2967        SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
2968        SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
2969                      ALC883_FUJITSU_PI2515),
2970        SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
2971                ALC888_FUJITSU_XA3530),
2972        SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
2973        SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2974        SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2975        SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2976        SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
2977        SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
2978        SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
2979        SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
2980
2981        SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
2982        SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
2983        SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
2984        SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
2985        SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
2986        SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
2987        SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
2988
2989        {}
2990};
2991
2992/* codec SSID table for Intel Mac */
2993static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
2994        SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
2995        SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
2996        SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
2997        SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
2998        SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
2999        SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
3000        SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
3001        SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
3002        SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
3003        SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
3004        SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
3005        SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
3006        SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
3007        SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
3008        SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
3009        SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
3010        SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
3011        /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
3012         * so apparently no perfect solution yet
3013         */
3014        SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
3015        SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
3016        SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
3017        {} /* terminator */
3018};
3019
3020static const struct alc_config_preset alc882_presets[] = {
3021        [ALC882_3ST_DIG] = {
3022                .mixers = { alc882_base_mixer },
3023                .init_verbs = { alc882_base_init_verbs,
3024                                alc882_adc1_init_verbs },
3025                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3026                .dac_nids = alc882_dac_nids,
3027                .dig_out_nid = ALC882_DIGOUT_NID,
3028                .dig_in_nid = ALC882_DIGIN_NID,
3029                .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3030                .channel_mode = alc882_ch_modes,
3031                .need_dac_fix = 1,
3032                .input_mux = &alc882_capture_source,
3033        },
3034        [ALC882_6ST_DIG] = {
3035                .mixers = { alc882_base_mixer, alc882_chmode_mixer },
3036                .init_verbs = { alc882_base_init_verbs,
3037                                alc882_adc1_init_verbs },
3038                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3039                .dac_nids = alc882_dac_nids,
3040                .dig_out_nid = ALC882_DIGOUT_NID,
3041                .dig_in_nid = ALC882_DIGIN_NID,
3042                .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
3043                .channel_mode = alc882_sixstack_modes,
3044                .input_mux = &alc882_capture_source,
3045        },
3046        [ALC882_ARIMA] = {
3047                .mixers = { alc882_base_mixer, alc882_chmode_mixer },
3048                .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3049                                alc882_eapd_verbs },
3050                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3051                .dac_nids = alc882_dac_nids,
3052                .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
3053                .channel_mode = alc882_sixstack_modes,
3054                .input_mux = &alc882_capture_source,
3055        },
3056        [ALC882_W2JC] = {
3057                .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
3058                .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3059                                alc882_eapd_verbs, alc880_gpio1_init_verbs },
3060                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3061                .dac_nids = alc882_dac_nids,
3062                .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3063                .channel_mode = alc880_threestack_modes,
3064                .need_dac_fix = 1,
3065                .input_mux = &alc882_capture_source,
3066                .dig_out_nid = ALC882_DIGOUT_NID,
3067        },
3068           [ALC885_MBA21] = {
3069                        .mixers = { alc885_mba21_mixer },
3070                        .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
3071                        .num_dacs = 2,
3072                        .dac_nids = alc882_dac_nids,
3073                        .channel_mode = alc885_mba21_ch_modes,
3074                        .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
3075                        .input_mux = &alc882_capture_source,
3076                        .unsol_event = alc_sku_unsol_event,
3077                        .setup = alc885_mba21_setup,
3078                        .init_hook = alc_hp_automute,
3079       },
3080        [ALC885_MBP3] = {
3081                .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
3082                .init_verbs = { alc885_mbp3_init_verbs,
3083                                alc880_gpio1_init_verbs },
3084                .num_dacs = 2,
3085                .dac_nids = alc882_dac_nids,
3086                .hp_nid = 0x04,
3087                .channel_mode = alc885_mbp_4ch_modes,
3088                .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
3089                .input_mux = &alc882_capture_source,
3090                .dig_out_nid = ALC882_DIGOUT_NID,
3091                .dig_in_nid = ALC882_DIGIN_NID,
3092                .unsol_event = alc_sku_unsol_event,
3093                .setup = alc885_mbp3_setup,
3094                .init_hook = alc_hp_automute,
3095        },
3096        [ALC885_MB5] = {
3097                .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
3098                .init_verbs = { alc885_mb5_init_verbs,
3099                                alc880_gpio1_init_verbs },
3100                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3101                .dac_nids = alc882_dac_nids,
3102                .channel_mode = alc885_mb5_6ch_modes,
3103                .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
3104                .input_mux = &mb5_capture_source,
3105                .dig_out_nid = ALC882_DIGOUT_NID,
3106                .dig_in_nid = ALC882_DIGIN_NID,
3107                .unsol_event = alc_sku_unsol_event,
3108                .setup = alc885_mb5_setup,
3109                .init_hook = alc_hp_automute,
3110        },
3111        [ALC885_MACMINI3] = {
3112                .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
3113                .init_verbs = { alc885_macmini3_init_verbs,
3114                                alc880_gpio1_init_verbs },
3115                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3116                .dac_nids = alc882_dac_nids,
3117                .channel_mode = alc885_macmini3_6ch_modes,
3118                .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
3119                .input_mux = &macmini3_capture_source,
3120                .dig_out_nid = ALC882_DIGOUT_NID,
3121                .dig_in_nid = ALC882_DIGIN_NID,
3122                .unsol_event = alc_sku_unsol_event,
3123                .setup = alc885_macmini3_setup,
3124                .init_hook = alc_hp_automute,
3125        },
3126        [ALC885_MACPRO] = {
3127                .mixers = { alc882_macpro_mixer },
3128                .init_verbs = { alc882_macpro_init_verbs },
3129                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3130                .dac_nids = alc882_dac_nids,
3131                .dig_out_nid = ALC882_DIGOUT_NID,
3132                .dig_in_nid = ALC882_DIGIN_NID,
3133                .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3134                .channel_mode = alc882_ch_modes,
3135                .input_mux = &alc882_capture_source,
3136                .init_hook = alc885_macpro_init_hook,
3137        },
3138        [ALC885_IMAC24] = {
3139                .mixers = { alc885_imac24_mixer },
3140                .init_verbs = { alc885_imac24_init_verbs },
3141                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3142                .dac_nids = alc882_dac_nids,
3143                .dig_out_nid = ALC882_DIGOUT_NID,
3144                .dig_in_nid = ALC882_DIGIN_NID,
3145                .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3146                .channel_mode = alc882_ch_modes,
3147                .input_mux = &alc882_capture_source,
3148                .unsol_event = alc_sku_unsol_event,
3149                .setup = alc885_imac24_setup,
3150                .init_hook = alc885_imac24_init_hook,
3151        },
3152        [ALC885_IMAC91] = {
3153                .mixers = {alc885_imac91_mixer},
3154                .init_verbs = { alc885_imac91_init_verbs,
3155                                alc880_gpio1_init_verbs },
3156                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3157                .dac_nids = alc882_dac_nids,
3158                .channel_mode = alc885_mba21_ch_modes,
3159                .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
3160                .input_mux = &alc889A_imac91_capture_source,
3161                .dig_out_nid = ALC882_DIGOUT_NID,
3162                .dig_in_nid = ALC882_DIGIN_NID,
3163                .unsol_event = alc_sku_unsol_event,
3164                .setup = alc885_imac91_setup,
3165                .init_hook = alc_hp_automute,
3166        },
3167        [ALC882_TARGA] = {
3168                .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
3169                .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3170                                alc880_gpio3_init_verbs, alc882_targa_verbs},
3171                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3172                .dac_nids = alc882_dac_nids,
3173                .dig_out_nid = ALC882_DIGOUT_NID,
3174                .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
3175                .adc_nids = alc882_adc_nids,
3176                .capsrc_nids = alc882_capsrc_nids,
3177                .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
3178                .channel_mode = alc882_3ST_6ch_modes,
3179                .need_dac_fix = 1,
3180                .input_mux = &alc882_capture_source,
3181                .unsol_event = alc_sku_unsol_event,
3182                .setup = alc882_targa_setup,
3183                .init_hook = alc882_targa_automute,
3184        },
3185        [ALC882_ASUS_A7J] = {
3186                .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
3187                .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3188                                alc882_asus_a7j_verbs},
3189                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3190                .dac_nids = alc882_dac_nids,
3191                .dig_out_nid = ALC882_DIGOUT_NID,
3192                .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
3193                .adc_nids = alc882_adc_nids,
3194                .capsrc_nids = alc882_capsrc_nids,
3195                .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
3196                .channel_mode = alc882_3ST_6ch_modes,
3197                .need_dac_fix = 1,
3198                .input_mux = &alc882_capture_source,
3199        },
3200        [ALC882_ASUS_A7M] = {
3201                .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
3202                .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3203                                alc882_eapd_verbs, alc880_gpio1_init_verbs,
3204                                alc882_asus_a7m_verbs },
3205                .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3206                .dac_nids = alc882_dac_nids,
3207                .dig_out_nid = ALC882_DIGOUT_NID,
3208                .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3209                .channel_mode = alc880_threestack_modes,
3210                .need_dac_fix = 1,
3211                .input_mux = &alc882_capture_source,
3212        },
3213        [ALC883_3ST_2ch_DIG] = {
3214                .mixers = { alc883_3ST_2ch_mixer },
3215                .init_verbs = { alc883_init_verbs },
3216                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3217                .dac_nids = alc883_dac_nids,
3218                .dig_out_nid = ALC883_DIGOUT_NID,
3219                .dig_in_nid = ALC883_DIGIN_NID,
3220                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3221                .channel_mode = alc883_3ST_2ch_modes,
3222                .input_mux = &alc883_capture_source,
3223        },
3224        [ALC883_3ST_6ch_DIG] = {
3225                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3226                .init_verbs = { alc883_init_verbs },
3227                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3228                .dac_nids = alc883_dac_nids,
3229                .dig_out_nid = ALC883_DIGOUT_NID,
3230                .dig_in_nid = ALC883_DIGIN_NID,
3231                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3232                .channel_mode = alc883_3ST_6ch_modes,
3233                .need_dac_fix = 1,
3234                .input_mux = &alc883_capture_source,
3235        },
3236        [ALC883_3ST_6ch] = {
3237                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3238                .init_verbs = { alc883_init_verbs },
3239                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3240                .dac_nids = alc883_dac_nids,
3241                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3242                .channel_mode = alc883_3ST_6ch_modes,
3243                .need_dac_fix = 1,
3244                .input_mux = &alc883_capture_source,
3245        },
3246        [ALC883_3ST_6ch_INTEL] = {
3247                .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
3248                .init_verbs = { alc883_init_verbs },
3249                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3250                .dac_nids = alc883_dac_nids,
3251                .dig_out_nid = ALC883_DIGOUT_NID,
3252                .dig_in_nid = ALC883_DIGIN_NID,
3253                .slave_dig_outs = alc883_slave_dig_outs,
3254                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
3255                .channel_mode = alc883_3ST_6ch_intel_modes,
3256                .need_dac_fix = 1,
3257                .input_mux = &alc883_3stack_6ch_intel,
3258        },
3259        [ALC889A_INTEL] = {
3260                .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
3261                .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
3262                                alc_hp15_unsol_verbs },
3263                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3264                .dac_nids = alc883_dac_nids,
3265                .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3266                .adc_nids = alc889_adc_nids,
3267                .dig_out_nid = ALC883_DIGOUT_NID,
3268                .dig_in_nid = ALC883_DIGIN_NID,
3269                .slave_dig_outs = alc883_slave_dig_outs,
3270                .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
3271                .channel_mode = alc889_8ch_intel_modes,
3272                .capsrc_nids = alc889_capsrc_nids,
3273                .input_mux = &alc889_capture_source,
3274                .setup = alc889_automute_setup,
3275                .init_hook = alc_hp_automute,
3276                .unsol_event = alc_sku_unsol_event,
3277                .need_dac_fix = 1,
3278        },
3279        [ALC889_INTEL] = {
3280                .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
3281                .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
3282                                alc889_eapd_verbs, alc_hp15_unsol_verbs},
3283                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3284                .dac_nids = alc883_dac_nids,
3285                .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3286                .adc_nids = alc889_adc_nids,
3287                .dig_out_nid = ALC883_DIGOUT_NID,
3288                .dig_in_nid = ALC883_DIGIN_NID,
3289                .slave_dig_outs = alc883_slave_dig_outs,
3290                .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
3291                .channel_mode = alc889_8ch_intel_modes,
3292                .capsrc_nids = alc889_capsrc_nids,
3293                .input_mux = &alc889_capture_source,
3294                .setup = alc889_automute_setup,
3295                .init_hook = alc889_intel_init_hook,
3296                .unsol_event = alc_sku_unsol_event,
3297                .need_dac_fix = 1,
3298        },
3299        [ALC883_6ST_DIG] = {
3300                .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3301                .init_verbs = { alc883_init_verbs },
3302                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3303                .dac_nids = alc883_dac_nids,
3304                .dig_out_nid = ALC883_DIGOUT_NID,
3305                .dig_in_nid = ALC883_DIGIN_NID,
3306                .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3307                .channel_mode = alc883_sixstack_modes,
3308                .input_mux = &alc883_capture_source,
3309        },
3310        [ALC883_TARGA_DIG] = {
3311                .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
3312                .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3313                                alc883_targa_verbs},
3314                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3315                .dac_nids = alc883_dac_nids,
3316                .dig_out_nid = ALC883_DIGOUT_NID,
3317                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3318                .channel_mode = alc883_3ST_6ch_modes,
3319                .need_dac_fix = 1,
3320                .input_mux = &alc883_capture_source,
3321                .unsol_event = alc883_targa_unsol_event,
3322                .setup = alc882_targa_setup,
3323                .init_hook = alc882_targa_automute,
3324        },
3325        [ALC883_TARGA_2ch_DIG] = {
3326                .mixers = { alc883_targa_2ch_mixer},
3327                .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3328                                alc883_targa_verbs},
3329                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3330                .dac_nids = alc883_dac_nids,
3331                .adc_nids = alc883_adc_nids_alt,
3332                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3333                .capsrc_nids = alc883_capsrc_nids,
3334                .dig_out_nid = ALC883_DIGOUT_NID,
3335                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3336                .channel_mode = alc883_3ST_2ch_modes,
3337                .input_mux = &alc883_capture_source,
3338                .unsol_event = alc883_targa_unsol_event,
3339                .setup = alc882_targa_setup,
3340                .init_hook = alc882_targa_automute,
3341        },
3342        [ALC883_TARGA_8ch_DIG] = {
3343                .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
3344                            alc883_chmode_mixer },
3345                .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3346                                alc883_targa_verbs },
3347                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3348                .dac_nids = alc883_dac_nids,
3349                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3350                .adc_nids = alc883_adc_nids_rev,
3351                .capsrc_nids = alc883_capsrc_nids_rev,
3352                .dig_out_nid = ALC883_DIGOUT_NID,
3353                .dig_in_nid = ALC883_DIGIN_NID,
3354                .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
3355                .channel_mode = alc883_4ST_8ch_modes,
3356                .need_dac_fix = 1,
3357                .input_mux = &alc883_capture_source,
3358                .unsol_event = alc883_targa_unsol_event,
3359                .setup = alc882_targa_setup,
3360                .init_hook = alc882_targa_automute,
3361        },
3362        [ALC883_ACER] = {
3363                .mixers = { alc883_base_mixer },
3364                /* On TravelMate laptops, GPIO 0 enables the internal speaker
3365                 * and the headphone jack.  Turn this on and rely on the
3366                 * standard mute methods whenever the user wants to turn
3367                 * these outputs off.
3368                 */
3369                .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
3370                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3371                .dac_nids = alc883_dac_nids,
3372                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3373                .channel_mode = alc883_3ST_2ch_modes,
3374                .input_mux = &alc883_capture_source,
3375        },
3376        [ALC883_ACER_ASPIRE] = {
3377                .mixers = { alc883_acer_aspire_mixer },
3378                .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
3379                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3380                .dac_nids = alc883_dac_nids,
3381                .dig_out_nid = ALC883_DIGOUT_NID,
3382                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3383                .channel_mode = alc883_3ST_2ch_modes,
3384                .input_mux = &alc883_capture_source,
3385                .unsol_event = alc_sku_unsol_event,
3386                .setup = alc883_acer_aspire_setup,
3387                .init_hook = alc_hp_automute,
3388        },
3389        [ALC888_ACER_ASPIRE_4930G] = {
3390                .mixers = { alc888_acer_aspire_4930g_mixer,
3391                                alc883_chmode_mixer },
3392                .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3393                                alc888_acer_aspire_4930g_verbs },
3394                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3395                .dac_nids = alc883_dac_nids,
3396                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3397                .adc_nids = alc883_adc_nids_rev,
3398                .capsrc_nids = alc883_capsrc_nids_rev,
3399                .dig_out_nid = ALC883_DIGOUT_NID,
3400                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3401                .channel_mode = alc883_3ST_6ch_modes,
3402                .need_dac_fix = 1,
3403                .const_channel_count = 6,
3404                .num_mux_defs =
3405                        ARRAY_SIZE(alc888_2_capture_sources),
3406                .input_mux = alc888_2_capture_sources,
3407                .unsol_event = alc_sku_unsol_event,
3408                .setup = alc888_acer_aspire_4930g_setup,
3409                .init_hook = alc_hp_automute,
3410        },
3411        [ALC888_ACER_ASPIRE_6530G] = {
3412                .mixers = { alc888_acer_aspire_6530_mixer },
3413                .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3414                                alc888_acer_aspire_6530g_verbs },
3415                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3416                .dac_nids = alc883_dac_nids,
3417                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3418                .adc_nids = alc883_adc_nids_rev,
3419                .capsrc_nids = alc883_capsrc_nids_rev,
3420                .dig_out_nid = ALC883_DIGOUT_NID,
3421                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3422                .channel_mode = alc883_3ST_2ch_modes,
3423                .num_mux_defs =
3424                        ARRAY_SIZE(alc888_2_capture_sources),
3425                .input_mux = alc888_acer_aspire_6530_sources,
3426                .unsol_event = alc_sku_unsol_event,
3427                .setup = alc888_acer_aspire_6530g_setup,
3428                .init_hook = alc_hp_automute,
3429        },
3430        [ALC888_ACER_ASPIRE_8930G] = {
3431                .mixers = { alc889_acer_aspire_8930g_mixer,
3432                                alc883_chmode_mixer },
3433                .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3434                                alc889_acer_aspire_8930g_verbs,
3435                                alc889_eapd_verbs},
3436                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3437                .dac_nids = alc883_dac_nids,
3438                .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3439                .adc_nids = alc889_adc_nids,
3440                .capsrc_nids = alc889_capsrc_nids,
3441                .dig_out_nid = ALC883_DIGOUT_NID,
3442                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3443                .channel_mode = alc883_3ST_6ch_modes,
3444                .need_dac_fix = 1,
3445                .const_channel_count = 6,
3446                .num_mux_defs =
3447                        ARRAY_SIZE(alc889_capture_sources),
3448                .input_mux = alc889_capture_sources,
3449                .unsol_event = alc_sku_unsol_event,
3450                .setup = alc889_acer_aspire_8930g_setup,
3451                .init_hook = alc_hp_automute,
3452#ifdef CONFIG_SND_HDA_POWER_SAVE
3453                .power_hook = alc_power_eapd,
3454#endif
3455        },
3456        [ALC888_ACER_ASPIRE_7730G] = {
3457                .mixers = { alc883_3ST_6ch_mixer,
3458                                alc883_chmode_mixer },
3459                .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3460                                alc888_acer_aspire_7730G_verbs },
3461                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3462                .dac_nids = alc883_dac_nids,
3463                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3464                .adc_nids = alc883_adc_nids_rev,
3465                .capsrc_nids = alc883_capsrc_nids_rev,
3466                .dig_out_nid = ALC883_DIGOUT_NID,
3467                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3468                .channel_mode = alc883_3ST_6ch_modes,
3469                .need_dac_fix = 1,
3470                .const_channel_count = 6,
3471                .input_mux = &alc883_capture_source,
3472                .unsol_event = alc_sku_unsol_event,
3473                .setup = alc888_acer_aspire_7730g_setup,
3474                .init_hook = alc_hp_automute,
3475        },
3476        [ALC883_MEDION] = {
3477                .mixers = { alc883_fivestack_mixer,
3478                            alc883_chmode_mixer },
3479                .init_verbs = { alc883_init_verbs,
3480                                alc883_medion_eapd_verbs },
3481                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3482                .dac_nids = alc883_dac_nids,
3483                .adc_nids = alc883_adc_nids_alt,
3484                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3485                .capsrc_nids = alc883_capsrc_nids,
3486                .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3487                .channel_mode = alc883_sixstack_modes,
3488                .input_mux = &alc883_capture_source,
3489        },
3490        [ALC883_MEDION_WIM2160] = {
3491                .mixers = { alc883_medion_wim2160_mixer },
3492                .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
3493                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3494                .dac_nids = alc883_dac_nids,
3495                .dig_out_nid = ALC883_DIGOUT_NID,
3496                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
3497                .adc_nids = alc883_adc_nids,
3498                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3499                .channel_mode = alc883_3ST_2ch_modes,
3500                .input_mux = &alc883_capture_source,
3501                .unsol_event = alc_sku_unsol_event,
3502                .setup = alc883_medion_wim2160_setup,
3503                .init_hook = alc_hp_automute,
3504        },
3505        [ALC883_LAPTOP_EAPD] = {
3506                .mixers = { alc883_base_mixer },
3507                .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
3508                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3509                .dac_nids = alc883_dac_nids,
3510                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3511                .channel_mode = alc883_3ST_2ch_modes,
3512                .input_mux = &alc883_capture_source,
3513        },
3514        [ALC883_CLEVO_M540R] = {
3515                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3516                .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
3517                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3518                .dac_nids = alc883_dac_nids,
3519                .dig_out_nid = ALC883_DIGOUT_NID,
3520                .dig_in_nid = ALC883_DIGIN_NID,
3521                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
3522                .channel_mode = alc883_3ST_6ch_clevo_modes,
3523                .need_dac_fix = 1,
3524                .input_mux = &alc883_capture_source,
3525                /* This machine has the hardware HP auto-muting, thus
3526                 * we need no software mute via unsol event
3527                 */
3528        },
3529        [ALC883_CLEVO_M720] = {
3530                .mixers = { alc883_clevo_m720_mixer },
3531                .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
3532                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3533                .dac_nids = alc883_dac_nids,
3534                .dig_out_nid = ALC883_DIGOUT_NID,
3535                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3536                .channel_mode = alc883_3ST_2ch_modes,
3537                .input_mux = &alc883_capture_source,
3538                .unsol_event = alc883_clevo_m720_unsol_event,
3539                .setup = alc883_clevo_m720_setup,
3540                .init_hook = alc883_clevo_m720_init_hook,
3541        },
3542        [ALC883_LENOVO_101E_2ch] = {
3543                .mixers = { alc883_lenovo_101e_2ch_mixer},
3544                .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
3545                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3546                .dac_nids = alc883_dac_nids,
3547                .adc_nids = alc883_adc_nids_alt,
3548                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3549                .capsrc_nids = alc883_capsrc_nids,
3550                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3551                .channel_mode = alc883_3ST_2ch_modes,
3552                .input_mux = &alc883_lenovo_101e_capture_source,
3553                .setup = alc883_lenovo_101e_setup,
3554                .unsol_event = alc_sku_unsol_event,
3555                .init_hook = alc_inithook,
3556        },
3557        [ALC883_LENOVO_NB0763] = {
3558                .mixers = { alc883_lenovo_nb0763_mixer },
3559                .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
3560                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3561                .dac_nids = alc883_dac_nids,
3562                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3563                .channel_mode = alc883_3ST_2ch_modes,
3564                .need_dac_fix = 1,
3565                .input_mux = &alc883_lenovo_nb0763_capture_source,
3566                .unsol_event = alc_sku_unsol_event,
3567                .setup = alc883_lenovo_nb0763_setup,
3568                .init_hook = alc_hp_automute,
3569        },
3570        [ALC888_LENOVO_MS7195_DIG] = {
3571                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3572                .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
3573                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3574                .dac_nids = alc883_dac_nids,
3575                .dig_out_nid = ALC883_DIGOUT_NID,
3576                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3577                .channel_mode = alc883_3ST_6ch_modes,
3578                .need_dac_fix = 1,
3579                .input_mux = &alc883_capture_source,
3580                .unsol_event = alc_sku_unsol_event,
3581                .setup = alc888_lenovo_ms7195_setup,
3582                .init_hook = alc_inithook,
3583        },
3584        [ALC883_HAIER_W66] = {
3585                .mixers = { alc883_targa_2ch_mixer},
3586                .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
3587                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3588                .dac_nids = alc883_dac_nids,
3589                .dig_out_nid = ALC883_DIGOUT_NID,
3590                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3591                .channel_mode = alc883_3ST_2ch_modes,
3592                .input_mux = &alc883_capture_source,
3593                .unsol_event = alc_sku_unsol_event,
3594                .setup = alc883_haier_w66_setup,
3595                .init_hook = alc_hp_automute,
3596        },
3597        [ALC888_3ST_HP] = {
3598                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3599                .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
3600                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3601                .dac_nids = alc883_dac_nids,
3602                .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
3603                .channel_mode = alc888_3st_hp_modes,
3604                .need_dac_fix = 1,
3605                .input_mux = &alc883_capture_source,
3606                .unsol_event = alc_sku_unsol_event,
3607                .setup = alc888_3st_hp_setup,
3608                .init_hook = alc_hp_automute,
3609        },
3610        [ALC888_6ST_DELL] = {
3611                .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3612                .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
3613                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3614                .dac_nids = alc883_dac_nids,
3615                .dig_out_nid = ALC883_DIGOUT_NID,
3616                .dig_in_nid = ALC883_DIGIN_NID,
3617                .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3618                .channel_mode = alc883_sixstack_modes,
3619                .input_mux = &alc883_capture_source,
3620                .unsol_event = alc_sku_unsol_event,
3621                .setup = alc888_6st_dell_setup,
3622                .init_hook = alc_hp_automute,
3623        },
3624        [ALC883_MITAC] = {
3625                .mixers = { alc883_mitac_mixer },
3626                .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
3627                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3628                .dac_nids = alc883_dac_nids,
3629                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3630                .channel_mode = alc883_3ST_2ch_modes,
3631                .input_mux = &alc883_capture_source,
3632                .unsol_event = alc_sku_unsol_event,
3633                .setup = alc883_mitac_setup,
3634                .init_hook = alc_hp_automute,
3635        },
3636        [ALC883_FUJITSU_PI2515] = {
3637                .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
3638                .init_verbs = { alc883_init_verbs,
3639                                alc883_2ch_fujitsu_pi2515_verbs},
3640                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3641                .dac_nids = alc883_dac_nids,
3642                .dig_out_nid = ALC883_DIGOUT_NID,
3643                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3644                .channel_mode = alc883_3ST_2ch_modes,
3645                .input_mux = &alc883_fujitsu_pi2515_capture_source,
3646                .unsol_event = alc_sku_unsol_event,
3647                .setup = alc883_2ch_fujitsu_pi2515_setup,
3648                .init_hook = alc_hp_automute,
3649        },
3650        [ALC888_FUJITSU_XA3530] = {
3651                .mixers = { alc888_base_mixer, alc883_chmode_mixer },
3652                .init_verbs = { alc883_init_verbs,
3653                        alc888_fujitsu_xa3530_verbs },
3654                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3655                .dac_nids = alc883_dac_nids,
3656                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3657                .adc_nids = alc883_adc_nids_rev,
3658                .capsrc_nids = alc883_capsrc_nids_rev,
3659                .dig_out_nid = ALC883_DIGOUT_NID,
3660                .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
3661                .channel_mode = alc888_4ST_8ch_intel_modes,
3662                .num_mux_defs =
3663                        ARRAY_SIZE(alc888_2_capture_sources),
3664                .input_mux = alc888_2_capture_sources,
3665                .unsol_event = alc_sku_unsol_event,
3666                .setup = alc888_fujitsu_xa3530_setup,
3667                .init_hook = alc_hp_automute,
3668        },
3669        [ALC888_LENOVO_SKY] = {
3670                .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
3671                .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
3672                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3673                .dac_nids = alc883_dac_nids,
3674                .dig_out_nid = ALC883_DIGOUT_NID,
3675                .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3676                .channel_mode = alc883_sixstack_modes,
3677                .need_dac_fix = 1,
3678                .input_mux = &alc883_lenovo_sky_capture_source,
3679                .unsol_event = alc_sku_unsol_event,
3680                .setup = alc888_lenovo_sky_setup,
3681                .init_hook = alc_hp_automute,
3682        },
3683        [ALC888_ASUS_M90V] = {
3684                .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3685                .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
3686                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3687                .dac_nids = alc883_dac_nids,
3688                .dig_out_nid = ALC883_DIGOUT_NID,
3689                .dig_in_nid = ALC883_DIGIN_NID,
3690                .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3691                .channel_mode = alc883_3ST_6ch_modes,
3692                .need_dac_fix = 1,
3693                .input_mux = &alc883_fujitsu_pi2515_capture_source,
3694                .unsol_event = alc_sku_unsol_event,
3695                .setup = alc883_mode2_setup,
3696                .init_hook = alc_inithook,
3697        },
3698        [ALC888_ASUS_EEE1601] = {
3699                .mixers = { alc883_asus_eee1601_mixer },
3700                .cap_mixer = alc883_asus_eee1601_cap_mixer,
3701                .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
3702                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3703                .dac_nids = alc883_dac_nids,
3704                .dig_out_nid = ALC883_DIGOUT_NID,
3705                .dig_in_nid = ALC883_DIGIN_NID,
3706                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3707                .channel_mode = alc883_3ST_2ch_modes,
3708                .need_dac_fix = 1,
3709                .input_mux = &alc883_asus_eee1601_capture_source,
3710                .unsol_event = alc_sku_unsol_event,
3711                .init_hook = alc883_eee1601_inithook,
3712        },
3713        [ALC1200_ASUS_P5Q] = {
3714                .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3715                .init_verbs = { alc883_init_verbs },
3716                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3717                .dac_nids = alc883_dac_nids,
3718                .dig_out_nid = ALC1200_DIGOUT_NID,
3719                .dig_in_nid = ALC883_DIGIN_NID,
3720                .slave_dig_outs = alc1200_slave_dig_outs,
3721                .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3722                .channel_mode = alc883_sixstack_modes,
3723                .input_mux = &alc883_capture_source,
3724        },
3725        [ALC889A_MB31] = {
3726                .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
3727                .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
3728                        alc880_gpio1_init_verbs },
3729                .adc_nids = alc883_adc_nids,
3730                .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
3731                .capsrc_nids = alc883_capsrc_nids,
3732                .dac_nids = alc883_dac_nids,
3733                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3734                .channel_mode = alc889A_mb31_6ch_modes,
3735                .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
3736                .input_mux = &alc889A_mb31_capture_source,
3737                .dig_out_nid = ALC883_DIGOUT_NID,
3738                .unsol_event = alc889A_mb31_unsol_event,
3739                .init_hook = alc889A_mb31_automute,
3740        },
3741        [ALC883_SONY_VAIO_TT] = {
3742                .mixers = { alc883_vaiott_mixer },
3743                .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
3744                .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3745                .dac_nids = alc883_dac_nids,
3746                .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3747                .channel_mode = alc883_3ST_2ch_modes,
3748                .input_mux = &alc883_capture_source,
3749                .unsol_event = alc_sku_unsol_event,
3750                .setup = alc883_vaiott_setup,
3751                .init_hook = alc_hp_automute,
3752        },
3753};
3754
3755
3756