Lines Matching +full:codec +full:- +full:analog +full:- +full:controls
2 More Notes on HD-Audio Driver
11 HD-audio is the new standard on-board audio component on modern PCs
12 after AC97. Although Linux has been supporting HD-audio since long
15 This document explains the brief trouble-shooting and debugging
16 methods for the HD-audio hardware.
18 The HD-audio component consists of two parts: the controller chip and
19 the codec chips on the HD-audio bus. Linux provides a single driver
20 for all controllers, snd-hda-intel. Although the driver name contains
21 a word of a well-known hardware vendor, it's not specific to it but for
22 all controller chips by other companies. Since the HD-audio
23 controllers are supposed to be compatible, the single snd-hda-driver
25 bugs and issues specific to each controller type. The snd-hda-intel
29 codec and optionally one modem codec. In theory, there might be
30 multiple audio codecs, e.g. for analog and digital outputs, and the
34 The snd-hda-intel driver has several different codec parsers depending
35 on the codec. It has a generic parser as a fallback, but this
37 parser, usually the codec-specific parser (coded in patch_*.c) is used
38 for the codec-specific implementations. The details about the
39 codec-specific problems are explained in the later sections.
41 If you are interested in the deep debugging of HD-audio, read the
42 HD-audio specification at first. The specification is found on
48 HD-Audio Controller
51 DMA-Position Problem
52 --------------------
55 read in two ways, either via a LPIB register or via a position-buffer
56 map. As default the driver tries to read from the io-mapped
57 position-buffer, and falls back to LPIB if the position-buffer appears
62 ``position_fix=2`` means to use the position-buffer.
65 by comparing both LPIB and position-buffer values.
67 and uses LPIB for the playback and the position-buffer for the capture
80 the wake-up timing. It wakes up a few samples before actually
93 Codec-Probing Problem
94 ---------------------
95 A less often but a more severe problem is the codec probing. When
96 BIOS reports the available codec slots wrongly, the driver gets
97 confused and tries to access the non-existing codec slot. This often
98 results in the total screw-up, and destructs the further communication
99 with the codec chips. The symptom appears usually as error messages
109 It means that the codec response isn't notified via an IRQ. The
115 accessing a non-existing codec slot.
118 codec slots via ``probe_mask`` option. It's a bitmask, and each bit
119 corresponds to the codec slot. For example, to probe only the first
127 driver to probe the codec slots the hardware doesn't report for use.
129 Then the rest 8 bits are passed as the codec slots to probe
131 the codec slots 0 and 1 no matter what the hardware reports.
135 ------------------
136 HD-audio driver uses MSI as default (if available) since 2.6.33
143 see a regression wrt the sound quality (stuttering, etc) or a lock-up
150 HD-Audio Codec
154 ------------
155 The most common problem regarding the HD-audio driver is the
156 unsupported codec features or the mismatched device configuration.
157 Most of codec-specific code has several preset models, either to
165 hda_codec: ALC880: BIOS auto-probing.
170 hda_codec: Unknown model for ALC880, trying auto-probe from BIOS...
175 listed in the known preset model (white-)list. But, this doesn't mean
176 that the driver is broken. Many codec-drivers provide the automatic
179 The HD-audio codec has usually "pin" widgets, and BIOS sets the default
181 connection type, the jack color, etc. The HD-audio driver can guess
183 However -- some codec-support codes, such as patch_analog.c, don't
188 The preset model (or recently called as "fix-up") is provided
190 model is found in the white-list, the driver assumes the static
193 (or codec SSID) from the existing one, you may have a good chance to
194 re-use the same model. You can pass the ``model`` option to specify the
195 preset model instead of PCI (and codec-) SSID look-up.
197 What ``model`` option values are available depends on the codec chip.
198 Check your codec chip from the codec proc file (see "Codec Proc-File"
199 section below). It will show the vendor/product name of your codec
200 chip. Then, see Documentation/sound/hd-audio/models.rst file,
201 the section of HD-audio driver. You can find a list of codecs
202 and ``model`` options belonging to each codec. For example, for Realtek
203 ALC262 codec chip, pass ``model=ultra`` for devices that are compatible
206 Thus, the first thing you can do for any brand-new, unsupported and
207 non-working HD-audio hardware is to check HD-audio codec and several
213 * when 'nofixup' is passed, the device-specific fixups in the codec
215 * when ``generic`` is passed, the codec-specific parser is skipped and
219 is to pass the PCI or codec SSID in the form of ``model=XXXX:YYYY``
220 where XXXX and YYYY are the sub-vendor and sub-device IDs in hex
231 ----------------------------
232 One of the most frequent (and obvious) bugs with HD-audio is the
233 silent output from either or both of a built-in speaker and a
235 first. A speaker output often requires more additional controls like
239 Before making a bug report, double-check whether the mixer is set up
240 correctly. The recent version of snd-hda-intel driver provides mostly
242 indicates the front-channels). In addition, there can be individual
243 "Headphone" and "Speaker" controls.
250 not on every preset model or codec-support code.
262 certain GPIO. If the codec pin supports EAPD, you have a better
265 * Some Realtek codecs require special vendor-specific coefficients to
267 * IDT codecs may have extra power-enable/disable controls on each
268 analog pin. See patch_sigmatel.c.
269 * Very rare but some devices don't accept the pin-detection verb until
271 codec-communication stall. Some examples are found in
276 ----------------
284 When the PCM device is opened via "default" PCM (without pulse-audio
289 should be set to exactly 50%, corresponding to 0dB -- neither extra
293 It's known that some codecs / devices have fairly bad analog circuits,
294 and the recorded sound contains a certain DC-offset. This is no bug
297 Most of modern laptops have no analog CD-input connection. Thus, the
301 The automatic switching of the built-in and external mic per plugging
302 is implemented on some codec models but not on every model. Partly
308 ----------------
310 to fight against evil, try debugging via hitting the raw HD-audio
311 codec verbs to the device. Some tools are available: hda-emu and
312 hda-analyzer. The detailed description is found in the sections
321 --------------------
332 options. Note that each of them corresponds to the codec chip, not
338 When this is enabled, the driver creates hardware-dependent devices
339 (one per each codec), and you have a raw access to the device via
341 codec slot #2 of the first card (#0). For debug-tools such as
342 hda-verb and hda-analyzer, the hwdep device has to be enabled.
347 the corresponding hwdep directory. See "HD-audio reconfiguration"
350 ``CONFIG_SND_HDA_POWER_SAVE`` option enables the power-saving feature.
351 See "Power-saving" section below.
354 Codec Proc-File
355 ---------------
356 The codec proc-file is a treasure-chest for debugging HD-audio.
357 It shows most of useful information of each codec widget.
359 The proc file is located in /proc/asound/card*/codec#*, one file per
360 each codec slot. You can know the codec vendor, product id and
363 is because the jack-sensing might be depending on the trigger state.
366 to the emulator as the primary codec information. See the debug tools
374 HD-Audio Reconfiguration
375 ------------------------
376 This is an experimental feature to allow you re-configure the HD-audio
377 codec dynamically without reloading the driver. The following sysfs
378 files are available under each codec-hwdep device directory (e.g.
382 Shows the 32bit codec vendor-id hex number. You can change the
383 vendor-id value by writing to this file.
385 Shows the 32bit codec subsystem-id hex number. You can change the
386 subsystem-id value by writing to this file.
388 Shows the 32bit codec revision-id hex number. You can change the
389 revision-id value by writing to this file.
391 Shows the AFG ID. This is read-only.
393 Shows the MFG ID. This is read-only.
395 Shows the codec name string. Can be changed by writing to this
405 Shows / stores hint strings for codec parsers for any use.
411 Shows the pin default values set by the codec parser explicitly.
422 Triggers the codec re-configuration. When any value is written to
423 this file, the driver re-initialize and parses the codec tree
427 Resets the codec, removes the mixer elements and PCM stuff of the
428 specified codec, and clear all init verbs and hints.
432 re-configure based on that state, run like below:
440 ------------
441 The codec parser have several switches and adjustment knobs for
442 matching better with the actual codec or device behavior. Many of
446 the codec parser will skip the features like auto-mute or mic
447 auto-switch. As a boolean value, either ``yes``, ``no``, ``true``, ``false``,
475 enable/disable the headphone auto-mute feature; default true
477 enable/disable the mic auto-switch feature; default true
479 enable/disable the line-in auto-switch feature; default false
485 try probing multi-I/O config (e.g. shared line-in/surround,
490 provide split internal mic volume/switch for phase-inverted
496 add the stereo mix (analog-loopback mix) to the input mux if
499 add "xxx Jack Mode" enum controls to each I/O jack for allowing to
511 enable/disable the hp/mic shared input for a single built-in mic
516 specifies the widget NID of the analog-loopback mixer
520 --------------
522 as a firmware file for modifying the HD-audio setup before
523 initializing the codec. This can work basically like the
525 first codec configuration.
531 [codec]
548 The file needs to have a line ``[codec]``. The next line should contain
549 three numbers indicating the codec vendor-id (0x12345678 in the
550 example), the codec subsystem-id (0xabcd1234) and the address (2) of
551 the codec. The rest patch entries are applied to this specified codec
552 until another codec entry is given. Passing 0 or a negative number to
557 The ``[model]`` line allows to change the model name of the each codec.
562 default pin-configurations just like ``user_pin_configs`` sysfs above.
569 Another example to override the codec vendor id from 0x12345678 to
573 [codec]
580 In the similar way, you can override the codec subsystem_id via
582 Also, the codec chip name can be rewritten via ``[chip_name]`` line.
585 [codec]
595 My-own NEWS-0002
598 The hd-audio driver reads the file via request_firmware(). Thus,
601 ``patch=hda-init.fw``, the file /lib/firmware/hda-init.fw must be
606 For example, if you have two cards, one for an on-board analog and one
610 options snd-hda-intel patch=on-board-patch,hdmi-patch
613 Power-Saving
614 ------------
615 The power-saving is a kind of auto-suspend of the device. When the
621 The power-saving won't work when the analog loopback is enabled on
623 you want the power-saving.
625 The power-saving feature might cause audible click noises at each
626 power-down/up depending on the device. Some of them might be
628 openSUSE enables the power-saving feature automatically when the power
630 power-saving. See /sys/module/snd_hda_intel/parameters/power_save to
631 check the current value. If it's non-zero, the feature is turned on.
633 The recent kernel supports the runtime PM for the HD-audio controller
634 chip, too. It means that the HD-audio controller is also powered up /
642 -----------
643 The hd-audio driver gives a few basic tracepoints.
645 traces the response from RIRB (only when read from the codec driver).
646 ``hda:hda_bus_reset`` traces the bus-reset due to fatal error, etc,
649 via power-saving behavior.
658 trace what codec command is sent, enable the tracepoint like:
664 # TASK-PID CPU# TIMESTAMP FUNCTION
666 <...>-7807 [002] 105147.774889: hda_send_cmd: [0:0] val=e3a019
667 <...>-7807 [002] 105147.774893: hda_send_cmd: [0:0] val=e39019
668 <...>-7807 [002] 105147.999542: hda_send_cmd: [0:0] val=e3a01a
669 <...>-7807 [002] 105147.999543: hda_send_cmd: [0:0] val=e3901a
670 <...>-26764 [001] 349222.837143: hda_send_cmd: [0:0] val=e3a019
671 <...>-26764 [001] 349222.837148: hda_send_cmd: [0:0] val=e39019
672 <...>-26764 [001] 349223.058539: hda_send_cmd: [0:0] val=e3a01a
673 <...>-26764 [001] 349223.058541: hda_send_cmd: [0:0] val=e3901a
675 Here ``[0:0]`` indicates the card number and the codec address, and
676 ``val`` shows the value sent to the codec, respectively. The value is
677 a packed value, and you can decode it via hda-decode-verb program
678 included in hda-emu package below. For example, the value e3a019 is
679 to set the left output-amp value to 25.
682 % hda-decode-verb 0xe3a019
692 ----------------
693 The latest development codes for HD-audio are found on sound git tree:
697 The master branch or for-next branches can be used as the main
699 and next kernels are found in for-linus and for-next branches,
704 --------------------
710 * Kernel version (and ALSA-driver version if you built externally)
711 * ``alsa-info.sh`` output; run with ``--no-upload`` option. See the
712 section below about alsa-info
714 If it's a regression, at best, send alsa-info outputs of both working
715 and non-working kernels. This is really helpful because we can
716 compare the codec registers directly.
720 kernel-bugzilla
722 alsa-devel ML
723 alsa-devel@alsa-project.org
729 This section describes some tools available for debugging HD-audio
732 alsa-info
733 ---------
734 The script ``alsa-info.sh`` is a very useful tool to gather the audio
735 device information. It's included in alsa-utils package. The latest
738 * git://git.alsa-project.org/alsa-utils.git
742 * https://www.alsa-project.org/alsa-info.sh
746 including the codec proc files, mixer outputs and the control
748 on alsa-project.org. But, if you send a bug report, it'd be better to
749 run with ``--no-upload`` option, and attach the generated file.
751 There are some other useful options. See ``--help`` option output for
757 alsa-info at this state. With this option, the driver won't configure
758 the mixer and PCM but just tries to probe the codec slot. After
759 probing, the proc file is available, so you can get the raw codec
762 configuration via hwdep sysfs file if hda-reconfig option is enabled.
765 to determine the BIOS codec initialization.
768 hda-verb
769 --------
770 hda-verb is a tiny program that allows you to access the HD-audio
771 codec directly. You can execute a raw HD-audio codec verb with this.
775 The hda-verb program takes four arguments: the hwdep device file, the
776 widget NID, the verb and the parameter. When you access to the codec
781 The second parameter is the widget number-id to access. The third
788 % hda-verb /dev/snd/hwC0D0 0x12 0x701 2
792 % hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_ID
796 % hda-verb /dev/snd/hwC0D0 2 set_a 0xb080
804 via hda-verb won't change the mixer value.
806 The hda-verb program is included now in alsa-tools:
808 * git://git.alsa-project.org/alsa-tools.git
810 Also, the old stand-alone package is found in the ftp directory:
816 * git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-verb.git
818 See README file in the tarball for more details about hda-verb
822 hda-analyzer
823 ------------
824 hda-analyzer provides a graphical interface to access the raw HD-audio
826 hda-verb. The program gives you an easy-to-use GUI stuff for showing
828 proc-compatible output.
830 The hda-analyzer:
832 * https://git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer
834 is a part of alsa.git repository in alsa-project.org:
836 * git://git.alsa-project.org/alsa.git
839 ----------
841 codec-node connection of a codec chip. It's especially useful when
842 you analyze or debug a codec without a proper datasheet. The program
843 parses the given codec proc file and converts to SVG via graphiz
851 hda-emu
852 -------
853 hda-emu is an HD-audio emulator. The main purpose of this program is
854 to debug an HD-audio codec without the real hardware. Thus, it
856 dumps the codec register changes and the ALSA-driver internal changes
857 at probing and operating the HD-audio driver.
859 The program requires a codec proc-file to simulate. Get a proc file
860 for the target codec beforehand, or pick up an example codec from the
861 codec proc collections in the tarball. Then, run the program with the
862 proc file, and the hda-emu program will start parsing the codec file
863 and simulates the HD-audio driver:
867 % hda-emu codecs/stac9200-dell-d820-laptop
874 The program gives you only a very dumb command-line interface. You
875 can get a proc-file dump at the current state, get a list of control
881 * git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git
883 See README file in the repository for more details about hda-emu
887 hda-jack-retask
888 ---------------
889 hda-jack-retask is a user-friendly GUI program to manipulate the
890 HD-audio pin control for jack retasking. If you have a problem about
896 The program is included in alsa-tools now:
898 * git://git.alsa-project.org/alsa-tools.git