Commit Graph

537 Commits

Author SHA1 Message Date
jhb
db9aa81e23 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
jhb
e41b9c8bc9 Add lock type arguments to callers of snd_mtxcreate(). 2002-04-04 20:56:47 +00:00
jhb
5c3c6df21b Change snd_mtxcreate() to accept a lock type as an extra argument that is
passed to mtx_init().
2002-04-04 20:54:27 +00:00
mike
582c3c2fe1 Include <machine/limits.h> for definition of ULONG_MAX. Remove a
duplicate include.
2002-03-25 09:23:41 +00:00
alfred
2c16fbdd2a Fixes to make select/poll mpsafe.
Problem:
  selwakeup required calling pfind which would cause lock order
  reversals with the allproc_lock and the per-process filedesc lock.
Solution:
  Instead of recording the pid of the select()'ing process into the
  selinfo structure, actually record a pointer to the thread.  To
  avoid dereferencing a bad address all the selinfo structures that
  are in use by a thread are kept in a list hung off the thread
  (protected by sellock).  When a selwakeup occurs the selinfo is
  removed from that threads list, it is also removed on the way out
  of select or poll where the thread will traverse its list removing
  all the selinfos from its own list.

Problem:
  Previously the PROC_LOCK was used to provide the mutual exclusion
  needed to ensure proper locking, this couldn't work because there
  was a single condvar used for select and poll and condvars can
  only be used with a single mutex.
Solution:
  Introduce a global mutex 'sellock' which is used to provide mutual
  exclusion when recording events to wait on as well as performing
  notification when an event occurs.

Interesting note:
  schedlock is required to manipulate the per-thread TDF_SELECT
  flag, however if given its own field it would not need schedlock,
  also because TDF_SELECT is only manipulated under sellock one
  doesn't actually use schedlock for syncronization, only to protect
  against corruption.

Proc locks are no longer used in select/poll.

Portions contributed by: davidc
2002-03-14 01:32:30 +00:00
tanimura
53021e2926 Do not call a synthesizer with a sequencer lock held. 2002-03-10 16:56:38 +00:00
orion
0c45c5a171 Suspend and resume related patches from Toshikazu Ichinoseki <t.ichinoseki@nifty.com>.
PR's: kern/35484, kern/35230.
2002-03-04 00:36:04 +00:00
orion
7cc2d2db68 Add support for VT8233. 2002-03-01 20:30:13 +00:00
des
01635cd066 Add a sysctl, sysctl hw.snd.report_soft_formats, that controls whether the
AIOGCAP ioctl reports software-emulated formats.  It defaults to on.  People
who use performance-sensitive audio software and do not want it to pick a
software-emulated audio format instead of one supported by their hardware
should turn it off.

This unbreaks isdnphone(1) on systems with PCM-only sound cards.

Approved by:	cg
2002-02-24 00:49:43 +00:00
alfred
ff615f0a6d Add play (but not record) support for the Sis 7012.
Submitted by: Mike Meyer <mwm@mired.org>
2002-02-19 00:59:23 +00:00
tg
7d6571799b Add support for the Aztech 2320 chip.
Reviewed by:	cg
Obtained from:	NetBSD (partly)
2002-02-05 12:09:23 +00:00
tanimura
df91bf49f0 - Do not hang if the resource allocation fails.
- Add another quirk entry of SB AWE64.

PR:		kern/32530
Submitted by:	Magnus Backstrom <b@etek.chalmers.se>
2002-02-05 06:52:56 +00:00
scottl
336ec4d2e7 Recent changes to newpcm require that the CHANNEL_SETFORMAT op return 0
for success, non-zero otherwise.  The maestro and maestro3 drivers were
returning the format code, which was being interpreted as a failure code.
Fixed.  No one seems to have noticed that the maestro driver was broken,
but I'll fix it anyways.

