Hda intel linux drivers

crojewsk / skl_hdadmic-howto.md

This document targets Skylake, Kabylake, Kabylake-refresh, Amberlake and some other platforms where audio is of SPT (PCH) type. HDA (with DSP capabilities) plus DMIC configuration is supported on these with skylake driver. Throughout this document said driver will also be refered to as snd_soc_skl . To see if your device matches the type, navigate to: /sys/devices/pci0000\:00/0000\:00\:1f.3/ and do: cat device . PCI device ids: 0x9d70 or 0x9d71 denote that indeed this doc is what you’re looking for.

Make sure your kernel is at least v5.4 before continuing. Several problems that had previously existed with skylake were addressed and merged with v5.7-rc1 sound PR. These fixes were then backported to v5.4 LTS kernel. Additional updates were provided later on to address issues troubling DMIC. Older kernels do not come with these fixes applied so HDA+DMIC configuration is unsupported.

For some of the steps it’s best if you have your git at the ready. Configuration files may not be present by default on your machine. alsatplg tool, which will be handy for creating topology binaries should be installed by default but you can always follow official alsa-lib and alsa-utils guides to compile these by your own if available version does not suffice.

Limitations

skylake driver supports Realtek and HDMI (Intel) HDA codecs. Other vendors, such as Conexant are not supported.

Advanced users

Feel free to backport mentioned patches to earlier kernels. When doing so, please note commits which initially introduced hda-dsp machine driver came with v4.20. So, going below v4.20 requires extra work.

When compiling kernel yourself, remember to select kernel configuration options listed below. make menuconfig should help you with that.

Device Drivers Sound card support Advanced Linux Sound Architecture HD-Audio HD Audio PCI Build Realtek HD-audio codec support Build HDMI/DisplayPort HD-audio codec support ALSA for SoC audio support [*] Intel ASoC SST drivers Skylake Platforms Kabylake Platforms [*] HDAudio codec support Intel Machine drivers SKL/KBL/BXT/APL with HDA Codecs 

With these, both skylake driver and skl_hda_dsp_generic machine board driver will be compiled and able to interact with each other during runtime.

Enabling the configuration

First check the device type, if indeed your audio DSP is of SPT-type as mentioned in Audience.

Topologies are stored in alsa-topology-conf repo and once compiled, should be moved to /lib/firmware/ directory. Their naming also needs to be precise. Default, exact name is complicated so it’s recommended that you use a more friendly option. Topology search algorithm present in skl_tplg_init() fetches for topology binary three times before giving up:

  • Exact name: based on OEM and revision ids, plus PCI device id
  • Friendly name: -tplg.bin . For HDA+DMIC configuration that’s always: skl_hda_dsp_generic-tplg.bin
  • Fallback, static name: dfw_sst.bin
Читайте также:  Php as service linux

To manually install topology, clone alsa-topology-conf and navigate to /topology/hda-dsp subdirectory. Then, make use of alsatplg tool:

alsatplg -c skl_hda_dsp_generic-tplg.conf -o skl_hda_dsp_generic-tplg.bin 

and move generated output to /lib/firmware/ so it can be consumed by skylake driver later on.

While two drivers can support audio on our platforms of interest, only one, HDA legacy or HDA DSP driver may be running at a time. These are represented by snd_hda_intel and snd_soc_skl respectively. For HDA+DMIC you need the latter. Selection is performed with help of snd_intel_dspcfg module. See the source for more info regarding selection mechanism, especially the FLAG_XXX macros. Said module exposes dsp_driver parameter which influences driver selecting during runtime. To force skylake driver selection, append:

options snd_intel_dspcfg dsp_driver=2 

within any or new file within /etc/modprobe.d/ directory. Value of 2 stands for SST — skylake. This needs to be done only once. To see if the selection succeeded, after reboot, navigate to: /sys/module/snd_intel_dspcfg/parameters/ and see the output of: cat dsp_driver .

This ACPI table takes part in configuring DMIC portion of our HDA+DMIC setup. Default table should be sufficient for supporting basic audio cases. Unfortunatelly, should is not always. Please, refer to initrd_table_override guide in order to override onboard NHLT with new one. You will also need acpi-overrides scripts. As currently no public tools are available to edit NHLT manually, it’s best if you ask intel developers for help to obtain correct NHLT binary. You may also checkout NLHT speficication if you want to try to fix the problems yourself.

Sometimes sound card’s behaviour may be dummy or lackluster. Usually this comes from missing or incorrect use-case configuration. This is where UseCaseManagement (ucm) files come into play. These are officially available at alsa-ucm-conf and should be installed under /usr/share/alsa/ucm2 . Each separate file or package targets concrete configuration. Here, we’re looking for HDA+DMIC one: /ucm2/hda-dsp . Chances are, you already have plenty of these present so adding new or updating existing should be straightforward. Refer to alsaucm manual for additional information.

While proper DSP firmware binaries should already be present, it’s worth noting these are located in /lib/firmware/intel/ . You should notice pattern in their naming, only suffix gets changed: kbl goes for 0x9d71 devices, while release for 0x9d70 ones. Multiple firmware versions may be present, skylake driver loads only generically-named onces though. These are often symbolic links. If you ever need to update firmware file manually, checkout linux-firmware repo and simply backup and remove existing, generically-named file and create new symbolic link targeting your new file, e.g.:

