Commit Graph

270 Commits

Author SHA1 Message Date
Matthew N. Dodd
f1e875be01 Set a lower bound on fragment size rather than returning a failure
when the user specifies a maximum fragment size < 2.

This is the behavior that Linux provides and fixes the problem I've
observed in Tribes2 where sounds effects are delayed by 1/2 a second.
2003-06-26 13:13:18 +00:00
Orion Hodson
4f3204ef22 Fix lock order reversal when opening device and chn_reset fails.
Submitted by: Jan-Espen Pettersen <sigsegv@leakingmemory.org>
Tested by: Georg Funk <georgfunk@web.de>
2003-05-01 16:31:21 +00:00
John Baldwin
6faa2f6d6e Comment out the mixer entry for igain for the mic 20dB boost for now since
it can cause feedback problems on some laptops.

Reviewed by:	orion
2003-04-23 16:49:53 +00:00
Orion Hodson
61a0da1de5 Add eMicro codec ids. 2003-04-21 04:48:40 +00:00
Orion Hodson
96524a52b6 Use SOUND_MIXER_IGAIN to toggle 20dB mic boost for want of a better
place for it.

Assorted comments.

Submitted by: luigi
2003-04-21 03:47:28 +00:00
Orion Hodson
6635978f23 Additional malloc failure checks. 2003-04-20 17:08:56 +00:00
Orion Hodson
ba548c643a Additional codec ids. 2003-04-04 07:37:25 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Orion Hodson
9963235abc Correct vendor id for ALC101. 2003-03-20 18:17:39 +00:00
Orion Hodson
b2a0f525e6 Correct CS4205 base vendor id.
Reported by:    Christophe Juniet and Mark Santcroos.
2003-03-12 15:11:25 +00:00
Orion Hodson
a7576e2e4b Back out last commit, which is fine in theory, but ignores the fact
that a lock is held whilst the allocations are made (M_WAITOK -> M_NOWAIT).
2003-03-05 14:48:28 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Orion Hodson
19921b23b5 o Move vendor ids into separate table.
o Add assorted vendor and codec ids.
2003-02-28 18:04:52 +00:00
Scott Long
4bc7efe837 Add the ID for the CS4205 codec found in Dell laptops. Obtained from
the CS4205 spec.
2003-02-27 03:51:43 +00:00
Olivier Houchard
7ee68e82e7 Add SigmaTel STAC9750 entry.
Submitted by:	Paulius Bulotas <paulius.bulotas@microlink.lt>
2003-02-26 18:39:04 +00:00
Orion Hodson
a4273e83bc Replicate OSS behaviour when rate settings fails.
PR:	kern/26563
2003-02-26 14:38:19 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Brian Feldman
3fbe138ca9 It seems that sound(4)'s feeder routines don't need to allocate memory
without waiting, since they are called from a system-call context only.
This appears to fix all sorts of problems with open("/dev/dsp", O_WRONLY)
randomly returning ENXIO.

Found by:	cognet
2003-02-23 20:49:45 +00:00
Olivier Houchard
38cc994207 Implement a "sndbuf_getbufaddr" function and use it instead of vtophys().
Reviewed by:	orion
2003-02-20 17:31:12 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Brian Feldman
d00d7d5c39 Sound devices were being leaked by dsp_open() not actually releasing the
channels it allocates if chn_reset() on them resulted in failure.
ARROW'D!
2003-02-11 16:58:54 +00:00
Yoshihiro Takahashi
3febcc57ec - Clean up ISA DMA supports.
- Rename all sndbuf_isadma* functions to sndbuf_dma* and move them into
  sys/dev/sound/isa/sndbuf_dma.c.

No response from:	sound
2003-02-07 14:05:34 +00:00
Orion Hodson
63679b6573 Fix comment typo.
Sync with userland test framework which now deals better with pcm feeder kobj
emulation.

Reduce max rate from 96kHz to 48kHz as userland tests found a few bad
points about 90kHz and we don't care about operating up there for now.
2003-02-06 17:32:02 +00:00
Orion Hodson
faea679930 Avoid zero padding when feeding read channels. chn_rdfeed has no way
of knowing data size transformations of feeder chain and in some cases
this means too much data is pulled through chain, eg converting input
stream from 16bits to 8bits on 16bit only h/w.

PR: kern/37831
Submitted by: Harti Brandt <brandt@fokus.fraunhofer.de>
2003-02-03 15:02:28 +00:00
Orion Hodson
ac224567bf Remove mono encodings from vchan format and mixer description. Fixes
mono formats at 44.1kHz playing at double speed when vchans are
enabled.
2003-02-03 03:20:27 +00:00
Orion Hodson
a825c6e59e Print ac97 name/id on normal boot.
Fix typo reported in pr misc/47794.
2003-02-03 01:38:43 +00:00
Alfred Perlstein
c023201af1 remove MIN now that it's a standard kernel define 2003-02-02 13:21:05 +00:00
Orion Hodson
456922d5f2 o Constrain inputs to 25Hz granularity so interpolator can operate
between any pair of values in range 4-96kHz.  Thanks to Ken Marks for
discovering there were problems with the previous version.

o Use a non-recursive gcd routine.
2003-01-30 16:32:56 +00:00
Orion Hodson
f9eb140935 Add ac97_patch.[ch] that provide space for ac97 codec specific patches. 2003-01-25 16:54:05 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Orion Hodson
4a532ff091 Re-implemention of the interpolation code used for sample rate
conversion.  The new version has improved interpolation accuracy and
maintains the timing relationship between the input and output signals
exactly.

Approved by:	cg
2003-01-20 00:54:24 +00:00
Olivier Houchard
e550089d43 Don't call destroy_dev it a channel has children.
vchan creation doesn't lead to /dev entry creation if the new vchan is the
first child of a channel,
This fix a panic that happens when loading a sound driver module, creating
vchans and unloading the driver.

Approved by:	cg
MFC after:	3 days
2003-01-14 17:13:52 +00:00
Orion Hodson
916aaded05 Add Realtek ALC650 id.
Submitted by:	"Mikko S. Hyvarinen" <morphy@morphy.iki.fi>
MFC after:	5 days
2003-01-13 17:43:49 +00:00
Brian Feldman
a8be3e63ce Fix the duplicate unlock of the pcm read channel in certain cases.
Reviewed by:	cg
2003-01-05 07:32:33 +00:00
Cameron Grant
00acb1337e (hopefully) fix build breakage some people are seeing
Approved by:	re
2002-11-26 18:16:27 +00:00
Cameron Grant
67beb5a5c8 various fixes to eliminate locking warnings
Approved by:	re
Reviewed by:	orion
2002-11-25 17:17:43 +00:00
Olivier Houchard
e33bee0756 Call pcm_chn_destroy() in pcm_killchan() so that channel mutexes are destroyed and struct pcm_channel freed.
Reviewed by:	cg
MFC after:	3 days
2002-11-04 19:12:02 +00:00
Bruce Evans
ab85003bf5 Fixed breakage from removing the used include of <sys/buf.h> in the
previous commit:
Include <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
depending on namespace pollution in <sys/buf.h>.  Only do this in the
__FreeBSD_version > 500000 case although the __FreeBSD_version < 500000
case has already rotted.
2002-09-15 08:21:14 +00:00
Poul-Henning Kamp
296bbb4cfb FreeBSD -current doesn't need <sys/buf.h> or <sys/bio.h>. 2002-09-14 18:58:36 +00:00
Orion Hodson
47d5a0f3e5 Marginally simplify dsp_open error handling by adding an early test to
determine liklihood of opening device in requested directions.  Makes for
simpler error handling and change should close kern/35004.

PR: kern/35004.
2002-08-28 15:19:30 +00:00
Nick Sayer
47172de8a2 Be sure to unregister from sndstat on unregister. Gets rid of phantom
sndstat output after removing uaudio.
2002-08-24 19:13:11 +00:00
Orion Hodson
108082c42e s/AC97_MIX_PHONES/AC97_MIX_AUXOUT/ to match ac97r2.{2,3}.
Attempt to determine what function of AUX_OUT is: "True line level
out", "Headphone out", or "4-Channel out" and frig OSS mixer label
accordingly.

Addresses problem raised by Randy Bush on -multimedia of not being
able to hear audio on ich2 m/b which was eventually found to be
because the mixer monitor value was 0.  On this h/w the label
"monitor" should now be presented as the marginally more intuitive
"ogain".
2002-08-23 06:19:28 +00:00
Archie Cobbs
4a6a94d8d8 Replace (ab)uses of "NULL" where "0" is really meant. 2002-08-22 21:24:01 +00:00
Orion Hodson
2296709020 Back out last commit. Needs slightly more subtle handling. 2002-08-20 08:02:56 +00:00
Orion Hodson
42e67fd3e7 Apply reference counting patch. Fixes problem of two applications
opening the device, eg one read only and one write only, and the
reference count being non-zero when both exit rendering device
permanently busy.

PR:		kern/35004
Submitted by:	Bill Wells
MFC after:	3 days
2002-08-18 14:17:06 +00:00
Brian Feldman
ca33ae2367 Fix some of the places where sound(4) can sleep with a lock held. (Help
courtesy of fenner).
2002-07-25 04:49:45 +00:00
Alexander Kabaev
61698e0ca1 Fix the sound driver vchan support to work when hw.snd.maxautovchans
has been specified through /boot/loader.conf as opposed to setting it
in /etc/sysctl.conf. Only PCMDIR_PLAY channel can be used as a parent
of virtual channel. Do not initialize a new vchan for a given physical
channel if other physical channel already has one created.

PR:	31597
Approved by:	obrien (mentor)
2002-07-23 14:50:51 +00:00
Orion Hodson
7cf0e77a00 Move lock in pcm_chn_add() to after malloc.
PR:             kern/40157
Submitted by:   Dan Lukes <dan@obluda.cz>
2002-07-22 02:38:20 +00:00
Mark Murray
64d85ef750 Use semicolons at the end of function-like macros for the sake of
consistency, style and future cleanliness.
2002-07-15 13:03:10 +00:00
Bruce Evans
e788f79698 Fixed printf format errors which apparently crept in while -Wformat was
disabled for gcc-3.
2002-05-25 11:18:03 +00:00