MFC after:	2 weeks
2002-01-27 23:09:41 +00:00
cg
7119c58487 * improve error handling
* be more specific in verbose boot messages
* allow the feeder subsystem to veto pcm* attaching if there is an error
  initialising the root feeder
* don't free/malloc a new tmpbuf when resizing a snd_dbuf to the same size as
  it currently is
* store the feeder description in the feeder structure instead of mallocing
  space for it
2002-01-26 22:13:24 +00:00
scottl
96d2f68a83 Fix code that had rotted behind debugging macros.
Approved by:	cg (in principle)
MFC after:	2 weeks
2002-01-25 04:14:12 +00:00
cg
ba4ccad7af a buffer offset equal to the buffer size is illegal too, fix assertion in
sndbuf_getbufofs()
2002-01-25 02:39:34 +00:00
cg
c7b097b846 cosmetic change, free b instead of c->bufhard for consistency within
chn_kill()
2002-01-25 02:36:22 +00:00
cg
e75ea781e8 improve sndstat output of feederchains so it can be understood without
reading the feeder sourcecode
2002-01-23 06:02:15 +00:00
cg
cf26ea42fd print warnings if a pcm*.buffersize hint is out of range or a non-power-of-2 2002-01-23 05:49:41 +00:00
cg
90da3073ce fix some comments accidentally hit by search/replace several revisions ago 2002-01-23 05:41:35 +00:00
cg
f83c1aa29b set the speeds the right way round for recording using the rate feeder 2002-01-23 05:35:12 +00:00
cg
505a32c5da add more error checking in chn_init() and chn_reset() 2002-01-23 05:21:27 +00:00
cg
3b2958fa78 make the feederchain builder work for recording. this has not been tested
extensively as none of my testboxes have speakers or an audio source at
present, but the chains built look correct and reading /dev/audio (ulaw,
translated from signed 16 bit little-endian) gives values within the
expected range for silence.
2002-01-23 05:10:56 +00:00
cg
29512efb54 don't bother checking if an unsigned parameter is less than 0 in a KASSERT 2002-01-23 04:50:51 +00:00
cg
a9336f5354 add more error checking to open of /dev/dsp* and /dev/audio* - if the
default format for the chosen subdevice cannot be obtained return an error
instead of returning success with an indeteterminate format selected.

note that this should never happen once the feederchain builder works for
recording.
2002-01-23 04:44:03 +00:00
cg
b75a033f75 don't allow mmap beyond the end of the buffer
Submitted by:	Philippe Anel <philippe.anel@noos.fr> (partially)
2002-01-23 04:32:18 +00:00
orion
98cc9db9b5 Change ich_calibrate to busy wait on buffer fill level and use a more
likely looking rate calculation.

Install interrupt handler before calling ich_init as the initialization
occasionally generates spurious interrupts.

These changes are derived from cg's work in progress version of this
driver.
2002-01-18 18:44:41 +00:00
tanimura
c7b71266e6 Add the system default timer engine. 2002-01-04 01:16:18 +00:00
tanimura
c9a37a6cea - Provide toggles to show debug messages. Set new sysctl variables
hw.midi.debug and hw.midi.seq.debug to 1 to enable debug log.

- Make debug messages human-frendly.

- Implement /dev/music.

- Add a timer engine required by /dev/music.

- Fix nonblocking I/O.

- Fix the numbering of midi and synth devices.
2002-01-04 01:13:49 +00:00
tanimura
a46d1d7f89 - Do not uiomove with a mutex locked.
- Move from msleep/wakeup to condvar.

- Return either zero or a positive errno value from a function.
  Return additional result via references.

- Unify the typedef of callback functions.
2002-01-01 17:36:26 +00:00
cg
00857bfbaf make mmapped vchans work 2001-12-23 13:10:29 +00:00
pb
3d484db474 Fixes apparent hang at probe time due to an extremely long timeout
(experienced with an Opti931/ISA PnP card).

