aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com>2014-03-18 04:15:54 -0400
committerTakashi Iwai <tiwai@suse.de>2014-03-18 04:49:27 -0400
commit7b5c7a0240b11b382073361c4ba9257c42d057e9 (patch)
tree536729746d5e574ddf4e58b5b3ad703318313cab /sound/pci
parent6bd55b04fe05cb26094b0fe494c7a207e6c0c36e (diff)
ALSA: hda/realtek - Fix the noise after suspend and resume on ALC282 codec
When the power state of ALC283 codec goes to D3 or return back to D0, it gives a noise via headphone output. To follow the depop procedure, it will be better. 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.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e86579d476ec..054489757528 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2786,6 +2786,77 @@ 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_init(struct hda_codec *codec)
2790{
2791 struct alc_spec *spec = codec->spec;
2792 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2793 bool hp_pin_sense;
2794 int coef78;
2795
2796 if (!hp_pin)
2797 return;
2798 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2799 coef78 = alc_read_coef_idx(codec, 0x78);
2800
2801 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2802 /* Headphone capless set to high power mode */
2803 alc_write_coef_idx(codec, 0x78, 0x9004);
2804
2805 if (hp_pin_sense)
2806 msleep(2);
2807
2808 snd_hda_codec_write(codec, hp_pin, 0,
2809 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2810
2811 if (hp_pin_sense)
2812 msleep(85);
2813
2814 snd_hda_codec_write(codec, hp_pin, 0,
2815 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2816
2817 if (hp_pin_sense)
2818 msleep(100);
2819
2820 /* Headphone capless set to normal mode */
2821 alc_write_coef_idx(codec, 0x78, coef78);
2822}
2823
2824static void alc282_shutup(struct hda_codec *codec)
2825{
2826 struct alc_spec *spec = codec->spec;
2827 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2828 bool hp_pin_sense;
2829 int coef78;
2830
2831 if (!hp_pin) {
2832 alc269_shutup(codec);
2833 return;
2834 }
2835
2836 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2837 coef78 = alc_read_coef_idx(codec, 0x78);
2838 alc_write_coef_idx(codec, 0x78, 0x9004);
2839
2840 if (hp_pin_sense)
2841 msleep(2);
2842
2843 snd_hda_codec_write(codec, hp_pin, 0,
2844 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2845
2846 if (hp_pin_sense)
2847 msleep(85);
2848
2849 snd_hda_codec_write(codec, hp_pin, 0,
2850 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2851
2852 if (hp_pin_sense)
2853 msleep(100);
2854
2855 alc_auto_setup_eapd(codec, false);
2856 snd_hda_shutup_pins(codec);
2857 alc_write_coef_idx(codec, 0x78, coef78);
2858}
2859
2789static void alc283_restore_default_value(struct hda_codec *codec) 2860static void alc283_restore_default_value(struct hda_codec *codec)
2790{ 2861{
2791 int val; 2862 int val;
@@ -4687,6 +4758,8 @@ static int patch_alc269(struct hda_codec *codec)
4687 break; 4758 break;
4688 case 0x10ec0282: 4759 case 0x10ec0282:
4689 spec->codec_variant = ALC269_TYPE_ALC282; 4760 spec->codec_variant = ALC269_TYPE_ALC282;
4761 spec->shutup = alc282_shutup;
4762 spec->init_hook = alc282_init;
4690 break; 4763 break;
4691 case 0x10ec0233: 4764 case 0x10ec0233:
4692 case 0x10ec0283: 4765 case 0x10ec0283: