HD-Audio.txt 28.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
MORE NOTES ON HD-AUDIO DRIVER
=============================
					Takashi Iwai <tiwai@suse.de>


GENERAL
-------

HD-audio is the new standard on-board audio component on modern PCs
after AC97.  Although Linux has been supporting HD-audio since long
time ago, there are often problems with new machines.  A part of the
T
Takashi Iwai 已提交
12 13 14
problem is broken BIOS, and the rest is the driver implementation.
This document explains the brief trouble-shooting and debugging
methods for the	HD-audio hardware.
15 16 17

The HD-audio component consists of two parts: the controller chip and 
the codec chips on the HD-audio bus.  Linux provides a single driver
T
Takashi Iwai 已提交
18
for all controllers, snd-hda-intel.  Although the driver name contains
19
a word of a well-known hardware vendor, it's not specific to it but for
T
Takashi Iwai 已提交
20 21 22 23 24
all controller chips by other companies.  Since the HD-audio
controllers are supposed to be compatible, the single snd-hda-driver
should work in most cases.  But, not surprisingly, there are known
bugs and issues specific to each controller type.  The snd-hda-intel
driver has a bunch of workarounds for these as described below.
25 26

A controller may have multiple codecs.  Usually you have one audio
T
Takashi Iwai 已提交
27 28 29 30
codec and optionally one modem codec.  In theory, there might be
multiple audio codecs, e.g. for analog and digital outputs, and the
driver might not work properly because of conflict of mixer elements.
This should be fixed in future if such hardware really exists.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

The snd-hda-intel driver has several different codec parsers depending
on the codec.  It has a generic parser as a fallback, but this
functionality is fairly limited until now.  Instead of the generic
parser, usually the codec-specific parser (coded in patch_*.c) is used
for the codec-specific implementations.  The details about the
codec-specific problems are explained in the later sections.

If you are interested in the deep debugging of HD-audio, read the
HD-audio specification at first.  The specification is found on
Intel's web page, for example:

- http://www.intel.com/standards/hdaudio/


HD-AUDIO CONTROLLER
-------------------

DMA-Position Problem
~~~~~~~~~~~~~~~~~~~~
The most common problem of the controller is the inaccurate DMA
pointer reporting.  The DMA pointer for playback and capture can be
read in two ways, either via a LPIB register or via a position-buffer
T
Takashi Iwai 已提交
54 55 56 57
map.  As default the driver tries to read from the io-mapped
position-buffer, and falls back to LPIB if the position-buffer appears
dead.  However, this detection isn't perfect on some devices.  In such
a case, you can change the default method via `position_fix` option.
58 59 60

`position_fix=1` means to use LPIB method explicitly.
`position_fix=2` means to use the position-buffer.  0 is the default
T
Takashi Iwai 已提交
61 62 63
value, the automatic check and fallback to LPIB as described in the
above.  If you get a problem of repeated sounds, this option might
help.
64 65 66 67 68 69 70 71 72 73

In addition to that, every controller is known to be broken regarding
the wake-up timing.  It wakes up a few samples before actually
processing the data on the buffer.  This caused a lot of problems, for
example, with ALSA dmix or JACK.  Since 2.6.27 kernel, the driver puts
an artificial delay to the wake up timing.  This delay is controlled
via `bdl_pos_adj` option. 

When `bdl_pos_adj` is a negative value (as default), it's assigned to
an appropriate value depending on the controller chip.  For Intel
T
Takashi Iwai 已提交
74
chips, it'd be 1 while it'd be 32 for others.  Usually this works.
75
Only in case it doesn't work and you get warning messages, you should
T
Takashi Iwai 已提交
76
change this parameter to other values.
77 78 79 80 81 82 83


Codec-Probing Problem
~~~~~~~~~~~~~~~~~~~~~
A less often but a more severe problem is the codec probing.  When
BIOS reports the available codec slots wrongly, the driver gets
confused and tries to access the non-existing codec slot.  This often
T
Takashi Iwai 已提交
84 85 86
results in the total screw-up, and destructs the further communication
with the codec chips.  The symptom appears usually as error messages
like:
87
------------------------------------------------------------------------
T
Takashi Iwai 已提交
88
  hda_intel: azx_get_response timeout, switching to polling mode:
