@@ -834,6 +834,8 @@ static void alc_pre_init(struct hda_codec *codec)
834834 alc_fill_eapd_coef (codec );
835835}
836836
837+ #define is_s3_resume (codec ) \
838+ ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
837839#define is_s4_resume (codec ) \
838840 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
839841
@@ -4901,6 +4903,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
49014903 switch (new_headset_mode ) {
49024904 case ALC_HEADSET_MODE_UNPLUGGED :
49034905 alc_headset_mode_unplugged (codec );
4906+ spec -> current_headset_mode = ALC_HEADSET_MODE_UNKNOWN ;
4907+ spec -> current_headset_type = ALC_HEADSET_TYPE_UNKNOWN ;
49044908 spec -> gen .hp_jack_present = false;
49054909 break ;
49064910 case ALC_HEADSET_MODE_HEADSET :
@@ -4943,8 +4947,6 @@ static void alc_update_headset_mode_hook(struct hda_codec *codec,
49434947static void alc_update_headset_jack_cb (struct hda_codec * codec ,
49444948 struct hda_jack_callback * jack )
49454949{
4946- struct alc_spec * spec = codec -> spec ;
4947- spec -> current_headset_type = ALC_HEADSET_TYPE_UNKNOWN ;
49484950 snd_hda_gen_hp_automute (codec , jack );
49494951}
49504952
@@ -4981,7 +4983,10 @@ static void alc_fixup_headset_mode(struct hda_codec *codec,
49814983 alc_probe_headset_mode (codec );
49824984 break ;
49834985 case HDA_FIXUP_ACT_INIT :
4984- spec -> current_headset_mode = 0 ;
4986+ if (is_s3_resume (codec ) || is_s4_resume (codec )) {
4987+ spec -> current_headset_mode = ALC_HEADSET_MODE_UNKNOWN ;
4988+ spec -> current_headset_type = ALC_HEADSET_TYPE_UNKNOWN ;
4989+ }
49854990 alc_update_headset_mode (codec );
49864991 break ;
49874992 }
0 commit comments