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.c330
1 files changed, 290 insertions, 40 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 18d105263fea..d08d2e399c8f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -79,6 +79,7 @@ enum {
79 ALC262_BASIC, 79 ALC262_BASIC,
80 ALC262_FUJITSU, 80 ALC262_FUJITSU,
81 ALC262_HP_BPC, 81 ALC262_HP_BPC,
82 ALC262_BENQ_ED8,
82 ALC262_AUTO, 83 ALC262_AUTO,
83 ALC262_MODEL_LAST /* last tag */ 84 ALC262_MODEL_LAST /* last tag */
84}; 85};
@@ -89,6 +90,7 @@ enum {
89 ALC660_3ST, 90 ALC660_3ST,
90 ALC861_3ST_DIG, 91 ALC861_3ST_DIG,
91 ALC861_6ST_DIG, 92 ALC861_6ST_DIG,
93 ALC861_UNIWILL_M31,
92 ALC861_AUTO, 94 ALC861_AUTO,
93 ALC861_MODEL_LAST, 95 ALC861_MODEL_LAST,
94}; 96};
@@ -97,6 +99,7 @@ enum {
97enum { 99enum {
98 ALC882_3ST_DIG, 100 ALC882_3ST_DIG,
99 ALC882_6ST_DIG, 101 ALC882_6ST_DIG,
102 ALC882_ARIMA,
100 ALC882_AUTO, 103 ALC882_AUTO,
101 ALC882_MODEL_LAST, 104 ALC882_MODEL_LAST,
102}; 105};
@@ -108,6 +111,7 @@ enum {
108 ALC883_3ST_6ch, 111 ALC883_3ST_6ch,
109 ALC883_6ST_DIG, 112 ALC883_6ST_DIG,
110 ALC888_DEMO_BOARD, 113 ALC888_DEMO_BOARD,
114 ALC883_ACER,
111 ALC883_AUTO, 115 ALC883_AUTO,
112 ALC883_MODEL_LAST, 116 ALC883_MODEL_LAST,
113}; 117};
@@ -153,6 +157,7 @@ struct alc_spec {
153 /* channel model */ 157 /* channel model */
154 const struct hda_channel_mode *channel_mode; 158 const struct hda_channel_mode *channel_mode;
155 int num_channel_mode; 159 int num_channel_mode;
160 int need_dac_fix;
156 161
157 /* PCM information */ 162 /* PCM information */
158 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 163 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
@@ -190,6 +195,7 @@ struct alc_config_preset {
190 hda_nid_t dig_in_nid; 195 hda_nid_t dig_in_nid;
191 unsigned int num_channel_mode; 196 unsigned int num_channel_mode;
192 const struct hda_channel_mode *channel_mode; 197 const struct hda_channel_mode *channel_mode;
198 int need_dac_fix;
193 unsigned int num_mux_defs; 199 unsigned int num_mux_defs;
194 const struct hda_input_mux *input_mux; 200 const struct hda_input_mux *input_mux;
195 void (*unsol_event)(struct hda_codec *, unsigned int); 201 void (*unsol_event)(struct hda_codec *, unsigned int);
@@ -262,9 +268,12 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
262{ 268{
263 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 269 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
264 struct alc_spec *spec = codec->spec; 270 struct alc_spec *spec = codec->spec;
265 return snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 271 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
266 spec->num_channel_mode, 272 spec->num_channel_mode,
267 &spec->multiout.max_channels); 273 &spec->multiout.max_channels);
274 if (! err && spec->need_dac_fix)
275 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
276 return err;
268} 277}
269 278
270/* 279/*
@@ -544,6 +553,7 @@ static void setup_preset(struct alc_spec *spec,
544 553
545 spec->channel_mode = preset->channel_mode; 554 spec->channel_mode = preset->channel_mode;
546 spec->num_channel_mode = preset->num_channel_mode; 555 spec->num_channel_mode = preset->num_channel_mode;
556 spec->need_dac_fix = preset->need_dac_fix;
547 557
548 spec->multiout.max_channels = spec->channel_mode[0].channels; 558 spec->multiout.max_channels = spec->channel_mode[0].channels;
549 559
@@ -1348,6 +1358,10 @@ static struct hda_verb alc880_pin_clevo_init_verbs[] = {
1348}; 1358};
1349 1359
1350static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { 1360static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
1361 /* change to EAPD mode */
1362 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1363 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1364
1351 /* Headphone output */ 1365 /* Headphone output */
1352 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1353 /* Front output*/ 1367 /* Front output*/
@@ -1782,25 +1796,9 @@ static int alc_build_pcms(struct hda_codec *codec)
1782 } 1796 }
1783 } 1797 }
1784 1798
1785 /* If the use of more than one ADC is requested for the current 1799 /* SPDIF for stream index #1 */
1786 * model, configure a second analog capture-only PCM.
1787 */
1788 if (spec->num_adc_nids > 1) {
1789 codec->num_pcms++;
1790 info++;
1791 info->name = spec->stream_name_analog;
1792 /* No playback stream for second PCM */
1793 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
1794 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
1795 if (spec->stream_analog_capture) {
1796 snd_assert(spec->adc_nids, return -EINVAL);
1797 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
1798 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
1799 }
1800 }
1801
1802 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1803 codec->num_pcms++; 1801 codec->num_pcms = 2;
1804 info++; 1802 info++;
1805 info->name = spec->stream_name_digital; 1803 info->name = spec->stream_name_digital;
1806 if (spec->multiout.dig_out_nid && 1804 if (spec->multiout.dig_out_nid &&
@@ -1815,6 +1813,24 @@ static int alc_build_pcms(struct hda_codec *codec)
1815 } 1813 }
1816 } 1814 }
1817 1815
1816 /* If the use of more than one ADC is requested for the current
1817 * model, configure a second analog capture-only PCM.
1818 */
1819 /* Additional Analaog capture for index #2 */
1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
1821 spec->adc_nids) {
1822 codec->num_pcms = 3;
1823 info++;
1824 info->name = spec->stream_name_analog;
1825 /* No playback stream for second PCM */
1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
1827 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
1828 if (spec->stream_analog_capture) {
1829 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
1830 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1];
1831 }
1832 }
1833
1818 return 0; 1834 return 0;
1819} 1835}
1820 1836
@@ -2130,7 +2146,10 @@ static struct hda_board_config alc880_cfg_tbl[] = {
2130 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20f, .config = ALC880_3ST }, 2146 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20f, .config = ALC880_3ST },
2131 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe210, .config = ALC880_3ST }, 2147 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe210, .config = ALC880_3ST },
2132 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe211, .config = ALC880_3ST }, 2148 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe211, .config = ALC880_3ST },
2149 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe212, .config = ALC880_3ST },
2150 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe213, .config = ALC880_3ST },
2133 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe214, .config = ALC880_3ST }, 2151 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe214, .config = ALC880_3ST },
2152 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe234, .config = ALC880_3ST },
2134 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe302, .config = ALC880_3ST }, 2153 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe302, .config = ALC880_3ST },
2135 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe303, .config = ALC880_3ST }, 2154 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe303, .config = ALC880_3ST },
2136 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe304, .config = ALC880_3ST }, 2155 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe304, .config = ALC880_3ST },
@@ -2145,6 +2164,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
2145 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4040, .config = ALC880_3ST }, 2164 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4040, .config = ALC880_3ST },
2146 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4041, .config = ALC880_3ST }, 2165 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4041, .config = ALC880_3ST },
2147 /* TCL S700 */ 2166 /* TCL S700 */
2167 { .modelname = "tcl", .config = ALC880_TCL_S700 },
2148 { .pci_subvendor = 0x19db, .pci_subdevice = 0x4188, .config = ALC880_TCL_S700 }, 2168 { .pci_subvendor = 0x19db, .pci_subdevice = 0x4188, .config = ALC880_TCL_S700 },
2149 2169
2150 /* Back 3 jack, front 2 jack (Internal add Aux-In) */ 2170 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
@@ -2156,8 +2176,13 @@ static struct hda_board_config alc880_cfg_tbl[] = {
2156 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 2176 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
2157 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, 2177 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG },
2158 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG }, 2178 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG },
2159 /* Clevo m520G NB */ 2179
2160 { .pci_subvendor = 0x1558, .pci_subdevice = 0x0520, .config = ALC880_CLEVO }, 2180 /* Clevo laptops */
2181 { .modelname = "clevo", .config = ALC880_CLEVO },
2182 { .pci_subvendor = 0x1558, .pci_subdevice = 0x0520,
2183 .config = ALC880_CLEVO }, /* Clevo m520G NB */
2184 { .pci_subvendor = 0x1558, .pci_subdevice = 0x0660,
2185 .config = ALC880_CLEVO }, /* Clevo m665n */
2161 2186
2162 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ 2187 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/
2163 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, 2188 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG },
@@ -2222,12 +2247,16 @@ static struct hda_board_config alc880_cfg_tbl[] = {
2222 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, 2247 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG },
2223 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG }, 2248 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG },
2224 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, 2249 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS },
2250 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c2, .config = ALC880_ASUS_DIG }, /* Asus W6A */
2225 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, 2251 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG },
2226 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, 2252 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS },
2227 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG }, 2253 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG },
2228 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS }, 2254 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS },
2255 { .modelname = "asus-w1v", .config = ALC880_ASUS_W1V },
2229 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V }, 2256 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V },
2257 { .modelname = "asus-dig", .config = ALC880_ASUS_DIG },
2230 { .pci_subvendor = 0x1043, .pci_subdevice = 0x8181, .config = ALC880_ASUS_DIG }, /* ASUS P4GPL-X */ 2258 { .pci_subvendor = 0x1043, .pci_subdevice = 0x8181, .config = ALC880_ASUS_DIG }, /* ASUS P4GPL-X */
2259 { .modelname = "asus-dig2", .config = ALC880_ASUS_DIG2 },
2231 { .pci_subvendor = 0x1558, .pci_subdevice = 0x5401, .config = ALC880_ASUS_DIG2 }, 2260 { .pci_subvendor = 0x1558, .pci_subdevice = 0x5401, .config = ALC880_ASUS_DIG2 },
2232 2261
2233 { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG }, 2262 { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG },
@@ -2243,6 +2272,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
2243 2272
2244 { .modelname = "lg-lw", .config = ALC880_LG_LW }, 2273 { .modelname = "lg-lw", .config = ALC880_LG_LW },
2245 { .pci_subvendor = 0x1854, .pci_subdevice = 0x0018, .config = ALC880_LG_LW }, 2274 { .pci_subvendor = 0x1854, .pci_subdevice = 0x0018, .config = ALC880_LG_LW },
2275 { .pci_subvendor = 0x1854, .pci_subdevice = 0x0077, .config = ALC880_LG_LW },
2246 2276
2247#ifdef CONFIG_SND_DEBUG 2277#ifdef CONFIG_SND_DEBUG
2248 { .modelname = "test", .config = ALC880_TEST }, 2278 { .modelname = "test", .config = ALC880_TEST },
@@ -2263,6 +2293,7 @@ static struct alc_config_preset alc880_presets[] = {
2263 .dac_nids = alc880_dac_nids, 2293 .dac_nids = alc880_dac_nids,
2264 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2294 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2265 .channel_mode = alc880_threestack_modes, 2295 .channel_mode = alc880_threestack_modes,
2296 .need_dac_fix = 1,
2266 .input_mux = &alc880_capture_source, 2297 .input_mux = &alc880_capture_source,
2267 }, 2298 },
2268 [ALC880_3ST_DIG] = { 2299 [ALC880_3ST_DIG] = {
@@ -2273,6 +2304,7 @@ static struct alc_config_preset alc880_presets[] = {
2273 .dig_out_nid = ALC880_DIGOUT_NID, 2304 .dig_out_nid = ALC880_DIGOUT_NID,
2274 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2305 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2275 .channel_mode = alc880_threestack_modes, 2306 .channel_mode = alc880_threestack_modes,
2307 .need_dac_fix = 1,
2276 .input_mux = &alc880_capture_source, 2308 .input_mux = &alc880_capture_source,
2277 }, 2309 },
2278 [ALC880_TCL_S700] = { 2310 [ALC880_TCL_S700] = {
@@ -2365,6 +2397,7 @@ static struct alc_config_preset alc880_presets[] = {
2365 .dac_nids = alc880_asus_dac_nids, 2397 .dac_nids = alc880_asus_dac_nids,
2366 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2398 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2367 .channel_mode = alc880_asus_modes, 2399 .channel_mode = alc880_asus_modes,
2400 .need_dac_fix = 1,
2368 .input_mux = &alc880_capture_source, 2401 .input_mux = &alc880_capture_source,
2369 }, 2402 },
2370 [ALC880_ASUS_DIG] = { 2403 [ALC880_ASUS_DIG] = {
@@ -2376,6 +2409,7 @@ static struct alc_config_preset alc880_presets[] = {
2376 .dig_out_nid = ALC880_DIGOUT_NID, 2409 .dig_out_nid = ALC880_DIGOUT_NID,
2377 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2410 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2378 .channel_mode = alc880_asus_modes, 2411 .channel_mode = alc880_asus_modes,
2412 .need_dac_fix = 1,
2379 .input_mux = &alc880_capture_source, 2413 .input_mux = &alc880_capture_source,
2380 }, 2414 },
2381 [ALC880_ASUS_DIG2] = { 2415 [ALC880_ASUS_DIG2] = {
@@ -2387,6 +2421,7 @@ static struct alc_config_preset alc880_presets[] = {
2387 .dig_out_nid = ALC880_DIGOUT_NID, 2421 .dig_out_nid = ALC880_DIGOUT_NID,
2388 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2422 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2389 .channel_mode = alc880_asus_modes, 2423 .channel_mode = alc880_asus_modes,
2424 .need_dac_fix = 1,
2390 .input_mux = &alc880_capture_source, 2425 .input_mux = &alc880_capture_source,
2391 }, 2426 },
2392 [ALC880_ASUS_W1V] = { 2427 [ALC880_ASUS_W1V] = {
@@ -2398,6 +2433,7 @@ static struct alc_config_preset alc880_presets[] = {
2398 .dig_out_nid = ALC880_DIGOUT_NID, 2433 .dig_out_nid = ALC880_DIGOUT_NID,
2399 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2434 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2400 .channel_mode = alc880_asus_modes, 2435 .channel_mode = alc880_asus_modes,
2436 .need_dac_fix = 1,
2401 .input_mux = &alc880_capture_source, 2437 .input_mux = &alc880_capture_source,
2402 }, 2438 },
2403 [ALC880_UNIWILL_DIG] = { 2439 [ALC880_UNIWILL_DIG] = {
@@ -2408,6 +2444,7 @@ static struct alc_config_preset alc880_presets[] = {
2408 .dig_out_nid = ALC880_DIGOUT_NID, 2444 .dig_out_nid = ALC880_DIGOUT_NID,
2409 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2445 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
2410 .channel_mode = alc880_asus_modes, 2446 .channel_mode = alc880_asus_modes,
2447 .need_dac_fix = 1,
2411 .input_mux = &alc880_capture_source, 2448 .input_mux = &alc880_capture_source,
2412 }, 2449 },
2413 [ALC880_CLEVO] = { 2450 [ALC880_CLEVO] = {
@@ -2419,6 +2456,7 @@ static struct alc_config_preset alc880_presets[] = {
2419 .hp_nid = 0x03, 2456 .hp_nid = 0x03,
2420 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2457 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
2421 .channel_mode = alc880_threestack_modes, 2458 .channel_mode = alc880_threestack_modes,
2459 .need_dac_fix = 1,
2422 .input_mux = &alc880_capture_source, 2460 .input_mux = &alc880_capture_source,
2423 }, 2461 },
2424 [ALC880_LG] = { 2462 [ALC880_LG] = {
@@ -2430,6 +2468,7 @@ static struct alc_config_preset alc880_presets[] = {
2430 .dig_out_nid = ALC880_DIGOUT_NID, 2468 .dig_out_nid = ALC880_DIGOUT_NID,
2431 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), 2469 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
2432 .channel_mode = alc880_lg_ch_modes, 2470 .channel_mode = alc880_lg_ch_modes,
2471 .need_dac_fix = 1,
2433 .input_mux = &alc880_lg_capture_source, 2472 .input_mux = &alc880_lg_capture_source,
2434 .unsol_event = alc880_lg_unsol_event, 2473 .unsol_event = alc880_lg_unsol_event,
2435 .init_hook = alc880_lg_automute, 2474 .init_hook = alc880_lg_automute,
@@ -2714,7 +2753,7 @@ static void alc880_auto_init_extra_out(struct hda_codec *codec)
2714 pin = spec->autocfg.speaker_pins[0]; 2753 pin = spec->autocfg.speaker_pins[0];
2715 if (pin) /* connect to front */ 2754 if (pin) /* connect to front */
2716 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 2755 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
2717 pin = spec->autocfg.hp_pin; 2756 pin = spec->autocfg.hp_pins[0];
2718 if (pin) /* connect to front */ 2757 if (pin) /* connect to front */
2719 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 2758 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
2720} 2759}
@@ -2755,7 +2794,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
2755 (err = alc880_auto_create_extra_out(spec, 2794 (err = alc880_auto_create_extra_out(spec,
2756 spec->autocfg.speaker_pins[0], 2795 spec->autocfg.speaker_pins[0],
2757 "Speaker")) < 0 || 2796 "Speaker")) < 0 ||
2758 (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pin, 2797 (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
2759 "Headphone")) < 0 || 2798 "Headphone")) < 0 ||
2760 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 2799 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0)
2761 return err; 2800 return err;
@@ -3697,7 +3736,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
3697 return err; 3736 return err;
3698 } 3737 }
3699 3738
3700 nid = cfg->hp_pin; 3739 nid = cfg->hp_pins[0];
3701 if (nid) { 3740 if (nid) {
3702 err = alc260_add_playback_controls(spec, nid, "Headphone"); 3741 err = alc260_add_playback_controls(spec, nid, "Headphone");
3703 if (err < 0) 3742 if (err < 0)
@@ -3767,7 +3806,7 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec)
3767 if (nid) 3806 if (nid)
3768 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 3807 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
3769 3808
3770 nid = spec->autocfg.hp_pin; 3809 nid = spec->autocfg.hp_pins[0];
3771 if (nid) 3810 if (nid)
3772 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 3811 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
3773} 3812}
@@ -3900,7 +3939,8 @@ static struct hda_board_config alc260_cfg_tbl[] = {
3900 { .pci_subvendor = 0x152d, .pci_subdevice = 0x0729, 3939 { .pci_subvendor = 0x152d, .pci_subdevice = 0x0729,
3901 .config = ALC260_BASIC }, /* CTL Travel Master U553W */ 3940 .config = ALC260_BASIC }, /* CTL Travel Master U553W */
3902 { .modelname = "hp", .config = ALC260_HP }, 3941 { .modelname = "hp", .config = ALC260_HP },
3903 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP }, 3942 { .modelname = "hp-3013", .config = ALC260_HP_3013 },
3943 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP_3013 },
3904 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP }, 3944 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP },
3905 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3012, .config = ALC260_HP_3013 }, 3945 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3012, .config = ALC260_HP_3013 },
3906 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3013, .config = ALC260_HP_3013 }, 3946 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3013, .config = ALC260_HP_3013 },
@@ -4266,6 +4306,13 @@ static struct hda_verb alc882_init_verbs[] = {
4266 { } 4306 { }
4267}; 4307};
4268 4308
4309static struct hda_verb alc882_eapd_verbs[] = {
4310 /* change to EAPD mode */
4311 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
4312 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
4313 { }
4314};
4315
4269/* 4316/*
4270 * generic initialization of ADC, input mixers and output mixers 4317 * generic initialization of ADC, input mixers and output mixers
4271 */ 4318 */
@@ -4397,6 +4444,9 @@ static struct hda_board_config alc882_cfg_tbl[] = {
4397 .config = ALC882_6ST_DIG }, /* Foxconn */ 4444 .config = ALC882_6ST_DIG }, /* Foxconn */
4398 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, 4445 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668,
4399 .config = ALC882_6ST_DIG }, /* ECS to Intel*/ 4446 .config = ALC882_6ST_DIG }, /* ECS to Intel*/
4447 { .modelname = "arima", .config = ALC882_ARIMA },
4448 { .pci_subvendor = 0x161f, .pci_subdevice = 0x2054,
4449 .config = ALC882_ARIMA }, /* Arima W820Di1 */
4400 { .modelname = "auto", .config = ALC882_AUTO }, 4450 { .modelname = "auto", .config = ALC882_AUTO },
4401 {} 4451 {}
4402}; 4452};
@@ -4411,6 +4461,7 @@ static struct alc_config_preset alc882_presets[] = {
4411 .dig_in_nid = ALC882_DIGIN_NID, 4461 .dig_in_nid = ALC882_DIGIN_NID,
4412 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 4462 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
4413 .channel_mode = alc882_ch_modes, 4463 .channel_mode = alc882_ch_modes,
4464 .need_dac_fix = 1,
4414 .input_mux = &alc882_capture_source, 4465 .input_mux = &alc882_capture_source,
4415 }, 4466 },
4416 [ALC882_6ST_DIG] = { 4467 [ALC882_6ST_DIG] = {
@@ -4424,6 +4475,15 @@ static struct alc_config_preset alc882_presets[] = {
4424 .channel_mode = alc882_sixstack_modes, 4475 .channel_mode = alc882_sixstack_modes,
4425 .input_mux = &alc882_capture_source, 4476 .input_mux = &alc882_capture_source,
4426 }, 4477 },
4478 [ALC882_ARIMA] = {
4479 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
4480 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
4481 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
4482 .dac_nids = alc882_dac_nids,
4483 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
4484 .channel_mode = alc882_sixstack_modes,
4485 .input_mux = &alc882_capture_source,
4486 },
4427}; 4487};
4428 4488
4429 4489
@@ -4466,7 +4526,7 @@ static void alc882_auto_init_hp_out(struct hda_codec *codec)
4466 struct alc_spec *spec = codec->spec; 4526 struct alc_spec *spec = codec->spec;
4467 hda_nid_t pin; 4527 hda_nid_t pin;
4468 4528
4469 pin = spec->autocfg.hp_pin; 4529 pin = spec->autocfg.hp_pins[0];
4470 if (pin) /* connect to front */ 4530 if (pin) /* connect to front */
4471 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */ 4531 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */
4472} 4532}
@@ -4999,16 +5059,23 @@ static struct snd_kcontrol_new alc883_capture_mixer[] = {
4999 */ 5059 */
5000static struct hda_board_config alc883_cfg_tbl[] = { 5060static struct hda_board_config alc883_cfg_tbl[] = {
5001 { .modelname = "3stack-dig", .config = ALC883_3ST_2ch_DIG }, 5061 { .modelname = "3stack-dig", .config = ALC883_3ST_2ch_DIG },
5062 { .modelname = "3stack-6ch-dig", .config = ALC883_3ST_6ch_DIG },
5063 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668,
5064 .config = ALC883_3ST_6ch_DIG }, /* ECS to Intel*/
5065 { .modelname = "3stack-6ch", .config = ALC883_3ST_6ch },
5066 { .pci_subvendor = 0x108e, .pci_subdevice = 0x534d,
5067 .config = ALC883_3ST_6ch },
5068 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd601,
5069 .config = ALC883_3ST_6ch }, /* D102GGC */
5002 { .modelname = "6stack-dig", .config = ALC883_6ST_DIG }, 5070 { .modelname = "6stack-dig", .config = ALC883_6ST_DIG },
5003 { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD },
5004 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, 5071 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668,
5005 .config = ALC883_6ST_DIG }, /* MSI */ 5072 .config = ALC883_6ST_DIG }, /* MSI */
5006 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, 5073 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668,
5007 .config = ALC883_6ST_DIG }, /* Foxconn */ 5074 .config = ALC883_6ST_DIG }, /* Foxconn */
5008 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, 5075 { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD },
5009 .config = ALC883_3ST_6ch_DIG }, /* ECS to Intel*/ 5076 { .modelname = "acer", .config = ALC883_ACER },
5010 { .pci_subvendor = 0x108e, .pci_subdevice = 0x534d, 5077 { .pci_subvendor = 0x1025, .pci_subdevice = 0/*0x0102*/,
5011 .config = ALC883_3ST_6ch }, 5078 .config = ALC883_ACER },
5012 { .modelname = "auto", .config = ALC883_AUTO }, 5079 { .modelname = "auto", .config = ALC883_AUTO },
5013 {} 5080 {}
5014}; 5081};
@@ -5038,6 +5105,7 @@ static struct alc_config_preset alc883_presets[] = {
5038 .dig_in_nid = ALC883_DIGIN_NID, 5105 .dig_in_nid = ALC883_DIGIN_NID,
5039 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 5106 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
5040 .channel_mode = alc883_3ST_6ch_modes, 5107 .channel_mode = alc883_3ST_6ch_modes,
5108 .need_dac_fix = 1,
5041 .input_mux = &alc883_capture_source, 5109 .input_mux = &alc883_capture_source,
5042 }, 5110 },
5043 [ALC883_3ST_6ch] = { 5111 [ALC883_3ST_6ch] = {
@@ -5049,6 +5117,7 @@ static struct alc_config_preset alc883_presets[] = {
5049 .adc_nids = alc883_adc_nids, 5117 .adc_nids = alc883_adc_nids,
5050 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 5118 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
5051 .channel_mode = alc883_3ST_6ch_modes, 5119 .channel_mode = alc883_3ST_6ch_modes,
5120 .need_dac_fix = 1,
5052 .input_mux = &alc883_capture_source, 5121 .input_mux = &alc883_capture_source,
5053 }, 5122 },
5054 [ALC883_6ST_DIG] = { 5123 [ALC883_6ST_DIG] = {
@@ -5077,6 +5146,23 @@ static struct alc_config_preset alc883_presets[] = {
5077 .channel_mode = alc883_sixstack_modes, 5146 .channel_mode = alc883_sixstack_modes,
5078 .input_mux = &alc883_capture_source, 5147 .input_mux = &alc883_capture_source,
5079 }, 5148 },
5149 [ALC883_ACER] = {
5150 .mixers = { alc883_base_mixer,
5151 alc883_chmode_mixer },
5152 /* On TravelMate laptops, GPIO 0 enables the internal speaker
5153 * and the headphone jack. Turn this on and rely on the
5154 * standard mute methods whenever the user wants to turn
5155 * these outputs off.
5156 */
5157 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
5158 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
5159 .dac_nids = alc883_dac_nids,
5160 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
5161 .adc_nids = alc883_adc_nids,
5162 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
5163 .channel_mode = alc883_3ST_2ch_modes,
5164 .input_mux = &alc883_capture_source,
5165 },
5080}; 5166};
5081 5167
5082 5168
@@ -5121,7 +5207,7 @@ static void alc883_auto_init_hp_out(struct hda_codec *codec)
5121 struct alc_spec *spec = codec->spec; 5207 struct alc_spec *spec = codec->spec;
5122 hda_nid_t pin; 5208 hda_nid_t pin;
5123 5209
5124 pin = spec->autocfg.hp_pin; 5210 pin = spec->autocfg.hp_pins[0];
5125 if (pin) /* connect to front */ 5211 if (pin) /* connect to front */
5126 /* use dac 0 */ 5212 /* use dac 0 */
5127 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 5213 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
@@ -5217,8 +5303,10 @@ static int patch_alc883(struct hda_codec *codec)
5217 spec->stream_digital_playback = &alc883_pcm_digital_playback; 5303 spec->stream_digital_playback = &alc883_pcm_digital_playback;
5218 spec->stream_digital_capture = &alc883_pcm_digital_capture; 5304 spec->stream_digital_capture = &alc883_pcm_digital_capture;
5219 5305
5220 spec->adc_nids = alc883_adc_nids; 5306 if (! spec->adc_nids && spec->input_mux) {
5221 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 5307 spec->adc_nids = alc883_adc_nids;
5308 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
5309 }
5222 5310
5223 codec->patch_ops = alc_patch_ops; 5311 codec->patch_ops = alc_patch_ops;
5224 if (board_config == ALC883_AUTO) 5312 if (board_config == ALC883_AUTO)
@@ -5481,6 +5569,7 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
5481 .info = snd_hda_mixer_amp_volume_info, 5569 .info = snd_hda_mixer_amp_volume_info,
5482 .get = snd_hda_mixer_amp_volume_get, 5570 .get = snd_hda_mixer_amp_volume_get,
5483 .put = alc262_fujitsu_master_vol_put, 5571 .put = alc262_fujitsu_master_vol_put,
5572 .tlv = { .c = snd_hda_mixer_amp_tlv },
5484 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), 5573 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
5485 }, 5574 },
5486 { 5575 {
@@ -5499,6 +5588,13 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
5499 { } /* end */ 5588 { } /* end */
5500}; 5589};
5501 5590
5591/* additional init verbs for Benq laptops */
5592static struct hda_verb alc262_EAPD_verbs[] = {
5593 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
5594 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
5595 {}
5596};
5597
5502/* add playback controls from the parsed DAC table */ 5598/* add playback controls from the parsed DAC table */
5503static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) 5599static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg)
5504{ 5600{
@@ -5534,7 +5630,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct
5534 return err; 5630 return err;
5535 } 5631 }
5536 } 5632 }
5537 nid = cfg->hp_pin; 5633 nid = cfg->hp_pins[0];
5538 if (nid) { 5634 if (nid) {
5539 /* spec->multiout.hp_nid = 2; */ 5635 /* spec->multiout.hp_nid = 2; */
5540 if (nid == 0x16) { 5636 if (nid == 0x16) {
@@ -5769,6 +5865,7 @@ static struct hda_board_config alc262_cfg_tbl[] = {
5769 { .modelname = "fujitsu", .config = ALC262_FUJITSU }, 5865 { .modelname = "fujitsu", .config = ALC262_FUJITSU },
5770 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, 5866 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397,
5771 .config = ALC262_FUJITSU }, 5867 .config = ALC262_FUJITSU },
5868 { .modelname = "hp-bpc", .config = ALC262_HP_BPC },
5772 { .pci_subvendor = 0x103c, .pci_subdevice = 0x208c, 5869 { .pci_subvendor = 0x103c, .pci_subdevice = 0x208c,
5773 .config = ALC262_HP_BPC }, /* xw4400 */ 5870 .config = ALC262_HP_BPC }, /* xw4400 */
5774 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, 5871 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014,
@@ -5777,6 +5874,9 @@ static struct hda_board_config alc262_cfg_tbl[] = {
5777 .config = ALC262_HP_BPC }, /* xw8400 */ 5874 .config = ALC262_HP_BPC }, /* xw8400 */
5778 { .pci_subvendor = 0x103c, .pci_subdevice = 0x12fe, 5875 { .pci_subvendor = 0x103c, .pci_subdevice = 0x12fe,
5779 .config = ALC262_HP_BPC }, /* xw9400 */ 5876 .config = ALC262_HP_BPC }, /* xw9400 */
5877 { .modelname = "benq", .config = ALC262_BENQ_ED8 },
5878 { .pci_subvendor = 0x17ff, .pci_subdevice = 0x0560,
5879 .config = ALC262_BENQ_ED8 },
5780 { .modelname = "auto", .config = ALC262_AUTO }, 5880 { .modelname = "auto", .config = ALC262_AUTO },
5781 {} 5881 {}
5782}; 5882};
@@ -5814,6 +5914,16 @@ static struct alc_config_preset alc262_presets[] = {
5814 .channel_mode = alc262_modes, 5914 .channel_mode = alc262_modes,
5815 .input_mux = &alc262_HP_capture_source, 5915 .input_mux = &alc262_HP_capture_source,
5816 }, 5916 },
5917 [ALC262_BENQ_ED8] = {
5918 .mixers = { alc262_base_mixer },
5919 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
5920 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
5921 .dac_nids = alc262_dac_nids,
5922 .hp_nid = 0x03,
5923 .num_channel_mode = ARRAY_SIZE(alc262_modes),
5924 .channel_mode = alc262_modes,
5925 .input_mux = &alc262_capture_source,
5926 },
5817}; 5927};
5818 5928
5819static int patch_alc262(struct hda_codec *codec) 5929static int patch_alc262(struct hda_codec *codec)
@@ -5942,6 +6052,23 @@ static struct hda_channel_mode alc861_threestack_modes[2] = {
5942 { 2, alc861_threestack_ch2_init }, 6052 { 2, alc861_threestack_ch2_init },
5943 { 6, alc861_threestack_ch6_init }, 6053 { 6, alc861_threestack_ch6_init },
5944}; 6054};
6055/* Set mic1 as input and unmute the mixer */
6056static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
6057 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
6058 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
6059 { } /* end */
6060};
6061/* Set mic1 as output and mute mixer */
6062static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
6063 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
6064 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
6065 { } /* end */
6066};
6067
6068static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
6069 { 2, alc861_uniwill_m31_ch2_init },
6070 { 4, alc861_uniwill_m31_ch4_init },
6071};
5945 6072
5946/* patch-ALC861 */ 6073/* patch-ALC861 */
5947 6074
@@ -6020,6 +6147,47 @@ static struct snd_kcontrol_new alc861_3ST_mixer[] = {
6020 }, 6147 },
6021 { } /* end */ 6148 { } /* end */
6022}; 6149};
6150static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
6151 /* output mixer control */
6152 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
6153 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
6154 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
6155 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
6156 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
6157
6158 /* Input mixer control */
6159 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
6160 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
6161 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
6162 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
6163 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
6164 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
6165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
6166 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
6167 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
6168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
6169
6170 /* Capture mixer control */
6171 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6172 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6173 {
6174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6175 .name = "Capture Source",
6176 .count = 1,
6177 .info = alc_mux_enum_info,
6178 .get = alc_mux_enum_get,
6179 .put = alc_mux_enum_put,
6180 },
6181 {
6182 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6183 .name = "Channel Mode",
6184 .info = alc_ch_mode_info,
6185 .get = alc_ch_mode_get,
6186 .put = alc_ch_mode_put,
6187 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
6188 },
6189 { } /* end */
6190};
6023 6191
6024/* 6192/*
6025 * generic initialization of ADC, input mixers and output mixers 6193 * generic initialization of ADC, input mixers and output mixers
@@ -6148,6 +6316,67 @@ static struct hda_verb alc861_threestack_init_verbs[] = {
6148 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6149 { } 6317 { }
6150}; 6318};
6319
6320static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
6321 /*
6322 * Unmute ADC0 and set the default input to mic-in
6323 */
6324 /* port-A for surround (rear panel) */
6325 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6326 /* port-B for mic-in (rear panel) with vref */
6327 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
6328 /* port-C for line-in (rear panel) */
6329 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
6330 /* port-D for Front */
6331 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
6332 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
6333 /* port-E for HP out (front panel) */
6334 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80
6335 /* route front PCM to HP */
6336 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 },
6337 /* port-F for mic-in (front panel) with vref */
6338 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
6339 /* port-G for CLFE (rear panel) */
6340 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6341 /* port-H for side (rear panel) */
6342 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6343 /* CD-in */
6344 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
6345 /* route front mic to ADC1*/
6346 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6347 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6348 /* Unmute DAC0~3 & spdif out*/
6349 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6350 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6351 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6352 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6353 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6354
6355 /* Unmute Mixer 14 (mic) 1c (Line in)*/
6356 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6357 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6358 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6359 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6360
6361 /* Unmute Stereo Mixer 15 */
6362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6363 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step
6366
6367 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6369 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6370 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6371 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6374 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6375 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front)
6376 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
6377 { }
6378};
6379
6151/* 6380/*
6152 * generic initialization of ADC, input mixers and output mixers 6381 * generic initialization of ADC, input mixers and output mixers
6153 */ 6382 */
@@ -6401,7 +6630,7 @@ static void alc861_auto_init_hp_out(struct hda_codec *codec)
6401 struct alc_spec *spec = codec->spec; 6630 struct alc_spec *spec = codec->spec;
6402 hda_nid_t pin; 6631 hda_nid_t pin;
6403 6632
6404 pin = spec->autocfg.hp_pin; 6633 pin = spec->autocfg.hp_pins[0];
6405 if (pin) /* connect to front */ 6634 if (pin) /* connect to front */
6406 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]); 6635 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]);
6407} 6636}
@@ -6436,7 +6665,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
6436 6665
6437 if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || 6666 if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 ||
6438 (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 6667 (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
6439 (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pin)) < 0 || 6668 (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0])) < 0 ||
6440 (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 6669 (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0)
6441 return err; 6670 return err;
6442 6671
@@ -6477,10 +6706,14 @@ static struct hda_board_config alc861_cfg_tbl[] = {
6477 { .modelname = "3stack", .config = ALC861_3ST }, 6706 { .modelname = "3stack", .config = ALC861_3ST },
6478 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd600, 6707 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd600,
6479 .config = ALC861_3ST }, 6708 .config = ALC861_3ST },
6709 { .modelname = "3stack-660", .config = ALC660_3ST },
6480 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81e7, 6710 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81e7,
6481 .config = ALC660_3ST }, 6711 .config = ALC660_3ST },
6482 { .modelname = "3stack-dig", .config = ALC861_3ST_DIG }, 6712 { .modelname = "3stack-dig", .config = ALC861_3ST_DIG },
6483 { .modelname = "6stack-dig", .config = ALC861_6ST_DIG }, 6713 { .modelname = "6stack-dig", .config = ALC861_6ST_DIG },
6714 { .modelname = "uniwill-m31", .config = ALC861_UNIWILL_M31},
6715 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9072,
6716 .config = ALC861_UNIWILL_M31 },
6484 { .modelname = "auto", .config = ALC861_AUTO }, 6717 { .modelname = "auto", .config = ALC861_AUTO },
6485 {} 6718 {}
6486}; 6719};
@@ -6493,6 +6726,7 @@ static struct alc_config_preset alc861_presets[] = {
6493 .dac_nids = alc861_dac_nids, 6726 .dac_nids = alc861_dac_nids,
6494 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6727 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
6495 .channel_mode = alc861_threestack_modes, 6728 .channel_mode = alc861_threestack_modes,
6729 .need_dac_fix = 1,
6496 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6730 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
6497 .adc_nids = alc861_adc_nids, 6731 .adc_nids = alc861_adc_nids,
6498 .input_mux = &alc861_capture_source, 6732 .input_mux = &alc861_capture_source,
@@ -6505,6 +6739,7 @@ static struct alc_config_preset alc861_presets[] = {
6505 .dig_out_nid = ALC861_DIGOUT_NID, 6739 .dig_out_nid = ALC861_DIGOUT_NID,
6506 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6740 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
6507 .channel_mode = alc861_threestack_modes, 6741 .channel_mode = alc861_threestack_modes,
6742 .need_dac_fix = 1,
6508 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6743 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
6509 .adc_nids = alc861_adc_nids, 6744 .adc_nids = alc861_adc_nids,
6510 .input_mux = &alc861_capture_source, 6745 .input_mux = &alc861_capture_source,
@@ -6528,10 +6763,25 @@ static struct alc_config_preset alc861_presets[] = {
6528 .dac_nids = alc660_dac_nids, 6763 .dac_nids = alc660_dac_nids,
6529 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6764 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
6530 .channel_mode = alc861_threestack_modes, 6765 .channel_mode = alc861_threestack_modes,
6766 .need_dac_fix = 1,
6767 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
6768 .adc_nids = alc861_adc_nids,
6769 .input_mux = &alc861_capture_source,
6770 },
6771 [ALC861_UNIWILL_M31] = {
6772 .mixers = { alc861_uniwill_m31_mixer },
6773 .init_verbs = { alc861_uniwill_m31_init_verbs },
6774 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
6775 .dac_nids = alc861_dac_nids,
6776 .dig_out_nid = ALC861_DIGOUT_NID,
6777 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
6778 .channel_mode = alc861_uniwill_m31_modes,
6779 .need_dac_fix = 1,
6531 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6780 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
6532 .adc_nids = alc861_adc_nids, 6781 .adc_nids = alc861_adc_nids,
6533 .input_mux = &alc861_capture_source, 6782 .input_mux = &alc861_capture_source,
6534 }, 6783 },
6784
6535}; 6785};
6536 6786
6537 6787