audio framework
Summary of changes:
* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.
* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t
* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.
* add `struct device *' parameter to ac97_attach()
* all of audio HW drivers follow audio_hw_if and ac97 changes
bus-independent backend, with PCI and CardBus attachment code.
The committed code has two serious bugs:
1. The driver makes no attempt to recover resources when a (Cardbus)
instance is removed; bus resources are leaked.
2. In testing with a NetGear GA-511, the Cardbus card never responded
to a reset/wakeup if the card is powered down after attachment.
So for now, leave cardbus instances powered up at attachment
(insertion, or at boot if a card is already present).
That aside, it acutally works on my GA-511. Committed as-is despite
the bugs, after repeated requests to make the code available for
further testing. Also requires sys/dev/mii/miidevs rev 1.54 -> 1.55,
and consequent regen of miidevs{,_data}.h.
in the wanted bus_dma space. If an allocation fails during operation
(i.e. when hotplugging an umass device), fall back to using the reserve.
The amount can be configured as USB_MEM_RESERVE. The default value is
256k.
Ideally, there would be a way to steal pages in the desired area from
UVM, but that's far more complicated, and this is not intrusive, plus
it works.
attach time the way Linux does it. Reported and tested by Jonathan
Schleifer, I checked it didn't break my own 7012 device which doesn't need
that manipulation.
reviewed by christos@, cube@ and martin@.
While here, remove a printf() in mpu_attach() (ic/mpu.c) to remove
an empty line in some frontends (mpu_isa.c, etc).
attempt to map the I/O BAR if it is 0. This will have the side-effect
of causing the wm_reset() routine to fall back to memory BAR accesses
for those chips on which it would attempt I/O BAR accesses for the reset.
Also update the comments about why we attempt the I/O BAR accesses for
the reset in favor of the memory BAR accesses.
make sure that the pullup was done into trailing space at the end of
the existing first-mbuf-in-chain. If not, log an error and drop the
packet, because the mbuf chain no longer corresponds to the DMA map,
and we are already committed to transmitting the packet.
* Encapsulate all the ring-specific variables into a substructure. (This will
help with some potential code sharing.)
* Don't bother with "last buffer complete" interrupts -- we should be taking an
interrupt anyway because we set IOC on every buffer.
* Likewise, ignore CELV; it's meaningless to us.
* Get rid of the FIFO error counters, since this doesn't actually happen any
more.
Also, allow any sample rate between 8000 and 48000Hz. (This range should
probably be larger, but this is what's known to work.)
Another 180 bytes shaved.
was causing some "fifo under/overrun" errors during the initial trigger.
Also fixes a ring synchronization problem introduced in the earlier changes.
This should completely fix the FIFO errors with auich.
1) Update the queue pointers any time we get a block completion interrupt,
not just when we hit the last block.
2) Set the "back-to-back enable" bit.
In addition:
3) Make sure we ack every block we transfer; there was a bug that could cause
the audio layer to get out of sync.
some special cases for the PCI-Express versions. As there is no
documentation available, all of this is inspired from Linux or taken from
FreeBSD (itself inspired from Linux). There are a lot of magic numbers.
Tested on two BCM5751 devices as found in newer Dell computers.
It is needed because automatic calibration by auich_calibrate() is not
so precise.
- Why not ioctl?
It is not good idea to add a new ioctl operation to MI audio for
a specific audio device.
- Why not mixerctl item?
AC'97 linke rate is not related to audio mixing.
This controller is integrated in some ALi Southbridges.
XXX This driver is incomplete and slightly buggy, but it
works enough to enable me to listen to music on my Sharp MM20.
- Change the Tx:Rx on-chip RAM allocation ratio based on MTU:
=> 82547: > 8192 18K:22K, else 10K:30K
=> others: > 8192 24K:40K, else 16K:48K
Values derived from Linux driver.
- On the 82547, keep track of how much of the Tx FIFO has been used.
When in half-duplex mode, don't let packets wrap around the FIFO ring
buffer, because that causes the chip to croak. Detect this, stall the
Tx queue, use a timer to wait for the packets to drain from the Tx FIFO,
reset the internal FIFO pointers, and restart the Tx queue. Basic
algorithm (and some magic numbers) derived from FreeBSD and Linux drivers.
Fix tx queue (slist can be corrupted when tx interrupts hit within tx_encap.
Lower interrupt moderation timer to (improves performance).
Improve chip identification. (from linux sk98lin driver).
Keep tx queue running by kicking the tx bmu repeatedly.