freebsd-nq/sys/dev/sound
Alexander Motin 3d741b14a7 Complete rewrite of the snd_hda(4) volume control.
Previous code was relatively dumb. During CODEC probe it was tracing signals
and statically binding amplifier controls to the OSS mixer controls. To set
volume it just set all bound amplifier controls proportionally to mixer
level, not looking on their hierarchy and amplification levels/offsets.

New code is much smarter. It also traces signals during probe, but mostly
to find out possible amplification control rages in dB for each specific
signal. To set volume it retraces each affected signal again and sets
amplifiers controls recursively to reach desired amplification level in dB.
It would be nice to export values in dB to user, but unluckily our OSS mixer
API is too simple for that.

As result of this change:
 - cascaded amplifiers will work together to reach maximal precision.
If some input has 0/+40dB preamplifier with 10dB step and -10/+10dB mixer
with 1dB step after it, new code will use both to provide 0/+40dB control
with 1dB step! We could even get -10/+50dB range there, but that is
intentionally blocked for now.
 - different channels of multichannel associations on non-uniform CODECs
such as VIA VT1708S will have the same volume, not looking that control
ranges are different. It was not good when fronts were 12dB louder.
 - for multiplexed recording, when we can record from only one source at
a time, we can now use recording amplifier controls to set different
volume levels for different inputs if they have no own controls of they
are less precise. If recording source change, amplifiers will be
reconfigured.

To improve out-of-the-box behavior, ignore default volume levels set by
sound(4) and use own, more reasonable: +20dB for mics, -10dB for analog
output volume and 0dB for the rest of controls. sound(4) defaults of 75%
mean absolutely random things for different controls of different CODECs
because of very different control ranges.
Together with further planned automatic recording source selection this
should allow users to get fine playback and recording without touching
mixer first.
Note that existing users should delete /var/db/mixer*-state and reboot
or trigger CODEC reconfiguration to get new default values.

MFC after:	2 months
Sponsored by:	iXsystems, Inc.
2012-01-22 10:24:12 +00:00
..
isa - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
macio Do not attach to the sound device on G5 Xserves, which is actually an 2011-06-26 00:35:11 +00:00
midi Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs. 2011-11-07 15:43:11 +00:00
pci Complete rewrite of the snd_hda(4) volume control. 2012-01-22 10:24:12 +00:00
pcm Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
sbus Fix typos. 2010-11-09 10:59:09 +00:00
usb Use usbd_transfer_unsetup() instead of usbd_transfer_stop() so that 2011-12-14 01:03:07 +00:00
chip.h
clone.c
clone.h
driver.c
unit.c
unit.h
version.h