Commit Graph

104 Commits

Author SHA1 Message Date
Alexander Leidinger
f31eef8b22 Fix memory leak in some failure cases.
CID:		420
Found with:	Coverity Prevent(tm)
2006-02-05 17:10:52 +00:00
Ariff Abdullah
238c5dc5c3 Fix kernel panic caused by double mss_unlock().
Noticed by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-11-07 09:25:15 +00:00
Yoshihiro Takahashi
8621e8a737 more #ifndef PC98. This really fix the pc98 tinderbox. 2005-09-12 13:40:10 +00:00
Warner Losh
d78baf42dc Since opti_detect is now only called on !PC98 machines, only declare
and define there as well.  This should fix the pc98 tinderbox.
2005-09-12 04:12:50 +00:00
Alexander Leidinger
70001ecea2 Add some ad_wait_init() calls to fix some problems in some configs (e.g.
PC98, CS4231A, "pcm0: play interrupt timeout").

PR:		45682
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 13:59:02 +00:00
Alexander Leidinger
3159d831fc Allow to record non 8bit-mono formats even in half-duplex configurations.
PR:		45679
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 13:49:24 +00:00
Alexander Leidinger
6643b656bb Fix misdetection of the sound chip on PC98 systems. The submitter doesn't
believe that there are PC98 systems with an OPTi chip.

I don't know enough about this special PC architecture to be sure about
this, so let's find out by letting people with such a system complain in
case this commit breaks the sound system for them. It's easy to revert
then.

PR:		45673
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 10:07:12 +00:00
Alexander Leidinger
7a7689dea4 - Fixup the locking.
- Don't mark MPSAFE (yet).

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:51:04 +00:00
John Baldwin
dfa9ef3d99 Don't attach the non-PnP mss pcm(4) driver to acpi busses as ACPI only
enumerates PnP ISA-like devices.

Reported by:	Harry Coin harrycoin at qconline dot com
MFC after:	3 days
2005-07-13 15:17:54 +00:00
Matthew N. Dodd
c58d5e62ad Use mss_{format,speed}() rather than chn_set{format,speed}() and hold
mss lock across call.

This allows my Thinkpad 600E to resume with the sound driver loaded and
vchans enabled.
2005-02-27 23:32:21 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Nate Lawson
ecb7c87d1c Re-add an acpi attachment for the legacy probe that was inadvertently
removed.
2004-10-15 05:13:25 +00:00
Pyun YongHyeon
eba1cb6e3e Audio drivers failed to detect failure condition and attempted to
assign DMA address to the wrong address. It can cause system lockup
or other mysterious errors. Since most sound cards requires low DMA
address(BUS_SPACE_MAXADDR_24BIT) sndbuf_alloc() would fail when the
audio driver is loaded after long running of operations.

Approved by:	jake (mentor)
Reviewed by:	truckman, matk
2004-10-13 05:45:16 +00:00
Nate Lawson
4a25d7ffe2 * Remove the acpi attachment from the es1888. It has an identify method
that conjures up the device node so it isn't true PNP.  Noticed by jhb@.

* Add an attachment for esscontrol since it too uses ISA_PNP_PROBE.

* Move an attachment from snd_mss to snd_pnpmss.  The latter is the real
  PNP user.
2004-10-12 01:56:03 +00:00
Seigo Tanimura
0739ea1de2 Rename the sound device drivers:
- `sound'
  The generic sound driver, always required.

- `snd_*'
  Device-dependent drivers, named after the sound module names.
  Configure accordingly to your hardware.

In addition, rename the `snd_pcm' module to `sound' in order to sync
with the driver names.

Suggested by:	cg
2004-07-16 04:00:08 +00:00
Marcel Moolenaar
23decc8a2f s/DDB/BVDDB/g
Note that DDB is unrelated to the debugger with the same acronym.
2004-07-10 21:12:27 +00:00
Brian Feldman
8fb9a995cf The newpcm headers currently #define away INTR_MPSAFE and INTR_TYPE_AV
because they bogusly check for defined(INTR_MPSAFE) -- something which
never was a #define.  Correct the definitions.

This make INTR_TYPE_AV finally get used instead of the lower-priority
INTR_TYPE_TTY, so it's quite possible some improvement will be had
on sound driver performance.  It would also make all the drivers
marked INTR_MPSAFE actually run without Giant (which does seem to
work for me), but:
	INTR_MPSAFE HAS BEEN REMOVED FROM EVERY SOUND DRIVER!
It needs to be re-added on a case-by-case basis since there is no one
who will vouch for which sound drivers, if any, willy actually operate
correctly without Giant, since there hasn't been testing because of
this bug disabling INTR_MPSAFE.

Found by:	"Yuriy Tsibizov" <Yuriy.Tsibizov@gfk.ru>
2004-04-14 14:57:49 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Cameron Grant
3f22597838 update my email address. 2003-09-07 16:28:03 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +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
Matthew N. Dodd
6dc61b5ae5 - GC a few more hand-rolled 'abs' macros.
- GC a few hand-rolled min()/max() macros while I'm here.
2003-01-15 02:15:57 +00:00
Matthew N. Dodd
dd815daba5 - Add acpi module binding.
- Restore speed and format settings on resume for CS423x and
  CS423x-PCI devices.
