Skip to contentSkip to conversation

ALSA: hda/realtek: Restore headset mic after suspend for Acer Nitro 5

PATCH In review Breno Baptista 2 participants 2 messages May 8 – May 15 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/realtek: Restore headset mic after suspend for Acer Nitro 5

The headset mic on the AN515-57 was shown as unplugged after resuming from S3/S4, requiring a reboot to recover.

---
 sound/hda/codecs/realtek/alc269.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
sound/hda/codecs/realtek/alc269.c +10 -0
index 11d0ea8ed859..449a5ab3b0d0 100644
@@ -3578,6 +3578,16 @@ static void alc2xx_fixup_headset_mic(struct hda_codec *codec,
 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
 		break;
+	case HDA_FIXUP_ACT_INIT:
+		/*
+		 * COEF 0x45 (CTIA combo jack mode) is not preserved across suspend.
+		 * Restore it before restarting HP JD so the headset is re-detected.
+		 */
+		if (is_s3_resume(codec) || is_s4_resume(codec)) {
+			alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
+			alc_combo_jack_hp_jd_restart(codec);
+		}
+		break;
 	}
 }
 
Signature · 1 line
2.54.0
#1 lore raw
Quoted 19 lines · Breno Baptista

The headset mic on the AN515-57 was shown as unplugged after resuming from S3/S4, requiring a reboot to recover.

---
 sound/hda/codecs/realtek/alc269.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
sound/hda/codecs/realtek/alc269.c +2 -0
index 11d0ea8ed859..449a5ab3b0d0 100644
@@ -3578,6 +3578,16 @@ static void alc2xx_fixup_headset_mic(struct hda_codec *codec,
 		alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
 		spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
 		break;
+	case HDA_FIXUP_ACT_INIT:
+		/*

sound/hda/codecs/realtek/alc269.c static void alc2xx_fixup_headset_mic(struct hda_codec *codec, · line 3592

Quoted 10 lines
sound/hda/codecs/realtek/alc269.c +8 -0
+		 * COEF 0x45 (CTIA combo jack mode) is not preserved across suspend.
+		 * Restore it before restarting HP JD so the headset is re-detected.
+		 */
+		if (is_s3_resume(codec) || is_s4_resume(codec)) {
+			alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
+			alc_combo_jack_hp_jd_restart(codec);
+		}
+		break;
 	}
 }

The code change itself looks OK, but I'd like to confirm that it's the expected behavior.

Kailang, could you verify this please?

thanks,

Takashi