More Notes on HD-Audio Driver¶
Takashi Iwai <tiwai@suse.de>
General¶
HD-audio is the new standard on-board audio component on modern PCsafter AC97. Although Linux has been supporting HD-audio since longtime ago, there are often problems with new machines. A part of theproblem is broken BIOS, and the rest is the driver implementation.This document explains the brief trouble-shooting and debuggingmethods for the HD-audio hardware.
The HD-audio component consists of two parts: the controller chip andthe codec chips on the HD-audio bus. Linux provides a single driverfor all controllers, snd-hda-intel. Although the driver name containsa word of a well-known hardware vendor, it’s not specific to it but forall controller chips by other companies. Since the HD-audiocontrollers are supposed to be compatible, the single snd-hda-drivershould work in most cases. But, not surprisingly, there are knownbugs and issues specific to each controller type. The snd-hda-inteldriver has a bunch of workarounds for these as described below.
A controller may have multiple codecs. Usually you have one audiocodec and optionally one modem codec. In theory, there might bemultiple audio codecs, e.g. for analog and digital outputs, and thedriver might not work properly because of conflict of mixer elements.This should be fixed in future if such hardware really exists.
The snd-hda-intel driver has several different codec parsers dependingon the codec. It has a generic parser as a fallback, but thisfunctionality is fairly limited until now. Instead of the genericparser, usually the codec-specific parser (coded in patch_*.c) is usedfor the codec-specific implementations. The details about thecodec-specific problems are explained in the later sections.
If you are interested in the deep debugging of HD-audio, read theHD-audio specification at first. The specification is found onIntel’s web page, for example:
HD-Audio Controller¶
DMA-Position Problem¶
The most common problem of the controller is the inaccurate DMApointer reporting. The DMA pointer for playback and capture can beread in two ways, either via a LPIB register or via a position-buffermap. As default the driver tries to read from the io-mappedposition-buffer, and falls back to LPIB if the position-buffer appearsdead. However, this detection isn’t perfect on some devices. In sucha case, you can change the default method viaposition_fix option.
position_fix=1 means to use LPIB method explicitly.position_fix=2 means to use the position-buffer.position_fix=3 means to use a combination of both methods, neededfor some VIA controllers. The capture stream position is correctedby comparing both LPIB and position-buffer values.position_fix=4 is another combination available for all controllers,and uses LPIB for the playback and the position-buffer for the capturestreams.position_fix=5 is specific to Intel platforms, so far, for Skylakeand onward. It applies the delay calculation for the precise positionreporting.position_fix=6 is to correct the position with the fixed FIFOsize, mainly targeted for the recent AMD controllers.0 is the default value for all othercontrollers, the automatic check and fallback to LPIB as described inthe above. If you get a problem of repeated sounds, this option mighthelp.
In addition to that, every controller is known to be broken regardingthe wake-up timing. It wakes up a few samples before actuallyprocessing the data on the buffer. This caused a lot of problems, forexample, with ALSA dmix or JACK. Since 2.6.27 kernel, the driver putsan artificial delay to the wake up timing. This delay is controlledviabdl_pos_adj option.
Whenbdl_pos_adj is a negative value (as default), it’s assigned toan appropriate value depending on the controller chip. For Intelchips, it’d be 1 while it’d be 32 for others. Usually this works.Only in case it doesn’t work and you get warning messages, you shouldchange this parameter to other values.
Codec-Probing Problem¶
A less often but a more severe problem is the codec probing. WhenBIOS reports the available codec slots wrongly, the driver getsconfused and tries to access the non-existing codec slot. This oftenresults in the total screw-up, and destructs the further communicationwith the codec chips. The symptom appears usually as error messageslike:
hda_intel: azx_get_response timeout, switching to polling mode: last cmd=0x12345678hda_intel: azx_get_response timeout, switching to single_cmd mode: last cmd=0x12345678
The first line is a warning, and this is usually relatively harmless.It means that the codec response isn’t notified via an IRQ. Thedriver uses explicit polling method to read the response. It givesvery slight CPU overhead, but you’d unlikely notice it.
The second line is, however, a fatal error. If this happens, usuallyit means that something is really wrong. Most likely you areaccessing a non-existing codec slot.
Thus, if the second error message appears, try to narrow the probedcodec slots viaprobe_mask option. It’s a bitmask, and each bitcorresponds to the codec slot. For example, to probe only the firstslot, passprobe_mask=1. For the first and the third slots, passprobe_mask=5 (where 5 = 1 | 4), and so on.
Since 2.6.29 kernel, the driver has a more robust probing method, sothis error might happen rarely, though.
On a machine with a broken BIOS, sometimes you need to force thedriver to probe the codec slots the hardware doesn’t report for use.In such a case, turn the bit 8 (0x100) ofprobe_mask option on.Then the rest 8 bits are passed as the codec slots to probeunconditionally. For example,probe_mask=0x103 will force to probethe codec slots 0 and 1 no matter what the hardware reports.
Interrupt Handling¶
HD-audio driver uses MSI as default (if available) since 2.6.33kernel as MSI works better on some machines, and in general, it’sbetter for performance. However, Nvidia controllers showed badregressions with MSI (especially in a combination with AMD chipset),thus we disabled MSI for them.
There seem also still other devices that don’t work with MSI. If yousee a regression wrt the sound quality (stuttering, etc) or a lock-upin the recent kernel, try to passenable_msi=0 option to disableMSI. If it works, you can add the known bad device to the blacklistdefined in hda_intel.c. In such a case, please report and give thepatch back to the upstream developer.
HD-Audio Codec¶
Model Option¶
The most common problem regarding the HD-audio driver is theunsupported codec features or the mismatched device configuration.Most of codec-specific code has several preset models, either tooverride the BIOS setup or to provide more comprehensive features.
The driver checks PCI SSID and looks through the static configurationtable until any matching entry is found. If you have a new machine,you may see a message like below:
hda_codec: ALC880: BIOS auto-probing.
Meanwhile, in the earlier versions, you would see a message like:
hda_codec: Unknown model for ALC880, trying auto-probe from BIOS...
Even if you see such a message, DON’T PANIC. Take a deep breath andkeep your towel. First of all, it’s an informational message, nowarning, no error. This means that the PCI SSID of your device isn’tlisted in the known preset model (white-)list. But, this doesn’t meanthat the driver is broken. Many codec-drivers provide the automaticconfiguration mechanism based on the BIOS setup.
The HD-audio codec has usually “pin” widgets, and BIOS sets the defaultconfiguration of each pin, which indicates the location, theconnection type, the jack color, etc. The HD-audio driver can guessthe right connection judging from these default configuration values.However -- some codec-support codes, such as patch_analog.c, don’tsupport the automatic probing (yet as of 2.6.28). And, BIOS is often,yes, pretty often broken. It sets up wrong values and screws up thedriver.
The preset model (or recently called as “fix-up”) is providedbasically to overcome such a situation. When the matching presetmodel is found in the white-list, the driver assumes the staticconfiguration of that preset with the correct pin setup, etc.Thus, if you have a newer machine with a slightly different PCI SSID(or codec SSID) from the existing one, you may have a good chance tore-use the same model. You can pass themodel option to specify thepreset model instead of PCI (and codec-) SSID look-up.
Whatmodel option values are available depends on the codec chip.Check your codec chip from the codec proc file (see “Codec Proc-File”section below). It will show the vendor/product name of your codecchip. Then, seeHD-Audio Codec-Specific Models file,the section of HD-audio driver. You can find a list of codecsandmodel options belonging to each codec. For example, for RealtekALC262 codec chip, passmodel=ultra for devices that are compatiblewith Samsung Q1 Ultra.
Thus, the first thing you can do for any brand-new, unsupported andnon-working HD-audio hardware is to check HD-audio codec and severaldifferentmodel option values. If you have any luck, some of themmight suit with your device well.
There are a few special model option values:
when ‘nofixup’ is passed, the device-specific fixups in the codecparser are skipped.
when
genericis passed, the codec-specific parser is skipped andonly the generic parser is used.
A new style for the model option that was introduced since 5.15 kernelis to pass the PCI or codec SSID in the form ofmodel=XXXX:YYYYwhere XXXX and YYYY are the sub-vendor and sub-device IDs in hexnumbers, respectively. This is a kind of aliasing to another device;when this form is given, the driver will refer to that SSID as areference to the quirk table. It’d be useful especially when thetarget quirk isn’t listed in the model table. For example, passingmodel=103c:8862 will apply the quirk for HP ProBook 445 G8 (whichisn’t found in the model table as of writing) as long as the device ishandled equivalently by the same driver.
Speaker and Headphone Output¶
One of the most frequent (and obvious) bugs with HD-audio is thesilent output from either or both of a built-in speaker and aheadphone jack. In general, you should try a headphone output atfirst. A speaker output often requires more additional controls likethe external amplifier bits. Thus a headphone output has a slightlybetter chance.
Before making a bug report, double-check whether the mixer is set upcorrectly. The recent version of snd-hda-intel driver provides mostly“Master” volume control as well as “Front” volume (where Frontindicates the front-channels). In addition, there can be individual“Headphone” and “Speaker” controls.
Ditto for the speaker output. There can be “External Amplifier”switch on some codecs. Turn on this if present.
Another related problem is the automatic mute of speaker output byheadphone plugging. This feature is implemented in most cases, butnot on every preset model or codec-support code.
In anyway, try a different model option if you have such a problem.Some other models may match better and give you more matchingfunctionality. If none of the available models works, send a bugreport. See the bug report section for details.
If you are masochistic enough to debug the driver problem, note thefollowing:
The speaker (and the headphone, too) output often requires theexternal amplifier. This can be set usually via EAPD verb or acertain GPIO. If the codec pin supports EAPD, you have a betterchance via SET_EAPD_BTL verb (0x70c). On others, GPIO pin (mostlyit’s either GPIO0 or GPIO1) may turn on/off EAPD.
Some Realtek codecs require special vendor-specific coefficients toturn on the amplifier. See patch_realtek.c.
IDT codecs may have extra power-enable/disable controls on eachanalog pin. See patch_sigmatel.c.
Very rare but some devices don’t accept the pin-detection verb untiltriggered. Issuing GET_PIN_SENSE verb (0xf09) may result in thecodec-communication stall. Some examples are found inpatch_realtek.c.
Capture Problems¶
The capture problems are often because of missing setups of mixers.Thus, before submitting a bug report, make sure that you set up themixer correctly. For example, both “Capture Volume” and “CaptureSwitch” have to be set properly in addition to the right “CaptureSource” or “Input Source” selection. Some devices have “Mic Boost”volume or switch.
When the PCM device is opened via “default” PCM (without pulse-audioplugin), you’ll likely have “Digital Capture Volume” control as well.This is provided for the extra gain/attenuation of the signal insoftware, especially for the inputs without the hardware volumecontrol such as digital microphones. Unless really needed, thisshould be set to exactly 50%, corresponding to 0dB -- neither extragain nor attenuation. When you use “hw” PCM, i.e., a raw access PCM,this control will have no influence, though.
It’s known that some codecs / devices have fairly bad analog circuits,and the recorded sound contains a certain DC-offset. This is no bugof the driver.
Most of modern laptops have no analog CD-input connection. Thus, therecording from CD input won’t work in many cases although the driverprovides it as the capture source. Use CDDA instead.
The automatic switching of the built-in and external mic per pluggingis implemented on some codec models but not on every model. Partlybecause of my laziness but mostly lack of testers. Feel free tosubmit the improvement patch to the author.
Direct Debugging¶
If no model option gives you a better result, and you are a tough guyto fight against evil, try debugging via hitting the raw HD-audiocodec verbs to the device. Some tools are available: hda-emu andhda-analyzer. The detailed description is found in the sectionsbelow. You’d need to enable hwdep for using these tools. See “KernelConfiguration” section.
Other Issues¶
Kernel Configuration¶
In general, I recommend you to enable the sound debug option,CONFIG_SND_DEBUG=y, no matter whether you are debugging or not.
Don’t forget to turn on the appropriateCONFIG_SND_HDA_CODEC_*options. Note that each of them corresponds to the codec chip, notthe controller chip. Thus, even if lspci shows the Nvidia controller,you may need to choose the option for other vendors. If you areunsure, just select all yes.
CONFIG_SND_HDA_HWDEP is a useful option for debugging the driver.When this is enabled, the driver creates hardware-dependent devices(one per each codec), and you have a raw access to the device viathese device files. For example,hwC0D2 will be created for thecodec slot #2 of the first card (#0). For debug-tools such ashda-verb and hda-analyzer, the hwdep device has to be enabled.Thus, it’d be better to turn this on always.
CONFIG_SND_HDA_RECONFIG is a new option, and this depends on thehwdep option above. When enabled, you’ll have some sysfs files underthe corresponding hwdep directory. See “HD-audio reconfiguration”section below.
CONFIG_SND_HDA_POWER_SAVE option enables the power-saving feature.See “Power-saving” section below.
Codec Proc-File¶
The codec proc-file is a treasure-chest for debugging HD-audio.It shows most of useful information of each codec widget.
The proc file is located in /proc/asound/card*/codec#*, one file pereach codec slot. You can know the codec vendor, product id andnames, the type of each widget, capabilities and so on.This file, however, doesn’t show the jack sensing state, so far. Thisis because the jack-sensing might be depending on the trigger state.
This file will be picked up by the debug tools, and also it can be fedto the emulator as the primary codec information. See the debug toolssection below.
This proc file can be also used to check whether the generic parser isused. When the generic parser is used, the vendor/product ID namewill appear as “Realtek ID 0262”, instead of “Realtek ALC262”.
HD-Audio Reconfiguration¶
This is an experimental feature to allow you re-configure the HD-audiocodec dynamically without reloading the driver. The following sysfsfiles are available under each codec-hwdep device directory (e.g./sys/class/sound/hwC0D0):
- vendor_id
Shows the 32bit codec vendor-id hex number. You can change thevendor-id value by writing to this file.
- subsystem_id
Shows the 32bit codec subsystem-id hex number. You can change thesubsystem-id value by writing to this file.
- revision_id
Shows the 32bit codec revision-id hex number. You can change therevision-id value by writing to this file.
- afg
Shows the AFG ID. This is read-only.
- mfg
Shows the MFG ID. This is read-only.
- name
Shows the codec name string. Can be changed by writing to thisfile.
- modelname
Shows the currently set
modeloption. Can be changed by writingto this file.- init_verbs
The extra verbs to execute at initialization. You can add a verb bywriting to this file. Pass three numbers: nid, verb and parameter(separated with a space).
- hints
Shows / stores hint strings for codec parsers for any use.Its format is
key=value. For example, passingjack_detect=nowill disable the jack detection of the machine completely.- init_pin_configs
Shows the initial pin default config values set by BIOS.
- driver_pin_configs
Shows the pin default values set by the codec parser explicitly.This doesn’t show all pin values but only the changed values bythe parser. That is, if the parser doesn’t change the pin defaultconfig values by itself, this will contain nothing.
- user_pin_configs
Shows the pin default config values to override the BIOS setup.Writing this (with two numbers, NID and value) appends the newvalue. The given will be used instead of the initial BIOS value atthe next reconfiguration time. Note that this config will overrideeven the driver pin configs, too.
- reconfig
Triggers the codec re-configuration. When any value is written tothis file, the driver re-initialize and parses the codec treeagain. All the changes done by the sysfs entries above are takeninto account.
- clear
Resets the codec, removes the mixer elements and PCM stuff of thespecified codec, and clear all init verbs and hints.
For example, when you want to change the pin default configurationvalue of the pin widget 0x14 to 0x9993013f, and let the driverre-configure based on that state, run like below:
# echo 0x14 0x9993013f > /sys/class/sound/hwC0D0/user_pin_configs# echo 1 > /sys/class/sound/hwC0D0/reconfig
Hint Strings¶
The codec parser have several switches and adjustment knobs formatching better with the actual codec or device behavior. Many ofthem can be adjusted dynamically via “hints” strings as mentioned inthe section above. For example, by passingjack_detect=no stringvia sysfs or a patch file, you can disable the jack detection, thusthe codec parser will skip the features like auto-mute or micauto-switch. As a boolean value, eitheryes,no,true,false,1 or0 can be passed.
The generic parser supports the following hints:
- jack_detect (bool)
specify whether the jack detection is available at all on thismachine; default true
- inv_jack_detect (bool)
indicates that the jack detection logic is inverted
- trigger_sense (bool)
indicates that the jack detection needs the explicit call ofAC_VERB_SET_PIN_SENSE verb
- inv_eapd (bool)
indicates that the EAPD is implemented in the inverted logic
- pcm_format_first (bool)
sets the PCM format before the stream tag and channel ID
- sticky_stream (bool)
keep the PCM format, stream tag and ID as long as possible;default true
- spdif_status_reset (bool)
reset the SPDIF status bits at each time the SPDIF stream is setup
- pin_amp_workaround (bool)
the output pin may have multiple amp values
- single_adc_amp (bool)
ADCs can have only single input amps
- auto_mute (bool)
enable/disable the headphone auto-mute feature; default true
- auto_mic (bool)
enable/disable the mic auto-switch feature; default true
- line_in_auto_switch (bool)
enable/disable the line-in auto-switch feature; default false
- need_dac_fix (bool)
limits the DACs depending on the channel count
- primary_hp (bool)
probe headphone jacks as the primary outputs; default true
- multi_io (bool)
try probing multi-I/O config (e.g. shared line-in/surround,mic/clfe jacks)
- multi_cap_vol (bool)
provide multiple capture volumes
- inv_dmic_split (bool)
provide split internal mic volume/switch for phase-inverteddigital mics
- indep_hp (bool)
provide the independent headphone PCM stream and the correspondingmixer control, if available
- add_stereo_mix_input (bool)
add the stereo mix (analog-loopback mix) to the input mux ifavailable
- add_jack_modes (bool)
add “xxx Jack Mode”
enumcontrolsto each I/O jack for allowing tochange the headphone amp and mic bias VREF capabilities- power_save_node (bool)
advanced power management for each widget, controlling the powerstate (D0/D3) of each widget node depending on the actual pin andstream states
- power_down_unused (bool)
power down the unused widgets, a subset of power_save_node, andwill be dropped in future
- add_hp_mic (bool)
add the headphone to capture source if possible
- hp_mic_detect (bool)
enable/disable the hp/mic shared input for a single built-in miccase; default true
- vmaster (bool)
enable/disable the virtual Master control; default true
- mixer_nid (int)
specifies the widget NID of the analog-loopback mixer
Early Patching¶
WhenCONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a “patch”as a firmware file for modifying the HD-audio setup beforeinitializing the codec. This can work basically like thereconfiguration via sysfs in the above, but it does it before thefirst codec configuration.
A patch file is a plain text file which looks like below:
[codec]0x12345678 0xabcd1234 2[model]auto[pincfg]0x12 0x411111f0[verb]0x20 0x500 0x030x20 0x400 0xff[hint]jack_detect = no
The file needs to have a line[codec]. The next line should containthree numbers indicating the codec vendor-id (0x12345678 in theexample), the codec subsystem-id (0xabcd1234) and the address (2) ofthe codec. The rest patch entries are applied to this specified codecuntil another codec entry is given. Passing 0 or a negative number tothe first or the second value will make the check of the correspondingfield be skipped. It’ll be useful for really broken devices that don’tinitialize SSID properly.
The[model] line allows to change the model name of the each codec.In the example above, it will be changed to model=auto.Note that this overrides the module option.
After the[pincfg] line, the contents are parsed as the initialdefault pin-configurations just likeuser_pin_configs sysfs above.The values can be shown in user_pin_configs sysfs file, too.
Similarly, the lines after[verb] are parsed asinit_verbssysfs entries, and the lines after[hint] are parsed ashintssysfs entries, respectively.
Another example to override the codec vendor id from 0x12345678 to0xdeadbeef is like below:
[codec]0x12345678 0xabcd1234 2[vendor_id]0xdeadbeef
In the similar way, you can override the codec subsystem_id via[subsystem_id], the revision id via[revision_id] line.Also, the codec chip name can be rewritten via[chip_name] line.
[codec]0x12345678 0xabcd1234 2[subsystem_id]0xffff1111[revision_id]0x10[chip_name]My-own NEWS-0002
The hd-audio driver reads the file viarequest_firmware(). Thus,a patch file has to be located on the appropriate firmware path,typically, /lib/firmware. For example, when you pass the optionpatch=hda-init.fw, the file /lib/firmware/hda-init.fw must bepresent.
The patch module option is specific to each card instance, and youneed to give one file name for each instance, separated by commas.For example, if you have two cards, one for an on-board analog and onefor an HDMI video board, you may pass patch option like below:
options snd-hda-intel patch=on-board-patch,hdmi-patch
Power-Saving¶
The power-saving is a kind of auto-suspend of the device. When thedevice is inactive for a certain time, the device is automaticallyturned off to save the power. The time to go down is specified viapower_save module option, and this option can be changed dynamicallyvia sysfs.
The power-saving won’t work when the analog loopback is enabled onsome codecs. Make sure that you mute all unneeded signal routes whenyou want the power-saving.
The power-saving feature might cause audible click noises at eachpower-down/up depending on the device. Some of them might besolvable, but some are hard, I’m afraid. Some distros such asopenSUSE enables the power-saving feature automatically when the powercable is unplugged. Thus, if you hear noises, suspect first thepower-saving. See /sys/module/snd_hda_intel/parameters/power_save tocheck the current value. If it’s non-zero, the feature is turned on.
The recent kernel supports the runtime PM for the HD-audio controllerchip, too. It means that the HD-audio controller is also powered up /down dynamically. The feature is enabled only for certain controllerchips like Intel LynxPoint. You can enable/disable this featureforcibly by settingpower_save_controller option, which is alsoavailable at /sys/module/snd_hda_intel/parameters directory.
Tracepoints¶
The hd-audio driver gives a few basic tracepoints.hda:hda_send_cmd traces each CORB write whilehda:hda_get_responsetraces the response from RIRB (only when read from the codec driver).hda:hda_bus_reset traces the bus-reset due to fatal error, etc,hda:hda_unsol_event traces the unsolicited events, andhda:hda_power_down andhda:hda_power_up trace the power down/upvia power-saving behavior.
Enabling all tracepoints can be done like
# echo 1 > /sys/kernel/tracing/events/hda/enable
then after some commands, you can traces from/sys/kernel/tracing/trace file. For example, when you want totrace what codec command is sent, enable the tracepoint like:
# cat /sys/kernel/tracing/trace# tracer: nop## TASK-PID CPU# TIMESTAMP FUNCTION# | | | | | <...>-7807 [002] 105147.774889: hda_send_cmd: [0:0] val=e3a019 <...>-7807 [002] 105147.774893: hda_send_cmd: [0:0] val=e39019 <...>-7807 [002] 105147.999542: hda_send_cmd: [0:0] val=e3a01a <...>-7807 [002] 105147.999543: hda_send_cmd: [0:0] val=e3901a <...>-26764 [001] 349222.837143: hda_send_cmd: [0:0] val=e3a019 <...>-26764 [001] 349222.837148: hda_send_cmd: [0:0] val=e39019 <...>-26764 [001] 349223.058539: hda_send_cmd: [0:0] val=e3a01a <...>-26764 [001] 349223.058541: hda_send_cmd: [0:0] val=e3901a
Here[0:0] indicates the card number and the codec address, andval shows the value sent to the codec, respectively. The value isa packed value, and you can decode it via hda-decode-verb programincluded in hda-emu package below. For example, the value e3a019 isto set the left output-amp value to 25.
% hda-decode-verb 0xe3a019raw value = 0x00e3a019cid = 0, nid = 0x0e, verb = 0x3a0, parm = 0x19raw value: verb = 0x3a0, parm = 0x19verbname = set_amp_gain_muteamp raw val = 0xa019output, left, idx=0, mute=0, val=25
Development Tree¶
The latest development codes for HD-audio are found on sound git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
The master branch or for-next branches can be used as the maindevelopment branches in general while the development for the currentand next kernels are found in for-linus and for-next branches,respectively.
Sending a Bug Report¶
If any model or module options don’t work for your device, it’s timeto send a bug report to the developers. Give the following in yourbug report:
Hardware vendor, product and model names
Kernel version (and ALSA-driver version if you built externally)
alsa-info.shoutput; run with--no-uploadoption. See thesection below about alsa-info
If it’s a regression, at best, send alsa-info outputs of both workingand non-working kernels. This is really helpful because we cancompare the codec registers directly.
Send a bug report either the following:
- kernel-bugzilla
- alsa-devel ML
Debug Tools¶
This section describes some tools available for debugging HD-audioproblems.
alsa-info¶
The scriptalsa-info.sh is a very useful tool to gather the audiodevice information. It’s included in alsa-utils package. The latestversion can be found on git repository:
git://git.alsa-project.org/alsa-utils.git
The script can be fetched directly from the following URL, too:
Run this script as root, and it will gather the important informationsuch as the module lists, module parameters, proc file contentsincluding the codec proc files, mixer outputs and the controlelements. As default, it will store the information onto a web serveron alsa-project.org. But, if you send a bug report, it’d be better torun with--no-upload option, and attach the generated file.
There are some other useful options. See--help option output fordetails.
When a probe error occurs or when the driver obviously assigns amismatched model, it’d be helpful to load the driver withprobe_only=1 option (at best after the cold reboot) and runalsa-info at this state. With this option, the driver won’t configurethe mixer and PCM but just tries to probe the codec slot. Afterprobing, the proc file is available, so you can get the raw codecinformation before modified by the driver. Of course, the driverisn’t usable withprobe_only=1. But you can continue theconfiguration via hwdep sysfs file if hda-reconfig option is enabled.Usingprobe_only mask 2 skips the reset of HDA codecs (useprobe_only=3 as module option). The hwdep interface can be usedto determine the BIOS codec initialization.
hda-verb¶
hda-verb is a tiny program that allows you to access the HD-audiocodec directly. You can execute a raw HD-audio codec verb with this.This program accesses the hwdep device, thus you need to enable thekernel configCONFIG_SND_HDA_HWDEP=y beforehand.
The hda-verb program takes four arguments: the hwdep device file, thewidget NID, the verb and the parameter. When you access to the codecon the slot 2 of the card 0, pass /dev/snd/hwC0D2 to the firstargument, typically. (However, the real path name depends on thesystem.)
The second parameter is the widget number-id to access. The thirdparameter can be either a hex/digit number or a string correspondingto a verb. Similarly, the last parameter is the value to write, orcan be a string for the parameter type.
% hda-verb /dev/snd/hwC0D0 0x12 0x701 2nid = 0x12, verb = 0x701, param = 0x2value = 0x0% hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_IDnid = 0x0, verb = 0xf00, param = 0x0value = 0x10ec0262% hda-verb /dev/snd/hwC0D0 2 set_a 0xb080nid = 0x2, verb = 0x300, param = 0xb080value = 0x0
Although you can issue any verbs with this program, the driver statewon’t be always updated. For example, the volume values are usuallycached in the driver, and thus changing the widget amp value directlyvia hda-verb won’t change the mixer value.
The hda-verb program is included now in alsa-tools:
git://git.alsa-project.org/alsa-tools.git
Also, the old stand-alone package is found in the ftp directory:
Also a git repository is available:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-verb.git
See README file in the tarball for more details about hda-verbprogram.
hda-analyzer¶
hda-analyzer provides a graphical interface to access the raw HD-audiocontrol, based on pyGTK2 binding. It’s a more powerful version ofhda-verb. The program gives you an easy-to-use GUI stuff for showingthe widget information and adjusting the amp values, as well as theproc-compatible output.
The hda-analyzer:
is a part of alsa.git repository in alsa-project.org:
git://git.alsa-project.org/alsa.git
Codecgraph¶
Codecgraph is a utility program to generate a graph and visualizes thecodec-node connection of a codec chip. It’s especially useful whenyou analyze or debug a codec without a proper datasheet. The programparses the given codec proc file and converts to SVG via graphizprogram.
The tarball and GIT trees are found in the web page at:
hda-emu¶
hda-emu is an HD-audio emulator. The main purpose of this program isto debug an HD-audio codec without the real hardware. Thus, itdoesn’t emulate the behavior with the real audio I/O, but it justdumps the codec register changes and the ALSA-driver internal changesat probing and operating the HD-audio driver.
The program requires a codec proc-file to simulate. Get a proc filefor the target codec beforehand, or pick up an example codec from thecodec proc collections in the tarball. Then, run the program with theproc file, and the hda-emu program will start parsing the codec fileand simulates the HD-audio driver:
% hda-emu codecs/stac9200-dell-d820-laptop# Parsing..hda_codec: Unknown model for STAC9200, using BIOS defaultshda_codec: pin nid 08 bios pin config 40c003fa....
The program gives you only a very dumb command-line interface. Youcan get a proc-file dump at the current state, get a list of control(mixer) elements, set/get the control element value, simulate the PCMoperation, the jack plugging simulation, etc.
The program is found in the git repository below:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git
See README file in the repository for more details about hda-emuprogram.
hda-jack-retask¶
hda-jack-retask is a user-friendly GUI program to manipulate theHD-audio pin control for jack retasking. If you have a problem aboutthe jack assignment, try this program and check whether you can getuseful results. Once when you figure out the proper pin assignment,it can be fixed either in the driver code statically or via passing afirmware patch file (see “Early Patching” section).
The program is included in alsa-tools now:
git://git.alsa-project.org/alsa-tools.git