ln -s dsp_fw_spt_release_vNewVersion.bin dsp_fw_release.bin 

When everything fails, feel free to send Intel a ticket. When doing so, it’s worth remembering couple of important steps. These will help us in fixing your issue quicker so you can enjoy smooth audio experience sooner.

  • Provide dmesg output. dmesg > log.txt suffices. It’s appreciated if said log contains early boot information i.e. dumped right after boot. If problem occurs later, you can provide two dmesg(s) instead: one from boot and one from runtime, once the problem presents itself. Please note that the default log level may not be sufficient. To enable debug logs, navigate to /etc/modprobe.d/ and similarly to snd_intel_dspcfg case, append within any or new file:
options snd_hda_core dyndbg==pmf options snd_hda_codec dyndbg==pmf options snd_soc_core dyndbg==pmf options snd_soc_skl dyndbg==pmf 

These ensure dmesg will be rich with audio related logs.

  • Attach kconfig, that is kernel config file which your kernel image is based on. These should be available in /boot/ directory. For exact match, check output of uname -r and select file matching: config- pattern.
  • Don’t forget to add topology binary for HDA+DMIC configuration If your /lib/firmware/ directory contains it.
  • Dump NHLT table. To do that, do: cat /sys/firmware/acpi/tables/NLHT > ~/nhlt.dat
  • General ALSA information, output of: alsa-info.sh —no-upload
  • List of sound modules loaded: lsmod | grep snd
  • PCI device ID of hda bus: cat /sys/devices/pci0000\:00/0000\:00\:1f.3/device
Читайте также:  Linux чем посмотреть smart

Thank you for this instruction how to enable under Linux a Digitial Microphone «D-Mic» with Intel SmartSoundTechnology (SST) on Machines with Skylake-Processor and SunrisePoint-LP (Low Power) chipset!
As Linux SOF explicitly does not support Skylake/KabyLake processors your fine instruction is the first solution I could find offering a targeted solution.

Your instruction explicitly covers two hardware-ids — which are a combination of the Skylake processors and its Platform Controller Hub (PCH) «SunrisePoint» chipset.
However there is a distinction within the processor family towards high-performance and energy-saving lines.
This article describes the differences:
https://www.anandtech.com/show/10303/choosing-the-right-ssd-for-a-skylakeu-system

While the high-performance H-, S- and K- CPUs need a separate Intel 100 Series platform controller hub (Sunrise Point PCH), the Skylake-U and Skylake-Y are Multi-Chip Packages (MCP) that have the Sunrise Point-LP PCH die integrated with the CPU in a single package.

So this solution covers many Notebooks with low-power oriented Skylake-Processers combined with low-power SunrisePoint (which is hardware id 0x9d70 ) but it misses the other ones (like H-Series which is 0xa170 ).

As many others I am suffering from this issue as well as my Notebook (Acer VN7-792 G) contains a Skylake i7-6700 HQ processer and Mobile Intel® HM170 Chipset ( https://ark.intel.com/content/www/us/en/ark/products/90584/mobile-intel-hm170-chipset.html ). Unfortunately your description does not work for this processor-chipset combination.
The ids of my system are

vendor: 8086 ("Intel Corporation"), device: a170 ("100 Series/C230 Series Chipset Family HD Audio Controller"). 

so for this particular Skylake processor the PCI device id is 0xa170.

As power-consumption is the reason for the different details in the chipsets I researched further and found this article showing a «Skylake U/Y Processor Platform Overview»
https://www.anandtech.com/show/10121/intel-nuc6i5syk-skylake-ucff-pc-review
containing a feature mapping table of the «SKL PCH-LP» versus the «100 Series PCH». The row «Audio» shows in both cases the same entry with respect to DMic — so I assume that there are no differences in the underlying logic, target hardware functionality (like number of mics in the array etc.).

Читайте также:  Утилита просмотр логов linux

This gave me hope that your solution approach can be expanded to include the other Skylake Processors as well and I continued my search.

Therefore I updated my Notebook to run under Linux Mint 21 — so it does contain all program versions/libraries as stated in your instruction. Having these installed I did some further research in the relevant linux source files for «0x9d70» and came to following results:

/* Sunrise Point */ < PCI_DEVICE(0x8086, 0xa170), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE >, /* Sunrise Point-LP */ < PCI_DEVICE(0x8086, 0x9d70), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE >, /* Kabylake */ < PCI_DEVICE(0x8086, 0xa171), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE >, /* Kabylake-LP */ < PCI_DEVICE(0x8086, 0x9d71), .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE >,

here are no differences for «0x9d70» versus «0xa170».

Secondly in linux/sound/soc/intel/skylake/skl.c and in https://github.com/torvalds/linux/blob/master/sound/soc/intel/skylake/skl.c
Herein again I searched for «0x9d70» and could find two passages which define certain actions for this PCI-ID (and «0x9d71») but nothing for «0xa170». Could this be the right place to add «something» to enable «0xa170» D-Mic as well?

I am neither a Linux expert nor a programmer — only a googling amateur trying to enable my fine notebook to be fully operable under Linux. So from hereon I have no idea what to do next.

Now my question is what to try next and whether you can help in this.

Note: It seems that all other functions controlled by the SunrisePoint PCH do work fine under Linux — only the D-Mic functionality does not.

Источник

Оцените статью
Adblock
detector