Bug 272682 - Adds support for Tiger Lake-H HD Audio Controller
Summary: Adds support for Tiger Lake-H HD Audio Controller
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.2-RELEASE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-multimedia (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-23 16:48 UTC by Miguel Salcedo
Modified: 2024-06-17 16:35 UTC (History)
4 users (show)

See Also:


Attachments
Tiger Lake-H HD Audio Controller support (2.22 KB, patch)
2024-06-13 14:07 UTC, Adam Retter
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Salcedo 2023-07-23 16:48:13 UTC
I encountered an issue where there was no default audio output on device 0x43c8 in FreeBSD. To resolve this, I modified the HDA module, adding the device using the definition:

#define HDA_INTEL_TGLH HDA_MODEL_CONSTRUCT(INTEL, 0x43c8).

Additionally, I redirected the pin output using "hints devices" during boot with specific configurations: 

hint.hdaa.0.nid20.config="as=1 seq=1 device=Line-out"
hint.hdaa.0.nid27.config="as=1 seq=2 device=Line-out"

These changes successfully fixed the bug, and audio output now works flawlessly without the need for manual adjustments during boot.
Comment 1 Adam Retter 2024-06-13 14:07:34 UTC
Created attachment 251434 [details]
Tiger Lake-H HD Audio Controller support

Adds support for Tiger Lake-H HD Audio Controller, e.g.:

none5@pci0:0:31:3:	class=0x040100 rev=0x11 hdr=0x00 vendor=0x8086 device=0x43c8 subvendor=0x17aa subdevice=0x22e5
    vendor     = 'Intel Corporation'
    device     = 'Tiger Lake-H HD Audio Controller'
    class      = multimedia
    subclass   = audio

Becomes:

hdac1@pci0:0:31:3:	class=0x040100 rev=0x11 hdr=0x00 vendor=0x8086 device=0x43c8 subvendor=0x17aa subdevice=0x22e5
    vendor     = 'Intel Corporation'
    device     = 'Tiger Lake-H HD Audio Controller'
    class      = multimedia
    subclass   = audio
Comment 2 Adam Retter 2024-06-13 14:08:30 UTC
(In reply to Adam Retter from comment #1)

I tested this on a Lenovo ThinkPad X1 Extreme Gen 4
Comment 3 Ed Maste freebsd_committer freebsd_triage 2024-06-14 15:26:00 UTC
(In reply to Adam Retter from comment #1)
Thank you, I will merge this patch in. Can you attach a git format patch please?

(Or, confirm git --author="Adam Retter <adam.retter@googlemail.com>" is acceptable.)
Comment 4 Adam Retter 2024-06-14 15:53:04 UTC
Ed, that is the correct author for me. However, it is really Miguel Salcedo's work, I only did the work to format what he already had as a patch.

Also I am experiencing a small issue with the internal mic, see: https://lists.freebsd.org/archives/freebsd-multimedia/2024-June/002411.html

I am not sure if that should stop this or not, it may just be a /boot/device.hints issue that I have with my specific Laptop, I am hoping someone can tell me...
Comment 5 Ed Maste freebsd_committer freebsd_triage 2024-06-14 16:02:42 UTC
(In reply to Adam Retter from comment #4)
You wrote the patch that I'm committing, so are the appropriate author.

The internal mic not working sounds like PR242527, an issue I encountered on my Lenovo X1 Carbon 7th gen. I haven't looked at the device number / routing issue yet; hopefully Christos can comment.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-06-14 16:26:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=fb1028dcd4aedc4d48dbd97314f008c663b2e711

commit fb1028dcd4aedc4d48dbd97314f008c663b2e711
Author:     Adam Retter <adam.retter@googlemail.com>
AuthorDate: 2024-06-14 15:57:15 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-06-14 16:24:59 +0000

    hda: add support for Tiger Lake-H

    PR:             272682
    Reported by:    Miguel Salcedo
    Reviewed by:    emaste

 sys/dev/sound/pci/hda/hdac.c  | 1 +
 sys/dev/sound/pci/hda/hdac.h  | 2 ++
 sys/dev/sound/pci/hda/hdacc.c | 1 +
 3 files changed, 4 insertions(+)
Comment 7 Alexander Motin freebsd_committer freebsd_triage 2024-06-14 16:28:17 UTC
Not that I am objecting the change, but it makes me wonder why is it even needed at all for more than cosmetic purposes?  IIRC HDA controllers should be detected just based on the PCI class value.  Is there something special about this Tiger Lake-H HD Audio Controller why it is not reported and standard HDA?
Comment 8 Adam Retter 2024-06-17 15:49:03 UTC
(In reply to Alexander Motin from comment #7)

I am afraid that they were not detected correctly before this patch.

"Intel Tiger Lake-H HD Audio Controller" is detected as class=multimedia (04h) and subclass=audio (01h). Whereas hda is normally class=multimedia (04h) and subclass=hda (03h). See section 1.5 here - https://pcisig.com/sites/default/files/files/PCI_Code-ID_r_1_11__v24_Jan_2019.pdf
Comment 9 Alexander Motin freebsd_committer freebsd_triage 2024-06-17 15:54:22 UTC
Right. But what made Intel to report them differently? Do they violate HDA specs in some way? Do they need special handling as result?
Comment 10 Adam Retter 2024-06-17 16:08:26 UTC
(In reply to Alexander Motin from comment #9)
Good question! I am afraid that all of this is way outside of my knowledge base. I can try and learn, but I don't know the answer yet.
I simply applied a proposed patch and tested it and apart from the internal-mic, everything else seemed to work nicely. Whereas before this patch, nothing worked for me. So I admit I did a bit of a "just try it and hope", but I think it is practically at least a step forward.
Comment 11 Ed Maste freebsd_committer freebsd_triage 2024-06-17 16:35:04 UTC
One point is that we need to implement DSP support (see https://www.sofproject.org/) and may then need specific handling for these devices.

As far as I can tell from a quick look at the Linux source there's a device match entry for this, only under #if IS_ENABLED(CONFIG_SND_SOC_SOF_TIGERLAKE). I have no idea on Linux configured w/o CONFIG_SND_SOC_SOF_TIGERLAKE if these devices attach and work based on class (but without a functional DMIC) or do not work at all.