From nobody Thu Nov 19 11:53:04 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jVcKr4hkyz6w58l for ; Thu, 19 Nov 2026 11:53:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jVcKr3vXfz3PjQ for ; Thu, 19 Nov 2026 11:53:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795089184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j9PIwqEnUkRymtqGUCZ/6M9V7LNpmk9qT3TnU9Kpjsg=; b=CQONcje82krmPwQRVmtKShrMhDC/tewVt2Np39v1exdDNGeBI8k64HzloB74MP55binERa eSfqsojMdO4COGmIazpQi5//8vVy4RcE4GCPMhIxcOM1eLg8hQOA1nErNrRJru1TQRRzZC iLj+n7X0mtcTAkbeNvaCY+MqgV9fpOvzoCW3qdkq6LBHIgMraicydsXNsRvS7lpnXVI2om 2nEYcY99AnUL3dq2rSy+Wfipfa7LjUgVYcoihHNBndFOD+9eOR7saGC65SN11SSXu+0afG rd9YkXRQQeL3CsfB0uM21DlHgju7dhe4Rb2Sr/Hs/bAx8jXE/aOJ2e07N2HP4w== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795089184; b=CM7gjRKxDDbzuv8SkD9Kjqhmy1M4H9GGje5t8kllGI38AhnFwbEvLKEkMwIpIX6Evbq+0g zSMnxoCUTMEI6gsAb5mgMxVwyarYtDgW3dJZ/gQV/IZXDlNkYqpfqhl6TBU5CGLIg6HUU1 gxJpMitKymKxd/kz3I69QYNzHqDaR0VoJW1WM6AqLOniAWydSjgfIHV5qL/gSvqwf5B9SH CbxR3dnOygj3Xt7ZLAKZEoh3BQqb6x/k7mMQegVHz5KUsBtHwpOuagdhP2RvkapIGczHcI /r376LScz7CSorQIAwZT0djaEqGMqCVmSM2evgg/M7BLxMhXrscdSUTJHNO36w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795089184; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j9PIwqEnUkRymtqGUCZ/6M9V7LNpmk9qT3TnU9Kpjsg=; b=cXVtqDrdDXTQ0aDRoYpjVjlk1jvf1EkfvqHWxdhIWfxtOzGfSFlw0P8S32lOwM41t0bS07 m/ILG8c8uQ40bUsXuWeUFjCvNtj6ge/s+2AOXTCAdXExzPGE/QiDI1Al+24L9ap2QQTqCX +5KmFeHDJTGrrcJmU3IYAiEWFkTKj4G1S/coGHxHR2UqLJfvPLj2PkIIiRKP9mC4OuIEDb vwhcPeuwT3Vtc/3BC1khz2YDblWRAOhoBy4g35sLtJX0sVtTTTEAJCLsVWMTY+QAA+GKbV TIzjVF+0LUGHw7ca8NhoIga4IGAGVSsrwrW3b28fdvRjlQVKa4k2JqXa4IvaQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jVcKr3HYnz10hL for ; Thu, 19 Nov 2026 11:53:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 14df1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 19 Nov 2026 11:53:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: David Bidner From: Christos Margiolis Subject: git: 5581f8df7d6a - stable/15 - snd_hda: wake display audio and restore amplifier settings List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 5581f8df7d6accdb5f0840929d5ea5bbe40a486b Auto-Submitted: auto-generated Date: Thu, 19 Nov 2026 11:53:04 +0000 Message-Id: <6afee320.14df1.77f73733@gitrepo.freebsd.org> The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=5581f8df7d6accdb5f0840929d5ea5bbe40a486b commit 5581f8df7d6accdb5f0840929d5ea5bbe40a486b Author: David Bidner AuthorDate: 2026-11-05 12:28:15 +0000 Commit: Christos Margiolis CommitDate: 2026-11-19 11:52:35 +0000 snd_hda: wake display audio and restore amplifier settings An Intel display-audio codec was observed to remain in D3 after monitor sleep on DragonFly BSD. Starting a new stream then produced no sound, and waking the codec alone left the output pin amplifier muted and other function configuration unrestored. Read the audio function power state at stream start. If its requested or actual state is not D0, use the existing power-up routine before configuring and starting the stream, then restore the function to a known state: Restore selectors, pins, EAPD, GPIO/GPO and direct codec patches, then replay the cached gain and mute values once the pins are configured. Split widget configuration out of hdaa_audio_commit() into hdaa_audio_widget_commit() so the wake path can reuse it without reinitializing the cached amplifier values. Preserve the existing volume, mute and forced-mute values. Re-enable unsolicited responses, refresh ELD, and run jack presence handling for playback pins. Skip the full presence handler for recording pins only: its recording path can drop the driver lock to update the recording source, which is not safe while starting a stream with the channel lock held. The playback path does not drop the driver lock, so it is safe to run here, and it is what matters for display audio, whose pins belong to playback associations. GET_POWER_STATE reports the actual state in ACT (bits 7:4) and the requested state in SET (bits 3:0). They can differ during a transition. Checking both avoids skipping the D0 request when the function is still actually in D0 but has been requested to power down, or when D0 has been requested but the actual state has not reached D0 yet. The observed post-sleep response on DragonFly was 0x233, with both fields reporting D3. Despite their names, HDAA_AMP_MUTE_DEFAULT (0xffffffff) and HDAA_AMP_VOL_DEFAULT (-1) are sentinels meaning "keep the cached setting" in hdaa_audio_ctl_amp_set(). Passing them leaves ctl->muted, ctl->left and ctl->right unchanged, then writes the cached values to the hardware while respecting ctl->forcemute. It does not select factory defaults or unconditionally unmute the output. Preserve the existing behavior when the power-state query returns HDA_INVALID or both fields already report D0, and leave the D0 fast path and invalid power-state query handling unchanged. The observed wake-only silence and amplifier recovery were seen on DragonFly BSD. This FreeBSD adaptation has not been validated on FreeBSD hardware. PR: 299139 MFC after: 2 weeks Reviewed by: christos Pull-Request: https://github.com/freebsd/freebsd-src/pull/2464 (cherry picked from commit 43bbd71ac785fcc4ee39a8c0ef29d59fcb8c2a3c) --- sys/dev/sound/pci/hda/hdaa.c | 72 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 67 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index 0f81d114eb30..431bb545aea7 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -167,6 +167,7 @@ const static char *ossnames[] = SOUND_DEVICE_NAMES; * Function prototypes ****************************************************************************/ static int hdaa_pcmchannel_setup(struct hdaa_chan *); +static void hdaa_audio_wake(struct hdaa_devinfo *); static void hdaa_widget_connection_select(struct hdaa_widget *, uint8_t); static void hdaa_audio_ctl_amp_set(struct hdaa_audio_ctl *, @@ -842,6 +843,38 @@ hdaa_sense_deinit(struct hdaa_devinfo *devinfo) } } +static void +hdaa_sense_wake(struct hdaa_devinfo *devinfo) +{ + struct hdaa_widget *w; + int i; + + for (i = devinfo->startnode; i < devinfo->endnode; i++) { + w = hdaa_widget_get(devinfo, i); + if (w == NULL || w->enable == 0 || w->type != + HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) + continue; + if (w->unsol >= 0) { + hda_command(devinfo->dev, + HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, + HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | + w->unsol)); + } + /* + * Run jack presence handling for playback pins only. The + * recording path can drop the driver lock to update the + * recording source, which is not safe while starting a stream + * with the channel lock held. The playback path does not drop + * the driver lock. + */ + if (devinfo->as[w->bindas].dir == HDAA_CTL_OUT) + hdaa_presence_handler(w); + if (HDA_PARAM_PIN_CAP_DP(w->wclass.pin.cap) || + HDA_PARAM_PIN_CAP_HDMI(w->wclass.pin.cap)) + hdaa_eld_handler(w); + } +} + uint32_t hdaa_widget_pin_patch(uint32_t config, const char *str) { @@ -2159,7 +2192,15 @@ static int hdaa_channel_start(struct hdaa_chan *ch) { struct hdaa_devinfo *devinfo = ch->devinfo; - uint32_t fmt; + uint32_t fmt, power; + + power = hda_command(devinfo->dev, + HDA_CMD_GET_POWER_STATE(0, devinfo->nid)); + if (power != HDA_INVALID && + (HDA_CMD_GET_POWER_STATE_ACT(power) != HDA_CMD_POWER_STATE_D0 || + HDA_CMD_GET_POWER_STATE_SET(power) != HDA_CMD_POWER_STATE_D0)) { + hdaa_audio_wake(devinfo); + } fmt = hdaa_stream_format(ch); ch->stripectl = fls(ch->stripecap & hdaa_allowed_stripes(fmt) & @@ -5275,14 +5316,11 @@ hdaa_gpo_commit(struct hdaa_devinfo *devinfo) } static void -hdaa_audio_commit(struct hdaa_devinfo *devinfo) +hdaa_audio_widget_commit(struct hdaa_devinfo *devinfo) { struct hdaa_widget *w; int i; - /* Commit controls. */ - hdaa_audio_ctl_commit(devinfo); - /* Commit selectors, pins and EAPD. */ for (i = 0; i < devinfo->nodecnt; i++) { w = &devinfo->widget[i]; @@ -5315,6 +5353,13 @@ hdaa_audio_commit(struct hdaa_devinfo *devinfo) hdaa_gpo_commit(devinfo); } +static void +hdaa_audio_commit(struct hdaa_devinfo *devinfo) +{ + hdaa_audio_ctl_commit(devinfo); + hdaa_audio_widget_commit(devinfo); +} + static void hdaa_powerup(struct hdaa_devinfo *devinfo) { @@ -5333,6 +5378,23 @@ hdaa_powerup(struct hdaa_devinfo *devinfo) DELAY(1000); } +static void +hdaa_audio_wake(struct hdaa_devinfo *devinfo) +{ + struct hdaa_audio_ctl *ctl; + int i; + + hdaa_lockassert(devinfo); + hdaa_powerup(devinfo); + hdaa_audio_widget_commit(devinfo); + hdaa_patch_direct(devinfo); + i = 0; + while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) + hdaa_audio_ctl_amp_set(ctl, HDAA_AMP_MUTE_DEFAULT, + HDAA_AMP_VOL_DEFAULT, HDAA_AMP_VOL_DEFAULT); + hdaa_sense_wake(devinfo); +} + static int hdaa_pcmchannel_setup(struct hdaa_chan *ch) {