diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 79 |
1 files changed, 72 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 012435212e58..e7cdc6a7d61d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -337,6 +337,9 @@ struct alc_spec { | |||
337 | /* hooks */ | 337 | /* hooks */ |
338 | void (*init_hook)(struct hda_codec *codec); | 338 | void (*init_hook)(struct hda_codec *codec); |
339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | 339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
340 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
341 | void (*power_hook)(struct hda_codec *codec, int power); | ||
342 | #endif | ||
340 | 343 | ||
341 | /* for pin sensing */ | 344 | /* for pin sensing */ |
342 | unsigned int sense_updated: 1; | 345 | unsigned int sense_updated: 1; |
@@ -388,6 +391,7 @@ struct alc_config_preset { | |||
388 | void (*init_hook)(struct hda_codec *); | 391 | void (*init_hook)(struct hda_codec *); |
389 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
390 | struct hda_amp_list *loopbacks; | 393 | struct hda_amp_list *loopbacks; |
394 | void (*power_hook)(struct hda_codec *codec, int power); | ||
391 | #endif | 395 | #endif |
392 | }; | 396 | }; |
393 | 397 | ||
@@ -904,6 +908,7 @@ static void setup_preset(struct hda_codec *codec, | |||
904 | spec->unsol_event = preset->unsol_event; | 908 | spec->unsol_event = preset->unsol_event; |
905 | spec->init_hook = preset->init_hook; | 909 | spec->init_hook = preset->init_hook; |
906 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 910 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
911 | spec->power_hook = preset->power_hook; | ||
907 | spec->loopback.amplist = preset->loopbacks; | 912 | spec->loopback.amplist = preset->loopbacks; |
908 | #endif | 913 | #endif |
909 | 914 | ||
@@ -1669,9 +1674,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |||
1669 | /* some bit here disables the other DACs. Init=0x4900 */ | 1674 | /* some bit here disables the other DACs. Init=0x4900 */ |
1670 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | 1675 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
1671 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | 1676 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
1672 | /* Enable amplifiers */ | ||
1673 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1674 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1675 | /* DMIC fix | 1677 | /* DMIC fix |
1676 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | 1678 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
1677 | * which makes the stereo useless. However, either the mic or the ALC889 | 1679 | * which makes the stereo useless. However, either the mic or the ALC889 |
@@ -1784,6 +1786,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1784 | { } /* end */ | 1786 | { } /* end */ |
1785 | }; | 1787 | }; |
1786 | 1788 | ||
1789 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
1790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1791 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1792 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1793 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1794 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
1795 | HDA_OUTPUT), | ||
1796 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1797 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1798 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1802 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
1803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1804 | { } /* end */ | ||
1805 | }; | ||
1806 | |||
1807 | |||
1787 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | 1808 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1788 | { | 1809 | { |
1789 | struct alc_spec *spec = codec->spec; | 1810 | struct alc_spec *spec = codec->spec; |
@@ -1814,6 +1835,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |||
1814 | spec->autocfg.speaker_pins[2] = 0x1b; | 1835 | spec->autocfg.speaker_pins[2] = 0x1b; |
1815 | } | 1836 | } |
1816 | 1837 | ||
1838 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
1839 | static void alc889_power_eapd(struct hda_codec *codec, int power) | ||
1840 | { | ||
1841 | snd_hda_codec_write(codec, 0x14, 0, | ||
1842 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | ||
1843 | snd_hda_codec_write(codec, 0x15, 0, | ||
1844 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | ||
1845 | } | ||
1846 | #endif | ||
1847 | |||
1817 | /* | 1848 | /* |
1818 | * ALC880 3-stack model | 1849 | * ALC880 3-stack model |
1819 | * | 1850 | * |
@@ -3688,12 +3719,29 @@ static void alc_free(struct hda_codec *codec) | |||
3688 | snd_hda_detach_beep_device(codec); | 3719 | snd_hda_detach_beep_device(codec); |
3689 | } | 3720 | } |
3690 | 3721 | ||
3722 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3723 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | ||
3724 | { | ||
3725 | struct alc_spec *spec = codec->spec; | ||
3726 | if (spec && spec->power_hook) | ||
3727 | spec->power_hook(codec, 0); | ||
3728 | return 0; | ||
3729 | } | ||
3730 | #endif | ||
3731 | |||
3691 | #ifdef SND_HDA_NEEDS_RESUME | 3732 | #ifdef SND_HDA_NEEDS_RESUME |
3692 | static int alc_resume(struct hda_codec *codec) | 3733 | static int alc_resume(struct hda_codec *codec) |
3693 | { | 3734 | { |
3735 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3736 | struct alc_spec *spec = codec->spec; | ||
3737 | #endif | ||
3694 | codec->patch_ops.init(codec); | 3738 | codec->patch_ops.init(codec); |
3695 | snd_hda_codec_resume_amp(codec); | 3739 | snd_hda_codec_resume_amp(codec); |
3696 | snd_hda_codec_resume_cache(codec); | 3740 | snd_hda_codec_resume_cache(codec); |
3741 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3742 | if (spec && spec->power_hook) | ||
3743 | spec->power_hook(codec, 1); | ||
3744 | #endif | ||
3697 | return 0; | 3745 | return 0; |
3698 | } | 3746 | } |
3699 | #endif | 3747 | #endif |
@@ -3710,6 +3758,7 @@ static struct hda_codec_ops alc_patch_ops = { | |||
3710 | .resume = alc_resume, | 3758 | .resume = alc_resume, |
3711 | #endif | 3759 | #endif |
3712 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3760 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3761 | .suspend = alc_suspend, | ||
3713 | .check_power_status = alc_check_power_status, | 3762 | .check_power_status = alc_check_power_status, |
3714 | #endif | 3763 | #endif |
3715 | }; | 3764 | }; |
@@ -9010,7 +9059,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9010 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 9059 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
9011 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 9060 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
9012 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | 9061 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
9013 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | 9062 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
9014 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | 9063 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
9015 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 9064 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
9016 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | 9065 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
@@ -9373,6 +9422,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9373 | .dac_nids = alc883_dac_nids, | 9422 | .dac_nids = alc883_dac_nids, |
9374 | .adc_nids = alc883_adc_nids_alt, | 9423 | .adc_nids = alc883_adc_nids_alt, |
9375 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9424 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9425 | .capsrc_nids = alc883_capsrc_nids, | ||
9376 | .dig_out_nid = ALC883_DIGOUT_NID, | 9426 | .dig_out_nid = ALC883_DIGOUT_NID, |
9377 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9427 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9378 | .channel_mode = alc883_3ST_2ch_modes, | 9428 | .channel_mode = alc883_3ST_2ch_modes, |
@@ -9469,10 +9519,11 @@ static struct alc_config_preset alc882_presets[] = { | |||
9469 | .init_hook = alc_automute_amp, | 9519 | .init_hook = alc_automute_amp, |
9470 | }, | 9520 | }, |
9471 | [ALC888_ACER_ASPIRE_8930G] = { | 9521 | [ALC888_ACER_ASPIRE_8930G] = { |
9472 | .mixers = { alc888_base_mixer, | 9522 | .mixers = { alc889_acer_aspire_8930g_mixer, |
9473 | alc883_chmode_mixer }, | 9523 | alc883_chmode_mixer }, |
9474 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | 9524 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
9475 | alc889_acer_aspire_8930g_verbs }, | 9525 | alc889_acer_aspire_8930g_verbs, |
9526 | alc889_eapd_verbs}, | ||
9476 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9527 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9477 | .dac_nids = alc883_dac_nids, | 9528 | .dac_nids = alc883_dac_nids, |
9478 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | 9529 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
@@ -9489,6 +9540,9 @@ static struct alc_config_preset alc882_presets[] = { | |||
9489 | .unsol_event = alc_automute_amp_unsol_event, | 9540 | .unsol_event = alc_automute_amp_unsol_event, |
9490 | .setup = alc889_acer_aspire_8930g_setup, | 9541 | .setup = alc889_acer_aspire_8930g_setup, |
9491 | .init_hook = alc_automute_amp, | 9542 | .init_hook = alc_automute_amp, |
9543 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
9544 | .power_hook = alc889_power_eapd, | ||
9545 | #endif | ||
9492 | }, | 9546 | }, |
9493 | [ALC888_ACER_ASPIRE_7730G] = { | 9547 | [ALC888_ACER_ASPIRE_7730G] = { |
9494 | .mixers = { alc883_3ST_6ch_mixer, | 9548 | .mixers = { alc883_3ST_6ch_mixer, |
@@ -9519,6 +9573,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9519 | .dac_nids = alc883_dac_nids, | 9573 | .dac_nids = alc883_dac_nids, |
9520 | .adc_nids = alc883_adc_nids_alt, | 9574 | .adc_nids = alc883_adc_nids_alt, |
9521 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9575 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9576 | .capsrc_nids = alc883_capsrc_nids, | ||
9522 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 9577 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
9523 | .channel_mode = alc883_sixstack_modes, | 9578 | .channel_mode = alc883_sixstack_modes, |
9524 | .input_mux = &alc883_capture_source, | 9579 | .input_mux = &alc883_capture_source, |
@@ -9580,6 +9635,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9580 | .dac_nids = alc883_dac_nids, | 9635 | .dac_nids = alc883_dac_nids, |
9581 | .adc_nids = alc883_adc_nids_alt, | 9636 | .adc_nids = alc883_adc_nids_alt, |
9582 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9637 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9638 | .capsrc_nids = alc883_capsrc_nids, | ||
9583 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9639 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9584 | .channel_mode = alc883_3ST_2ch_modes, | 9640 | .channel_mode = alc883_3ST_2ch_modes, |
9585 | .input_mux = &alc883_lenovo_101e_capture_source, | 9641 | .input_mux = &alc883_lenovo_101e_capture_source, |
@@ -9759,6 +9815,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9759 | alc880_gpio1_init_verbs }, | 9815 | alc880_gpio1_init_verbs }, |
9760 | .adc_nids = alc883_adc_nids, | 9816 | .adc_nids = alc883_adc_nids, |
9761 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | 9817 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
9818 | .capsrc_nids = alc883_capsrc_nids, | ||
9762 | .dac_nids = alc883_dac_nids, | 9819 | .dac_nids = alc883_dac_nids, |
9763 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9820 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9764 | .channel_mode = alc889A_mb31_6ch_modes, | 9821 | .channel_mode = alc889A_mb31_6ch_modes, |
@@ -10781,6 +10838,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |||
10781 | {} | 10838 | {} |
10782 | }; | 10839 | }; |
10783 | 10840 | ||
10841 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
10842 | /* Front Mic pin: input vref at 50% */ | ||
10843 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
10844 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
10845 | {} | ||
10846 | }; | ||
10847 | |||
10784 | static struct hda_input_mux alc262_fujitsu_capture_source = { | 10848 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
10785 | .num_items = 3, | 10849 | .num_items = 3, |
10786 | .items = { | 10850 | .items = { |
@@ -11835,7 +11899,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11835 | [ALC262_LENOVO_3000] = { | 11899 | [ALC262_LENOVO_3000] = { |
11836 | .mixers = { alc262_lenovo_3000_mixer }, | 11900 | .mixers = { alc262_lenovo_3000_mixer }, |
11837 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | 11901 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
11838 | alc262_lenovo_3000_unsol_verbs }, | 11902 | alc262_lenovo_3000_unsol_verbs, |
11903 | alc262_lenovo_3000_init_verbs }, | ||
11839 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11904 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11840 | .dac_nids = alc262_dac_nids, | 11905 | .dac_nids = alc262_dac_nids, |
11841 | .hp_nid = 0x03, | 11906 | .hp_nid = 0x03, |