Bug 213953

Summary: HP x360 Spectre speakers not working (Tigerlake, 15-eb1xxx/8811)
Product: Drivers Reporter: Davide Baldo (davide)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: alex, ger, lisa.schlitt, lucgaboury, rouquier.p
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.13.6 Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info for HP Spectre x360 Convertible 14-ea1xxx

Description Davide Baldo 2021-08-03 11:43:18 UTC
Speakers are not working by default while headphones works out of the box.

A workaround is discussed in arch linux, 
https://wiki.archlinux.org/title/HP_Spectre_x360_(2020)#Audio

And on stackoverflow:
https://askubuntu.com/questions/1263178/20-04-no-speaker-audio-on-hp-spectre-x360-2020-15t-eb000

My hardware is slightly a different version but the workaround works:

[    0.000000] DMI: HP HP Spectre x360 Convertible 15-eb1xxx/8811, BIOS F.06 01/25/2021

sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00


Related dmesg:

[    5.657346] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 1:6:1-53680
[    5.657348] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:17:0 Kernel ABI 3:18:0
[    5.669900] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:17:0 Kernel ABI 3:18:0
[    5.683632] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: Parent card not yet available, widget card binding deferred
[    5.703675] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC285: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    5.703677] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    5.703677] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    5.703678] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
[    5.703679] snd_hda_codec_realtek ehdaudio0D0:    inputs:
[    5.703679] snd_hda_codec_realtek ehdaudio0D0:      Mic=0x19
[    5.745765] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
[    5.745768] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
Comment 1 Davide Baldo 2021-08-13 15:24:17 UTC
By applying this small patch front speakers start by default, the workaround only turn on the rear speakers

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c92d9b9cf..ec9069561 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8347,6 +8347,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
        SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
        SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
+       SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360),
        SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
        SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),


but in the quirk the comments is stating it should turn on the REAR ones (but turns on the front ones for me). I don't know if it's a typo or the models are actually different.


related code:
static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
                                          const struct hda_fixup *fix, int action)
{
        static const hda_nid_t conn[] = { 0x02 };
        static const struct hda_pintbl pincfgs[] = {
                { 0x14, 0x90170110 },  /* rear speaker */
                { }
        };

        switch (action) {
        case HDA_FIXUP_ACT_PRE_PROBE:
                snd_hda_apply_pincfgs(codec, pincfgs);
                /* force front speaker to DAC1 */
                snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
                break;
        }
}
Comment 2 Davide Baldo 2021-09-09 09:42:24 UTC
I'm working at a bugfix myself, will submit a patch which fixes both speakers in the following weeks
Comment 3 Philippe Rouquier 2021-09-25 14:41:21 UTC
Hi, for what it's worth I tried the patch, though for a slightly newer machine (HP Spectre x360 15-eb1xxx but 0x8812) and I can confirm it works in fedora 35 (currently using 5.14.7). It would be great if it were modified to include my model as well and integrated in the kernel mainline.
Comment 4 Davide Baldo 2021-09-25 19:53:39 UTC
I've just sent out the patch to alsa-devel mailing list, should be visible as soon as my email is approved, in the meantime this is my commit which enabled both front and rear speakers.

In laptop 'HP Spectre x360 Convertible 15-eb1xxx/8811' both front and
rear speakers are silent, this patch fixes that by overriding the pin
layout and by initializing the amplifier which needs a GPIO pin to be
set to 1 then 0, similar to the existing HP Spectre x360 14 model.

This patch also correctly map the mute LED but since there is no
microphone on/off switch exposed by the alsa subsystem it never turns
on by itself.

There are still known audio issues in this laptop: headset microphone
doesn't work, the button to mute/unmute microphone is not yet mapped,
the LED of the mute/unmute speakers doesn't seems to be exposed via
GPIO and never turns on.

---
 sound/pci/hda/patch_realtek.c | 41 ++++++++++++++++++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 70516527ebce..90f845976793 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6414,6 +6414,38 @@ static void alc_fixup_no_int_mic(struct hda_codec *codec,
         }
 }
 
