Subject: Re: ICH5 mixer issue, kern/20368 and kern/22548
To: TAMURA Kent <kent@netbsd.org>
From: None <cube@cubidou.net>
List: tech-kern
Date: 09/08/2003 17:54:21
On Tue, Sep 09, 2003 at 12:09:17AM +0900, TAMURA Kent wrote:
> 
> In message "ICH5 mixer issue, kern/20368 and kern/22548"
> > First of all, kern/20368 is wrong, although the fix does the right thing
> > in the end. The main reason for that is that the codec listing is
> > erroneous: ADS 0x70 is ad1980, not ad1981. Thus the register names are
> > different. In the meantime, that codec should be probed as:
> 
> Ok, I have fixed this.

Thanks!

> > The effect of kern/20368 is to have the headphone controlled by the
> > surround register, and the line-out controlled by the main mixer, thus
> > inverting the use of the two registers, creating the behaviour described
> > in kern/22548.
> 
> I have questions to understand the behavior of AD1980.  When you
> play stereo audio data, do you have the audio output via the
> line-out with kern/20368, and via the headphone without
> kern/20368?  How does outputs.headphones work, and how about
> setting AD1980_MISC_SPRD?

If I understood correctly (and that's a big if), there are several issues.

First, outputs.headphones is inactive (FreeBSD has code to detect this. It
consists in reading 0x0 instead of 0x8000).

Then, the chip is incorrectly wired on most (some? i heven't seen any
report of a correct behaviour in my googlings) boards and the two outputs
are swapped.

I may be confused about the names of the ouputs and the names of the
controls, but according to documentation of AD1980, setting HPSEL and
LOSEL to 1 effectively swap surround and front outputs, allowing the user
to use the normal jack plug to get sound.

But HPSEL and LOSEL being set to one also swap the meaning of the mixer
control registers MASTER and SURR. Thus we have to either rename the
controls names, or swap the register they're operating on.

I might not be clear, and I admit I don't fully understand the issue and
didn't try all bit combinations for LOSEL/HPSEL. But at least that's
what it looks like it is happening.

I'll make a test later, consisting in removing all the quirks and init
stuff, and detecting which mixer control operates on master. The flaw in
my reasoning is that if we don't do anything, all should be ok except
for the jack to plug the headphones in, and I'm not sure whether it is
the case. (That's indeed what happens in the [unaware] Linux kernels I
quickly patched [blindly adding the ICH5 IDs to the list in i810_audio]
for my co-workers, though.)

FreeBSD folks made an attempt at the register swapping quirk, but loosely
so they backed it out.

Anyway, to have a fully working setup (as in, using correct output and
mixerctl behaving as expected), we need the register swapping trick.

SPRD does a lot more than HPSEL/LOSEL, I think it will introduce other
misbehaviours from mixerctl.

Also, what do we do with the inactive AC97_REG_HEADPHONE_VOLUME register?

Quentin Garnier.