aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 11:58:44 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 11:58:44 -0500
commit524df55725217b13d5a232fb5badb5846418ea0e (patch)
treec041613577ac7e68737cfd8af16a37d1ed37e6af /sound/pci/hda/patch_realtek.c
parent0f4533979473a456a8adb3869365e12c7a99cf65 (diff)
parent6679ee1870f7ccdd48e2e5c57919240b8f19a6dc (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (252 commits) ASoC: Check progress when reporting periods from i.MX FIQ handler ASoC: Remove a unused variables from i.MX FIQ runtime data ALSA: hda - Add/fix ALC269 FSC and Quanta models ALSA: hda - Add ALC670 codec support OMAP4: PMIC: Add support for twl6030 codec ALSA: hda - remove unnecessary msleep on power state transitions usb/gadget/{f_audio,gmidi}.c: follow recent changes in audio.h ASoC: fsi: Modify over/under run error settlement ASoC: OMAP4: Add McPDM platform driver ASoC: OMAP4: Add support for McPDM ASoC: OMAP: data_type and sync_mode configurable in audio dma ALSA: hda - Add missing description in HD-Audio-Models.txt ALSA: add support for Macbook Air 2,1 internal speaker ALSA: usbaudio: consolidate header files ALSA: usbmixer: bail out early when parsing audio class v2 descriptors ALSA: usbaudio: implement basic set of class v2.0 parser ALSA: usbaudio: introduce new types for audio class v2 ALSA: usbaudio: parse USB descriptors with structs ALSA: hda - enable snoop for Intel Cougar Point ALSA: hda - Remove identical definitions for macmini3 model ...
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c1006
1 files changed, 663 insertions, 343 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index da34095c707f..e8cbe216e912 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -131,8 +131,10 @@ enum {
131enum { 131enum {
132 ALC269_BASIC, 132 ALC269_BASIC,
133 ALC269_QUANTA_FL1, 133 ALC269_QUANTA_FL1,
134 ALC269_ASUS_AMIC, 134 ALC269_AMIC,
135 ALC269_ASUS_DMIC, 135 ALC269_DMIC,
136 ALC269VB_AMIC,
137 ALC269VB_DMIC,
136 ALC269_FUJITSU, 138 ALC269_FUJITSU,
137 ALC269_LIFEBOOK, 139 ALC269_LIFEBOOK,
138 ALC269_AUTO, 140 ALC269_AUTO,
@@ -207,8 +209,10 @@ enum {
207 ALC882_ASUS_A7J, 209 ALC882_ASUS_A7J,
208 ALC882_ASUS_A7M, 210 ALC882_ASUS_A7M,
209 ALC885_MACPRO, 211 ALC885_MACPRO,
212 ALC885_MBA21,
210 ALC885_MBP3, 213 ALC885_MBP3,
211 ALC885_MB5, 214 ALC885_MB5,
215 ALC885_MACMINI3,
212 ALC885_IMAC24, 216 ALC885_IMAC24,
213 ALC885_IMAC91, 217 ALC885_IMAC91,
214 ALC883_3ST_2ch_DIG, 218 ALC883_3ST_2ch_DIG,
@@ -338,7 +342,7 @@ struct alc_spec {
338 void (*init_hook)(struct hda_codec *codec); 342 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 343 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340#ifdef CONFIG_SND_HDA_POWER_SAVE 344#ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power); 345 void (*power_hook)(struct hda_codec *codec);
342#endif 346#endif
343 347
344 /* for pin sensing */ 348 /* for pin sensing */
@@ -391,7 +395,7 @@ struct alc_config_preset {
391 void (*init_hook)(struct hda_codec *); 395 void (*init_hook)(struct hda_codec *);
392#ifdef CONFIG_SND_HDA_POWER_SAVE 396#ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks; 397 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power); 398 void (*power_hook)(struct hda_codec *codec);
395#endif 399#endif
396}; 400};
397 401
@@ -633,6 +637,7 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
633 637
634#define ALC_PIN_MODE(xname, nid, dir) \ 638#define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 639 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
640 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
636 .info = alc_pin_mode_info, \ 641 .info = alc_pin_mode_info, \
637 .get = alc_pin_mode_get, \ 642 .get = alc_pin_mode_get, \
638 .put = alc_pin_mode_put, \ 643 .put = alc_pin_mode_put, \
@@ -684,6 +689,7 @@ static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
684} 689}
685#define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ 690#define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
686 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 691 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
692 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
687 .info = alc_gpio_data_info, \ 693 .info = alc_gpio_data_info, \
688 .get = alc_gpio_data_get, \ 694 .get = alc_gpio_data_get, \
689 .put = alc_gpio_data_put, \ 695 .put = alc_gpio_data_put, \
@@ -738,6 +744,7 @@ static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
738} 744}
739#define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ 745#define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
740 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 746 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
747 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
741 .info = alc_spdif_ctrl_info, \ 748 .info = alc_spdif_ctrl_info, \
742 .get = alc_spdif_ctrl_get, \ 749 .get = alc_spdif_ctrl_get, \
743 .put = alc_spdif_ctrl_put, \ 750 .put = alc_spdif_ctrl_put, \
@@ -791,6 +798,7 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
791 798
792#define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ 799#define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
793 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 800 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
801 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
794 .info = alc_eapd_ctrl_info, \ 802 .info = alc_eapd_ctrl_info, \
795 .get = alc_eapd_ctrl_get, \ 803 .get = alc_eapd_ctrl_get, \
796 .put = alc_eapd_ctrl_put, \ 804 .put = alc_eapd_ctrl_put, \
@@ -837,27 +845,6 @@ static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
837 spec->init_verbs[spec->num_init_verbs++] = verb; 845 spec->init_verbs[spec->num_init_verbs++] = verb;
838} 846}
839 847
840#ifdef CONFIG_PROC_FS
841/*
842 * hook for proc
843 */
844static void print_realtek_coef(struct snd_info_buffer *buffer,
845 struct hda_codec *codec, hda_nid_t nid)
846{
847 int coeff;
848
849 if (nid != 0x20)
850 return;
851 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
852 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
853 coeff = snd_hda_codec_read(codec, nid, 0,
854 AC_VERB_GET_COEF_INDEX, 0);
855 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
856}
857#else
858#define print_realtek_coef NULL
859#endif
860
861/* 848/*
862 * set up from the preset table 849 * set up from the preset table
863 */ 850 */
@@ -1162,6 +1149,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1162 case 0x10ec0888: 1149 case 0x10ec0888:
1163 alc888_coef_init(codec); 1150 alc888_coef_init(codec);
1164 break; 1151 break;
1152#if 0 /* XXX: This may cause the silent output on speaker on some machines */
1165 case 0x10ec0267: 1153 case 0x10ec0267:
1166 case 0x10ec0268: 1154 case 0x10ec0268:
1167 snd_hda_codec_write(codec, 0x20, 0, 1155 snd_hda_codec_write(codec, 0x20, 0,
@@ -1174,6 +1162,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1174 AC_VERB_SET_PROC_COEF, 1162 AC_VERB_SET_PROC_COEF,
1175 tmp | 0x3000); 1163 tmp | 0x3000);
1176 break; 1164 break;
1165#endif /* XXX */
1177 } 1166 }
1178 break; 1167 break;
1179 } 1168 }
@@ -1265,7 +1254,7 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1265 */ 1254 */
1266static int alc_subsystem_id(struct hda_codec *codec, 1255static int alc_subsystem_id(struct hda_codec *codec,
1267 hda_nid_t porta, hda_nid_t porte, 1256 hda_nid_t porta, hda_nid_t porte,
1268 hda_nid_t portd) 1257 hda_nid_t portd, hda_nid_t porti)
1269{ 1258{
1270 unsigned int ass, tmp, i; 1259 unsigned int ass, tmp, i;
1271 unsigned nid; 1260 unsigned nid;
@@ -1291,7 +1280,7 @@ static int alc_subsystem_id(struct hda_codec *codec,
1291 snd_printd("realtek: No valid SSID, " 1280 snd_printd("realtek: No valid SSID, "
1292 "checking pincfg 0x%08x for NID 0x%x\n", 1281 "checking pincfg 0x%08x for NID 0x%x\n",
1293 ass, nid); 1282 ass, nid);
1294 if (!(ass & 1) && !(ass & 0x100000)) 1283 if (!(ass & 1))
1295 return 0; 1284 return 0;
1296 if ((ass >> 30) != 1) /* no physical connection */ 1285 if ((ass >> 30) != 1) /* no physical connection */
1297 return 0; 1286 return 0;
@@ -1351,6 +1340,8 @@ do_sku:
1351 nid = porte; 1340 nid = porte;
1352 else if (tmp == 2) 1341 else if (tmp == 2)
1353 nid = portd; 1342 nid = portd;
1343 else if (tmp == 3)
1344 nid = porti;
1354 else 1345 else
1355 return 1; 1346 return 1;
1356 for (i = 0; i < spec->autocfg.line_outs; i++) 1347 for (i = 0; i < spec->autocfg.line_outs; i++)
@@ -1365,9 +1356,10 @@ do_sku:
1365} 1356}
1366 1357
1367static void alc_ssid_check(struct hda_codec *codec, 1358static void alc_ssid_check(struct hda_codec *codec,
1368 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) 1359 hda_nid_t porta, hda_nid_t porte,
1360 hda_nid_t portd, hda_nid_t porti)
1369{ 1361{
1370 if (!alc_subsystem_id(codec, porta, porte, portd)) { 1362 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1371 struct alc_spec *spec = codec->spec; 1363 struct alc_spec *spec = codec->spec;
1372 snd_printd("realtek: " 1364 snd_printd("realtek: "
1373 "Enable default setup for auto mode as fallback\n"); 1365 "Enable default setup for auto mode as fallback\n");
@@ -1840,14 +1832,6 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1840 spec->autocfg.speaker_pins[2] = 0x1b; 1832 spec->autocfg.speaker_pins[2] = 0x1b;
1841} 1833}
1842 1834
1843#ifdef CONFIG_SND_HDA_POWER_SAVE
1844static void alc889_power_eapd(struct hda_codec *codec, int power)
1845{
1846 set_eapd(codec, 0x14, power);
1847 set_eapd(codec, 0x15, power);
1848}
1849#endif
1850
1851/* 1835/*
1852 * ALC880 3-stack model 1836 * ALC880 3-stack model
1853 * 1837 *
@@ -2450,6 +2434,15 @@ static const char *alc_slave_sws[] = {
2450 * build control elements 2434 * build control elements
2451 */ 2435 */
2452 2436
2437#define NID_MAPPING (-1)
2438
2439#define SUBDEV_SPEAKER_ (0 << 6)
2440#define SUBDEV_HP_ (1 << 6)
2441#define SUBDEV_LINE_ (2 << 6)
2442#define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2443#define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2444#define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2445
2453static void alc_free_kctls(struct hda_codec *codec); 2446static void alc_free_kctls(struct hda_codec *codec);
2454 2447
2455#ifdef CONFIG_SND_HDA_INPUT_BEEP 2448#ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -2464,8 +2457,11 @@ static struct snd_kcontrol_new alc_beep_mixer[] = {
2464static int alc_build_controls(struct hda_codec *codec) 2457static int alc_build_controls(struct hda_codec *codec)
2465{ 2458{
2466 struct alc_spec *spec = codec->spec; 2459 struct alc_spec *spec = codec->spec;
2467 int err; 2460 struct snd_kcontrol *kctl;
2468 int i; 2461 struct snd_kcontrol_new *knew;
2462 int i, j, err;
2463 unsigned int u;
2464 hda_nid_t nid;
2469 2465
2470 for (i = 0; i < spec->num_mixers; i++) { 2466 for (i = 0; i < spec->num_mixers; i++) {
2471 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); 2467 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
@@ -2506,8 +2502,7 @@ static int alc_build_controls(struct hda_codec *codec)
2506 if (!kctl) 2502 if (!kctl)
2507 return -ENOMEM; 2503 return -ENOMEM;
2508 kctl->private_value = spec->beep_amp; 2504 kctl->private_value = spec->beep_amp;
2509 err = snd_hda_ctl_add(codec, 2505 err = snd_hda_ctl_add(codec, 0, kctl);
2510 get_amp_nid_(spec->beep_amp), kctl);
2511 if (err < 0) 2506 if (err < 0)
2512 return err; 2507 return err;
2513 } 2508 }
@@ -2534,6 +2529,75 @@ static int alc_build_controls(struct hda_codec *codec)
2534 } 2529 }
2535 2530
2536 alc_free_kctls(codec); /* no longer needed */ 2531 alc_free_kctls(codec); /* no longer needed */
2532
2533 /* assign Capture Source enums to NID */
2534 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2535 if (!kctl)
2536 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2537 for (i = 0; kctl && i < kctl->count; i++) {
2538 hda_nid_t *nids = spec->capsrc_nids;
2539 if (!nids)
2540 nids = spec->adc_nids;
2541 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2542 if (err < 0)
2543 return err;
2544 }
2545 if (spec->cap_mixer) {
2546 const char *kname = kctl ? kctl->id.name : NULL;
2547 for (knew = spec->cap_mixer; knew->name; knew++) {
2548 if (kname && strcmp(knew->name, kname) == 0)
2549 continue;
2550 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2551 for (i = 0; kctl && i < kctl->count; i++) {
2552 err = snd_hda_add_nid(codec, kctl, i,
2553 spec->adc_nids[i]);
2554 if (err < 0)
2555 return err;
2556 }
2557 }
2558 }
2559
2560 /* other nid->control mapping */
2561 for (i = 0; i < spec->num_mixers; i++) {
2562 for (knew = spec->mixers[i]; knew->name; knew++) {
2563 if (knew->iface != NID_MAPPING)
2564 continue;
2565 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2566 if (kctl == NULL)
2567 continue;
2568 u = knew->subdevice;
2569 for (j = 0; j < 4; j++, u >>= 8) {
2570 nid = u & 0x3f;
2571 if (nid == 0)
2572 continue;
2573 switch (u & 0xc0) {
2574 case SUBDEV_SPEAKER_:
2575 nid = spec->autocfg.speaker_pins[nid];
2576 break;
2577 case SUBDEV_LINE_:
2578 nid = spec->autocfg.line_out_pins[nid];
2579 break;
2580 case SUBDEV_HP_:
2581 nid = spec->autocfg.hp_pins[nid];
2582 break;
2583 default:
2584 continue;
2585 }
2586 err = snd_hda_add_nid(codec, kctl, 0, nid);
2587 if (err < 0)
2588 return err;
2589 }
2590 u = knew->private_value;
2591 for (j = 0; j < 4; j++, u >>= 8) {
2592 nid = u & 0xff;
2593 if (nid == 0)
2594 continue;
2595 err = snd_hda_add_nid(codec, kctl, 0, nid);
2596 if (err < 0)
2597 return err;
2598 }
2599 }
2600 }
2537 return 0; 2601 return 0;
2538} 2602}
2539 2603
@@ -3616,6 +3680,11 @@ static int alc_build_pcms(struct hda_codec *codec)
3616 return 0; 3680 return 0;
3617} 3681}
3618 3682
3683static inline void alc_shutup(struct hda_codec *codec)
3684{
3685 snd_hda_shutup_pins(codec);
3686}
3687
3619static void alc_free_kctls(struct hda_codec *codec) 3688static void alc_free_kctls(struct hda_codec *codec)
3620{ 3689{
3621 struct alc_spec *spec = codec->spec; 3690 struct alc_spec *spec = codec->spec;
@@ -3636,17 +3705,44 @@ static void alc_free(struct hda_codec *codec)
3636 if (!spec) 3705 if (!spec)
3637 return; 3706 return;
3638 3707
3708 alc_shutup(codec);
3639 alc_free_kctls(codec); 3709 alc_free_kctls(codec);
3640 kfree(spec); 3710 kfree(spec);
3641 snd_hda_detach_beep_device(codec); 3711 snd_hda_detach_beep_device(codec);
3642} 3712}
3643 3713
3644#ifdef CONFIG_SND_HDA_POWER_SAVE 3714#ifdef CONFIG_SND_HDA_POWER_SAVE
3715static void alc_power_eapd(struct hda_codec *codec)
3716{
3717 /* We currently only handle front, HP */
3718 switch (codec->vendor_id) {
3719 case 0x10ec0260:
3720 set_eapd(codec, 0x0f, 0);
3721 set_eapd(codec, 0x10, 0);
3722 break;
3723 case 0x10ec0262:
3724 case 0x10ec0267:
3725 case 0x10ec0268:
3726 case 0x10ec0269:
3727 case 0x10ec0270:
3728 case 0x10ec0272:
3729 case 0x10ec0660:
3730 case 0x10ec0662:
3731 case 0x10ec0663:
3732 case 0x10ec0862:
3733 case 0x10ec0889:
3734 set_eapd(codec, 0x14, 0);
3735 set_eapd(codec, 0x15, 0);
3736 break;
3737 }
3738}
3739
3645static int alc_suspend(struct hda_codec *codec, pm_message_t state) 3740static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3646{ 3741{
3647 struct alc_spec *spec = codec->spec; 3742 struct alc_spec *spec = codec->spec;
3743 alc_shutup(codec);
3648 if (spec && spec->power_hook) 3744 if (spec && spec->power_hook)
3649 spec->power_hook(codec, 0); 3745 spec->power_hook(codec);
3650 return 0; 3746 return 0;
3651} 3747}
3652#endif 3748#endif
@@ -3654,16 +3750,9 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3654#ifdef SND_HDA_NEEDS_RESUME 3750#ifdef SND_HDA_NEEDS_RESUME
3655static int alc_resume(struct hda_codec *codec) 3751static int alc_resume(struct hda_codec *codec)
3656{ 3752{
3657#ifdef CONFIG_SND_HDA_POWER_SAVE
3658 struct alc_spec *spec = codec->spec;
3659#endif
3660 codec->patch_ops.init(codec); 3753 codec->patch_ops.init(codec);
3661 snd_hda_codec_resume_amp(codec); 3754 snd_hda_codec_resume_amp(codec);
3662 snd_hda_codec_resume_cache(codec); 3755 snd_hda_codec_resume_cache(codec);
3663#ifdef CONFIG_SND_HDA_POWER_SAVE
3664 if (spec && spec->power_hook)
3665 spec->power_hook(codec, 1);
3666#endif
3667 return 0; 3756 return 0;
3668} 3757}
3669#endif 3758#endif
@@ -3683,6 +3772,7 @@ static struct hda_codec_ops alc_patch_ops = {
3683 .suspend = alc_suspend, 3772 .suspend = alc_suspend,
3684 .check_power_status = alc_check_power_status, 3773 .check_power_status = alc_check_power_status,
3685#endif 3774#endif
3775 .reboot_notify = alc_shutup,
3686}; 3776};
3687 3777
3688 3778
@@ -3839,6 +3929,7 @@ static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3839#define PIN_CTL_TEST(xname,nid) { \ 3929#define PIN_CTL_TEST(xname,nid) { \
3840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3841 .name = xname, \ 3931 .name = xname, \
3932 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3842 .info = alc_test_pin_ctl_info, \ 3933 .info = alc_test_pin_ctl_info, \
3843 .get = alc_test_pin_ctl_get, \ 3934 .get = alc_test_pin_ctl_get, \
3844 .put = alc_test_pin_ctl_put, \ 3935 .put = alc_test_pin_ctl_put, \
@@ -3848,6 +3939,7 @@ static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3848#define PIN_SRC_TEST(xname,nid) { \ 3939#define PIN_SRC_TEST(xname,nid) { \
3849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 3940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3850 .name = xname, \ 3941 .name = xname, \
3942 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3851 .info = alc_test_pin_src_info, \ 3943 .info = alc_test_pin_src_info, \
3852 .get = alc_test_pin_src_get, \ 3944 .get = alc_test_pin_src_get, \
3853 .put = alc_test_pin_src_put, \ 3945 .put = alc_test_pin_src_put, \
@@ -4387,7 +4479,7 @@ static int add_control(struct alc_spec *spec, int type, const char *name,
4387 if (!knew->name) 4479 if (!knew->name)
4388 return -ENOMEM; 4480 return -ENOMEM;
4389 if (get_amp_nid_(val)) 4481 if (get_amp_nid_(val))
4390 knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); 4482 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4391 knew->private_value = val; 4483 knew->private_value = val;
4392 return 0; 4484 return 0;
4393} 4485}
@@ -4770,7 +4862,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4770 spec->num_mux_defs = 1; 4862 spec->num_mux_defs = 1;
4771 spec->input_mux = &spec->private_imux[0]; 4863 spec->input_mux = &spec->private_imux[0];
4772 4864
4773 alc_ssid_check(codec, 0x15, 0x1b, 0x14); 4865 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
4774 4866
4775 return 1; 4867 return 1;
4776} 4868}
@@ -4974,7 +5066,6 @@ static int patch_alc880(struct hda_codec *codec)
4974 if (!spec->loopback.amplist) 5066 if (!spec->loopback.amplist)
4975 spec->loopback.amplist = alc880_loopbacks; 5067 spec->loopback.amplist = alc880_loopbacks;
4976#endif 5068#endif
4977 codec->proc_widget_hook = print_realtek_coef;
4978 5069
4979 return 0; 5070 return 0;
4980} 5071}
@@ -5182,6 +5273,7 @@ static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5182 { 5273 {
5183 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5184 .name = "Master Playback Switch", 5275 .name = "Master Playback Switch",
5276 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5185 .info = snd_ctl_boolean_mono_info, 5277 .info = snd_ctl_boolean_mono_info,
5186 .get = alc260_hp_master_sw_get, 5278 .get = alc260_hp_master_sw_get,
5187 .put = alc260_hp_master_sw_put, 5279 .put = alc260_hp_master_sw_put,
@@ -5220,6 +5312,7 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5220 { 5312 {
5221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5313 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5222 .name = "Master Playback Switch", 5314 .name = "Master Playback Switch",
5315 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5223 .info = snd_ctl_boolean_mono_info, 5316 .info = snd_ctl_boolean_mono_info,
5224 .get = alc260_hp_master_sw_get, 5317 .get = alc260_hp_master_sw_get,
5225 .put = alc260_hp_master_sw_put, 5318 .put = alc260_hp_master_sw_put,
@@ -6303,7 +6396,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
6303 spec->num_mux_defs = 1; 6396 spec->num_mux_defs = 1;
6304 spec->input_mux = &spec->private_imux[0]; 6397 spec->input_mux = &spec->private_imux[0];
6305 6398
6306 alc_ssid_check(codec, 0x10, 0x15, 0x0f); 6399 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6307 6400
6308 return 1; 6401 return 1;
6309} 6402}
@@ -6582,7 +6675,6 @@ static int patch_alc260(struct hda_codec *codec)
6582 if (!spec->loopback.amplist) 6675 if (!spec->loopback.amplist)
6583 spec->loopback.amplist = alc260_loopbacks; 6676 spec->loopback.amplist = alc260_loopbacks;
6584#endif 6677#endif
6585 codec->proc_widget_hook = print_realtek_coef;
6586 6678
6587 return 0; 6679 return 0;
6588} 6680}
@@ -6664,6 +6756,14 @@ static struct hda_input_mux mb5_capture_source = {
6664 }, 6756 },
6665}; 6757};
6666 6758
6759static struct hda_input_mux macmini3_capture_source = {
6760 .num_items = 2,
6761 .items = {
6762 { "Line", 0x2 },
6763 { "CD", 0x4 },
6764 },
6765};
6766
6667static struct hda_input_mux alc883_3stack_6ch_intel = { 6767static struct hda_input_mux alc883_3stack_6ch_intel = {
6668 .num_items = 4, 6768 .num_items = 4,
6669 .items = { 6769 .items = {
@@ -6852,6 +6952,13 @@ static struct hda_channel_mode alc882_sixstack_modes[2] = {
6852 { 8, alc882_sixstack_ch8_init }, 6952 { 8, alc882_sixstack_ch8_init },
6853}; 6953};
6854 6954
6955
6956/* Macbook Air 2,1 */
6957
6958static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
6959 { 2, NULL },
6960};
6961
6855/* 6962/*
6856 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic 6963 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6857 */ 6964 */
@@ -6912,6 +7019,7 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6912 { 6, alc885_mb5_ch6_init }, 7019 { 6, alc885_mb5_ch6_init },
6913}; 7020};
6914 7021
7022#define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
6915 7023
6916/* 7024/*
6917 * 2ch mode 7025 * 2ch mode
@@ -7123,6 +7231,15 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {
7123 { } /* end */ 7231 { } /* end */
7124}; 7232};
7125 7233
7234/* Macbook Air 2,1 same control for HP and internal Speaker */
7235
7236static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7238 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7239 { }
7240};
7241
7242
7126static struct snd_kcontrol_new alc885_mbp3_mixer[] = { 7243static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7127 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 7244 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7128 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), 7245 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
@@ -7156,6 +7273,21 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7156 { } /* end */ 7273 { } /* end */
7157}; 7274};
7158 7275
7276static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7277 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7278 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7279 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7280 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7281 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7282 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7283 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7284 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7286 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7287 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7288 { } /* end */
7289};
7290
7159static struct snd_kcontrol_new alc885_imac91_mixer[] = { 7291static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7160 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 7292 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7161 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), 7293 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
@@ -7247,29 +7379,18 @@ static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7247 7379
7248static struct hda_verb alc882_base_init_verbs[] = { 7380static struct hda_verb alc882_base_init_verbs[] = {
7249 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 7381 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7382 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7253 /* Rear mixer */ 7384 /* Rear mixer */
7254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7385 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7386 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7257 /* CLFE mixer */ 7387 /* CLFE mixer */
7258 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7388 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7261 /* Side mixer */ 7390 /* Side mixer */
7262 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7391 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7265 7393
7266 /* mute analog input loopbacks */
7267 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7268 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7269 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7270 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7271 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7272
7273 /* Front Pin: output 0 (0x0c) */ 7394 /* Front Pin: output 0 (0x0c) */
7274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7395 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7275 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7396 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -7306,14 +7427,8 @@ static struct hda_verb alc882_base_init_verbs[] = {
7306 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 7427 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7307 /* Input mixer2 */ 7428 /* Input mixer2 */
7308 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7309 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7310 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7311 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7312 /* Input mixer3 */ 7430 /* Input mixer3 */
7313 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7315 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7316 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7317 /* ADC2: mute amp left and right */ 7432 /* ADC2: mute amp left and right */
7318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7433 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7319 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7434 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
@@ -7357,26 +7472,17 @@ static struct hda_verb alc_hp15_unsol_verbs[] = {
7357 7472
7358static struct hda_verb alc885_init_verbs[] = { 7473static struct hda_verb alc885_init_verbs[] = {
7359 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 7474 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 7475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7361 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7362 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7363 /* Rear mixer */ 7477 /* Rear mixer */
7364 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 7478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7365 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7366 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7367 /* CLFE mixer */ 7480 /* CLFE mixer */
7368 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 7481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7369 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7370 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7371 /* Side mixer */ 7483 /* Side mixer */
7372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 7484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7373 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7485 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7374 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7375
7376 /* mute analog input loopbacks */
7377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7380 7486
7381 /* Front HP Pin: output 0 (0x0c) */ 7487 /* Front HP Pin: output 0 (0x0c) */
7382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 7488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
@@ -7410,17 +7516,11 @@ static struct hda_verb alc885_init_verbs[] = {
7410 7516
7411 /* Mixer elements: 0x18, , 0x1a, 0x1b */ 7517 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7412 /* Input mixer1 */ 7518 /* Input mixer1 */
7413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 7519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7416 /* Input mixer2 */ 7520 /* Input mixer2 */
7417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7521 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7420 /* Input mixer3 */ 7522 /* Input mixer3 */
7421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7424 /* ADC2: mute amp left and right */ 7524 /* ADC2: mute amp left and right */
7425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7525 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 /* ADC3: mute amp left and right */ 7526 /* ADC3: mute amp left and right */
@@ -7562,6 +7662,76 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7562 { } 7662 { }
7563}; 7663};
7564 7664
7665/* Macmini 3,1 */
7666static struct hda_verb alc885_macmini3_init_verbs[] = {
7667 /* DACs */
7668 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7669 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7670 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7671 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7672 /* Front mixer */
7673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7676 /* Surround mixer */
7677 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7680 /* LFE mixer */
7681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7684 /* HP mixer */
7685 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7686 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7687 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7688 /* Front Pin (0x0c) */
7689 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7690 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7691 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7692 /* LFE Pin (0x0e) */
7693 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7694 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7695 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7696 /* HP Pin (0x0f) */
7697 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7698 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7699 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7700 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7701 /* Line In pin */
7702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7704
7705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7709 { }
7710};
7711
7712
7713static struct hda_verb alc885_mba21_init_verbs[] = {
7714 /*Internal and HP Speaker Mixer*/
7715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7716 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7717 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7718 /*Internal Speaker Pin (0x0c)*/
7719 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
7720 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7721 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7722 /* HP Pin: output 0 (0x0e) */
7723 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7724 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7725 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7726 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
7727 /* Line in (is hp when jack connected)*/
7728 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
7729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7730
7731 { }
7732 };
7733
7734
7565/* Macbook Pro rev3 */ 7735/* Macbook Pro rev3 */
7566static struct hda_verb alc885_mbp3_init_verbs[] = { 7736static struct hda_verb alc885_mbp3_init_verbs[] = {
7567 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 7737 /* Front mixer: unmute input/output amp left and right (volume = 0) */
@@ -7724,54 +7894,35 @@ static void alc885_imac24_setup(struct hda_codec *codec)
7724 spec->autocfg.speaker_pins[1] = 0x1a; 7894 spec->autocfg.speaker_pins[1] = 0x1a;
7725} 7895}
7726 7896
7727static void alc885_mbp3_setup(struct hda_codec *codec) 7897#define alc885_mb5_setup alc885_imac24_setup
7728{ 7898#define alc885_macmini3_setup alc885_imac24_setup
7729 struct alc_spec *spec = codec->spec;
7730
7731 spec->autocfg.hp_pins[0] = 0x15;
7732 spec->autocfg.speaker_pins[0] = 0x14;
7733}
7734 7899
7735static void alc885_mb5_automute(struct hda_codec *codec) 7900/* Macbook Air 2,1 */
7901static void alc885_mba21_setup(struct hda_codec *codec)
7736{ 7902{
7737 unsigned int present; 7903 struct alc_spec *spec = codec->spec;
7738
7739 present = snd_hda_codec_read(codec, 0x14, 0,
7740 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7741 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7742 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7743 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7744 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7745 7904
7905 spec->autocfg.hp_pins[0] = 0x14;
7906 spec->autocfg.speaker_pins[0] = 0x18;
7746} 7907}
7747 7908
7748static void alc885_mb5_unsol_event(struct hda_codec *codec,
7749 unsigned int res)
7750{
7751 /* Headphone insertion or removal. */
7752 if ((res >> 26) == ALC880_HP_EVENT)
7753 alc885_mb5_automute(codec);
7754}
7755 7909
7756static void alc885_imac91_automute(struct hda_codec *codec)
7757{
7758 unsigned int present;
7759 7910
7760 present = snd_hda_codec_read(codec, 0x14, 0, 7911static void alc885_mbp3_setup(struct hda_codec *codec)
7761 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7912{
7762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 7913 struct alc_spec *spec = codec->spec;
7763 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7764 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7765 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7766 7914
7915 spec->autocfg.hp_pins[0] = 0x15;
7916 spec->autocfg.speaker_pins[0] = 0x14;
7767} 7917}
7768 7918
7769static void alc885_imac91_unsol_event(struct hda_codec *codec, 7919static void alc885_imac91_setup(struct hda_codec *codec)
7770 unsigned int res)
7771{ 7920{
7772 /* Headphone insertion or removal. */ 7921 struct alc_spec *spec = codec->spec;
7773 if ((res >> 26) == ALC880_HP_EVENT) 7922
7774 alc885_imac91_automute(codec); 7923 spec->autocfg.hp_pins[0] = 0x14;
7924 spec->autocfg.speaker_pins[0] = 0x15;
7925 spec->autocfg.speaker_pins[1] = 0x1a;
7775} 7926}
7776 7927
7777static struct hda_verb alc882_targa_verbs[] = { 7928static struct hda_verb alc882_targa_verbs[] = {
@@ -7906,18 +8057,6 @@ static struct hda_verb alc883_auto_init_verbs[] = {
7906 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 8057 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 8058 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7908 8059
7909 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7910 * mixer widget
7911 * Note: PASD motherboards uses the Line In 2 as the input for
7912 * front panel mic (mic 2)
7913 */
7914 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7915 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7916 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7917 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7918 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7919 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7920
7921 /* 8060 /*
7922 * Set up output mixers (0x0c - 0x0f) 8061 * Set up output mixers (0x0c - 0x0f)
7923 */ 8062 */
@@ -7942,16 +8081,9 @@ static struct hda_verb alc883_auto_init_verbs[] = {
7942 /* FIXME: use matrix-type input source selection */ 8081 /* FIXME: use matrix-type input source selection */
7943 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 8082 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7944 /* Input mixer2 */ 8083 /* Input mixer2 */
7945 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 8084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7946 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7947 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7948 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7949 /* Input mixer3 */ 8085 /* Input mixer3 */
7950 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 8086 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7951 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7952 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7954
7955 { } 8087 { }
7956}; 8088};
7957 8089
@@ -8938,6 +9070,8 @@ static const char *alc882_models[ALC882_MODEL_LAST] = {
8938 [ALC882_ASUS_A7M] = "asus-a7m", 9070 [ALC882_ASUS_A7M] = "asus-a7m",
8939 [ALC885_MACPRO] = "macpro", 9071 [ALC885_MACPRO] = "macpro",
8940 [ALC885_MB5] = "mb5", 9072 [ALC885_MB5] = "mb5",
9073 [ALC885_MACMINI3] = "macmini3",
9074 [ALC885_MBA21] = "mba21",
8941 [ALC885_MBP3] = "mbp3", 9075 [ALC885_MBP3] = "mbp3",
8942 [ALC885_IMAC24] = "imac24", 9076 [ALC885_IMAC24] = "imac24",
8943 [ALC885_IMAC91] = "imac91", 9077 [ALC885_IMAC91] = "imac91",
@@ -9121,6 +9255,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9121 */ 9255 */
9122 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5), 9256 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9123 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), 9257 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9258 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9124 {} /* terminator */ 9259 {} /* terminator */
9125}; 9260};
9126 9261
@@ -9172,6 +9307,18 @@ static struct alc_config_preset alc882_presets[] = {
9172 .input_mux = &alc882_capture_source, 9307 .input_mux = &alc882_capture_source,
9173 .dig_out_nid = ALC882_DIGOUT_NID, 9308 .dig_out_nid = ALC882_DIGOUT_NID,
9174 }, 9309 },
9310 [ALC885_MBA21] = {
9311 .mixers = { alc885_mba21_mixer },
9312 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9313 .num_dacs = 2,
9314 .dac_nids = alc882_dac_nids,
9315 .channel_mode = alc885_mba21_ch_modes,
9316 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9317 .input_mux = &alc882_capture_source,
9318 .unsol_event = alc_automute_amp_unsol_event,
9319 .setup = alc885_mba21_setup,
9320 .init_hook = alc_automute_amp,
9321 },
9175 [ALC885_MBP3] = { 9322 [ALC885_MBP3] = {
9176 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, 9323 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9177 .init_verbs = { alc885_mbp3_init_verbs, 9324 .init_verbs = { alc885_mbp3_init_verbs,
@@ -9199,8 +9346,24 @@ static struct alc_config_preset alc882_presets[] = {
9199 .input_mux = &mb5_capture_source, 9346 .input_mux = &mb5_capture_source,
9200 .dig_out_nid = ALC882_DIGOUT_NID, 9347 .dig_out_nid = ALC882_DIGOUT_NID,
9201 .dig_in_nid = ALC882_DIGIN_NID, 9348 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc885_mb5_unsol_event, 9349 .unsol_event = alc_automute_amp_unsol_event,
9203 .init_hook = alc885_mb5_automute, 9350 .setup = alc885_mb5_setup,
9351 .init_hook = alc_automute_amp,
9352 },
9353 [ALC885_MACMINI3] = {
9354 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9355 .init_verbs = { alc885_macmini3_init_verbs,
9356 alc880_gpio1_init_verbs },
9357 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9358 .dac_nids = alc882_dac_nids,
9359 .channel_mode = alc885_macmini3_6ch_modes,
9360 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9361 .input_mux = &macmini3_capture_source,
9362 .dig_out_nid = ALC882_DIGOUT_NID,
9363 .dig_in_nid = ALC882_DIGIN_NID,
9364 .unsol_event = alc_automute_amp_unsol_event,
9365 .setup = alc885_macmini3_setup,
9366 .init_hook = alc_automute_amp,
9204 }, 9367 },
9205 [ALC885_MACPRO] = { 9368 [ALC885_MACPRO] = {
9206 .mixers = { alc882_macpro_mixer }, 9369 .mixers = { alc882_macpro_mixer },
@@ -9239,8 +9402,9 @@ static struct alc_config_preset alc882_presets[] = {
9239 .input_mux = &alc882_capture_source, 9402 .input_mux = &alc882_capture_source,
9240 .dig_out_nid = ALC882_DIGOUT_NID, 9403 .dig_out_nid = ALC882_DIGOUT_NID,
9241 .dig_in_nid = ALC882_DIGIN_NID, 9404 .dig_in_nid = ALC882_DIGIN_NID,
9242 .unsol_event = alc885_imac91_unsol_event, 9405 .unsol_event = alc_automute_amp_unsol_event,
9243 .init_hook = alc885_imac91_automute, 9406 .setup = alc885_imac91_setup,
9407 .init_hook = alc_automute_amp,
9244 }, 9408 },
9245 [ALC882_TARGA] = { 9409 [ALC882_TARGA] = {
9246 .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, 9410 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
@@ -9528,7 +9692,7 @@ static struct alc_config_preset alc882_presets[] = {
9528 .setup = alc889_acer_aspire_8930g_setup, 9692 .setup = alc889_acer_aspire_8930g_setup,
9529 .init_hook = alc_automute_amp, 9693 .init_hook = alc_automute_amp,
9530#ifdef CONFIG_SND_HDA_POWER_SAVE 9694#ifdef CONFIG_SND_HDA_POWER_SAVE
9531 .power_hook = alc889_power_eapd, 9695 .power_hook = alc_power_eapd,
9532#endif 9696#endif
9533 }, 9697 },
9534 [ALC888_ACER_ASPIRE_7730G] = { 9698 [ALC888_ACER_ASPIRE_7730G] = {
@@ -10063,7 +10227,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
10063 spec->num_mux_defs = 1; 10227 spec->num_mux_defs = 1;
10064 spec->input_mux = &spec->private_imux[0]; 10228 spec->input_mux = &spec->private_imux[0];
10065 10229
10066 alc_ssid_check(codec, 0x15, 0x1b, 0x14); 10230 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10067 10231
10068 err = alc_auto_add_mic_boost(codec); 10232 err = alc_auto_add_mic_boost(codec);
10069 if (err < 0) 10233 if (err < 0)
@@ -10201,7 +10365,6 @@ static int patch_alc882(struct hda_codec *codec)
10201 if (!spec->loopback.amplist) 10365 if (!spec->loopback.amplist)
10202 spec->loopback.amplist = alc882_loopbacks; 10366 spec->loopback.amplist = alc882_loopbacks;
10203#endif 10367#endif
10204 codec->proc_widget_hook = print_realtek_coef;
10205 10368
10206 return 0; 10369 return 0;
10207} 10370}
@@ -10324,8 +10487,14 @@ static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10324 .info = snd_ctl_boolean_mono_info, \ 10487 .info = snd_ctl_boolean_mono_info, \
10325 .get = alc262_hp_master_sw_get, \ 10488 .get = alc262_hp_master_sw_get, \
10326 .put = alc262_hp_master_sw_put, \ 10489 .put = alc262_hp_master_sw_put, \
10490 }, \
10491 { \
10492 .iface = NID_MAPPING, \
10493 .name = "Master Playback Switch", \
10494 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10327 } 10495 }
10328 10496
10497
10329static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { 10498static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10330 ALC262_HP_MASTER_SWITCH, 10499 ALC262_HP_MASTER_SWITCH,
10331 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 10500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
@@ -10483,6 +10652,12 @@ static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10483 .info = snd_ctl_boolean_mono_info, \ 10652 .info = snd_ctl_boolean_mono_info, \
10484 .get = alc262_hippo_master_sw_get, \ 10653 .get = alc262_hippo_master_sw_get, \
10485 .put = alc262_hippo_master_sw_put, \ 10654 .put = alc262_hippo_master_sw_put, \
10655 }, \
10656 { \
10657 .iface = NID_MAPPING, \
10658 .name = "Master Playback Switch", \
10659 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10660 (SUBDEV_SPEAKER(0) << 16), \
10486 } 10661 }
10487 10662
10488static struct snd_kcontrol_new alc262_hippo_mixer[] = { 10663static struct snd_kcontrol_new alc262_hippo_mixer[] = {
@@ -10963,11 +11138,17 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10963 { 11138 {
10964 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 11139 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10965 .name = "Master Playback Switch", 11140 .name = "Master Playback Switch",
11141 .subdevice = HDA_SUBDEV_AMP_FLAG,
10966 .info = snd_hda_mixer_amp_switch_info, 11142 .info = snd_hda_mixer_amp_switch_info,
10967 .get = snd_hda_mixer_amp_switch_get, 11143 .get = snd_hda_mixer_amp_switch_get,
10968 .put = alc262_fujitsu_master_sw_put, 11144 .put = alc262_fujitsu_master_sw_put,
10969 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 11145 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10970 }, 11146 },
11147 {
11148 .iface = NID_MAPPING,
11149 .name = "Master Playback Switch",
11150 .private_value = 0x1b,
11151 },
10971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 11152 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 11153 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10973 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 11154 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
@@ -10998,6 +11179,7 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10998 { 11179 {
10999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 11180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11000 .name = "Master Playback Switch", 11181 .name = "Master Playback Switch",
11182 .subdevice = HDA_SUBDEV_AMP_FLAG,
11001 .info = snd_hda_mixer_amp_switch_info, 11183 .info = snd_hda_mixer_amp_switch_info,
11002 .get = snd_hda_mixer_amp_switch_get, 11184 .get = snd_hda_mixer_amp_switch_get,
11003 .put = alc262_lenovo_3000_master_sw_put, 11185 .put = alc262_lenovo_3000_master_sw_put,
@@ -11152,6 +11334,11 @@ static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11152 .get = alc_mux_enum_get, 11334 .get = alc_mux_enum_get,
11153 .put = alc262_ultra_mux_enum_put, 11335 .put = alc262_ultra_mux_enum_put,
11154 }, 11336 },
11337 {
11338 .iface = NID_MAPPING,
11339 .name = "Capture Source",
11340 .private_value = 0x15,
11341 },
11155 { } /* end */ 11342 { } /* end */
11156}; 11343};
11157 11344
@@ -11598,7 +11785,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
11598 if (err < 0) 11785 if (err < 0)
11599 return err; 11786 return err;
11600 11787
11601 alc_ssid_check(codec, 0x15, 0x14, 0x1b); 11788 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
11602 11789
11603 return 1; 11790 return 1;
11604} 11791}
@@ -12041,7 +12228,6 @@ static int patch_alc262(struct hda_codec *codec)
12041 if (!spec->loopback.amplist) 12228 if (!spec->loopback.amplist)
12042 spec->loopback.amplist = alc262_loopbacks; 12229 spec->loopback.amplist = alc262_loopbacks;
12043#endif 12230#endif
12044 codec->proc_widget_hook = print_realtek_coef;
12045 12231
12046 return 0; 12232 return 0;
12047} 12233}
@@ -12170,6 +12356,7 @@ static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12170 { 12356 {
12171 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 12357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12172 .name = "Master Playback Switch", 12358 .name = "Master Playback Switch",
12359 .subdevice = HDA_SUBDEV_AMP_FLAG,
12173 .info = snd_hda_mixer_amp_switch_info, 12360 .info = snd_hda_mixer_amp_switch_info,
12174 .get = snd_hda_mixer_amp_switch_get, 12361 .get = snd_hda_mixer_amp_switch_get,
12175 .put = alc268_acer_master_sw_put, 12362 .put = alc268_acer_master_sw_put,
@@ -12185,6 +12372,7 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {
12185 { 12372 {
12186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 12373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12187 .name = "Master Playback Switch", 12374 .name = "Master Playback Switch",
12375 .subdevice = HDA_SUBDEV_AMP_FLAG,
12188 .info = snd_hda_mixer_amp_switch_info, 12376 .info = snd_hda_mixer_amp_switch_info,
12189 .get = snd_hda_mixer_amp_switch_get, 12377 .get = snd_hda_mixer_amp_switch_get,
12190 .put = alc268_acer_master_sw_put, 12378 .put = alc268_acer_master_sw_put,
@@ -12202,6 +12390,7 @@ static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12202 { 12390 {
12203 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 12391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12204 .name = "Master Playback Switch", 12392 .name = "Master Playback Switch",
12393 .subdevice = HDA_SUBDEV_AMP_FLAG,
12205 .info = snd_hda_mixer_amp_switch_info, 12394 .info = snd_hda_mixer_amp_switch_info,
12206 .get = snd_hda_mixer_amp_switch_get, 12395 .get = snd_hda_mixer_amp_switch_get,
12207 .put = alc268_acer_master_sw_put, 12396 .put = alc268_acer_master_sw_put,
@@ -12547,7 +12736,6 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12547 dac = 0x02; 12736 dac = 0x02;
12548 break; 12737 break;
12549 case 0x15: 12738 case 0x15:
12550 case 0x21:
12551 dac = 0x03; 12739 dac = 0x03;
12552 break; 12740 break;
12553 default: 12741 default:
@@ -12768,7 +12956,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
12768 if (err < 0) 12956 if (err < 0)
12769 return err; 12957 return err;
12770 12958
12771 alc_ssid_check(codec, 0x15, 0x1b, 0x14); 12959 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12772 12960
12773 return 1; 12961 return 1;
12774} 12962}
@@ -13105,8 +13293,6 @@ static int patch_alc268(struct hda_codec *codec)
13105 if (board_config == ALC268_AUTO) 13293 if (board_config == ALC268_AUTO)
13106 spec->init_hook = alc268_auto_init; 13294 spec->init_hook = alc268_auto_init;
13107 13295
13108 codec->proc_widget_hook = print_realtek_coef;
13109
13110 return 0; 13296 return 0;
13111} 13297}
13112 13298
@@ -13126,6 +13312,15 @@ static hda_nid_t alc269_capsrc_nids[1] = {
13126 0x23, 13312 0x23,
13127}; 13313};
13128 13314
13315static hda_nid_t alc269vb_adc_nids[1] = {
13316 /* ADC1 */
13317 0x09,
13318};
13319
13320static hda_nid_t alc269vb_capsrc_nids[1] = {
13321 0x22,
13322};
13323
13129/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), 13324/* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13130 * not a mux! 13325 * not a mux!
13131 */ 13326 */
@@ -13155,6 +13350,7 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13155 { 13350 {
13156 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 13351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13157 .name = "Master Playback Switch", 13352 .name = "Master Playback Switch",
13353 .subdevice = HDA_SUBDEV_AMP_FLAG,
13158 .info = snd_hda_mixer_amp_switch_info, 13354 .info = snd_hda_mixer_amp_switch_info,
13159 .get = snd_hda_mixer_amp_switch_get, 13355 .get = snd_hda_mixer_amp_switch_get,
13160 .put = alc268_acer_master_sw_put, 13356 .put = alc268_acer_master_sw_put,
@@ -13175,6 +13371,7 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13175 { 13371 {
13176 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 13372 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13177 .name = "Master Playback Switch", 13373 .name = "Master Playback Switch",
13374 .subdevice = HDA_SUBDEV_AMP_FLAG,
13178 .info = snd_hda_mixer_amp_switch_info, 13375 .info = snd_hda_mixer_amp_switch_info,
13179 .get = snd_hda_mixer_amp_switch_get, 13376 .get = snd_hda_mixer_amp_switch_get,
13180 .put = alc268_acer_master_sw_put, 13377 .put = alc268_acer_master_sw_put,
@@ -13192,7 +13389,7 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13192 { } 13389 { }
13193}; 13390};
13194 13391
13195static struct snd_kcontrol_new alc269_eeepc_mixer[] = { 13392static struct snd_kcontrol_new alc269_laptop_mixer[] = {
13196 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), 13393 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13197 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), 13394 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13198 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 13395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
@@ -13200,16 +13397,47 @@ static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13200 { } /* end */ 13397 { } /* end */
13201}; 13398};
13202 13399
13400static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
13401 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13402 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13403 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
13404 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13405 { } /* end */
13406};
13407
13203/* capture mixer elements */ 13408/* capture mixer elements */
13204static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { 13409static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
13410 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13411 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13413 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13414 { } /* end */
13415};
13416
13417static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
13205 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 13418 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13206 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 13419 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13207 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 13420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13208 { } /* end */ 13421 { } /* end */
13209}; 13422};
13210 13423
13424static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
13425 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13426 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13428 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
13429 { } /* end */
13430};
13431
13432static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
13433 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
13434 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
13435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13436 { } /* end */
13437};
13438
13211/* FSC amilo */ 13439/* FSC amilo */
13212#define alc269_fujitsu_mixer alc269_eeepc_mixer 13440#define alc269_fujitsu_mixer alc269_laptop_mixer
13213 13441
13214static struct hda_verb alc269_quanta_fl1_verbs[] = { 13442static struct hda_verb alc269_quanta_fl1_verbs[] = {
13215 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 13443 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
@@ -13352,7 +13580,7 @@ static void alc269_lifebook_init_hook(struct hda_codec *codec)
13352 alc269_lifebook_mic_autoswitch(codec); 13580 alc269_lifebook_mic_autoswitch(codec);
13353} 13581}
13354 13582
13355static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { 13583static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
13356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 13584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13357 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05}, 13585 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13358 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 13586 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -13363,7 +13591,7 @@ static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13363 {} 13591 {}
13364}; 13592};
13365 13593
13366static struct hda_verb alc269_eeepc_amic_init_verbs[] = { 13594static struct hda_verb alc269_laptop_amic_init_verbs[] = {
13367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 13595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13368 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, 13596 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13369 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, 13597 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
@@ -13373,6 +13601,28 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13373 {} 13601 {}
13374}; 13602};
13375 13603
13604static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
13605 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13606 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
13607 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13608 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13609 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13610 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13611 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13612 {}
13613};
13614
13615static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
13616 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
13617 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
13618 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13619 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13620 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13621 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13622 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13623 {}
13624};
13625
13376/* toggle speaker-output according to the hp-jack state */ 13626/* toggle speaker-output according to the hp-jack state */
13377static void alc269_speaker_automute(struct hda_codec *codec) 13627static void alc269_speaker_automute(struct hda_codec *codec)
13378{ 13628{
@@ -13390,7 +13640,7 @@ static void alc269_speaker_automute(struct hda_codec *codec)
13390} 13640}
13391 13641
13392/* unsolicited event for HP jack sensing */ 13642/* unsolicited event for HP jack sensing */
13393static void alc269_eeepc_unsol_event(struct hda_codec *codec, 13643static void alc269_laptop_unsol_event(struct hda_codec *codec,
13394 unsigned int res) 13644 unsigned int res)
13395{ 13645{
13396 switch (res >> 26) { 13646 switch (res >> 26) {
@@ -13403,7 +13653,7 @@ static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13403 } 13653 }
13404} 13654}
13405 13655
13406static void alc269_eeepc_dmic_setup(struct hda_codec *codec) 13656static void alc269_laptop_dmic_setup(struct hda_codec *codec)
13407{ 13657{
13408 struct alc_spec *spec = codec->spec; 13658 struct alc_spec *spec = codec->spec;
13409 spec->ext_mic.pin = 0x18; 13659 spec->ext_mic.pin = 0x18;
@@ -13413,7 +13663,17 @@ static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13413 spec->auto_mic = 1; 13663 spec->auto_mic = 1;
13414} 13664}
13415 13665
13416static void alc269_eeepc_amic_setup(struct hda_codec *codec) 13666static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
13667{
13668 struct alc_spec *spec = codec->spec;
13669 spec->ext_mic.pin = 0x18;
13670 spec->ext_mic.mux_idx = 0;
13671 spec->int_mic.pin = 0x12;
13672 spec->int_mic.mux_idx = 6;
13673 spec->auto_mic = 1;
13674}
13675
13676static void alc269_laptop_amic_setup(struct hda_codec *codec)
13417{ 13677{
13418 struct alc_spec *spec = codec->spec; 13678 struct alc_spec *spec = codec->spec;
13419 spec->ext_mic.pin = 0x18; 13679 spec->ext_mic.pin = 0x18;
@@ -13423,7 +13683,7 @@ static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13423 spec->auto_mic = 1; 13683 spec->auto_mic = 1;
13424} 13684}
13425 13685
13426static void alc269_eeepc_inithook(struct hda_codec *codec) 13686static void alc269_laptop_inithook(struct hda_codec *codec)
13427{ 13687{
13428 alc269_speaker_automute(codec); 13688 alc269_speaker_automute(codec);
13429 alc_mic_automute(codec); 13689 alc_mic_automute(codec);
@@ -13436,22 +13696,10 @@ static struct hda_verb alc269_init_verbs[] = {
13436 /* 13696 /*
13437 * Unmute ADC0 and set the default input to mic-in 13697 * Unmute ADC0 and set the default input to mic-in
13438 */ 13698 */
13439 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 13699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13440
13441 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13442 * analog-loopback mixer widget
13443 * Note: PASD motherboards uses the Line In 2 as the input for
13444 * front panel mic (mic 2)
13445 */
13446 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13447 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13452 13700
13453 /* 13701 /*
13454 * Set up output mixers (0x0c - 0x0e) 13702 * Set up output mixers (0x02 - 0x03)
13455 */ 13703 */
13456 /* set vol=0 to output mixers */ 13704 /* set vol=0 to output mixers */
13457 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 13705 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
@@ -13476,26 +13724,57 @@ static struct hda_verb alc269_init_verbs[] = {
13476 13724
13477 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13725 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 13726 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13480 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13481 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13484 13727
13485 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 13728 /* FIXME: use Mux-type input source selection */
13486 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 13729 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13730 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13731 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13487 13732
13488 /* FIXME: use matrix-type input source selection */ 13733 /* set EAPD */
13734 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13735 { }
13736};
13737
13738static struct hda_verb alc269vb_init_verbs[] = {
13739 /*
13740 * Unmute ADC0 and set the default input to mic-in
13741 */
13742 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13743
13744 /*
13745 * Set up output mixers (0x02 - 0x03)
13746 */
13747 /* set vol=0 to output mixers */
13748 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13749 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13750
13751 /* set up input amps for analog loopback */
13752 /* Amp Indices: DAC = 0, mixer = 1 */
13753 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13754 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13755 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13756 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13758 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13759
13760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13761 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13762 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13763 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13765 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13766 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13767
13768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13769 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13770
13771 /* FIXME: use Mux-type input source selection */
13489 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ 13772 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13490 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 13773 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 13774 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
13492 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13493 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13494 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13495 13775
13496 /* set EAPD */ 13776 /* set EAPD */
13497 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 13777 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13498 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13499 { } 13778 { }
13500}; 13779};
13501 13780
@@ -13543,6 +13822,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
13543 struct alc_spec *spec = codec->spec; 13822 struct alc_spec *spec = codec->spec;
13544 int err; 13823 int err;
13545 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 13824 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13825 hda_nid_t real_capsrc_nids;
13546 13826
13547 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 13827 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13548 alc269_ignore); 13828 alc269_ignore);
@@ -13564,11 +13844,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
13564 if (spec->kctls.list) 13844 if (spec->kctls.list)
13565 add_mixer(spec, spec->kctls.list); 13845 add_mixer(spec, spec->kctls.list);
13566 13846
13567 add_verb(spec, alc269_init_verbs); 13847 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) {
13848 add_verb(spec, alc269vb_init_verbs);
13849 real_capsrc_nids = alc269vb_capsrc_nids[0];
13850 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
13851 } else {
13852 add_verb(spec, alc269_init_verbs);
13853 real_capsrc_nids = alc269_capsrc_nids[0];
13854 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13855 }
13856
13568 spec->num_mux_defs = 1; 13857 spec->num_mux_defs = 1;
13569 spec->input_mux = &spec->private_imux[0]; 13858 spec->input_mux = &spec->private_imux[0];
13570 /* set default input source */ 13859 /* set default input source */
13571 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], 13860 snd_hda_codec_write_cache(codec, real_capsrc_nids,
13572 0, AC_VERB_SET_CONNECT_SEL, 13861 0, AC_VERB_SET_CONNECT_SEL,
13573 spec->input_mux->items[0].index); 13862 spec->input_mux->items[0].index);
13574 13863
@@ -13579,8 +13868,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
13579 if (!spec->cap_mixer && !spec->no_analog) 13868 if (!spec->cap_mixer && !spec->no_analog)
13580 set_capture_mixer(codec); 13869 set_capture_mixer(codec);
13581 13870
13582 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13583
13584 return 1; 13871 return 1;
13585} 13872}
13586 13873
@@ -13606,8 +13893,8 @@ static void alc269_auto_init(struct hda_codec *codec)
13606static const char *alc269_models[ALC269_MODEL_LAST] = { 13893static const char *alc269_models[ALC269_MODEL_LAST] = {
13607 [ALC269_BASIC] = "basic", 13894 [ALC269_BASIC] = "basic",
13608 [ALC269_QUANTA_FL1] = "quanta", 13895 [ALC269_QUANTA_FL1] = "quanta",
13609 [ALC269_ASUS_AMIC] = "asus-amic", 13896 [ALC269_AMIC] = "laptop-amic",
13610 [ALC269_ASUS_DMIC] = "asus-dmic", 13897 [ALC269_DMIC] = "laptop-dmic",
13611 [ALC269_FUJITSU] = "fujitsu", 13898 [ALC269_FUJITSU] = "fujitsu",
13612 [ALC269_LIFEBOOK] = "lifebook", 13899 [ALC269_LIFEBOOK] = "lifebook",
13613 [ALC269_AUTO] = "auto", 13900 [ALC269_AUTO] = "auto",
@@ -13616,43 +13903,57 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {
13616static struct snd_pci_quirk alc269_cfg_tbl[] = { 13903static struct snd_pci_quirk alc269_cfg_tbl[] = {
13617 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), 13904 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13618 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 13905 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13619 ALC269_ASUS_AMIC), 13906 ALC269_AMIC),
13620 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), 13907 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
13621 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), 13908 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
13622 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), 13909 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
13623 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), 13910 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
13624 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), 13911 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
13625 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), 13912 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
13626 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), 13913 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
13627 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), 13914 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
13628 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), 13915 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
13629 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), 13916 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
13630 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), 13917 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
13631 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), 13918 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
13632 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), 13919 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
13633 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), 13920 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
13634 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), 13921 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
13635 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), 13922 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
13636 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), 13923 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
13637 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), 13924 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
13638 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), 13925 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
13639 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), 13926 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
13640 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), 13927 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
13641 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), 13928 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
13642 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), 13929 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
13643 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), 13930 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
13644 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), 13931 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
13645 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), 13932 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
13646 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), 13933 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
13647 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), 13934 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
13935 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
13936 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
13937 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
13938 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
13939 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
13940 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
13941 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
13942 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
13648 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 13943 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13649 ALC269_ASUS_DMIC), 13944 ALC269_DMIC),
13650 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 13945 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13651 ALC269_ASUS_DMIC), 13946 ALC269_DMIC),
13652 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), 13947 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
13653 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), 13948 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
13654 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 13949 SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),
13655 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), 13950 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13951 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
13952 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13953 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
13954 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
13955 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
13956 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
13656 {} 13957 {}
13657}; 13958};
13658 13959
@@ -13680,47 +13981,75 @@ static struct alc_config_preset alc269_presets[] = {
13680 .setup = alc269_quanta_fl1_setup, 13981 .setup = alc269_quanta_fl1_setup,
13681 .init_hook = alc269_quanta_fl1_init_hook, 13982 .init_hook = alc269_quanta_fl1_init_hook,
13682 }, 13983 },
13683 [ALC269_ASUS_AMIC] = { 13984 [ALC269_AMIC] = {
13684 .mixers = { alc269_eeepc_mixer }, 13985 .mixers = { alc269_laptop_mixer },
13685 .cap_mixer = alc269_epc_capture_mixer, 13986 .cap_mixer = alc269_laptop_analog_capture_mixer,
13686 .init_verbs = { alc269_init_verbs, 13987 .init_verbs = { alc269_init_verbs,
13687 alc269_eeepc_amic_init_verbs }, 13988 alc269_laptop_amic_init_verbs },
13688 .num_dacs = ARRAY_SIZE(alc269_dac_nids), 13989 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13689 .dac_nids = alc269_dac_nids, 13990 .dac_nids = alc269_dac_nids,
13690 .hp_nid = 0x03, 13991 .hp_nid = 0x03,
13691 .num_channel_mode = ARRAY_SIZE(alc269_modes), 13992 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13692 .channel_mode = alc269_modes, 13993 .channel_mode = alc269_modes,
13693 .unsol_event = alc269_eeepc_unsol_event, 13994 .unsol_event = alc269_laptop_unsol_event,
13694 .setup = alc269_eeepc_amic_setup, 13995 .setup = alc269_laptop_amic_setup,
13695 .init_hook = alc269_eeepc_inithook, 13996 .init_hook = alc269_laptop_inithook,
13696 }, 13997 },
13697 [ALC269_ASUS_DMIC] = { 13998 [ALC269_DMIC] = {
13698 .mixers = { alc269_eeepc_mixer }, 13999 .mixers = { alc269_laptop_mixer },
13699 .cap_mixer = alc269_epc_capture_mixer, 14000 .cap_mixer = alc269_laptop_digital_capture_mixer,
13700 .init_verbs = { alc269_init_verbs, 14001 .init_verbs = { alc269_init_verbs,
13701 alc269_eeepc_dmic_init_verbs }, 14002 alc269_laptop_dmic_init_verbs },
14003 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14004 .dac_nids = alc269_dac_nids,
14005 .hp_nid = 0x03,
14006 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14007 .channel_mode = alc269_modes,
14008 .unsol_event = alc269_laptop_unsol_event,
14009 .setup = alc269_laptop_dmic_setup,
14010 .init_hook = alc269_laptop_inithook,
14011 },
14012 [ALC269VB_AMIC] = {
14013 .mixers = { alc269vb_laptop_mixer },
14014 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14015 .init_verbs = { alc269vb_init_verbs,
14016 alc269vb_laptop_amic_init_verbs },
14017 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14018 .dac_nids = alc269_dac_nids,
14019 .hp_nid = 0x03,
14020 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14021 .channel_mode = alc269_modes,
14022 .unsol_event = alc269_laptop_unsol_event,
14023 .setup = alc269_laptop_amic_setup,
14024 .init_hook = alc269_laptop_inithook,
14025 },
14026 [ALC269VB_DMIC] = {
14027 .mixers = { alc269vb_laptop_mixer },
14028 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14029 .init_verbs = { alc269vb_init_verbs,
14030 alc269vb_laptop_dmic_init_verbs },
13702 .num_dacs = ARRAY_SIZE(alc269_dac_nids), 14031 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13703 .dac_nids = alc269_dac_nids, 14032 .dac_nids = alc269_dac_nids,
13704 .hp_nid = 0x03, 14033 .hp_nid = 0x03,
13705 .num_channel_mode = ARRAY_SIZE(alc269_modes), 14034 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13706 .channel_mode = alc269_modes, 14035 .channel_mode = alc269_modes,
13707 .unsol_event = alc269_eeepc_unsol_event, 14036 .unsol_event = alc269_laptop_unsol_event,
13708 .setup = alc269_eeepc_dmic_setup, 14037 .setup = alc269vb_laptop_dmic_setup,
13709 .init_hook = alc269_eeepc_inithook, 14038 .init_hook = alc269_laptop_inithook,
13710 }, 14039 },
13711 [ALC269_FUJITSU] = { 14040 [ALC269_FUJITSU] = {
13712 .mixers = { alc269_fujitsu_mixer }, 14041 .mixers = { alc269_fujitsu_mixer },
13713 .cap_mixer = alc269_epc_capture_mixer, 14042 .cap_mixer = alc269_laptop_digital_capture_mixer,
13714 .init_verbs = { alc269_init_verbs, 14043 .init_verbs = { alc269_init_verbs,
13715 alc269_eeepc_dmic_init_verbs }, 14044 alc269_laptop_dmic_init_verbs },
13716 .num_dacs = ARRAY_SIZE(alc269_dac_nids), 14045 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13717 .dac_nids = alc269_dac_nids, 14046 .dac_nids = alc269_dac_nids,
13718 .hp_nid = 0x03, 14047 .hp_nid = 0x03,
13719 .num_channel_mode = ARRAY_SIZE(alc269_modes), 14048 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13720 .channel_mode = alc269_modes, 14049 .channel_mode = alc269_modes,
13721 .unsol_event = alc269_eeepc_unsol_event, 14050 .unsol_event = alc269_laptop_unsol_event,
13722 .setup = alc269_eeepc_dmic_setup, 14051 .setup = alc269_laptop_dmic_setup,
13723 .init_hook = alc269_eeepc_inithook, 14052 .init_hook = alc269_laptop_inithook,
13724 }, 14053 },
13725 [ALC269_LIFEBOOK] = { 14054 [ALC269_LIFEBOOK] = {
13726 .mixers = { alc269_lifebook_mixer }, 14055 .mixers = { alc269_lifebook_mixer },
@@ -13741,6 +14070,7 @@ static int patch_alc269(struct hda_codec *codec)
13741 struct alc_spec *spec; 14070 struct alc_spec *spec;
13742 int board_config; 14071 int board_config;
13743 int err; 14072 int err;
14073 int is_alc269vb = 0;
13744 14074
13745 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 14075 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13746 if (spec == NULL) 14076 if (spec == NULL)
@@ -13757,6 +14087,7 @@ static int patch_alc269(struct hda_codec *codec)
13757 alc_free(codec); 14087 alc_free(codec);
13758 return -ENOMEM; 14088 return -ENOMEM;
13759 } 14089 }
14090 is_alc269vb = 1;
13760 } 14091 }
13761 14092
13762 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, 14093 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
@@ -13792,7 +14123,7 @@ static int patch_alc269(struct hda_codec *codec)
13792 if (board_config != ALC269_AUTO) 14123 if (board_config != ALC269_AUTO)
13793 setup_preset(codec, &alc269_presets[board_config]); 14124 setup_preset(codec, &alc269_presets[board_config]);
13794 14125
13795 if (codec->subsystem_id == 0x17aa3bf8) { 14126 if (board_config == ALC269_QUANTA_FL1) {
13796 /* Due to a hardware problem on Lenovo Ideadpad, we need to 14127 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13797 * fix the sample rate of analog I/O to 44.1kHz 14128 * fix the sample rate of analog I/O to 44.1kHz
13798 */ 14129 */
@@ -13805,9 +14136,16 @@ static int patch_alc269(struct hda_codec *codec)
13805 spec->stream_digital_playback = &alc269_pcm_digital_playback; 14136 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13806 spec->stream_digital_capture = &alc269_pcm_digital_capture; 14137 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13807 14138
13808 spec->adc_nids = alc269_adc_nids; 14139 if (!is_alc269vb) {
13809 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); 14140 spec->adc_nids = alc269_adc_nids;
13810 spec->capsrc_nids = alc269_capsrc_nids; 14141 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
14142 spec->capsrc_nids = alc269_capsrc_nids;
14143 } else {
14144 spec->adc_nids = alc269vb_adc_nids;
14145 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
14146 spec->capsrc_nids = alc269vb_capsrc_nids;
14147 }
14148
13811 if (!spec->cap_mixer) 14149 if (!spec->cap_mixer)
13812 set_capture_mixer(codec); 14150 set_capture_mixer(codec);
13813 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 14151 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
@@ -13821,7 +14159,6 @@ static int patch_alc269(struct hda_codec *codec)
13821 if (!spec->loopback.amplist) 14159 if (!spec->loopback.amplist)
13822 spec->loopback.amplist = alc269_loopbacks; 14160 spec->loopback.amplist = alc269_loopbacks;
13823#endif 14161#endif
13824 codec->proc_widget_hook = print_realtek_coef;
13825 14162
13826 return 0; 14163 return 0;
13827} 14164}
@@ -14684,7 +15021,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
14684 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 15021 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14685 set_capture_mixer(codec); 15022 set_capture_mixer(codec);
14686 15023
14687 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); 15024 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
14688 15025
14689 return 1; 15026 return 1;
14690} 15027}
@@ -14939,13 +15276,16 @@ static int patch_alc861(struct hda_codec *codec)
14939 spec->vmaster_nid = 0x03; 15276 spec->vmaster_nid = 0x03;
14940 15277
14941 codec->patch_ops = alc_patch_ops; 15278 codec->patch_ops = alc_patch_ops;
14942 if (board_config == ALC861_AUTO) 15279 if (board_config == ALC861_AUTO) {
14943 spec->init_hook = alc861_auto_init; 15280 spec->init_hook = alc861_auto_init;
14944#ifdef CONFIG_SND_HDA_POWER_SAVE 15281#ifdef CONFIG_SND_HDA_POWER_SAVE
15282 spec->power_hook = alc_power_eapd;
15283#endif
15284 }
15285#ifdef CONFIG_SND_HDA_POWER_SAVE
14945 if (!spec->loopback.amplist) 15286 if (!spec->loopback.amplist)
14946 spec->loopback.amplist = alc861_loopbacks; 15287 spec->loopback.amplist = alc861_loopbacks;
14947#endif 15288#endif
14948 codec->proc_widget_hook = print_realtek_coef;
14949 15289
14950 return 0; 15290 return 0;
14951} 15291}
@@ -15572,7 +15912,7 @@ static struct alc_config_preset alc861vd_presets[] = {
15572static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 15912static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15573 const struct auto_pin_cfg *cfg) 15913 const struct auto_pin_cfg *cfg)
15574{ 15914{
15575 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); 15915 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15576} 15916}
15577 15917
15578 15918
@@ -15808,7 +16148,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
15808 if (err < 0) 16148 if (err < 0)
15809 return err; 16149 return err;
15810 16150
15811 alc_ssid_check(codec, 0x15, 0x1b, 0x14); 16151 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
15812 16152
15813 return 1; 16153 return 1;
15814} 16154}
@@ -15925,7 +16265,6 @@ static int patch_alc861vd(struct hda_codec *codec)
15925 if (!spec->loopback.amplist) 16265 if (!spec->loopback.amplist)
15926 spec->loopback.amplist = alc861vd_loopbacks; 16266 spec->loopback.amplist = alc861vd_loopbacks;
15927#endif 16267#endif
15928 codec->proc_widget_hook = print_realtek_coef;
15929 16268
15930 return 0; 16269 return 0;
15931} 16270}
@@ -16392,13 +16731,6 @@ static struct hda_verb alc662_init_verbs[] = {
16392 /* ADC: mute amp left and right */ 16731 /* ADC: mute amp left and right */
16393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 16732 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 16733 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16395 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16396
16397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16402 16734
16403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 16735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 16736 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
@@ -16448,6 +16780,28 @@ static struct hda_verb alc662_init_verbs[] = {
16448 { } 16780 { }
16449}; 16781};
16450 16782
16783static struct hda_verb alc663_init_verbs[] = {
16784 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16785 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16786 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16787 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16788 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16789 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16790 { }
16791};
16792
16793static struct hda_verb alc272_init_verbs[] = {
16794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16795 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16796 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16797 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16798 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16799 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16800 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16801 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16802 { }
16803};
16804
16451static struct hda_verb alc662_sue_init_verbs[] = { 16805static struct hda_verb alc662_sue_init_verbs[] = {
16452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, 16806 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, 16807 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
@@ -16467,61 +16821,6 @@ static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16467 {} 16821 {}
16468}; 16822};
16469 16823
16470/*
16471 * generic initialization of ADC, input mixers and output mixers
16472 */
16473static struct hda_verb alc662_auto_init_verbs[] = {
16474 /*
16475 * Unmute ADC and set the default input to mic-in
16476 */
16477 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16478 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16479
16480 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16481 * mixer widget
16482 * Note: PASD motherboards uses the Line In 2 as the input for front
16483 * panel mic (mic 2)
16484 */
16485 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16491
16492 /*
16493 * Set up output mixers (0x0c - 0x0f)
16494 */
16495 /* set vol=0 to output mixers */
16496 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16497 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16498 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16499
16500 /* set up input amps for analog loopback */
16501 /* Amp Indices: DAC = 0, mixer = 1 */
16502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16508
16509
16510 /* FIXME: use matrix-type input source selection */
16511 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16512 /* Input mixer */
16513 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16515 { }
16516};
16517
16518/* additional verbs for ALC663 */
16519static struct hda_verb alc663_auto_init_verbs[] = {
16520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16521 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16522 { }
16523};
16524
16525static struct hda_verb alc663_m51va_init_verbs[] = { 16824static struct hda_verb alc663_m51va_init_verbs[] = {
16526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 16825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 16826 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -17272,6 +17571,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17272 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), 17571 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17273 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), 17572 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17274 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), 17573 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17574 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
17275 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), 17575 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17276 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 17576 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17277 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 17577 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
@@ -17307,6 +17607,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17307 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), 17607 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17308 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), 17608 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17309 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), 17609 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17610 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
17310 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), 17611 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17311 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), 17612 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17312 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), 17613 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
@@ -17334,6 +17635,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17334 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17635 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17335 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17636 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17336 ALC662_3ST_6ch_DIG), 17637 ALC662_3ST_6ch_DIG),
17638 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
17337 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), 17639 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17338 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), 17640 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17339 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 17641 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
@@ -17952,15 +18254,23 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
17952 spec->num_mux_defs = 1; 18254 spec->num_mux_defs = 1;
17953 spec->input_mux = &spec->private_imux[0]; 18255 spec->input_mux = &spec->private_imux[0];
17954 18256
17955 add_verb(spec, alc662_auto_init_verbs); 18257 add_verb(spec, alc662_init_verbs);
17956 if (codec->vendor_id == 0x10ec0663) 18258 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
17957 add_verb(spec, alc663_auto_init_verbs); 18259 codec->vendor_id == 0x10ec0665)
18260 add_verb(spec, alc663_init_verbs);
18261
18262 if (codec->vendor_id == 0x10ec0272)
18263 add_verb(spec, alc272_init_verbs);
17958 18264
17959 err = alc_auto_add_mic_boost(codec); 18265 err = alc_auto_add_mic_boost(codec);
17960 if (err < 0) 18266 if (err < 0)
17961 return err; 18267 return err;
17962 18268
17963 alc_ssid_check(codec, 0x15, 0x1b, 0x14); 18269 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
18270 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
18271 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
18272 else
18273 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17964 18274
17965 return 1; 18275 return 1;
17966} 18276}
@@ -18046,11 +18356,20 @@ static int patch_alc662(struct hda_codec *codec)
18046 18356
18047 if (!spec->cap_mixer) 18357 if (!spec->cap_mixer)
18048 set_capture_mixer(codec); 18358 set_capture_mixer(codec);
18049 if (codec->vendor_id == 0x10ec0662) 18359
18360 switch (codec->vendor_id) {
18361 case 0x10ec0662:
18050 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 18362 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18051 else 18363 break;
18364 case 0x10ec0272:
18365 case 0x10ec0663:
18366 case 0x10ec0665:
18052 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 18367 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18053 18368 break;
18369 case 0x10ec0273:
18370 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
18371 break;
18372 }
18054 spec->vmaster_nid = 0x02; 18373 spec->vmaster_nid = 0x02;
18055 18374
18056 codec->patch_ops = alc_patch_ops; 18375 codec->patch_ops = alc_patch_ops;
@@ -18060,7 +18379,6 @@ static int patch_alc662(struct hda_codec *codec)
18060 if (!spec->loopback.amplist) 18379 if (!spec->loopback.amplist)
18061 spec->loopback.amplist = alc662_loopbacks; 18380 spec->loopback.amplist = alc662_loopbacks;
18062#endif 18381#endif
18063 codec->proc_widget_hook = print_realtek_coef;
18064 18382
18065 return 0; 18383 return 0;
18066} 18384}
@@ -18101,6 +18419,8 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
18101 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", 18419 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18102 .patch = patch_alc662 }, 18420 .patch = patch_alc662 },
18103 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, 18421 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18422 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
18423 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
18104 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 18424 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18105 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 18425 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18106 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, 18426 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },