Commit Graph

221 Commits

Author SHA1 Message Date
kent e893f67fa1 return information about playing buffer, not recording bufer,
for AUDIO_WSEEK.

PR#35171
2007-03-09 13:20:12 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
thorpej ebd626809e TRUE -> true, FALSE -> false 2007-03-01 17:31:35 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad 9db0a17503 Defer wakeup() to the soft interrupt also. 2007-02-15 18:12:05 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
cbiere 293f5e50a2 Set oldpblksize and oldrblksize early enough so that zero-initialisation
isn't necessary. The GCC warning was not a false-positive, AFAICS.
2006-11-01 10:13:37 +00:00
xtraeme 5975efbaee Initialize old[pr]blksize to 0 to avoid gcc warnings. 2006-11-01 09:36:52 +00:00
cbiere 87261698f4 Fix for kern/17446. Restore the audio settings if an error occured. 2006-11-01 06:39:19 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
jmcneill f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
christos ff62f5c658 add missing initializers. 2006-08-27 23:54:50 +00:00
jmcneill 7508425eaa Protect audio_powerhook with '#if NAUDIO > 0'. PR kern/33832. 2006-06-27 02:07:08 +00:00
jmcneill bd22603476 Halt input/output on soft suspend if currently running, and restore them
on soft resume.
2006-06-19 10:19:08 +00:00
kent e47609747e If one or more playback filters are applied, minimize loading
size of the hardware buffer to improve accuracy of AUDIO_GETIOFFS.
2006-05-16 13:46:19 +00:00
kent 6ad20dfc11 Fixes a bug that audio_offset_t::samples for AUDIO_GETxOFFS has
incorrect value.  It also affects SNDCTL_DSP_GETOPTR of
ossaudio.

PR: kern/32405 by Stephane Witzman
2006-05-10 01:56:21 +00:00
jmcneill f77081f364 Don't use simple_locks; we can't hold them while calling malloc and
friends.
2006-04-19 14:10:58 +00:00
jmcneill a46cb959f0 Protect audio_write's filter graph from being modified in the middle of a
write. Fixes the 'audioctl of death' problem (PR#32563).
2006-04-18 19:15:27 +00:00
thorpej 39cd836ee1 Use device_unit(). 2006-03-28 17:38:24 +00:00
jmcneill d2e442a982 Add a 'powerstate' callback to audio_hw_if, to allow hw drivers to power
themselves down when not in use.
2006-03-07 15:17:47 +00:00
rpaulo f714333c4c In mixer_remove() it's better to check if lwp is not NULL before trying
to access a children node of it.

Fixes PR 32823, by Yours Truly. I guess I should read the code before
sending a PR.
2006-02-25 11:32:51 +00:00
perry 93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
ws 9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
is eb4cc6d724 Make sure buffer sizes are initialized correctly even when the pause state
is explicitly set. Without this, the machine would crash in the audio interupt when the driver
needs to divide by the block size (e.g., cs4281.c/cs4280.c).
Idea for the fix by yamt.
2005-06-11 08:14:19 +00:00
augustss 21ef7c17a0 Allow the audio device to be opened for read resp. write by separate calls
to open().  Previously only one call to open() was allowed.
This change should allow some Linux derived programs to work unaltered.

XXX This isn't really possible to implement correctly in a simple way.
So this implementation is incorrect: It is not until device has been closed
by both the reader and writer that it is possible to open it at all again.
2005-05-18 20:10:25 +00:00
augustss 22506e27d1 When audioclose is called it's the last close of the device, so there
is no need to fiddle with resetting individual bits.  Just clear them.
2005-05-04 01:57:23 +00:00
jmcneill b0665daf43 Enable full-duplex mode by default on drivers that support it if the
underlying audio device was opened read/write. This is consistent with
Linux OSS behaviour and fixes a bug with certain applications (including
Skype) that assume this behaviour.

Fixes PR# 30044.
2005-04-25 13:19:46 +00:00
fredb 380c7a5d1e For the "record.port", choose "record.source" over "inputs.source" if the
former exists.  Partial fix for PR kern/29178.
2005-02-13 23:53:20 +00:00
fredb fec463c4fe Comment as to why we run through the devinfo list twice, in audioattach(). 2005-02-13 23:50:22 +00:00
kent 68559dd1d9 fix a typo in audiogetinfo().
No behaviour changes though the code was wrong.
2005-02-13 17:05:15 +00:00
kent 373214b329 * audiosetinfo()
call audio_clear() only when blocksizes are actually changed.
  This fixes a problem on some audio devices and applications which
use ossaudio and call SNDCTL_DSP_GETOSPACE repeatedly while playing.

* audiostartp()
  add some debug prints.
2005-01-29 18:16:49 +00:00
minoura c2a6ed3b7b Fix panic when precision < 8.
From kent@.
2005-01-17 14:13:19 +00:00
kent ba29617639 minor KNF 2005-01-15 16:23:03 +00:00
kent 14eae77d98 fix a typo in audiostartp(). This change fixes a problem introduced by
kent-audio1 merger with some audio hardware such as emuxki.
2005-01-15 04:57:18 +00:00
kent 23b5d91433 merge kent-audio1 branch, which introduces audio filter pipeline to the MI
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
2005-01-10 22:01:36 +00:00
yamt 18f717bb90 constify audio_hw_if, midi_hw_if, and radio_hw_if. 2004-10-29 12:57:15 +00:00
mycroft 77bfa3ce71 If we're short-circuiting audiostartp() because there isn't enough data
present, do an extra wakeup() on the write channel.  This happens when we
change parameters during playback, at which point we flush the buffer, and
would stall.
2004-07-07 22:30:22 +00:00
fredb 7f674884ad Fix a couple of long-standing bugs in the volume control(s) part of the
audio device interface:

1) When attempting to match the appropriate mixer control, we weren't
checking the class label, but only the second level label, so for
devices that had both an "inputs.cd" and a "record.cd", for example,
we could never do the right thing except by chance. For this reason,
evidently, all the record masters were labeled (by the underlying
drivers) either "record.record" or "record.volume", to distinguish
from "outputs.master". We'll now accept "record.master", and document
that as the the new preferred way.

