aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKailang Yang <kailang@realtek.com>2018-01-05 03:50:08 -0500
committerTakashi Iwai <tiwai@suse.de>2018-01-08 04:42:13 -0500
commitda911b1f5e98f21b20aa042748dfe73e36322fb1 (patch)
treebd490e254403833ac9755c65d3b9ba0d8c2f2d0d
parent2c82e8ea942dc80350a62a719159ea522e0758af (diff)
ALSA: hda/realtek - update ALC225 depop optimize
Add ALC225 its own depop functions for alc_init and alc_shutup. Add depop optimize step for headset mode functions. Signed-off-by: Kailang Yang <kailang@realtek.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b2037131eed9..440972975bd4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3166,6 +3166,93 @@ static void alc256_shutup(struct hda_codec *codec)
3166 snd_hda_shutup_pins(codec); 3166 snd_hda_shutup_pins(codec);
3167} 3167}
3168 3168
3169static void alc225_init(struct hda_codec *codec)
3170{
3171 struct alc_spec *spec = codec->spec;
3172 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3173 bool hp1_pin_sense, hp2_pin_sense;
3174
3175 if (!hp_pin)
3176 return;
3177
3178 msleep(30);
3179
3180 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3181 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3182
3183 if (hp1_pin_sense || hp2_pin_sense)
3184 msleep(2);
3185
3186 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3187
3188 if (hp1_pin_sense)
3189 snd_hda_codec_write(codec, hp_pin, 0,
3190 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3191 if (hp2_pin_sense)
3192 snd_hda_codec_write(codec, 0x16, 0,
3193 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3194
3195 if (hp1_pin_sense || hp2_pin_sense)
3196 msleep(85);
3197
3198 if (hp1_pin_sense)
3199 snd_hda_codec_write(codec, hp_pin, 0,
3200 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3201 if (hp2_pin_sense)
3202 snd_hda_codec_write(codec, 0x16, 0,
3203 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3204
3205 if (hp1_pin_sense || hp2_pin_sense)
3206 msleep(100);
3207
3208 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3209 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3210}
3211
3212static void alc225_shutup(struct hda_codec *codec)
3213{
3214 struct alc_spec *spec = codec->spec;
3215 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3216 bool hp1_pin_sense, hp2_pin_sense;
3217
3218 if (!hp_pin) {
3219 alc269_shutup(codec);
3220 return;
3221 }
3222
3223 /* 3k pull low control for Headset jack. */
3224 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3225
3226 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3227 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3228
3229 if (hp1_pin_sense || hp2_pin_sense)
3230 msleep(2);
3231
3232 if (hp1_pin_sense)
3233 snd_hda_codec_write(codec, hp_pin, 0,
3234 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3235 if (hp2_pin_sense)
3236 snd_hda_codec_write(codec, 0x16, 0,
3237 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3238
3239 if (hp1_pin_sense || hp2_pin_sense)
3240 msleep(85);
3241
3242 if (hp1_pin_sense)
3243 snd_hda_codec_write(codec, hp_pin, 0,
3244 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3245 if (hp2_pin_sense)
3246 snd_hda_codec_write(codec, 0x16, 0,
3247 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3248
3249 if (hp1_pin_sense || hp2_pin_sense)
3250 msleep(100);
3251
3252 alc_auto_setup_eapd(codec, false);
3253 snd_hda_shutup_pins(codec);
3254}
3255
3169static void alc_default_init(struct hda_codec *codec) 3256static void alc_default_init(struct hda_codec *codec)
3170{ 3257{
3171 struct alc_spec *spec = codec->spec; 3258 struct alc_spec *spec = codec->spec;
@@ -4569,6 +4656,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4569 case 0x10ec0225: 4656 case 0x10ec0225:
4570 case 0x10ec0295: 4657 case 0x10ec0295:
4571 case 0x10ec0299: 4658 case 0x10ec0299:
4659 snd_hda_codec_write(codec, 0x21, 0,
4660 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4661 msleep(80);
4662 snd_hda_codec_write(codec, 0x21, 0,
4663 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4664
4572 alc_process_coef_fw(codec, alc225_pre_hsmode); 4665 alc_process_coef_fw(codec, alc225_pre_hsmode);
4573 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); 4666 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4574 val = alc_read_coef_idx(codec, 0x45); 4667 val = alc_read_coef_idx(codec, 0x45);
@@ -4588,6 +4681,12 @@ static void alc_determine_headset_type(struct hda_codec *codec)
4588 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); 4681 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4589 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); 4682 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4590 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); 4683 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
4684
4685 snd_hda_codec_write(codec, 0x21, 0,
4686 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4687 msleep(80);
4688 snd_hda_codec_write(codec, 0x21, 0,
4689 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4591 break; 4690 break;
4592 case 0x10ec0867: 4691 case 0x10ec0867:
4593 is_ctia = true; 4692 is_ctia = true;
@@ -6925,6 +7024,8 @@ static int patch_alc269(struct hda_codec *codec)
6925 case 0x10ec0295: 7024 case 0x10ec0295:
6926 case 0x10ec0299: 7025 case 0x10ec0299:
6927 spec->codec_variant = ALC269_TYPE_ALC225; 7026 spec->codec_variant = ALC269_TYPE_ALC225;
7027 spec->shutup = alc225_shutup;
7028 spec->init_hook = alc225_init;
6928 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */ 7029 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
6929 break; 7030 break;
6930 case 0x10ec0234: 7031 case 0x10ec0234: