public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter
@ 2026-02-19 20:14 Sean Rhodes
  2026-02-23  8:51 ` Takashi Iwai
  2026-03-14 19:34 ` [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 " Sean Rhodes
  0 siblings, 2 replies; 7+ messages in thread
From: Sean Rhodes @ 2026-02-19 20:14 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jaroslav Kysela, Takashi Iwai, Stefan Binding, Kailang Yang,
	Chris Chiu, Edip Hazuri, linux-sound, Sean Rhodes

On Star Labs StarFighter (Realtek ALC233/235), the internal speakers can
emit an audible pop when entering or leaving runtime suspend.

Mute the speaker output paths via snd_hda_gen_shutup_speakers() in the
Realtek shutup callback before the codec is powered down.

This is enough to avoid the pop without special EAPD handling.

Test results:
- runtime PM pop fixed
- still reaches D3 (PCI 0000:00:1f.3 power_state=D3hot)
- does not address pops on cold boot (G3 exit) or around display manager
  start/shutdown

journalctl -k (boot):
- snd_hda_codec_alc269 hdaudioC0D0: ALC233: picked fixup for PCI SSID
  7017:2014
- snd_hda_codec_alc269 hdaudioC0D0: autoconfig for ALC233: line_outs=1
  (0x1b/0x0/0x0/0x0/0x0) type:speaker

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: Kailang Yang <kailang@realtek.com>
Cc: Chris Chiu <chris.chiu@canonical.com>
Cc: Edip Hazuri <edip@medip.dev>
Cc: linux-sound@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Suggested-by: Takashi Iwai <tiwai@suse.com>
Tested-by: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
 sound/hda/codecs/realtek/alc269.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index b66965a52107..00a92da0ba05 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -1017,6 +1017,24 @@ static int alc269_resume(struct hda_codec *codec)
 	return 0;
 }
 
+#define STARLABS_STARFIGHTER_SHUTUP_DELAY_MS	30
+
+static void starlabs_starfighter_shutup(struct hda_codec *codec)
+{
+	if (snd_hda_gen_shutup_speakers(codec))
+		msleep(STARLABS_STARFIGHTER_SHUTUP_DELAY_MS);
+}
+
+static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
+					      const struct hda_fixup *fix,
+					      int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	if (action == HDA_FIXUP_ACT_PRE_PROBE)
+		spec->shutup = starlabs_starfighter_shutup;
+}
+
 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
 						 const struct hda_fixup *fix, int action)
 {
@@ -3802,6 +3820,7 @@ enum {
 	ALC245_FIXUP_CLEVO_NOISY_MIC,
 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
 	ALC233_FIXUP_MEDION_MTL_SPK,
+	ALC233_FIXUP_STARLABS_STARFIGHTER,
 	ALC294_FIXUP_BASS_SPEAKER_15,
 	ALC283_FIXUP_DELL_HP_RESUME,
 	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
@@ -6238,6 +6257,10 @@ static const struct hda_fixup alc269_fixups[] = {
 			{ }
 		},
 	},
+	[ALC233_FIXUP_STARLABS_STARFIGHTER] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc233_fixup_starlabs_starfighter,
+	},
 	[ALC294_FIXUP_BASS_SPEAKER_15] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc294_fixup_bass_speaker_15,
@@ -7370,6 +7393,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = {
 	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_SPK),
+	SND_PCI_QUIRK(0x7017, 0x2014, "Star Labs StarFighter", ALC233_FIXUP_STARLABS_STARFIGHTER),
 	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 +7490,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
 	{.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
 	{.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
 	{.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
+	{.id = ALC233_FIXUP_STARLABS_STARFIGHTER, .name = "starlabs-starfighter"},
 	{.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
 	{.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
 	{.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v6] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter
  2026-02-19 20:14 [PATCH v6] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter Sean Rhodes
@ 2026-02-23  8:51 ` Takashi Iwai
  2026-03-14 19:34 ` [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 " Sean Rhodes
  1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2026-02-23  8:51 UTC (permalink / raw)
  To: Sean Rhodes
  Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai, Stefan Binding,
	Kailang Yang, Chris Chiu, Edip Hazuri, linux-sound

On Thu, 19 Feb 2026 21:14:26 +0100,
Sean Rhodes wrote:
> 
> On Star Labs StarFighter (Realtek ALC233/235), the internal speakers can
> emit an audible pop when entering or leaving runtime suspend.
> 
> Mute the speaker output paths via snd_hda_gen_shutup_speakers() in the
> Realtek shutup callback before the codec is powered down.
> 
> This is enough to avoid the pop without special EAPD handling.
> 
> Test results:
> - runtime PM pop fixed
> - still reaches D3 (PCI 0000:00:1f.3 power_state=D3hot)
> - does not address pops on cold boot (G3 exit) or around display manager
>   start/shutdown
> 
> journalctl -k (boot):
> - snd_hda_codec_alc269 hdaudioC0D0: ALC233: picked fixup for PCI SSID
>   7017:2014
> - snd_hda_codec_alc269 hdaudioC0D0: autoconfig for ALC233: line_outs=1
>   (0x1b/0x0/0x0/0x0/0x0) type:speaker
> 
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Kailang Yang <kailang@realtek.com>
> Cc: Chris Chiu <chris.chiu@canonical.com>
> Cc: Edip Hazuri <edip@medip.dev>
> Cc: linux-sound@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: Takashi Iwai <tiwai@suse.com>
> Tested-by: Sean Rhodes <sean@starlabs.systems>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 on Star Labs StarFighter
  2026-02-19 20:14 [PATCH v6] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter Sean Rhodes
  2026-02-23  8:51 ` Takashi Iwai
@ 2026-03-14 19:34 ` Sean Rhodes
  2026-03-15  9:27   ` Takashi Iwai
  2026-03-15 20:11   ` [PATCH v4] " Sean Rhodes
  1 sibling, 2 replies; 7+ messages in thread
From: Sean Rhodes @ 2026-03-14 19:34 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jaroslav Kysela, Takashi Iwai, Chris Chiu, Kailang Yang,
	Stefan Binding, Edip Hazuri, Zhang Heng, linux-sound

The initial StarFighter quirk fixed the runtime suspend pop by muting
speakers in the shutup callback before power-down. Further hardware
validation showed that the speaker path is controlled directly by LINE2
EAPD on NID 0x1b together with GPIO2 for the external amplifier.

Replace the shutup-delay workaround with explicit sequencing of those
controls at playback start and stop:
- assert LINE2 EAPD and drive GPIO2 high on PREPARE
- deassert LINE2 EAPD and drive GPIO2 low on CLEANUP

This avoids the runtime suspend pop without a sleep, and also fixes pops
around G3 entry and display-manager start that the original workaround
did not cover.

Fixes: 1cb3c20688fc ("ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter")
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: Kailang Yang <kailang@realtek.com>
Cc: Chris Chiu <chris.chiu@canonical.com>
Cc: Edip Hazuri <edip@medip.dev>
Cc: linux-sound@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Tested-by: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
 sound/hda/codecs/realtek/alc269.c | 64 ++++++++++++++++++++++---------
 1 file changed, 45 insertions(+), 19 deletions(-)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index 4c49f1195e1b..901314a7af51 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -1017,24 +1017,6 @@ static int alc269_resume(struct hda_codec *codec)
 	return 0;
 }
 
-#define STARLABS_STARFIGHTER_SHUTUP_DELAY_MS	30
-
-static void starlabs_starfighter_shutup(struct hda_codec *codec)
-{
-	if (snd_hda_gen_shutup_speakers(codec))
-		msleep(STARLABS_STARFIGHTER_SHUTUP_DELAY_MS);
-}
-
-static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
-					      const struct hda_fixup *fix,
-					      int action)
-{
-	struct alc_spec *spec = codec->spec;
-
-	if (action == HDA_FIXUP_ACT_PRE_PROBE)
-		spec->shutup = starlabs_starfighter_shutup;
-}
-
 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
 						 const struct hda_fixup *fix, int action)
 {
@@ -1454,6 +1436,32 @@ static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
 	}
 }
 
+#define ALC233_STARFIGHTER_SPK_PIN	0x1b
+#define ALC233_STARFIGHTER_GPIO2	0x04
+
+static void alc233_starfighter_update_amp(struct hda_codec *codec, bool on)
+{
+	snd_hda_codec_write(codec, ALC233_STARFIGHTER_SPK_PIN, 0,
+			    AC_VERB_SET_EAPD_BTLENABLE,
+			    on ? AC_EAPDBTL_EAPD : 0);
+	alc_update_gpio_data(codec, ALC233_STARFIGHTER_GPIO2, on);
+}
+
+static void alc233_starfighter_pcm_hook(struct hda_pcm_stream *hinfo,
+					struct hda_codec *codec,
+					struct snd_pcm_substream *substream,
+					int action)
+{
+	switch (action) {
+	case HDA_GEN_PCM_ACT_PREPARE:
+		alc233_starfighter_update_amp(codec, true);
+		break;
+	case HDA_GEN_PCM_ACT_CLEANUP:
+		alc233_starfighter_update_amp(codec, false);
+		break;
+	}
+}
+
 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
 				      const struct hda_fixup *fix,
 				      int action)
@@ -1467,6 +1475,24 @@ static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
 	}
 }
 
+static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
+					      const struct hda_fixup *fix,
+					      int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		spec->gpio_mask |= ALC233_STARFIGHTER_GPIO2;
+		spec->gpio_dir |= ALC233_STARFIGHTER_GPIO2;
+		spec->gpio_data &= ~ALC233_STARFIGHTER_GPIO2;
+		break;
+	case HDA_FIXUP_ACT_PROBE:
+		spec->gen.pcm_playback_hook = alc233_starfighter_pcm_hook;
+		break;
+	}
+}
+
 static void alc_update_coef_led(struct hda_codec *codec,
 				struct alc_coef_led *led,
 				bool polarity, bool on)
@@ -4058,7 +4084,6 @@ enum {
 	ALC245_FIXUP_CLEVO_NOISY_MIC,
 	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
 	ALC233_FIXUP_MEDION_MTL_SPK,
-	ALC233_FIXUP_STARLABS_STARFIGHTER,
 	ALC294_FIXUP_BASS_SPEAKER_15,
 	ALC283_FIXUP_DELL_HP_RESUME,
 	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
@@ -4074,6 +4099,7 @@ enum {
 	ALC288_FIXUP_SURFACE_SWAP_DACS,
 	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO,
 	ALC233_FIXUP_LENOVO_GPIO2_MIC_HOTKEY,
+	ALC233_FIXUP_STARLABS_STARFIGHTER,
 	ALC245_FIXUP_BASS_HP_DAC,
 	ALC245_FIXUP_ACER_MICMUTE_LED,
 };
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 on Star Labs StarFighter
  2026-03-14 19:34 ` [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 " Sean Rhodes
@ 2026-03-15  9:27   ` Takashi Iwai
  2026-03-15 20:11   ` [PATCH v4] " Sean Rhodes
  1 sibling, 0 replies; 7+ messages in thread
From: Takashi Iwai @ 2026-03-15  9:27 UTC (permalink / raw)
  To: Sean Rhodes
  Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai, Chris Chiu,
	Kailang Yang, Stefan Binding, Edip Hazuri, Zhang Heng,
	linux-sound

On Sat, 14 Mar 2026 20:34:34 +0100,
Sean Rhodes wrote:
> 
> The initial StarFighter quirk fixed the runtime suspend pop by muting
> speakers in the shutup callback before power-down. Further hardware
> validation showed that the speaker path is controlled directly by LINE2
> EAPD on NID 0x1b together with GPIO2 for the external amplifier.
> 
> Replace the shutup-delay workaround with explicit sequencing of those
> controls at playback start and stop:
> - assert LINE2 EAPD and drive GPIO2 high on PREPARE
> - deassert LINE2 EAPD and drive GPIO2 low on CLEANUP
> 
> This avoids the runtime suspend pop without a sleep, and also fixes pops
> around G3 entry and display-manager start that the original workaround
> did not cover.
> 
> Fixes: 1cb3c20688fc ("ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter")
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Kailang Yang <kailang@realtek.com>
> Cc: Chris Chiu <chris.chiu@canonical.com>
> Cc: Edip Hazuri <edip@medip.dev>
> Cc: linux-sound@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Tested-by: Sean Rhodes <sean@starlabs.systems>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>

Thanks, it's better than the previous patchset, but...

> ---
>  sound/hda/codecs/realtek/alc269.c | 64 ++++++++++++++++++++++---------
>  1 file changed, 45 insertions(+), 19 deletions(-)
> 
> diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
> index 4c49f1195e1b..901314a7af51 100644
> --- a/sound/hda/codecs/realtek/alc269.c
> +++ b/sound/hda/codecs/realtek/alc269.c
> @@ -1017,24 +1017,6 @@ static int alc269_resume(struct hda_codec *codec)
>  	return 0;
>  }
>  
> -#define STARLABS_STARFIGHTER_SHUTUP_DELAY_MS	30
> -
> -static void starlabs_starfighter_shutup(struct hda_codec *codec)
> -{
> -	if (snd_hda_gen_shutup_speakers(codec))
> -		msleep(STARLABS_STARFIGHTER_SHUTUP_DELAY_MS);
> -}
> -
> -static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
> -					      const struct hda_fixup *fix,
> -					      int action)
> -{
> -	struct alc_spec *spec = codec->spec;
> -
> -	if (action == HDA_FIXUP_ACT_PRE_PROBE)
> -		spec->shutup = starlabs_starfighter_shutup;
> -}
> -
>  static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
>  						 const struct hda_fixup *fix, int action)
>  {
> @@ -1454,6 +1436,32 @@ static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
>  	}
>  }
>  
> +#define ALC233_STARFIGHTER_SPK_PIN	0x1b
> +#define ALC233_STARFIGHTER_GPIO2	0x04
> +
> +static void alc233_starfighter_update_amp(struct hda_codec *codec, bool on)
> +{
> +	snd_hda_codec_write(codec, ALC233_STARFIGHTER_SPK_PIN, 0,
> +			    AC_VERB_SET_EAPD_BTLENABLE,
> +			    on ? AC_EAPDBTL_EAPD : 0);
> +	alc_update_gpio_data(codec, ALC233_STARFIGHTER_GPIO2, on);
> +}
> +
> +static void alc233_starfighter_pcm_hook(struct hda_pcm_stream *hinfo,
> +					struct hda_codec *codec,
> +					struct snd_pcm_substream *substream,
> +					int action)
> +{
> +	switch (action) {
> +	case HDA_GEN_PCM_ACT_PREPARE:
> +		alc233_starfighter_update_amp(codec, true);
> +		break;
> +	case HDA_GEN_PCM_ACT_CLEANUP:
> +		alc233_starfighter_update_amp(codec, false);
> +		break;
> +	}
> +}
> +
>  static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
>  				      const struct hda_fixup *fix,
>  				      int action)
> @@ -1467,6 +1475,24 @@ static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
>  	}
>  }
>  
> +static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
> +					      const struct hda_fixup *fix,
> +					      int action)
> +{
> +	struct alc_spec *spec = codec->spec;
> +
> +	switch (action) {
> +	case HDA_FIXUP_ACT_PRE_PROBE:
> +		spec->gpio_mask |= ALC233_STARFIGHTER_GPIO2;
> +		spec->gpio_dir |= ALC233_STARFIGHTER_GPIO2;
> +		spec->gpio_data &= ~ALC233_STARFIGHTER_GPIO2;
> +		break;
> +	case HDA_FIXUP_ACT_PROBE:
> +		spec->gen.pcm_playback_hook = alc233_starfighter_pcm_hook;
> +		break;
> +	}
> +}

... it'd be even better not to move the place of the function but
keeps at the same position.  

>  static void alc_update_coef_led(struct hda_codec *codec,
>  				struct alc_coef_led *led,
>  				bool polarity, bool on)
> @@ -4058,7 +4084,6 @@ enum {
>  	ALC245_FIXUP_CLEVO_NOISY_MIC,
>  	ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE,
>  	ALC233_FIXUP_MEDION_MTL_SPK,
> -	ALC233_FIXUP_STARLABS_STARFIGHTER,
>  	ALC294_FIXUP_BASS_SPEAKER_15,
>  	ALC283_FIXUP_DELL_HP_RESUME,
>  	ALC294_FIXUP_ASUS_CS35L41_SPI_2,
> @@ -4074,6 +4099,7 @@ enum {
>  	ALC288_FIXUP_SURFACE_SWAP_DACS,
>  	ALC236_FIXUP_HP_MUTE_LED_MICMUTE_GPIO,
>  	ALC233_FIXUP_LENOVO_GPIO2_MIC_HOTKEY,
> +	ALC233_FIXUP_STARLABS_STARFIGHTER,
>  	ALC245_FIXUP_BASS_HP_DAC,
>  	ALC245_FIXUP_ACER_MICMUTE_LED,

Ditto, there is no need for move the position.

By keeping the positions, we can concentrate only on what's really
changed.

Please resubmit with those corrections.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4] ALSA: hda/realtek: Sequence GPIO2 on Star Labs StarFighter
  2026-03-14 19:34 ` [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 " Sean Rhodes
  2026-03-15  9:27   ` Takashi Iwai
@ 2026-03-15 20:11   ` Sean Rhodes
  2026-03-16 17:05     ` Takashi Iwai
  1 sibling, 1 reply; 7+ messages in thread
From: Sean Rhodes @ 2026-03-15 20:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Jaroslav Kysela, Takashi Iwai, Chris Chiu, Kailang Yang,
	Stefan Binding, Edip Hazuri, Zhang Heng, linux-sound

The initial StarFighter quirk fixed the runtime suspend pop by muting
speakers in the shutup callback before power-down. Further hardware
validation showed that the speaker path is controlled directly by LINE2
EAPD on NID 0x1b together with GPIO2 for the external amplifier.

Replace the shutup-delay workaround with explicit sequencing of those
controls at playback start and stop:
- assert LINE2 EAPD and drive GPIO2 high on PREPARE
- deassert LINE2 EAPD and drive GPIO2 low on CLEANUP

This avoids the runtime suspend pop without a sleep, and also fixes pops
around G3 entry and display-manager start that the original workaround
did not cover.

Fixes: 1cb3c20688fc ("ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter")
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Stefan Binding <sbinding@opensource.cirrus.com>
Cc: Kailang Yang <kailang@realtek.com>
Cc: Chris Chiu <chris.chiu@canonical.com>
Cc: Edip Hazuri <edip@medip.dev>
Cc: linux-sound@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Tested-by: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
 sound/hda/codecs/realtek/alc269.c | 38 ++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/sound/hda/codecs/realtek/alc269.c b/sound/hda/codecs/realtek/alc269.c
index 4c49f1195e1b..b1a52fb4bb8a 100644
--- a/sound/hda/codecs/realtek/alc269.c
+++ b/sound/hda/codecs/realtek/alc269.c
@@ -1017,12 +1017,30 @@ static int alc269_resume(struct hda_codec *codec)
 	return 0;
 }
 
-#define STARLABS_STARFIGHTER_SHUTUP_DELAY_MS	30
+#define ALC233_STARFIGHTER_SPK_PIN	0x1b
+#define ALC233_STARFIGHTER_GPIO2	0x04
 
-static void starlabs_starfighter_shutup(struct hda_codec *codec)
+static void alc233_starfighter_update_amp(struct hda_codec *codec, bool on)
 {
-	if (snd_hda_gen_shutup_speakers(codec))
-		msleep(STARLABS_STARFIGHTER_SHUTUP_DELAY_MS);
+	snd_hda_codec_write(codec, ALC233_STARFIGHTER_SPK_PIN, 0,
+			    AC_VERB_SET_EAPD_BTLENABLE,
+			    on ? AC_EAPDBTL_EAPD : 0);
+	alc_update_gpio_data(codec, ALC233_STARFIGHTER_GPIO2, on);
+}
+
+static void alc233_starfighter_pcm_hook(struct hda_pcm_stream *hinfo,
+					struct hda_codec *codec,
+					struct snd_pcm_substream *substream,
+					int action)
+{
+	switch (action) {
+	case HDA_GEN_PCM_ACT_PREPARE:
+		alc233_starfighter_update_amp(codec, true);
+		break;
+	case HDA_GEN_PCM_ACT_CLEANUP:
+		alc233_starfighter_update_amp(codec, false);
+		break;
+	}
 }
 
 static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
@@ -1031,8 +1049,16 @@ static void alc233_fixup_starlabs_starfighter(struct hda_codec *codec,
 {
 	struct alc_spec *spec = codec->spec;
 
-	if (action == HDA_FIXUP_ACT_PRE_PROBE)
-		spec->shutup = starlabs_starfighter_shutup;
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		spec->gpio_mask |= ALC233_STARFIGHTER_GPIO2;
+		spec->gpio_dir |= ALC233_STARFIGHTER_GPIO2;
+		spec->gpio_data &= ~ALC233_STARFIGHTER_GPIO2;
+		break;
+	case HDA_FIXUP_ACT_PROBE:
+		spec->gen.pcm_playback_hook = alc233_starfighter_pcm_hook;
+		break;
+	}
 }
 
 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] ALSA: hda/realtek: Sequence GPIO2 on Star Labs StarFighter
  2026-03-15 20:11   ` [PATCH v4] " Sean Rhodes
@ 2026-03-16 17:05     ` Takashi Iwai
  2026-03-16 18:36       ` Sean Rhodes
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2026-03-16 17:05 UTC (permalink / raw)
  To: Sean Rhodes
  Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai, Chris Chiu,
	Kailang Yang, Stefan Binding, Edip Hazuri, Zhang Heng,
	linux-sound

On Sun, 15 Mar 2026 21:11:27 +0100,
Sean Rhodes wrote:
> 
> The initial StarFighter quirk fixed the runtime suspend pop by muting
> speakers in the shutup callback before power-down. Further hardware
> validation showed that the speaker path is controlled directly by LINE2
> EAPD on NID 0x1b together with GPIO2 for the external amplifier.
> 
> Replace the shutup-delay workaround with explicit sequencing of those
> controls at playback start and stop:
> - assert LINE2 EAPD and drive GPIO2 high on PREPARE
> - deassert LINE2 EAPD and drive GPIO2 low on CLEANUP
> 
> This avoids the runtime suspend pop without a sleep, and also fixes pops
> around G3 entry and display-manager start that the original workaround
> did not cover.
> 
> Fixes: 1cb3c20688fc ("ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter")
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.com>
> Cc: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Kailang Yang <kailang@realtek.com>
> Cc: Chris Chiu <chris.chiu@canonical.com>
> Cc: Edip Hazuri <edip@medip.dev>
> Cc: linux-sound@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Tested-by: Sean Rhodes <sean@starlabs.systems>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4] ALSA: hda/realtek: Sequence GPIO2 on Star Labs StarFighter
  2026-03-16 17:05     ` Takashi Iwai
@ 2026-03-16 18:36       ` Sean Rhodes
  0 siblings, 0 replies; 7+ messages in thread
From: Sean Rhodes @ 2026-03-16 18:36 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai, Chris Chiu,
	Kailang Yang, Stefan Binding, Edip Hazuri, Heng Zhang,
	linux-sound

Thank you :)

> On 16 Mar 2026, at 17:05, Takashi Iwai <tiwai@suse.de> wrote:
> 
> On Sun, 15 Mar 2026 21:11:27 +0100,
> Sean Rhodes wrote:
>> 
>> The initial StarFighter quirk fixed the runtime suspend pop by muting
>> speakers in the shutup callback before power-down. Further hardware
>> validation showed that the speaker path is controlled directly by LINE2
>> EAPD on NID 0x1b together with GPIO2 for the external amplifier.
>> 
>> Replace the shutup-delay workaround with explicit sequencing of those
>> controls at playback start and stop:
>> - assert LINE2 EAPD and drive GPIO2 high on PREPARE
>> - deassert LINE2 EAPD and drive GPIO2 low on CLEANUP
>> 
>> This avoids the runtime suspend pop without a sleep, and also fixes pops
>> around G3 entry and display-manager start that the original workaround
>> did not cover.
>> 
>> Fixes: 1cb3c20688fc ("ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter")
>> Cc: Jaroslav Kysela <perex@perex.cz>
>> Cc: Takashi Iwai <tiwai@suse.com>
>> Cc: Stefan Binding <sbinding@opensource.cirrus.com>
>> Cc: Kailang Yang <kailang@realtek.com>
>> Cc: Chris Chiu <chris.chiu@canonical.com>
>> Cc: Edip Hazuri <edip@medip.dev>
>> Cc: linux-sound@vger.kernel.org
>> Cc: linux-kernel@vger.kernel.org
>> Tested-by: Sean Rhodes <sean@starlabs.systems>
>> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> 
> Applied now.  Thanks.
> 
> 
> Takashi

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-03-16 18:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-19 20:14 [PATCH v6] ALSA: hda/realtek: Fix speaker pop on Star Labs StarFighter Sean Rhodes
2026-02-23  8:51 ` Takashi Iwai
2026-03-14 19:34 ` [PATCH v3] ALSA: hda/realtek: Sequence GPIO2 " Sean Rhodes
2026-03-15  9:27   ` Takashi Iwai
2026-03-15 20:11   ` [PATCH v4] " Sean Rhodes
2026-03-16 17:05     ` Takashi Iwai
2026-03-16 18:36       ` Sean Rhodes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox