aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c2565
1 files changed, 1469 insertions, 1096 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index bcbb736f94f..33453319742 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -190,6 +190,7 @@ enum {
190 ALC663_ASUS_MODE6, 190 ALC663_ASUS_MODE6,
191 ALC272_DELL, 191 ALC272_DELL,
192 ALC272_DELL_ZM1, 192 ALC272_DELL_ZM1,
193 ALC272_SAMSUNG_NC10,
193 ALC662_AUTO, 194 ALC662_AUTO,
194 ALC662_MODEL_LAST, 195 ALC662_MODEL_LAST,
195}; 196};
@@ -205,6 +206,7 @@ enum {
205 ALC882_ASUS_A7M, 206 ALC882_ASUS_A7M,
206 ALC885_MACPRO, 207 ALC885_MACPRO,
207 ALC885_MBP3, 208 ALC885_MBP3,
209 ALC885_MB5,
208 ALC885_IMAC24, 210 ALC885_IMAC24,
209 ALC882_AUTO, 211 ALC882_AUTO,
210 ALC882_MODEL_LAST, 212 ALC882_MODEL_LAST,
@@ -218,9 +220,12 @@ enum {
218 ALC883_6ST_DIG, 220 ALC883_6ST_DIG,
219 ALC883_TARGA_DIG, 221 ALC883_TARGA_DIG,
220 ALC883_TARGA_2ch_DIG, 222 ALC883_TARGA_2ch_DIG,
223 ALC883_TARGA_8ch_DIG,
221 ALC883_ACER, 224 ALC883_ACER,
222 ALC883_ACER_ASPIRE, 225 ALC883_ACER_ASPIRE,
223 ALC888_ACER_ASPIRE_4930G, 226 ALC888_ACER_ASPIRE_4930G,
227 ALC888_ACER_ASPIRE_6530G,
228 ALC888_ACER_ASPIRE_8930G,
224 ALC883_MEDION, 229 ALC883_MEDION,
225 ALC883_MEDION_MD2, 230 ALC883_MEDION_MD2,
226 ALC883_LAPTOP_EAPD, 231 ALC883_LAPTOP_EAPD,
@@ -238,21 +243,25 @@ enum {
238 ALC883_3ST_6ch_INTEL, 243 ALC883_3ST_6ch_INTEL,
239 ALC888_ASUS_M90V, 244 ALC888_ASUS_M90V,
240 ALC888_ASUS_EEE1601, 245 ALC888_ASUS_EEE1601,
246 ALC889A_MB31,
241 ALC1200_ASUS_P5Q, 247 ALC1200_ASUS_P5Q,
248 ALC883_SONY_VAIO_TT,
242 ALC883_AUTO, 249 ALC883_AUTO,
243 ALC883_MODEL_LAST, 250 ALC883_MODEL_LAST,
244}; 251};
245 252
246/* styles of capture selection */
247enum {
248 CAPT_MUX = 0, /* only mux based */
249 CAPT_MIX, /* only mixer based */
250 CAPT_1MUX_MIX, /* first mux and other mixers */
251};
252
253/* for GPIO Poll */ 253/* for GPIO Poll */
254#define GPIO_MASK 0x03 254#define GPIO_MASK 0x03
255 255
256/* extra amp-initialization sequence types */
257enum {
258 ALC_INIT_NONE,
259 ALC_INIT_DEFAULT,
260 ALC_INIT_GPIO1,
261 ALC_INIT_GPIO2,
262 ALC_INIT_GPIO3,
263};
264
256struct alc_spec { 265struct alc_spec {
257 /* codec parameterization */ 266 /* codec parameterization */
258 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 267 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
@@ -266,13 +275,13 @@ struct alc_spec {
266 */ 275 */
267 unsigned int num_init_verbs; 276 unsigned int num_init_verbs;
268 277
269 char *stream_name_analog; /* analog PCM stream */ 278 char stream_name_analog[16]; /* analog PCM stream */
270 struct hda_pcm_stream *stream_analog_playback; 279 struct hda_pcm_stream *stream_analog_playback;
271 struct hda_pcm_stream *stream_analog_capture; 280 struct hda_pcm_stream *stream_analog_capture;
272 struct hda_pcm_stream *stream_analog_alt_playback; 281 struct hda_pcm_stream *stream_analog_alt_playback;
273 struct hda_pcm_stream *stream_analog_alt_capture; 282 struct hda_pcm_stream *stream_analog_alt_capture;
274 283
275 char *stream_name_digital; /* digital PCM stream */ 284 char stream_name_digital[16]; /* digital PCM stream */
276 struct hda_pcm_stream *stream_digital_playback; 285 struct hda_pcm_stream *stream_digital_playback;
277 struct hda_pcm_stream *stream_digital_capture; 286 struct hda_pcm_stream *stream_digital_capture;
278 287
@@ -290,7 +299,6 @@ struct alc_spec {
290 hda_nid_t *adc_nids; 299 hda_nid_t *adc_nids;
291 hda_nid_t *capsrc_nids; 300 hda_nid_t *capsrc_nids;
292 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 301 hda_nid_t dig_in_nid; /* digital-in NID; optional */
293 int capture_style; /* capture style (CAPT_*) */
294 302
295 /* capture source */ 303 /* capture source */
296 unsigned int num_mux_defs; 304 unsigned int num_mux_defs;
@@ -301,6 +309,8 @@ struct alc_spec {
301 const struct hda_channel_mode *channel_mode; 309 const struct hda_channel_mode *channel_mode;
302 int num_channel_mode; 310 int num_channel_mode;
303 int need_dac_fix; 311 int need_dac_fix;
312 int const_channel_count;
313 int ext_channel_count;
304 314
305 /* PCM information */ 315 /* PCM information */
306 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 316 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
@@ -322,6 +332,7 @@ struct alc_spec {
322 332
323 /* other flags */ 333 /* other flags */
324 unsigned int no_analog :1; /* digital I/O only */ 334 unsigned int no_analog :1; /* digital I/O only */
335 int init_amp;
325 336
326 /* for virtual master */ 337 /* for virtual master */
327 hda_nid_t vmaster_nid; 338 hda_nid_t vmaster_nid;
@@ -355,6 +366,7 @@ struct alc_config_preset {
355 unsigned int num_channel_mode; 366 unsigned int num_channel_mode;
356 const struct hda_channel_mode *channel_mode; 367 const struct hda_channel_mode *channel_mode;
357 int need_dac_fix; 368 int need_dac_fix;
369 int const_channel_count;
358 unsigned int num_mux_defs; 370 unsigned int num_mux_defs;
359 const struct hda_input_mux *input_mux; 371 const struct hda_input_mux *input_mux;
360 void (*unsol_event)(struct hda_codec *, unsigned int); 372 void (*unsol_event)(struct hda_codec *, unsigned int);
@@ -400,12 +412,13 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
400 unsigned int mux_idx; 412 unsigned int mux_idx;
401 hda_nid_t nid = spec->capsrc_nids ? 413 hda_nid_t nid = spec->capsrc_nids ?
402 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 414 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
415 unsigned int type;
403 416
404 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 417 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
405 imux = &spec->input_mux[mux_idx]; 418 imux = &spec->input_mux[mux_idx];
406 419
407 if (spec->capture_style && 420 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
408 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { 421 if (type == AC_WID_AUD_MIX) {
409 /* Matrix-mixer style (e.g. ALC882) */ 422 /* Matrix-mixer style (e.g. ALC882) */
410 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 423 unsigned int *cur_val = &spec->cur_mux[adc_idx];
411 unsigned int i, idx; 424 unsigned int i, idx;
@@ -449,7 +462,7 @@ static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
449 struct alc_spec *spec = codec->spec; 462 struct alc_spec *spec = codec->spec;
450 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, 463 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
451 spec->num_channel_mode, 464 spec->num_channel_mode,
452 spec->multiout.max_channels); 465 spec->ext_channel_count);
453} 466}
454 467
455static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, 468static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
@@ -459,9 +472,12 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
459 struct alc_spec *spec = codec->spec; 472 struct alc_spec *spec = codec->spec;
460 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 473 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
461 spec->num_channel_mode, 474 spec->num_channel_mode,
462 &spec->multiout.max_channels); 475 &spec->ext_channel_count);
463 if (err >= 0 && spec->need_dac_fix) 476 if (err >= 0 && !spec->const_channel_count) {
464 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 477 spec->multiout.max_channels = spec->ext_channel_count;
478 if (spec->need_dac_fix)
479 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
480 }
465 return err; 481 return err;
466} 482}
467 483
@@ -776,6 +792,12 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
776 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 792 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
777 if (pincap & AC_PINCAP_VREF_80) 793 if (pincap & AC_PINCAP_VREF_80)
778 val = PIN_VREF80; 794 val = PIN_VREF80;
795 else if (pincap & AC_PINCAP_VREF_50)
796 val = PIN_VREF50;
797 else if (pincap & AC_PINCAP_VREF_100)
798 val = PIN_VREF100;
799 else if (pincap & AC_PINCAP_VREF_GRD)
800 val = PIN_VREFGRD;
779 } 801 }
780 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); 802 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
781} 803}
@@ -835,8 +857,13 @@ static void setup_preset(struct alc_spec *spec,
835 spec->channel_mode = preset->channel_mode; 857 spec->channel_mode = preset->channel_mode;
836 spec->num_channel_mode = preset->num_channel_mode; 858 spec->num_channel_mode = preset->num_channel_mode;
837 spec->need_dac_fix = preset->need_dac_fix; 859 spec->need_dac_fix = preset->need_dac_fix;
860 spec->const_channel_count = preset->const_channel_count;
838 861
839 spec->multiout.max_channels = spec->channel_mode[0].channels; 862 if (preset->const_channel_count)
863 spec->multiout.max_channels = preset->const_channel_count;
864 else
865 spec->multiout.max_channels = spec->channel_mode[0].channels;
866 spec->ext_channel_count = spec->channel_mode[0].channels;
840 867
841 spec->multiout.num_dacs = preset->num_dacs; 868 spec->multiout.num_dacs = preset->num_dacs;
842 spec->multiout.dac_nids = preset->dac_nids; 869 spec->multiout.dac_nids = preset->dac_nids;
@@ -915,23 +942,29 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
915 alc_fix_pll(codec); 942 alc_fix_pll(codec);
916} 943}
917 944
918static void alc_sku_automute(struct hda_codec *codec) 945static void alc_automute_pin(struct hda_codec *codec)
919{ 946{
920 struct alc_spec *spec = codec->spec; 947 struct alc_spec *spec = codec->spec;
921 unsigned int present; 948 unsigned int present;
922 unsigned int hp_nid = spec->autocfg.hp_pins[0]; 949 unsigned int nid = spec->autocfg.hp_pins[0];
923 unsigned int sp_nid = spec->autocfg.speaker_pins[0]; 950 int i;
924 951
925 /* need to execute and sync at first */ 952 /* need to execute and sync at first */
926 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); 953 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
927 present = snd_hda_codec_read(codec, hp_nid, 0, 954 present = snd_hda_codec_read(codec, nid, 0,
928 AC_VERB_GET_PIN_SENSE, 0); 955 AC_VERB_GET_PIN_SENSE, 0);
929 spec->jack_present = (present & 0x80000000) != 0; 956 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
930 snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 957 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
931 spec->jack_present ? 0 : PIN_OUT); 958 nid = spec->autocfg.speaker_pins[i];
959 if (!nid)
960 break;
961 snd_hda_codec_write(codec, nid, 0,
962 AC_VERB_SET_PIN_WIDGET_CONTROL,
963 spec->jack_present ? 0 : PIN_OUT);
964 }
932} 965}
933 966
934#if 0 /* it's broken in some acses -- temporarily disabled */ 967#if 0 /* it's broken in some cases -- temporarily disabled */
935static void alc_mic_automute(struct hda_codec *codec) 968static void alc_mic_automute(struct hda_codec *codec)
936{ 969{
937 struct alc_spec *spec = codec->spec; 970 struct alc_spec *spec = codec->spec;
@@ -963,16 +996,19 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
963 res >>= 28; 996 res >>= 28;
964 else 997 else
965 res >>= 26; 998 res >>= 26;
966 if (res == ALC880_HP_EVENT) 999 switch (res) {
967 alc_sku_automute(codec); 1000 case ALC880_HP_EVENT:
968 1001 alc_automute_pin(codec);
969 if (res == ALC880_MIC_EVENT) 1002 break;
1003 case ALC880_MIC_EVENT:
970 alc_mic_automute(codec); 1004 alc_mic_automute(codec);
1005 break;
1006 }
971} 1007}
972 1008
973static void alc_inithook(struct hda_codec *codec) 1009static void alc_inithook(struct hda_codec *codec)
974{ 1010{
975 alc_sku_automute(codec); 1011 alc_automute_pin(codec);
976 alc_mic_automute(codec); 1012 alc_mic_automute(codec);
977} 1013}
978 1014
@@ -994,69 +1030,21 @@ static void alc888_coef_init(struct hda_codec *codec)
994 AC_VERB_SET_PROC_COEF, 0x3030); 1030 AC_VERB_SET_PROC_COEF, 0x3030);
995} 1031}
996 1032
997/* 32-bit subsystem ID for BIOS loading in HD Audio codec. 1033static void alc_auto_init_amp(struct hda_codec *codec, int type)
998 * 31 ~ 16 : Manufacture ID
999 * 15 ~ 8 : SKU ID
1000 * 7 ~ 0 : Assembly ID
1001 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1002 */
1003static void alc_subsystem_id(struct hda_codec *codec,
1004 unsigned int porta, unsigned int porte,
1005 unsigned int portd)
1006{ 1034{
1007 unsigned int ass, tmp, i; 1035 unsigned int tmp;
1008 unsigned nid;
1009 struct alc_spec *spec = codec->spec;
1010
1011 ass = codec->subsystem_id & 0xffff;
1012 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1013 goto do_sku;
1014
1015 /*
1016 * 31~30 : port conetcivity
1017 * 29~21 : reserve
1018 * 20 : PCBEEP input
1019 * 19~16 : Check sum (15:1)
1020 * 15~1 : Custom
1021 * 0 : override
1022 */
1023 nid = 0x1d;
1024 if (codec->vendor_id == 0x10ec0260)
1025 nid = 0x17;
1026 ass = snd_hda_codec_get_pincfg(codec, nid);
1027 if (!(ass & 1) && !(ass & 0x100000))
1028 return;
1029 if ((ass >> 30) != 1) /* no physical connection */
1030 return;
1031 1036
1032 /* check sum */ 1037 switch (type) {
1033 tmp = 0; 1038 case ALC_INIT_GPIO1:
1034 for (i = 1; i < 16; i++) {
1035 if ((ass >> i) & 1)
1036 tmp++;
1037 }
1038 if (((ass >> 16) & 0xf) != tmp)
1039 return;
1040do_sku:
1041 /*
1042 * 0 : override
1043 * 1 : Swap Jack
1044 * 2 : 0 --> Desktop, 1 --> Laptop
1045 * 3~5 : External Amplifier control
1046 * 7~6 : Reserved
1047 */
1048 tmp = (ass & 0x38) >> 3; /* external Amp control */
1049 switch (tmp) {
1050 case 1:
1051 snd_hda_sequence_write(codec, alc_gpio1_init_verbs); 1039 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1052 break; 1040 break;
1053 case 3: 1041 case ALC_INIT_GPIO2:
1054 snd_hda_sequence_write(codec, alc_gpio2_init_verbs); 1042 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1055 break; 1043 break;
1056 case 7: 1044 case ALC_INIT_GPIO3:
1057 snd_hda_sequence_write(codec, alc_gpio3_init_verbs); 1045 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1058 break; 1046 break;
1059 case 5: /* set EAPD output high */ 1047 case ALC_INIT_DEFAULT:
1060 switch (codec->vendor_id) { 1048 switch (codec->vendor_id) {
1061 case 0x10ec0260: 1049 case 0x10ec0260:
1062 snd_hda_codec_write(codec, 0x0f, 0, 1050 snd_hda_codec_write(codec, 0x0f, 0,
@@ -1110,7 +1098,7 @@ do_sku:
1110 tmp | 0x2010); 1098 tmp | 0x2010);
1111 break; 1099 break;
1112 case 0x10ec0888: 1100 case 0x10ec0888:
1113 /*alc888_coef_init(codec);*/ /* called in alc_init() */ 1101 alc888_coef_init(codec);
1114 break; 1102 break;
1115 case 0x10ec0267: 1103 case 0x10ec0267:
1116 case 0x10ec0268: 1104 case 0x10ec0268:
@@ -1125,7 +1113,107 @@ do_sku:
1125 tmp | 0x3000); 1113 tmp | 0x3000);
1126 break; 1114 break;
1127 } 1115 }
1128 default: 1116 break;
1117 }
1118}
1119
1120static void alc_init_auto_hp(struct hda_codec *codec)
1121{
1122 struct alc_spec *spec = codec->spec;
1123
1124 if (!spec->autocfg.hp_pins[0])
1125 return;
1126
1127 if (!spec->autocfg.speaker_pins[0]) {
1128 if (spec->autocfg.line_out_pins[0] &&
1129 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1130 spec->autocfg.speaker_pins[0] =
1131 spec->autocfg.line_out_pins[0];
1132 else
1133 return;
1134 }
1135
1136 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1137 spec->autocfg.hp_pins[0]);
1138 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1139 AC_VERB_SET_UNSOLICITED_ENABLE,
1140 AC_USRSP_EN | ALC880_HP_EVENT);
1141 spec->unsol_event = alc_sku_unsol_event;
1142}
1143
1144/* check subsystem ID and set up device-specific initialization;
1145 * return 1 if initialized, 0 if invalid SSID
1146 */
1147/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1148 * 31 ~ 16 : Manufacture ID
1149 * 15 ~ 8 : SKU ID
1150 * 7 ~ 0 : Assembly ID
1151 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1152 */
1153static int alc_subsystem_id(struct hda_codec *codec,
1154 hda_nid_t porta, hda_nid_t porte,
1155 hda_nid_t portd)
1156{
1157 unsigned int ass, tmp, i;
1158 unsigned nid;
1159 struct alc_spec *spec = codec->spec;
1160
1161 ass = codec->subsystem_id & 0xffff;
1162 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1163 goto do_sku;
1164
1165 /* invalid SSID, check the special NID pin defcfg instead */
1166 /*
1167 * 31~30 : port connectivity
1168 * 29~21 : reserve
1169 * 20 : PCBEEP input
1170 * 19~16 : Check sum (15:1)
1171 * 15~1 : Custom
1172 * 0 : override
1173 */
1174 nid = 0x1d;
1175 if (codec->vendor_id == 0x10ec0260)
1176 nid = 0x17;
1177 ass = snd_hda_codec_get_pincfg(codec, nid);
1178 snd_printd("realtek: No valid SSID, "
1179 "checking pincfg 0x%08x for NID 0x%x\n",
1180 ass, nid);
1181 if (!(ass & 1) && !(ass & 0x100000))
1182 return 0;
1183 if ((ass >> 30) != 1) /* no physical connection */
1184 return 0;
1185
1186 /* check sum */
1187 tmp = 0;
1188 for (i = 1; i < 16; i++) {
1189 if ((ass >> i) & 1)
1190 tmp++;
1191 }
1192 if (((ass >> 16) & 0xf) != tmp)
1193 return 0;
1194do_sku:
1195 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1196 ass & 0xffff, codec->vendor_id);
1197 /*
1198 * 0 : override
1199 * 1 : Swap Jack
1200 * 2 : 0 --> Desktop, 1 --> Laptop
1201 * 3~5 : External Amplifier control
1202 * 7~6 : Reserved
1203 */
1204 tmp = (ass & 0x38) >> 3; /* external Amp control */
1205 switch (tmp) {
1206 case 1:
1207 spec->init_amp = ALC_INIT_GPIO1;
1208 break;
1209 case 3:
1210 spec->init_amp = ALC_INIT_GPIO2;
1211 break;
1212 case 7:
1213 spec->init_amp = ALC_INIT_GPIO3;
1214 break;
1215 case 5:
1216 spec->init_amp = ALC_INIT_DEFAULT;
1129 break; 1217 break;
1130 } 1218 }
1131 1219
@@ -1133,7 +1221,7 @@ do_sku:
1133 * when the external headphone out jack is plugged" 1221 * when the external headphone out jack is plugged"
1134 */ 1222 */
1135 if (!(ass & 0x8000)) 1223 if (!(ass & 0x8000))
1136 return; 1224 return 1;
1137 /* 1225 /*
1138 * 10~8 : Jack location 1226 * 10~8 : Jack location
1139 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered 1227 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
@@ -1141,14 +1229,6 @@ do_sku:
1141 * 15 : 1 --> enable the function "Mute internal speaker 1229 * 15 : 1 --> enable the function "Mute internal speaker
1142 * when the external headphone out jack is plugged" 1230 * when the external headphone out jack is plugged"
1143 */ 1231 */
1144 if (!spec->autocfg.speaker_pins[0]) {
1145 if (spec->autocfg.line_out_pins[0])
1146 spec->autocfg.speaker_pins[0] =
1147 spec->autocfg.line_out_pins[0];
1148 else
1149 return;
1150 }
1151
1152 if (!spec->autocfg.hp_pins[0]) { 1232 if (!spec->autocfg.hp_pins[0]) {
1153 tmp = (ass >> 11) & 0x3; /* HP to chassis */ 1233 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1154 if (tmp == 0) 1234 if (tmp == 0)
@@ -1158,23 +1238,23 @@ do_sku:
1158 else if (tmp == 2) 1238 else if (tmp == 2)
1159 spec->autocfg.hp_pins[0] = portd; 1239 spec->autocfg.hp_pins[0] = portd;
1160 else 1240 else
1161 return; 1241 return 1;
1162 } 1242 }
1163 if (spec->autocfg.hp_pins[0])
1164 snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0,
1165 AC_VERB_SET_UNSOLICITED_ENABLE,
1166 AC_USRSP_EN | ALC880_HP_EVENT);
1167
1168#if 0 /* it's broken in some acses -- temporarily disabled */
1169 if (spec->autocfg.input_pins[AUTO_PIN_MIC] &&
1170 spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC])
1171 snd_hda_codec_write(codec,
1172 spec->autocfg.input_pins[AUTO_PIN_MIC], 0,
1173 AC_VERB_SET_UNSOLICITED_ENABLE,
1174 AC_USRSP_EN | ALC880_MIC_EVENT);
1175#endif /* disabled */
1176 1243
1177 spec->unsol_event = alc_sku_unsol_event; 1244 alc_init_auto_hp(codec);
1245 return 1;
1246}
1247
1248static void alc_ssid_check(struct hda_codec *codec,
1249 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1250{
1251 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1252 struct alc_spec *spec = codec->spec;
1253 snd_printd("realtek: "
1254 "Enable default setup for auto mode as fallback\n");
1255 spec->init_amp = ALC_INIT_DEFAULT;
1256 alc_init_auto_hp(codec);
1257 }
1178} 1258}
1179 1259
1180/* 1260/*
@@ -1309,32 +1389,58 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1309 {} 1389 {}
1310}; 1390};
1311 1391
1312static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) 1392static void alc_automute_amp(struct hda_codec *codec)
1313{ 1393{
1314 unsigned int present; 1394 struct alc_spec *spec = codec->spec;
1315 unsigned int bits; 1395 unsigned int val, mute;
1316 /* Line out presence */ 1396 hda_nid_t nid;
1317 present = snd_hda_codec_read(codec, 0x17, 0, 1397 int i;
1318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1398
1319 /* HP out presence */ 1399 spec->jack_present = 0;
1320 present = present || snd_hda_codec_read(codec, 0x1b, 0, 1400 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1401 nid = spec->autocfg.hp_pins[i];
1322 bits = present ? HDA_AMP_MUTE : 0; 1402 if (!nid)
1403 break;
1404 val = snd_hda_codec_read(codec, nid, 0,
1405 AC_VERB_GET_PIN_SENSE, 0);
1406 if (val & AC_PINSENSE_PRESENCE) {
1407 spec->jack_present = 1;
1408 break;
1409 }
1410 }
1411
1412 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1323 /* Toggle internal speakers muting */ 1413 /* Toggle internal speakers muting */
1324 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 1414 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1325 HDA_AMP_MUTE, bits); 1415 nid = spec->autocfg.speaker_pins[i];
1326 /* Toggle internal bass muting */ 1416 if (!nid)
1327 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 1417 break;
1328 HDA_AMP_MUTE, bits); 1418 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1419 HDA_AMP_MUTE, mute);
1420 }
1329} 1421}
1330 1422
1331static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, 1423static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1332 unsigned int res) 1424 unsigned int res)
1333{ 1425{
1334 if (res >> 26 == ALC880_HP_EVENT) 1426 if (codec->vendor_id == 0x10ec0880)
1335 alc888_fujitsu_xa3530_automute(codec); 1427 res >>= 28;
1428 else
1429 res >>= 26;
1430 if (res == ALC880_HP_EVENT)
1431 alc_automute_amp(codec);
1336} 1432}
1337 1433
1434static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1435{
1436 struct alc_spec *spec = codec->spec;
1437
1438 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1439 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1440 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1441 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1442 alc_automute_amp(codec);
1443}
1338 1444
1339/* 1445/*
1340 * ALC888 Acer Aspire 4930G model 1446 * ALC888 Acer Aspire 4930G model
@@ -1358,6 +1464,78 @@ static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1358 { } 1464 { }
1359}; 1465};
1360 1466
1467/*
1468 * ALC888 Acer Aspire 6530G model
1469 */
1470
1471static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1472/* Bias voltage on for external mic port */
1473 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1474/* Enable unsolicited event for HP jack */
1475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1476/* Enable speaker output */
1477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1478 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1479/* Enable headphone output */
1480 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1483 { }
1484};
1485
1486/*
1487 * ALC889 Acer Aspire 8930G model
1488 */
1489
1490static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1491/* Front Mic: set to PIN_IN (empty by default) */
1492 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1493/* Unselect Front Mic by default in input mixer 3 */
1494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1495/* Enable unsolicited event for HP jack */
1496 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1497/* Connect Internal Front to Front */
1498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1500 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1501/* Connect Internal Rear to Rear */
1502 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1503 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1504 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1505/* Connect Internal CLFE to CLFE */
1506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1507 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1508 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1509/* Connect HP out to Front */
1510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1511 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1512 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1513/* Enable all DACs */
1514/* DAC DISABLE/MUTE 1? */
1515/* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1516 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1517 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1518/* DAC DISABLE/MUTE 2? */
1519/* some bit here disables the other DACs. Init=0x4900 */
1520 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1521 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1522/* Enable amplifiers */
1523 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1524 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1525/* DMIC fix
1526 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1527 * which makes the stereo useless. However, either the mic or the ALC889
1528 * makes the signal become a difference/sum signal instead of standard
1529 * stereo, which is annoying. So instead we flip this bit which makes the
1530 * codec replicate the sum signal to both channels, turning it into a
1531 * normal mono mic.
1532 */
1533/* DMIC_CONTROL? Init value = 0x0001 */
1534 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1535 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1536 { }
1537};
1538
1361static struct hda_input_mux alc888_2_capture_sources[2] = { 1539static struct hda_input_mux alc888_2_capture_sources[2] = {
1362 /* Front mic only available on one ADC */ 1540 /* Front mic only available on one ADC */
1363 { 1541 {
@@ -1379,6 +1557,57 @@ static struct hda_input_mux alc888_2_capture_sources[2] = {
1379 } 1557 }
1380}; 1558};
1381 1559
1560static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1561 /* Interal mic only available on one ADC */
1562 {
1563 .num_items = 3,
1564 .items = {
1565 { "Ext Mic", 0x0 },
1566 { "CD", 0x4 },
1567 { "Int Mic", 0xb },
1568 },
1569 },
1570 {
1571 .num_items = 2,
1572 .items = {
1573 { "Ext Mic", 0x0 },
1574 { "CD", 0x4 },
1575 },
1576 }
1577};
1578
1579static struct hda_input_mux alc889_capture_sources[3] = {
1580 /* Digital mic only available on first "ADC" */
1581 {
1582 .num_items = 5,
1583 .items = {
1584 { "Mic", 0x0 },
1585 { "Line", 0x2 },
1586 { "CD", 0x4 },
1587 { "Front Mic", 0xb },
1588 { "Input Mix", 0xa },
1589 },
1590 },
1591 {
1592 .num_items = 4,
1593 .items = {
1594 { "Mic", 0x0 },
1595 { "Line", 0x2 },
1596 { "CD", 0x4 },
1597 { "Input Mix", 0xa },
1598 },
1599 },
1600 {
1601 .num_items = 4,
1602 .items = {
1603 { "Mic", 0x0 },
1604 { "Line", 0x2 },
1605 { "CD", 0x4 },
1606 { "Input Mix", 0xa },
1607 },
1608 }
1609};
1610
1382static struct snd_kcontrol_new alc888_base_mixer[] = { 1611static struct snd_kcontrol_new alc888_base_mixer[] = {
1383 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1384 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 1613 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -1401,22 +1630,24 @@ static struct snd_kcontrol_new alc888_base_mixer[] = {
1401 { } /* end */ 1630 { } /* end */
1402}; 1631};
1403 1632
1404static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) 1633static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1405{ 1634{
1406 unsigned int present; 1635 struct alc_spec *spec = codec->spec;
1407 unsigned int bits; 1636
1408 present = snd_hda_codec_read(codec, 0x15, 0, 1637 spec->autocfg.hp_pins[0] = 0x15;
1409 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1638 spec->autocfg.speaker_pins[0] = 0x14;
1410 bits = present ? HDA_AMP_MUTE : 0; 1639 alc_automute_amp(codec);
1411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1412 HDA_AMP_MUTE, bits);
1413} 1640}
1414 1641
1415static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, 1642static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1416 unsigned int res)
1417{ 1643{
1418 if (res >> 26 == ALC880_HP_EVENT) 1644 struct alc_spec *spec = codec->spec;
1419 alc888_acer_aspire_4930g_automute(codec); 1645
1646 spec->autocfg.hp_pins[0] = 0x15;
1647 spec->autocfg.speaker_pins[0] = 0x14;
1648 spec->autocfg.speaker_pins[1] = 0x16;
1649 spec->autocfg.speaker_pins[2] = 0x1b;
1650 alc_automute_amp(codec);
1420} 1651}
1421 1652
1422/* 1653/*
@@ -2384,21 +2615,6 @@ static struct hda_verb alc880_beep_init_verbs[] = {
2384 { } 2615 { }
2385}; 2616};
2386 2617
2387/* toggle speaker-output according to the hp-jack state */
2388static void alc880_uniwill_hp_automute(struct hda_codec *codec)
2389{
2390 unsigned int present;
2391 unsigned char bits;
2392
2393 present = snd_hda_codec_read(codec, 0x14, 0,
2394 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2395 bits = present ? HDA_AMP_MUTE : 0;
2396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
2397 HDA_AMP_MUTE, bits);
2398 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
2399 HDA_AMP_MUTE, bits);
2400}
2401
2402/* auto-toggle front mic */ 2618/* auto-toggle front mic */
2403static void alc880_uniwill_mic_automute(struct hda_codec *codec) 2619static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2404{ 2620{
@@ -2411,9 +2627,14 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2411 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); 2627 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2412} 2628}
2413 2629
2414static void alc880_uniwill_automute(struct hda_codec *codec) 2630static void alc880_uniwill_init_hook(struct hda_codec *codec)
2415{ 2631{
2416 alc880_uniwill_hp_automute(codec); 2632 struct alc_spec *spec = codec->spec;
2633
2634 spec->autocfg.hp_pins[0] = 0x14;
2635 spec->autocfg.speaker_pins[0] = 0x15;
2636 spec->autocfg.speaker_pins[0] = 0x16;
2637 alc_automute_amp(codec);
2417 alc880_uniwill_mic_automute(codec); 2638 alc880_uniwill_mic_automute(codec);
2418} 2639}
2419 2640
@@ -2424,24 +2645,22 @@ static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2424 * definition. 4bit tag is placed at 28 bit! 2645 * definition. 4bit tag is placed at 28 bit!
2425 */ 2646 */
2426 switch (res >> 28) { 2647 switch (res >> 28) {
2427 case ALC880_HP_EVENT:
2428 alc880_uniwill_hp_automute(codec);
2429 break;
2430 case ALC880_MIC_EVENT: 2648 case ALC880_MIC_EVENT:
2431 alc880_uniwill_mic_automute(codec); 2649 alc880_uniwill_mic_automute(codec);
2432 break; 2650 break;
2651 default:
2652 alc_automute_amp_unsol_event(codec, res);
2653 break;
2433 } 2654 }
2434} 2655}
2435 2656
2436static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) 2657static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2437{ 2658{
2438 unsigned int present; 2659 struct alc_spec *spec = codec->spec;
2439 unsigned char bits;
2440 2660
2441 present = snd_hda_codec_read(codec, 0x14, 0, 2661 spec->autocfg.hp_pins[0] = 0x14;
2442 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 2662 spec->autocfg.speaker_pins[0] = 0x15;
2443 bits = present ? HDA_AMP_MUTE : 0; 2663 alc_automute_amp(codec);
2444 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits);
2445} 2664}
2446 2665
2447static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 2666static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -2463,10 +2682,10 @@ static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2463 /* Looks like the unsol event is incompatible with the standard 2682 /* Looks like the unsol event is incompatible with the standard
2464 * definition. 4bit tag is placed at 28 bit! 2683 * definition. 4bit tag is placed at 28 bit!
2465 */ 2684 */
2466 if ((res >> 28) == ALC880_HP_EVENT)
2467 alc880_uniwill_p53_hp_automute(codec);
2468 if ((res >> 28) == ALC880_DCVOL_EVENT) 2685 if ((res >> 28) == ALC880_DCVOL_EVENT)
2469 alc880_uniwill_p53_dcvol_automute(codec); 2686 alc880_uniwill_p53_dcvol_automute(codec);
2687 else
2688 alc_automute_amp_unsol_event(codec, res);
2470} 2689}
2471 2690
2472/* 2691/*
@@ -2536,6 +2755,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = {
2536/* Enable GPIO mask and set output */ 2755/* Enable GPIO mask and set output */
2537#define alc880_gpio1_init_verbs alc_gpio1_init_verbs 2756#define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2538#define alc880_gpio2_init_verbs alc_gpio2_init_verbs 2757#define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2758#define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2539 2759
2540/* Clevo m520g init */ 2760/* Clevo m520g init */
2541static struct hda_verb alc880_pin_clevo_init_verbs[] = { 2761static struct hda_verb alc880_pin_clevo_init_verbs[] = {
@@ -2698,30 +2918,18 @@ static struct hda_verb alc880_lg_init_verbs[] = {
2698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 2918 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2919 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2700 /* jack sense */ 2920 /* jack sense */
2701 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, 2921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2702 { } 2922 { }
2703}; 2923};
2704 2924
2705/* toggle speaker-output according to the hp-jack state */ 2925/* toggle speaker-output according to the hp-jack state */
2706static void alc880_lg_automute(struct hda_codec *codec) 2926static void alc880_lg_init_hook(struct hda_codec *codec)
2707{ 2927{
2708 unsigned int present; 2928 struct alc_spec *spec = codec->spec;
2709 unsigned char bits;
2710
2711 present = snd_hda_codec_read(codec, 0x1b, 0,
2712 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2713 bits = present ? HDA_AMP_MUTE : 0;
2714 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
2715 HDA_AMP_MUTE, bits);
2716}
2717 2929
2718static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) 2930 spec->autocfg.hp_pins[0] = 0x1b;
2719{ 2931 spec->autocfg.speaker_pins[0] = 0x17;
2720 /* Looks like the unsol event is incompatible with the standard 2932 alc_automute_amp(codec);
2721 * definition. 4bit tag is placed at 28 bit!
2722 */
2723 if ((res >> 28) == 0x01)
2724 alc880_lg_automute(codec);
2725} 2933}
2726 2934
2727/* 2935/*
@@ -2795,30 +3003,18 @@ static struct hda_verb alc880_lg_lw_init_verbs[] = {
2795 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2796 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3004 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2797 /* jack sense */ 3005 /* jack sense */
2798 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, 3006 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2799 { } 3007 { }
2800}; 3008};
2801 3009
2802/* toggle speaker-output according to the hp-jack state */ 3010/* toggle speaker-output according to the hp-jack state */
2803static void alc880_lg_lw_automute(struct hda_codec *codec) 3011static void alc880_lg_lw_init_hook(struct hda_codec *codec)
2804{ 3012{
2805 unsigned int present; 3013 struct alc_spec *spec = codec->spec;
2806 unsigned char bits;
2807
2808 present = snd_hda_codec_read(codec, 0x1b, 0,
2809 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2810 bits = present ? HDA_AMP_MUTE : 0;
2811 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
2812 HDA_AMP_MUTE, bits);
2813}
2814 3014
2815static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) 3015 spec->autocfg.hp_pins[0] = 0x1b;
2816{ 3016 spec->autocfg.speaker_pins[0] = 0x14;
2817 /* Looks like the unsol event is incompatible with the standard 3017 alc_automute_amp(codec);
2818 * definition. 4bit tag is placed at 28 bit!
2819 */
2820 if ((res >> 28) == 0x01)
2821 alc880_lg_lw_automute(codec);
2822} 3018}
2823 3019
2824static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { 3020static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
@@ -2865,16 +3061,10 @@ static struct hda_verb alc880_medion_rim_init_verbs[] = {
2865/* toggle speaker-output according to the hp-jack state */ 3061/* toggle speaker-output according to the hp-jack state */
2866static void alc880_medion_rim_automute(struct hda_codec *codec) 3062static void alc880_medion_rim_automute(struct hda_codec *codec)
2867{ 3063{
2868 unsigned int present; 3064 struct alc_spec *spec = codec->spec;
2869 unsigned char bits; 3065 alc_automute_amp(codec);
2870 3066 /* toggle EAPD */
2871 present = snd_hda_codec_read(codec, 0x14, 0, 3067 if (spec->jack_present)
2872 AC_VERB_GET_PIN_SENSE, 0)
2873 & AC_PINSENSE_PRESENCE;
2874 bits = present ? HDA_AMP_MUTE : 0;
2875 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
2876 HDA_AMP_MUTE, bits);
2877 if (present)
2878 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); 3068 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
2879 else 3069 else
2880 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); 3070 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
@@ -2890,6 +3080,15 @@ static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
2890 alc880_medion_rim_automute(codec); 3080 alc880_medion_rim_automute(codec);
2891} 3081}
2892 3082
3083static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3084{
3085 struct alc_spec *spec = codec->spec;
3086
3087 spec->autocfg.hp_pins[0] = 0x14;
3088 spec->autocfg.speaker_pins[0] = 0x1b;
3089 alc880_medion_rim_automute(codec);
3090}
3091
2893#ifdef CONFIG_SND_HDA_POWER_SAVE 3092#ifdef CONFIG_SND_HDA_POWER_SAVE
2894static struct hda_amp_list alc880_loopbacks[] = { 3093static struct hda_amp_list alc880_loopbacks[] = {
2895 { 0x0b, HDA_INPUT, 0 }, 3094 { 0x0b, HDA_INPUT, 0 },
@@ -2918,8 +3117,7 @@ static int alc_init(struct hda_codec *codec)
2918 unsigned int i; 3117 unsigned int i;
2919 3118
2920 alc_fix_pll(codec); 3119 alc_fix_pll(codec);
2921 if (codec->vendor_id == 0x10ec0888) 3120 alc_auto_init_amp(codec, spec->init_amp);
2922 alc888_coef_init(codec);
2923 3121
2924 for (i = 0; i < spec->num_init_verbs; i++) 3122 for (i = 0; i < spec->num_init_verbs; i++)
2925 snd_hda_sequence_write(codec, spec->init_verbs[i]); 3123 snd_hda_sequence_write(codec, spec->init_verbs[i]);
@@ -3121,7 +3319,10 @@ static int alc_build_pcms(struct hda_codec *codec)
3121 if (spec->no_analog) 3319 if (spec->no_analog)
3122 goto skip_analog; 3320 goto skip_analog;
3123 3321
3322 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3323 "%s Analog", codec->chip_name);
3124 info->name = spec->stream_name_analog; 3324 info->name = spec->stream_name_analog;
3325
3125 if (spec->stream_analog_playback) { 3326 if (spec->stream_analog_playback) {
3126 if (snd_BUG_ON(!spec->multiout.dac_nids)) 3327 if (snd_BUG_ON(!spec->multiout.dac_nids))
3127 return -EINVAL; 3328 return -EINVAL;
@@ -3147,6 +3348,9 @@ static int alc_build_pcms(struct hda_codec *codec)
3147 skip_analog: 3348 skip_analog:
3148 /* SPDIF for stream index #1 */ 3349 /* SPDIF for stream index #1 */
3149 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 3350 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3351 snprintf(spec->stream_name_digital,
3352 sizeof(spec->stream_name_digital),
3353 "%s Digital", codec->chip_name);
3150 codec->num_pcms = 2; 3354 codec->num_pcms = 2;
3151 codec->slave_dig_outs = spec->multiout.slave_dig_outs; 3355 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3152 info = spec->pcm_rec + 1; 3356 info = spec->pcm_rec + 1;
@@ -3749,7 +3953,7 @@ static struct alc_config_preset alc880_presets[] = {
3749 .channel_mode = alc880_2_jack_modes, 3953 .channel_mode = alc880_2_jack_modes,
3750 .input_mux = &alc880_f1734_capture_source, 3954 .input_mux = &alc880_f1734_capture_source,
3751 .unsol_event = alc880_uniwill_p53_unsol_event, 3955 .unsol_event = alc880_uniwill_p53_unsol_event,
3752 .init_hook = alc880_uniwill_p53_hp_automute, 3956 .init_hook = alc880_uniwill_p53_init_hook,
3753 }, 3957 },
3754 [ALC880_ASUS] = { 3958 [ALC880_ASUS] = {
3755 .mixers = { alc880_asus_mixer }, 3959 .mixers = { alc880_asus_mixer },
@@ -3826,7 +4030,7 @@ static struct alc_config_preset alc880_presets[] = {
3826 .need_dac_fix = 1, 4030 .need_dac_fix = 1,
3827 .input_mux = &alc880_capture_source, 4031 .input_mux = &alc880_capture_source,
3828 .unsol_event = alc880_uniwill_unsol_event, 4032 .unsol_event = alc880_uniwill_unsol_event,
3829 .init_hook = alc880_uniwill_automute, 4033 .init_hook = alc880_uniwill_init_hook,
3830 }, 4034 },
3831 [ALC880_UNIWILL_P53] = { 4035 [ALC880_UNIWILL_P53] = {
3832 .mixers = { alc880_uniwill_p53_mixer }, 4036 .mixers = { alc880_uniwill_p53_mixer },
@@ -3838,7 +4042,7 @@ static struct alc_config_preset alc880_presets[] = {
3838 .channel_mode = alc880_threestack_modes, 4042 .channel_mode = alc880_threestack_modes,
3839 .input_mux = &alc880_capture_source, 4043 .input_mux = &alc880_capture_source,
3840 .unsol_event = alc880_uniwill_p53_unsol_event, 4044 .unsol_event = alc880_uniwill_p53_unsol_event,
3841 .init_hook = alc880_uniwill_p53_hp_automute, 4045 .init_hook = alc880_uniwill_p53_init_hook,
3842 }, 4046 },
3843 [ALC880_FUJITSU] = { 4047 [ALC880_FUJITSU] = {
3844 .mixers = { alc880_fujitsu_mixer }, 4048 .mixers = { alc880_fujitsu_mixer },
@@ -3852,7 +4056,7 @@ static struct alc_config_preset alc880_presets[] = {
3852 .channel_mode = alc880_2_jack_modes, 4056 .channel_mode = alc880_2_jack_modes,
3853 .input_mux = &alc880_capture_source, 4057 .input_mux = &alc880_capture_source,
3854 .unsol_event = alc880_uniwill_p53_unsol_event, 4058 .unsol_event = alc880_uniwill_p53_unsol_event,
3855 .init_hook = alc880_uniwill_p53_hp_automute, 4059 .init_hook = alc880_uniwill_p53_init_hook,
3856 }, 4060 },
3857 [ALC880_CLEVO] = { 4061 [ALC880_CLEVO] = {
3858 .mixers = { alc880_three_stack_mixer }, 4062 .mixers = { alc880_three_stack_mixer },
@@ -3877,8 +4081,8 @@ static struct alc_config_preset alc880_presets[] = {
3877 .channel_mode = alc880_lg_ch_modes, 4081 .channel_mode = alc880_lg_ch_modes,
3878 .need_dac_fix = 1, 4082 .need_dac_fix = 1,
3879 .input_mux = &alc880_lg_capture_source, 4083 .input_mux = &alc880_lg_capture_source,
3880 .unsol_event = alc880_lg_unsol_event, 4084 .unsol_event = alc_automute_amp_unsol_event,
3881 .init_hook = alc880_lg_automute, 4085 .init_hook = alc880_lg_init_hook,
3882#ifdef CONFIG_SND_HDA_POWER_SAVE 4086#ifdef CONFIG_SND_HDA_POWER_SAVE
3883 .loopbacks = alc880_lg_loopbacks, 4087 .loopbacks = alc880_lg_loopbacks,
3884#endif 4088#endif
@@ -3893,8 +4097,8 @@ static struct alc_config_preset alc880_presets[] = {
3893 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), 4097 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
3894 .channel_mode = alc880_lg_lw_modes, 4098 .channel_mode = alc880_lg_lw_modes,
3895 .input_mux = &alc880_lg_lw_capture_source, 4099 .input_mux = &alc880_lg_lw_capture_source,
3896 .unsol_event = alc880_lg_lw_unsol_event, 4100 .unsol_event = alc_automute_amp_unsol_event,
3897 .init_hook = alc880_lg_lw_automute, 4101 .init_hook = alc880_lg_lw_init_hook,
3898 }, 4102 },
3899 [ALC880_MEDION_RIM] = { 4103 [ALC880_MEDION_RIM] = {
3900 .mixers = { alc880_medion_rim_mixer }, 4104 .mixers = { alc880_medion_rim_mixer },
@@ -3908,7 +4112,7 @@ static struct alc_config_preset alc880_presets[] = {
3908 .channel_mode = alc880_2_jack_modes, 4112 .channel_mode = alc880_2_jack_modes,
3909 .input_mux = &alc880_medion_rim_capture_source, 4113 .input_mux = &alc880_medion_rim_capture_source,
3910 .unsol_event = alc880_medion_rim_unsol_event, 4114 .unsol_event = alc880_medion_rim_unsol_event,
3911 .init_hook = alc880_medion_rim_automute, 4115 .init_hook = alc880_medion_rim_init_hook,
3912 }, 4116 },
3913#ifdef CONFIG_SND_DEBUG 4117#ifdef CONFIG_SND_DEBUG
3914 [ALC880_TEST] = { 4118 [ALC880_TEST] = {
@@ -4193,7 +4397,6 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec)
4193 struct alc_spec *spec = codec->spec; 4397 struct alc_spec *spec = codec->spec;
4194 int i; 4398 int i;
4195 4399
4196 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
4197 for (i = 0; i < spec->autocfg.line_outs; i++) { 4400 for (i = 0; i < spec->autocfg.line_outs; i++) {
4198 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 4401 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4199 int pin_type = get_pin_type(spec->autocfg.line_out_type); 4402 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -4298,6 +4501,8 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4298 spec->num_mux_defs = 1; 4501 spec->num_mux_defs = 1;
4299 spec->input_mux = &spec->private_imux[0]; 4502 spec->input_mux = &spec->private_imux[0];
4300 4503
4504 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4505
4301 return 1; 4506 return 1;
4302} 4507}
4303 4508
@@ -4355,8 +4560,8 @@ static int patch_alc880(struct hda_codec *codec)
4355 alc880_models, 4560 alc880_models,
4356 alc880_cfg_tbl); 4561 alc880_cfg_tbl);
4357 if (board_config < 0) { 4562 if (board_config < 0) {
4358 printk(KERN_INFO "hda_codec: Unknown model for ALC880, " 4563 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4359 "trying auto-probe from BIOS...\n"); 4564 "trying auto-probe from BIOS...\n", codec->chip_name);
4360 board_config = ALC880_AUTO; 4565 board_config = ALC880_AUTO;
4361 } 4566 }
4362 4567
@@ -4383,12 +4588,10 @@ static int patch_alc880(struct hda_codec *codec)
4383 if (board_config != ALC880_AUTO) 4588 if (board_config != ALC880_AUTO)
4384 setup_preset(spec, &alc880_presets[board_config]); 4589 setup_preset(spec, &alc880_presets[board_config]);
4385 4590
4386 spec->stream_name_analog = "ALC880 Analog";
4387 spec->stream_analog_playback = &alc880_pcm_analog_playback; 4591 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4388 spec->stream_analog_capture = &alc880_pcm_analog_capture; 4592 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4389 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; 4593 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4390 4594
4391 spec->stream_name_digital = "ALC880 Digital";
4392 spec->stream_digital_playback = &alc880_pcm_digital_playback; 4595 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4393 spec->stream_digital_capture = &alc880_pcm_digital_capture; 4596 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4394 4597
@@ -5673,7 +5876,6 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec)
5673 struct alc_spec *spec = codec->spec; 5876 struct alc_spec *spec = codec->spec;
5674 hda_nid_t nid; 5877 hda_nid_t nid;
5675 5878
5676 alc_subsystem_id(codec, 0x10, 0x15, 0x0f);
5677 nid = spec->autocfg.line_out_pins[0]; 5879 nid = spec->autocfg.line_out_pins[0];
5678 if (nid) { 5880 if (nid) {
5679 int pin_type = get_pin_type(spec->autocfg.line_out_type); 5881 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -5783,6 +5985,8 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
5783 spec->num_mux_defs = 1; 5985 spec->num_mux_defs = 1;
5784 spec->input_mux = &spec->private_imux[0]; 5986 spec->input_mux = &spec->private_imux[0];
5785 5987
5988 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5989
5786 return 1; 5990 return 1;
5787} 5991}
5788 5992
@@ -6000,8 +6204,9 @@ static int patch_alc260(struct hda_codec *codec)
6000 alc260_models, 6204 alc260_models,
6001 alc260_cfg_tbl); 6205 alc260_cfg_tbl);
6002 if (board_config < 0) { 6206 if (board_config < 0) {
6003 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " 6207 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6004 "trying auto-probe from BIOS...\n"); 6208 "trying auto-probe from BIOS...\n",
6209 codec->chip_name);
6005 board_config = ALC260_AUTO; 6210 board_config = ALC260_AUTO;
6006 } 6211 }
6007 6212
@@ -6028,11 +6233,9 @@ static int patch_alc260(struct hda_codec *codec)
6028 if (board_config != ALC260_AUTO) 6233 if (board_config != ALC260_AUTO)
6029 setup_preset(spec, &alc260_presets[board_config]); 6234 setup_preset(spec, &alc260_presets[board_config]);
6030 6235
6031 spec->stream_name_analog = "ALC260 Analog";
6032 spec->stream_analog_playback = &alc260_pcm_analog_playback; 6236 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6033 spec->stream_analog_capture = &alc260_pcm_analog_capture; 6237 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6034 6238
6035 spec->stream_name_digital = "ALC260 Digital";
6036 spec->stream_digital_playback = &alc260_pcm_digital_playback; 6239 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6037 spec->stream_digital_capture = &alc260_pcm_digital_capture; 6240 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6038 6241
@@ -6109,6 +6312,16 @@ static struct hda_input_mux alc882_capture_source = {
6109 { "CD", 0x4 }, 6312 { "CD", 0x4 },
6110 }, 6313 },
6111}; 6314};
6315
6316static struct hda_input_mux mb5_capture_source = {
6317 .num_items = 3,
6318 .items = {
6319 { "Mic", 0x1 },
6320 { "Line", 0x2 },
6321 { "CD", 0x4 },
6322 },
6323};
6324
6112/* 6325/*
6113 * 2ch mode 6326 * 2ch mode
6114 */ 6327 */
@@ -6166,7 +6379,7 @@ static struct hda_channel_mode alc882_sixstack_modes[2] = {
6166}; 6379};
6167 6380
6168/* 6381/*
6169 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic 6382 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6170 */ 6383 */
6171 6384
6172/* 6385/*
@@ -6196,6 +6409,34 @@ static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6196 { 6, alc885_mbp_ch6_init }, 6409 { 6, alc885_mbp_ch6_init },
6197}; 6410};
6198 6411
6412/*
6413 * 2ch
6414 * Speakers/Woofer/HP = Front
6415 * LineIn = Input
6416 */
6417static struct hda_verb alc885_mb5_ch2_init[] = {
6418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6420 { } /* end */
6421};
6422
6423/*
6424 * 6ch mode
6425 * Speakers/HP = Front
6426 * Woofer = LFE
6427 * LineIn = Surround
6428 */
6429static struct hda_verb alc885_mb5_ch6_init[] = {
6430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6433 { } /* end */
6434};
6435
6436static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6437 { 2, alc885_mb5_ch2_init },
6438 { 6, alc885_mb5_ch6_init },
6439};
6199 6440
6200/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 6441/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6201 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b 6442 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
@@ -6238,6 +6479,25 @@ static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6238 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), 6479 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6239 { } /* end */ 6480 { } /* end */
6240}; 6481};
6482
6483static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6484 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6485 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6486 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6487 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6488 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6489 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6490 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6491 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6493 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6495 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6496 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6497 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6498 { } /* end */
6499};
6500
6241static struct snd_kcontrol_new alc882_w2jc_mixer[] = { 6501static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 6502 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 6503 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -6465,6 +6725,55 @@ static struct hda_verb alc882_macpro_init_verbs[] = {
6465 { } 6725 { }
6466}; 6726};
6467 6727
6728/* Macbook 5,1 */
6729static struct hda_verb alc885_mb5_init_verbs[] = {
6730 /* DACs */
6731 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6732 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6733 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6734 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6735 /* Front mixer */
6736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6737 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6739 /* Surround mixer */
6740 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6741 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6743 /* LFE mixer */
6744 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6745 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6746 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6747 /* HP mixer */
6748 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6749 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6751 /* Front Pin (0x0c) */
6752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6754 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6755 /* LFE Pin (0x0e) */
6756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
6759 /* HP Pin (0x0f) */
6760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6762 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
6763 /* Front Mic pin: input vref at 80% */
6764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6766 /* Line In pin */
6767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6769
6770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6772 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6773 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6774 { }
6775};
6776
6468/* Macbook Pro rev3 */ 6777/* Macbook Pro rev3 */
6469static struct hda_verb alc885_mbp3_init_verbs[] = { 6778static struct hda_verb alc885_mbp3_init_verbs[] = {
6470 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 6779 /* Front mixer: unmute input/output amp left and right (volume = 0) */
@@ -6554,45 +6863,23 @@ static struct hda_verb alc885_imac24_init_verbs[] = {
6554}; 6863};
6555 6864
6556/* Toggle speaker-output according to the hp-jack state */ 6865/* Toggle speaker-output according to the hp-jack state */
6557static void alc885_imac24_automute(struct hda_codec *codec) 6866static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6558{ 6867{
6559 unsigned int present; 6868 struct alc_spec *spec = codec->spec;
6560
6561 present = snd_hda_codec_read(codec, 0x14, 0,
6562 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6563 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
6564 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6565 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
6566 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6567}
6568 6869
6569/* Processes unsolicited events. */ 6870 spec->autocfg.hp_pins[0] = 0x14;
6570static void alc885_imac24_unsol_event(struct hda_codec *codec, 6871 spec->autocfg.speaker_pins[0] = 0x18;
6571 unsigned int res) 6872 spec->autocfg.speaker_pins[1] = 0x1a;
6572{ 6873 alc_automute_amp(codec);
6573 /* Headphone insertion or removal. */
6574 if ((res >> 26) == ALC880_HP_EVENT)
6575 alc885_imac24_automute(codec);
6576} 6874}
6577 6875
6578static void alc885_mbp3_automute(struct hda_codec *codec) 6876static void alc885_mbp3_init_hook(struct hda_codec *codec)
6579{ 6877{
6580 unsigned int present; 6878 struct alc_spec *spec = codec->spec;
6581
6582 present = snd_hda_codec_read(codec, 0x15, 0,
6583 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6584 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6586 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6587 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
6588 6879
6589} 6880 spec->autocfg.hp_pins[0] = 0x15;
6590static void alc885_mbp3_unsol_event(struct hda_codec *codec, 6881 spec->autocfg.speaker_pins[0] = 0x14;
6591 unsigned int res) 6882 alc_automute_amp(codec);
6592{
6593 /* Headphone insertion or removal. */
6594 if ((res >> 26) == ALC880_HP_EVENT)
6595 alc885_mbp3_automute(codec);
6596} 6883}
6597 6884
6598 6885
@@ -6617,24 +6904,25 @@ static struct hda_verb alc882_targa_verbs[] = {
6617/* toggle speaker-output according to the hp-jack state */ 6904/* toggle speaker-output according to the hp-jack state */
6618static void alc882_targa_automute(struct hda_codec *codec) 6905static void alc882_targa_automute(struct hda_codec *codec)
6619{ 6906{
6620 unsigned int present; 6907 struct alc_spec *spec = codec->spec;
6621 6908 alc_automute_amp(codec);
6622 present = snd_hda_codec_read(codec, 0x14, 0,
6623 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6624 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6625 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6626 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 6909 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6627 present ? 1 : 3); 6910 spec->jack_present ? 1 : 3);
6911}
6912
6913static void alc882_targa_init_hook(struct hda_codec *codec)
6914{
6915 struct alc_spec *spec = codec->spec;
6916
6917 spec->autocfg.hp_pins[0] = 0x14;
6918 spec->autocfg.speaker_pins[0] = 0x1b;
6919 alc882_targa_automute(codec);
6628} 6920}
6629 6921
6630static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) 6922static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6631{ 6923{
6632 /* Looks like the unsol event is incompatible with the standard 6924 if ((res >> 26) == ALC880_HP_EVENT)
6633 * definition. 4bit tag is placed at 26 bit!
6634 */
6635 if (((res >> 26) == ALC880_HP_EVENT)) {
6636 alc882_targa_automute(codec); 6925 alc882_targa_automute(codec);
6637 }
6638} 6926}
6639 6927
6640static struct hda_verb alc882_asus_a7j_verbs[] = { 6928static struct hda_verb alc882_asus_a7j_verbs[] = {
@@ -6716,7 +7004,7 @@ static void alc885_macpro_init_hook(struct hda_codec *codec)
6716static void alc885_imac24_init_hook(struct hda_codec *codec) 7004static void alc885_imac24_init_hook(struct hda_codec *codec)
6717{ 7005{
6718 alc885_macpro_init_hook(codec); 7006 alc885_macpro_init_hook(codec);
6719 alc885_imac24_automute(codec); 7007 alc885_imac24_automute_init_hook(codec);
6720} 7008}
6721 7009
6722/* 7010/*
@@ -6791,7 +7079,7 @@ static struct hda_verb alc882_auto_init_verbs[] = {
6791#define alc882_loopbacks alc880_loopbacks 7079#define alc882_loopbacks alc880_loopbacks
6792#endif 7080#endif
6793 7081
6794/* pcm configuration: identiacal with ALC880 */ 7082/* pcm configuration: identical with ALC880 */
6795#define alc882_pcm_analog_playback alc880_pcm_analog_playback 7083#define alc882_pcm_analog_playback alc880_pcm_analog_playback
6796#define alc882_pcm_analog_capture alc880_pcm_analog_capture 7084#define alc882_pcm_analog_capture alc880_pcm_analog_capture
6797#define alc882_pcm_digital_playback alc880_pcm_digital_playback 7085#define alc882_pcm_digital_playback alc880_pcm_digital_playback
@@ -6809,6 +7097,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = {
6809 [ALC882_ASUS_A7J] = "asus-a7j", 7097 [ALC882_ASUS_A7J] = "asus-a7j",
6810 [ALC882_ASUS_A7M] = "asus-a7m", 7098 [ALC882_ASUS_A7M] = "asus-a7m",
6811 [ALC885_MACPRO] = "macpro", 7099 [ALC885_MACPRO] = "macpro",
7100 [ALC885_MB5] = "mb5",
6812 [ALC885_MBP3] = "mbp3", 7101 [ALC885_MBP3] = "mbp3",
6813 [ALC885_IMAC24] = "imac24", 7102 [ALC885_IMAC24] = "imac24",
6814 [ALC882_AUTO] = "auto", 7103 [ALC882_AUTO] = "auto",
@@ -6886,8 +7175,20 @@ static struct alc_config_preset alc882_presets[] = {
6886 .input_mux = &alc882_capture_source, 7175 .input_mux = &alc882_capture_source,
6887 .dig_out_nid = ALC882_DIGOUT_NID, 7176 .dig_out_nid = ALC882_DIGOUT_NID,
6888 .dig_in_nid = ALC882_DIGIN_NID, 7177 .dig_in_nid = ALC882_DIGIN_NID,
6889 .unsol_event = alc885_mbp3_unsol_event, 7178 .unsol_event = alc_automute_amp_unsol_event,
6890 .init_hook = alc885_mbp3_automute, 7179 .init_hook = alc885_mbp3_init_hook,
7180 },
7181 [ALC885_MB5] = {
7182 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
7183 .init_verbs = { alc885_mb5_init_verbs,
7184 alc880_gpio1_init_verbs },
7185 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7186 .dac_nids = alc882_dac_nids,
7187 .channel_mode = alc885_mb5_6ch_modes,
7188 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
7189 .input_mux = &mb5_capture_source,
7190 .dig_out_nid = ALC882_DIGOUT_NID,
7191 .dig_in_nid = ALC882_DIGIN_NID,
6891 }, 7192 },
6892 [ALC885_MACPRO] = { 7193 [ALC885_MACPRO] = {
6893 .mixers = { alc882_macpro_mixer }, 7194 .mixers = { alc882_macpro_mixer },
@@ -6911,7 +7212,7 @@ static struct alc_config_preset alc882_presets[] = {
6911 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 7212 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
6912 .channel_mode = alc882_ch_modes, 7213 .channel_mode = alc882_ch_modes,
6913 .input_mux = &alc882_capture_source, 7214 .input_mux = &alc882_capture_source,
6914 .unsol_event = alc885_imac24_unsol_event, 7215 .unsol_event = alc_automute_amp_unsol_event,
6915 .init_hook = alc885_imac24_init_hook, 7216 .init_hook = alc885_imac24_init_hook,
6916 }, 7217 },
6917 [ALC882_TARGA] = { 7218 [ALC882_TARGA] = {
@@ -6928,7 +7229,7 @@ static struct alc_config_preset alc882_presets[] = {
6928 .need_dac_fix = 1, 7229 .need_dac_fix = 1,
6929 .input_mux = &alc882_capture_source, 7230 .input_mux = &alc882_capture_source,
6930 .unsol_event = alc882_targa_unsol_event, 7231 .unsol_event = alc882_targa_unsol_event,
6931 .init_hook = alc882_targa_automute, 7232 .init_hook = alc882_targa_init_hook,
6932 }, 7233 },
6933 [ALC882_ASUS_A7J] = { 7234 [ALC882_ASUS_A7J] = {
6934 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer }, 7235 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
@@ -7008,7 +7309,6 @@ static void alc882_auto_init_multi_out(struct hda_codec *codec)
7008 struct alc_spec *spec = codec->spec; 7309 struct alc_spec *spec = codec->spec;
7009 int i; 7310 int i;
7010 7311
7011 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
7012 for (i = 0; i <= HDA_SIDE; i++) { 7312 for (i = 0; i <= HDA_SIDE; i++) {
7013 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 7313 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7014 int pin_type = get_pin_type(spec->autocfg.line_out_type); 7314 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -7191,10 +7491,17 @@ static int patch_alc882(struct hda_codec *codec)
7191 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 7491 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7192 case 0x106b00a4: /* MacbookPro4,1 */ 7492 case 0x106b00a4: /* MacbookPro4,1 */
7193 case 0x106b2c00: /* Macbook Pro rev3 */ 7493 case 0x106b2c00: /* Macbook Pro rev3 */
7194 case 0x106b3600: /* Macbook 3.1 */ 7494 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7195 case 0x106b3800: /* MacbookPro4,1 - latter revision */ 7495 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7196 board_config = ALC885_MBP3; 7496 board_config = ALC885_MBP3;
7197 break; 7497 break;
7498 case 0x106b3f00: /* Macbook 5,1 */
7499 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7500 * seems not working, so apparently
7501 * no perfect solution yet
7502 */
7503 board_config = ALC885_MB5;
7504 break;
7198 default: 7505 default:
7199 /* ALC889A is handled better as ALC888-compatible */ 7506 /* ALC889A is handled better as ALC888-compatible */
7200 if (codec->revision_id == 0x100101 || 7507 if (codec->revision_id == 0x100101 ||
@@ -7202,8 +7509,9 @@ static int patch_alc882(struct hda_codec *codec)
7202 alc_free(codec); 7509 alc_free(codec);
7203 return patch_alc883(codec); 7510 return patch_alc883(codec);
7204 } 7511 }
7205 printk(KERN_INFO "hda_codec: Unknown model for ALC882, " 7512 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7206 "trying auto-probe from BIOS...\n"); 7513 "trying auto-probe from BIOS...\n",
7514 codec->chip_name);
7207 board_config = ALC882_AUTO; 7515 board_config = ALC882_AUTO;
7208 } 7516 }
7209 } 7517 }
@@ -7233,14 +7541,6 @@ static int patch_alc882(struct hda_codec *codec)
7233 if (board_config != ALC882_AUTO) 7541 if (board_config != ALC882_AUTO)
7234 setup_preset(spec, &alc882_presets[board_config]); 7542 setup_preset(spec, &alc882_presets[board_config]);
7235 7543
7236 if (codec->vendor_id == 0x10ec0885) {
7237 spec->stream_name_analog = "ALC885 Analog";
7238 spec->stream_name_digital = "ALC885 Digital";
7239 } else {
7240 spec->stream_name_analog = "ALC882 Analog";
7241 spec->stream_name_digital = "ALC882 Digital";
7242 }
7243
7244 spec->stream_analog_playback = &alc882_pcm_analog_playback; 7544 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7245 spec->stream_analog_capture = &alc882_pcm_analog_capture; 7545 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7246 /* FIXME: setup DAC5 */ 7546 /* FIXME: setup DAC5 */
@@ -7250,7 +7550,6 @@ static int patch_alc882(struct hda_codec *codec)
7250 spec->stream_digital_playback = &alc882_pcm_digital_playback; 7550 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7251 spec->stream_digital_capture = &alc882_pcm_digital_capture; 7551 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7252 7552
7253 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7254 if (!spec->adc_nids && spec->input_mux) { 7553 if (!spec->adc_nids && spec->input_mux) {
7255 /* check whether NID 0x07 is valid */ 7554 /* check whether NID 0x07 is valid */
7256 unsigned int wcap = get_wcaps(codec, 0x07); 7555 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -7393,6 +7692,17 @@ static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7393 }, 7692 },
7394}; 7693};
7395 7694
7695static struct hda_input_mux alc889A_mb31_capture_source = {
7696 .num_items = 2,
7697 .items = {
7698 { "Mic", 0x0 },
7699 /* Front Mic (0x01) unused */
7700 { "Line", 0x2 },
7701 /* Line 2 (0x03) unused */
7702 /* CD (0x04) unsused? */
7703 },
7704};
7705
7396/* 7706/*
7397 * 2ch mode 7707 * 2ch mode
7398 */ 7708 */
@@ -7442,6 +7752,73 @@ static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7442 { 6, alc883_3ST_ch6_init }, 7752 { 6, alc883_3ST_ch6_init },
7443}; 7753};
7444 7754
7755
7756/*
7757 * 2ch mode
7758 */
7759static struct hda_verb alc883_4ST_ch2_init[] = {
7760 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7761 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7762 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7763 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7764 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7765 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7766 { } /* end */
7767};
7768
7769/*
7770 * 4ch mode
7771 */
7772static struct hda_verb alc883_4ST_ch4_init[] = {
7773 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7774 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7775 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7776 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7777 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7778 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7779 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7780 { } /* end */
7781};
7782
7783/*
7784 * 6ch mode
7785 */
7786static struct hda_verb alc883_4ST_ch6_init[] = {
7787 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7788 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7789 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7790 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7791 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7792 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7793 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7794 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7795 { } /* end */
7796};
7797
7798/*
7799 * 8ch mode
7800 */
7801static struct hda_verb alc883_4ST_ch8_init[] = {
7802 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7803 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7804 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7805 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7806 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7807 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7808 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7809 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7810 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7811 { } /* end */
7812};
7813
7814static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7815 { 2, alc883_4ST_ch2_init },
7816 { 4, alc883_4ST_ch4_init },
7817 { 6, alc883_4ST_ch6_init },
7818 { 8, alc883_4ST_ch8_init },
7819};
7820
7821
7445/* 7822/*
7446 * 2ch mode 7823 * 2ch mode
7447 */ 7824 */
@@ -7511,6 +7888,49 @@ static struct hda_channel_mode alc883_sixstack_modes[2] = {
7511 { 8, alc883_sixstack_ch8_init }, 7888 { 8, alc883_sixstack_ch8_init },
7512}; 7889};
7513 7890
7891/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7892static struct hda_verb alc889A_mb31_ch2_init[] = {
7893 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7894 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7895 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7896 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7897 { } /* end */
7898};
7899
7900/* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7901static struct hda_verb alc889A_mb31_ch4_init[] = {
7902 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7903 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7904 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7906 { } /* end */
7907};
7908
7909/* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7910static struct hda_verb alc889A_mb31_ch5_init[] = {
7911 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7912 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7913 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7914 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7915 { } /* end */
7916};
7917
7918/* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7919static struct hda_verb alc889A_mb31_ch6_init[] = {
7920 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7921 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7922 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7923 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7924 { } /* end */
7925};
7926
7927static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7928 { 2, alc889A_mb31_ch2_init },
7929 { 4, alc889A_mb31_ch4_init },
7930 { 5, alc889A_mb31_ch5_init },
7931 { 6, alc889A_mb31_ch6_init },
7932};
7933
7514static struct hda_verb alc883_medion_eapd_verbs[] = { 7934static struct hda_verb alc883_medion_eapd_verbs[] = {
7515 /* eanable EAPD on medion laptop */ 7935 /* eanable EAPD on medion laptop */
7516 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 7936 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
@@ -7679,7 +8099,7 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7679 { } /* end */ 8099 { } /* end */
7680}; 8100};
7681 8101
7682static struct snd_kcontrol_new alc883_tagra_mixer[] = { 8102static struct snd_kcontrol_new alc883_targa_mixer[] = {
7683 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8103 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7684 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8104 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7685 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 8105 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -7699,7 +8119,7 @@ static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7699 { } /* end */ 8119 { } /* end */
7700}; 8120};
7701 8121
7702static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { 8122static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8123 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 8124 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7705 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 8125 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -7764,6 +8184,19 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7764 { } /* end */ 8184 { } /* end */
7765}; 8185};
7766 8186
8187static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8188 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8189 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8190 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8191 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8197 { } /* end */
8198};
8199
7767static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { 8200static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 8201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 8202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -7776,8 +8209,6 @@ static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), 8209 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7777 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 8210 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7778 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 8211 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7780 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
7781 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7782 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 8213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 8214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
@@ -7791,6 +8222,42 @@ static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7791 { } /* end */ 8222 { } /* end */
7792}; 8223};
7793 8224
8225static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8226 /* Output mixers */
8227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8230 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8231 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8232 HDA_OUTPUT),
8233 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8234 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8235 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8236 /* Output switches */
8237 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8238 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8239 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8240 /* Boost mixers */
8241 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8243 /* Input mixers */
8244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8248 { } /* end */
8249};
8250
8251static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8252 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8253 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8258 { } /* end */
8259};
8260
7794static struct hda_bind_ctls alc883_bind_cap_vol = { 8261static struct hda_bind_ctls alc883_bind_cap_vol = {
7795 .ops = &snd_hda_bind_vol, 8262 .ops = &snd_hda_bind_vol,
7796 .values = { 8263 .values = {
@@ -7926,16 +8393,14 @@ static struct hda_verb alc883_init_verbs[] = {
7926}; 8393};
7927 8394
7928/* toggle speaker-output according to the hp-jack state */ 8395/* toggle speaker-output according to the hp-jack state */
7929static void alc883_mitac_hp_automute(struct hda_codec *codec) 8396static void alc883_mitac_init_hook(struct hda_codec *codec)
7930{ 8397{
7931 unsigned int present; 8398 struct alc_spec *spec = codec->spec;
7932 8399
7933 present = snd_hda_codec_read(codec, 0x15, 0, 8400 spec->autocfg.hp_pins[0] = 0x15;
7934 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8401 spec->autocfg.speaker_pins[0] = 0x14;
7935 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8402 spec->autocfg.speaker_pins[1] = 0x17;
7936 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 8403 alc_automute_amp(codec);
7937 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
7938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7939} 8404}
7940 8405
7941/* auto-toggle front mic */ 8406/* auto-toggle front mic */
@@ -7952,25 +8417,6 @@ static void alc883_mitac_mic_automute(struct hda_codec *codec)
7952} 8417}
7953*/ 8418*/
7954 8419
7955static void alc883_mitac_automute(struct hda_codec *codec)
7956{
7957 alc883_mitac_hp_automute(codec);
7958 /* alc883_mitac_mic_automute(codec); */
7959}
7960
7961static void alc883_mitac_unsol_event(struct hda_codec *codec,
7962 unsigned int res)
7963{
7964 switch (res >> 26) {
7965 case ALC880_HP_EVENT:
7966 alc883_mitac_hp_automute(codec);
7967 break;
7968 case ALC880_MIC_EVENT:
7969 /* alc883_mitac_mic_automute(codec); */
7970 break;
7971 }
7972}
7973
7974static struct hda_verb alc883_mitac_verbs[] = { 8420static struct hda_verb alc883_mitac_verbs[] = {
7975 /* HP */ 8421 /* HP */
7976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 8422 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -8015,21 +8461,31 @@ static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8015 { } /* end */ 8461 { } /* end */
8016}; 8462};
8017 8463
8018static struct hda_verb alc883_tagra_verbs[] = { 8464static struct hda_verb alc883_targa_verbs[] = {
8019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 8466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8021 8467
8022 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 8468 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8023 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 8469 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8024 8470
8025 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 8471/* Connect Line-Out side jack (SPDIF) to Side */
8026 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 8472 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8027 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 8473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8474 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8475/* Connect Mic jack to CLFE */
8476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8478 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8479/* Connect Line-in jack to Surround */
8480 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8481 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8482 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8483/* Connect HP out jack to Front */
8484 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8485 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8486 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8028 8487
8029 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 8488 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8030 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
8031 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
8032 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
8033 8489
8034 { } /* end */ 8490 { } /* end */
8035}; 8491};
@@ -8088,29 +8544,26 @@ static struct hda_verb alc888_6st_dell_verbs[] = {
8088 { } 8544 { }
8089}; 8545};
8090 8546
8091static void alc888_3st_hp_front_automute(struct hda_codec *codec) 8547static struct hda_verb alc883_vaiott_verbs[] = {
8092{ 8548 /* HP */
8093 unsigned int present, bits; 8549 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8550 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8094 8551
8095 present = snd_hda_codec_read(codec, 0x1b, 0, 8552 /* enable unsolicited event */
8096 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8553 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8097 bits = present ? HDA_AMP_MUTE : 0;
8098 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8099 HDA_AMP_MUTE, bits);
8100 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8101 HDA_AMP_MUTE, bits);
8102 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
8103 HDA_AMP_MUTE, bits);
8104}
8105 8554
8106static void alc888_3st_hp_unsol_event(struct hda_codec *codec, 8555 { } /* end */
8107 unsigned int res) 8556};
8557
8558static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8108{ 8559{
8109 switch (res >> 26) { 8560 struct alc_spec *spec = codec->spec;
8110 case ALC880_HP_EVENT: 8561
8111 alc888_3st_hp_front_automute(codec); 8562 spec->autocfg.hp_pins[0] = 0x1b;
8112 break; 8563 spec->autocfg.speaker_pins[0] = 0x14;
8113 } 8564 spec->autocfg.speaker_pins[1] = 0x16;
8565 spec->autocfg.speaker_pins[2] = 0x18;
8566 alc_automute_amp(codec);
8114} 8567}
8115 8568
8116static struct hda_verb alc888_3st_hp_verbs[] = { 8569static struct hda_verb alc888_3st_hp_verbs[] = {
@@ -8207,56 +8660,18 @@ static struct hda_verb alc883_medion_md2_verbs[] = {
8207}; 8660};
8208 8661
8209/* toggle speaker-output according to the hp-jack state */ 8662/* toggle speaker-output according to the hp-jack state */
8210static void alc883_medion_md2_automute(struct hda_codec *codec) 8663static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8211{
8212 unsigned int present;
8213
8214 present = snd_hda_codec_read(codec, 0x14, 0,
8215 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8216 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8217 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8218}
8219
8220static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
8221 unsigned int res)
8222{
8223 if ((res >> 26) == ALC880_HP_EVENT)
8224 alc883_medion_md2_automute(codec);
8225}
8226
8227/* toggle speaker-output according to the hp-jack state */
8228static void alc883_tagra_automute(struct hda_codec *codec)
8229{ 8664{
8230 unsigned int present; 8665 struct alc_spec *spec = codec->spec;
8231 unsigned char bits;
8232
8233 present = snd_hda_codec_read(codec, 0x14, 0,
8234 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8235 bits = present ? HDA_AMP_MUTE : 0;
8236 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
8237 HDA_AMP_MUTE, bits);
8238 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8239 present ? 1 : 3);
8240}
8241 8666
8242static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) 8667 spec->autocfg.hp_pins[0] = 0x14;
8243{ 8668 spec->autocfg.speaker_pins[0] = 0x15;
8244 if ((res >> 26) == ALC880_HP_EVENT) 8669 alc_automute_amp(codec);
8245 alc883_tagra_automute(codec);
8246} 8670}
8247 8671
8248/* toggle speaker-output according to the hp-jack state */ 8672/* toggle speaker-output according to the hp-jack state */
8249static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) 8673#define alc883_targa_init_hook alc882_targa_init_hook
8250{ 8674#define alc883_targa_unsol_event alc882_targa_unsol_event
8251 unsigned int present;
8252 unsigned char bits;
8253
8254 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
8255 & AC_PINSENSE_PRESENCE;
8256 bits = present ? HDA_AMP_MUTE : 0;
8257 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8258 HDA_AMP_MUTE, bits);
8259}
8260 8675
8261static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) 8676static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8262{ 8677{
@@ -8268,9 +8683,13 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8268 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 8683 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8269} 8684}
8270 8685
8271static void alc883_clevo_m720_automute(struct hda_codec *codec) 8686static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8272{ 8687{
8273 alc883_clevo_m720_hp_automute(codec); 8688 struct alc_spec *spec = codec->spec;
8689
8690 spec->autocfg.hp_pins[0] = 0x15;
8691 spec->autocfg.speaker_pins[0] = 0x14;
8692 alc_automute_amp(codec);
8274 alc883_clevo_m720_mic_automute(codec); 8693 alc883_clevo_m720_mic_automute(codec);
8275} 8694}
8276 8695
@@ -8278,52 +8697,32 @@ static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8278 unsigned int res) 8697 unsigned int res)
8279{ 8698{
8280 switch (res >> 26) { 8699 switch (res >> 26) {
8281 case ALC880_HP_EVENT:
8282 alc883_clevo_m720_hp_automute(codec);
8283 break;
8284 case ALC880_MIC_EVENT: 8700 case ALC880_MIC_EVENT:
8285 alc883_clevo_m720_mic_automute(codec); 8701 alc883_clevo_m720_mic_automute(codec);
8286 break; 8702 break;
8703 default:
8704 alc_automute_amp_unsol_event(codec, res);
8705 break;
8287 } 8706 }
8288} 8707}
8289 8708
8290/* toggle speaker-output according to the hp-jack state */ 8709/* toggle speaker-output according to the hp-jack state */
8291static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) 8710static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8292{ 8711{
8293 unsigned int present; 8712 struct alc_spec *spec = codec->spec;
8294 unsigned char bits;
8295
8296 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8297 & AC_PINSENSE_PRESENCE;
8298 bits = present ? HDA_AMP_MUTE : 0;
8299 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8300 HDA_AMP_MUTE, bits);
8301}
8302 8713
8303static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, 8714 spec->autocfg.hp_pins[0] = 0x14;
8304 unsigned int res) 8715 spec->autocfg.speaker_pins[0] = 0x15;
8305{ 8716 alc_automute_amp(codec);
8306 if ((res >> 26) == ALC880_HP_EVENT)
8307 alc883_2ch_fujitsu_pi2515_automute(codec);
8308} 8717}
8309 8718
8310static void alc883_haier_w66_automute(struct hda_codec *codec) 8719static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8311{ 8720{
8312 unsigned int present; 8721 struct alc_spec *spec = codec->spec;
8313 unsigned char bits;
8314 8722
8315 present = snd_hda_codec_read(codec, 0x1b, 0, 8723 spec->autocfg.hp_pins[0] = 0x1b;
8316 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8724 spec->autocfg.speaker_pins[0] = 0x14;
8317 bits = present ? 0x80 : 0; 8725 alc_automute_amp(codec);
8318 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8319 0x80, bits);
8320}
8321
8322static void alc883_haier_w66_unsol_event(struct hda_codec *codec,
8323 unsigned int res)
8324{
8325 if ((res >> 26) == ALC880_HP_EVENT)
8326 alc883_haier_w66_automute(codec);
8327} 8726}
8328 8727
8329static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) 8728static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
@@ -8331,8 +8730,8 @@ static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8331 unsigned int present; 8730 unsigned int present;
8332 unsigned char bits; 8731 unsigned char bits;
8333 8732
8334 present = snd_hda_codec_read(codec, 0x14, 0, 8733 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8335 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8734 & AC_PINSENSE_PRESENCE;
8336 bits = present ? HDA_AMP_MUTE : 0; 8735 bits = present ? HDA_AMP_MUTE : 0;
8337 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8736 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8338 HDA_AMP_MUTE, bits); 8737 HDA_AMP_MUTE, bits);
@@ -8362,23 +8761,14 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8362} 8761}
8363 8762
8364/* toggle speaker-output according to the hp-jack state */ 8763/* toggle speaker-output according to the hp-jack state */
8365static void alc883_acer_aspire_automute(struct hda_codec *codec) 8764static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8366{ 8765{
8367 unsigned int present; 8766 struct alc_spec *spec = codec->spec;
8368 8767
8369 present = snd_hda_codec_read(codec, 0x14, 0, 8768 spec->autocfg.hp_pins[0] = 0x14;
8370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8769 spec->autocfg.speaker_pins[0] = 0x15;
8371 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8770 spec->autocfg.speaker_pins[1] = 0x16;
8372 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 8771 alc_automute_amp(codec);
8373 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8374 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8375}
8376
8377static void alc883_acer_aspire_unsol_event(struct hda_codec *codec,
8378 unsigned int res)
8379{
8380 if ((res >> 26) == ALC880_HP_EVENT)
8381 alc883_acer_aspire_automute(codec);
8382} 8772}
8383 8773
8384static struct hda_verb alc883_acer_eapd_verbs[] = { 8774static struct hda_verb alc883_acer_eapd_verbs[] = {
@@ -8399,75 +8789,39 @@ static struct hda_verb alc883_acer_eapd_verbs[] = {
8399 { } 8789 { }
8400}; 8790};
8401 8791
8402static void alc888_6st_dell_front_automute(struct hda_codec *codec) 8792static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8403{ 8793{
8404 unsigned int present; 8794 struct alc_spec *spec = codec->spec;
8405 8795
8406 present = snd_hda_codec_read(codec, 0x1b, 0, 8796 spec->autocfg.hp_pins[0] = 0x1b;
8407 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8797 spec->autocfg.speaker_pins[0] = 0x14;
8408 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8798 spec->autocfg.speaker_pins[1] = 0x15;
8409 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 8799 spec->autocfg.speaker_pins[2] = 0x16;
8410 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 8800 spec->autocfg.speaker_pins[3] = 0x17;
8411 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 8801 alc_automute_amp(codec);
8412 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8413 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8414 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8415 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8416} 8802}
8417 8803
8418static void alc888_6st_dell_unsol_event(struct hda_codec *codec, 8804static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8419 unsigned int res)
8420{ 8805{
8421 switch (res >> 26) { 8806 struct alc_spec *spec = codec->spec;
8422 case ALC880_HP_EVENT:
8423 /* printk(KERN_DEBUG "hp_event\n"); */
8424 alc888_6st_dell_front_automute(codec);
8425 break;
8426 }
8427}
8428
8429static void alc888_lenovo_sky_front_automute(struct hda_codec *codec)
8430{
8431 unsigned int mute;
8432 unsigned int present;
8433 8807
8434 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 8808 spec->autocfg.hp_pins[0] = 0x1b;
8435 present = snd_hda_codec_read(codec, 0x1b, 0, 8809 spec->autocfg.speaker_pins[0] = 0x14;
8436 AC_VERB_GET_PIN_SENSE, 0); 8810 spec->autocfg.speaker_pins[1] = 0x15;
8437 present = (present & 0x80000000) != 0; 8811 spec->autocfg.speaker_pins[2] = 0x16;
8438 if (present) { 8812 spec->autocfg.speaker_pins[3] = 0x17;
8439 /* mute internal speaker */ 8813 spec->autocfg.speaker_pins[4] = 0x1a;
8440 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8814 alc_automute_amp(codec);
8441 HDA_AMP_MUTE, HDA_AMP_MUTE);
8442 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8443 HDA_AMP_MUTE, HDA_AMP_MUTE);
8444 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8445 HDA_AMP_MUTE, HDA_AMP_MUTE);
8446 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8447 HDA_AMP_MUTE, HDA_AMP_MUTE);
8448 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8449 HDA_AMP_MUTE, HDA_AMP_MUTE);
8450 } else {
8451 /* unmute internal speaker if necessary */
8452 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
8453 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8454 HDA_AMP_MUTE, mute);
8455 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8456 HDA_AMP_MUTE, mute);
8457 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8458 HDA_AMP_MUTE, mute);
8459 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
8460 HDA_AMP_MUTE, mute);
8461 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
8462 HDA_AMP_MUTE, mute);
8463 }
8464} 8815}
8465 8816
8466static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, 8817static void alc883_vaiott_init_hook(struct hda_codec *codec)
8467 unsigned int res)
8468{ 8818{
8469 if ((res >> 26) == ALC880_HP_EVENT) 8819 struct alc_spec *spec = codec->spec;
8470 alc888_lenovo_sky_front_automute(codec); 8820
8821 spec->autocfg.hp_pins[0] = 0x15;
8822 spec->autocfg.speaker_pins[0] = 0x14;
8823 spec->autocfg.speaker_pins[1] = 0x17;
8824 alc_automute_amp(codec);
8471} 8825}
8472 8826
8473/* 8827/*
@@ -8555,39 +8909,33 @@ static void alc883_nb_mic_automute(struct hda_codec *codec)
8555 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); 8909 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8556} 8910}
8557 8911
8558static void alc883_M90V_speaker_automute(struct hda_codec *codec) 8912static void alc883_M90V_init_hook(struct hda_codec *codec)
8559{ 8913{
8560 unsigned int present; 8914 struct alc_spec *spec = codec->spec;
8561 unsigned char bits;
8562 8915
8563 present = snd_hda_codec_read(codec, 0x1b, 0, 8916 spec->autocfg.hp_pins[0] = 0x1b;
8564 AC_VERB_GET_PIN_SENSE, 0) 8917 spec->autocfg.speaker_pins[0] = 0x14;
8565 & AC_PINSENSE_PRESENCE; 8918 spec->autocfg.speaker_pins[1] = 0x15;
8566 bits = present ? 0 : PIN_OUT; 8919 spec->autocfg.speaker_pins[2] = 0x16;
8567 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 8920 alc_automute_pin(codec);
8568 bits);
8569 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8570 bits);
8571 snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8572 bits);
8573} 8921}
8574 8922
8575static void alc883_mode2_unsol_event(struct hda_codec *codec, 8923static void alc883_mode2_unsol_event(struct hda_codec *codec,
8576 unsigned int res) 8924 unsigned int res)
8577{ 8925{
8578 switch (res >> 26) { 8926 switch (res >> 26) {
8579 case ALC880_HP_EVENT:
8580 alc883_M90V_speaker_automute(codec);
8581 break;
8582 case ALC880_MIC_EVENT: 8927 case ALC880_MIC_EVENT:
8583 alc883_nb_mic_automute(codec); 8928 alc883_nb_mic_automute(codec);
8584 break; 8929 break;
8930 default:
8931 alc_sku_unsol_event(codec, res);
8932 break;
8585 } 8933 }
8586} 8934}
8587 8935
8588static void alc883_mode2_inithook(struct hda_codec *codec) 8936static void alc883_mode2_inithook(struct hda_codec *codec)
8589{ 8937{
8590 alc883_M90V_speaker_automute(codec); 8938 alc883_M90V_init_hook(codec);
8591 alc883_nb_mic_automute(codec); 8939 alc883_nb_mic_automute(codec);
8592} 8940}
8593 8941
@@ -8604,39 +8952,56 @@ static struct hda_verb alc888_asus_eee1601_verbs[] = {
8604 { } /* end */ 8952 { } /* end */
8605}; 8953};
8606 8954
8607static void alc883_eee1601_speaker_automute(struct hda_codec *codec) 8955static void alc883_eee1601_inithook(struct hda_codec *codec)
8608{ 8956{
8609 unsigned int present; 8957 struct alc_spec *spec = codec->spec;
8610 unsigned char bits;
8611 8958
8612 present = snd_hda_codec_read(codec, 0x14, 0, 8959 spec->autocfg.hp_pins[0] = 0x14;
8613 AC_VERB_GET_PIN_SENSE, 0) 8960 spec->autocfg.speaker_pins[0] = 0x1b;
8614 & AC_PINSENSE_PRESENCE; 8961 alc_automute_pin(codec);
8615 bits = present ? 0 : PIN_OUT;
8616 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8617 bits);
8618} 8962}
8619 8963
8620static void alc883_eee1601_unsol_event(struct hda_codec *codec, 8964static struct hda_verb alc889A_mb31_verbs[] = {
8621 unsigned int res) 8965 /* Init rear pin (used as headphone output) */
8966 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8967 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8968 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8969 /* Init line pin (used as output in 4ch and 6ch mode) */
8970 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8971 /* Init line 2 pin (used as headphone out by default) */
8972 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8973 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8974 { } /* end */
8975};
8976
8977/* Mute speakers according to the headphone jack state */
8978static void alc889A_mb31_automute(struct hda_codec *codec)
8622{ 8979{
8623 switch (res >> 26) { 8980 unsigned int present;
8624 case ALC880_HP_EVENT: 8981
8625 alc883_eee1601_speaker_automute(codec); 8982 /* Mute only in 2ch or 4ch mode */
8626 break; 8983 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8984 == 0x00) {
8985 present = snd_hda_codec_read(codec, 0x15, 0,
8986 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8987 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8988 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8989 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8990 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8627 } 8991 }
8628} 8992}
8629 8993
8630static void alc883_eee1601_inithook(struct hda_codec *codec) 8994static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8631{ 8995{
8632 alc883_eee1601_speaker_automute(codec); 8996 if ((res >> 26) == ALC880_HP_EVENT)
8997 alc889A_mb31_automute(codec);
8633} 8998}
8634 8999
8635#ifdef CONFIG_SND_HDA_POWER_SAVE 9000#ifdef CONFIG_SND_HDA_POWER_SAVE
8636#define alc883_loopbacks alc880_loopbacks 9001#define alc883_loopbacks alc880_loopbacks
8637#endif 9002#endif
8638 9003
8639/* pcm configuration: identiacal with ALC880 */ 9004/* pcm configuration: identical with ALC880 */
8640#define alc883_pcm_analog_playback alc880_pcm_analog_playback 9005#define alc883_pcm_analog_playback alc880_pcm_analog_playback
8641#define alc883_pcm_analog_capture alc880_pcm_analog_capture 9006#define alc883_pcm_analog_capture alc880_pcm_analog_capture
8642#define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture 9007#define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
@@ -8653,9 +9018,12 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
8653 [ALC883_6ST_DIG] = "6stack-dig", 9018 [ALC883_6ST_DIG] = "6stack-dig",
8654 [ALC883_TARGA_DIG] = "targa-dig", 9019 [ALC883_TARGA_DIG] = "targa-dig",
8655 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", 9020 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9021 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8656 [ALC883_ACER] = "acer", 9022 [ALC883_ACER] = "acer",
8657 [ALC883_ACER_ASPIRE] = "acer-aspire", 9023 [ALC883_ACER_ASPIRE] = "acer-aspire",
8658 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", 9024 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9025 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9026 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8659 [ALC883_MEDION] = "medion", 9027 [ALC883_MEDION] = "medion",
8660 [ALC883_MEDION_MD2] = "medion-md2", 9028 [ALC883_MEDION_MD2] = "medion-md2",
8661 [ALC883_LAPTOP_EAPD] = "laptop-eapd", 9029 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
@@ -8672,6 +9040,8 @@ static const char *alc883_models[ALC883_MODEL_LAST] = {
8672 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", 9040 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8673 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", 9041 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8674 [ALC1200_ASUS_P5Q] = "asus-p5q", 9042 [ALC1200_ASUS_P5Q] = "asus-p5q",
9043 [ALC889A_MB31] = "mb31",
9044 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8675 [ALC883_AUTO] = "auto", 9045 [ALC883_AUTO] = "auto",
8676}; 9046};
8677 9047
@@ -8687,14 +9057,20 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8687 ALC888_ACER_ASPIRE_4930G), 9057 ALC888_ACER_ASPIRE_4930G),
8688 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", 9058 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8689 ALC888_ACER_ASPIRE_4930G), 9059 ALC888_ACER_ASPIRE_4930G),
9060 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9061 ALC888_ACER_ASPIRE_8930G),
9062 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9063 ALC888_ACER_ASPIRE_8930G),
8690 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), 9064 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
8691 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), 9065 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
8692 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", 9066 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8693 ALC888_ACER_ASPIRE_4930G), 9067 ALC888_ACER_ASPIRE_4930G),
8694 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", 9068 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8695 ALC888_ACER_ASPIRE_4930G), 9069 ALC888_ACER_ASPIRE_6530G),
8696 /* default Acer */ 9070 /* default Acer -- disabled as it causes more problems.
8697 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), 9071 * model=auto should work fine now
9072 */
9073 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8698 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 9074 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8699 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), 9075 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8700 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 9076 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
@@ -8730,6 +9106,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8730 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), 9106 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), 9107 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), 9108 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9109 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), 9110 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 9111 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), 9112 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
@@ -8737,6 +9114,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8737 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), 9114 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), 9115 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), 9116 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9117 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8740 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 9118 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8741 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), 9119 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8742 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), 9120 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
@@ -8762,6 +9140,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8762 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), 9140 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8763 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), 9141 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8764 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 9142 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9143 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8765 {} 9144 {}
8766}; 9145};
8767 9146
@@ -8832,8 +9211,8 @@ static struct alc_config_preset alc883_presets[] = {
8832 .input_mux = &alc883_capture_source, 9211 .input_mux = &alc883_capture_source,
8833 }, 9212 },
8834 [ALC883_TARGA_DIG] = { 9213 [ALC883_TARGA_DIG] = {
8835 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, 9214 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
8836 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, 9215 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8837 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9216 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8838 .dac_nids = alc883_dac_nids, 9217 .dac_nids = alc883_dac_nids,
8839 .dig_out_nid = ALC883_DIGOUT_NID, 9218 .dig_out_nid = ALC883_DIGOUT_NID,
@@ -8841,12 +9220,12 @@ static struct alc_config_preset alc883_presets[] = {
8841 .channel_mode = alc883_3ST_6ch_modes, 9220 .channel_mode = alc883_3ST_6ch_modes,
8842 .need_dac_fix = 1, 9221 .need_dac_fix = 1,
8843 .input_mux = &alc883_capture_source, 9222 .input_mux = &alc883_capture_source,
8844 .unsol_event = alc883_tagra_unsol_event, 9223 .unsol_event = alc883_targa_unsol_event,
8845 .init_hook = alc883_tagra_automute, 9224 .init_hook = alc883_targa_init_hook,
8846 }, 9225 },
8847 [ALC883_TARGA_2ch_DIG] = { 9226 [ALC883_TARGA_2ch_DIG] = {
8848 .mixers = { alc883_tagra_2ch_mixer}, 9227 .mixers = { alc883_targa_2ch_mixer},
8849 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, 9228 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8850 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9229 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8851 .dac_nids = alc883_dac_nids, 9230 .dac_nids = alc883_dac_nids,
8852 .adc_nids = alc883_adc_nids_alt, 9231 .adc_nids = alc883_adc_nids_alt,
@@ -8855,8 +9234,26 @@ static struct alc_config_preset alc883_presets[] = {
8855 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9234 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8856 .channel_mode = alc883_3ST_2ch_modes, 9235 .channel_mode = alc883_3ST_2ch_modes,
8857 .input_mux = &alc883_capture_source, 9236 .input_mux = &alc883_capture_source,
8858 .unsol_event = alc883_tagra_unsol_event, 9237 .unsol_event = alc883_targa_unsol_event,
8859 .init_hook = alc883_tagra_automute, 9238 .init_hook = alc883_targa_init_hook,
9239 },
9240 [ALC883_TARGA_8ch_DIG] = {
9241 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9242 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9243 alc883_targa_verbs },
9244 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9245 .dac_nids = alc883_dac_nids,
9246 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9247 .adc_nids = alc883_adc_nids_rev,
9248 .capsrc_nids = alc883_capsrc_nids_rev,
9249 .dig_out_nid = ALC883_DIGOUT_NID,
9250 .dig_in_nid = ALC883_DIGIN_NID,
9251 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9252 .channel_mode = alc883_4ST_8ch_modes,
9253 .need_dac_fix = 1,
9254 .input_mux = &alc883_capture_source,
9255 .unsol_event = alc883_targa_unsol_event,
9256 .init_hook = alc883_targa_init_hook,
8860 }, 9257 },
8861 [ALC883_ACER] = { 9258 [ALC883_ACER] = {
8862 .mixers = { alc883_base_mixer }, 9259 .mixers = { alc883_base_mixer },
@@ -8881,8 +9278,8 @@ static struct alc_config_preset alc883_presets[] = {
8881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8882 .channel_mode = alc883_3ST_2ch_modes, 9279 .channel_mode = alc883_3ST_2ch_modes,
8883 .input_mux = &alc883_capture_source, 9280 .input_mux = &alc883_capture_source,
8884 .unsol_event = alc883_acer_aspire_unsol_event, 9281 .unsol_event = alc_automute_amp_unsol_event,
8885 .init_hook = alc883_acer_aspire_automute, 9282 .init_hook = alc883_acer_aspire_init_hook,
8886 }, 9283 },
8887 [ALC888_ACER_ASPIRE_4930G] = { 9284 [ALC888_ACER_ASPIRE_4930G] = {
8888 .mixers = { alc888_base_mixer, 9285 .mixers = { alc888_base_mixer,
@@ -8901,8 +9298,47 @@ static struct alc_config_preset alc883_presets[] = {
8901 .num_mux_defs = 9298 .num_mux_defs =
8902 ARRAY_SIZE(alc888_2_capture_sources), 9299 ARRAY_SIZE(alc888_2_capture_sources),
8903 .input_mux = alc888_2_capture_sources, 9300 .input_mux = alc888_2_capture_sources,
8904 .unsol_event = alc888_acer_aspire_4930g_unsol_event, 9301 .unsol_event = alc_automute_amp_unsol_event,
8905 .init_hook = alc888_acer_aspire_4930g_automute, 9302 .init_hook = alc888_acer_aspire_4930g_init_hook,
9303 },
9304 [ALC888_ACER_ASPIRE_6530G] = {
9305 .mixers = { alc888_acer_aspire_6530_mixer },
9306 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9307 alc888_acer_aspire_6530g_verbs },
9308 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9309 .dac_nids = alc883_dac_nids,
9310 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9311 .adc_nids = alc883_adc_nids_rev,
9312 .capsrc_nids = alc883_capsrc_nids_rev,
9313 .dig_out_nid = ALC883_DIGOUT_NID,
9314 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9315 .channel_mode = alc883_3ST_2ch_modes,
9316 .num_mux_defs =
9317 ARRAY_SIZE(alc888_2_capture_sources),
9318 .input_mux = alc888_acer_aspire_6530_sources,
9319 .unsol_event = alc_automute_amp_unsol_event,
9320 .init_hook = alc888_acer_aspire_4930g_init_hook,
9321 },
9322 [ALC888_ACER_ASPIRE_8930G] = {
9323 .mixers = { alc888_base_mixer,
9324 alc883_chmode_mixer },
9325 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9326 alc889_acer_aspire_8930g_verbs },
9327 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9328 .dac_nids = alc883_dac_nids,
9329 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9330 .adc_nids = alc889_adc_nids,
9331 .capsrc_nids = alc889_capsrc_nids,
9332 .dig_out_nid = ALC883_DIGOUT_NID,
9333 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9334 .channel_mode = alc883_3ST_6ch_modes,
9335 .need_dac_fix = 1,
9336 .const_channel_count = 6,
9337 .num_mux_defs =
9338 ARRAY_SIZE(alc889_capture_sources),
9339 .input_mux = alc889_capture_sources,
9340 .unsol_event = alc_automute_amp_unsol_event,
9341 .init_hook = alc889_acer_aspire_8930g_init_hook,
8906 }, 9342 },
8907 [ALC883_MEDION] = { 9343 [ALC883_MEDION] = {
8908 .mixers = { alc883_fivestack_mixer, 9344 .mixers = { alc883_fivestack_mixer,
@@ -8926,8 +9362,8 @@ static struct alc_config_preset alc883_presets[] = {
8926 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9362 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8927 .channel_mode = alc883_3ST_2ch_modes, 9363 .channel_mode = alc883_3ST_2ch_modes,
8928 .input_mux = &alc883_capture_source, 9364 .input_mux = &alc883_capture_source,
8929 .unsol_event = alc883_medion_md2_unsol_event, 9365 .unsol_event = alc_automute_amp_unsol_event,
8930 .init_hook = alc883_medion_md2_automute, 9366 .init_hook = alc883_medion_md2_init_hook,
8931 }, 9367 },
8932 [ALC883_LAPTOP_EAPD] = { 9368 [ALC883_LAPTOP_EAPD] = {
8933 .mixers = { alc883_base_mixer }, 9369 .mixers = { alc883_base_mixer },
@@ -8948,7 +9384,7 @@ static struct alc_config_preset alc883_presets[] = {
8948 .channel_mode = alc883_3ST_2ch_modes, 9384 .channel_mode = alc883_3ST_2ch_modes,
8949 .input_mux = &alc883_capture_source, 9385 .input_mux = &alc883_capture_source,
8950 .unsol_event = alc883_clevo_m720_unsol_event, 9386 .unsol_event = alc883_clevo_m720_unsol_event,
8951 .init_hook = alc883_clevo_m720_automute, 9387 .init_hook = alc883_clevo_m720_init_hook,
8952 }, 9388 },
8953 [ALC883_LENOVO_101E_2ch] = { 9389 [ALC883_LENOVO_101E_2ch] = {
8954 .mixers = { alc883_lenovo_101e_2ch_mixer}, 9390 .mixers = { alc883_lenovo_101e_2ch_mixer},
@@ -8972,8 +9408,8 @@ static struct alc_config_preset alc883_presets[] = {
8972 .channel_mode = alc883_3ST_2ch_modes, 9408 .channel_mode = alc883_3ST_2ch_modes,
8973 .need_dac_fix = 1, 9409 .need_dac_fix = 1,
8974 .input_mux = &alc883_lenovo_nb0763_capture_source, 9410 .input_mux = &alc883_lenovo_nb0763_capture_source,
8975 .unsol_event = alc883_medion_md2_unsol_event, 9411 .unsol_event = alc_automute_amp_unsol_event,
8976 .init_hook = alc883_medion_md2_automute, 9412 .init_hook = alc883_medion_md2_init_hook,
8977 }, 9413 },
8978 [ALC888_LENOVO_MS7195_DIG] = { 9414 [ALC888_LENOVO_MS7195_DIG] = {
8979 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 9415 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -8989,7 +9425,7 @@ static struct alc_config_preset alc883_presets[] = {
8989 .init_hook = alc888_lenovo_ms7195_front_automute, 9425 .init_hook = alc888_lenovo_ms7195_front_automute,
8990 }, 9426 },
8991 [ALC883_HAIER_W66] = { 9427 [ALC883_HAIER_W66] = {
8992 .mixers = { alc883_tagra_2ch_mixer}, 9428 .mixers = { alc883_targa_2ch_mixer},
8993 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, 9429 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8994 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8995 .dac_nids = alc883_dac_nids, 9431 .dac_nids = alc883_dac_nids,
@@ -8997,8 +9433,8 @@ static struct alc_config_preset alc883_presets[] = {
8997 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9433 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8998 .channel_mode = alc883_3ST_2ch_modes, 9434 .channel_mode = alc883_3ST_2ch_modes,
8999 .input_mux = &alc883_capture_source, 9435 .input_mux = &alc883_capture_source,
9000 .unsol_event = alc883_haier_w66_unsol_event, 9436 .unsol_event = alc_automute_amp_unsol_event,
9001 .init_hook = alc883_haier_w66_automute, 9437 .init_hook = alc883_haier_w66_init_hook,
9002 }, 9438 },
9003 [ALC888_3ST_HP] = { 9439 [ALC888_3ST_HP] = {
9004 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 9440 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -9009,8 +9445,8 @@ static struct alc_config_preset alc883_presets[] = {
9009 .channel_mode = alc888_3st_hp_modes, 9445 .channel_mode = alc888_3st_hp_modes,
9010 .need_dac_fix = 1, 9446 .need_dac_fix = 1,
9011 .input_mux = &alc883_capture_source, 9447 .input_mux = &alc883_capture_source,
9012 .unsol_event = alc888_3st_hp_unsol_event, 9448 .unsol_event = alc_automute_amp_unsol_event,
9013 .init_hook = alc888_3st_hp_front_automute, 9449 .init_hook = alc888_3st_hp_init_hook,
9014 }, 9450 },
9015 [ALC888_6ST_DELL] = { 9451 [ALC888_6ST_DELL] = {
9016 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 9452 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
@@ -9022,8 +9458,8 @@ static struct alc_config_preset alc883_presets[] = {
9022 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9458 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9023 .channel_mode = alc883_sixstack_modes, 9459 .channel_mode = alc883_sixstack_modes,
9024 .input_mux = &alc883_capture_source, 9460 .input_mux = &alc883_capture_source,
9025 .unsol_event = alc888_6st_dell_unsol_event, 9461 .unsol_event = alc_automute_amp_unsol_event,
9026 .init_hook = alc888_6st_dell_front_automute, 9462 .init_hook = alc888_6st_dell_init_hook,
9027 }, 9463 },
9028 [ALC883_MITAC] = { 9464 [ALC883_MITAC] = {
9029 .mixers = { alc883_mitac_mixer }, 9465 .mixers = { alc883_mitac_mixer },
@@ -9033,8 +9469,8 @@ static struct alc_config_preset alc883_presets[] = {
9033 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9469 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9034 .channel_mode = alc883_3ST_2ch_modes, 9470 .channel_mode = alc883_3ST_2ch_modes,
9035 .input_mux = &alc883_capture_source, 9471 .input_mux = &alc883_capture_source,
9036 .unsol_event = alc883_mitac_unsol_event, 9472 .unsol_event = alc_automute_amp_unsol_event,
9037 .init_hook = alc883_mitac_automute, 9473 .init_hook = alc883_mitac_init_hook,
9038 }, 9474 },
9039 [ALC883_FUJITSU_PI2515] = { 9475 [ALC883_FUJITSU_PI2515] = {
9040 .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, 9476 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
@@ -9046,8 +9482,8 @@ static struct alc_config_preset alc883_presets[] = {
9046 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 9482 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9047 .channel_mode = alc883_3ST_2ch_modes, 9483 .channel_mode = alc883_3ST_2ch_modes,
9048 .input_mux = &alc883_fujitsu_pi2515_capture_source, 9484 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9049 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 9485 .unsol_event = alc_automute_amp_unsol_event,
9050 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 9486 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9051 }, 9487 },
9052 [ALC888_FUJITSU_XA3530] = { 9488 [ALC888_FUJITSU_XA3530] = {
9053 .mixers = { alc888_base_mixer, alc883_chmode_mixer }, 9489 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
@@ -9064,8 +9500,8 @@ static struct alc_config_preset alc883_presets[] = {
9064 .num_mux_defs = 9500 .num_mux_defs =
9065 ARRAY_SIZE(alc888_2_capture_sources), 9501 ARRAY_SIZE(alc888_2_capture_sources),
9066 .input_mux = alc888_2_capture_sources, 9502 .input_mux = alc888_2_capture_sources,
9067 .unsol_event = alc888_fujitsu_xa3530_unsol_event, 9503 .unsol_event = alc_automute_amp_unsol_event,
9068 .init_hook = alc888_fujitsu_xa3530_automute, 9504 .init_hook = alc888_fujitsu_xa3530_init_hook,
9069 }, 9505 },
9070 [ALC888_LENOVO_SKY] = { 9506 [ALC888_LENOVO_SKY] = {
9071 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, 9507 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
@@ -9077,8 +9513,8 @@ static struct alc_config_preset alc883_presets[] = {
9077 .channel_mode = alc883_sixstack_modes, 9513 .channel_mode = alc883_sixstack_modes,
9078 .need_dac_fix = 1, 9514 .need_dac_fix = 1,
9079 .input_mux = &alc883_lenovo_sky_capture_source, 9515 .input_mux = &alc883_lenovo_sky_capture_source,
9080 .unsol_event = alc883_lenovo_sky_unsol_event, 9516 .unsol_event = alc_automute_amp_unsol_event,
9081 .init_hook = alc888_lenovo_sky_front_automute, 9517 .init_hook = alc888_lenovo_sky_init_hook,
9082 }, 9518 },
9083 [ALC888_ASUS_M90V] = { 9519 [ALC888_ASUS_M90V] = {
9084 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 9520 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
@@ -9106,7 +9542,7 @@ static struct alc_config_preset alc883_presets[] = {
9106 .channel_mode = alc883_3ST_2ch_modes, 9542 .channel_mode = alc883_3ST_2ch_modes,
9107 .need_dac_fix = 1, 9543 .need_dac_fix = 1,
9108 .input_mux = &alc883_asus_eee1601_capture_source, 9544 .input_mux = &alc883_asus_eee1601_capture_source,
9109 .unsol_event = alc883_eee1601_unsol_event, 9545 .unsol_event = alc_sku_unsol_event,
9110 .init_hook = alc883_eee1601_inithook, 9546 .init_hook = alc883_eee1601_inithook,
9111 }, 9547 },
9112 [ALC1200_ASUS_P5Q] = { 9548 [ALC1200_ASUS_P5Q] = {
@@ -9121,6 +9557,32 @@ static struct alc_config_preset alc883_presets[] = {
9121 .channel_mode = alc883_sixstack_modes, 9557 .channel_mode = alc883_sixstack_modes,
9122 .input_mux = &alc883_capture_source, 9558 .input_mux = &alc883_capture_source,
9123 }, 9559 },
9560 [ALC889A_MB31] = {
9561 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9562 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9563 alc880_gpio1_init_verbs },
9564 .adc_nids = alc883_adc_nids,
9565 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9566 .dac_nids = alc883_dac_nids,
9567 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9568 .channel_mode = alc889A_mb31_6ch_modes,
9569 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9570 .input_mux = &alc889A_mb31_capture_source,
9571 .dig_out_nid = ALC883_DIGOUT_NID,
9572 .unsol_event = alc889A_mb31_unsol_event,
9573 .init_hook = alc889A_mb31_automute,
9574 },
9575 [ALC883_SONY_VAIO_TT] = {
9576 .mixers = { alc883_vaiott_mixer },
9577 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9579 .dac_nids = alc883_dac_nids,
9580 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9581 .channel_mode = alc883_3ST_2ch_modes,
9582 .input_mux = &alc883_capture_source,
9583 .unsol_event = alc_automute_amp_unsol_event,
9584 .init_hook = alc883_vaiott_init_hook,
9585 },
9124}; 9586};
9125 9587
9126 9588
@@ -9149,7 +9611,6 @@ static void alc883_auto_init_multi_out(struct hda_codec *codec)
9149 struct alc_spec *spec = codec->spec; 9611 struct alc_spec *spec = codec->spec;
9150 int i; 9612 int i;
9151 9613
9152 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
9153 for (i = 0; i <= HDA_SIDE; i++) { 9614 for (i = 0; i <= HDA_SIDE; i++) {
9154 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 9615 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9155 int pin_type = get_pin_type(spec->autocfg.line_out_type); 9616 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -9267,10 +9728,18 @@ static int patch_alc883(struct hda_codec *codec)
9267 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, 9728 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9268 alc883_models, 9729 alc883_models,
9269 alc883_cfg_tbl); 9730 alc883_cfg_tbl);
9270 if (board_config < 0) { 9731 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) {
9271 printk(KERN_INFO "hda_codec: Unknown model for ALC883, " 9732 /* Pick up systems that don't supply PCI SSID */
9272 "trying auto-probe from BIOS...\n"); 9733 switch (codec->subsystem_id) {
9273 board_config = ALC883_AUTO; 9734 case 0x106b3600: /* Macbook 3.1 */
9735 board_config = ALC889A_MB31;
9736 break;
9737 default:
9738 printk(KERN_INFO
9739 "hda_codec: Unknown model for %s, trying "
9740 "auto-probe from BIOS...\n", codec->chip_name);
9741 board_config = ALC883_AUTO;
9742 }
9274 } 9743 }
9275 9744
9276 if (board_config == ALC883_AUTO) { 9745 if (board_config == ALC883_AUTO) {
@@ -9298,43 +9767,29 @@ static int patch_alc883(struct hda_codec *codec)
9298 9767
9299 switch (codec->vendor_id) { 9768 switch (codec->vendor_id) {
9300 case 0x10ec0888: 9769 case 0x10ec0888:
9301 if (codec->revision_id == 0x100101) {
9302 spec->stream_name_analog = "ALC1200 Analog";
9303 spec->stream_name_digital = "ALC1200 Digital";
9304 } else {
9305 spec->stream_name_analog = "ALC888 Analog";
9306 spec->stream_name_digital = "ALC888 Digital";
9307 }
9308 if (!spec->num_adc_nids) { 9770 if (!spec->num_adc_nids) {
9309 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 9771 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9310 spec->adc_nids = alc883_adc_nids; 9772 spec->adc_nids = alc883_adc_nids;
9311 } 9773 }
9312 if (!spec->capsrc_nids) 9774 if (!spec->capsrc_nids)
9313 spec->capsrc_nids = alc883_capsrc_nids; 9775 spec->capsrc_nids = alc883_capsrc_nids;
9314 spec->capture_style = CAPT_MIX; /* matrix-style capture */ 9776 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9315 break; 9777 break;
9316 case 0x10ec0889: 9778 case 0x10ec0889:
9317 spec->stream_name_analog = "ALC889 Analog";
9318 spec->stream_name_digital = "ALC889 Digital";
9319 if (!spec->num_adc_nids) { 9779 if (!spec->num_adc_nids) {
9320 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); 9780 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9321 spec->adc_nids = alc889_adc_nids; 9781 spec->adc_nids = alc889_adc_nids;
9322 } 9782 }
9323 if (!spec->capsrc_nids) 9783 if (!spec->capsrc_nids)
9324 spec->capsrc_nids = alc889_capsrc_nids; 9784 spec->capsrc_nids = alc889_capsrc_nids;
9325 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9326 capture */
9327 break; 9785 break;
9328 default: 9786 default:
9329 spec->stream_name_analog = "ALC883 Analog";
9330 spec->stream_name_digital = "ALC883 Digital";
9331 if (!spec->num_adc_nids) { 9787 if (!spec->num_adc_nids) {
9332 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 9788 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9333 spec->adc_nids = alc883_adc_nids; 9789 spec->adc_nids = alc883_adc_nids;
9334 } 9790 }
9335 if (!spec->capsrc_nids) 9791 if (!spec->capsrc_nids)
9336 spec->capsrc_nids = alc883_capsrc_nids; 9792 spec->capsrc_nids = alc883_capsrc_nids;
9337 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9338 break; 9793 break;
9339 } 9794 }
9340 9795
@@ -9407,24 +9862,6 @@ static struct snd_kcontrol_new alc262_base_mixer[] = {
9407 { } /* end */ 9862 { } /* end */
9408}; 9863};
9409 9864
9410static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9411 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9412 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9413 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9414 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9415 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9416 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9419 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9420 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9423 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/
9424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9425 { } /* end */
9426};
9427
9428/* update HP, line and mono-out pins according to the master switch */ 9865/* update HP, line and mono-out pins according to the master switch */
9429static void alc262_hp_master_update(struct hda_codec *codec) 9866static void alc262_hp_master_update(struct hda_codec *codec)
9430{ 9867{
@@ -9480,14 +9917,7 @@ static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9480 alc262_hp_wildwest_automute(codec); 9917 alc262_hp_wildwest_automute(codec);
9481} 9918}
9482 9919
9483static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, 9920#define alc262_hp_master_sw_get alc260_hp_master_sw_get
9484 struct snd_ctl_elem_value *ucontrol)
9485{
9486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9487 struct alc_spec *spec = codec->spec;
9488 *ucontrol->value.integer.value = spec->master_sw;
9489 return 0;
9490}
9491 9921
9492static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, 9922static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9493 struct snd_ctl_elem_value *ucontrol) 9923 struct snd_ctl_elem_value *ucontrol)
@@ -9503,14 +9933,17 @@ static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9503 return 1; 9933 return 1;
9504} 9934}
9505 9935
9936#define ALC262_HP_MASTER_SWITCH \
9937 { \
9938 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9939 .name = "Master Playback Switch", \
9940 .info = snd_ctl_boolean_mono_info, \
9941 .get = alc262_hp_master_sw_get, \
9942 .put = alc262_hp_master_sw_put, \
9943 }
9944
9506static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { 9945static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9507 { 9946 ALC262_HP_MASTER_SWITCH,
9508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9509 .name = "Master Playback Switch",
9510 .info = snd_ctl_boolean_mono_info,
9511 .get = alc262_hp_master_sw_get,
9512 .put = alc262_hp_master_sw_put,
9513 },
9514 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9947 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9515 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9948 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9516 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9949 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -9534,13 +9967,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9534}; 9967};
9535 9968
9536static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { 9969static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9537 { 9970 ALC262_HP_MASTER_SWITCH,
9538 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9539 .name = "Master Playback Switch",
9540 .info = snd_ctl_boolean_mono_info,
9541 .get = alc262_hp_master_sw_get,
9542 .put = alc262_hp_master_sw_put,
9543 },
9544 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9971 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9545 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9972 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9546 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9973 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -9567,32 +9994,13 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9567}; 9994};
9568 9995
9569/* mute/unmute internal speaker according to the hp jack and mute state */ 9996/* mute/unmute internal speaker according to the hp jack and mute state */
9570static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) 9997static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9571{ 9998{
9572 struct alc_spec *spec = codec->spec; 9999 struct alc_spec *spec = codec->spec;
9573 10000
9574 if (force || !spec->sense_updated) { 10001 spec->autocfg.hp_pins[0] = 0x15;
9575 unsigned int present; 10002 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9576 present = snd_hda_codec_read(codec, 0x15, 0, 10003 alc_automute_amp(codec);
9577 AC_VERB_GET_PIN_SENSE, 0);
9578 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9579 spec->sense_updated = 1;
9580 }
9581 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9582 spec->jack_present ? HDA_AMP_MUTE : 0);
9583}
9584
9585static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9586 unsigned int res)
9587{
9588 if ((res >> 26) != ALC880_HP_EVENT)
9589 return;
9590 alc262_hp_t5735_automute(codec, 1);
9591}
9592
9593static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9594{
9595 alc262_hp_t5735_automute(codec, 1);
9596} 10004}
9597 10005
9598static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 10006static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
@@ -9645,46 +10053,132 @@ static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9645 }, 10053 },
9646}; 10054};
9647 10055
9648/* bind hp and internal speaker mute (with plug check) */ 10056/* bind hp and internal speaker mute (with plug check) as master switch */
9649static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, 10057static void alc262_hippo_master_update(struct hda_codec *codec)
9650 struct snd_ctl_elem_value *ucontrol)
9651{ 10058{
9652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 10059 struct alc_spec *spec = codec->spec;
9653 long *valp = ucontrol->value.integer.value; 10060 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9654 int change; 10061 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10062 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10063 unsigned int mute;
9655 10064
9656 /* change hp mute */ 10065 /* HP */
9657 change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 10066 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9658 HDA_AMP_MUTE, 10067 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9659 valp[0] ? 0 : HDA_AMP_MUTE); 10068 HDA_AMP_MUTE, mute);
9660 change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 10069 /* mute internal speaker per jack sense */
9661 HDA_AMP_MUTE, 10070 if (spec->jack_present)
9662 valp[1] ? 0 : HDA_AMP_MUTE); 10071 mute = HDA_AMP_MUTE;
9663 if (change) { 10072 if (line_nid)
9664 /* change speaker according to HP jack state */ 10073 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9665 struct alc_spec *spec = codec->spec; 10074 HDA_AMP_MUTE, mute);
9666 unsigned int mute; 10075 if (speaker_nid && speaker_nid != line_nid)
9667 if (spec->jack_present) 10076 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9668 mute = HDA_AMP_MUTE;
9669 else
9670 mute = snd_hda_codec_amp_read(codec, 0x15, 0,
9671 HDA_OUTPUT, 0);
9672 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9673 HDA_AMP_MUTE, mute); 10077 HDA_AMP_MUTE, mute);
10078}
10079
10080#define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10081
10082static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10083 struct snd_ctl_elem_value *ucontrol)
10084{
10085 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10086 struct alc_spec *spec = codec->spec;
10087 int val = !!*ucontrol->value.integer.value;
10088
10089 if (val == spec->master_sw)
10090 return 0;
10091 spec->master_sw = val;
10092 alc262_hippo_master_update(codec);
10093 return 1;
10094}
10095
10096#define ALC262_HIPPO_MASTER_SWITCH \
10097 { \
10098 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10099 .name = "Master Playback Switch", \
10100 .info = snd_ctl_boolean_mono_info, \
10101 .get = alc262_hippo_master_sw_get, \
10102 .put = alc262_hippo_master_sw_put, \
9674 } 10103 }
9675 return change; 10104
10105static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10106 ALC262_HIPPO_MASTER_SWITCH,
10107 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10110 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10111 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10113 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10115 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10116 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10117 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10118 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10119 { } /* end */
10120};
10121
10122static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10123 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10124 ALC262_HIPPO_MASTER_SWITCH,
10125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10131 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10132 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10133 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10134 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10135 { } /* end */
10136};
10137
10138/* mute/unmute internal speaker according to the hp jack and mute state */
10139static void alc262_hippo_automute(struct hda_codec *codec)
10140{
10141 struct alc_spec *spec = codec->spec;
10142 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10143 unsigned int present;
10144
10145 /* need to execute and sync at first */
10146 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10147 present = snd_hda_codec_read(codec, hp_nid, 0,
10148 AC_VERB_GET_PIN_SENSE, 0);
10149 spec->jack_present = (present & 0x80000000) != 0;
10150 alc262_hippo_master_update(codec);
9676} 10151}
9677 10152
10153static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10154{
10155 if ((res >> 26) != ALC880_HP_EVENT)
10156 return;
10157 alc262_hippo_automute(codec);
10158}
10159
10160static void alc262_hippo_init_hook(struct hda_codec *codec)
10161{
10162 struct alc_spec *spec = codec->spec;
10163
10164 spec->autocfg.hp_pins[0] = 0x15;
10165 spec->autocfg.speaker_pins[0] = 0x14;
10166 alc262_hippo_automute(codec);
10167}
10168
10169static void alc262_hippo1_init_hook(struct hda_codec *codec)
10170{
10171 struct alc_spec *spec = codec->spec;
10172
10173 spec->autocfg.hp_pins[0] = 0x1b;
10174 spec->autocfg.speaker_pins[0] = 0x14;
10175 alc262_hippo_automute(codec);
10176}
10177
10178
9678static struct snd_kcontrol_new alc262_sony_mixer[] = { 10179static struct snd_kcontrol_new alc262_sony_mixer[] = {
9679 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 10180 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9680 { 10181 ALC262_HIPPO_MASTER_SWITCH,
9681 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9682 .name = "Master Playback Switch",
9683 .info = snd_hda_mixer_amp_switch_info,
9684 .get = snd_hda_mixer_amp_switch_get,
9685 .put = alc262_sony_master_sw_put,
9686 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
9687 },
9688 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 10182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9689 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 10183 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9690 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 10184 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -9693,8 +10187,8 @@ static struct snd_kcontrol_new alc262_sony_mixer[] = {
9693}; 10187};
9694 10188
9695static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { 10189static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9696 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 10190 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9697 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 10191 ALC262_HIPPO_MASTER_SWITCH,
9698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 10192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9699 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 10193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9700 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 10194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
@@ -9735,34 +10229,15 @@ static struct hda_verb alc262_tyan_verbs[] = {
9735}; 10229};
9736 10230
9737/* unsolicited event for HP jack sensing */ 10231/* unsolicited event for HP jack sensing */
9738static void alc262_tyan_automute(struct hda_codec *codec) 10232static void alc262_tyan_init_hook(struct hda_codec *codec)
9739{ 10233{
9740 unsigned int mute; 10234 struct alc_spec *spec = codec->spec;
9741 unsigned int present;
9742 10235
9743 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 10236 spec->autocfg.hp_pins[0] = 0x1b;
9744 present = snd_hda_codec_read(codec, 0x1b, 0, 10237 spec->autocfg.speaker_pins[0] = 0x15;
9745 AC_VERB_GET_PIN_SENSE, 0); 10238 alc_automute_amp(codec);
9746 present = (present & 0x80000000) != 0;
9747 if (present) {
9748 /* mute line output on ATX panel */
9749 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9750 HDA_AMP_MUTE, HDA_AMP_MUTE);
9751 } else {
9752 /* unmute line output if necessary */
9753 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
9754 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9755 HDA_AMP_MUTE, mute);
9756 }
9757} 10239}
9758 10240
9759static void alc262_tyan_unsol_event(struct hda_codec *codec,
9760 unsigned int res)
9761{
9762 if ((res >> 26) != ALC880_HP_EVENT)
9763 return;
9764 alc262_tyan_automute(codec);
9765}
9766 10241
9767#define alc262_capture_mixer alc882_capture_mixer 10242#define alc262_capture_mixer alc882_capture_mixer
9768#define alc262_capture_alt_mixer alc882_capture_alt_mixer 10243#define alc262_capture_alt_mixer alc882_capture_alt_mixer
@@ -9917,99 +10392,25 @@ static void alc262_dmic_automute(struct hda_codec *codec)
9917 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); 10392 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9918} 10393}
9919 10394
9920/* toggle speaker-output according to the hp-jack state */
9921static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec)
9922{
9923 unsigned int present;
9924 unsigned char bits;
9925
9926 present = snd_hda_codec_read(codec, 0x15, 0,
9927 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9928 bits = present ? 0 : PIN_OUT;
9929 snd_hda_codec_write(codec, 0x14, 0,
9930 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
9931}
9932
9933
9934 10395
9935/* unsolicited event for HP jack sensing */ 10396/* unsolicited event for HP jack sensing */
9936static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, 10397static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9937 unsigned int res) 10398 unsigned int res)
9938{ 10399{
9939 if ((res >> 26) == ALC880_HP_EVENT)
9940 alc262_toshiba_s06_speaker_automute(codec);
9941 if ((res >> 26) == ALC880_MIC_EVENT) 10400 if ((res >> 26) == ALC880_MIC_EVENT)
9942 alc262_dmic_automute(codec); 10401 alc262_dmic_automute(codec);
9943 10402 else
10403 alc_sku_unsol_event(codec, res);
9944} 10404}
9945 10405
9946static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) 10406static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9947{ 10407{
9948 alc262_toshiba_s06_speaker_automute(codec);
9949 alc262_dmic_automute(codec);
9950}
9951
9952/* mute/unmute internal speaker according to the hp jack and mute state */
9953static void alc262_hippo_automute(struct hda_codec *codec)
9954{
9955 struct alc_spec *spec = codec->spec; 10408 struct alc_spec *spec = codec->spec;
9956 unsigned int mute;
9957 unsigned int present;
9958
9959 /* need to execute and sync at first */
9960 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
9961 present = snd_hda_codec_read(codec, 0x15, 0,
9962 AC_VERB_GET_PIN_SENSE, 0);
9963 spec->jack_present = (present & 0x80000000) != 0;
9964 if (spec->jack_present) {
9965 /* mute internal speaker */
9966 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9967 HDA_AMP_MUTE, HDA_AMP_MUTE);
9968 } else {
9969 /* unmute internal speaker if necessary */
9970 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
9971 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9972 HDA_AMP_MUTE, mute);
9973 }
9974}
9975
9976/* unsolicited event for HP jack sensing */
9977static void alc262_hippo_unsol_event(struct hda_codec *codec,
9978 unsigned int res)
9979{
9980 if ((res >> 26) != ALC880_HP_EVENT)
9981 return;
9982 alc262_hippo_automute(codec);
9983}
9984
9985static void alc262_hippo1_automute(struct hda_codec *codec)
9986{
9987 unsigned int mute;
9988 unsigned int present;
9989
9990 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
9991 present = snd_hda_codec_read(codec, 0x1b, 0,
9992 AC_VERB_GET_PIN_SENSE, 0);
9993 present = (present & 0x80000000) != 0;
9994 if (present) {
9995 /* mute internal speaker */
9996 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9997 HDA_AMP_MUTE, HDA_AMP_MUTE);
9998 } else {
9999 /* unmute internal speaker if necessary */
10000 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10001 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10002 HDA_AMP_MUTE, mute);
10003 }
10004}
10005 10409
10006/* unsolicited event for HP jack sensing */ 10410 spec->autocfg.hp_pins[0] = 0x15;
10007static void alc262_hippo1_unsol_event(struct hda_codec *codec, 10411 spec->autocfg.speaker_pins[0] = 0x14;
10008 unsigned int res) 10412 alc_automute_pin(codec);
10009{ 10413 alc262_dmic_automute(codec);
10010 if ((res >> 26) != ALC880_HP_EVENT)
10011 return;
10012 alc262_hippo1_automute(codec);
10013} 10414}
10014 10415
10015/* 10416/*
@@ -10279,14 +10680,7 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10279 10680
10280static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { 10681static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10281 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), 10682 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10282 { 10683 ALC262_HIPPO_MASTER_SWITCH,
10283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10284 .name = "Master Playback Switch",
10285 .info = snd_hda_mixer_amp_switch_info,
10286 .get = snd_hda_mixer_amp_switch_get,
10287 .put = alc262_sony_master_sw_put,
10288 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
10289 },
10290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 10684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 10685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 10686 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
@@ -10507,9 +10901,27 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10507 return 0; 10901 return 0;
10508} 10902}
10509 10903
10510/* identical with ALC880 */ 10904static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10511#define alc262_auto_create_analog_input_ctls \ 10905 const struct auto_pin_cfg *cfg)
10512 alc880_auto_create_analog_input_ctls 10906{
10907 int err;
10908
10909 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10910 if (err < 0)
10911 return err;
10912 /* digital-mic input pin is excluded in alc880_auto_create..()
10913 * because it's under 0x18
10914 */
10915 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10916 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10917 struct hda_input_mux *imux = &spec->private_imux[0];
10918 imux->items[imux->num_items].label = "Int Mic";
10919 imux->items[imux->num_items].index = 0x09;
10920 imux->num_items++;
10921 }
10922 return 0;
10923}
10924
10513 10925
10514/* 10926/*
10515 * generic initialization of ADC, input mixers and output mixers 10927 * generic initialization of ADC, input mixers and output mixers
@@ -10633,31 +11045,46 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10633 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 11045 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 11046 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10635 11047
10636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, 11048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10637 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 11049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 11050 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10639 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, 11051 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10640 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 11052 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10641 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 11053 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10642 11054
10643 11055
10644 /* FIXME: use matrix-type input source selection */ 11056 /* FIXME: use matrix-type input source selection */
10645 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 11057 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10646 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 11058 /* Input mixer1: only unmute Mic */
10647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 11059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10648 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 11060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10649 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 11061 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10650 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 11062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11063 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11064 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11065 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11066 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10651 /* Input mixer2 */ 11068 /* Input mixer2 */
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 11069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 11070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 11071 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10655 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 11072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11076 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11077 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10656 /* Input mixer3 */ 11078 /* Input mixer3 */
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 11079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 11080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 11081 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 11082 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11083 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11084 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11085 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10661 11088
10662 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 11089 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10663 11090
@@ -10782,7 +11209,7 @@ static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10782#define alc262_loopbacks alc880_loopbacks 11209#define alc262_loopbacks alc880_loopbacks
10783#endif 11210#endif
10784 11211
10785/* pcm configuration: identiacal with ALC880 */ 11212/* pcm configuration: identical with ALC880 */
10786#define alc262_pcm_analog_playback alc880_pcm_analog_playback 11213#define alc262_pcm_analog_playback alc880_pcm_analog_playback
10787#define alc262_pcm_analog_capture alc880_pcm_analog_capture 11214#define alc262_pcm_analog_capture alc880_pcm_analog_capture
10788#define alc262_pcm_digital_playback alc880_pcm_digital_playback 11215#define alc262_pcm_digital_playback alc880_pcm_digital_playback
@@ -10837,6 +11264,8 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10837 if (err < 0) 11264 if (err < 0)
10838 return err; 11265 return err;
10839 11266
11267 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11268
10840 return 1; 11269 return 1;
10841} 11270}
10842 11271
@@ -10909,6 +11338,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
10909 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), 11338 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10910 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), 11339 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10911 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ 11340 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11341 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
10912 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", 11342 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10913 ALC262_SONY_ASSAMD), 11343 ALC262_SONY_ASSAMD),
10914 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 11344 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
@@ -10939,7 +11369,7 @@ static struct alc_config_preset alc262_presets[] = {
10939 .input_mux = &alc262_capture_source, 11369 .input_mux = &alc262_capture_source,
10940 }, 11370 },
10941 [ALC262_HIPPO] = { 11371 [ALC262_HIPPO] = {
10942 .mixers = { alc262_base_mixer }, 11372 .mixers = { alc262_hippo_mixer },
10943 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, 11373 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10944 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11374 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10945 .dac_nids = alc262_dac_nids, 11375 .dac_nids = alc262_dac_nids,
@@ -10949,7 +11379,7 @@ static struct alc_config_preset alc262_presets[] = {
10949 .channel_mode = alc262_modes, 11379 .channel_mode = alc262_modes,
10950 .input_mux = &alc262_capture_source, 11380 .input_mux = &alc262_capture_source,
10951 .unsol_event = alc262_hippo_unsol_event, 11381 .unsol_event = alc262_hippo_unsol_event,
10952 .init_hook = alc262_hippo_automute, 11382 .init_hook = alc262_hippo_init_hook,
10953 }, 11383 },
10954 [ALC262_HIPPO_1] = { 11384 [ALC262_HIPPO_1] = {
10955 .mixers = { alc262_hippo1_mixer }, 11385 .mixers = { alc262_hippo1_mixer },
@@ -10961,8 +11391,8 @@ static struct alc_config_preset alc262_presets[] = {
10961 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11391 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10962 .channel_mode = alc262_modes, 11392 .channel_mode = alc262_modes,
10963 .input_mux = &alc262_capture_source, 11393 .input_mux = &alc262_capture_source,
10964 .unsol_event = alc262_hippo1_unsol_event, 11394 .unsol_event = alc262_hippo_unsol_event,
10965 .init_hook = alc262_hippo1_automute, 11395 .init_hook = alc262_hippo1_init_hook,
10966 }, 11396 },
10967 [ALC262_FUJITSU] = { 11397 [ALC262_FUJITSU] = {
10968 .mixers = { alc262_fujitsu_mixer }, 11398 .mixers = { alc262_fujitsu_mixer },
@@ -11024,7 +11454,7 @@ static struct alc_config_preset alc262_presets[] = {
11024 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11454 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11025 .channel_mode = alc262_modes, 11455 .channel_mode = alc262_modes,
11026 .input_mux = &alc262_capture_source, 11456 .input_mux = &alc262_capture_source,
11027 .unsol_event = alc262_hp_t5735_unsol_event, 11457 .unsol_event = alc_automute_amp_unsol_event,
11028 .init_hook = alc262_hp_t5735_init_hook, 11458 .init_hook = alc262_hp_t5735_init_hook,
11029 }, 11459 },
11030 [ALC262_HP_RP5700] = { 11460 [ALC262_HP_RP5700] = {
@@ -11056,7 +11486,7 @@ static struct alc_config_preset alc262_presets[] = {
11056 .channel_mode = alc262_modes, 11486 .channel_mode = alc262_modes,
11057 .input_mux = &alc262_capture_source, 11487 .input_mux = &alc262_capture_source,
11058 .unsol_event = alc262_hippo_unsol_event, 11488 .unsol_event = alc262_hippo_unsol_event,
11059 .init_hook = alc262_hippo_automute, 11489 .init_hook = alc262_hippo_init_hook,
11060 }, 11490 },
11061 [ALC262_BENQ_T31] = { 11491 [ALC262_BENQ_T31] = {
11062 .mixers = { alc262_benq_t31_mixer }, 11492 .mixers = { alc262_benq_t31_mixer },
@@ -11068,7 +11498,7 @@ static struct alc_config_preset alc262_presets[] = {
11068 .channel_mode = alc262_modes, 11498 .channel_mode = alc262_modes,
11069 .input_mux = &alc262_capture_source, 11499 .input_mux = &alc262_capture_source,
11070 .unsol_event = alc262_hippo_unsol_event, 11500 .unsol_event = alc262_hippo_unsol_event,
11071 .init_hook = alc262_hippo_automute, 11501 .init_hook = alc262_hippo_init_hook,
11072 }, 11502 },
11073 [ALC262_ULTRA] = { 11503 [ALC262_ULTRA] = {
11074 .mixers = { alc262_ultra_mixer }, 11504 .mixers = { alc262_ultra_mixer },
@@ -11116,6 +11546,7 @@ static struct alc_config_preset alc262_presets[] = {
11116 .capsrc_nids = alc262_dmic_capsrc_nids, 11546 .capsrc_nids = alc262_dmic_capsrc_nids,
11117 .dac_nids = alc262_dac_nids, 11547 .dac_nids = alc262_dac_nids,
11118 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ 11548 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11549 .num_adc_nids = 1, /* single ADC */
11119 .dig_out_nid = ALC262_DIGOUT_NID, 11550 .dig_out_nid = ALC262_DIGOUT_NID,
11120 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11551 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11121 .channel_mode = alc262_modes, 11552 .channel_mode = alc262_modes,
@@ -11133,7 +11564,7 @@ static struct alc_config_preset alc262_presets[] = {
11133 .channel_mode = alc262_modes, 11564 .channel_mode = alc262_modes,
11134 .input_mux = &alc262_capture_source, 11565 .input_mux = &alc262_capture_source,
11135 .unsol_event = alc262_hippo_unsol_event, 11566 .unsol_event = alc262_hippo_unsol_event,
11136 .init_hook = alc262_hippo_automute, 11567 .init_hook = alc262_hippo_init_hook,
11137 }, 11568 },
11138 [ALC262_TYAN] = { 11569 [ALC262_TYAN] = {
11139 .mixers = { alc262_tyan_mixer }, 11570 .mixers = { alc262_tyan_mixer },
@@ -11145,8 +11576,8 @@ static struct alc_config_preset alc262_presets[] = {
11145 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11576 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11146 .channel_mode = alc262_modes, 11577 .channel_mode = alc262_modes,
11147 .input_mux = &alc262_capture_source, 11578 .input_mux = &alc262_capture_source,
11148 .unsol_event = alc262_tyan_unsol_event, 11579 .unsol_event = alc_automute_amp_unsol_event,
11149 .init_hook = alc262_tyan_automute, 11580 .init_hook = alc262_tyan_init_hook,
11150 }, 11581 },
11151}; 11582};
11152 11583
@@ -11181,8 +11612,8 @@ static int patch_alc262(struct hda_codec *codec)
11181 alc262_cfg_tbl); 11612 alc262_cfg_tbl);
11182 11613
11183 if (board_config < 0) { 11614 if (board_config < 0) {
11184 printk(KERN_INFO "hda_codec: Unknown model for ALC262, " 11615 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11185 "trying auto-probe from BIOS...\n"); 11616 "trying auto-probe from BIOS...\n", codec->chip_name);
11186 board_config = ALC262_AUTO; 11617 board_config = ALC262_AUTO;
11187 } 11618 }
11188 11619
@@ -11211,29 +11642,42 @@ static int patch_alc262(struct hda_codec *codec)
11211 if (board_config != ALC262_AUTO) 11642 if (board_config != ALC262_AUTO)
11212 setup_preset(spec, &alc262_presets[board_config]); 11643 setup_preset(spec, &alc262_presets[board_config]);
11213 11644
11214 spec->stream_name_analog = "ALC262 Analog";
11215 spec->stream_analog_playback = &alc262_pcm_analog_playback; 11645 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11216 spec->stream_analog_capture = &alc262_pcm_analog_capture; 11646 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11217 11647
11218 spec->stream_name_digital = "ALC262 Digital";
11219 spec->stream_digital_playback = &alc262_pcm_digital_playback; 11648 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11220 spec->stream_digital_capture = &alc262_pcm_digital_capture; 11649 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11221 11650
11222 spec->capture_style = CAPT_MIX;
11223 if (!spec->adc_nids && spec->input_mux) { 11651 if (!spec->adc_nids && spec->input_mux) {
11224 /* check whether NID 0x07 is valid */ 11652 int i;
11225 unsigned int wcap = get_wcaps(codec, 0x07); 11653 /* check whether the digital-mic has to be supported */
11226 11654 for (i = 0; i < spec->input_mux->num_items; i++) {
11227 /* get type */ 11655 if (spec->input_mux->items[i].index >= 9)
11228 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 11656 break;
11229 if (wcap != AC_WID_AUD_IN) { 11657 }
11230 spec->adc_nids = alc262_adc_nids_alt; 11658 if (i < spec->input_mux->num_items) {
11231 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 11659 /* use only ADC0 */
11232 spec->capsrc_nids = alc262_capsrc_nids_alt; 11660 spec->adc_nids = alc262_dmic_adc_nids;
11661 spec->num_adc_nids = 1;
11662 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11233 } else { 11663 } else {
11234 spec->adc_nids = alc262_adc_nids; 11664 /* all analog inputs */
11235 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 11665 /* check whether NID 0x07 is valid */
11236 spec->capsrc_nids = alc262_capsrc_nids; 11666 unsigned int wcap = get_wcaps(codec, 0x07);
11667
11668 /* get type */
11669 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11670 if (wcap != AC_WID_AUD_IN) {
11671 spec->adc_nids = alc262_adc_nids_alt;
11672 spec->num_adc_nids =
11673 ARRAY_SIZE(alc262_adc_nids_alt);
11674 spec->capsrc_nids = alc262_capsrc_nids_alt;
11675 } else {
11676 spec->adc_nids = alc262_adc_nids;
11677 spec->num_adc_nids =
11678 ARRAY_SIZE(alc262_adc_nids);
11679 spec->capsrc_nids = alc262_capsrc_nids;
11680 }
11237 } 11681 }
11238 } 11682 }
11239 if (!spec->cap_mixer && !spec->no_analog) 11683 if (!spec->cap_mixer && !spec->no_analog)
@@ -11290,6 +11734,17 @@ static struct snd_kcontrol_new alc268_base_mixer[] = {
11290 { } 11734 { }
11291}; 11735};
11292 11736
11737static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11738 /* output mixer control */
11739 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11740 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11741 ALC262_HIPPO_MASTER_SWITCH,
11742 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11743 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11744 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11745 { }
11746};
11747
11293/* bind Beep switches of both NID 0x0f and 0x10 */ 11748/* bind Beep switches of both NID 0x0f and 0x10 */
11294static struct hda_bind_ctls alc268_bind_beep_sw = { 11749static struct hda_bind_ctls alc268_bind_beep_sw = {
11295 .ops = &snd_hda_bind_sw, 11750 .ops = &snd_hda_bind_sw,
@@ -11313,8 +11768,6 @@ static struct hda_verb alc268_eapd_verbs[] = {
11313}; 11768};
11314 11769
11315/* Toshiba specific */ 11770/* Toshiba specific */
11316#define alc268_toshiba_automute alc262_hippo_automute
11317
11318static struct hda_verb alc268_toshiba_verbs[] = { 11771static struct hda_verb alc268_toshiba_verbs[] = {
11319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 11772 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11320 { } /* end */ 11773 { } /* end */
@@ -11450,13 +11903,8 @@ static struct hda_verb alc268_acer_verbs[] = {
11450}; 11903};
11451 11904
11452/* unsolicited event for HP jack sensing */ 11905/* unsolicited event for HP jack sensing */
11453static void alc268_toshiba_unsol_event(struct hda_codec *codec, 11906#define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11454 unsigned int res) 11907#define alc268_toshiba_init_hook alc262_hippo_init_hook
11455{
11456 if ((res >> 26) != ALC880_HP_EVENT)
11457 return;
11458 alc268_toshiba_automute(codec);
11459}
11460 11908
11461static void alc268_acer_unsol_event(struct hda_codec *codec, 11909static void alc268_acer_unsol_event(struct hda_codec *codec,
11462 unsigned int res) 11910 unsigned int res)
@@ -11531,30 +11979,15 @@ static struct hda_verb alc268_dell_verbs[] = {
11531}; 11979};
11532 11980
11533/* mute/unmute internal speaker according to the hp jack and mute state */ 11981/* mute/unmute internal speaker according to the hp jack and mute state */
11534static void alc268_dell_automute(struct hda_codec *codec) 11982static void alc268_dell_init_hook(struct hda_codec *codec)
11535{ 11983{
11536 unsigned int present; 11984 struct alc_spec *spec = codec->spec;
11537 unsigned int mute;
11538
11539 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0);
11540 if (present & 0x80000000)
11541 mute = HDA_AMP_MUTE;
11542 else
11543 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
11544 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11545 HDA_AMP_MUTE, mute);
11546}
11547 11985
11548static void alc268_dell_unsol_event(struct hda_codec *codec, 11986 spec->autocfg.hp_pins[0] = 0x15;
11549 unsigned int res) 11987 spec->autocfg.speaker_pins[0] = 0x14;
11550{ 11988 alc_automute_pin(codec);
11551 if ((res >> 26) != ALC880_HP_EVENT)
11552 return;
11553 alc268_dell_automute(codec);
11554} 11989}
11555 11990
11556#define alc268_dell_init_hook alc268_dell_automute
11557
11558static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { 11991static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11559 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), 11992 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11560 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 11993 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
@@ -11573,16 +12006,6 @@ static struct hda_verb alc267_quanta_il1_verbs[] = {
11573 { } 12006 { }
11574}; 12007};
11575 12008
11576static void alc267_quanta_il1_hp_automute(struct hda_codec *codec)
11577{
11578 unsigned int present;
11579
11580 present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0)
11581 & AC_PINSENSE_PRESENCE;
11582 snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
11583 present ? 0 : PIN_OUT);
11584}
11585
11586static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) 12009static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11587{ 12010{
11588 unsigned int present; 12011 unsigned int present;
@@ -11594,9 +12017,13 @@ static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11594 present ? 0x00 : 0x01); 12017 present ? 0x00 : 0x01);
11595} 12018}
11596 12019
11597static void alc267_quanta_il1_automute(struct hda_codec *codec) 12020static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11598{ 12021{
11599 alc267_quanta_il1_hp_automute(codec); 12022 struct alc_spec *spec = codec->spec;
12023
12024 spec->autocfg.hp_pins[0] = 0x15;
12025 spec->autocfg.speaker_pins[0] = 0x14;
12026 alc_automute_pin(codec);
11600 alc267_quanta_il1_mic_automute(codec); 12027 alc267_quanta_il1_mic_automute(codec);
11601} 12028}
11602 12029
@@ -11604,12 +12031,12 @@ static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11604 unsigned int res) 12031 unsigned int res)
11605{ 12032{
11606 switch (res >> 26) { 12033 switch (res >> 26) {
11607 case ALC880_HP_EVENT:
11608 alc267_quanta_il1_hp_automute(codec);
11609 break;
11610 case ALC880_MIC_EVENT: 12034 case ALC880_MIC_EVENT:
11611 alc267_quanta_il1_mic_automute(codec); 12035 alc267_quanta_il1_mic_automute(codec);
11612 break; 12036 break;
12037 default:
12038 alc_sku_unsol_event(codec, res);
12039 break;
11613 } 12040 }
11614} 12041}
11615 12042
@@ -11954,7 +12381,7 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11954 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); 12381 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11955} 12382}
11956 12383
11957/* pcm configuration: identiacal with ALC880 */ 12384/* pcm configuration: identical with ALC880 */
11958#define alc268_pcm_analog_playback alc880_pcm_analog_playback 12385#define alc268_pcm_analog_playback alc880_pcm_analog_playback
11959#define alc268_pcm_analog_capture alc880_pcm_analog_capture 12386#define alc268_pcm_analog_capture alc880_pcm_analog_capture
11960#define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture 12387#define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
@@ -12057,16 +12484,16 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
12057 ALC268_ACER_ASPIRE_ONE), 12484 ALC268_ACER_ASPIRE_ONE),
12058 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 12485 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12059 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), 12486 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12060 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 12487 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12061 SND_PCI_QUIRK(0x103c, 0x30f1, "HP TX25xx series", ALC268_TOSHIBA), 12488 ALC268_TOSHIBA),
12062 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), 12489 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12063 SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), 12490 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12064 SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), 12491 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12065 SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), 12492 ALC268_TOSHIBA),
12066 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), 12493 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12067 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), 12494 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12068 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), 12495 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12069 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), 12496 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12070 {} 12497 {}
12071}; 12498};
12072 12499
@@ -12084,7 +12511,7 @@ static struct alc_config_preset alc268_presets[] = {
12084 .channel_mode = alc268_modes, 12511 .channel_mode = alc268_modes,
12085 .input_mux = &alc268_capture_source, 12512 .input_mux = &alc268_capture_source,
12086 .unsol_event = alc267_quanta_il1_unsol_event, 12513 .unsol_event = alc267_quanta_il1_unsol_event,
12087 .init_hook = alc267_quanta_il1_automute, 12514 .init_hook = alc267_quanta_il1_init_hook,
12088 }, 12515 },
12089 [ALC268_3ST] = { 12516 [ALC268_3ST] = {
12090 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 12517 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
@@ -12102,7 +12529,7 @@ static struct alc_config_preset alc268_presets[] = {
12102 .input_mux = &alc268_capture_source, 12529 .input_mux = &alc268_capture_source,
12103 }, 12530 },
12104 [ALC268_TOSHIBA] = { 12531 [ALC268_TOSHIBA] = {
12105 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, 12532 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12106 alc268_beep_mixer }, 12533 alc268_beep_mixer },
12107 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 12534 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12108 alc268_toshiba_verbs }, 12535 alc268_toshiba_verbs },
@@ -12116,7 +12543,7 @@ static struct alc_config_preset alc268_presets[] = {
12116 .channel_mode = alc268_modes, 12543 .channel_mode = alc268_modes,
12117 .input_mux = &alc268_capture_source, 12544 .input_mux = &alc268_capture_source,
12118 .unsol_event = alc268_toshiba_unsol_event, 12545 .unsol_event = alc268_toshiba_unsol_event,
12119 .init_hook = alc268_toshiba_automute, 12546 .init_hook = alc268_toshiba_init_hook,
12120 }, 12547 },
12121 [ALC268_ACER] = { 12548 [ALC268_ACER] = {
12122 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, 12549 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
@@ -12179,7 +12606,7 @@ static struct alc_config_preset alc268_presets[] = {
12179 .hp_nid = 0x02, 12606 .hp_nid = 0x02,
12180 .num_channel_mode = ARRAY_SIZE(alc268_modes), 12607 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12181 .channel_mode = alc268_modes, 12608 .channel_mode = alc268_modes,
12182 .unsol_event = alc268_dell_unsol_event, 12609 .unsol_event = alc_sku_unsol_event,
12183 .init_hook = alc268_dell_init_hook, 12610 .init_hook = alc268_dell_init_hook,
12184 .input_mux = &alc268_capture_source, 12611 .input_mux = &alc268_capture_source,
12185 }, 12612 },
@@ -12199,7 +12626,7 @@ static struct alc_config_preset alc268_presets[] = {
12199 .channel_mode = alc268_modes, 12626 .channel_mode = alc268_modes,
12200 .input_mux = &alc268_capture_source, 12627 .input_mux = &alc268_capture_source,
12201 .unsol_event = alc268_toshiba_unsol_event, 12628 .unsol_event = alc268_toshiba_unsol_event,
12202 .init_hook = alc268_toshiba_automute 12629 .init_hook = alc268_toshiba_init_hook
12203 }, 12630 },
12204#ifdef CONFIG_SND_DEBUG 12631#ifdef CONFIG_SND_DEBUG
12205 [ALC268_TEST] = { 12632 [ALC268_TEST] = {
@@ -12237,8 +12664,8 @@ static int patch_alc268(struct hda_codec *codec)
12237 alc268_cfg_tbl); 12664 alc268_cfg_tbl);
12238 12665
12239 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { 12666 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12240 printk(KERN_INFO "hda_codec: Unknown model for ALC268, " 12667 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12241 "trying auto-probe from BIOS...\n"); 12668 "trying auto-probe from BIOS...\n", codec->chip_name);
12242 board_config = ALC268_AUTO; 12669 board_config = ALC268_AUTO;
12243 } 12670 }
12244 12671
@@ -12259,14 +12686,6 @@ static int patch_alc268(struct hda_codec *codec)
12259 if (board_config != ALC268_AUTO) 12686 if (board_config != ALC268_AUTO)
12260 setup_preset(spec, &alc268_presets[board_config]); 12687 setup_preset(spec, &alc268_presets[board_config]);
12261 12688
12262 if (codec->vendor_id == 0x10ec0267) {
12263 spec->stream_name_analog = "ALC267 Analog";
12264 spec->stream_name_digital = "ALC267 Digital";
12265 } else {
12266 spec->stream_name_analog = "ALC268 Analog";
12267 spec->stream_name_digital = "ALC268 Digital";
12268 }
12269
12270 spec->stream_analog_playback = &alc268_pcm_analog_playback; 12689 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12271 spec->stream_analog_capture = &alc268_pcm_analog_capture; 12690 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12272 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; 12691 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
@@ -12848,32 +13267,14 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12848 return 0; 13267 return 0;
12849} 13268}
12850 13269
12851static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, 13270#define alc269_auto_create_analog_input_ctls \
12852 const struct auto_pin_cfg *cfg) 13271 alc262_auto_create_analog_input_ctls
12853{
12854 int err;
12855
12856 err = alc880_auto_create_analog_input_ctls(spec, cfg);
12857 if (err < 0)
12858 return err;
12859 /* digital-mic input pin is excluded in alc880_auto_create..()
12860 * because it's under 0x18
12861 */
12862 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12863 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12864 struct hda_input_mux *imux = &spec->private_imux[0];
12865 imux->items[imux->num_items].label = "Int Mic";
12866 imux->items[imux->num_items].index = 0x05;
12867 imux->num_items++;
12868 }
12869 return 0;
12870}
12871 13272
12872#ifdef CONFIG_SND_HDA_POWER_SAVE 13273#ifdef CONFIG_SND_HDA_POWER_SAVE
12873#define alc269_loopbacks alc880_loopbacks 13274#define alc269_loopbacks alc880_loopbacks
12874#endif 13275#endif
12875 13276
12876/* pcm configuration: identiacal with ALC880 */ 13277/* pcm configuration: identical with ALC880 */
12877#define alc269_pcm_analog_playback alc880_pcm_analog_playback 13278#define alc269_pcm_analog_playback alc880_pcm_analog_playback
12878#define alc269_pcm_analog_capture alc880_pcm_analog_capture 13279#define alc269_pcm_analog_capture alc880_pcm_analog_capture
12879#define alc269_pcm_digital_playback alc880_pcm_digital_playback 13280#define alc269_pcm_digital_playback alc880_pcm_digital_playback
@@ -13093,8 +13494,8 @@ static int patch_alc269(struct hda_codec *codec)
13093 alc269_cfg_tbl); 13494 alc269_cfg_tbl);
13094 13495
13095 if (board_config < 0) { 13496 if (board_config < 0) {
13096 printk(KERN_INFO "hda_codec: Unknown model for ALC269, " 13497 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13097 "trying auto-probe from BIOS...\n"); 13498 "trying auto-probe from BIOS...\n", codec->chip_name);
13098 board_config = ALC269_AUTO; 13499 board_config = ALC269_AUTO;
13099 } 13500 }
13100 13501
@@ -13121,7 +13522,6 @@ static int patch_alc269(struct hda_codec *codec)
13121 if (board_config != ALC269_AUTO) 13522 if (board_config != ALC269_AUTO)
13122 setup_preset(spec, &alc269_presets[board_config]); 13523 setup_preset(spec, &alc269_presets[board_config]);
13123 13524
13124 spec->stream_name_analog = "ALC269 Analog";
13125 if (codec->subsystem_id == 0x17aa3bf8) { 13525 if (codec->subsystem_id == 0x17aa3bf8) {
13126 /* Due to a hardware problem on Lenovo Ideadpad, we need to 13526 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13127 * fix the sample rate of analog I/O to 44.1kHz 13527 * fix the sample rate of analog I/O to 44.1kHz
@@ -13132,7 +13532,6 @@ static int patch_alc269(struct hda_codec *codec)
13132 spec->stream_analog_playback = &alc269_pcm_analog_playback; 13532 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13133 spec->stream_analog_capture = &alc269_pcm_analog_capture; 13533 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13134 } 13534 }
13135 spec->stream_name_digital = "ALC269 Digital";
13136 spec->stream_digital_playback = &alc269_pcm_digital_playback; 13535 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13137 spec->stream_digital_capture = &alc269_pcm_digital_capture; 13536 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13138 13537
@@ -13737,7 +14136,7 @@ static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13737 alc861_toshiba_automute(codec); 14136 alc861_toshiba_automute(codec);
13738} 14137}
13739 14138
13740/* pcm configuration: identiacal with ALC880 */ 14139/* pcm configuration: identical with ALC880 */
13741#define alc861_pcm_analog_playback alc880_pcm_analog_playback 14140#define alc861_pcm_analog_playback alc880_pcm_analog_playback
13742#define alc861_pcm_analog_capture alc880_pcm_analog_capture 14141#define alc861_pcm_analog_capture alc880_pcm_analog_capture
13743#define alc861_pcm_digital_playback alc880_pcm_digital_playback 14142#define alc861_pcm_digital_playback alc880_pcm_digital_playback
@@ -13921,7 +14320,6 @@ static void alc861_auto_init_multi_out(struct hda_codec *codec)
13921 struct alc_spec *spec = codec->spec; 14320 struct alc_spec *spec = codec->spec;
13922 int i; 14321 int i;
13923 14322
13924 alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b);
13925 for (i = 0; i < spec->autocfg.line_outs; i++) { 14323 for (i = 0; i < spec->autocfg.line_outs; i++) {
13926 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 14324 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13927 int pin_type = get_pin_type(spec->autocfg.line_out_type); 14325 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -14004,6 +14402,8 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
14004 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 14402 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14005 set_capture_mixer(spec); 14403 set_capture_mixer(spec);
14006 14404
14405 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14406
14007 return 1; 14407 return 1;
14008} 14408}
14009 14409
@@ -14193,8 +14593,8 @@ static int patch_alc861(struct hda_codec *codec)
14193 alc861_cfg_tbl); 14593 alc861_cfg_tbl);
14194 14594
14195 if (board_config < 0) { 14595 if (board_config < 0) {
14196 printk(KERN_INFO "hda_codec: Unknown model for ALC861, " 14596 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14197 "trying auto-probe from BIOS...\n"); 14597 "trying auto-probe from BIOS...\n", codec->chip_name);
14198 board_config = ALC861_AUTO; 14598 board_config = ALC861_AUTO;
14199 } 14599 }
14200 14600
@@ -14221,11 +14621,9 @@ static int patch_alc861(struct hda_codec *codec)
14221 if (board_config != ALC861_AUTO) 14621 if (board_config != ALC861_AUTO)
14222 setup_preset(spec, &alc861_presets[board_config]); 14622 setup_preset(spec, &alc861_presets[board_config]);
14223 14623
14224 spec->stream_name_analog = "ALC861 Analog";
14225 spec->stream_analog_playback = &alc861_pcm_analog_playback; 14624 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14226 spec->stream_analog_capture = &alc861_pcm_analog_capture; 14625 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14227 14626
14228 spec->stream_name_digital = "ALC861 Digital";
14229 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14627 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14230 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14628 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14231 14629
@@ -14261,7 +14659,7 @@ static hda_nid_t alc861vd_dac_nids[4] = {
14261 14659
14262/* dac_nids for ALC660vd are in a different order - according to 14660/* dac_nids for ALC660vd are in a different order - according to
14263 * Realtek's driver. 14661 * Realtek's driver.
14264 * This should probably tesult in a different mixer for 6stack models 14662 * This should probably result in a different mixer for 6stack models
14265 * of ALC660vd codecs, but for now there is only 3stack mixer 14663 * of ALC660vd codecs, but for now there is only 3stack mixer
14266 * - and it is the same as in 861vd. 14664 * - and it is the same as in 861vd.
14267 * adc_nids in ALC660vd are (is) the same as in 861vd 14665 * adc_nids in ALC660vd are (is) the same as in 861vd
@@ -14612,19 +15010,6 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14612 {} 15010 {}
14613}; 15011};
14614 15012
14615/* toggle speaker-output according to the hp-jack state */
14616static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
14617{
14618 unsigned int present;
14619 unsigned char bits;
14620
14621 present = snd_hda_codec_read(codec, 0x1b, 0,
14622 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14623 bits = present ? HDA_AMP_MUTE : 0;
14624 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
14625 HDA_AMP_MUTE, bits);
14626}
14627
14628static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) 15013static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14629{ 15014{
14630 unsigned int present; 15015 unsigned int present;
@@ -14637,9 +15022,13 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14637 HDA_AMP_MUTE, bits); 15022 HDA_AMP_MUTE, bits);
14638} 15023}
14639 15024
14640static void alc861vd_lenovo_automute(struct hda_codec *codec) 15025static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14641{ 15026{
14642 alc861vd_lenovo_hp_automute(codec); 15027 struct alc_spec *spec = codec->spec;
15028
15029 spec->autocfg.hp_pins[0] = 0x1b;
15030 spec->autocfg.speaker_pins[0] = 0x14;
15031 alc_automute_amp(codec);
14643 alc861vd_lenovo_mic_automute(codec); 15032 alc861vd_lenovo_mic_automute(codec);
14644} 15033}
14645 15034
@@ -14647,12 +15036,12 @@ static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14647 unsigned int res) 15036 unsigned int res)
14648{ 15037{
14649 switch (res >> 26) { 15038 switch (res >> 26) {
14650 case ALC880_HP_EVENT:
14651 alc861vd_lenovo_hp_automute(codec);
14652 break;
14653 case ALC880_MIC_EVENT: 15039 case ALC880_MIC_EVENT:
14654 alc861vd_lenovo_mic_automute(codec); 15040 alc861vd_lenovo_mic_automute(codec);
14655 break; 15041 break;
15042 default:
15043 alc_automute_amp_unsol_event(codec, res);
15044 break;
14656 } 15045 }
14657} 15046}
14658 15047
@@ -14702,27 +15091,20 @@ static struct hda_verb alc861vd_dallas_verbs[] = {
14702}; 15091};
14703 15092
14704/* toggle speaker-output according to the hp-jack state */ 15093/* toggle speaker-output according to the hp-jack state */
14705static void alc861vd_dallas_automute(struct hda_codec *codec) 15094static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14706{ 15095{
14707 unsigned int present; 15096 struct alc_spec *spec = codec->spec;
14708 15097
14709 present = snd_hda_codec_read(codec, 0x15, 0, 15098 spec->autocfg.hp_pins[0] = 0x15;
14710 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 15099 spec->autocfg.speaker_pins[0] = 0x14;
14711 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 15100 alc_automute_amp(codec);
14712 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14713}
14714
14715static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
14716{
14717 if ((res >> 26) == ALC880_HP_EVENT)
14718 alc861vd_dallas_automute(codec);
14719} 15101}
14720 15102
14721#ifdef CONFIG_SND_HDA_POWER_SAVE 15103#ifdef CONFIG_SND_HDA_POWER_SAVE
14722#define alc861vd_loopbacks alc880_loopbacks 15104#define alc861vd_loopbacks alc880_loopbacks
14723#endif 15105#endif
14724 15106
14725/* pcm configuration: identiacal with ALC880 */ 15107/* pcm configuration: identical with ALC880 */
14726#define alc861vd_pcm_analog_playback alc880_pcm_analog_playback 15108#define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14727#define alc861vd_pcm_analog_capture alc880_pcm_analog_capture 15109#define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14728#define alc861vd_pcm_digital_playback alc880_pcm_digital_playback 15110#define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
@@ -14829,7 +15211,7 @@ static struct alc_config_preset alc861vd_presets[] = {
14829 .channel_mode = alc861vd_3stack_2ch_modes, 15211 .channel_mode = alc861vd_3stack_2ch_modes,
14830 .input_mux = &alc861vd_capture_source, 15212 .input_mux = &alc861vd_capture_source,
14831 .unsol_event = alc861vd_lenovo_unsol_event, 15213 .unsol_event = alc861vd_lenovo_unsol_event,
14832 .init_hook = alc861vd_lenovo_automute, 15214 .init_hook = alc861vd_lenovo_init_hook,
14833 }, 15215 },
14834 [ALC861VD_DALLAS] = { 15216 [ALC861VD_DALLAS] = {
14835 .mixers = { alc861vd_dallas_mixer }, 15217 .mixers = { alc861vd_dallas_mixer },
@@ -14839,8 +15221,8 @@ static struct alc_config_preset alc861vd_presets[] = {
14839 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 15221 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14840 .channel_mode = alc861vd_3stack_2ch_modes, 15222 .channel_mode = alc861vd_3stack_2ch_modes,
14841 .input_mux = &alc861vd_dallas_capture_source, 15223 .input_mux = &alc861vd_dallas_capture_source,
14842 .unsol_event = alc861vd_dallas_unsol_event, 15224 .unsol_event = alc_automute_amp_unsol_event,
14843 .init_hook = alc861vd_dallas_automute, 15225 .init_hook = alc861vd_dallas_init_hook,
14844 }, 15226 },
14845 [ALC861VD_HP] = { 15227 [ALC861VD_HP] = {
14846 .mixers = { alc861vd_hp_mixer }, 15228 .mixers = { alc861vd_hp_mixer },
@@ -14851,8 +15233,8 @@ static struct alc_config_preset alc861vd_presets[] = {
14851 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), 15233 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14852 .channel_mode = alc861vd_3stack_2ch_modes, 15234 .channel_mode = alc861vd_3stack_2ch_modes,
14853 .input_mux = &alc861vd_hp_capture_source, 15235 .input_mux = &alc861vd_hp_capture_source,
14854 .unsol_event = alc861vd_dallas_unsol_event, 15236 .unsol_event = alc_automute_amp_unsol_event,
14855 .init_hook = alc861vd_dallas_automute, 15237 .init_hook = alc861vd_dallas_init_hook,
14856 }, 15238 },
14857 [ALC660VD_ASUS_V1S] = { 15239 [ALC660VD_ASUS_V1S] = {
14858 .mixers = { alc861vd_lenovo_mixer }, 15240 .mixers = { alc861vd_lenovo_mixer },
@@ -14867,7 +15249,7 @@ static struct alc_config_preset alc861vd_presets[] = {
14867 .channel_mode = alc861vd_3stack_2ch_modes, 15249 .channel_mode = alc861vd_3stack_2ch_modes,
14868 .input_mux = &alc861vd_capture_source, 15250 .input_mux = &alc861vd_capture_source,
14869 .unsol_event = alc861vd_lenovo_unsol_event, 15251 .unsol_event = alc861vd_lenovo_unsol_event,
14870 .init_hook = alc861vd_lenovo_automute, 15252 .init_hook = alc861vd_lenovo_init_hook,
14871 }, 15253 },
14872}; 15254};
14873 15255
@@ -14885,7 +15267,6 @@ static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14885 struct alc_spec *spec = codec->spec; 15267 struct alc_spec *spec = codec->spec;
14886 int i; 15268 int i;
14887 15269
14888 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
14889 for (i = 0; i <= HDA_SIDE; i++) { 15270 for (i = 0; i <= HDA_SIDE; i++) {
14890 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 15271 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14891 int pin_type = get_pin_type(spec->autocfg.line_out_type); 15272 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -14902,7 +15283,7 @@ static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14902 hda_nid_t pin; 15283 hda_nid_t pin;
14903 15284
14904 pin = spec->autocfg.hp_pins[0]; 15285 pin = spec->autocfg.hp_pins[0];
14905 if (pin) /* connect to front and use dac 0 */ 15286 if (pin) /* connect to front and use dac 0 */
14906 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 15287 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14907 pin = spec->autocfg.speaker_pins[0]; 15288 pin = spec->autocfg.speaker_pins[0];
14908 if (pin) 15289 if (pin)
@@ -15103,6 +15484,8 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
15103 if (err < 0) 15484 if (err < 0)
15104 return err; 15485 return err;
15105 15486
15487 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15488
15106 return 1; 15489 return 1;
15107} 15490}
15108 15491
@@ -15134,8 +15517,8 @@ static int patch_alc861vd(struct hda_codec *codec)
15134 alc861vd_cfg_tbl); 15517 alc861vd_cfg_tbl);
15135 15518
15136 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { 15519 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15137 printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" 15520 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15138 "ALC861VD, trying auto-probe from BIOS...\n"); 15521 "trying auto-probe from BIOS...\n", codec->chip_name);
15139 board_config = ALC861VD_AUTO; 15522 board_config = ALC861VD_AUTO;
15140 } 15523 }
15141 15524
@@ -15163,13 +15546,8 @@ static int patch_alc861vd(struct hda_codec *codec)
15163 setup_preset(spec, &alc861vd_presets[board_config]); 15546 setup_preset(spec, &alc861vd_presets[board_config]);
15164 15547
15165 if (codec->vendor_id == 0x10ec0660) { 15548 if (codec->vendor_id == 0x10ec0660) {
15166 spec->stream_name_analog = "ALC660-VD Analog";
15167 spec->stream_name_digital = "ALC660-VD Digital";
15168 /* always turn on EAPD */ 15549 /* always turn on EAPD */
15169 add_verb(spec, alc660vd_eapd_verbs); 15550 add_verb(spec, alc660vd_eapd_verbs);
15170 } else {
15171 spec->stream_name_analog = "ALC861VD Analog";
15172 spec->stream_name_digital = "ALC861VD Digital";
15173 } 15551 }
15174 15552
15175 spec->stream_analog_playback = &alc861vd_pcm_analog_playback; 15553 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
@@ -15181,7 +15559,6 @@ static int patch_alc861vd(struct hda_codec *codec)
15181 spec->adc_nids = alc861vd_adc_nids; 15559 spec->adc_nids = alc861vd_adc_nids;
15182 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 15560 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15183 spec->capsrc_nids = alc861vd_capsrc_nids; 15561 spec->capsrc_nids = alc861vd_capsrc_nids;
15184 spec->capture_style = CAPT_MIX;
15185 15562
15186 set_capture_mixer(spec); 15563 set_capture_mixer(spec);
15187 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 15564 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
@@ -15283,6 +15660,38 @@ static struct hda_input_mux alc663_m51va_capture_source = {
15283 }, 15660 },
15284}; 15661};
15285 15662
15663#if 1 /* set to 0 for testing other input sources below */
15664static struct hda_input_mux alc272_nc10_capture_source = {
15665 .num_items = 2,
15666 .items = {
15667 { "Autoselect Mic", 0x0 },
15668 { "Internal Mic", 0x1 },
15669 },
15670};
15671#else
15672static struct hda_input_mux alc272_nc10_capture_source = {
15673 .num_items = 16,
15674 .items = {
15675 { "Autoselect Mic", 0x0 },
15676 { "Internal Mic", 0x1 },
15677 { "In-0x02", 0x2 },
15678 { "In-0x03", 0x3 },
15679 { "In-0x04", 0x4 },
15680 { "In-0x05", 0x5 },
15681 { "In-0x06", 0x6 },
15682 { "In-0x07", 0x7 },
15683 { "In-0x08", 0x8 },
15684 { "In-0x09", 0x9 },
15685 { "In-0x0a", 0x0a },
15686 { "In-0x0b", 0x0b },
15687 { "In-0x0c", 0x0c },
15688 { "In-0x0d", 0x0d },
15689 { "In-0x0e", 0x0e },
15690 { "In-0x0f", 0x0f },
15691 },
15692};
15693#endif
15694
15286/* 15695/*
15287 * 2ch mode 15696 * 2ch mode
15288 */ 15697 */
@@ -15422,10 +15831,8 @@ static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15422}; 15831};
15423 15832
15424static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { 15833static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15425 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 15834 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15426 15835 ALC262_HIPPO_MASTER_SWITCH,
15427 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15428 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15429 15836
15430 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), 15837 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15431 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 15838 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -15438,15 +15845,11 @@ static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15438}; 15845};
15439 15846
15440static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { 15847static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15441 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), 15848 ALC262_HIPPO_MASTER_SWITCH,
15442 HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), 15849 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15443 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), 15850 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15444 HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT),
15445 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), 15851 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15446 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), 15852 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15447 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT),
15448 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT),
15449 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15450 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), 15853 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 15854 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 15855 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
@@ -15954,51 +16357,25 @@ static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15954static void alc662_eeepc_unsol_event(struct hda_codec *codec, 16357static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15955 unsigned int res) 16358 unsigned int res)
15956{ 16359{
15957 if ((res >> 26) == ALC880_HP_EVENT)
15958 alc262_hippo1_automute( codec );
15959
15960 if ((res >> 26) == ALC880_MIC_EVENT) 16360 if ((res >> 26) == ALC880_MIC_EVENT)
15961 alc662_eeepc_mic_automute(codec); 16361 alc662_eeepc_mic_automute(codec);
16362 else
16363 alc262_hippo_unsol_event(codec, res);
15962} 16364}
15963 16365
15964static void alc662_eeepc_inithook(struct hda_codec *codec) 16366static void alc662_eeepc_inithook(struct hda_codec *codec)
15965{ 16367{
15966 alc262_hippo1_automute( codec ); 16368 alc262_hippo1_init_hook(codec);
15967 alc662_eeepc_mic_automute(codec); 16369 alc662_eeepc_mic_automute(codec);
15968} 16370}
15969 16371
15970static void alc662_eeepc_ep20_automute(struct hda_codec *codec)
15971{
15972 unsigned int mute;
15973 unsigned int present;
15974
15975 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
15976 present = snd_hda_codec_read(codec, 0x14, 0,
15977 AC_VERB_GET_PIN_SENSE, 0);
15978 present = (present & 0x80000000) != 0;
15979 if (present) {
15980 /* mute internal speaker */
15981 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15982 HDA_AMP_MUTE, HDA_AMP_MUTE);
15983 } else {
15984 /* unmute internal speaker if necessary */
15985 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
15986 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
15987 HDA_AMP_MUTE, mute);
15988 }
15989}
15990
15991/* unsolicited event for HP jack sensing */
15992static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec,
15993 unsigned int res)
15994{
15995 if ((res >> 26) == ALC880_HP_EVENT)
15996 alc662_eeepc_ep20_automute(codec);
15997}
15998
15999static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) 16372static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16000{ 16373{
16001 alc662_eeepc_ep20_automute(codec); 16374 struct alc_spec *spec = codec->spec;
16375
16376 spec->autocfg.hp_pins[0] = 0x14;
16377 spec->autocfg.speaker_pins[0] = 0x1b;
16378 alc262_hippo_master_update(codec);
16002} 16379}
16003 16380
16004static void alc663_m51va_speaker_automute(struct hda_codec *codec) 16381static void alc663_m51va_speaker_automute(struct hda_codec *codec)
@@ -16332,35 +16709,9 @@ static void alc663_g50v_inithook(struct hda_codec *codec)
16332 alc662_eeepc_mic_automute(codec); 16709 alc662_eeepc_mic_automute(codec);
16333} 16710}
16334 16711
16335/* bind hp and internal speaker mute (with plug check) */
16336static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol,
16337 struct snd_ctl_elem_value *ucontrol)
16338{
16339 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
16340 long *valp = ucontrol->value.integer.value;
16341 int change;
16342
16343 change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0,
16344 HDA_AMP_MUTE,
16345 valp[0] ? 0 : HDA_AMP_MUTE);
16346 change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
16347 HDA_AMP_MUTE,
16348 valp[1] ? 0 : HDA_AMP_MUTE);
16349 if (change)
16350 alc262_hippo1_automute(codec);
16351 return change;
16352}
16353
16354static struct snd_kcontrol_new alc662_ecs_mixer[] = { 16712static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16355 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), 16713 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16356 { 16714 ALC262_HIPPO_MASTER_SWITCH,
16357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16358 .name = "Master Playback Switch",
16359 .info = snd_hda_mixer_amp_switch_info,
16360 .get = snd_hda_mixer_amp_switch_get,
16361 .put = alc662_ecs_master_sw_put,
16362 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16363 },
16364 16715
16365 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), 16716 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16366 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), 16717 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
@@ -16372,12 +16723,29 @@ static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16372 { } /* end */ 16723 { } /* end */
16373}; 16724};
16374 16725
16726static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16727 /* Master Playback automatically created from Speaker and Headphone */
16728 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16729 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16730 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16731 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16732
16733 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16734 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16735 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16736
16737 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16738 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16739 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16740 { } /* end */
16741};
16742
16375#ifdef CONFIG_SND_HDA_POWER_SAVE 16743#ifdef CONFIG_SND_HDA_POWER_SAVE
16376#define alc662_loopbacks alc880_loopbacks 16744#define alc662_loopbacks alc880_loopbacks
16377#endif 16745#endif
16378 16746
16379 16747
16380/* pcm configuration: identiacal with ALC880 */ 16748/* pcm configuration: identical with ALC880 */
16381#define alc662_pcm_analog_playback alc880_pcm_analog_playback 16749#define alc662_pcm_analog_playback alc880_pcm_analog_playback
16382#define alc662_pcm_analog_capture alc880_pcm_analog_capture 16750#define alc662_pcm_analog_capture alc880_pcm_analog_capture
16383#define alc662_pcm_digital_playback alc880_pcm_digital_playback 16751#define alc662_pcm_digital_playback alc880_pcm_digital_playback
@@ -16405,6 +16773,9 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
16405 [ALC663_ASUS_MODE4] = "asus-mode4", 16773 [ALC663_ASUS_MODE4] = "asus-mode4",
16406 [ALC663_ASUS_MODE5] = "asus-mode5", 16774 [ALC663_ASUS_MODE5] = "asus-mode5",
16407 [ALC663_ASUS_MODE6] = "asus-mode6", 16775 [ALC663_ASUS_MODE6] = "asus-mode6",
16776 [ALC272_DELL] = "dell",
16777 [ALC272_DELL_ZM1] = "dell-zm1",
16778 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16408 [ALC662_AUTO] = "auto", 16779 [ALC662_AUTO] = "auto",
16409}; 16780};
16410 16781
@@ -16462,6 +16833,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
16462 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 16833 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16463 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 16834 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16464 ALC662_3ST_6ch_DIG), 16835 ALC662_3ST_6ch_DIG),
16836 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16465 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 16837 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16466 ALC662_3ST_6ch_DIG), 16838 ALC662_3ST_6ch_DIG),
16467 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), 16839 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
@@ -16552,7 +16924,7 @@ static struct alc_config_preset alc662_presets[] = {
16552 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), 16924 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16553 .channel_mode = alc662_3ST_6ch_modes, 16925 .channel_mode = alc662_3ST_6ch_modes,
16554 .input_mux = &alc662_lenovo_101e_capture_source, 16926 .input_mux = &alc662_lenovo_101e_capture_source,
16555 .unsol_event = alc662_eeepc_ep20_unsol_event, 16927 .unsol_event = alc662_eeepc_unsol_event,
16556 .init_hook = alc662_eeepc_ep20_inithook, 16928 .init_hook = alc662_eeepc_ep20_inithook,
16557 }, 16929 },
16558 [ALC662_ECS] = { 16930 [ALC662_ECS] = {
@@ -16733,6 +17105,18 @@ static struct alc_config_preset alc662_presets[] = {
16733 .unsol_event = alc663_m51va_unsol_event, 17105 .unsol_event = alc663_m51va_unsol_event,
16734 .init_hook = alc663_m51va_inithook, 17106 .init_hook = alc663_m51va_inithook,
16735 }, 17107 },
17108 [ALC272_SAMSUNG_NC10] = {
17109 .mixers = { alc272_nc10_mixer },
17110 .init_verbs = { alc662_init_verbs,
17111 alc663_21jd_amic_init_verbs },
17112 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17113 .dac_nids = alc272_dac_nids,
17114 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17115 .channel_mode = alc662_3ST_2ch_modes,
17116 .input_mux = &alc272_nc10_capture_source,
17117 .unsol_event = alc663_mode4_unsol_event,
17118 .init_hook = alc663_mode4_inithook,
17119 },
16736}; 17120};
16737 17121
16738 17122
@@ -16927,7 +17311,6 @@ static void alc662_auto_init_multi_out(struct hda_codec *codec)
16927 struct alc_spec *spec = codec->spec; 17311 struct alc_spec *spec = codec->spec;
16928 int i; 17312 int i;
16929 17313
16930 alc_subsystem_id(codec, 0x15, 0x1b, 0x14);
16931 for (i = 0; i <= HDA_SIDE; i++) { 17314 for (i = 0; i <= HDA_SIDE; i++) {
16932 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 17315 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16933 int pin_type = get_pin_type(spec->autocfg.line_out_type); 17316 int pin_type = get_pin_type(spec->autocfg.line_out_type);
@@ -17024,6 +17407,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
17024 if (err < 0) 17407 if (err < 0)
17025 return err; 17408 return err;
17026 17409
17410 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17411
17027 return 1; 17412 return 1;
17028} 17413}
17029 17414
@@ -17056,8 +17441,8 @@ static int patch_alc662(struct hda_codec *codec)
17056 alc662_models, 17441 alc662_models,
17057 alc662_cfg_tbl); 17442 alc662_cfg_tbl);
17058 if (board_config < 0) { 17443 if (board_config < 0) {
17059 printk(KERN_INFO "hda_codec: Unknown model for ALC662, " 17444 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17060 "trying auto-probe from BIOS...\n"); 17445 "trying auto-probe from BIOS...\n", codec->chip_name);
17061 board_config = ALC662_AUTO; 17446 board_config = ALC662_AUTO;
17062 } 17447 }
17063 17448
@@ -17084,17 +17469,6 @@ static int patch_alc662(struct hda_codec *codec)
17084 if (board_config != ALC662_AUTO) 17469 if (board_config != ALC662_AUTO)
17085 setup_preset(spec, &alc662_presets[board_config]); 17470 setup_preset(spec, &alc662_presets[board_config]);
17086 17471
17087 if (codec->vendor_id == 0x10ec0663) {
17088 spec->stream_name_analog = "ALC663 Analog";
17089 spec->stream_name_digital = "ALC663 Digital";
17090 } else if (codec->vendor_id == 0x10ec0272) {
17091 spec->stream_name_analog = "ALC272 Analog";
17092 spec->stream_name_digital = "ALC272 Digital";
17093 } else {
17094 spec->stream_name_analog = "ALC662 Analog";
17095 spec->stream_name_digital = "ALC662 Digital";
17096 }
17097
17098 spec->stream_analog_playback = &alc662_pcm_analog_playback; 17472 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17099 spec->stream_analog_capture = &alc662_pcm_analog_capture; 17473 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17100 17474
@@ -17104,7 +17478,6 @@ static int patch_alc662(struct hda_codec *codec)
17104 spec->adc_nids = alc662_adc_nids; 17478 spec->adc_nids = alc662_adc_nids;
17105 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 17479 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17106 spec->capsrc_nids = alc662_capsrc_nids; 17480 spec->capsrc_nids = alc662_capsrc_nids;
17107 spec->capture_style = CAPT_MIX;
17108 17481
17109 if (!spec->cap_mixer) 17482 if (!spec->cap_mixer)
17110 set_capture_mixer(spec); 17483 set_capture_mixer(spec);