89
        last cmd=0x12345678
T
Takashi Iwai 已提交
90
  hda_intel: azx_get_response timeout, switching to single_cmd mode:
91 92 93 94 95 96 97 98 99 100 101 102 103 104
        last cmd=0x12345678
------------------------------------------------------------------------

The first line is a warning, and this is usually relatively harmless.
It means that the codec response isn't notified via an IRQ.  The
driver uses explicit polling method to read the response.  It gives
very slight CPU overhead, but you'd unlikely notice it.

The second line is, however, a fatal error.  If this happens, usually
it means that something is really wrong.  Most likely you are
accessing a non-existing codec slot.

Thus, if the second error message appears, try to narrow the probed
codec slots via `probe_mask` option.  It's a bitmask, and each bit
T
Takashi Iwai 已提交
105 106 107
corresponds to the codec slot.  For example, to probe only the first
slot, pass `probe_mask=1`.  For the first and the third slots, pass
`probe_mask=5` (where 5 = 1 | 4), and so on.
108 109 110 111

Since 2.6.29 kernel, the driver has a more robust probing method, so
this error might happen rarely, though.

T
Takashi Iwai 已提交
112 113 114 115 116 117 118
On a machine with a broken BIOS, sometimes you need to force the
driver to probe the codec slots the hardware doesn't report for use.
In such a case, turn the bit 8 (0x100) of `probe_mask` option on.
Then the rest 8 bits are passed as the codec slots to probe
unconditionally.  For example, `probe_mask=0x103` will force to probe
the codec slots 0 and 1 no matter what the hardware reports.

119 120 121 122 123 124 125 126 127 128 129 130 131 132

Interrupt Handling
~~~~~~~~~~~~~~~~~~
In rare but some cases, the interrupt isn't properly handled as
default.  You would notice this by the DMA transfer error reported by
ALSA PCM core, for example.  Using MSI might help in such a case.
Pass `enable_msi=1` option for enabling MSI.


HD-AUDIO CODEC
--------------

Model Option
~~~~~~~~~~~~
T
Takashi Iwai 已提交
133 134 135 136
The most common problem regarding the HD-audio driver is the
unsupported codec features or the mismatched device configuration.
Most of codec-specific code has several preset models, either to
override the BIOS setup or to provide more comprehensive features.
137 138 139 140

The driver checks PCI SSID and looks through the static configuration
table until any matching entry is found.  If you have a new machine,
you may see a message like below:
141 142 143 144
------------------------------------------------------------------------
    hda_codec: ALC880: BIOS auto-probing.
------------------------------------------------------------------------
Meanwhile, in the earlier versions, you would see a message like:
145 146 147
------------------------------------------------------------------------
    hda_codec: Unknown model for ALC880, trying auto-probe from BIOS...
------------------------------------------------------------------------
T
Takashi Iwai 已提交
148 149 150 151 152 153
Even if you see such a message, DON'T PANIC.  Take a deep breath and
keep your towel.  First of all, it's an informational message, no
warning, no error.  This means that the PCI SSID of your device isn't
listed in the known preset model (white-)list.  But, this doesn't mean
that the driver is broken.  Many codec-drivers provide the automatic
configuration mechanism based on the BIOS setup.
154 155 156 157 158

The HD-audio codec has usually "pin" widgets, and BIOS sets the default
configuration of each pin, which indicates the location, the
connection type, the jack color, etc.  The HD-audio driver can guess
the right connection judging from these default configuration values.
T
Takashi Iwai 已提交
159
However -- some codec-support codes, such as patch_analog.c, don't
160 161 162 163
support the automatic probing (yet as of 2.6.28).  And, BIOS is often,
yes, pretty often broken.  It sets up wrong values and screws up the
driver.

T
Takashi Iwai 已提交
164 165
The preset model is provided basically to overcome such a situation.
When the matching preset model is found in the white-list, the driver
166
assumes the static configuration of that preset and builds the mixer
T
Takashi Iwai 已提交
167 168 169 170 171
elements and PCM streams based on the static information.  Thus, if
you have a newer machine with a slightly different PCI SSID from the
existing one, you may have a good chance to re-use the same model.
You can pass the `model` option to specify the preset model instead of
PCI SSID look-up.
172 173 174 175

