Attached (perhaps) is the patch file I promised, ohh, probably 3-4
months ago, representing the changes I made to the UCB1400 driver. In
summary, here is what I've changed:
Index: target/device/Gumstix/basix-connex/kernel-patches/series
Added "mixer_oss.patch".
Index: target/device/Gumstix/basix-connex/kernel-patches/mixer_oss.patch
Added support to set and get the "CVOLUME" control. I should
probably get in touch with the OSS maintainer to find out if this
is needed, or even a good idea, but, in the mean time, I use it in
OSS emulation mode to control the "Capture Volume" with aumix.
OSS doesn't have the notion of "+20 dB MIC boost", but it does
have the notion of a capture volume. I use this control to
control that.
Index: target/device/Gumstix/basix-connex/kernel-patches/ucb1400-ac97-audio.patch
This is a patch to a patch file, which makes it strange to read,
but here goes:
a) Added 'AC97_HAS_NO_REC_GAIN' flag to the flags word because,
strangely enough, the UCB1400 can't adjust the recording gain.
The +20 dB MIC boost is handled differently.
b) Added "Capture Source" control
This allows the user to switch between the "MIC" input and the
Line IN inputs. Note that, when the MIC input is selected, it
is selected for both L & R channels. The UCB1400 has a feature
that it can record the MIC on the Left channel and LINE_IN on
the right channel, or duplicate whatever comes in on the left
channel on the right. For ALSA, it might be possible to switch
these independently (in which case, the word "MIC" should be
replaced with "Copy whatever is on the LEFT channel", but only
for the right channel. For now, it seems good enough as it is.
c) Added "Capture Volume" control
This controls the PGA setting for the left & right channel line
in channels. For ALSA, it might be possible to control the
volumes independently. For OSS emulation, they appear to be
linked.
d) Added "Capture Switch" control
This turns on or off the capture device. For the UCB1400, this
disables and enables the "Master Record mute". It might,
possibly, reduce the power consumption when enabled. Through
the OSS emulation layer, setting the "igain" aumix setting to 0
forces this switch to be on.
e) Added "Mic Capture Volume" control
The "Mic Capture Volume" that is in the normal ac97 driver
wiggles a register at offset 0x1e. This register doesn't exist
on the UCB1400. So I wired it to the "MIC Volume" register,
controlling whether the +20 dB boost is enabled or not.
I could have given it a more common name of "Mic Boost
(+20dB)", but the OSS emulation layer uses the "Mic Capture
Volume" control. This gives us the ability to enable or
disable the +20 dB boost from an OSS application such as aumix.
Helpful hint: When staring at the UCB1400 datasheet, and having a
gumstix in front of you:
# grep 1c /proc/asound/UCB1400/codec97\#0/ac97\#0-0\+regs
will tell you what the contents of register 0x1c are
With these changes, I can now run "aumix -q" on my gumstix and see the
following:
# aumix -q
vol 0, 0
bass 0, 0
treble 0, 0
line 100, 100, P
mic 0, 0, R
pcm2 100, 100
igain 0, 0
Previously, I got to see all sorts of things related to video capture,
phone input, phone output, etc... that made no sense to me whatsoever.
I should really go figure out how to put this information in the wiki
(assuming that the patch is applied), but, in the mean time, here is
what I've learned:
vol: this is the master output volume.
bass: this controls the "bass boost" feature of the UCB1400
treble: this controls the "treble boost" feature of the UCB1400
I haven't played with these yet, but from looking at the code, they
should work as advertised.
line: you might be tempted to think that you can control the output
volume with this control, but the output volume is controlled with the
"vol" control. So this really exists just to show whether the LINE or
the MIC inputs are selected for recording. In the case of my
audiostix, the tip of the stereo connector is wired to both the MIC
input and the LINE_IN_L input. The center ring is wired to LINE_IN_R,
and the outermost ring is wired to GND.
mic: This indicates whether the +20 dB boost is enabled for the MIC
input (when it reads 100) or not (when it reads 0). It also indicates
whether the MIC is selected for recording (when there is an "R" after
it) or the LINE inputs are selected for recording (when the "R" is
next to "line").
To select the microphone input for recording using aumix, enter:
# aumix -m R
To select the line input for recording using aumix, enter:
# aumix -l R
pcm2: Unfortunately, this is somewhat of a misnomer, since we don't
have 2 line (or PCM) inputs on this device. This enables (when set to
100) and disables (when set to 0) the headphone driver in the device.
It would appear from the data sheet that the headphone driver must
be enabled in order to enable output from the device, however, I
haven't verified this yet. When it is set to 0, it probably reduces
the power consumption of the UCB1400.
igain: This controls the line input gain. When it is set to zero, it
probably reduces the power consumption of the UCB1400.
Note that all of these controls can be wiggled directly from within
your own C/C++/whatever program via the OSS emulation layer. Also, if
you have enough memory to install the ALSA libraries (I don't) you
should be able to control them via more descriptive names.
I hope this helps someone out there in audiostix land...
--wpd
|