diff options
author | Kailang Yang <kailang@realtek.com> | 2013-07-24 08:39:49 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-07-24 08:44:40 -0400 |
commit | c5177c861e2bae584996f60667dc7b291ba6600a (patch) | |
tree | fde2d174074ec21c92cad8764578e20d84a44825 /sound/pci | |
parent | 9bfb2844a2f9e6eab52aed1eca0d03f4398c755f (diff) |
ALSA: hda - Fix the noise after suspend on ALC283 codec
When the power state of ALC283 codec goes to D3, it gives a noise via
headphone output. This is because the driver tries to clear all pins
via snd_hda_shutup_pins(). Setting the mic pin to zero triggers such
a noise.
Define a new shutup call specific to this codec and control the pins
there more precisely. Also, add the power-save enable/disable
sequences in the resume and the new shutup calls.
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.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index dbd59dfc746e..04a69e3fca47 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -2712,6 +2712,13 @@ static int alc269_resume(struct hda_codec *codec) | |||
2712 | hda_call_check_power_status(codec, 0x01); | 2712 | hda_call_check_power_status(codec, 0x01); |
2713 | if (spec->has_alc5505_dsp) | 2713 | if (spec->has_alc5505_dsp) |
2714 | alc5505_dsp_resume(codec); | 2714 | alc5505_dsp_resume(codec); |
2715 | |||
2716 | /* clear the power-save mode for ALC283 */ | ||
2717 | if (codec->vendor_id == 0x10ec0283) { | ||
2718 | alc_write_coef_idx(codec, 0x4, 0xaf01); | ||
2719 | alc_write_coef_idx(codec, 0x6, 0x2104); | ||
2720 | } | ||
2721 | |||
2715 | return 0; | 2722 | return 0; |
2716 | } | 2723 | } |
2717 | #endif /* CONFIG_PM */ | 2724 | #endif /* CONFIG_PM */ |
@@ -3775,6 +3782,30 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
3775 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); | 3782 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); |
3776 | } | 3783 | } |
3777 | 3784 | ||
3785 | /* don't clear mic pin; otherwise it results in noise in D3 */ | ||
3786 | static void alc283_headset_shutup(struct hda_codec *codec) | ||
3787 | { | ||
3788 | int i; | ||
3789 | |||
3790 | if (codec->bus->shutdown) | ||
3791 | return; | ||
3792 | |||
3793 | for (i = 0; i < codec->init_pins.used; i++) { | ||
3794 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | ||
3795 | /* use read here for syncing after issuing each verb */ | ||
3796 | if (pin->nid != 0x19) | ||
3797 | snd_hda_codec_read(codec, pin->nid, 0, | ||
3798 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
3799 | } | ||
3800 | |||
3801 | alc_write_coef_idx(codec, 0x4, 0x0f01); /* power save */ | ||
3802 | alc_write_coef_idx(codec, 0x6, 0x2100); /* power save */ | ||
3803 | snd_hda_codec_write(codec, 0x19, 0, | ||
3804 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
3805 | PIN_VREFHIZ); | ||
3806 | codec->pins_shutup = 1; | ||
3807 | } | ||
3808 | |||
3778 | /* | 3809 | /* |
3779 | */ | 3810 | */ |
3780 | static int patch_alc269(struct hda_codec *codec) | 3811 | static int patch_alc269(struct hda_codec *codec) |
@@ -3789,6 +3820,9 @@ static int patch_alc269(struct hda_codec *codec) | |||
3789 | spec = codec->spec; | 3820 | spec = codec->spec; |
3790 | spec->gen.shared_mic_vref_pin = 0x18; | 3821 | spec->gen.shared_mic_vref_pin = 0x18; |
3791 | 3822 | ||
3823 | if (codec->vendor_id == 0x10ec0283) | ||
3824 | spec->shutup = alc283_headset_shutup; | ||
3825 | |||
3792 | snd_hda_pick_fixup(codec, alc269_fixup_models, | 3826 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
3793 | alc269_fixup_tbl, alc269_fixups); | 3827 | alc269_fixup_tbl, alc269_fixups); |
3794 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | 3828 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
@@ -3862,7 +3896,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
3862 | codec->patch_ops.suspend = alc269_suspend; | 3896 | codec->patch_ops.suspend = alc269_suspend; |
3863 | codec->patch_ops.resume = alc269_resume; | 3897 | codec->patch_ops.resume = alc269_resume; |
3864 | #endif | 3898 | #endif |
3865 | spec->shutup = alc269_shutup; | 3899 | if (!spec->shutup) |
3900 | spec->shutup = alc269_shutup; | ||
3866 | 3901 | ||
3867 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); | 3902 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
3868 | 3903 | ||