2) More importantly, the model was deficient. Selecting a port on many
chips completely disables most of the level controls, which doesn't play
nice with other applications which are trying to use the interface. Now,
selecting a port simply sets which mixer input control shall be changed,
setting state in the audio layer. In other words, the "mixerout" port
is really selected all the time, enabling the final stage mixer, and
setting "gain" sets the level of the appropriate input. It should be
possible for separate applications to each control the mic, dac, and cd
inputs at the same time using this interface, simply by reiterating their
port selections with each change, but applications that don't bother to
do that aren't any worse off than they were before.

The user is expected to set the master output with another application,
dedicated to that task. Though it is now meaningful to select "no port"
with the audio device interface, to manipulate the master output, there's
no particular reason for an audio device consumer to do that. (I added
the capability in order to restore the initial state of the audio device,
for testing purposes. It might also be useful to users of broken binary-
only applications.)

Observe that the mixer device interface (and so, "mixerctl") still
retains all capabilities, including the ability to set the actual input
port on the chip, overriding the level controls. No change is being made
to the mixer device interface. The mixer device simply presents all the
controls on the chip, with no attempt at abstraction, so there are no
bugs there.

The upshot is, that applications that have been trying to use the audio
device interface to change the volume, such as mplayer, now "just work".

I've tested these changes extensively with "eso" and "eap" since first
proposing them on tech-kern last January, and somewhat with "esm" and a
few others. This closes both PR kern/10221, and PR kern/17159.
2004-01-31 00:07:56 +00:00
mycroft fc3c7930e6 A bit of cleanup:
* Separate the code to set the default parameters into a new function,
  audio_set_defaults().  Make it use audiosetinfo(), which properly initializes
  the block size and whatnot.  Use this in both audioattach() and the
  /dev/audio case of audio_open().
* Do not force a reinitialization when /dev/sound is opened.
* Do all of the block size sanity checks in auto_init_ringbuffer(), not in
  both audio_calc_blksize() and audiosetinfo().
* Fix a bug in audiosetinfo() that caused the block size to not be recalculated
  immediately if we set it to 0.
* For AUDIO_GET[IO]OFFS, modify the deltablks calculation so that it gives us
  the number of block boundaries crossed.
2003-10-02 07:15:20 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
augustss 4cc039d469 Add FIONREAD ioctl(). 2003-05-26 12:43:35 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
gmcgarry 2bdf9ba1f2 Fix full-duplex mode (again).
Back-out revision 1.170 and and 1.166.  Revision 1.170 fixes some problems
introduced in revision 1.166.  It isn't clear what problem revision 1.166
was attempting to address.  It seems bogus anyway, since we later check
the modes in audio_check_params().
2003-04-25 03:02:11 +00:00
wiz 68caa698b2 Respect the law: Use A-law and mu-law as spellings as far as easily possible.
Inspired by Igor Sobrado in PR 19680.
2003-04-06 18:20:07 +00:00
jdolecek cd8e491e95 sprinkle const qualifiers to const stuff 2003-03-31 18:47:58 +00:00
thorpej e354490475 Use aprint_*(). 2003-01-31 02:15:57 +00:00
thorpej 72a7af27b0 Use aprint_normal() in cfprint routines. 2003-01-01 00:10:15 +00:00