What `model` option values are available depends on the codec chip.
Check your codec chip from the codec proc file (see "Codec Proc-File"
section below).  It will show the vendor/product name of your codec
176
chip.  Then, see Documentation/sound/alsa/HD-Audio-Models.txt file,
177
the section of HD-audio driver.  You can find a list of codecs
T
Takashi Iwai 已提交
178
and `model` options belonging to each codec.  For example, for Realtek
179 180 181
ALC262 codec chip, pass `model=ultra` for devices that are compatible
with Samsung Q1 Ultra.

T
Takashi Iwai 已提交
182 183
Thus, the first thing you can do for any brand-new, unsupported and
non-working HD-audio hardware is to check HD-audio codec and several
184
different `model` option values.  If you have any luck, some of them
T
Takashi Iwai 已提交
185
might suit with your device well.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205

Some codecs such as ALC880 have a special model option `model=test`.
This configures the driver to provide as many mixer controls as
possible for every single pin feature except for the unsolicited
events (and maybe some other specials).  Adjust each mixer element and
try the I/O in the way of trial-and-error until figuring out the whole
I/O pin mappings.

Note that `model=generic` has a special meaning.  It means to use the
generic parser regardless of the codec.  Usually the codec-specific
parser is much better than the generic parser (as now).  Thus this
option is more about the debugging purpose.


Speaker and Headphone Output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
One of the most frequent (and obvious) bugs with HD-audio is the
silent output from either or both of a built-in speaker and a
headphone jack.  In general, you should try a headphone output at
first.  A speaker output often requires more additional controls like
T
Takashi Iwai 已提交
206 207
the external amplifier bits.  Thus a headphone output has a slightly
better chance.
208 209 210

Before making a bug report, double-check whether the mixer is set up
correctly.  The recent version of snd-hda-intel driver provides mostly
T
Takashi Iwai 已提交
211 212 213
"Master" volume control as well as "Front" volume (where Front
indicates the front-channels).  In addition, there can be individual
"Headphone" and "Speaker" controls.
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233

Ditto for the speaker output.  There can be "External Amplifier"
switch on some codecs.  Turn on this if present.

Another related problem is the automatic mute of speaker output by
headphone plugging.  This feature is implemented in most cases, but
not on every preset model or codec-support code.

In anyway, try a different model option if you have such a problem.
Some other models may match better and give you more matching
functionality.  If none of the available models works, send a bug
report.  See the bug report section for details.

If you are masochistic enough to debug the driver problem, note the
following:

