From nobody Sun Apr 5 13:17:02 2026 Received: from mail-yx1-f54.google.com (mail-yx1-f54.google.com [74.125.224.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00B921D5CDE for ; Tue, 17 Feb 2026 22:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=74.125.224.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771366469; cv=pass; b=kTaUHe/+ZQFWIwUkW7l1SaexuwZeTDXFGd9DuSDLu/NMNPQlykHH5q1U4ealw+ev4tvSUTktGAtJDwy5mDRj2Ch3CvQNERSoZ1RJSa+FzGoIPOniNKS+WYwPk8UQ7fyxy9fqoSVzOuJL6UVaW/YFXn+zPNADKcKeKkuStzrl/+Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771366469; c=relaxed/simple; bh=S+VUFCu6rlLqwWm0NnnC2mnkLSyVV8nguqsug+kWh3U=; h=MIME-Version:from:Date:Message-ID:Subject:To:Cc:Content-Type; b=tFBVGHOnXiyn91CUAUZlyhegwYGYDfjBmBuhI+b61pK3VsWOuCCue8768TaM7MXNOOq5YNr+Z01H8UzvPtIrG/tZFV6WmILoXrxQYMJgyUEm6E+WbPvEAHXAo3gJxsBHWfjLJXGR5aK1oyugJCMb4unQOGNH2NznK182/xX/RoU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=starlabs.systems; spf=pass smtp.mailfrom=starlabs.systems; dkim=pass (2048-bit key) header.d=starlabs-systems.20230601.gappssmtp.com header.i=@starlabs-systems.20230601.gappssmtp.com header.b=NkYMZ9gb; arc=pass smtp.client-ip=74.125.224.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=starlabs.systems Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starlabs.systems Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=starlabs-systems.20230601.gappssmtp.com header.i=@starlabs-systems.20230601.gappssmtp.com header.b="NkYMZ9gb" Received: by mail-yx1-f54.google.com with SMTP id 956f58d0204a3-64aedd812baso4515633d50.3 for ; Tue, 17 Feb 2026 14:14:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771366465; cv=none; d=google.com; s=arc-20240605; b=VsMtbB0pyC5NKqg28xVH8Z95g8/H/mj0JMPj7sulrgnsALWCxMua/IZlbXgHA9xb0i nm2oo5HIezOT/5QvabCeQ5Abl65xcRKV/4ULSoBJky6zIvtupKm04QdqxkdkErfF90aA gfNqTlXrbgvTLiz+0F+OA8KIWZANyjQFxhW7oG9QxQ35vjGt7EOy9WLHcB3bvLk6Ca33 HdrxOCWeLaQfl2PuJjCrR+j8in8ykThtqiTx5b3Kt+XIhnxl3OCPW6Nuo7ht/+Y60dsE 7BOBHfCXWepD1VL0DZGkjOfmuex8URcLuvPwLN3Yfkj6jxV9qyzEVWlZkj1QpotDbzFQ RwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:mime-version:dkim-signature; bh=N/Rid5NqxxgBRg/S4kEAGGXjmMFCG2xtP2qbUOz07gY=; fh=uJ2QOHs3MdpZo7bSSDbZ8T/oQH8Hjp/2aOunUEn0VuQ=; b=AlQ6RNz1qra42SXlNCL9LJTSE2gzOPC/1aLmcLu6NQKdrb/T8PA9Y6Ha8BA/grnvyt lpgtiPCdU7wH9rA5Pc6q+BKo4bK6rocz/LZtUJ2tFpSLLBGU8XDCzWMdDxGs8hCgoILh dV7aptwDcAXyAJz4z8uiqLXaECFwbOi4A2EZOIVcLvbpQNnqqSMXS/F5tbCzjstA18u+ j9kfqGHW6ukaVZB0NL4n8aa9hY9cyjZvevjvhWOSWW3x39xv0yoEXxRJwbHX+NEbjeUT h29pTPqhPT9X0ZrXHQkbpKchmspWyBC5KDcFnbdNVEMiKDbtAZtmImdQ0Guy2IgokFjZ Or9A==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starlabs-systems.20230601.gappssmtp.com; s=20230601; t=1771366465; x=1771971265; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=N/Rid5NqxxgBRg/S4kEAGGXjmMFCG2xtP2qbUOz07gY=; b=NkYMZ9gbucMnmBi4Y5d8YV7ytw+4FSjfndM0IklwIcJLHqxsCn+uaM6/3O80Sua+lC ujcCT9lcYHXGCE1fbJKpXvXVfJ8KI63bDFb1P5kk16J4Z9dCs7mS99KoF4KU1xp1qFgh S5cn57OFzEGhyMrHt0U6CJL2AzxSJU3Q+RaNpnGGCi8wx+aZMuJXmEFteQ/Z3w7Xq3pc iewbjaIUqNqb7c2eyM2Bk4v0W3eIefZ6NHzVy7Iig0kAyJg9yQb6iUXQ5FZeUNT6bxwZ qsL1PViUnX794YKPMHzqerrtCFTHMVs4UEkhe+i4ka0fVkb5VzYt2gwOCJXUHCMMeDsZ py4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771366465; x=1771971265; h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N/Rid5NqxxgBRg/S4kEAGGXjmMFCG2xtP2qbUOz07gY=; b=mPeXFhWU8QAVuDsuwnGYg7Ry/6EKAplgE7l4FTAXO3Psb0/+pWCf2AKjU3A85W7sJv 97UGZ56wCjsZpl7uNiWFvHPp9O9qFTSxpYlYpwLq4UA/Xf9ZMt0SQQbG28MCHoZzmRWw PzsXcF6zFmBxV0ftovjJ66B2GjpdGlZBs5DV+hPEm4K0G+gfhuWbuJxYa/OVfgl45Jbs M45cLfSdYaRl+22IgCNzxQc0H1vfIm/Dx0A5wZvw8Vr6PQVrt3Ghyz2NNbi+e3FatduU cR8aGFeYm8qvVn41biO8ypPE3TvjPPMJXCEBAaAxb+q2IC7oPRZ+3JaUTdJ3rIKx40ii qpCA== X-Gm-Message-State: AOJu0YxyDzXP/xuWh12woGAp9w/nZwo45LVm2n+Pluz+M8nan5Uq5J+G nX4idjXDtYvmzy7EjZVTOXxEMIpHyvgPqBzHKbzom8u4VddXmTzZRfQGlHbDDueL9aXLbzErKiS F9QmNRRZZ9AGFZSKC1sCuSxCc4cgAQQUOnNpzWN/SFU3DimbSAUw= X-Gm-Gg: AZuq6aKDAIOhcgQquTZ4lnqjA+rmm/dSpYVuWyJzOf7EcgQRMmj/19cScOVtXetJxQ3 653eSSJLEXJXShHwEzroDCsYHx9IXLbtmed51fdP4aI9c6a8cSpcSgFrZ/8V66RBWXs6uExbs+Y ceSwH/8AeL4MVrdYs/0u/fjEb/J5LywlD3fqbHwdc9z11BG8c+mFgfW6lt/jj/qQmb6SsmsxcIi j0c5/JEjMPtjl4kSAID3L/SDk537MQFTer11CdwtyCnOumpbDAenzs13Rh5TChmwrggKdqffAK/ pXITd7oIRcQbNkq5cc3DfO6w6PnZknufu0QNow== X-Received: by 2002:a05:690e:150c:b0:649:ae49:f58b with SMTP id 956f58d0204a3-64c198c7ac6mr11065944d50.25.1771366464775; Tue, 17 Feb 2026 14:14:24 -0800 (PST) Received: from 239600423368 named unknown by gmailapi.google.com with HTTPREST; Tue, 17 Feb 2026 14:14:24 -0800 Received: from 239600423368 named unknown by gmailapi.google.com with HTTPREST; Tue, 17 Feb 2026 14:14:24 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 from: Sean Rhodes Date: Tue, 17 Feb 2026 14:14:24 -0800 X-Gm-Features: AaiRm50vV7ROzbwZCEB0gZP6KUbFwGf7XDciOrThMx_hJAknP5Fvs0PUmNClGh4 Message-ID: Subject: [PATCH] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter To: linux-kernel@vger.kernel.org Cc: tiwai@suse.com, chris.chiu@canonical.com, edip@medip.dev, kailang@realtek.com, linux-sound@vger.kernel.org, perex@perex.cz, david.henningsson@canonical.com, sbinding@opensource.cirrus.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From 278f2646b0942aa2c57f2da1839b6e18adb38ed9 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Tue, 17 Feb 2026 11:53:41 +0000 Subject: [PATCH] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter To: tiwai@suse.com Cc: perex@perex.cz, sbinding@opensource.cirrus.com, kailang@realtek.com, chris.chiu@canonical.com, edip@medip.dev, david.henningsson@canonical.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org On Star Labs StarFighter (Realtek ALC233/235), the internal speakers can emit an audible pop when resuming from runtime suspend. The speaker amplifier is controlled via EAPD. The generic Realtek shutup path can toggle EAPD/pin widget control while the amp is still unmuted, causing the pop. Mute the speaker output before toggling EAPD on suspend/resume and restore the previous mute state after resume. Also toggle EAPD for the auxiliary pin (0x14) so runtime PM can fully power down the codec instead of being held in D0. On this machine the internal speaker pin is exposed as a line-out pin with type speaker, so use the line-out pin as the target for mute/EAPD when no dedicated speaker pin is present. Test results: fixes the runtime PM suspend/resume speaker pop. Pops that can occur on cold boot (G3 exit) and around display manager start/shutdown are = not addressed. Tested-by: Sean Rhodes Signed-off-by: Sean Rhodes --- sound/hda/codecs/realtek/alc269.c | 127 +++++++++++++++++++++++++++++ sound/hda/codecs/realtek/realtek.h | 2 + 2 files changed, 129 insertions(+) diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c index b66965a52107..4fec84b1bf5c 100644 --- a/sound/hda/codecs/realtek/alc269.c +++ b/sound/hda/codecs/realtek/alc269.c @@ -1017,6 +1017,126 @@ static int alc269_resume(struct hda_codec *codec) return 0; } +#define STARLABS_STARFIGHTER_AUX_EAPD_PIN 0x14 +#define STARLABS_STARFIGHTER_EAPD_DELAY_MS 30 +#define STARLABS_STARFIGHTER_RESUME_DELAY_MS 20 + +static hda_nid_t starlabs_starfighter_get_spk_pin(struct hda_codec *codec) +{ + struct alc_spec *spec =3D codec->spec; + const struct auto_pin_cfg *cfg =3D &spec->gen.autocfg; + const hda_nid_t *pins =3D auto_cfg_speaker_pins(cfg); + + if (auto_cfg_speaker_outs(cfg) > 0 && pins[0]) + return pins[0]; + + if (cfg->line_out_type =3D=3D AC_JACK_SPEAKER && cfg->line_out_pins[0]) + return cfg->line_out_pins[0]; + + return 0; +} + +static void starlabs_starfighter_set_mute(struct hda_codec *codec, + hda_nid_t nid, bool mute) +{ + snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, HDA_AMP_MUTE, + mute ? HDA_AMP_MUTE : 0); + /* sync after issuing the verbs */ + snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0); + snd_hda_codec_amp_read(codec, nid, 1, HDA_OUTPUT, 0); +} + +static void starlabs_starfighter_set_eapd(struct hda_codec *codec, + hda_nid_t nid, bool enable) +{ + if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) + return; + + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, + enable ? 0x02 : 0x00); + /* sync after issuing the verb */ + snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_EAPD_BTLENABLE, 0); +} + +static void starlabs_starfighter_shutup(struct hda_codec *codec) +{ + struct alc_spec *spec =3D codec->spec; + hda_nid_t spk_pin =3D starlabs_starfighter_get_spk_pin(codec); + unsigned int amp_l, amp_r; + + if (!spk_pin) + return; + + amp_l =3D snd_hda_codec_amp_read(codec, spk_pin, 0, HDA_OUTPUT, 0); + amp_r =3D snd_hda_codec_amp_read(codec, spk_pin, 1, HDA_OUTPUT, 0); + spec->speaker_pop_spk_was_muted =3D + !!((amp_l & HDA_AMP_MUTE) && (amp_r & HDA_AMP_MUTE)); + spec->speaker_pop_resume_pending =3D 1; + + /* + * Star Labs StarFighter: the internal speaker amplifier is controlled via + * EAPD. Mute before toggling EAPD on suspend/resume to avoid speaker pop= s. + */ + starlabs_starfighter_set_mute(codec, spk_pin, true); + msleep(STARLABS_STARFIGHTER_EAPD_DELAY_MS); + + starlabs_starfighter_set_eapd(codec, spk_pin, false); + if (spk_pin !=3D STARLABS_STARFIGHTER_AUX_EAPD_PIN) + starlabs_starfighter_set_eapd(codec, + STARLABS_STARFIGHTER_AUX_EAPD_PIN, + false); + msleep(STARLABS_STARFIGHTER_EAPD_DELAY_MS); +} + +static unsigned int starlabs_starfighter_power_filter(struct hda_codec *co= dec, + hda_nid_t nid, + unsigned int power_state) +{ + unsigned int state; + + state =3D snd_hda_gen_path_power_filter(codec, nid, power_state); + return snd_hda_codec_eapd_power_filter(codec, nid, state); +} + +static void alc233_fixup_starlabs_speaker_pop(struct hda_codec *codec, + const struct hda_fixup *fix, + int action) +{ + struct alc_spec *spec =3D codec->spec; + + switch (action) { + case HDA_FIXUP_ACT_PRE_PROBE: + codec->power_save_node =3D 1; + codec->power_filter =3D starlabs_starfighter_power_filter; + spec->shutup =3D starlabs_starfighter_shutup; + break; + case HDA_FIXUP_ACT_INIT: { + hda_nid_t spk_pin; + + if (!spec->speaker_pop_resume_pending) + break; + + spec->speaker_pop_resume_pending =3D 0; + spk_pin =3D starlabs_starfighter_get_spk_pin(codec); + if (!spk_pin) + break; + + starlabs_starfighter_set_mute(codec, spk_pin, true); + starlabs_starfighter_set_eapd(codec, spk_pin, true); + if (spk_pin !=3D STARLABS_STARFIGHTER_AUX_EAPD_PIN) + starlabs_starfighter_set_eapd(codec, + STARLABS_STARFIGHTER_AUX_EAPD_PIN, + true); + msleep(STARLABS_STARFIGHTER_EAPD_DELAY_MS); + msleep(STARLABS_STARFIGHTER_RESUME_DELAY_MS); + + if (!spec->speaker_pop_spk_was_muted) + starlabs_starfighter_set_mute(codec, spk_pin, false); + break; + } + } +} + static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, const struct hda_fixup *fix, int action) { @@ -3802,6 +3922,7 @@ enum { ALC245_FIXUP_CLEVO_NOISY_MIC, ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE, ALC233_FIXUP_MEDION_MTL_SPK, + ALC233_FIXUP_STARLABS_SPEAKER_POP, ALC294_FIXUP_BASS_SPEAKER_15, ALC283_FIXUP_DELL_HP_RESUME, ALC294_FIXUP_ASUS_CS35L41_SPI_2, @@ -6238,6 +6359,10 @@ static const struct hda_fixup alc269_fixups[] =3D { { } }, }, + [ALC233_FIXUP_STARLABS_SPEAKER_POP] =3D { + .type =3D HDA_FIXUP_FUNC, + .v.func =3D alc233_fixup_starlabs_speaker_pop, + }, [ALC294_FIXUP_BASS_SPEAKER_15] =3D { .type =3D HDA_FIXUP_FUNC, .v.func =3D alc294_fixup_bass_speaker_15, @@ -7370,6 +7495,7 @@ static const struct hda_quirk alc269_fixup_tbl[] =3D { SND_PCI_QUIRK(0x2782, 0x1705, "MEDION E15433", ALC269VC_FIXUP_INFINIX_Y4_= MAX), SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME), SND_PCI_QUIRK(0x2782, 0x4900, "MEDION E15443", ALC233_FIXUP_MEDION_MTL_SP= K), + SND_PCI_QUIRK(0x7017, 0x2014, "Star Labs StarFighter", ALC233_FIXUP_STARLABS_SPEAKER_POP), SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC= ), SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED), SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10), @@ -7466,6 +7592,7 @@ static const struct hda_model_fixup alc269_fixup_models[] =3D { {.id =3D ALC298_FIXUP_TPT470_DOCK_FIX, .name =3D "tpt470-dock-fix"}, {.id =3D ALC298_FIXUP_TPT470_DOCK, .name =3D "tpt470-dock"}, {.id =3D ALC233_FIXUP_LENOVO_MULTI_CODECS, .name =3D "dual-codecs"}, + {.id =3D ALC233_FIXUP_STARLABS_SPEAKER_POP, .name =3D "starlabs-starfight= er"}, {.id =3D ALC700_FIXUP_INTEL_REFERENCE, .name =3D "alc700-ref"}, {.id =3D ALC269_FIXUP_SONY_VAIO, .name =3D "vaio"}, {.id =3D ALC269_FIXUP_DELL_M101Z, .name =3D "dell-m101z"}, diff --git a/sound/hda/codecs/realtek/realtek.h b/sound/hda/codecs/realtek/realtek.h index b2a919904c4c..293fc0f3373f 100644 --- a/sound/hda/codecs/realtek/realtek.h +++ b/sound/hda/codecs/realtek/realtek.h @@ -119,6 +119,8 @@ struct alc_spec { unsigned int has_hs_key:1; unsigned int no_internal_mic_pin:1; unsigned int en_3kpull_low:1; + unsigned int speaker_pop_resume_pending:1; + unsigned int speaker_pop_spk_was_muted:1; int num_speaker_amps; /* for PLL fix */ --=20 2.51.0