aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com>2014-03-18 04:45:32 -0400
committerTakashi Iwai <tiwai@suse.de>2014-03-18 04:55:54 -0400
commitcb149cb3a7178ad653e4a1e1deb5100b96a10b2c (patch)
tree8db565d5c01210ba11328afae0f5e9f94c78d634 /sound/pci
parent7b5c7a0240b11b382073361c4ba9257c42d057e9 (diff)
ALSA: hda/realtek - Restore default value for ALC282
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. Signed-off-by: Kailang Yang <kailang@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 054489757528..189b1af7375d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2786,6 +2786,81 @@ static void alc269_shutup(struct hda_codec *codec)
2786 snd_hda_shutup_pins(codec); 2786 snd_hda_shutup_pins(codec);
2787} 2787}
2788 2788
2789static void alc282_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, 0x6e00);
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, 0x6f, 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, 0x34, 0xa0c0);
2824 /* AGC MUX */
2825 val = alc_read_coef_idx(codec, 0x16);
2826 alc_write_coef_idx(codec, 0x16, (val & ~0x0008) | 0x0);
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, 0x63, 0x2902);
2837 /* capless control 2 */
2838 alc_write_coef_idx(codec, 0x68, 0xa080);
2839 /* capless control 3 */
2840 alc_write_coef_idx(codec, 0x69, 0x3400);
2841 /* capless control 4 */
2842 alc_write_coef_idx(codec, 0x6a, 0x2f3e);
2843 /* capless control 5 */
2844 alc_write_coef_idx(codec, 0x6b, 0x0);
2845 /* class D test 2 */
2846 val = alc_read_coef_idx(codec, 0x6d);
2847 alc_write_coef_idx(codec, 0x6d, (val & ~0x0fff) | 0x0900);
2848 /* class D test 3 */
2849 alc_write_coef_idx(codec, 0x6e, 0x110a);
2850 /* class D test 5 */
2851 val = alc_read_coef_idx(codec, 0x70);
2852 alc_write_coef_idx(codec, 0x70, (val & ~0x00f8) | 0x00d8);
2853 /* class D test 6 */
2854 alc_write_coef_idx(codec, 0x71, 0x0014);
2855 /* classD OCP */
2856 alc_write_coef_idx(codec, 0x72, 0xc2ba);
2857 /* classD pure DC test */
2858 val = alc_read_coef_idx(codec, 0x77);
2859 alc_write_coef_idx(codec, 0x77, (val & ~0x0f80) | 0x0);
2860 /* Class D amp control */
2861 alc_write_coef_idx(codec, 0x6c, 0xfc06);
2862}
2863
2789static void alc282_init(struct hda_codec *codec) 2864static void alc282_init(struct hda_codec *codec)
2790{ 2865{
2791 struct alc_spec *spec = codec->spec; 2866 struct alc_spec *spec = codec->spec;
@@ -2793,6 +2868,8 @@ static void alc282_init(struct hda_codec *codec)
2793 bool hp_pin_sense; 2868 bool hp_pin_sense;
2794 int coef78; 2869 int coef78;
2795 2870
2871 alc282_restore_default_value(codec);
2872
2796 if (!hp_pin) 2873 if (!hp_pin)
2797 return; 2874 return;
2798 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); 2875 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);