xref: /linux/Documentation/sound/hd-audio/notes.rst (revision 041c9f71a47b8b98f6bdbbf4c0312f9782ca9a70)
19000d699STakashi Iwai=============================
29000d699STakashi IwaiMore Notes on HD-Audio Driver
39000d699STakashi Iwai=============================
49000d699STakashi Iwai
59000d699STakashi IwaiTakashi Iwai <tiwai@suse.de>
69000d699STakashi Iwai
79000d699STakashi Iwai
89000d699STakashi IwaiGeneral
99000d699STakashi Iwai=======
109000d699STakashi Iwai
119000d699STakashi IwaiHD-audio is the new standard on-board audio component on modern PCs
129000d699STakashi Iwaiafter AC97.  Although Linux has been supporting HD-audio since long
139000d699STakashi Iwaitime ago, there are often problems with new machines.  A part of the
149000d699STakashi Iwaiproblem is broken BIOS, and the rest is the driver implementation.
159000d699STakashi IwaiThis document explains the brief trouble-shooting and debugging
169000d699STakashi Iwaimethods for the	HD-audio hardware.
179000d699STakashi Iwai
189000d699STakashi IwaiThe HD-audio component consists of two parts: the controller chip and
199000d699STakashi Iwaithe codec chips on the HD-audio bus.  Linux provides a single driver
209000d699STakashi Iwaifor all controllers, snd-hda-intel.  Although the driver name contains
219000d699STakashi Iwaia word of a well-known hardware vendor, it's not specific to it but for
229000d699STakashi Iwaiall controller chips by other companies.  Since the HD-audio
239000d699STakashi Iwaicontrollers are supposed to be compatible, the single snd-hda-driver
249000d699STakashi Iwaishould work in most cases.  But, not surprisingly, there are known
259000d699STakashi Iwaibugs and issues specific to each controller type.  The snd-hda-intel
269000d699STakashi Iwaidriver has a bunch of workarounds for these as described below.
279000d699STakashi Iwai
289000d699STakashi IwaiA controller may have multiple codecs.  Usually you have one audio
299000d699STakashi Iwaicodec and optionally one modem codec.  In theory, there might be
309000d699STakashi Iwaimultiple audio codecs, e.g. for analog and digital outputs, and the
319000d699STakashi Iwaidriver might not work properly because of conflict of mixer elements.
329000d699STakashi IwaiThis should be fixed in future if such hardware really exists.
339000d699STakashi Iwai
349000d699STakashi IwaiThe snd-hda-intel driver has several different codec parsers depending
359000d699STakashi Iwaion the codec.  It has a generic parser as a fallback, but this
369000d699STakashi Iwaifunctionality is fairly limited until now.  Instead of the generic
379000d699STakashi Iwaiparser, usually the codec-specific parser (coded in patch_*.c) is used
389000d699STakashi Iwaifor the codec-specific implementations.  The details about the
399000d699STakashi Iwaicodec-specific problems are explained in the later sections.
409000d699STakashi Iwai
419000d699STakashi IwaiIf you are interested in the deep debugging of HD-audio, read the
429000d699STakashi IwaiHD-audio specification at first.  The specification is found on
439000d699STakashi IwaiIntel's web page, for example:
449000d699STakashi Iwai
457ed33ea6SAlexander A. Klimov* https://www.intel.com/standards/hdaudio/
469000d699STakashi Iwai
479000d699STakashi Iwai
489000d699STakashi IwaiHD-Audio Controller
499000d699STakashi Iwai===================
509000d699STakashi Iwai
519000d699STakashi IwaiDMA-Position Problem
529000d699STakashi Iwai--------------------
539000d699STakashi IwaiThe most common problem of the controller is the inaccurate DMA
549000d699STakashi Iwaipointer reporting.  The DMA pointer for playback and capture can be
559000d699STakashi Iwairead in two ways, either via a LPIB register or via a position-buffer
569000d699STakashi Iwaimap.  As default the driver tries to read from the io-mapped
579000d699STakashi Iwaiposition-buffer, and falls back to LPIB if the position-buffer appears
589000d699STakashi Iwaidead.  However, this detection isn't perfect on some devices.  In such
599000d699STakashi Iwaia case, you can change the default method via ``position_fix`` option.
609000d699STakashi Iwai
619000d699STakashi Iwai``position_fix=1`` means to use LPIB method explicitly.
629000d699STakashi Iwai``position_fix=2`` means to use the position-buffer.
639000d699STakashi Iwai``position_fix=3`` means to use a combination of both methods, needed
649000d699STakashi Iwaifor some VIA controllers.  The capture stream position is corrected
659000d699STakashi Iwaiby comparing both LPIB and position-buffer values.
669000d699STakashi Iwai``position_fix=4`` is another combination available for all controllers,
679000d699STakashi Iwaiand uses LPIB for the playback and the position-buffer for the capture
689000d699STakashi Iwaistreams.
6967d94c21STakashi Iwai``position_fix=5`` is specific to Intel platforms, so far, for Skylake
7067d94c21STakashi Iwaiand onward.  It applies the delay calculation for the precise position
7167d94c21STakashi Iwaireporting.
7267d94c21STakashi Iwai``position_fix=6`` is to correct the position with the fixed FIFO
7367d94c21STakashi Iwaisize, mainly targeted for the recent AMD controllers.
749000d699STakashi Iwai0 is the default value for all other
759000d699STakashi Iwaicontrollers, the automatic check and fallback to LPIB as described in
769000d699STakashi Iwaithe above.  If you get a problem of repeated sounds, this option might
779000d699STakashi Iwaihelp.
789000d699STakashi Iwai
799000d699STakashi IwaiIn addition to that, every controller is known to be broken regarding
809000d699STakashi Iwaithe wake-up timing.  It wakes up a few samples before actually
819000d699STakashi Iwaiprocessing the data on the buffer.  This caused a lot of problems, for
829000d699STakashi Iwaiexample, with ALSA dmix or JACK.  Since 2.6.27 kernel, the driver puts
839000d699STakashi Iwaian artificial delay to the wake up timing.  This delay is controlled
849000d699STakashi Iwaivia ``bdl_pos_adj`` option.
859000d699STakashi Iwai
869000d699STakashi IwaiWhen ``bdl_pos_adj`` is a negative value (as default), it's assigned to
879000d699STakashi Iwaian appropriate value depending on the controller chip.  For Intel
889000d699STakashi Iwaichips, it'd be 1 while it'd be 32 for others.  Usually this works.
899000d699STakashi IwaiOnly in case it doesn't work and you get warning messages, you should
909000d699STakashi Iwaichange this parameter to other values.
919000d699STakashi Iwai
929000d699STakashi Iwai
939000d699STakashi IwaiCodec-Probing Problem
949000d699STakashi Iwai---------------------
959000d699STakashi IwaiA less often but a more severe problem is the codec probing.  When
969000d699STakashi IwaiBIOS reports the available codec slots wrongly, the driver gets
979000d699STakashi Iwaiconfused and tries to access the non-existing codec slot.  This often
989000d699STakashi Iwairesults in the total screw-up, and destructs the further communication
999000d699STakashi Iwaiwith the codec chips.  The symptom appears usually as error messages
1009000d699STakashi Iwailike:
1019000d699STakashi Iwai::
1029000d699STakashi Iwai
1039000d699STakashi Iwai    hda_intel: azx_get_response timeout, switching to polling mode:
1049000d699STakashi Iwai          last cmd=0x12345678
1059000d699STakashi Iwai    hda_intel: azx_get_response timeout, switching to single_cmd mode:
1069000d699STakashi Iwai          last cmd=0x12345678
1079000d699STakashi Iwai
1089000d699STakashi IwaiThe first line is a warning, and this is usually relatively harmless.
1099000d699STakashi IwaiIt means that the codec response isn't notified via an IRQ.  The
1109000d699STakashi Iwaidriver uses explicit polling method to read the response.  It gives
1119000d699STakashi Iwaivery slight CPU overhead, but you'd unlikely notice it.
1129000d699STakashi Iwai
1139000d699STakashi IwaiThe second line is, however, a fatal error.  If this happens, usually
1149000d699STakashi Iwaiit means that something is really wrong.  Most likely you are
1159000d699STakashi Iwaiaccessing a non-existing codec slot.
1169000d699STakashi Iwai
1179000d699STakashi IwaiThus, if the second error message appears, try to narrow the probed
1189000d699STakashi Iwaicodec slots via ``probe_mask`` option.  It's a bitmask, and each bit
1199000d699STakashi Iwaicorresponds to the codec slot.  For example, to probe only the first
1209000d699STakashi Iwaislot, pass ``probe_mask=1``.  For the first and the third slots, pass
1219000d699STakashi Iwai``probe_mask=5`` (where 5 = 1 | 4), and so on.
1229000d699STakashi Iwai
1239000d699STakashi IwaiSince 2.6.29 kernel, the driver has a more robust probing method, so
1249000d699STakashi Iwaithis error might happen rarely, though.
1259000d699STakashi Iwai
1269000d699STakashi IwaiOn a machine with a broken BIOS, sometimes you need to force the
1279000d699STakashi Iwaidriver to probe the codec slots the hardware doesn't report for use.
1289000d699STakashi IwaiIn such a case, turn the bit 8 (0x100) of ``probe_mask`` option on.
1299000d699STakashi IwaiThen the rest 8 bits are passed as the codec slots to probe
1309000d699STakashi Iwaiunconditionally.  For example, ``probe_mask=0x103`` will force to probe
1319000d699STakashi Iwaithe codec slots 0 and 1 no matter what the hardware reports.
1329000d699STakashi Iwai
1339000d699STakashi Iwai
1349000d699STakashi IwaiInterrupt Handling
1359000d699STakashi Iwai------------------
1369000d699STakashi IwaiHD-audio driver uses MSI as default (if available) since 2.6.33
1379000d699STakashi Iwaikernel as MSI works better on some machines, and in general, it's
1389000d699STakashi Iwaibetter for performance.  However, Nvidia controllers showed bad
1399000d699STakashi Iwairegressions with MSI (especially in a combination with AMD chipset),
1409000d699STakashi Iwaithus we disabled MSI for them.
1419000d699STakashi Iwai
1429000d699STakashi IwaiThere seem also still other devices that don't work with MSI.  If you
1439000d699STakashi Iwaisee a regression wrt the sound quality (stuttering, etc) or a lock-up
1449000d699STakashi Iwaiin the recent kernel, try to pass ``enable_msi=0`` option to disable
1459000d699STakashi IwaiMSI.  If it works, you can add the known bad device to the blacklist
1469000d699STakashi Iwaidefined in hda_intel.c.  In such a case, please report and give the
1479000d699STakashi Iwaipatch back to the upstream developer.
1489000d699STakashi Iwai
1499000d699STakashi Iwai
1509000d699STakashi IwaiHD-Audio Codec
1519000d699STakashi Iwai==============
1529000d699STakashi Iwai
1539000d699STakashi IwaiModel Option
1549000d699STakashi Iwai------------
1559000d699STakashi IwaiThe most common problem regarding the HD-audio driver is the
1569000d699STakashi Iwaiunsupported codec features or the mismatched device configuration.
1579000d699STakashi IwaiMost of codec-specific code has several preset models, either to
1589000d699STakashi Iwaioverride the BIOS setup or to provide more comprehensive features.
1599000d699STakashi Iwai
1609000d699STakashi IwaiThe driver checks PCI SSID and looks through the static configuration
1619000d699STakashi Iwaitable until any matching entry is found.  If you have a new machine,
1629000d699STakashi Iwaiyou may see a message like below:
1639000d699STakashi Iwai::
1649000d699STakashi Iwai
1659000d699STakashi Iwai    hda_codec: ALC880: BIOS auto-probing.
1669000d699STakashi Iwai
1679000d699STakashi IwaiMeanwhile, in the earlier versions, you would see a message like:
1689000d699STakashi Iwai::
1699000d699STakashi Iwai
1709000d699STakashi Iwai    hda_codec: Unknown model for ALC880, trying auto-probe from BIOS...
1719000d699STakashi Iwai
1729000d699STakashi IwaiEven if you see such a message, DON'T PANIC.  Take a deep breath and
1739000d699STakashi Iwaikeep your towel.  First of all, it's an informational message, no
1749000d699STakashi Iwaiwarning, no error.  This means that the PCI SSID of your device isn't
1759000d699STakashi Iwailisted in the known preset model (white-)list.  But, this doesn't mean
1769000d699STakashi Iwaithat the driver is broken.  Many codec-drivers provide the automatic
1779000d699STakashi Iwaiconfiguration mechanism based on the BIOS setup.
1789000d699STakashi Iwai
1799000d699STakashi IwaiThe HD-audio codec has usually "pin" widgets, and BIOS sets the default
1809000d699STakashi Iwaiconfiguration of each pin, which indicates the location, the
1819000d699STakashi Iwaiconnection type, the jack color, etc.  The HD-audio driver can guess
1829000d699STakashi Iwaithe right connection judging from these default configuration values.
1839000d699STakashi IwaiHowever -- some codec-support codes, such as patch_analog.c, don't
1849000d699STakashi Iwaisupport the automatic probing (yet as of 2.6.28).  And, BIOS is often,
1859000d699STakashi Iwaiyes, pretty often broken.  It sets up wrong values and screws up the
1869000d699STakashi Iwaidriver.
1879000d699STakashi Iwai
1889000d699STakashi IwaiThe preset model (or recently called as "fix-up") is provided
1899000d699STakashi Iwaibasically to overcome such a situation.  When the matching preset
1909000d699STakashi Iwaimodel is found in the white-list, the driver assumes the static
1919000d699STakashi Iwaiconfiguration of that preset with the correct pin setup, etc.
1929000d699STakashi IwaiThus, if you have a newer machine with a slightly different PCI SSID
1939000d699STakashi Iwai(or codec SSID) from the existing one, you may have a good chance to
1949000d699STakashi Iwaire-use the same model.  You can pass the ``model`` option to specify the
1959000d699STakashi Iwaipreset model instead of PCI (and codec-) SSID look-up.
1969000d699STakashi Iwai
1979000d699STakashi IwaiWhat ``model`` option values are available depends on the codec chip.
1989000d699STakashi IwaiCheck your codec chip from the codec proc file (see "Codec Proc-File"
1999000d699STakashi Iwaisection below).  It will show the vendor/product name of your codec
200f495ae3cSTom Saegerchip.  Then, see Documentation/sound/hd-audio/models.rst file,
2019000d699STakashi Iwaithe section of HD-audio driver.  You can find a list of codecs
2029000d699STakashi Iwaiand ``model`` options belonging to each codec.  For example, for Realtek
2039000d699STakashi IwaiALC262 codec chip, pass ``model=ultra`` for devices that are compatible
2049000d699STakashi Iwaiwith Samsung Q1 Ultra.
2059000d699STakashi Iwai
2069000d699STakashi IwaiThus, the first thing you can do for any brand-new, unsupported and
2079000d699STakashi Iwainon-working HD-audio hardware is to check HD-audio codec and several
2089000d699STakashi Iwaidifferent ``model`` option values.  If you have any luck, some of them
2099000d699STakashi Iwaimight suit with your device well.
2109000d699STakashi Iwai
2119000d699STakashi IwaiThere are a few special model option values:
2129000d699STakashi Iwai
2139000d699STakashi Iwai* when 'nofixup' is passed, the device-specific fixups in the codec
2149000d699STakashi Iwai  parser are skipped.
2159000d699STakashi Iwai* when ``generic`` is passed, the codec-specific parser is skipped and
2169000d699STakashi Iwai  only the generic parser is used.
2179000d699STakashi Iwai
2184a1672d1STakashi IwaiA new style for the model option that was introduced since 5.15 kernel
2194a1672d1STakashi Iwaiis to pass the PCI or codec SSID in the form of ``model=XXXX:YYYY``
2204a1672d1STakashi Iwaiwhere XXXX and YYYY are the sub-vendor and sub-device IDs in hex
2214a1672d1STakashi Iwainumbers, respectively.  This is a kind of aliasing to another device;
2224a1672d1STakashi Iwaiwhen this form is given, the driver will refer to that SSID as a
2234a1672d1STakashi Iwaireference to the quirk table.  It'd be useful especially when the
2244a1672d1STakashi Iwaitarget quirk isn't listed in the model table.  For example, passing
2254a1672d1STakashi Iwaimodel=103c:8862 will apply the quirk for HP ProBook 445 G8 (which
2264a1672d1STakashi Iwaiisn't found in the model table as of writing) as long as the device is
2274a1672d1STakashi Iwaihandled equivalently by the same driver.
2284a1672d1STakashi Iwai
2299000d699STakashi Iwai
2309000d699STakashi IwaiSpeaker and Headphone Output
2319000d699STakashi Iwai----------------------------
2329000d699STakashi IwaiOne of the most frequent (and obvious) bugs with HD-audio is the
2339000d699STakashi Iwaisilent output from either or both of a built-in speaker and a
2349000d699STakashi Iwaiheadphone jack.  In general, you should try a headphone output at
2359000d699STakashi Iwaifirst.  A speaker output often requires more additional controls like
2369000d699STakashi Iwaithe external amplifier bits.  Thus a headphone output has a slightly
2379000d699STakashi Iwaibetter chance.
2389000d699STakashi Iwai
2399000d699STakashi IwaiBefore making a bug report, double-check whether the mixer is set up
2409000d699STakashi Iwaicorrectly.  The recent version of snd-hda-intel driver provides mostly
2419000d699STakashi Iwai"Master" volume control as well as "Front" volume (where Front
2429000d699STakashi Iwaiindicates the front-channels).  In addition, there can be individual
2439000d699STakashi Iwai"Headphone" and "Speaker" controls.
2449000d699STakashi Iwai
2459000d699STakashi IwaiDitto for the speaker output.  There can be "External Amplifier"
2469000d699STakashi Iwaiswitch on some codecs.  Turn on this if present.
2479000d699STakashi Iwai
2489000d699STakashi IwaiAnother related problem is the automatic mute of speaker output by
2499000d699STakashi Iwaiheadphone plugging.  This feature is implemented in most cases, but
2509000d699STakashi Iwainot on every preset model or codec-support code.
2519000d699STakashi Iwai
2529000d699STakashi IwaiIn anyway, try a different model option if you have such a problem.
2539000d699STakashi IwaiSome other models may match better and give you more matching
2549000d699STakashi Iwaifunctionality.  If none of the available models works, send a bug
2559000d699STakashi Iwaireport.  See the bug report section for details.
2569000d699STakashi Iwai
2579000d699STakashi IwaiIf you are masochistic enough to debug the driver problem, note the
2589000d699STakashi Iwaifollowing:
2599000d699STakashi Iwai
2609000d699STakashi Iwai* The speaker (and the headphone, too) output often requires the
2619000d699STakashi Iwai  external amplifier.  This can be set usually via EAPD verb or a
2629000d699STakashi Iwai  certain GPIO.  If the codec pin supports EAPD, you have a better
2639000d699STakashi Iwai  chance via SET_EAPD_BTL verb (0x70c).  On others, GPIO pin (mostly
2649000d699STakashi Iwai  it's either GPIO0 or GPIO1) may turn on/off EAPD.
2659000d699STakashi Iwai* Some Realtek codecs require special vendor-specific coefficients to
2669000d699STakashi Iwai  turn on the amplifier.  See patch_realtek.c.
2679000d699STakashi Iwai* IDT codecs may have extra power-enable/disable controls on each
2689000d699STakashi Iwai  analog pin.  See patch_sigmatel.c.
2699000d699STakashi Iwai* Very rare but some devices don't accept the pin-detection verb until
2709000d699STakashi Iwai  triggered.  Issuing GET_PIN_SENSE verb (0xf09) may result in the
2719000d699STakashi Iwai  codec-communication stall.  Some examples are found in
2729000d699STakashi Iwai  patch_realtek.c.
2739000d699STakashi Iwai
2749000d699STakashi Iwai
2759000d699STakashi IwaiCapture Problems
2769000d699STakashi Iwai----------------
2779000d699STakashi IwaiThe capture problems are often because of missing setups of mixers.
2789000d699STakashi IwaiThus, before submitting a bug report, make sure that you set up the
2799000d699STakashi Iwaimixer correctly.  For example, both "Capture Volume" and "Capture
2809000d699STakashi IwaiSwitch" have to be set properly in addition to the right "Capture
2819000d699STakashi IwaiSource" or "Input Source" selection.  Some devices have "Mic Boost"
2829000d699STakashi Iwaivolume or switch.
2839000d699STakashi Iwai
2849000d699STakashi IwaiWhen the PCM device is opened via "default" PCM (without pulse-audio
2859000d699STakashi Iwaiplugin), you'll likely have "Digital Capture Volume" control as well.
2869000d699STakashi IwaiThis is provided for the extra gain/attenuation of the signal in
2879000d699STakashi Iwaisoftware, especially for the inputs without the hardware volume
2889000d699STakashi Iwaicontrol such as digital microphones.  Unless really needed, this
2899000d699STakashi Iwaishould be set to exactly 50%, corresponding to 0dB -- neither extra
2909000d699STakashi Iwaigain nor attenuation.  When you use "hw" PCM, i.e., a raw access PCM,
2919000d699STakashi Iwaithis control will have no influence, though.
2929000d699STakashi Iwai
2939000d699STakashi IwaiIt's known that some codecs / devices have fairly bad analog circuits,
2949000d699STakashi Iwaiand the recorded sound contains a certain DC-offset.  This is no bug
2959000d699STakashi Iwaiof the driver.
2969000d699STakashi Iwai
2979000d699STakashi IwaiMost of modern laptops have no analog CD-input connection.  Thus, the
2989000d699STakashi Iwairecording from CD input won't work in many cases although the driver
2999000d699STakashi Iwaiprovides it as the capture source.  Use CDDA instead.
3009000d699STakashi Iwai
3019000d699STakashi IwaiThe automatic switching of the built-in and external mic per plugging
3029000d699STakashi Iwaiis implemented on some codec models but not on every model.  Partly
3039000d699STakashi Iwaibecause of my laziness but mostly lack of testers.  Feel free to
3049000d699STakashi Iwaisubmit the improvement patch to the author.
3059000d699STakashi Iwai
3069000d699STakashi Iwai
3079000d699STakashi IwaiDirect Debugging
3089000d699STakashi Iwai----------------
3099000d699STakashi IwaiIf no model option gives you a better result, and you are a tough guy
3109000d699STakashi Iwaito fight against evil, try debugging via hitting the raw HD-audio
3119000d699STakashi Iwaicodec verbs to the device.  Some tools are available: hda-emu and
3129000d699STakashi Iwaihda-analyzer.  The detailed description is found in the sections
3139000d699STakashi Iwaibelow.  You'd need to enable hwdep for using these tools.  See "Kernel
3149000d699STakashi IwaiConfiguration" section.
3159000d699STakashi Iwai
3169000d699STakashi Iwai
3179000d699STakashi IwaiOther Issues
3189000d699STakashi Iwai============
3199000d699STakashi Iwai
3209000d699STakashi IwaiKernel Configuration
3219000d699STakashi Iwai--------------------
3229000d699STakashi IwaiIn general, I recommend you to enable the sound debug option,
3239000d699STakashi Iwai``CONFIG_SND_DEBUG=y``, no matter whether you are debugging or not.
3249000d699STakashi IwaiThis enables snd_printd() macro and others, and you'll get additional
3259000d699STakashi Iwaikernel messages at probing.
3269000d699STakashi Iwai
3279000d699STakashi IwaiIn addition, you can enable ``CONFIG_SND_DEBUG_VERBOSE=y``.  But this
3289000d699STakashi Iwaiwill give you far more messages.  Thus turn this on only when you are
3299000d699STakashi Iwaisure to want it.
3309000d699STakashi Iwai
3319000d699STakashi IwaiDon't forget to turn on the appropriate ``CONFIG_SND_HDA_CODEC_*``
3329000d699STakashi Iwaioptions.  Note that each of them corresponds to the codec chip, not
3339000d699STakashi Iwaithe controller chip.  Thus, even if lspci shows the Nvidia controller,
3349000d699STakashi Iwaiyou may need to choose the option for other vendors.  If you are
3359000d699STakashi Iwaiunsure, just select all yes.
3369000d699STakashi Iwai
3379000d699STakashi Iwai``CONFIG_SND_HDA_HWDEP`` is a useful option for debugging the driver.
3389000d699STakashi IwaiWhen this is enabled, the driver creates hardware-dependent devices
3399000d699STakashi Iwai(one per each codec), and you have a raw access to the device via
3409000d699STakashi Iwaithese device files.  For example, ``hwC0D2`` will be created for the
3419000d699STakashi Iwaicodec slot #2 of the first card (#0).  For debug-tools such as
3429000d699STakashi Iwaihda-verb and hda-analyzer, the hwdep device has to be enabled.
3439000d699STakashi IwaiThus, it'd be better to turn this on always.
3449000d699STakashi Iwai
3459000d699STakashi Iwai``CONFIG_SND_HDA_RECONFIG`` is a new option, and this depends on the
3469000d699STakashi Iwaihwdep option above.  When enabled, you'll have some sysfs files under
3479000d699STakashi Iwaithe corresponding hwdep directory.  See "HD-audio reconfiguration"
3489000d699STakashi Iwaisection below.
3499000d699STakashi Iwai
3509000d699STakashi Iwai``CONFIG_SND_HDA_POWER_SAVE`` option enables the power-saving feature.
3519000d699STakashi IwaiSee "Power-saving" section below.
3529000d699STakashi Iwai
3539000d699STakashi Iwai
3549000d699STakashi IwaiCodec Proc-File
3559000d699STakashi Iwai---------------
3569000d699STakashi IwaiThe codec proc-file is a treasure-chest for debugging HD-audio.
3579000d699STakashi IwaiIt shows most of useful information of each codec widget.
3589000d699STakashi Iwai
3599000d699STakashi IwaiThe proc file is located in /proc/asound/card*/codec#*, one file per
3609000d699STakashi Iwaieach codec slot.  You can know the codec vendor, product id and
3619000d699STakashi Iwainames, the type of each widget, capabilities and so on.
3629000d699STakashi IwaiThis file, however, doesn't show the jack sensing state, so far.  This
3639000d699STakashi Iwaiis because the jack-sensing might be depending on the trigger state.
3649000d699STakashi Iwai
3659000d699STakashi IwaiThis file will be picked up by the debug tools, and also it can be fed
3669000d699STakashi Iwaito the emulator as the primary codec information.  See the debug tools
3679000d699STakashi Iwaisection below.
3689000d699STakashi Iwai
3699000d699STakashi IwaiThis proc file can be also used to check whether the generic parser is
3709000d699STakashi Iwaiused.  When the generic parser is used, the vendor/product ID name
3719000d699STakashi Iwaiwill appear as "Realtek ID 0262", instead of "Realtek ALC262".
3729000d699STakashi Iwai
3739000d699STakashi Iwai
3749000d699STakashi IwaiHD-Audio Reconfiguration
3759000d699STakashi Iwai------------------------
3769000d699STakashi IwaiThis is an experimental feature to allow you re-configure the HD-audio
3779000d699STakashi Iwaicodec dynamically without reloading the driver.  The following sysfs
3789000d699STakashi Iwaifiles are available under each codec-hwdep device directory (e.g.
3799000d699STakashi Iwai/sys/class/sound/hwC0D0):
3809000d699STakashi Iwai
3819000d699STakashi Iwaivendor_id
3829000d699STakashi Iwai    Shows the 32bit codec vendor-id hex number.  You can change the
3839000d699STakashi Iwai    vendor-id value by writing to this file.
3849000d699STakashi Iwaisubsystem_id
3859000d699STakashi Iwai    Shows the 32bit codec subsystem-id hex number.  You can change the
3869000d699STakashi Iwai    subsystem-id value by writing to this file.
3879000d699STakashi Iwairevision_id
3889000d699STakashi Iwai    Shows the 32bit codec revision-id hex number.  You can change the
3899000d699STakashi Iwai    revision-id value by writing to this file.
3909000d699STakashi Iwaiafg
3919000d699STakashi Iwai    Shows the AFG ID.  This is read-only.
3929000d699STakashi Iwaimfg
3939000d699STakashi Iwai    Shows the MFG ID.  This is read-only.
3949000d699STakashi Iwainame
3959000d699STakashi Iwai    Shows the codec name string.  Can be changed by writing to this
3969000d699STakashi Iwai    file.
3979000d699STakashi Iwaimodelname
3989000d699STakashi Iwai    Shows the currently set ``model`` option.  Can be changed by writing
3999000d699STakashi Iwai    to this file.
4009000d699STakashi Iwaiinit_verbs
4019000d699STakashi Iwai    The extra verbs to execute at initialization.  You can add a verb by
4029000d699STakashi Iwai    writing to this file.  Pass three numbers: nid, verb and parameter
4039000d699STakashi Iwai    (separated with a space).
4049000d699STakashi Iwaihints
4059000d699STakashi Iwai    Shows / stores hint strings for codec parsers for any use.
4069000d699STakashi Iwai    Its format is ``key = value``.  For example, passing ``jack_detect = no``
4079000d699STakashi Iwai    will disable the jack detection of the machine completely.
4089000d699STakashi Iwaiinit_pin_configs
4099000d699STakashi Iwai    Shows the initial pin default config values set by BIOS.
4109000d699STakashi Iwaidriver_pin_configs
4119000d699STakashi Iwai    Shows the pin default values set by the codec parser explicitly.
4129000d699STakashi Iwai    This doesn't show all pin values but only the changed values by
4139000d699STakashi Iwai    the parser.  That is, if the parser doesn't change the pin default
4149000d699STakashi Iwai    config values by itself, this will contain nothing.
4159000d699STakashi Iwaiuser_pin_configs
4169000d699STakashi Iwai    Shows the pin default config values to override the BIOS setup.
4179000d699STakashi Iwai    Writing this (with two numbers, NID and value) appends the new
4189000d699STakashi Iwai    value.  The given will be used instead of the initial BIOS value at
4199000d699STakashi Iwai    the next reconfiguration time.  Note that this config will override
4209000d699STakashi Iwai    even the driver pin configs, too.
4219000d699STakashi Iwaireconfig
4229000d699STakashi Iwai    Triggers the codec re-configuration.  When any value is written to
4239000d699STakashi Iwai    this file, the driver re-initialize and parses the codec tree
4249000d699STakashi Iwai    again.  All the changes done by the sysfs entries above are taken
4259000d699STakashi Iwai    into account.
4269000d699STakashi Iwaiclear
4279000d699STakashi Iwai    Resets the codec, removes the mixer elements and PCM stuff of the
4289000d699STakashi Iwai    specified codec, and clear all init verbs and hints.
4299000d699STakashi Iwai
4309000d699STakashi IwaiFor example, when you want to change the pin default configuration
4319000d699STakashi Iwaivalue of the pin widget 0x14 to 0x9993013f, and let the driver
4329000d699STakashi Iwaire-configure based on that state, run like below:
4339000d699STakashi Iwai::
4349000d699STakashi Iwai
4359000d699STakashi Iwai    # echo 0x14 0x9993013f > /sys/class/sound/hwC0D0/user_pin_configs
4369000d699STakashi Iwai    # echo 1 > /sys/class/sound/hwC0D0/reconfig
4379000d699STakashi Iwai
4389000d699STakashi Iwai
4399000d699STakashi IwaiHint Strings
4409000d699STakashi Iwai------------
4419000d699STakashi IwaiThe codec parser have several switches and adjustment knobs for
4429000d699STakashi Iwaimatching better with the actual codec or device behavior.  Many of
4439000d699STakashi Iwaithem can be adjusted dynamically via "hints" strings as mentioned in
4449000d699STakashi Iwaithe section above.  For example, by passing ``jack_detect = no`` string
4459000d699STakashi Iwaivia sysfs or a patch file, you can disable the jack detection, thus
4469000d699STakashi Iwaithe codec parser will skip the features like auto-mute or mic
4479000d699STakashi Iwaiauto-switch.  As a boolean value, either ``yes``, ``no``, ``true``, ``false``,
4489000d699STakashi Iwai``1`` or ``0`` can be passed.
4499000d699STakashi Iwai
4509000d699STakashi IwaiThe generic parser supports the following hints:
4519000d699STakashi Iwai
4529000d699STakashi Iwaijack_detect (bool)
4539000d699STakashi Iwai    specify whether the jack detection is available at all on this
4549000d699STakashi Iwai    machine; default true
4559000d699STakashi Iwaiinv_jack_detect (bool)
4569000d699STakashi Iwai    indicates that the jack detection logic is inverted
4579000d699STakashi Iwaitrigger_sense (bool)
4589000d699STakashi Iwai    indicates that the jack detection needs the explicit call of
4599000d699STakashi Iwai    AC_VERB_SET_PIN_SENSE verb
4609000d699STakashi Iwaiinv_eapd (bool)
4619000d699STakashi Iwai    indicates that the EAPD is implemented in the inverted logic
4629000d699STakashi Iwaipcm_format_first (bool)
4639000d699STakashi Iwai    sets the PCM format before the stream tag and channel ID
4649000d699STakashi Iwaisticky_stream (bool)
4659000d699STakashi Iwai    keep the PCM format, stream tag and ID as long as possible;
4669000d699STakashi Iwai    default true
4679000d699STakashi Iwaispdif_status_reset (bool)
4689000d699STakashi Iwai    reset the SPDIF status bits at each time the SPDIF stream is set
4699000d699STakashi Iwai    up
4709000d699STakashi Iwaipin_amp_workaround (bool)
4719000d699STakashi Iwai    the output pin may have multiple amp values
4729000d699STakashi Iwaisingle_adc_amp (bool)
4739000d699STakashi Iwai    ADCs can have only single input amps
4749000d699STakashi Iwaiauto_mute (bool)
4759000d699STakashi Iwai    enable/disable the headphone auto-mute feature; default true
4769000d699STakashi Iwaiauto_mic (bool)
4779000d699STakashi Iwai    enable/disable the mic auto-switch feature; default true
4789000d699STakashi Iwailine_in_auto_switch (bool)
4799000d699STakashi Iwai    enable/disable the line-in auto-switch feature; default false
4809000d699STakashi Iwaineed_dac_fix (bool)
4819000d699STakashi Iwai    limits the DACs depending on the channel count
4829000d699STakashi Iwaiprimary_hp (bool)
4839000d699STakashi Iwai    probe headphone jacks as the primary outputs; default true
4849000d699STakashi Iwaimulti_io (bool)
4859000d699STakashi Iwai    try probing multi-I/O config (e.g. shared line-in/surround,
4869000d699STakashi Iwai    mic/clfe jacks)
4879000d699STakashi Iwaimulti_cap_vol (bool)
4889000d699STakashi Iwai    provide multiple capture volumes
4899000d699STakashi Iwaiinv_dmic_split (bool)
4909000d699STakashi Iwai    provide split internal mic volume/switch for phase-inverted
4919000d699STakashi Iwai    digital mics
4929000d699STakashi Iwaiindep_hp (bool)
4939000d699STakashi Iwai    provide the independent headphone PCM stream and the corresponding
4949000d699STakashi Iwai    mixer control, if available
4959000d699STakashi Iwaiadd_stereo_mix_input (bool)
4969000d699STakashi Iwai    add the stereo mix (analog-loopback mix) to the input mux if
4979000d699STakashi Iwai    available
4989000d699STakashi Iwaiadd_jack_modes (bool)
4999000d699STakashi Iwai    add "xxx Jack Mode" enum controls to each I/O jack for allowing to
5009000d699STakashi Iwai    change the headphone amp and mic bias VREF capabilities
5019000d699STakashi Iwaipower_save_node (bool)
5029000d699STakashi Iwai    advanced power management for each widget, controlling the power
503ba35c3a5SRandy Dunlap    state (D0/D3) of each widget node depending on the actual pin and
5049000d699STakashi Iwai    stream states
5059000d699STakashi Iwaipower_down_unused (bool)
5069000d699STakashi Iwai    power down the unused widgets, a subset of power_save_node, and
5079000d699STakashi Iwai    will be dropped in future
5089000d699STakashi Iwaiadd_hp_mic (bool)
5099000d699STakashi Iwai    add the headphone to capture source if possible
5109000d699STakashi Iwaihp_mic_detect (bool)
5119000d699STakashi Iwai    enable/disable the hp/mic shared input for a single built-in mic
5129000d699STakashi Iwai    case; default true
5137480316cSTakashi Iwaivmaster (bool)
5147480316cSTakashi Iwai    enable/disable the virtual Master control; default true
5159000d699STakashi Iwaimixer_nid (int)
5169000d699STakashi Iwai    specifies the widget NID of the analog-loopback mixer
5179000d699STakashi Iwai
5189000d699STakashi Iwai
5199000d699STakashi IwaiEarly Patching
5209000d699STakashi Iwai--------------
5219000d699STakashi IwaiWhen ``CONFIG_SND_HDA_PATCH_LOADER=y`` is set, you can pass a "patch"
5229000d699STakashi Iwaias a firmware file for modifying the HD-audio setup before
5239000d699STakashi Iwaiinitializing the codec.  This can work basically like the
5249000d699STakashi Iwaireconfiguration via sysfs in the above, but it does it before the
5259000d699STakashi Iwaifirst codec configuration.
5269000d699STakashi Iwai
5279000d699STakashi IwaiA patch file is a plain text file which looks like below:
5289000d699STakashi Iwai
5299000d699STakashi Iwai::
5309000d699STakashi Iwai
5319000d699STakashi Iwai    [codec]
5329000d699STakashi Iwai    0x12345678 0xabcd1234 2
5339000d699STakashi Iwai
5349000d699STakashi Iwai    [model]
5359000d699STakashi Iwai    auto
5369000d699STakashi Iwai
5379000d699STakashi Iwai    [pincfg]
5389000d699STakashi Iwai    0x12 0x411111f0
5399000d699STakashi Iwai
5409000d699STakashi Iwai    [verb]
5419000d699STakashi Iwai    0x20 0x500 0x03
5429000d699STakashi Iwai    0x20 0x400 0xff
5439000d699STakashi Iwai
5449000d699STakashi Iwai    [hint]
5459000d699STakashi Iwai    jack_detect = no
5469000d699STakashi Iwai
5479000d699STakashi Iwai
5489000d699STakashi IwaiThe file needs to have a line ``[codec]``.  The next line should contain
5499000d699STakashi Iwaithree numbers indicating the codec vendor-id (0x12345678 in the
5509000d699STakashi Iwaiexample), the codec subsystem-id (0xabcd1234) and the address (2) of
5519000d699STakashi Iwaithe codec.  The rest patch entries are applied to this specified codec
5529000d699STakashi Iwaiuntil another codec entry is given.  Passing 0 or a negative number to
5539000d699STakashi Iwaithe first or the second value will make the check of the corresponding
5549000d699STakashi Iwaifield be skipped.  It'll be useful for really broken devices that don't
5559000d699STakashi Iwaiinitialize SSID properly.
5569000d699STakashi Iwai
5579000d699STakashi IwaiThe ``[model]`` line allows to change the model name of the each codec.
5589000d699STakashi IwaiIn the example above, it will be changed to model=auto.
5599000d699STakashi IwaiNote that this overrides the module option.
5609000d699STakashi Iwai
5619000d699STakashi IwaiAfter the ``[pincfg]`` line, the contents are parsed as the initial
5629000d699STakashi Iwaidefault pin-configurations just like ``user_pin_configs`` sysfs above.
5639000d699STakashi IwaiThe values can be shown in user_pin_configs sysfs file, too.
5649000d699STakashi Iwai
5659000d699STakashi IwaiSimilarly, the lines after ``[verb]`` are parsed as ``init_verbs``
5669000d699STakashi Iwaisysfs entries, and the lines after ``[hint]`` are parsed as ``hints``
5679000d699STakashi Iwaisysfs entries, respectively.
5689000d699STakashi Iwai
5699000d699STakashi IwaiAnother example to override the codec vendor id from 0x12345678 to
5709000d699STakashi Iwai0xdeadbeef is like below:
5719000d699STakashi Iwai::
5729000d699STakashi Iwai
5739000d699STakashi Iwai    [codec]
5749000d699STakashi Iwai    0x12345678 0xabcd1234 2
5759000d699STakashi Iwai
5769000d699STakashi Iwai    [vendor_id]
5779000d699STakashi Iwai    0xdeadbeef
5789000d699STakashi Iwai
5799000d699STakashi Iwai
5809000d699STakashi IwaiIn the similar way, you can override the codec subsystem_id via
5819000d699STakashi Iwai``[subsystem_id]``, the revision id via ``[revision_id]`` line.
5829000d699STakashi IwaiAlso, the codec chip name can be rewritten via ``[chip_name]`` line.
5839000d699STakashi Iwai::
5849000d699STakashi Iwai
5859000d699STakashi Iwai    [codec]
5869000d699STakashi Iwai    0x12345678 0xabcd1234 2
5879000d699STakashi Iwai
5889000d699STakashi Iwai    [subsystem_id]
5899000d699STakashi Iwai    0xffff1111
5909000d699STakashi Iwai
5919000d699STakashi Iwai    [revision_id]
5929000d699STakashi Iwai    0x10
5939000d699STakashi Iwai
5949000d699STakashi Iwai    [chip_name]
5959000d699STakashi Iwai    My-own NEWS-0002
5969000d699STakashi Iwai
5979000d699STakashi Iwai
5989000d699STakashi IwaiThe hd-audio driver reads the file via request_firmware().  Thus,
5999000d699STakashi Iwaia patch file has to be located on the appropriate firmware path,
6009000d699STakashi Iwaitypically, /lib/firmware.  For example, when you pass the option
6019000d699STakashi Iwai``patch=hda-init.fw``, the file /lib/firmware/hda-init.fw must be
6029000d699STakashi Iwaipresent.
6039000d699STakashi Iwai
6049000d699STakashi IwaiThe patch module option is specific to each card instance, and you
6059000d699STakashi Iwaineed to give one file name for each instance, separated by commas.
6069000d699STakashi IwaiFor example, if you have two cards, one for an on-board analog and one
6079000d699STakashi Iwaifor an HDMI video board, you may pass patch option like below:
6089000d699STakashi Iwai::
6099000d699STakashi Iwai
6109000d699STakashi Iwai    options snd-hda-intel patch=on-board-patch,hdmi-patch
6119000d699STakashi Iwai
6129000d699STakashi Iwai
6139000d699STakashi IwaiPower-Saving
6149000d699STakashi Iwai------------
6159000d699STakashi IwaiThe power-saving is a kind of auto-suspend of the device.  When the
6169000d699STakashi Iwaidevice is inactive for a certain time, the device is automatically
6179000d699STakashi Iwaiturned off to save the power.  The time to go down is specified via
6189000d699STakashi Iwai``power_save`` module option, and this option can be changed dynamically
6199000d699STakashi Iwaivia sysfs.
6209000d699STakashi Iwai
6219000d699STakashi IwaiThe power-saving won't work when the analog loopback is enabled on
6229000d699STakashi Iwaisome codecs.  Make sure that you mute all unneeded signal routes when
6239000d699STakashi Iwaiyou want the power-saving.
6249000d699STakashi Iwai
6259000d699STakashi IwaiThe power-saving feature might cause audible click noises at each
6269000d699STakashi Iwaipower-down/up depending on the device.  Some of them might be
6279000d699STakashi Iwaisolvable, but some are hard, I'm afraid.  Some distros such as
6289000d699STakashi IwaiopenSUSE enables the power-saving feature automatically when the power
6299000d699STakashi Iwaicable is unplugged.  Thus, if you hear noises, suspect first the
6309000d699STakashi Iwaipower-saving.  See /sys/module/snd_hda_intel/parameters/power_save to
6319000d699STakashi Iwaicheck the current value.  If it's non-zero, the feature is turned on.
6329000d699STakashi Iwai
6339000d699STakashi IwaiThe recent kernel supports the runtime PM for the HD-audio controller
6349000d699STakashi Iwaichip, too.  It means that the HD-audio controller is also powered up /
6359000d699STakashi Iwaidown dynamically.  The feature is enabled only for certain controller
6369000d699STakashi Iwaichips like Intel LynxPoint.  You can enable/disable this feature
6379000d699STakashi Iwaiforcibly by setting ``power_save_controller`` option, which is also
6389000d699STakashi Iwaiavailable at /sys/module/snd_hda_intel/parameters directory.
6399000d699STakashi Iwai
6409000d699STakashi Iwai
6419000d699STakashi IwaiTracepoints
6429000d699STakashi Iwai-----------
6439000d699STakashi IwaiThe hd-audio driver gives a few basic tracepoints.
6449000d699STakashi Iwai``hda:hda_send_cmd`` traces each CORB write while ``hda:hda_get_response``
6459000d699STakashi Iwaitraces the response from RIRB (only when read from the codec driver).
6469000d699STakashi Iwai``hda:hda_bus_reset`` traces the bus-reset due to fatal error, etc,
6479000d699STakashi Iwai``hda:hda_unsol_event`` traces the unsolicited events, and
6489000d699STakashi Iwai``hda:hda_power_down`` and ``hda:hda_power_up`` trace the power down/up
6499000d699STakashi Iwaivia power-saving behavior.
6509000d699STakashi Iwai
6519000d699STakashi IwaiEnabling all tracepoints can be done like
6529000d699STakashi Iwai::
6539000d699STakashi Iwai
654*2abfcd29SRoss Zwisler    # echo 1 > /sys/kernel/tracing/events/hda/enable
6559000d699STakashi Iwai
6569000d699STakashi Iwaithen after some commands, you can traces from
657*2abfcd29SRoss Zwisler/sys/kernel/tracing/trace file.  For example, when you want to
6589000d699STakashi Iwaitrace what codec command is sent, enable the tracepoint like:
6599000d699STakashi Iwai::
6609000d699STakashi Iwai
661*2abfcd29SRoss Zwisler    # cat /sys/kernel/tracing/trace
6629000d699STakashi Iwai    # tracer: nop
6639000d699STakashi Iwai    #
6649000d699STakashi Iwai    #       TASK-PID    CPU#    TIMESTAMP  FUNCTION
6659000d699STakashi Iwai    #          | |       |          |         |
6669000d699STakashi Iwai	   <...>-7807  [002] 105147.774889: hda_send_cmd: [0:0] val=e3a019
6679000d699STakashi Iwai	   <...>-7807  [002] 105147.774893: hda_send_cmd: [0:0] val=e39019
6689000d699STakashi Iwai	   <...>-7807  [002] 105147.999542: hda_send_cmd: [0:0] val=e3a01a
6699000d699STakashi Iwai	   <...>-7807  [002] 105147.999543: hda_send_cmd: [0:0] val=e3901a
6709000d699STakashi Iwai	   <...>-26764 [001] 349222.837143: hda_send_cmd: [0:0] val=e3a019
6719000d699STakashi Iwai	   <...>-26764 [001] 349222.837148: hda_send_cmd: [0:0] val=e39019
6729000d699STakashi Iwai	   <...>-26764 [001] 349223.058539: hda_send_cmd: [0:0] val=e3a01a
6739000d699STakashi Iwai	   <...>-26764 [001] 349223.058541: hda_send_cmd: [0:0] val=e3901a
6749000d699STakashi Iwai
6759000d699STakashi IwaiHere ``[0:0]`` indicates the card number and the codec address, and
6769000d699STakashi Iwai``val`` shows the value sent to the codec, respectively.  The value is
6779000d699STakashi Iwaia packed value, and you can decode it via hda-decode-verb program
6789000d699STakashi Iwaiincluded in hda-emu package below.  For example, the value e3a019 is
6799000d699STakashi Iwaito set the left output-amp value to 25.
6809000d699STakashi Iwai::
6819000d699STakashi Iwai
6829000d699STakashi Iwai    % hda-decode-verb 0xe3a019
6839000d699STakashi Iwai    raw value = 0x00e3a019
6849000d699STakashi Iwai    cid = 0, nid = 0x0e, verb = 0x3a0, parm = 0x19
6859000d699STakashi Iwai    raw value: verb = 0x3a0, parm = 0x19
6869000d699STakashi Iwai    verbname = set_amp_gain_mute
6879000d699STakashi Iwai    amp raw val = 0xa019
6889000d699STakashi Iwai    output, left, idx=0, mute=0, val=25
6899000d699STakashi Iwai
6909000d699STakashi Iwai
6919000d699STakashi IwaiDevelopment Tree
6929000d699STakashi Iwai----------------
6939000d699STakashi IwaiThe latest development codes for HD-audio are found on sound git tree:
6949000d699STakashi Iwai
6959000d699STakashi Iwai* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
6969000d699STakashi Iwai
6979000d699STakashi IwaiThe master branch or for-next branches can be used as the main
6989000d699STakashi Iwaidevelopment branches in general while the development for the current
6999000d699STakashi Iwaiand next kernels are found in for-linus and for-next branches,
7009000d699STakashi Iwairespectively.
7019000d699STakashi Iwai
7029000d699STakashi Iwai
7039000d699STakashi IwaiSending a Bug Report
7049000d699STakashi Iwai--------------------
7059000d699STakashi IwaiIf any model or module options don't work for your device, it's time
7069000d699STakashi Iwaito send a bug report to the developers.  Give the following in your
7079000d699STakashi Iwaibug report:
7089000d699STakashi Iwai
7099000d699STakashi Iwai* Hardware vendor, product and model names
7109000d699STakashi Iwai* Kernel version (and ALSA-driver version if you built externally)
7119000d699STakashi Iwai* ``alsa-info.sh`` output; run with ``--no-upload`` option.  See the
7129000d699STakashi Iwai  section below about alsa-info
7139000d699STakashi Iwai
7149000d699STakashi IwaiIf it's a regression, at best, send alsa-info outputs of both working
7159000d699STakashi Iwaiand non-working kernels.  This is really helpful because we can
7169000d699STakashi Iwaicompare the codec registers directly.
7179000d699STakashi Iwai
7184091fb95SMasahiro YamadaSend a bug report either the following:
7199000d699STakashi Iwai
7209000d699STakashi Iwaikernel-bugzilla
7219000d699STakashi Iwai    https://bugzilla.kernel.org/
7229000d699STakashi Iwaialsa-devel ML
7239000d699STakashi Iwai    alsa-devel@alsa-project.org
7249000d699STakashi Iwai
7259000d699STakashi Iwai
7269000d699STakashi IwaiDebug Tools
7279000d699STakashi Iwai===========
7289000d699STakashi Iwai
7299000d699STakashi IwaiThis section describes some tools available for debugging HD-audio
7309000d699STakashi Iwaiproblems.
7319000d699STakashi Iwai
7329000d699STakashi Iwaialsa-info
7339000d699STakashi Iwai---------
7349000d699STakashi IwaiThe script ``alsa-info.sh`` is a very useful tool to gather the audio
7359000d699STakashi Iwaidevice information.  It's included in alsa-utils package.  The latest
7369000d699STakashi Iwaiversion can be found on git repository:
7379000d699STakashi Iwai
7389000d699STakashi Iwai* git://git.alsa-project.org/alsa-utils.git
7399000d699STakashi Iwai
7409000d699STakashi IwaiThe script can be fetched directly from the following URL, too:
7419000d699STakashi Iwai
7427ed33ea6SAlexander A. Klimov* https://www.alsa-project.org/alsa-info.sh
7439000d699STakashi Iwai
7449000d699STakashi IwaiRun this script as root, and it will gather the important information
7459000d699STakashi Iwaisuch as the module lists, module parameters, proc file contents
7469000d699STakashi Iwaiincluding the codec proc files, mixer outputs and the control
7479000d699STakashi Iwaielements.  As default, it will store the information onto a web server
7489000d699STakashi Iwaion alsa-project.org.  But, if you send a bug report, it'd be better to
7499000d699STakashi Iwairun with ``--no-upload`` option, and attach the generated file.
7509000d699STakashi Iwai
7519000d699STakashi IwaiThere are some other useful options.  See ``--help`` option output for
7529000d699STakashi Iwaidetails.
7539000d699STakashi Iwai
7549000d699STakashi IwaiWhen a probe error occurs or when the driver obviously assigns a
7559000d699STakashi Iwaimismatched model, it'd be helpful to load the driver with
7569000d699STakashi Iwai``probe_only=1`` option (at best after the cold reboot) and run
7579000d699STakashi Iwaialsa-info at this state.  With this option, the driver won't configure
7589000d699STakashi Iwaithe mixer and PCM but just tries to probe the codec slot.  After
7599000d699STakashi Iwaiprobing, the proc file is available, so you can get the raw codec
7609000d699STakashi Iwaiinformation before modified by the driver.  Of course, the driver
7619000d699STakashi Iwaiisn't usable with ``probe_only=1``.  But you can continue the
7629000d699STakashi Iwaiconfiguration via hwdep sysfs file if hda-reconfig option is enabled.
7639000d699STakashi IwaiUsing ``probe_only`` mask 2 skips the reset of HDA codecs (use
7649000d699STakashi Iwai``probe_only=3`` as module option). The hwdep interface can be used
7659000d699STakashi Iwaito determine the BIOS codec initialization.
7669000d699STakashi Iwai
7679000d699STakashi Iwai
7689000d699STakashi Iwaihda-verb
7699000d699STakashi Iwai--------
7709000d699STakashi Iwaihda-verb is a tiny program that allows you to access the HD-audio
7719000d699STakashi Iwaicodec directly.  You can execute a raw HD-audio codec verb with this.
7729000d699STakashi IwaiThis program accesses the hwdep device, thus you need to enable the
7739000d699STakashi Iwaikernel config ``CONFIG_SND_HDA_HWDEP=y`` beforehand.
7749000d699STakashi Iwai
7759000d699STakashi IwaiThe hda-verb program takes four arguments: the hwdep device file, the
7769000d699STakashi Iwaiwidget NID, the verb and the parameter.  When you access to the codec
7779000d699STakashi Iwaion the slot 2 of the card 0, pass /dev/snd/hwC0D2 to the first
7789000d699STakashi Iwaiargument, typically.  (However, the real path name depends on the
7799000d699STakashi Iwaisystem.)
7809000d699STakashi Iwai
7819000d699STakashi IwaiThe second parameter is the widget number-id to access.  The third
7829000d699STakashi Iwaiparameter can be either a hex/digit number or a string corresponding
7839000d699STakashi Iwaito a verb.  Similarly, the last parameter is the value to write, or
7849000d699STakashi Iwaican be a string for the parameter type.
7859000d699STakashi Iwai
7869000d699STakashi Iwai::
7879000d699STakashi Iwai
7889000d699STakashi Iwai    % hda-verb /dev/snd/hwC0D0 0x12 0x701 2
7899000d699STakashi Iwai    nid = 0x12, verb = 0x701, param = 0x2
7909000d699STakashi Iwai    value = 0x0
7919000d699STakashi Iwai
7929000d699STakashi Iwai    % hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_ID
7939000d699STakashi Iwai    nid = 0x0, verb = 0xf00, param = 0x0
7949000d699STakashi Iwai    value = 0x10ec0262
7959000d699STakashi Iwai
7969000d699STakashi Iwai    % hda-verb /dev/snd/hwC0D0 2 set_a 0xb080
7979000d699STakashi Iwai    nid = 0x2, verb = 0x300, param = 0xb080
7989000d699STakashi Iwai    value = 0x0
7999000d699STakashi Iwai
8009000d699STakashi Iwai
8019000d699STakashi IwaiAlthough you can issue any verbs with this program, the driver state
8029000d699STakashi Iwaiwon't be always updated.  For example, the volume values are usually
8039000d699STakashi Iwaicached in the driver, and thus changing the widget amp value directly
8049000d699STakashi Iwaivia hda-verb won't change the mixer value.
8059000d699STakashi Iwai
8069000d699STakashi IwaiThe hda-verb program is included now in alsa-tools:
8079000d699STakashi Iwai
8089000d699STakashi Iwai* git://git.alsa-project.org/alsa-tools.git
8099000d699STakashi Iwai
8109000d699STakashi IwaiAlso, the old stand-alone package is found in the ftp directory:
8119000d699STakashi Iwai
8129000d699STakashi Iwai* ftp://ftp.suse.com/pub/people/tiwai/misc/
8139000d699STakashi Iwai
8149000d699STakashi IwaiAlso a git repository is available:
8159000d699STakashi Iwai
8169000d699STakashi Iwai* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-verb.git
8179000d699STakashi Iwai
8189000d699STakashi IwaiSee README file in the tarball for more details about hda-verb
8199000d699STakashi Iwaiprogram.
8209000d699STakashi Iwai
8219000d699STakashi Iwai
8229000d699STakashi Iwaihda-analyzer
8239000d699STakashi Iwai------------
8249000d699STakashi Iwaihda-analyzer provides a graphical interface to access the raw HD-audio
8259000d699STakashi Iwaicontrol, based on pyGTK2 binding.  It's a more powerful version of
8269000d699STakashi Iwaihda-verb.  The program gives you an easy-to-use GUI stuff for showing
8279000d699STakashi Iwaithe widget information and adjusting the amp values, as well as the
8289000d699STakashi Iwaiproc-compatible output.
8299000d699STakashi Iwai
8309000d699STakashi IwaiThe hda-analyzer:
8319000d699STakashi Iwai
8327ed33ea6SAlexander A. Klimov* https://git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer
8339000d699STakashi Iwai
8349000d699STakashi Iwaiis a part of alsa.git repository in alsa-project.org:
8359000d699STakashi Iwai
8369000d699STakashi Iwai* git://git.alsa-project.org/alsa.git
8379000d699STakashi Iwai
8389000d699STakashi IwaiCodecgraph
8399000d699STakashi Iwai----------
8409000d699STakashi IwaiCodecgraph is a utility program to generate a graph and visualizes the
8419000d699STakashi Iwaicodec-node connection of a codec chip.  It's especially useful when
8429000d699STakashi Iwaiyou analyze or debug a codec without a proper datasheet.  The program
8439000d699STakashi Iwaiparses the given codec proc file and converts to SVG via graphiz
8449000d699STakashi Iwaiprogram.
8459000d699STakashi Iwai
8469000d699STakashi IwaiThe tarball and GIT trees are found in the web page at:
8479000d699STakashi Iwai
8489000d699STakashi Iwai* http://helllabs.org/codecgraph/
8499000d699STakashi Iwai
8509000d699STakashi Iwai
8519000d699STakashi Iwaihda-emu
8529000d699STakashi Iwai-------
8539000d699STakashi Iwaihda-emu is an HD-audio emulator.  The main purpose of this program is
8549000d699STakashi Iwaito debug an HD-audio codec without the real hardware.  Thus, it
8559000d699STakashi Iwaidoesn't emulate the behavior with the real audio I/O, but it just
8569000d699STakashi Iwaidumps the codec register changes and the ALSA-driver internal changes
8579000d699STakashi Iwaiat probing and operating the HD-audio driver.
8589000d699STakashi Iwai
8599000d699STakashi IwaiThe program requires a codec proc-file to simulate.  Get a proc file
8609000d699STakashi Iwaifor the target codec beforehand, or pick up an example codec from the
8619000d699STakashi Iwaicodec proc collections in the tarball.  Then, run the program with the
8629000d699STakashi Iwaiproc file, and the hda-emu program will start parsing the codec file
8639000d699STakashi Iwaiand simulates the HD-audio driver:
8649000d699STakashi Iwai
8659000d699STakashi Iwai::
8669000d699STakashi Iwai
8679000d699STakashi Iwai    % hda-emu codecs/stac9200-dell-d820-laptop
8689000d699STakashi Iwai    # Parsing..
8699000d699STakashi Iwai    hda_codec: Unknown model for STAC9200, using BIOS defaults
8709000d699STakashi Iwai    hda_codec: pin nid 08 bios pin config 40c003fa
8719000d699STakashi Iwai    ....
8729000d699STakashi Iwai
8739000d699STakashi Iwai
8749000d699STakashi IwaiThe program gives you only a very dumb command-line interface.  You
8759000d699STakashi Iwaican get a proc-file dump at the current state, get a list of control
8769000d699STakashi Iwai(mixer) elements, set/get the control element value, simulate the PCM
8779000d699STakashi Iwaioperation, the jack plugging simulation, etc.
8789000d699STakashi Iwai
8799000d699STakashi IwaiThe program is found in the git repository below:
8809000d699STakashi Iwai
8819000d699STakashi Iwai* git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git
8829000d699STakashi Iwai
8839000d699STakashi IwaiSee README file in the repository for more details about hda-emu
8849000d699STakashi Iwaiprogram.
8859000d699STakashi Iwai
8869000d699STakashi Iwai
8879000d699STakashi Iwaihda-jack-retask
8889000d699STakashi Iwai---------------
8899000d699STakashi Iwaihda-jack-retask is a user-friendly GUI program to manipulate the
8909000d699STakashi IwaiHD-audio pin control for jack retasking.  If you have a problem about
8919000d699STakashi Iwaithe jack assignment, try this program and check whether you can get
8929000d699STakashi Iwaiuseful results.  Once when you figure out the proper pin assignment,
8939000d699STakashi Iwaiit can be fixed either in the driver code statically or via passing a
8949000d699STakashi Iwaifirmware patch file (see "Early Patching" section).
8959000d699STakashi Iwai
8969000d699STakashi IwaiThe program is included in alsa-tools now:
8979000d699STakashi Iwai
8989000d699STakashi Iwai* git://git.alsa-project.org/alsa-tools.git
899