Request: Kernel patch for the dell-headset-multi workaround

We’ve been including steps in each Linux distro setup guide to manually apply the workaround to have headset audio in work on the 3.5mm combo jack: “As root, edit “/etc/modprobe.d/alsa-base.conf”, add “options snd-hda-intel model=dell-headset-multi” to the end of it, and then reboot.”

However, to save everyone the time, it makes sense just to patch the related kernel driver instead. We’ve put this on our internal todo list, but I figured there are probably several of you in the community who are familiar with submitting kernel patches and could do this more quickly than we can. The fix is most likely adding a quirk to sound/pci/hda/patch_realtek.c like has been done here: ALSA: hda - One more Dell headset detection quirk · torvalds/linux@7dca4bc · GitHub

4 Likes

It’s great of you folks to be on this. Thank you!

I believe this is the right patch:

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4c0c593f3c0a..a1b45c72e9b1 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9294,6 +9294,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	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),
+	SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
 
 #if 0
 	/* Below is a quirk table taken from the old code.

I am assuming that the subsystem ID f111:0001 is unique to this revision of the hardware :smile:; I preferred it over 8086:a0c8, which might match too broadly any TGL-LP SST devices.

With that patch + sound debugging enabled:

[  823.593494] snd_hda_codec_realtek hdaudioC0D0: ALC295: picked fixup Framework Laptop for PCI SSID f111:0001
[  823.593502] snd_hda_codec_realtek hdaudioC0D0: ALC295: Apply pincfg for Framework Laptop
[  823.593505] snd_hda_codec_realtek hdaudioC0D0: ALC295: Apply fix-func for Framework Laptop

I’ll submit it to alsa-devel in a couple hours :slight_smile:

5 Likes

@DHowett f111:0001 is our PCI allocated VID:PID for this mainboard. So yes!

2 Likes

Alright, here you go! Mailing list, Patchwork. I’ll update this thread as its status changes.

Thanks for the confirmation, Kieran! :slight_smile:

5 Likes

Any particular reason to do the fix that gives a non-working microphone device (in addition to the working one) instead of the one that doesn’t?

Nope! I didn’t know there was an alternative fix.

I’m testing out a variant of it based on the pre-existing System76 “No Headphone Mic” quirk:

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4c0c593f3c0a..54442ec36af9 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7012,6 +7012,7 @@ enum {
        ALC245_FIXUP_CS35L41_SPI_4,
        ALC245_FIXUP_CS35L41_SPI_4_HP_GPIO_LED,
        ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
+       ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE,
 };

 static const struct hda_fixup alc269_fixups[] = {
@@ -8806,6 +8807,15 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC285_FIXUP_HP_MUTE_LED,
        },
+       [ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
+       },
 };

 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9294,6 +9304,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        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),
+       SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),

 #if 0
        /* Below is a quirk table taken from the old code.

I’m seeing a little bit of trouble where the headset mic doesn’t report the right levels after coming out of sleep. However, connecting to the NO_HP_MIC quirk chain feels appropriate. The pinmux config in the above patch is based on the dell-headset-multi one without the headphone mic.

I will of course look at your pinctl as well.

Alright, I think the “right” pinctl value is 0x02a1112c

hda-emu % ./hda-decode-pincfg 0x02a1112c
Pin Default 0x02a1112c: [Jack] Mic at Ext Front
  Conn = 1/8, Color = Black
  DefAssociation  = 0x2, Sequence = 0xc, Misc = 0x1

The one you produced is “Mic at Ext Left”, which is totally correct. However, the Headphone Output is designated as “Ext Front”. Figured I’d line them up. :slight_smile:

The one used by dell-headset-multi is Ext Rear/Pink/Association-0x3.

2 Likes

:tada: The final version of the patch incorporating @Brad_J’s suggestion was accepted into the alsa dev tree!

5 Likes

Fantastic! Thanks, guys!!

Which version will be the first released stable kernel version including this patch? 5.18? Can this patch be backported to the kernel 5.17 too?

If I had to guess, the first release that could contain this fix is 5.19!

1 Like

Does anyone fancy taking a stab at this too?

I see. Maybe someone can ask a backport request in Linux distros if they want to see the fix faster. Today I tried to ask the backport request to Fedora 36 (kernel 5.17) on Fedora. But I gave it up today, as I needed to show the reproducing steps, and I didn’t have the motivation. (the detail).