+/* GPIO1 = amplifier on/off
+ * GPIO3 = mic mute LED
+ */
+static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
+                                          const struct hda_fixup *fix, int action)
+{
+        struct alc_spec *spec = codec->spec;
+        static const struct hda_pintbl pincfgs[] = {
+                { 0x14, 0x90170110 },  /* front speakers */
+                { }
+        };
+
+        //enable micmute led
+        alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
+        spec->micmute_led_polarity = 1;
+
+        switch (action) {
+        case HDA_FIXUP_ACT_PRE_PROBE:
+                /* needed for amp of back speakers */
+                spec->gpio_mask |= 0x01;
+                spec->gpio_dir |= 0x01;
+                snd_hda_apply_pincfgs(codec, pincfgs);
+                break;
+        case HDA_FIXUP_ACT_INIT:
+                /* need to toggle GPIO to enable the amp of back speakers */
+                alc_update_gpio_data(codec, 0x01, true);
+                msleep(100);
+                alc_update_gpio_data(codec, 0x01, false);
+                break;
+        }
+}
+
 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
                                           const struct hda_fixup *fix, int action)
 {
@@ -6534,6 +6566,7 @@ enum {
         ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
         ALC280_FIXUP_HP_9480M,
         ALC245_FIXUP_HP_X360_AMP,
+        ALC285_FIXUP_HP_SPECTRE_X360_EB1,
         ALC288_FIXUP_DELL_HEADSET_MODE,
         ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
         ALC288_FIXUP_DELL_XPS_13,
@@ -6658,7 +6691,7 @@ enum {
         ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
         ALC623_FIXUP_LENOVO_THINKSTATION_P340,
         ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
-        ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
+        ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -8222,6 +8255,10 @@ static const struct hda_fixup alc269_fixups[] = {
                 .type = HDA_FIXUP_FUNC,
                 .v.func = alc285_fixup_hp_spectre_x360,
         },
+        [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
+                .type = HDA_FIXUP_FUNC,
+                .v.func = alc285_fixup_hp_spectre_x360_eb1
+        },
         [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
                 .type = HDA_FIXUP_FUNC,
                 .v.func = alc285_fixup_ideapad_s740_coef,
@@ -8415,6 +8452,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
         SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
         SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
         SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
+        SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
         SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
         SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
         SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
@@ -8858,6 +8896,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
         {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
         {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
         {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
+        {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
         {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
         {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
         {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
--
2.32.0
Comment 5 Davide Baldo 2021-09-25 19:55:45 UTC
Simply replace the identifier from 0x8811 to 0x8812, if it works i'll add it to the pull request.
Comment 6 Philippe Rouquier 2021-09-27 07:30:24 UTC
I tried your patch with my model. It kind of works, thanks for your work. I have the front speakers working as well as the back speakers. BUT, the sound volume is always maxed out whatever I do. I can't change it in GNOME or in alsamixer. I can move the sliders up and down from 1 to 100 but the sound volume remains the same.

One point I wanted to mention is that gnome offers the possibility in the control panel to change the sound volume on an application basis. Even though, as I said, the slider for master does not change anything, I can change the volume for each application and it works.

One other thing I noticed with the previous/original patch is that I only had the back speakers working but if I used (while playing sound) the workaround that can be found on internet:
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00

the front speakers started working and I had no problem controlling sound.


As for the led, it does not turn on or off but maybe it was to be expected given your comment.

If I can be of any help to improve the patch for my machine, let me know.
Comment 7 Davide Baldo 2021-09-27 10:27:20 UTC
I didn't notice but I had the very same issue, i played around a bit with pre-amp connections, seems like both front and back speakers are connected to the same pre-amp, this patch makes it explicit to alsa and allows to play with volume, let me know if you notice anything broken (stereo/mono headset/headphone etc..).

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 70516527ebce..42063476b2ea 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -6414,6 +6414,43 @@ static void alc_fixup_no_int_mic(struct hda_codec *codec,
 	}
 }
 
+/* GPIO1 = amplifier on/off
+ * GPIO3 = mic mute LED
+ */
+static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
+					  const struct hda_fixup *fix, int action)
+{
+	static const hda_nid_t conn[] = { 0x02 };
+
+	struct alc_spec *spec = codec->spec;
+	static const struct hda_pintbl pincfgs[] = {
+		{ 0x14, 0x90170110 },  /* front/high speakers */
+		{ 0x17, 0x90170130 },  /* back/bass speakers */
+		{ }
+	};
+
+	//enable micmute led
+	alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
+	spec->micmute_led_polarity = 1;
+
+	switch (action) {
+	case HDA_FIXUP_ACT_PRE_PROBE:
+		/* needed for amp of back speakers */
+		spec->gpio_mask |= 0x01;
+		spec->gpio_dir |= 0x01;
+		snd_hda_apply_pincfgs(codec, pincfgs);
+		snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
+		snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
+		break;
+	case HDA_FIXUP_ACT_INIT:
+		/* need to toggle GPIO to enable the amp of back speakers */
+		alc_update_gpio_data(codec, 0x01, true);
+		msleep(100);
+		alc_update_gpio_data(codec, 0x01, false);
+		break;
+	}
+}
+
 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
 					  const struct hda_fixup *fix, int action)
 {
@@ -6534,6 +6571,7 @@ enum {
 	ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
 	ALC280_FIXUP_HP_9480M,
 	ALC245_FIXUP_HP_X360_AMP,
+	ALC285_FIXUP_HP_SPECTRE_X360_EB1,
 	ALC288_FIXUP_DELL_HEADSET_MODE,
 	ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
 	ALC288_FIXUP_DELL_XPS_13,
@@ -6658,7 +6696,7 @@ enum {
 	ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
 	ALC623_FIXUP_LENOVO_THINKSTATION_P340,
 	ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
-	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
+	ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -8222,6 +8260,10 @@ static const struct hda_fixup alc269_fixups[] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc285_fixup_hp_spectre_x360,
 	},
+	[ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc285_fixup_hp_spectre_x360_eb1
+	},
 	[ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc285_fixup_ideapad_s740_coef,
@@ -8415,6 +8457,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
 	SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
 	SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
+	SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
+	SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
 	SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
 	SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
 	SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
@@ -8858,6 +8902,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
 	{.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
 	{.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
 	{.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
+	{.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
 	{.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
 	{.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
 	{.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Comment 8 Philippe Rouquier 2021-09-27 14:00:27 UTC
I tried and it works as it should. Master control works as expected and so does gnome control slider.
One small problem though remains but I don't think it is related to your patch because I had noticed it previously when I used the hda-verb workaround mentioned earlier in my previous comment. After suspend the sound stutters a bit and I need to reboot. But if I cold boot, your patch works like a charm. Well done and thank you.
Comment 9 Alexander Giese 2021-10-15 17:09:03 UTC
The hda-verb-quirk mentioned above was actually supplied by me. On my machine it does indeed turn on the rear speakers. No typo there ;)
It seems like the front and back speakers are switched between the eb0xxx and eb1xxx devices. As for what I know it does not make a difference in the fix you supplied.
I use this device:

DMI: HP HP Spectre x360 Convertible 15-eb0xxx/86E8, BIOS F.12 07/30/2021

I tried your patch on my machine and everything works exactly as you described it. They appear to be very similar. If you are still working on this would you mind including my device as well?

What I did for now:

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 965b096f416f..789c4c5c4812 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8630,6 +8630,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
        SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
+       SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
        SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Comment 10 lucgaboury 2022-09-06 17:39:16 UTC
Created attachment 301755 [details]
alsa-info for HP Spectre x360 Convertible 14-ea1xxx

I have the same issue on an HP Spectre x360 Convertible 14-ea1xxx.  Attached is my alsa-info.  I am currently running kernel 5.19.7 on Arch-Linux.
Comment 11 Lisa S 2022-11-01 19:32:08 UTC
Same issue as with comment 10, HP Spectre 14-ea100

Running Fedora 36 with Kernel 6.0.5-200.

Speakers are recognized on boot as Tiger Lake-LP Smart Sound Technology Audio Controller, but no sound comes from the speakers.  

Interesting, I run a dual boot with Windows 11, and an initial boot to Windows followed by a restart fixes the issue and sound works fine!

Please let me know what data would be necessary to help resolve the issue; thank you!