Skip to content

Commit ca0deda

Browse files
KailangYangtiwai
authored andcommitted
ALSA: hda/realtek: update ALC222 depop optimize
Add ALC222 its own depop functions for alc_init and alc_shutup. [note: this fixes pop noise issues on the models with two headphone jacks -- tiwai ] Signed-off-by: Kailang Yang <kailang@realtek.com> Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent d0bbe33 commit ca0deda

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

sound/pci/hda/patch_realtek.c

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,6 +3843,79 @@ static void alc225_shutup(struct hda_codec *codec)
38433843
}
38443844
}
38453845

3846+
static void alc222_init(struct hda_codec *codec)
3847+
{
3848+
struct alc_spec *spec = codec->spec;
3849+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
3850+
bool hp1_pin_sense, hp2_pin_sense;
3851+
3852+
if (!hp_pin)
3853+
return;
3854+
3855+
msleep(30);
3856+
3857+
hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3858+
hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3859+
3860+
if (hp1_pin_sense || hp2_pin_sense) {
3861+
msleep(2);
3862+
3863+
if (hp1_pin_sense)
3864+
snd_hda_codec_write(codec, hp_pin, 0,
3865+
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3866+
if (hp2_pin_sense)
3867+
snd_hda_codec_write(codec, 0x14, 0,
3868+
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3869+
msleep(75);
3870+
3871+
if (hp1_pin_sense)
3872+
snd_hda_codec_write(codec, hp_pin, 0,
3873+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3874+
if (hp2_pin_sense)
3875+
snd_hda_codec_write(codec, 0x14, 0,
3876+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
3877+
3878+
msleep(75);
3879+
}
3880+
}
3881+
3882+
static void alc222_shutup(struct hda_codec *codec)
3883+
{
3884+
struct alc_spec *spec = codec->spec;
3885+
hda_nid_t hp_pin = alc_get_hp_pin(spec);
3886+
bool hp1_pin_sense, hp2_pin_sense;
3887+
3888+
if (!hp_pin)
3889+
hp_pin = 0x21;
3890+
3891+
hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3892+
hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
3893+
3894+
if (hp1_pin_sense || hp2_pin_sense) {
3895+
msleep(2);
3896+
3897+
if (hp1_pin_sense)
3898+
snd_hda_codec_write(codec, hp_pin, 0,
3899+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3900+
if (hp2_pin_sense)
3901+
snd_hda_codec_write(codec, 0x14, 0,
3902+
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3903+
3904+
msleep(75);
3905+
3906+
if (hp1_pin_sense)
3907+
snd_hda_codec_write(codec, hp_pin, 0,
3908+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3909+
if (hp2_pin_sense)
3910+
snd_hda_codec_write(codec, 0x14, 0,
3911+
AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3912+
3913+
msleep(75);
3914+
}
3915+
alc_auto_setup_eapd(codec, false);
3916+
alc_shutup_pins(codec);
3917+
}
3918+
38463919
static void alc_default_init(struct hda_codec *codec)
38473920
{
38483921
struct alc_spec *spec = codec->spec;
@@ -11907,8 +11980,11 @@ static int patch_alc269(struct hda_codec *codec)
1190711980
spec->codec_variant = ALC269_TYPE_ALC300;
1190811981
spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
1190911982
break;
11983+
case 0x10ec0222:
1191011984
case 0x10ec0623:
1191111985
spec->codec_variant = ALC269_TYPE_ALC623;
11986+
spec->shutup = alc222_shutup;
11987+
spec->init_hook = alc222_init;
1191211988
break;
1191311989
case 0x10ec0700:
1191411990
case 0x10ec0701:

0 commit comments

Comments
 (0)