[alsa-devel] Throughts on getting ALC892 working better (was Re: Help With Getting Line-in monitoring working)

Kevin Atkinson kevina at gnu.org
Tue Sep 6 00:45:09 CEST 2011

[I wasn't sure if this post was directed at me or Takashi Iwai.]

I spent several hours going over the data sheet (ver 1.3, you can find it 
or just Google it if you don't already have it) and in particular the 
Block Diagram on page 5.  And, things are finally making sense to me.

Apparently there is no hardware master control and the master and PCM 
slider must be implemented in software.

So, after the change you suggest below the mixer are mapped better in the 
newer drivers.  But things can be still be improved.  More below.

On Mon, 5 Sep 2011, Raymond Yau wrote:

> 2011/9/5 Kevin Atkinson <kevina at gnu.org>:
>> Hi,
>> I need some help getting my cards line-in monitoring working.  That is
>> analog pass-through from line-in to headphone out.
>> I am using Ubuntu 10.04 with Linux kernel Linux Intel 2.6.38-10 (Ubuntu
>> package).  I am using on-board audio with HDA-Intel with the Realtek ALC892
>> codec.
>> With the stock Ubuntu kernel (lets call this setup "stable") I can't get
>> line-in monitoring working (note however I can record from line in, I just
>> can't get the analog pass-through working).  However, when I install the
>> latest ALSA drivers (lets call this setup "soso") (recompiled a source
>> package from the Ubuntu-audio-dev ppa, head 7c48f32b). I can get Line-in
>> monitoring but the mixer controls are all mixed up.  The Line-in control
>> controls the Line-in volume, but the master control has no effect.  Also,
>> the PCM control has no effect on PCM volume and the front control controls
>> the output to the headphone but in order to mute the headphone
>> I still need to use the headphone mute.  The mixer work correctly with the
>> stable setup.
>> Thus I am lead to the conclusion that the latest ALSA drivers are doing
>> something right with line-in but getting a lot of other things wrong.
> connect node 0x1b  HP to 0x02 instead of 0x26, you will unable to use
> the headphone playback volume at 0x25

This doesn't make sense,  I think you meant connect 0x1b to 0x26 like it 
was in the older drivers.  At least for me, my headphone mixer is working 
correctly after making this change (with the newer driver).

> Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
> +  Control: name="Headphone Playback Switch", index=0, device=0
> +    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
>   Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
>   Amp-In vals:  [0x00 0x00]
>   Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
> @@ -436,11 +444,11 @@
>     Conn = 1/8, Color = Green
>     DefAssociation = 0x2, Sequence = 0x0
>   Pin-ctls: 0xc0: OUT HP VREF_HIZ
> -  Unsolicited: tag=00, enabled=0
> +  Unsolicited: tag=04, enabled=1
>   Power states:  D0 D1 D2 D3 EPSS
>   Power: setting=D0, actual=D0
>   Connection: 5
> -     0x0c 0x0d 0x0e 0x0f 0x26*
> +     0x0c* 0x0d 0x0e 0x0f 0x26

Also to get line-in pass-through working via headphone out please unmute 
the second set of Amp-in vals of pin 0x26.

> Node 0x26 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
>  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
>  Amp-In vals:  [0x00 0x00] [0x80 0x80]
                               ^^^^^^^^^^^ set these to 0x00
>  Connection: 2
>     0x25 0x0b

Apparently all analog inputs are mixed together using 0x0B and then the 
output is sent to a bunch of other audio mixers, but these mixers don't 
really control the volume, they just have a separate mute for the PCM and 
analog input.  That being said, it probably also makes sense to mute 
analog audio (coming from 0x0B) on all but pins 0x26 (headphone) and 0x0C 
(front) by default.

The fact that the master (or individual output controls for that matter) 
doesn't control the analog pass-through volume is unfortunate, but I can 
live with.  At least with the newer drivers the mute also mute the analog 
pass-through which was not the case with the old drivers.

Speaking of mixer settings, for pins that are configured to output and 
have the "HP" capacity, please expose this widget control somehow on the 
mixer.  I am not sure I would call it call it an amp toggle because what 
it really does is switch between line-out and headphone-out.  This is 
important because when I first tried the card I wasn't sure what the 
front Headphone out and the back Front out where configured as (I knew 
they could be both from the motherboard manual).  A switch will give me 
confidence that they are configured correctly.  In addition, this is 
something users should be able to control without having to know the 
intricacies of the Intel HDA spec and using hda-analyze.

On a lesser note the mixer settings for recording are really don't really 
correspond to how to hardware is set up.  According to the diagram there are 
two separate PCM recorders and each of them can take input from the analog 
mixer (0x0B) or they can bypass the mixer by unmuting any of the analog 
inputs (controlled by mixer 22h and 23h), then after that there is another 
volume control which controls the combined input (0x09 0x08).

The current mixer only allows one to select source for each PCM recorders 
and does not give the option to use the analog mixer (0x0B) which might 
make sense if you want to record from two mics.

On an even lesser note, it would be really nice if ALSA could expose the 
full capacity of the hardware without having an unwieldy number of mixer 
controls.  For example each of the 5 output mixers have a separate PCM and 
analog pass-though mute control, it would be nice to expose this.  Also, 
each of the 8 analog pins can be repurposed as either input or output, 
some of them have a headphone amp, some of them have a mic boost, it would 
be nice if all this could all be exposed.  However, I can see how exposing 
all this will lead to a lot of confusing mixer settings.

Short of that, it would be nice if it would be possible to reconfigure 
mixer hookups and add new mixers.  For example if I repurpose the one of 
the output pins for an additional line-in it would like to be able to 
control the volume for it and select it for recording.  I can see how to 
reconfigure the HDA-Intel setting via /sys/class/sound but I can not see 
how to control the mixer configuration.  In can reconfigure the card using 
hda_analyzer but it is very non-obvious how to get the codec to 
re-configuration based on those settings (and possible expose some 
additional mixer settings, if say one of the output pins becomes an input 
pin).  Nor is it obvious how to make those settings persistent.  An option 
for hda_analyzer to expose the difference in a way that can be used by 
/sys/class/sound and/or via the Early Patching option would be helpful.

More information about the Alsa-devel mailing list