diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 75 |
1 files changed, 68 insertions, 7 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 2d3f4f893ef3..c7465053d6bb 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 | ||
@@ -900,6 +904,7 @@ static void setup_preset(struct hda_codec *codec, | |||
900 | spec->unsol_event = preset->unsol_event; | 904 | spec->unsol_event = preset->unsol_event; |
901 | spec->init_hook = preset->init_hook; | 905 | spec->init_hook = preset->init_hook; |
902 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 906 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
907 | spec->power_hook = preset->power_hook; | ||
903 | spec->loopback.amplist = preset->loopbacks; | 908 | spec->loopback.amplist = preset->loopbacks; |
904 | #endif | 909 | #endif |
905 | 910 | ||
@@ -1665,9 +1670,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |||
1665 | /* some bit here disables the other DACs. Init=0x4900 */ | 1670 | /* some bit here disables the other DACs. Init=0x4900 */ |
1666 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | 1671 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
1667 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | 1672 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
1668 | /* Enable amplifiers */ | ||
1669 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1670 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1671 | /* DMIC fix | 1673 | /* DMIC fix |
1672 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | 1674 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
1673 | * which makes the stereo useless. However, either the mic or the ALC889 | 1675 | * which makes the stereo useless. However, either the mic or the ALC889 |
@@ -1780,6 +1782,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1780 | { } /* end */ | 1782 | { } /* end */ |
1781 | }; | 1783 | }; |
1782 | 1784 | ||
1785 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
1786 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1787 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1788 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1789 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1790 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
1791 | HDA_OUTPUT), | ||
1792 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1793 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1794 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1795 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1796 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1797 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1798 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
1799 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1800 | { } /* end */ | ||
1801 | }; | ||
1802 | |||
1803 | |||
1783 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | 1804 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1784 | { | 1805 | { |
1785 | struct alc_spec *spec = codec->spec; | 1806 | struct alc_spec *spec = codec->spec; |
@@ -1810,6 +1831,16 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec) | |||
1810 | spec->autocfg.speaker_pins[2] = 0x1b; | 1831 | spec->autocfg.speaker_pins[2] = 0x1b; |
1811 | } | 1832 | } |
1812 | 1833 | ||
1834 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
1835 | static void alc889_power_eapd(struct hda_codec *codec, int power) | ||
1836 | { | ||
1837 | snd_hda_codec_write(codec, 0x14, 0, | ||
1838 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | ||
1839 | snd_hda_codec_write(codec, 0x15, 0, | ||
1840 | AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0); | ||
1841 | } | ||
1842 | #endif | ||
1843 | |||
1813 | /* | 1844 | /* |
1814 | * ALC880 3-stack model | 1845 | * ALC880 3-stack model |
1815 | * | 1846 | * |
@@ -3603,12 +3634,29 @@ static void alc_free(struct hda_codec *codec) | |||
3603 | snd_hda_detach_beep_device(codec); | 3634 | snd_hda_detach_beep_device(codec); |
3604 | } | 3635 | } |
3605 | 3636 | ||
3637 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3638 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | ||
3639 | { | ||
3640 | struct alc_spec *spec = codec->spec; | ||
3641 | if (spec && spec->power_hook) | ||
3642 | spec->power_hook(codec, 0); | ||
3643 | return 0; | ||
3644 | } | ||
3645 | #endif | ||
3646 | |||
3606 | #ifdef SND_HDA_NEEDS_RESUME | 3647 | #ifdef SND_HDA_NEEDS_RESUME |
3607 | static int alc_resume(struct hda_codec *codec) | 3648 | static int alc_resume(struct hda_codec *codec) |
3608 | { | 3649 | { |
3650 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3651 | struct alc_spec *spec = codec->spec; | ||
3652 | #endif | ||
3609 | codec->patch_ops.init(codec); | 3653 | codec->patch_ops.init(codec); |
3610 | snd_hda_codec_resume_amp(codec); | 3654 | snd_hda_codec_resume_amp(codec); |
3611 | snd_hda_codec_resume_cache(codec); | 3655 | snd_hda_codec_resume_cache(codec); |
3656 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3657 | if (spec && spec->power_hook) | ||
3658 | spec->power_hook(codec, 1); | ||
3659 | #endif | ||
3612 | return 0; | 3660 | return 0; |
3613 | } | 3661 | } |
3614 | #endif | 3662 | #endif |
@@ -3625,6 +3673,7 @@ static struct hda_codec_ops alc_patch_ops = { | |||
3625 | .resume = alc_resume, | 3673 | .resume = alc_resume, |
3626 | #endif | 3674 | #endif |
3627 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3675 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3676 | .suspend = alc_suspend, | ||
3628 | .check_power_status = alc_check_power_status, | 3677 | .check_power_status = alc_check_power_status, |
3629 | #endif | 3678 | #endif |
3630 | }; | 3679 | }; |
@@ -9381,10 +9430,11 @@ static struct alc_config_preset alc882_presets[] = { | |||
9381 | .init_hook = alc_automute_amp, | 9430 | .init_hook = alc_automute_amp, |
9382 | }, | 9431 | }, |
9383 | [ALC888_ACER_ASPIRE_8930G] = { | 9432 | [ALC888_ACER_ASPIRE_8930G] = { |
9384 | .mixers = { alc888_base_mixer, | 9433 | .mixers = { alc889_acer_aspire_8930g_mixer, |
9385 | alc883_chmode_mixer }, | 9434 | alc883_chmode_mixer }, |
9386 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | 9435 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
9387 | alc889_acer_aspire_8930g_verbs }, | 9436 | alc889_acer_aspire_8930g_verbs, |
9437 | alc889_eapd_verbs}, | ||
9388 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9438 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9389 | .dac_nids = alc883_dac_nids, | 9439 | .dac_nids = alc883_dac_nids, |
9390 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | 9440 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
@@ -9401,6 +9451,9 @@ static struct alc_config_preset alc882_presets[] = { | |||
9401 | .unsol_event = alc_automute_amp_unsol_event, | 9451 | .unsol_event = alc_automute_amp_unsol_event, |
9402 | .setup = alc889_acer_aspire_8930g_setup, | 9452 | .setup = alc889_acer_aspire_8930g_setup, |
9403 | .init_hook = alc_automute_amp, | 9453 | .init_hook = alc_automute_amp, |
9454 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
9455 | .power_hook = alc889_power_eapd, | ||
9456 | #endif | ||
9404 | }, | 9457 | }, |
9405 | [ALC888_ACER_ASPIRE_7730G] = { | 9458 | [ALC888_ACER_ASPIRE_7730G] = { |
9406 | .mixers = { alc883_3ST_6ch_mixer, | 9459 | .mixers = { alc883_3ST_6ch_mixer, |
@@ -10684,6 +10737,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |||
10684 | {} | 10737 | {} |
10685 | }; | 10738 | }; |
10686 | 10739 | ||
10740 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
10741 | /* Front Mic pin: input vref at 50% */ | ||
10742 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
10743 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
10744 | {} | ||
10745 | }; | ||
10746 | |||
10687 | static struct hda_input_mux alc262_fujitsu_capture_source = { | 10747 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
10688 | .num_items = 3, | 10748 | .num_items = 3, |
10689 | .items = { | 10749 | .items = { |
@@ -11726,7 +11786,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11726 | [ALC262_LENOVO_3000] = { | 11786 | [ALC262_LENOVO_3000] = { |
11727 | .mixers = { alc262_lenovo_3000_mixer }, | 11787 | .mixers = { alc262_lenovo_3000_mixer }, |
11728 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | 11788 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
11729 | alc262_lenovo_3000_unsol_verbs }, | 11789 | alc262_lenovo_3000_unsol_verbs, |
11790 | alc262_lenovo_3000_init_verbs }, | ||
11730 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11791 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11731 | .dac_nids = alc262_dac_nids, | 11792 | .dac_nids = alc262_dac_nids, |
11732 | .hp_nid = 0x03, | 11793 | .hp_nid = 0x03, |
@@ -12863,7 +12924,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
12863 | int board_config; | 12924 | int board_config; |
12864 | int i, has_beep, err; | 12925 | int i, has_beep, err; |
12865 | 12926 | ||
12866 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 12927 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
12867 | if (spec == NULL) | 12928 | if (spec == NULL) |
12868 | return -ENOMEM; | 12929 | return -ENOMEM; |
12869 | 12930 | ||