Approved by:	cg
2001-12-21 23:26:55 +00:00
cg
84081fd046 fix mmapped playback
remove dead debugging code
2001-12-21 22:34:01 +00:00
orion
748fd60224 Save and restore state for suspend/resume.
PR:		kern/28692
Obtained from:	SAKIYAMA Nobuo <sakichan@sakichan.org>
2001-12-21 19:20:28 +00:00
orion
3e097bafba Correct unexpected interrupt detection. 2001-12-19 18:26:53 +00:00
orion
3d7b11bb97 Nitlets. 2001-12-19 18:04:04 +00:00
orion
308c6566ff Clear resume interrupts - these can occur during initialization and
must be cleared to prevent machine hanging (presently aflicts -current
and -stable).

Problem reported by Bruce Montague <brucem@cse.iitkgp.ernet.in>

PR:		kern/29769 (probably)
2001-12-19 17:38:38 +00:00
orion
96b6116d6e Add calibration test to determine extent of AC97 overclocking (if any). 2001-12-18 03:29:31 +00:00
jhb
a3b98398cb Modify the critical section API as follows:
- The MD functions critical_enter/exit are renamed to start with a cpu_
  prefix.
- MI wrapper functions critical_enter/exit maintain a per-thread nesting
  count and a per-thread critical section saved state set when entering
  a critical section while at nesting level 0 and restored when exiting
  to nesting level 0.  This moves the saved state out of spin mutexes so
  that interlocking spin mutexes works properly.
- Most low-level MD code that used critical_enter/exit now use
  cpu_critical_enter/exit.  MI code such as device drivers and spin
  mutexes use the MI wrappers.  Note that since the MI wrappers store
  the state in the current thread, they do not have any return values or
  arguments.
- mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is
  assigned to curthread->td_savecrit during fork_exit().

Tested on:	i386, alpha
2001-12-18 00:27:18 +00:00
orion
9b9b8305c7 Added a sysctl control variable "ac97rate" to allow manual tuning of
the link rate - some ich motherboards overclock ac97 out of the box.

Will hopefully replace this with a callibration loop in time for 4.5R
freeze.

Problem reported by Luigi Rizzo and fix derived from his code (put
diff in ich.c rather than ac97.c).

MFC after:	3 days
2001-12-17 01:57:42 +00:00
orion
1ce1fbf5b8 Addition of sysctl variable to enable spdif. By default spdif is disabled.
MFC after:	3 days
2001-12-17 01:39:36 +00:00
guido
aebaef0c19 Get rid of irritating (bogus) message:
pcm0: ac97 codec failed to reset extended mode (0, got 80)
This was due to not masking off the correct extended function bits
in the read value from the extended status reg.

MFC after:	2 days
2001-12-10 20:27:18 +00:00
obrien
7fd9a6a23a Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
guido
19c1d909f1 Fix resume for HP Omnibook 500's.
MFC after:	1 week
2001-12-05 10:36:32 +00:00
iwasaki
560d91adcd Add suspend/resume support.
MFC after:	1 week
2001-11-24 18:00:33 +00:00
orion
9c629e4ed0 Fix typo introduced with last commit. 2001-11-22 23:38:26 +00:00
orion
724cc16dd3 Correct extmode initialization.
MFC after:	3
2001-11-21 04:26:04 +00:00
orion
2bfeee833a Emit a warning if invalid mode passed to ac97_setextmode.
MFC after:	3 days
2001-11-21 04:08:10 +00:00
orion
dc35e47b82 Set extmode according to extcaps. Fixes codec sample rate failures
that causes noisy playback with rates other than 48k (reported by
Olexander Kunytsa).

MFC after:	3 days
2001-11-21 04:06:52 +00:00
asmodai
fa6dc65332 Remove clkrun_hack for ThinkPad 570.
PR:		28031
Submitted by:	Tan Koan-Sin <freedom@csie.nctu.edu.tw>
MFC after:	2 weeks
2001-11-15 18:51:08 +00:00