diff options
author | Kailang Yang <kailang@realtek.com> | 2014-03-17 01:51:27 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-03-18 02:14:42 -0400 |
commit | 6bd55b04fe05cb26094b0fe494c7a207e6c0c36e (patch) | |
tree | 239ec6048ad94192733d8837a311c47fafd9c681 /sound/pci | |
parent | 5e3a227a64a1c9add0a4091989ef490342f716cf (diff) |
ALSA: hda/realtek - Restore default value for ALC283
Restore the registers to prevent the abnormal digital power supply
rising ratio/sequence to the codec and causing the incorrect default
codec register restoration during initialization.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=71861
Signed-off-by: Kailang Yang <kailang@realtek.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8d0a84436674..e86579d476ec 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2786,6 +2786,89 @@ static void alc269_shutup(struct hda_codec *codec) | |||
2786 | snd_hda_shutup_pins(codec); | 2786 | snd_hda_shutup_pins(codec); |
2787 | } | 2787 | } |
2788 | 2788 | ||
2789 | static void alc283_restore_default_value(struct hda_codec *codec) | ||
2790 | { | ||
2791 | int val; | ||
2792 | |||
2793 | /* Power Down Control */ | ||
2794 | alc_write_coef_idx(codec, 0x03, 0x0002); | ||
2795 | /* FIFO and filter clock */ | ||
2796 | alc_write_coef_idx(codec, 0x05, 0x0700); | ||
2797 | /* DMIC control */ | ||
2798 | alc_write_coef_idx(codec, 0x07, 0x0200); | ||
2799 | /* Analog clock */ | ||
2800 | val = alc_read_coef_idx(codec, 0x06); | ||
2801 | alc_write_coef_idx(codec, 0x06, (val & ~0x00f0) | 0x0); | ||
2802 | /* JD */ | ||
2803 | val = alc_read_coef_idx(codec, 0x08); | ||
2804 | alc_write_coef_idx(codec, 0x08, (val & ~0xfffc) | 0x0c2c); | ||
2805 | /* JD offset1 */ | ||
2806 | alc_write_coef_idx(codec, 0x0a, 0xcccc); | ||
2807 | /* JD offset2 */ | ||
2808 | alc_write_coef_idx(codec, 0x0b, 0xcccc); | ||
2809 | /* LDO1/2/3, DAC/ADC */ | ||
2810 | alc_write_coef_idx(codec, 0x0e, 0x6fc0); | ||
2811 | /* JD */ | ||
2812 | val = alc_read_coef_idx(codec, 0x0f); | ||
2813 | alc_write_coef_idx(codec, 0x0f, (val & ~0xf800) | 0x1000); | ||
2814 | /* Capless */ | ||
2815 | val = alc_read_coef_idx(codec, 0x10); | ||
2816 | alc_write_coef_idx(codec, 0x10, (val & ~0xfc00) | 0x0c00); | ||
2817 | /* Class D test 4 */ | ||
2818 | alc_write_coef_idx(codec, 0x3a, 0x0); | ||
2819 | /* IO power down directly */ | ||
2820 | val = alc_read_coef_idx(codec, 0x0c); | ||
2821 | alc_write_coef_idx(codec, 0x0c, (val & ~0xfe00) | 0x0); | ||
2822 | /* ANC */ | ||
2823 | alc_write_coef_idx(codec, 0x22, 0xa0c0); | ||
2824 | /* AGC MUX */ | ||
2825 | val = alc_read_coefex_idx(codec, 0x53, 0x01); | ||
2826 | alc_write_coefex_idx(codec, 0x53, 0x01, (val & ~0x000f) | 0x0008); | ||
2827 | /* DAC simple content protection */ | ||
2828 | val = alc_read_coef_idx(codec, 0x1d); | ||
2829 | alc_write_coef_idx(codec, 0x1d, (val & ~0x00e0) | 0x0); | ||
2830 | /* ADC simple content protection */ | ||
2831 | val = alc_read_coef_idx(codec, 0x1f); | ||
2832 | alc_write_coef_idx(codec, 0x1f, (val & ~0x00e0) | 0x0); | ||
2833 | /* DAC ADC Zero Detection */ | ||
2834 | alc_write_coef_idx(codec, 0x21, 0x8804); | ||
2835 | /* PLL */ | ||
2836 | alc_write_coef_idx(codec, 0x2e, 0x2902); | ||
2837 | /* capless control 2 */ | ||
2838 | alc_write_coef_idx(codec, 0x33, 0xa080); | ||
2839 | /* capless control 3 */ | ||
2840 | alc_write_coef_idx(codec, 0x34, 0x3400); | ||
2841 | /* capless control 4 */ | ||
2842 | alc_write_coef_idx(codec, 0x35, 0x2f3e); | ||
2843 | /* capless control 5 */ | ||
2844 | alc_write_coef_idx(codec, 0x36, 0x0); | ||
2845 | /* class D test 2 */ | ||
2846 | val = alc_read_coef_idx(codec, 0x38); | ||
2847 | alc_write_coef_idx(codec, 0x38, (val & ~0x0fff) | 0x0900); | ||
2848 | /* class D test 3 */ | ||
2849 | alc_write_coef_idx(codec, 0x39, 0x110a); | ||
2850 | /* class D test 5 */ | ||
2851 | val = alc_read_coef_idx(codec, 0x3b); | ||
2852 | alc_write_coef_idx(codec, 0x3b, (val & ~0x00f8) | 0x00d8); | ||
2853 | /* class D test 6 */ | ||
2854 | alc_write_coef_idx(codec, 0x3c, 0x0014); | ||
2855 | /* classD OCP */ | ||
2856 | alc_write_coef_idx(codec, 0x3d, 0xc2ba); | ||
2857 | /* classD pure DC test */ | ||
2858 | val = alc_read_coef_idx(codec, 0x42); | ||
2859 | alc_write_coef_idx(codec, 0x42, (val & ~0x0f80) | 0x0); | ||
2860 | /* test mode */ | ||
2861 | alc_write_coef_idx(codec, 0x49, 0x0); | ||
2862 | /* Class D DC enable */ | ||
2863 | val = alc_read_coef_idx(codec, 0x40); | ||
2864 | alc_write_coef_idx(codec, 0x40, (val & ~0xf800) | 0x9800); | ||
2865 | /* DC offset */ | ||
2866 | val = alc_read_coef_idx(codec, 0x42); | ||
2867 | alc_write_coef_idx(codec, 0x42, (val & ~0xf000) | 0x2000); | ||
2868 | /* Class D amp control */ | ||
2869 | alc_write_coef_idx(codec, 0x37, 0xfc06); | ||
2870 | } | ||
2871 | |||
2789 | static void alc283_init(struct hda_codec *codec) | 2872 | static void alc283_init(struct hda_codec *codec) |
2790 | { | 2873 | { |
2791 | struct alc_spec *spec = codec->spec; | 2874 | struct alc_spec *spec = codec->spec; |
@@ -2793,6 +2876,8 @@ static void alc283_init(struct hda_codec *codec) | |||
2793 | bool hp_pin_sense; | 2876 | bool hp_pin_sense; |
2794 | int val; | 2877 | int val; |
2795 | 2878 | ||
2879 | alc283_restore_default_value(codec); | ||
2880 | |||
2796 | if (!hp_pin) | 2881 | if (!hp_pin) |
2797 | return; | 2882 | return; |
2798 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | 2883 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); |