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