162306a36Sopenharmony_ci============================= 262306a36Sopenharmony_ciMore Notes on HD-Audio Driver 362306a36Sopenharmony_ci============================= 462306a36Sopenharmony_ci 562306a36Sopenharmony_ciTakashi Iwai <tiwai@suse.de> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci 862306a36Sopenharmony_ciGeneral 962306a36Sopenharmony_ci======= 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ciHD-audio is the new standard on-board audio component on modern PCs 1262306a36Sopenharmony_ciafter AC97. Although Linux has been supporting HD-audio since long 1362306a36Sopenharmony_citime ago, there are often problems with new machines. A part of the 1462306a36Sopenharmony_ciproblem is broken BIOS, and the rest is the driver implementation. 1562306a36Sopenharmony_ciThis document explains the brief trouble-shooting and debugging 1662306a36Sopenharmony_cimethods for the HD-audio hardware. 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ciThe HD-audio component consists of two parts: the controller chip and 1962306a36Sopenharmony_cithe codec chips on the HD-audio bus. Linux provides a single driver 2062306a36Sopenharmony_cifor all controllers, snd-hda-intel. Although the driver name contains 2162306a36Sopenharmony_cia word of a well-known hardware vendor, it's not specific to it but for 2262306a36Sopenharmony_ciall controller chips by other companies. Since the HD-audio 2362306a36Sopenharmony_cicontrollers are supposed to be compatible, the single snd-hda-driver 2462306a36Sopenharmony_cishould work in most cases. But, not surprisingly, there are known 2562306a36Sopenharmony_cibugs and issues specific to each controller type. The snd-hda-intel 2662306a36Sopenharmony_cidriver has a bunch of workarounds for these as described below. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciA controller may have multiple codecs. Usually you have one audio 2962306a36Sopenharmony_cicodec and optionally one modem codec. In theory, there might be 3062306a36Sopenharmony_cimultiple audio codecs, e.g. for analog and digital outputs, and the 3162306a36Sopenharmony_cidriver might not work properly because of conflict of mixer elements. 3262306a36Sopenharmony_ciThis should be fixed in future if such hardware really exists. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciThe snd-hda-intel driver has several different codec parsers depending 3562306a36Sopenharmony_cion the codec. It has a generic parser as a fallback, but this 3662306a36Sopenharmony_cifunctionality is fairly limited until now. Instead of the generic 3762306a36Sopenharmony_ciparser, usually the codec-specific parser (coded in patch_*.c) is used 3862306a36Sopenharmony_cifor the codec-specific implementations. The details about the 3962306a36Sopenharmony_cicodec-specific problems are explained in the later sections. 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciIf you are interested in the deep debugging of HD-audio, read the 4262306a36Sopenharmony_ciHD-audio specification at first. The specification is found on 4362306a36Sopenharmony_ciIntel's web page, for example: 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci* https://www.intel.com/standards/hdaudio/ 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ciHD-Audio Controller 4962306a36Sopenharmony_ci=================== 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ciDMA-Position Problem 5262306a36Sopenharmony_ci-------------------- 5362306a36Sopenharmony_ciThe most common problem of the controller is the inaccurate DMA 5462306a36Sopenharmony_cipointer reporting. The DMA pointer for playback and capture can be 5562306a36Sopenharmony_ciread in two ways, either via a LPIB register or via a position-buffer 5662306a36Sopenharmony_cimap. As default the driver tries to read from the io-mapped 5762306a36Sopenharmony_ciposition-buffer, and falls back to LPIB if the position-buffer appears 5862306a36Sopenharmony_cidead. However, this detection isn't perfect on some devices. In such 5962306a36Sopenharmony_cia case, you can change the default method via ``position_fix`` option. 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci``position_fix=1`` means to use LPIB method explicitly. 6262306a36Sopenharmony_ci``position_fix=2`` means to use the position-buffer. 6362306a36Sopenharmony_ci``position_fix=3`` means to use a combination of both methods, needed 6462306a36Sopenharmony_cifor some VIA controllers. The capture stream position is corrected 6562306a36Sopenharmony_ciby comparing both LPIB and position-buffer values. 6662306a36Sopenharmony_ci``position_fix=4`` is another combination available for all controllers, 6762306a36Sopenharmony_ciand uses LPIB for the playback and the position-buffer for the capture 6862306a36Sopenharmony_cistreams. 6962306a36Sopenharmony_ci``position_fix=5`` is specific to Intel platforms, so far, for Skylake 7062306a36Sopenharmony_ciand onward. It applies the delay calculation for the precise position 7162306a36Sopenharmony_cireporting. 7262306a36Sopenharmony_ci``position_fix=6`` is to correct the position with the fixed FIFO 7362306a36Sopenharmony_cisize, mainly targeted for the recent AMD controllers. 7462306a36Sopenharmony_ci0 is the default value for all other 7562306a36Sopenharmony_cicontrollers, the automatic check and fallback to LPIB as described in 7662306a36Sopenharmony_cithe above. If you get a problem of repeated sounds, this option might 7762306a36Sopenharmony_cihelp. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ciIn addition to that, every controller is known to be broken regarding 8062306a36Sopenharmony_cithe wake-up timing. It wakes up a few samples before actually 8162306a36Sopenharmony_ciprocessing the data on the buffer. This caused a lot of problems, for 8262306a36Sopenharmony_ciexample, with ALSA dmix or JACK. Since 2.6.27 kernel, the driver puts 8362306a36Sopenharmony_cian artificial delay to the wake up timing. This delay is controlled 8462306a36Sopenharmony_civia ``bdl_pos_adj`` option. 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciWhen ``bdl_pos_adj`` is a negative value (as default), it's assigned to 8762306a36Sopenharmony_cian appropriate value depending on the controller chip. For Intel 8862306a36Sopenharmony_cichips, it'd be 1 while it'd be 32 for others. Usually this works. 8962306a36Sopenharmony_ciOnly in case it doesn't work and you get warning messages, you should 9062306a36Sopenharmony_cichange this parameter to other values. 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ciCodec-Probing Problem 9462306a36Sopenharmony_ci--------------------- 9562306a36Sopenharmony_ciA less often but a more severe problem is the codec probing. When 9662306a36Sopenharmony_ciBIOS reports the available codec slots wrongly, the driver gets 9762306a36Sopenharmony_ciconfused and tries to access the non-existing codec slot. This often 9862306a36Sopenharmony_ciresults in the total screw-up, and destructs the further communication 9962306a36Sopenharmony_ciwith the codec chips. The symptom appears usually as error messages 10062306a36Sopenharmony_cilike: 10162306a36Sopenharmony_ci:: 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci hda_intel: azx_get_response timeout, switching to polling mode: 10462306a36Sopenharmony_ci last cmd=0x12345678 10562306a36Sopenharmony_ci hda_intel: azx_get_response timeout, switching to single_cmd mode: 10662306a36Sopenharmony_ci last cmd=0x12345678 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciThe first line is a warning, and this is usually relatively harmless. 10962306a36Sopenharmony_ciIt means that the codec response isn't notified via an IRQ. The 11062306a36Sopenharmony_cidriver uses explicit polling method to read the response. It gives 11162306a36Sopenharmony_civery slight CPU overhead, but you'd unlikely notice it. 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_ciThe second line is, however, a fatal error. If this happens, usually 11462306a36Sopenharmony_ciit means that something is really wrong. Most likely you are 11562306a36Sopenharmony_ciaccessing a non-existing codec slot. 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ciThus, if the second error message appears, try to narrow the probed 11862306a36Sopenharmony_cicodec slots via ``probe_mask`` option. It's a bitmask, and each bit 11962306a36Sopenharmony_cicorresponds to the codec slot. For example, to probe only the first 12062306a36Sopenharmony_cislot, pass ``probe_mask=1``. For the first and the third slots, pass 12162306a36Sopenharmony_ci``probe_mask=5`` (where 5 = 1 | 4), and so on. 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ciSince 2.6.29 kernel, the driver has a more robust probing method, so 12462306a36Sopenharmony_cithis error might happen rarely, though. 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ciOn a machine with a broken BIOS, sometimes you need to force the 12762306a36Sopenharmony_cidriver to probe the codec slots the hardware doesn't report for use. 12862306a36Sopenharmony_ciIn such a case, turn the bit 8 (0x100) of ``probe_mask`` option on. 12962306a36Sopenharmony_ciThen the rest 8 bits are passed as the codec slots to probe 13062306a36Sopenharmony_ciunconditionally. For example, ``probe_mask=0x103`` will force to probe 13162306a36Sopenharmony_cithe codec slots 0 and 1 no matter what the hardware reports. 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ciInterrupt Handling 13562306a36Sopenharmony_ci------------------ 13662306a36Sopenharmony_ciHD-audio driver uses MSI as default (if available) since 2.6.33 13762306a36Sopenharmony_cikernel as MSI works better on some machines, and in general, it's 13862306a36Sopenharmony_cibetter for performance. However, Nvidia controllers showed bad 13962306a36Sopenharmony_ciregressions with MSI (especially in a combination with AMD chipset), 14062306a36Sopenharmony_cithus we disabled MSI for them. 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ciThere seem also still other devices that don't work with MSI. If you 14362306a36Sopenharmony_cisee a regression wrt the sound quality (stuttering, etc) or a lock-up 14462306a36Sopenharmony_ciin the recent kernel, try to pass ``enable_msi=0`` option to disable 14562306a36Sopenharmony_ciMSI. If it works, you can add the known bad device to the blacklist 14662306a36Sopenharmony_cidefined in hda_intel.c. In such a case, please report and give the 14762306a36Sopenharmony_cipatch back to the upstream developer. 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ciHD-Audio Codec 15162306a36Sopenharmony_ci============== 15262306a36Sopenharmony_ci 15362306a36Sopenharmony_ciModel Option 15462306a36Sopenharmony_ci------------ 15562306a36Sopenharmony_ciThe most common problem regarding the HD-audio driver is the 15662306a36Sopenharmony_ciunsupported codec features or the mismatched device configuration. 15762306a36Sopenharmony_ciMost of codec-specific code has several preset models, either to 15862306a36Sopenharmony_cioverride the BIOS setup or to provide more comprehensive features. 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ciThe driver checks PCI SSID and looks through the static configuration 16162306a36Sopenharmony_citable until any matching entry is found. If you have a new machine, 16262306a36Sopenharmony_ciyou may see a message like below: 16362306a36Sopenharmony_ci:: 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_ci hda_codec: ALC880: BIOS auto-probing. 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ciMeanwhile, in the earlier versions, you would see a message like: 16862306a36Sopenharmony_ci:: 16962306a36Sopenharmony_ci 17062306a36Sopenharmony_ci hda_codec: Unknown model for ALC880, trying auto-probe from BIOS... 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ciEven if you see such a message, DON'T PANIC. Take a deep breath and 17362306a36Sopenharmony_cikeep your towel. First of all, it's an informational message, no 17462306a36Sopenharmony_ciwarning, no error. This means that the PCI SSID of your device isn't 17562306a36Sopenharmony_cilisted in the known preset model (white-)list. But, this doesn't mean 17662306a36Sopenharmony_cithat the driver is broken. Many codec-drivers provide the automatic 17762306a36Sopenharmony_ciconfiguration mechanism based on the BIOS setup. 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ciThe HD-audio codec has usually "pin" widgets, and BIOS sets the default 18062306a36Sopenharmony_ciconfiguration of each pin, which indicates the location, the 18162306a36Sopenharmony_ciconnection type, the jack color, etc. The HD-audio driver can guess 18262306a36Sopenharmony_cithe right connection judging from these default configuration values. 18362306a36Sopenharmony_ciHowever -- some codec-support codes, such as patch_analog.c, don't 18462306a36Sopenharmony_cisupport the automatic probing (yet as of 2.6.28). And, BIOS is often, 18562306a36Sopenharmony_ciyes, pretty often broken. It sets up wrong values and screws up the 18662306a36Sopenharmony_cidriver. 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ciThe preset model (or recently called as "fix-up") is provided 18962306a36Sopenharmony_cibasically to overcome such a situation. When the matching preset 19062306a36Sopenharmony_cimodel is found in the white-list, the driver assumes the static 19162306a36Sopenharmony_ciconfiguration of that preset with the correct pin setup, etc. 19262306a36Sopenharmony_ciThus, if you have a newer machine with a slightly different PCI SSID 19362306a36Sopenharmony_ci(or codec SSID) from the existing one, you may have a good chance to 19462306a36Sopenharmony_cire-use the same model. You can pass the ``model`` option to specify the 19562306a36Sopenharmony_cipreset model instead of PCI (and codec-) SSID look-up. 19662306a36Sopenharmony_ci 19762306a36Sopenharmony_ciWhat ``model`` option values are available depends on the codec chip. 19862306a36Sopenharmony_ciCheck your codec chip from the codec proc file (see "Codec Proc-File" 19962306a36Sopenharmony_cisection below). It will show the vendor/product name of your codec 20062306a36Sopenharmony_cichip. Then, see Documentation/sound/hd-audio/models.rst file, 20162306a36Sopenharmony_cithe section of HD-audio driver. You can find a list of codecs 20262306a36Sopenharmony_ciand ``model`` options belonging to each codec. For example, for Realtek 20362306a36Sopenharmony_ciALC262 codec chip, pass ``model=ultra`` for devices that are compatible 20462306a36Sopenharmony_ciwith Samsung Q1 Ultra. 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ciThus, the first thing you can do for any brand-new, unsupported and 20762306a36Sopenharmony_cinon-working HD-audio hardware is to check HD-audio codec and several 20862306a36Sopenharmony_cidifferent ``model`` option values. If you have any luck, some of them 20962306a36Sopenharmony_cimight suit with your device well. 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ciThere are a few special model option values: 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci* when 'nofixup' is passed, the device-specific fixups in the codec 21462306a36Sopenharmony_ci parser are skipped. 21562306a36Sopenharmony_ci* when ``generic`` is passed, the codec-specific parser is skipped and 21662306a36Sopenharmony_ci only the generic parser is used. 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ciA new style for the model option that was introduced since 5.15 kernel 21962306a36Sopenharmony_ciis to pass the PCI or codec SSID in the form of ``model=XXXX:YYYY`` 22062306a36Sopenharmony_ciwhere XXXX and YYYY are the sub-vendor and sub-device IDs in hex 22162306a36Sopenharmony_cinumbers, respectively. This is a kind of aliasing to another device; 22262306a36Sopenharmony_ciwhen this form is given, the driver will refer to that SSID as a 22362306a36Sopenharmony_cireference to the quirk table. It'd be useful especially when the 22462306a36Sopenharmony_citarget quirk isn't listed in the model table. For example, passing 22562306a36Sopenharmony_cimodel=103c:8862 will apply the quirk for HP ProBook 445 G8 (which 22662306a36Sopenharmony_ciisn't found in the model table as of writing) as long as the device is 22762306a36Sopenharmony_cihandled equivalently by the same driver. 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ciSpeaker and Headphone Output 23162306a36Sopenharmony_ci---------------------------- 23262306a36Sopenharmony_ciOne of the most frequent (and obvious) bugs with HD-audio is the 23362306a36Sopenharmony_cisilent output from either or both of a built-in speaker and a 23462306a36Sopenharmony_ciheadphone jack. In general, you should try a headphone output at 23562306a36Sopenharmony_cifirst. A speaker output often requires more additional controls like 23662306a36Sopenharmony_cithe external amplifier bits. Thus a headphone output has a slightly 23762306a36Sopenharmony_cibetter chance. 23862306a36Sopenharmony_ci 23962306a36Sopenharmony_ciBefore making a bug report, double-check whether the mixer is set up 24062306a36Sopenharmony_cicorrectly. The recent version of snd-hda-intel driver provides mostly 24162306a36Sopenharmony_ci"Master" volume control as well as "Front" volume (where Front 24262306a36Sopenharmony_ciindicates the front-channels). In addition, there can be individual 24362306a36Sopenharmony_ci"Headphone" and "Speaker" controls. 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ciDitto for the speaker output. There can be "External Amplifier" 24662306a36Sopenharmony_ciswitch on some codecs. Turn on this if present. 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ciAnother related problem is the automatic mute of speaker output by 24962306a36Sopenharmony_ciheadphone plugging. This feature is implemented in most cases, but 25062306a36Sopenharmony_cinot on every preset model or codec-support code. 25162306a36Sopenharmony_ci 25262306a36Sopenharmony_ciIn anyway, try a different model option if you have such a problem. 25362306a36Sopenharmony_ciSome other models may match better and give you more matching 25462306a36Sopenharmony_cifunctionality. If none of the available models works, send a bug 25562306a36Sopenharmony_cireport. See the bug report section for details. 25662306a36Sopenharmony_ci 25762306a36Sopenharmony_ciIf you are masochistic enough to debug the driver problem, note the 25862306a36Sopenharmony_cifollowing: 25962306a36Sopenharmony_ci 26062306a36Sopenharmony_ci* The speaker (and the headphone, too) output often requires the 26162306a36Sopenharmony_ci external amplifier. This can be set usually via EAPD verb or a 26262306a36Sopenharmony_ci certain GPIO. If the codec pin supports EAPD, you have a better 26362306a36Sopenharmony_ci chance via SET_EAPD_BTL verb (0x70c). On others, GPIO pin (mostly 26462306a36Sopenharmony_ci it's either GPIO0 or GPIO1) may turn on/off EAPD. 26562306a36Sopenharmony_ci* Some Realtek codecs require special vendor-specific coefficients to 26662306a36Sopenharmony_ci turn on the amplifier. See patch_realtek.c. 26762306a36Sopenharmony_ci* IDT codecs may have extra power-enable/disable controls on each 26862306a36Sopenharmony_ci analog pin. See patch_sigmatel.c. 26962306a36Sopenharmony_ci* Very rare but some devices don't accept the pin-detection verb until 27062306a36Sopenharmony_ci triggered. Issuing GET_PIN_SENSE verb (0xf09) may result in the 27162306a36Sopenharmony_ci codec-communication stall. Some examples are found in 27262306a36Sopenharmony_ci patch_realtek.c. 27362306a36Sopenharmony_ci 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_ciCapture Problems 27662306a36Sopenharmony_ci---------------- 27762306a36Sopenharmony_ciThe capture problems are often because of missing setups of mixers. 27862306a36Sopenharmony_ciThus, before submitting a bug report, make sure that you set up the 27962306a36Sopenharmony_cimixer correctly. For example, both "Capture Volume" and "Capture 28062306a36Sopenharmony_ciSwitch" have to be set properly in addition to the right "Capture 28162306a36Sopenharmony_ciSource" or "Input Source" selection. Some devices have "Mic Boost" 28262306a36Sopenharmony_civolume or switch. 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ciWhen the PCM device is opened via "default" PCM (without pulse-audio 28562306a36Sopenharmony_ciplugin), you'll likely have "Digital Capture Volume" control as well. 28662306a36Sopenharmony_ciThis is provided for the extra gain/attenuation of the signal in 28762306a36Sopenharmony_cisoftware, especially for the inputs without the hardware volume 28862306a36Sopenharmony_cicontrol such as digital microphones. Unless really needed, this 28962306a36Sopenharmony_cishould be set to exactly 50%, corresponding to 0dB -- neither extra 29062306a36Sopenharmony_cigain nor attenuation. When you use "hw" PCM, i.e., a raw access PCM, 29162306a36Sopenharmony_cithis control will have no influence, though. 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ciIt's known that some codecs / devices have fairly bad analog circuits, 29462306a36Sopenharmony_ciand the recorded sound contains a certain DC-offset. This is no bug 29562306a36Sopenharmony_ciof the driver. 29662306a36Sopenharmony_ci 29762306a36Sopenharmony_ciMost of modern laptops have no analog CD-input connection. Thus, the 29862306a36Sopenharmony_cirecording from CD input won't work in many cases although the driver 29962306a36Sopenharmony_ciprovides it as the capture source. Use CDDA instead. 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ciThe automatic switching of the built-in and external mic per plugging 30262306a36Sopenharmony_ciis implemented on some codec models but not on every model. Partly 30362306a36Sopenharmony_cibecause of my laziness but mostly lack of testers. Feel free to 30462306a36Sopenharmony_cisubmit the improvement patch to the author. 30562306a36Sopenharmony_ci 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_ciDirect Debugging 30862306a36Sopenharmony_ci---------------- 30962306a36Sopenharmony_ciIf no model option gives you a better result, and you are a tough guy 31062306a36Sopenharmony_cito fight against evil, try debugging via hitting the raw HD-audio 31162306a36Sopenharmony_cicodec verbs to the device. Some tools are available: hda-emu and 31262306a36Sopenharmony_cihda-analyzer. The detailed description is found in the sections 31362306a36Sopenharmony_cibelow. You'd need to enable hwdep for using these tools. See "Kernel 31462306a36Sopenharmony_ciConfiguration" section. 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci 31762306a36Sopenharmony_ciOther Issues 31862306a36Sopenharmony_ci============ 31962306a36Sopenharmony_ci 32062306a36Sopenharmony_ciKernel Configuration 32162306a36Sopenharmony_ci-------------------- 32262306a36Sopenharmony_ciIn general, I recommend you to enable the sound debug option, 32362306a36Sopenharmony_ci``CONFIG_SND_DEBUG=y``, no matter whether you are debugging or not. 32462306a36Sopenharmony_ciThis enables snd_printd() macro and others, and you'll get additional 32562306a36Sopenharmony_cikernel messages at probing. 32662306a36Sopenharmony_ci 32762306a36Sopenharmony_ciIn addition, you can enable ``CONFIG_SND_DEBUG_VERBOSE=y``. But this 32862306a36Sopenharmony_ciwill give you far more messages. Thus turn this on only when you are 32962306a36Sopenharmony_cisure to want it. 33062306a36Sopenharmony_ci 33162306a36Sopenharmony_ciDon't forget to turn on the appropriate ``CONFIG_SND_HDA_CODEC_*`` 33262306a36Sopenharmony_cioptions. Note that each of them corresponds to the codec chip, not 33362306a36Sopenharmony_cithe controller chip. Thus, even if lspci shows the Nvidia controller, 33462306a36Sopenharmony_ciyou may need to choose the option for other vendors. If you are 33562306a36Sopenharmony_ciunsure, just select all yes. 33662306a36Sopenharmony_ci 33762306a36Sopenharmony_ci``CONFIG_SND_HDA_HWDEP`` is a useful option for debugging the driver. 33862306a36Sopenharmony_ciWhen this is enabled, the driver creates hardware-dependent devices 33962306a36Sopenharmony_ci(one per each codec), and you have a raw access to the device via 34062306a36Sopenharmony_cithese device files. For example, ``hwC0D2`` will be created for the 34162306a36Sopenharmony_cicodec slot #2 of the first card (#0). For debug-tools such as 34262306a36Sopenharmony_cihda-verb and hda-analyzer, the hwdep device has to be enabled. 34362306a36Sopenharmony_ciThus, it'd be better to turn this on always. 34462306a36Sopenharmony_ci 34562306a36Sopenharmony_ci``CONFIG_SND_HDA_RECONFIG`` is a new option, and this depends on the 34662306a36Sopenharmony_cihwdep option above. When enabled, you'll have some sysfs files under 34762306a36Sopenharmony_cithe corresponding hwdep directory. See "HD-audio reconfiguration" 34862306a36Sopenharmony_cisection below. 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci``CONFIG_SND_HDA_POWER_SAVE`` option enables the power-saving feature. 35162306a36Sopenharmony_ciSee "Power-saving" section below. 35262306a36Sopenharmony_ci 35362306a36Sopenharmony_ci 35462306a36Sopenharmony_ciCodec Proc-File 35562306a36Sopenharmony_ci--------------- 35662306a36Sopenharmony_ciThe codec proc-file is a treasure-chest for debugging HD-audio. 35762306a36Sopenharmony_ciIt shows most of useful information of each codec widget. 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ciThe proc file is located in /proc/asound/card*/codec#*, one file per 36062306a36Sopenharmony_cieach codec slot. You can know the codec vendor, product id and 36162306a36Sopenharmony_cinames, the type of each widget, capabilities and so on. 36262306a36Sopenharmony_ciThis file, however, doesn't show the jack sensing state, so far. This 36362306a36Sopenharmony_ciis because the jack-sensing might be depending on the trigger state. 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ciThis file will be picked up by the debug tools, and also it can be fed 36662306a36Sopenharmony_cito the emulator as the primary codec information. See the debug tools 36762306a36Sopenharmony_cisection below. 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ciThis proc file can be also used to check whether the generic parser is 37062306a36Sopenharmony_ciused. When the generic parser is used, the vendor/product ID name 37162306a36Sopenharmony_ciwill appear as "Realtek ID 0262", instead of "Realtek ALC262". 37262306a36Sopenharmony_ci 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ciHD-Audio Reconfiguration 37562306a36Sopenharmony_ci------------------------ 37662306a36Sopenharmony_ciThis is an experimental feature to allow you re-configure the HD-audio 37762306a36Sopenharmony_cicodec dynamically without reloading the driver. The following sysfs 37862306a36Sopenharmony_cifiles are available under each codec-hwdep device directory (e.g. 37962306a36Sopenharmony_ci/sys/class/sound/hwC0D0): 38062306a36Sopenharmony_ci 38162306a36Sopenharmony_civendor_id 38262306a36Sopenharmony_ci Shows the 32bit codec vendor-id hex number. You can change the 38362306a36Sopenharmony_ci vendor-id value by writing to this file. 38462306a36Sopenharmony_cisubsystem_id 38562306a36Sopenharmony_ci Shows the 32bit codec subsystem-id hex number. You can change the 38662306a36Sopenharmony_ci subsystem-id value by writing to this file. 38762306a36Sopenharmony_cirevision_id 38862306a36Sopenharmony_ci Shows the 32bit codec revision-id hex number. You can change the 38962306a36Sopenharmony_ci revision-id value by writing to this file. 39062306a36Sopenharmony_ciafg 39162306a36Sopenharmony_ci Shows the AFG ID. This is read-only. 39262306a36Sopenharmony_cimfg 39362306a36Sopenharmony_ci Shows the MFG ID. This is read-only. 39462306a36Sopenharmony_ciname 39562306a36Sopenharmony_ci Shows the codec name string. Can be changed by writing to this 39662306a36Sopenharmony_ci file. 39762306a36Sopenharmony_cimodelname 39862306a36Sopenharmony_ci Shows the currently set ``model`` option. Can be changed by writing 39962306a36Sopenharmony_ci to this file. 40062306a36Sopenharmony_ciinit_verbs 40162306a36Sopenharmony_ci The extra verbs to execute at initialization. You can add a verb by 40262306a36Sopenharmony_ci writing to this file. Pass three numbers: nid, verb and parameter 40362306a36Sopenharmony_ci (separated with a space). 40462306a36Sopenharmony_cihints 40562306a36Sopenharmony_ci Shows / stores hint strings for codec parsers for any use. 40662306a36Sopenharmony_ci Its format is ``key = value``. For example, passing ``jack_detect = no`` 40762306a36Sopenharmony_ci will disable the jack detection of the machine completely. 40862306a36Sopenharmony_ciinit_pin_configs 40962306a36Sopenharmony_ci Shows the initial pin default config values set by BIOS. 41062306a36Sopenharmony_cidriver_pin_configs 41162306a36Sopenharmony_ci Shows the pin default values set by the codec parser explicitly. 41262306a36Sopenharmony_ci This doesn't show all pin values but only the changed values by 41362306a36Sopenharmony_ci the parser. That is, if the parser doesn't change the pin default 41462306a36Sopenharmony_ci config values by itself, this will contain nothing. 41562306a36Sopenharmony_ciuser_pin_configs 41662306a36Sopenharmony_ci Shows the pin default config values to override the BIOS setup. 41762306a36Sopenharmony_ci Writing this (with two numbers, NID and value) appends the new 41862306a36Sopenharmony_ci value. The given will be used instead of the initial BIOS value at 41962306a36Sopenharmony_ci the next reconfiguration time. Note that this config will override 42062306a36Sopenharmony_ci even the driver pin configs, too. 42162306a36Sopenharmony_cireconfig 42262306a36Sopenharmony_ci Triggers the codec re-configuration. When any value is written to 42362306a36Sopenharmony_ci this file, the driver re-initialize and parses the codec tree 42462306a36Sopenharmony_ci again. All the changes done by the sysfs entries above are taken 42562306a36Sopenharmony_ci into account. 42662306a36Sopenharmony_ciclear 42762306a36Sopenharmony_ci Resets the codec, removes the mixer elements and PCM stuff of the 42862306a36Sopenharmony_ci specified codec, and clear all init verbs and hints. 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_ciFor example, when you want to change the pin default configuration 43162306a36Sopenharmony_civalue of the pin widget 0x14 to 0x9993013f, and let the driver 43262306a36Sopenharmony_cire-configure based on that state, run like below: 43362306a36Sopenharmony_ci:: 43462306a36Sopenharmony_ci 43562306a36Sopenharmony_ci # echo 0x14 0x9993013f > /sys/class/sound/hwC0D0/user_pin_configs 43662306a36Sopenharmony_ci # echo 1 > /sys/class/sound/hwC0D0/reconfig 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ciHint Strings 44062306a36Sopenharmony_ci------------ 44162306a36Sopenharmony_ciThe codec parser have several switches and adjustment knobs for 44262306a36Sopenharmony_cimatching better with the actual codec or device behavior. Many of 44362306a36Sopenharmony_cithem can be adjusted dynamically via "hints" strings as mentioned in 44462306a36Sopenharmony_cithe section above. For example, by passing ``jack_detect = no`` string 44562306a36Sopenharmony_civia sysfs or a patch file, you can disable the jack detection, thus 44662306a36Sopenharmony_cithe codec parser will skip the features like auto-mute or mic 44762306a36Sopenharmony_ciauto-switch. As a boolean value, either ``yes``, ``no``, ``true``, ``false``, 44862306a36Sopenharmony_ci``1`` or ``0`` can be passed. 44962306a36Sopenharmony_ci 45062306a36Sopenharmony_ciThe generic parser supports the following hints: 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_cijack_detect (bool) 45362306a36Sopenharmony_ci specify whether the jack detection is available at all on this 45462306a36Sopenharmony_ci machine; default true 45562306a36Sopenharmony_ciinv_jack_detect (bool) 45662306a36Sopenharmony_ci indicates that the jack detection logic is inverted 45762306a36Sopenharmony_citrigger_sense (bool) 45862306a36Sopenharmony_ci indicates that the jack detection needs the explicit call of 45962306a36Sopenharmony_ci AC_VERB_SET_PIN_SENSE verb 46062306a36Sopenharmony_ciinv_eapd (bool) 46162306a36Sopenharmony_ci indicates that the EAPD is implemented in the inverted logic 46262306a36Sopenharmony_cipcm_format_first (bool) 46362306a36Sopenharmony_ci sets the PCM format before the stream tag and channel ID 46462306a36Sopenharmony_cisticky_stream (bool) 46562306a36Sopenharmony_ci keep the PCM format, stream tag and ID as long as possible; 46662306a36Sopenharmony_ci default true 46762306a36Sopenharmony_cispdif_status_reset (bool) 46862306a36Sopenharmony_ci reset the SPDIF status bits at each time the SPDIF stream is set 46962306a36Sopenharmony_ci up 47062306a36Sopenharmony_cipin_amp_workaround (bool) 47162306a36Sopenharmony_ci the output pin may have multiple amp values 47262306a36Sopenharmony_cisingle_adc_amp (bool) 47362306a36Sopenharmony_ci ADCs can have only single input amps 47462306a36Sopenharmony_ciauto_mute (bool) 47562306a36Sopenharmony_ci enable/disable the headphone auto-mute feature; default true 47662306a36Sopenharmony_ciauto_mic (bool) 47762306a36Sopenharmony_ci enable/disable the mic auto-switch feature; default true 47862306a36Sopenharmony_ciline_in_auto_switch (bool) 47962306a36Sopenharmony_ci enable/disable the line-in auto-switch feature; default false 48062306a36Sopenharmony_cineed_dac_fix (bool) 48162306a36Sopenharmony_ci limits the DACs depending on the channel count 48262306a36Sopenharmony_ciprimary_hp (bool) 48362306a36Sopenharmony_ci probe headphone jacks as the primary outputs; default true 48462306a36Sopenharmony_cimulti_io (bool) 48562306a36Sopenharmony_ci try probing multi-I/O config (e.g. shared line-in/surround, 48662306a36Sopenharmony_ci mic/clfe jacks) 48762306a36Sopenharmony_cimulti_cap_vol (bool) 48862306a36Sopenharmony_ci provide multiple capture volumes 48962306a36Sopenharmony_ciinv_dmic_split (bool) 49062306a36Sopenharmony_ci provide split internal mic volume/switch for phase-inverted 49162306a36Sopenharmony_ci digital mics 49262306a36Sopenharmony_ciindep_hp (bool) 49362306a36Sopenharmony_ci provide the independent headphone PCM stream and the corresponding 49462306a36Sopenharmony_ci mixer control, if available 49562306a36Sopenharmony_ciadd_stereo_mix_input (bool) 49662306a36Sopenharmony_ci add the stereo mix (analog-loopback mix) to the input mux if 49762306a36Sopenharmony_ci available 49862306a36Sopenharmony_ciadd_jack_modes (bool) 49962306a36Sopenharmony_ci add "xxx Jack Mode" enum controls to each I/O jack for allowing to 50062306a36Sopenharmony_ci change the headphone amp and mic bias VREF capabilities 50162306a36Sopenharmony_cipower_save_node (bool) 50262306a36Sopenharmony_ci advanced power management for each widget, controlling the power 50362306a36Sopenharmony_ci state (D0/D3) of each widget node depending on the actual pin and 50462306a36Sopenharmony_ci stream states 50562306a36Sopenharmony_cipower_down_unused (bool) 50662306a36Sopenharmony_ci power down the unused widgets, a subset of power_save_node, and 50762306a36Sopenharmony_ci will be dropped in future 50862306a36Sopenharmony_ciadd_hp_mic (bool) 50962306a36Sopenharmony_ci add the headphone to capture source if possible 51062306a36Sopenharmony_cihp_mic_detect (bool) 51162306a36Sopenharmony_ci enable/disable the hp/mic shared input for a single built-in mic 51262306a36Sopenharmony_ci case; default true 51362306a36Sopenharmony_civmaster (bool) 51462306a36Sopenharmony_ci enable/disable the virtual Master control; default true 51562306a36Sopenharmony_cimixer_nid (int) 51662306a36Sopenharmony_ci specifies the widget NID of the analog-loopback mixer 51762306a36Sopenharmony_ci 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_ciEarly Patching 52062306a36Sopenharmony_ci-------------- 52162306a36Sopenharmony_ciWhen ``CONFIG_SND_HDA_PATCH_LOADER=y`` is set, you can pass a "patch" 52262306a36Sopenharmony_cias a firmware file for modifying the HD-audio setup before 52362306a36Sopenharmony_ciinitializing the codec. This can work basically like the 52462306a36Sopenharmony_cireconfiguration via sysfs in the above, but it does it before the 52562306a36Sopenharmony_cifirst codec configuration. 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_ciA patch file is a plain text file which looks like below: 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci:: 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci [codec] 53262306a36Sopenharmony_ci 0x12345678 0xabcd1234 2 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci [model] 53562306a36Sopenharmony_ci auto 53662306a36Sopenharmony_ci 53762306a36Sopenharmony_ci [pincfg] 53862306a36Sopenharmony_ci 0x12 0x411111f0 53962306a36Sopenharmony_ci 54062306a36Sopenharmony_ci [verb] 54162306a36Sopenharmony_ci 0x20 0x500 0x03 54262306a36Sopenharmony_ci 0x20 0x400 0xff 54362306a36Sopenharmony_ci 54462306a36Sopenharmony_ci [hint] 54562306a36Sopenharmony_ci jack_detect = no 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_ci 54862306a36Sopenharmony_ciThe file needs to have a line ``[codec]``. The next line should contain 54962306a36Sopenharmony_cithree numbers indicating the codec vendor-id (0x12345678 in the 55062306a36Sopenharmony_ciexample), the codec subsystem-id (0xabcd1234) and the address (2) of 55162306a36Sopenharmony_cithe codec. The rest patch entries are applied to this specified codec 55262306a36Sopenharmony_ciuntil another codec entry is given. Passing 0 or a negative number to 55362306a36Sopenharmony_cithe first or the second value will make the check of the corresponding 55462306a36Sopenharmony_cifield be skipped. It'll be useful for really broken devices that don't 55562306a36Sopenharmony_ciinitialize SSID properly. 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ciThe ``[model]`` line allows to change the model name of the each codec. 55862306a36Sopenharmony_ciIn the example above, it will be changed to model=auto. 55962306a36Sopenharmony_ciNote that this overrides the module option. 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ciAfter the ``[pincfg]`` line, the contents are parsed as the initial 56262306a36Sopenharmony_cidefault pin-configurations just like ``user_pin_configs`` sysfs above. 56362306a36Sopenharmony_ciThe values can be shown in user_pin_configs sysfs file, too. 56462306a36Sopenharmony_ci 56562306a36Sopenharmony_ciSimilarly, the lines after ``[verb]`` are parsed as ``init_verbs`` 56662306a36Sopenharmony_cisysfs entries, and the lines after ``[hint]`` are parsed as ``hints`` 56762306a36Sopenharmony_cisysfs entries, respectively. 56862306a36Sopenharmony_ci 56962306a36Sopenharmony_ciAnother example to override the codec vendor id from 0x12345678 to 57062306a36Sopenharmony_ci0xdeadbeef is like below: 57162306a36Sopenharmony_ci:: 57262306a36Sopenharmony_ci 57362306a36Sopenharmony_ci [codec] 57462306a36Sopenharmony_ci 0x12345678 0xabcd1234 2 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci [vendor_id] 57762306a36Sopenharmony_ci 0xdeadbeef 57862306a36Sopenharmony_ci 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ciIn the similar way, you can override the codec subsystem_id via 58162306a36Sopenharmony_ci``[subsystem_id]``, the revision id via ``[revision_id]`` line. 58262306a36Sopenharmony_ciAlso, the codec chip name can be rewritten via ``[chip_name]`` line. 58362306a36Sopenharmony_ci:: 58462306a36Sopenharmony_ci 58562306a36Sopenharmony_ci [codec] 58662306a36Sopenharmony_ci 0x12345678 0xabcd1234 2 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci [subsystem_id] 58962306a36Sopenharmony_ci 0xffff1111 59062306a36Sopenharmony_ci 59162306a36Sopenharmony_ci [revision_id] 59262306a36Sopenharmony_ci 0x10 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ci [chip_name] 59562306a36Sopenharmony_ci My-own NEWS-0002 59662306a36Sopenharmony_ci 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ciThe hd-audio driver reads the file via request_firmware(). Thus, 59962306a36Sopenharmony_cia patch file has to be located on the appropriate firmware path, 60062306a36Sopenharmony_citypically, /lib/firmware. For example, when you pass the option 60162306a36Sopenharmony_ci``patch=hda-init.fw``, the file /lib/firmware/hda-init.fw must be 60262306a36Sopenharmony_cipresent. 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ciThe patch module option is specific to each card instance, and you 60562306a36Sopenharmony_cineed to give one file name for each instance, separated by commas. 60662306a36Sopenharmony_ciFor example, if you have two cards, one for an on-board analog and one 60762306a36Sopenharmony_cifor an HDMI video board, you may pass patch option like below: 60862306a36Sopenharmony_ci:: 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_ci options snd-hda-intel patch=on-board-patch,hdmi-patch 61162306a36Sopenharmony_ci 61262306a36Sopenharmony_ci 61362306a36Sopenharmony_ciPower-Saving 61462306a36Sopenharmony_ci------------ 61562306a36Sopenharmony_ciThe power-saving is a kind of auto-suspend of the device. When the 61662306a36Sopenharmony_cidevice is inactive for a certain time, the device is automatically 61762306a36Sopenharmony_citurned off to save the power. The time to go down is specified via 61862306a36Sopenharmony_ci``power_save`` module option, and this option can be changed dynamically 61962306a36Sopenharmony_civia sysfs. 62062306a36Sopenharmony_ci 62162306a36Sopenharmony_ciThe power-saving won't work when the analog loopback is enabled on 62262306a36Sopenharmony_cisome codecs. Make sure that you mute all unneeded signal routes when 62362306a36Sopenharmony_ciyou want the power-saving. 62462306a36Sopenharmony_ci 62562306a36Sopenharmony_ciThe power-saving feature might cause audible click noises at each 62662306a36Sopenharmony_cipower-down/up depending on the device. Some of them might be 62762306a36Sopenharmony_cisolvable, but some are hard, I'm afraid. Some distros such as 62862306a36Sopenharmony_ciopenSUSE enables the power-saving feature automatically when the power 62962306a36Sopenharmony_cicable is unplugged. Thus, if you hear noises, suspect first the 63062306a36Sopenharmony_cipower-saving. See /sys/module/snd_hda_intel/parameters/power_save to 63162306a36Sopenharmony_cicheck the current value. If it's non-zero, the feature is turned on. 63262306a36Sopenharmony_ci 63362306a36Sopenharmony_ciThe recent kernel supports the runtime PM for the HD-audio controller 63462306a36Sopenharmony_cichip, too. It means that the HD-audio controller is also powered up / 63562306a36Sopenharmony_cidown dynamically. The feature is enabled only for certain controller 63662306a36Sopenharmony_cichips like Intel LynxPoint. You can enable/disable this feature 63762306a36Sopenharmony_ciforcibly by setting ``power_save_controller`` option, which is also 63862306a36Sopenharmony_ciavailable at /sys/module/snd_hda_intel/parameters directory. 63962306a36Sopenharmony_ci 64062306a36Sopenharmony_ci 64162306a36Sopenharmony_ciTracepoints 64262306a36Sopenharmony_ci----------- 64362306a36Sopenharmony_ciThe hd-audio driver gives a few basic tracepoints. 64462306a36Sopenharmony_ci``hda:hda_send_cmd`` traces each CORB write while ``hda:hda_get_response`` 64562306a36Sopenharmony_citraces the response from RIRB (only when read from the codec driver). 64662306a36Sopenharmony_ci``hda:hda_bus_reset`` traces the bus-reset due to fatal error, etc, 64762306a36Sopenharmony_ci``hda:hda_unsol_event`` traces the unsolicited events, and 64862306a36Sopenharmony_ci``hda:hda_power_down`` and ``hda:hda_power_up`` trace the power down/up 64962306a36Sopenharmony_civia power-saving behavior. 65062306a36Sopenharmony_ci 65162306a36Sopenharmony_ciEnabling all tracepoints can be done like 65262306a36Sopenharmony_ci:: 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_ci # echo 1 > /sys/kernel/tracing/events/hda/enable 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_cithen after some commands, you can traces from 65762306a36Sopenharmony_ci/sys/kernel/tracing/trace file. For example, when you want to 65862306a36Sopenharmony_citrace what codec command is sent, enable the tracepoint like: 65962306a36Sopenharmony_ci:: 66062306a36Sopenharmony_ci 66162306a36Sopenharmony_ci # cat /sys/kernel/tracing/trace 66262306a36Sopenharmony_ci # tracer: nop 66362306a36Sopenharmony_ci # 66462306a36Sopenharmony_ci # TASK-PID CPU# TIMESTAMP FUNCTION 66562306a36Sopenharmony_ci # | | | | | 66662306a36Sopenharmony_ci <...>-7807 [002] 105147.774889: hda_send_cmd: [0:0] val=e3a019 66762306a36Sopenharmony_ci <...>-7807 [002] 105147.774893: hda_send_cmd: [0:0] val=e39019 66862306a36Sopenharmony_ci <...>-7807 [002] 105147.999542: hda_send_cmd: [0:0] val=e3a01a 66962306a36Sopenharmony_ci <...>-7807 [002] 105147.999543: hda_send_cmd: [0:0] val=e3901a 67062306a36Sopenharmony_ci <...>-26764 [001] 349222.837143: hda_send_cmd: [0:0] val=e3a019 67162306a36Sopenharmony_ci <...>-26764 [001] 349222.837148: hda_send_cmd: [0:0] val=e39019 67262306a36Sopenharmony_ci <...>-26764 [001] 349223.058539: hda_send_cmd: [0:0] val=e3a01a 67362306a36Sopenharmony_ci <...>-26764 [001] 349223.058541: hda_send_cmd: [0:0] val=e3901a 67462306a36Sopenharmony_ci 67562306a36Sopenharmony_ciHere ``[0:0]`` indicates the card number and the codec address, and 67662306a36Sopenharmony_ci``val`` shows the value sent to the codec, respectively. The value is 67762306a36Sopenharmony_cia packed value, and you can decode it via hda-decode-verb program 67862306a36Sopenharmony_ciincluded in hda-emu package below. For example, the value e3a019 is 67962306a36Sopenharmony_cito set the left output-amp value to 25. 68062306a36Sopenharmony_ci:: 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_ci % hda-decode-verb 0xe3a019 68362306a36Sopenharmony_ci raw value = 0x00e3a019 68462306a36Sopenharmony_ci cid = 0, nid = 0x0e, verb = 0x3a0, parm = 0x19 68562306a36Sopenharmony_ci raw value: verb = 0x3a0, parm = 0x19 68662306a36Sopenharmony_ci verbname = set_amp_gain_mute 68762306a36Sopenharmony_ci amp raw val = 0xa019 68862306a36Sopenharmony_ci output, left, idx=0, mute=0, val=25 68962306a36Sopenharmony_ci 69062306a36Sopenharmony_ci 69162306a36Sopenharmony_ciDevelopment Tree 69262306a36Sopenharmony_ci---------------- 69362306a36Sopenharmony_ciThe latest development codes for HD-audio are found on sound git tree: 69462306a36Sopenharmony_ci 69562306a36Sopenharmony_ci* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git 69662306a36Sopenharmony_ci 69762306a36Sopenharmony_ciThe master branch or for-next branches can be used as the main 69862306a36Sopenharmony_cidevelopment branches in general while the development for the current 69962306a36Sopenharmony_ciand next kernels are found in for-linus and for-next branches, 70062306a36Sopenharmony_cirespectively. 70162306a36Sopenharmony_ci 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ciSending a Bug Report 70462306a36Sopenharmony_ci-------------------- 70562306a36Sopenharmony_ciIf any model or module options don't work for your device, it's time 70662306a36Sopenharmony_cito send a bug report to the developers. Give the following in your 70762306a36Sopenharmony_cibug report: 70862306a36Sopenharmony_ci 70962306a36Sopenharmony_ci* Hardware vendor, product and model names 71062306a36Sopenharmony_ci* Kernel version (and ALSA-driver version if you built externally) 71162306a36Sopenharmony_ci* ``alsa-info.sh`` output; run with ``--no-upload`` option. See the 71262306a36Sopenharmony_ci section below about alsa-info 71362306a36Sopenharmony_ci 71462306a36Sopenharmony_ciIf it's a regression, at best, send alsa-info outputs of both working 71562306a36Sopenharmony_ciand non-working kernels. This is really helpful because we can 71662306a36Sopenharmony_cicompare the codec registers directly. 71762306a36Sopenharmony_ci 71862306a36Sopenharmony_ciSend a bug report either the following: 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_cikernel-bugzilla 72162306a36Sopenharmony_ci https://bugzilla.kernel.org/ 72262306a36Sopenharmony_cialsa-devel ML 72362306a36Sopenharmony_ci alsa-devel@alsa-project.org 72462306a36Sopenharmony_ci 72562306a36Sopenharmony_ci 72662306a36Sopenharmony_ciDebug Tools 72762306a36Sopenharmony_ci=========== 72862306a36Sopenharmony_ci 72962306a36Sopenharmony_ciThis section describes some tools available for debugging HD-audio 73062306a36Sopenharmony_ciproblems. 73162306a36Sopenharmony_ci 73262306a36Sopenharmony_cialsa-info 73362306a36Sopenharmony_ci--------- 73462306a36Sopenharmony_ciThe script ``alsa-info.sh`` is a very useful tool to gather the audio 73562306a36Sopenharmony_cidevice information. It's included in alsa-utils package. The latest 73662306a36Sopenharmony_civersion can be found on git repository: 73762306a36Sopenharmony_ci 73862306a36Sopenharmony_ci* git://git.alsa-project.org/alsa-utils.git 73962306a36Sopenharmony_ci 74062306a36Sopenharmony_ciThe script can be fetched directly from the following URL, too: 74162306a36Sopenharmony_ci 74262306a36Sopenharmony_ci* https://www.alsa-project.org/alsa-info.sh 74362306a36Sopenharmony_ci 74462306a36Sopenharmony_ciRun this script as root, and it will gather the important information 74562306a36Sopenharmony_cisuch as the module lists, module parameters, proc file contents 74662306a36Sopenharmony_ciincluding the codec proc files, mixer outputs and the control 74762306a36Sopenharmony_cielements. As default, it will store the information onto a web server 74862306a36Sopenharmony_cion alsa-project.org. But, if you send a bug report, it'd be better to 74962306a36Sopenharmony_cirun with ``--no-upload`` option, and attach the generated file. 75062306a36Sopenharmony_ci 75162306a36Sopenharmony_ciThere are some other useful options. See ``--help`` option output for 75262306a36Sopenharmony_cidetails. 75362306a36Sopenharmony_ci 75462306a36Sopenharmony_ciWhen a probe error occurs or when the driver obviously assigns a 75562306a36Sopenharmony_cimismatched model, it'd be helpful to load the driver with 75662306a36Sopenharmony_ci``probe_only=1`` option (at best after the cold reboot) and run 75762306a36Sopenharmony_cialsa-info at this state. With this option, the driver won't configure 75862306a36Sopenharmony_cithe mixer and PCM but just tries to probe the codec slot. After 75962306a36Sopenharmony_ciprobing, the proc file is available, so you can get the raw codec 76062306a36Sopenharmony_ciinformation before modified by the driver. Of course, the driver 76162306a36Sopenharmony_ciisn't usable with ``probe_only=1``. But you can continue the 76262306a36Sopenharmony_ciconfiguration via hwdep sysfs file if hda-reconfig option is enabled. 76362306a36Sopenharmony_ciUsing ``probe_only`` mask 2 skips the reset of HDA codecs (use 76462306a36Sopenharmony_ci``probe_only=3`` as module option). The hwdep interface can be used 76562306a36Sopenharmony_cito determine the BIOS codec initialization. 76662306a36Sopenharmony_ci 76762306a36Sopenharmony_ci 76862306a36Sopenharmony_cihda-verb 76962306a36Sopenharmony_ci-------- 77062306a36Sopenharmony_cihda-verb is a tiny program that allows you to access the HD-audio 77162306a36Sopenharmony_cicodec directly. You can execute a raw HD-audio codec verb with this. 77262306a36Sopenharmony_ciThis program accesses the hwdep device, thus you need to enable the 77362306a36Sopenharmony_cikernel config ``CONFIG_SND_HDA_HWDEP=y`` beforehand. 77462306a36Sopenharmony_ci 77562306a36Sopenharmony_ciThe hda-verb program takes four arguments: the hwdep device file, the 77662306a36Sopenharmony_ciwidget NID, the verb and the parameter. When you access to the codec 77762306a36Sopenharmony_cion the slot 2 of the card 0, pass /dev/snd/hwC0D2 to the first 77862306a36Sopenharmony_ciargument, typically. (However, the real path name depends on the 77962306a36Sopenharmony_cisystem.) 78062306a36Sopenharmony_ci 78162306a36Sopenharmony_ciThe second parameter is the widget number-id to access. The third 78262306a36Sopenharmony_ciparameter can be either a hex/digit number or a string corresponding 78362306a36Sopenharmony_cito a verb. Similarly, the last parameter is the value to write, or 78462306a36Sopenharmony_cican be a string for the parameter type. 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci:: 78762306a36Sopenharmony_ci 78862306a36Sopenharmony_ci % hda-verb /dev/snd/hwC0D0 0x12 0x701 2 78962306a36Sopenharmony_ci nid = 0x12, verb = 0x701, param = 0x2 79062306a36Sopenharmony_ci value = 0x0 79162306a36Sopenharmony_ci 79262306a36Sopenharmony_ci % hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_ID 79362306a36Sopenharmony_ci nid = 0x0, verb = 0xf00, param = 0x0 79462306a36Sopenharmony_ci value = 0x10ec0262 79562306a36Sopenharmony_ci 79662306a36Sopenharmony_ci % hda-verb /dev/snd/hwC0D0 2 set_a 0xb080 79762306a36Sopenharmony_ci nid = 0x2, verb = 0x300, param = 0xb080 79862306a36Sopenharmony_ci value = 0x0 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci 80162306a36Sopenharmony_ciAlthough you can issue any verbs with this program, the driver state 80262306a36Sopenharmony_ciwon't be always updated. For example, the volume values are usually 80362306a36Sopenharmony_cicached in the driver, and thus changing the widget amp value directly 80462306a36Sopenharmony_civia hda-verb won't change the mixer value. 80562306a36Sopenharmony_ci 80662306a36Sopenharmony_ciThe hda-verb program is included now in alsa-tools: 80762306a36Sopenharmony_ci 80862306a36Sopenharmony_ci* git://git.alsa-project.org/alsa-tools.git 80962306a36Sopenharmony_ci 81062306a36Sopenharmony_ciAlso, the old stand-alone package is found in the ftp directory: 81162306a36Sopenharmony_ci 81262306a36Sopenharmony_ci* ftp://ftp.suse.com/pub/people/tiwai/misc/ 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ciAlso a git repository is available: 81562306a36Sopenharmony_ci 81662306a36Sopenharmony_ci* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-verb.git 81762306a36Sopenharmony_ci 81862306a36Sopenharmony_ciSee README file in the tarball for more details about hda-verb 81962306a36Sopenharmony_ciprogram. 82062306a36Sopenharmony_ci 82162306a36Sopenharmony_ci 82262306a36Sopenharmony_cihda-analyzer 82362306a36Sopenharmony_ci------------ 82462306a36Sopenharmony_cihda-analyzer provides a graphical interface to access the raw HD-audio 82562306a36Sopenharmony_cicontrol, based on pyGTK2 binding. It's a more powerful version of 82662306a36Sopenharmony_cihda-verb. The program gives you an easy-to-use GUI stuff for showing 82762306a36Sopenharmony_cithe widget information and adjusting the amp values, as well as the 82862306a36Sopenharmony_ciproc-compatible output. 82962306a36Sopenharmony_ci 83062306a36Sopenharmony_ciThe hda-analyzer: 83162306a36Sopenharmony_ci 83262306a36Sopenharmony_ci* https://git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer 83362306a36Sopenharmony_ci 83462306a36Sopenharmony_ciis a part of alsa.git repository in alsa-project.org: 83562306a36Sopenharmony_ci 83662306a36Sopenharmony_ci* git://git.alsa-project.org/alsa.git 83762306a36Sopenharmony_ci 83862306a36Sopenharmony_ciCodecgraph 83962306a36Sopenharmony_ci---------- 84062306a36Sopenharmony_ciCodecgraph is a utility program to generate a graph and visualizes the 84162306a36Sopenharmony_cicodec-node connection of a codec chip. It's especially useful when 84262306a36Sopenharmony_ciyou analyze or debug a codec without a proper datasheet. The program 84362306a36Sopenharmony_ciparses the given codec proc file and converts to SVG via graphiz 84462306a36Sopenharmony_ciprogram. 84562306a36Sopenharmony_ci 84662306a36Sopenharmony_ciThe tarball and GIT trees are found in the web page at: 84762306a36Sopenharmony_ci 84862306a36Sopenharmony_ci* http://helllabs.org/codecgraph/ 84962306a36Sopenharmony_ci 85062306a36Sopenharmony_ci 85162306a36Sopenharmony_cihda-emu 85262306a36Sopenharmony_ci------- 85362306a36Sopenharmony_cihda-emu is an HD-audio emulator. The main purpose of this program is 85462306a36Sopenharmony_cito debug an HD-audio codec without the real hardware. Thus, it 85562306a36Sopenharmony_cidoesn't emulate the behavior with the real audio I/O, but it just 85662306a36Sopenharmony_cidumps the codec register changes and the ALSA-driver internal changes 85762306a36Sopenharmony_ciat probing and operating the HD-audio driver. 85862306a36Sopenharmony_ci 85962306a36Sopenharmony_ciThe program requires a codec proc-file to simulate. Get a proc file 86062306a36Sopenharmony_cifor the target codec beforehand, or pick up an example codec from the 86162306a36Sopenharmony_cicodec proc collections in the tarball. Then, run the program with the 86262306a36Sopenharmony_ciproc file, and the hda-emu program will start parsing the codec file 86362306a36Sopenharmony_ciand simulates the HD-audio driver: 86462306a36Sopenharmony_ci 86562306a36Sopenharmony_ci:: 86662306a36Sopenharmony_ci 86762306a36Sopenharmony_ci % hda-emu codecs/stac9200-dell-d820-laptop 86862306a36Sopenharmony_ci # Parsing.. 86962306a36Sopenharmony_ci hda_codec: Unknown model for STAC9200, using BIOS defaults 87062306a36Sopenharmony_ci hda_codec: pin nid 08 bios pin config 40c003fa 87162306a36Sopenharmony_ci .... 87262306a36Sopenharmony_ci 87362306a36Sopenharmony_ci 87462306a36Sopenharmony_ciThe program gives you only a very dumb command-line interface. You 87562306a36Sopenharmony_cican get a proc-file dump at the current state, get a list of control 87662306a36Sopenharmony_ci(mixer) elements, set/get the control element value, simulate the PCM 87762306a36Sopenharmony_cioperation, the jack plugging simulation, etc. 87862306a36Sopenharmony_ci 87962306a36Sopenharmony_ciThe program is found in the git repository below: 88062306a36Sopenharmony_ci 88162306a36Sopenharmony_ci* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git 88262306a36Sopenharmony_ci 88362306a36Sopenharmony_ciSee README file in the repository for more details about hda-emu 88462306a36Sopenharmony_ciprogram. 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_cihda-jack-retask 88862306a36Sopenharmony_ci--------------- 88962306a36Sopenharmony_cihda-jack-retask is a user-friendly GUI program to manipulate the 89062306a36Sopenharmony_ciHD-audio pin control for jack retasking. If you have a problem about 89162306a36Sopenharmony_cithe jack assignment, try this program and check whether you can get 89262306a36Sopenharmony_ciuseful results. Once when you figure out the proper pin assignment, 89362306a36Sopenharmony_ciit can be fixed either in the driver code statically or via passing a 89462306a36Sopenharmony_cifirmware patch file (see "Early Patching" section). 89562306a36Sopenharmony_ci 89662306a36Sopenharmony_ciThe program is included in alsa-tools now: 89762306a36Sopenharmony_ci 89862306a36Sopenharmony_ci* git://git.alsa-project.org/alsa-tools.git 899