[PATCH] ALSA: hda: Force resume if acomp notified during system suspend

From: Nícolas F. R. A. Prado

Date: Fri Jun 26 2026 - 11:47:59 EST


Currently if an HDMI cable is connected while the system is suspended,
the HDMI audio jack status stays off after resume.

This is due to the jack state not being synced by the HDA HDMI codec
device's runtime resume, as that never happens if the device was runtime
suspended before the system suspended, or by the acomp notification
triggered from the DRM side if that happens before the HDA HDMI codec
device has resumed.

To fix this, if snd_hda_hdmi_acomp_pin_eld_notify() gets called before
the HDA HDMI codec device has resumed, mark it to be forcefully runtime
resumed at the next PM complete time.

Do this using a separate acomp_requested_resume flag that can be
temporarily set without overwriting forced_resume for drivers that
always want to force resume.

Assisted-by: Copilot:claude-sonnet-4.6
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
---
include/sound/hda_codec.h | 1 +
sound/hda/codecs/hdmi/hdmi.c | 4 +++-
sound/hda/common/codec.c | 5 ++++-
3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
index 17945ab5e6e2..c05b6d44c491 100644
--- a/include/sound/hda_codec.h
+++ b/include/sound/hda_codec.h
@@ -256,6 +256,7 @@ struct hda_codec {
unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
unsigned int forced_resume:1; /* forced resume for jack */
+ unsigned int acomp_requested_resume:1; /* resume requested by acomp */
unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
unsigned int ctl_dev_id:1; /* old control element id build behaviour */
unsigned int eld_jack_detect:1; /* Machine jack-detection by ELD */
diff --git a/sound/hda/codecs/hdmi/hdmi.c b/sound/hda/codecs/hdmi/hdmi.c
index 1f4d646724ed..0b6816018a42 100644
--- a/sound/hda/codecs/hdmi/hdmi.c
+++ b/sound/hda/codecs/hdmi/hdmi.c
@@ -2233,8 +2233,10 @@ void snd_hda_hdmi_acomp_pin_eld_notify(void *audio_ptr, int port, int dev_id)
/* skip notification during system suspend (but not in runtime PM);
* the state will be updated at resume
*/
- if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND)
+ if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND) {
+ codec->acomp_requested_resume = 1;
return;
+ }

snd_hda_hdmi_check_presence_and_report(codec, pin_nid, dev_id);
}
diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index ef533770179b..b9ded149ea11 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -2967,8 +2967,11 @@ static void hda_codec_pm_complete(struct device *dev)
dev->power.power_state = PMSG_RESUME;

if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
- hda_codec_need_resume(codec) || codec->forced_resume))
+ hda_codec_need_resume(codec) || codec->forced_resume ||
+ codec->acomp_requested_resume)) {
+ codec->acomp_requested_resume = 0;
pm_request_resume(dev);
+ }
}

static int hda_codec_pm_suspend(struct device *dev)

---
base-commit: 30ffa8de54e5cc80d93fd211ca134d1764a7011f
change-id: 20260626-hda-force-resume-eld-notify-1347e3b9667f

Best regards,
--
Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>