VIA8235 + AD1980

Oleg Sharoiko os at rsu.ru
Wed Jun 25 05:56:26 PDT 2003


Hello!

I need some help from sound drivers guru.
I have motherboard with via8235 and ad1980 (ac97 compatible codec from analog
devices) FreeBSD's driver doesn't work correctly with this codec. The problem
is that sound is quiet and it comes out the wrong jack (Mic jack instead of
line out). I spent some time reading AD1980 specification and ALSA sources. I
found a quick solution to this problems. Here is the core of it:

void ad1980_patch(struct ac97_info* codec)
{
        ac97_wrcd(codec, 0x76, ac97_rdcd(codec, 0x76) | 0x0420);
        codec->mix[SOUND_MIXER_VOLUME].reg = AC97_MIXEXT_SURROUND;
}

Here are descritions of bits 0x0400 and 0x0020 from register 0x76 (from ad
spec):

---
0x0020 LOSEL LINE_OUT Amplifiers Input Select. This bit allows the LINE_OUT
output amplifiers to be driven by the mixer or the surround DACs. The main
purpose for this is to allow swapping of the front and surround channels to
make better use of the SURR/HP_OUT output amplifiers. This bit should normally
be used in tandem with the HPSEL bit (see below). 0 = LINE_OUT amplifiers are
driven by the mixer outputs (reset default). 1 = LINE_OUT amplifiers are
driven by the surround DAC outputs.

0x0400 HPSEL Headphone Amplifier Input Select. This bit allows the headphone
power amps to be driven from the surround DACs or from the mixer outputs.
There are two reasons for this: one is to allow 2-channel media to use the
higher power headphone amplifiers available on the SURR/HP_OUT outputs; the
other is to allow spreading of 2-channel media to the surround outputs.
Together with the LOSEL bit (see above), this bit also provides for analog
swapping of the mixer (front) and surround outputs. 0 = SURR_out/HP_out
outputs are driven by the surround DACs (reset default). 1 = SURR_out/HP_out
outputs are driven by the mixer outputs.
---

AC97_MIXEXT_SURROUND is the Surround mixer register.

There is a small problem with this patch: AC97_MIXEXT_SURROUND has seprate
mute bits for right and left channels and I don't see how can they be
implemented in FreeBSD.

I'd like to get to the roots of this problem and this is where I need some
help. If I understood everything correctly than it happens so that the sound
somehow goes to surround dac. The question that I cannot answer: why it goes
to surround dac? Unfortunately I don't have via8235 spec. Myabe data are being
put into wrong timeslots?

-- 
Oleg Sharoiko.
Software and Network Engineer
Computer Center of Rostov State University.


More information about the freebsd-hackers mailing list