2003-01-08 06:24:25 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Semen Ustimenko
83190e29d3 Do not return(foo()) in void function.
Submitted by:	marius@alchemy.franken.de
MFC after:	3 days
2002-12-18 22:53:24 +00:00
Cameron Grant
00acb1337e (hopefully) fix build breakage some people are seeing
Approved by:	re
2002-11-26 18:16:27 +00:00
John Baldwin
489c22ebb8 Add lock type arguments to callers of snd_mtxcreate(). 2002-04-04 20:56:47 +00:00
Thomas Gellekum
cc9f4eb939 Add support for the Aztech 2320 chip.
Reviewed by:	cg
Obtained from:	NetBSD (partly)
2002-02-05 12:09:23 +00:00
Pierre Beyssac
5a8c4e90b9 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
Cameron Grant
11149a9ac8 release isa dma channels on unload. 2001-09-29 08:01:42 +00:00
Cameron Grant
374e1c5baa allow the hardware buffer size to be controlled with hints
release isa dma channels on unload (ad1816, ess, sb8)
2001-09-29 07:57:07 +00:00
Cameron Grant
a6295c60ae when setting blocksize, fix blockcount to 2 to reduce latency with smaller
block sizes.
2001-09-18 15:19:44 +00:00
Cameron Grant
c2995ba2d4 make buffer size adjustable. 2001-09-18 15:12:35 +00:00
Cameron Grant
67b1dce3bc many changes:
* add new channels to the end of the list so channels used in order of
addition

* de-globalise definition of struct snddev_info and provide accessor
functions where necessary.

* move the $FreeBSD$ tag in each .c file into a macro and allow the
/dev/sndstat handler to display these when set to maximum verbosity to aid
debugging.

* allow each device to register its own sndstat handler to reduce the amount
of groping sndstat must do in foreign structs.
2001-08-23 11:30:52 +00:00
George C A Reid
733a4ea771 Use the M_ZERO flag to malloc(9)
Reviewed by:	cg
MFC after:	1 week
2001-06-21 19:45:59 +00:00
Cameron Grant
d95502a838 use a global devclass for all drivers - i'm not entirely sure why this
worked before.

mixer, dsp and sndstat are seperate devices - give them their own cdevsws
instead of demuxing requests sent to a single cdevsw.

use the si_drv1/si_drv2 fields in dev_t structures for holding information
specific to an open instance of mixer/dsp.

nuke /dev/{dsp,dspW,audio}[0-9]* links - this functionality is now provided
using cloning.

various locking fixes.
2001-06-16 21:25:10 +00:00
George C A Reid
94d79d6dea Remove a bogus comment which I forgot to get rid of after testing 2001-05-15 20:05:19 +00:00
Cameron Grant
35910bd13e release resources if one of the speculative probes in opti_detect() fails,
otherwise resource_list_alloc panics when opti_detect tries its next probe.
2001-03-25 19:09:06 +00:00
Cameron Grant
4e5f69d4dd the softc is not a mutex, don't try to lock it.
Submitted by:		George Reid <greid@ukug.uk.freebsd.org>
2001-03-25 18:56:48 +00:00
Cameron Grant
66ef8af5b0 mega-commit.
this introduces a new buffering mechanism which results in dramatic
simplification of the channel manager.

as several structures have changed, we take the opportunity to move their
definitions into the source files where they are used, make them private and
de-typedef them.

the sound drivers are updated to use snd_setup_intr instead of
bus_setup_intr, and to comply with the de-typedefed structures.

the ac97, mixer and channel layers have been updated with finegrained
locking, as have some drivers- not all though.  the rest will follow soon.
2001-03-24 23:10:29 +00:00
Cameron Grant
64738af72b add support for opti924 and opti930 chips
both should work in non-pnp mode, the 924 should also work in its rather
braindead pnp mode- it will adopt port 0x530 unless given hints due to it
starting up in soundblaster mode and thus not requesting a valid mss port
address.

Submitted by:	George Reid <greid@ukug.uk.freebsd.org>
2001-03-24 00:22:01 +00:00
Cameron Grant
86c1b69bbb increase timeouts for ad_wait_init() 2001-03-05 17:59:36 +00:00
Cameron Grant
350a5fafb1 update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use.  it will aim for a power of two size small
enough to generate block sizes of at most 20ms.  it will also set the
hard-blocksize taking into account rate/format conversions in use.

update drivers to implement setblocksize  correctly:
updated, tested: 	sb16, emu10k1, maestro, solo
updated, untested: 	ad1816, ess, mss, sb8, csa
not updated: 		ds1, es137x, fm801, neomagic, t4dwave, via82c686

i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
2000-12-23 03:16:13 +00:00
Cameron Grant
0f55ac6c1a kobjify.
this gives us several benefits, including:

* easier extensibility- new optional methods can be added to
  ac97/mixer/channel classes without having to fixup every driver.

* forward compatibility for drivers, provided no new mandatory methods are
  added.
2000-12-18 01:36:41 +00:00
Cameron Grant
9ec437a334 add reinit functions to mixers
unstaticize chn_start()
add reset/resetdone functions to channels
2000-10-26 20:46:58 +00:00
Maxim Sobolev
6e3c38712b Reduce buffer size from 64K to 4K.
Approved by:	cg
2000-10-09 14:54:32 +00:00
Cameron Grant
306f91b60b detach support
remove un-needed setdir functions
add bus_teardown_intr calls where necessary
destroy our dma tags where necessary
destroy ac97 before releasing resources
2000-09-09 19:21:04 +00:00
Cameron Grant
33dbf14a17 change mixer api slightly
change channel interface - kobj implementation coming soonish
make pcm_makelinks not panic if modular
add pcm_unregister()

these changes support newpcm kld unloading, but this is only implemented
by ds1.c
2000-09-01 20:09:24 +00:00
Cameron Grant
513693be6c rework feeder sytem to allow feeders in klds
modify driver capability reporting format to list every audio format
seperately- required for above and because we could not previously indicate
that mono was unsupported.

there should be no functional impact.
2000-08-20 22:18:56 +00:00
Cameron Grant
5151584d21 add suspend/resume for yamaha chips
Submitted by:	Ira L Cooper <ira@MIT.EDU>
2000-07-30 21:15:35 +00:00