- The speaker (and the headphone, too) output often requires the
  external amplifier.  This can be set usually via EAPD verb or a
  certain GPIO.  If the codec pin supports EAPD, you have a better
  chance via SET_EAPD_BTL verb (0x70c).  On others, GPIO pin (mostly
T
Takashi Iwai 已提交
234
  it's either GPIO0 or GPIO1) may turn on/off EAPD.
235 236 237 238 239 240 241 242 243 244 245 246
- Some Realtek codecs require special vendor-specific coefficients to
  turn on the amplifier.  See patch_realtek.c.
- IDT codecs may have extra power-enable/disable controls on each
  analog pin.  See patch_sigmatel.c.
- Very rare but some devices don't accept the pin-detection verb until
  triggered.  Issuing GET_PIN_SENSE verb (0xf09) may result in the
  codec-communication stall.  Some examples are found in
  patch_realtek.c.


Capture Problems
~~~~~~~~~~~~~~~~
T
Takashi Iwai 已提交
247 248 249 250 251 252
The capture problems are often because of missing setups of mixers.
Thus, before submitting a bug report, make sure that you set up the
mixer correctly.  For example, both "Capture Volume" and "Capture
Switch" have to be set properly in addition to the right "Capture
Source" or "Input Source" selection.  Some devices have "Mic Boost"
volume or switch.
253 254 255 256 257 258

When the PCM device is opened via "default" PCM (without pulse-audio
plugin), you'll likely have "Digital Capture Volume" control as well.
This is provided for the extra gain/attenuation of the signal in
software, especially for the inputs without the hardware volume
control such as digital microphones.  Unless really needed, this
T
Takashi Iwai 已提交
259 260 261
should be set to exactly 50%, corresponding to 0dB -- neither extra
gain nor attenuation.  When you use "hw" PCM, i.e., a raw access PCM,
this control will have no influence, though.
262 263 264 265 266

It's known that some codecs / devices have fairly bad analog circuits,
and the recorded sound contains a certain DC-offset.  This is no bug
of the driver.

T
Takashi Iwai 已提交
267
Most of modern laptops have no analog CD-input connection.  Thus, the
268
recording from CD input won't work in many cases although the driver
T
Takashi Iwai 已提交
269
provides it as the capture source.  Use CDDA instead.
270 271 272 273 274 275 276 277 278

The automatic switching of the built-in and external mic per plugging
is implemented on some codec models but not on every model.  Partly
because of my laziness but mostly lack of testers.  Feel free to
submit the improvement patch to the author.


Direct Debugging
~~~~~~~~~~~~~~~~
279
If no model option gives you a better result, and you are a tough guy
T
Takashi Iwai 已提交
280
to fight against evil, try debugging via hitting the raw HD-audio
281 282 283
codec verbs to the device.  Some tools are available: hda-emu and
hda-analyzer.  The detailed description is found in the sections
below.  You'd need to enable hwdep for using these tools.  See "Kernel
T
Takashi Iwai 已提交
284
Configuration" section.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303


OTHER ISSUES
------------

Kernel Configuration
~~~~~~~~~~~~~~~~~~~~
In general, I recommend you to enable the sound debug option,
`CONFIG_SND_DEBUG=y`, no matter whether you are debugging or not.
This enables snd_printd() macro and others, and you'll get additional
kernel messages at probing.

In addition, you can enable `CONFIG_SND_DEBUG_VERBOSE=y`.  But this
will give you far more messages.  Thus turn this on only when you are
sure to want it.

Don't forget to turn on the appropriate `CONFIG_SND_HDA_CODEC_*`
options.  Note that each of them corresponds to the codec chip, not
the controller chip.  Thus, even if lspci shows the Nvidia controller,
T
Takashi Iwai 已提交
304 305
you may need to choose the option for other vendors.  If you are
unsure, just select all yes.
306 307 308 309

`CONFIG_SND_HDA_HWDEP` is a useful option for debugging the driver.
When this is enabled, the driver creates hardware-dependent devices
(one per each codec), and you have a raw access to the device via
T
Takashi Iwai 已提交
310 311 312 313
these device files.  For example, `hwC0D2` will be created for the
codec slot #2 of the first card (#0).  For debug-tools such as
hda-verb and hda-analyzer, the hwdep device has to be enabled.
Thus, it'd be better to turn this on always.
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371

`CONFIG_SND_HDA_RECONFIG` is a new option, and this depends on the
hwdep option above.  When enabled, you'll have some sysfs files under
the corresponding hwdep directory.  See "HD-audio reconfiguration"
section below.

`CONFIG_SND_HDA_POWER_SAVE` option enables the power-saving feature.
See "Power-saving" section below.


Codec Proc-File
~~~~~~~~~~~~~~~
The codec proc-file is a treasure-chest for debugging HD-audio.
It shows most of useful information of each codec widget.

The proc file is located in /proc/asound/card*/codec#*, one file per
each codec slot.  You can know the codec vendor, product id and
names, the type of each widget, capabilities and so on.
This file, however, doesn't show the jack sensing state, so far.  This
is because the jack-sensing might be depending on the trigger state.

This file will be picked up by the debug tools, and also it can be fed
to the emulator as the primary codec information.  See the debug tools
section below.

This proc file can be also used to check whether the generic parser is
used.  When the generic parser is used, the vendor/product ID name
will appear as "Realtek ID 0262", instead of "Realtek ALC262".


HD-Audio Reconfiguration
~~~~~~~~~~~~~~~~~~~~~~~~
This is an experimental feature to allow you re-configure the HD-audio
codec dynamically without reloading the driver.  The following sysfs
files are available under each codec-hwdep device directory (e.g. 
/sys/class/sound/hwC0D0):

vendor_id::
  Shows the 32bit codec vendor-id hex number.  You can change the
  vendor-id value by writing to this file.
subsystem_id::
  Shows the 32bit codec subsystem-id hex number.  You can change the
  subsystem-id value by writing to this file.
revision_id::
  Shows the 32bit codec revision-id hex number.  You can change the
  revision-id value by writing to this file.
afg::
  Shows the AFG ID.  This is read-only.
mfg::
  Shows the MFG ID.  This is read-only.
name::
  Shows the codec name string.  Can be changed by writing to this
  file.
modelname::
  Shows the currently set `model` option.  Can be changed by writing
  to this file.
init_verbs::
  The extra verbs to execute at initialization.  You can add a verb by
372 373
  writing to this file.  Pass three numbers: nid, verb and parameter
  (separated with a space).
374
hints::
375 376 377 378
  Shows / stores hint strings for codec parsers for any use.
  Its format is `key = value`.  For example, passing `hp_detect = yes`
  to IDT/STAC codec parser will result in the disablement of the
  headphone detection.
379 380
init_pin_configs::
  Shows the initial pin default config values set by BIOS.
381
driver_pin_configs::
382 383 384 385
  Shows the pin default values set by the codec parser explicitly.
  This doesn't show all pin values but only the changed values by
  the parser.  That is, if the parser doesn't change the pin default
  config values by itself, this will contain nothing.
386 387 388 389
user_pin_configs::
  Shows the pin default config values to override the BIOS setup.
  Writing this (with two numbers, NID and value) appends the new
  value.  The given will be used instead of the initial BIOS value at
390 391
  the next reconfiguration time.  Note that this config will override
  even the driver pin configs, too.
392 393 394 395 396 397 398 399 400
reconfig::
  Triggers the codec re-configuration.  When any value is written to
  this file, the driver re-initialize and parses the codec tree
  again.  All the changes done by the sysfs entries above are taken
  into account.
clear::
  Resets the codec, removes the mixer elements and PCM stuff of the
  specified codec, and clear all init verbs and hints.

401 402 403 404 405 406 407 408
For example, when you want to change the pin default configuration
value of the pin widget 0x14 to 0x9993013f, and let the driver
re-configure based on that state, run like below:
------------------------------------------------------------------------
  # echo 0x14 0x9993013f > /sys/class/sound/hwC0D0/user_pin_configs
  # echo 1 > /sys/class/sound/hwC0D0/reconfig  
------------------------------------------------------------------------

409

410 411 412 413 414 415 416
Early Patching
~~~~~~~~~~~~~~
When CONFIG_SND_HDA_PATCH_LOADER=y is set, you can pass a "patch" as a
firmware file for modifying the HD-audio setup before initializing the
codec.  This can work basically like the reconfiguration via sysfs in
the above, but it does it before the first codec configuration.

417
A patch file is a plain text file which looks like below:
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454

------------------------------------------------------------------------
  [codec]
  0x12345678 0xabcd1234 2

  [model]
  auto

  [pincfg]
  0x12 0x411111f0

  [verb]
  0x20 0x500 0x03
  0x20 0x400 0xff

  [hint]
  hp_detect = yes
------------------------------------------------------------------------

The file needs to have a line `[codec]`.  The next line should contain
three numbers indicating the codec vendor-id (0x12345678 in the
example), the codec subsystem-id (0xabcd1234) and the address (2) of
the codec.  The rest patch entries are applied to this specified codec
until another codec entry is given.

The `[model]` line allows to change the model name of the each codec.
In the example above, it will be changed to model=auto.
Note that this overrides the module option.

After the `[pincfg]` line, the contents are parsed as the initial
default pin-configurations just like `user_pin_configs` sysfs above.
The values can be shown in user_pin_configs sysfs file, too.

Similarly, the lines after `[verb]` are parsed as `init_verbs`
sysfs entries, and the lines after `[hint]` are parsed as `hints`
sysfs entries, respectively.

455 456 457 458 459 460 461 462 463 464 465 466 467 468
The hd-audio driver reads the file via request_firmware().  Thus,
a patch file has to be located on the appropriate firmware path,
typically, /lib/firmware.  For example, when you pass the option
`patch=hda-init.fw`, the file /lib/firmware/hda-init-fw must be
present.

The patch module option is specific to each card instance, and you
need to give one file name for each instance, separated by commas.
For example, if you have two cards, one for an on-board analog and one 
for an HDMI video board, you may pass patch option like below:
------------------------------------------------------------------------
    options snd-hda-intel patch=on-board-patch,hdmi-patch
------------------------------------------------------------------------

469

470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486
Power-Saving
~~~~~~~~~~~~
The power-saving is a kind of auto-suspend of the device.  When the
device is inactive for a certain time, the device is automatically
turned off to save the power.  The time to go down is specified via
`power_save` module option, and this option can be changed dynamically
via sysfs.

The power-saving won't work when the analog loopback is enabled on
some codecs.  Make sure that you mute all unneeded signal routes when
you want the power-saving.

The power-saving feature might cause audible click noises at each
power-down/up depending on the device.  Some of them might be
solvable, but some are hard, I'm afraid.  Some distros such as
openSUSE enables the power-saving feature automatically when the power
cable is unplugged.  Thus, if you hear noises, suspect first the
T
Takashi Iwai 已提交
487
power-saving.  See /sys/module/snd_hda_intel/parameters/power_save to
488 489 490
check the current value.  If it's non-zero, the feature is turned on.


491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
Development Tree
~~~~~~~~~~~~~~~~
The latest development codes for HD-audio are found on sound git tree:

- git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git

The master branch or for-next branches can be used as the main
development branches in general while the HD-audio specific patches
are committed in topic/hda branch.

If you are using the latest Linus tree, it'd be better to pull the
above GIT tree onto it.  If you are using the older kernels, an easy
way to try the latest ALSA code is to build from the snapshot
tarball.  There are daily tarballs and the latest snapshot tarball.
All can be built just like normal alsa-driver release packages, that
is, installed via the usual spells: configure, make and make
install(-modules).  See INSTALL in the package.  The snapshot tarballs
are found at:

- ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/


513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558
Sending a Bug Report
~~~~~~~~~~~~~~~~~~~~
If any model or module options don't work for your device, it's time
to send a bug report to the developers.  Give the following in your
bug report:

- Hardware vendor, product and model names
- Kernel version (and ALSA-driver version if you built externally)
- `alsa-info.sh` output; run with `--no-upload` option.  See the
  section below about alsa-info

If it's a regression, at best, send alsa-info outputs of both working
and non-working kernels.  This is really helpful because we can
compare the codec registers directly.

Send a bug report either the followings:

kernel-bugzilla::
  http://bugme.linux-foundation.org/
alsa-devel ML::
  alsa-devel@alsa-project.org


DEBUG TOOLS
-----------

This section describes some tools available for debugging HD-audio
problems.

alsa-info
~~~~~~~~~
The script `alsa-info.sh` is a very useful tool to gather the audio
device information.  You can fetch the latest version from:

- http://www.alsa-project.org/alsa-info.sh

Run this script as root, and it will gather the important information
such as the module lists, module parameters, proc file contents
including the codec proc files, mixer outputs and the control
elements.  As default, it will store the information onto a web server
on alsa-project.org.  But, if you send a bug report, it'd be better to
run with `--no-upload` option, and attach the generated file.

There are some other useful options.  See `--help` option output for
details.

T
Takashi Iwai 已提交
559 560 561 562 563 564 565 566 567 568
When a probe error occurs or when the driver obviously assigns a
mismatched model, it'd be helpful to load the driver with
`probe_only=1` option (at best after the cold reboot) and run
alsa-info at this state.  With this option, the driver won't configure
the mixer and PCM but just tries to probe the codec slot.  After
probing, the proc file is available, so you can get the raw codec
information before modified by the driver.  Of course, the driver
isn't usable with `probe_only=1`.  But you can continue the
configuration via hwdep sysfs file if hda-reconfig option is enabled.

569 570 571 572

hda-verb
~~~~~~~~
hda-verb is a tiny program that allows you to access the HD-audio
T
Takashi Iwai 已提交
573
codec directly.  You can execute a raw HD-audio codec verb with this.
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622
This program accesses the hwdep device, thus you need to enable the
kernel config `CONFIG_SND_HDA_HWDEP=y` beforehand.

The hda-verb program takes four arguments: the hwdep device file, the
widget NID, the verb and the parameter.  When you access to the codec
on the slot 2 of the card 0, pass /dev/snd/hwC0D2 to the first
argument, typically.  (However, the real path name depends on the
system.)

The second parameter is the widget number-id to access.  The third
parameter can be either a hex/digit number or a string corresponding
to a verb.  Similarly, the last parameter is the value to write, or
can be a string for the parameter type.

------------------------------------------------------------------------
  % hda-verb /dev/snd/hwC0D0 0x12 0x701 2
  nid = 0x12, verb = 0x701, param = 0x2
  value = 0x0

  % hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_ID
  nid = 0x0, verb = 0xf00, param = 0x0
  value = 0x10ec0262

  % hda-verb /dev/snd/hwC0D0 2 set_a 0xb080
  nid = 0x2, verb = 0x300, param = 0xb080
  value = 0x0
------------------------------------------------------------------------

Although you can issue any verbs with this program, the driver state
won't be always updated.  For example, the volume values are usually
cached in the driver, and thus changing the widget amp value directly
via hda-verb won't change the mixer value.

The hda-verb program is found in the ftp directory:

- ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/misc/

Also a git repository is available:

- git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-verb.git

See README file in the tarball for more details about hda-verb
program.


hda-analyzer
~~~~~~~~~~~~
hda-analyzer provides a graphical interface to access the raw HD-audio
control, based on pyGTK2 binding.  It's a more powerful version of
T
Takashi Iwai 已提交
623
hda-verb.  The program gives you an easy-to-use GUI stuff for showing
624 625 626
the widget information and adjusting the amp values, as well as the
proc-compatible output.

627
The hda-analyzer:
628 629 630

- http://git.alsa-project.org/?p=alsa.git;a=tree;f=hda-analyzer

631 632 633
is a part of alsa.git repository in alsa-project.org:

- git://git.alsa-project.org/alsa.git
634

T
Takashi Iwai 已提交
635 636 637 638 639 640 641 642 643 644 645 646 647
Codecgraph
~~~~~~~~~~
Codecgraph is a utility program to generate a graph and visualizes the
codec-node connection of a codec chip.  It's especially useful when
you analyze or debug a codec without a proper datasheet.  The program
parses the given codec proc file and converts to SVG via graphiz
program.

The tarball and GIT trees are found in the web page at:

- http://helllabs.org/codecgraph/


648 649
hda-emu
~~~~~~~
T
Takashi Iwai 已提交
650
hda-emu is an HD-audio emulator.  The main purpose of this program is
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684
to debug an HD-audio codec without the real hardware.  Thus, it
doesn't emulate the behavior with the real audio I/O, but it just
dumps the codec register changes and the ALSA-driver internal changes
at probing and operating the HD-audio driver.

The program requires a codec proc-file to simulate.  Get a proc file
for the target codec beforehand, or pick up an example codec from the
codec proc collections in the tarball.  Then, run the program with the
proc file, and the hda-emu program will start parsing the codec file
and simulates the HD-audio driver:

------------------------------------------------------------------------
  % hda-emu codecs/stac9200-dell-d820-laptop
  # Parsing..
  hda_codec: Unknown model for STAC9200, using BIOS defaults
  hda_codec: pin nid 08 bios pin config 40c003fa
  ....
------------------------------------------------------------------------

The program gives you only a very dumb command-line interface.  You
can get a proc-file dump at the current state, get a list of control
(mixer) elements, set/get the control element value, simulate the PCM
operation, the jack plugging simulation, etc.

The package is found in:

- ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/misc/

A git repository is available:

- git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/hda-emu.git

See README file in the tarball for more details about hda-emu
program.