Commit Graph

241 Commits

Author SHA1 Message Date
Kevin Lo
976b010645 Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
Ariff Abdullah
082f63835c Flush remaining malloc() cleanups (M_NOWAIT -> M_WAITOK). 2007-06-17 06:10:43 +00:00
Ariff Abdullah
bdfbdcec6a Filter/compress the amount of channel trigger. This should reduce
much of lock/unlock contentions within the interrupt handler. Most
of these drivers only need PCMTRIG_START or STOP (ABORT).

Discussed with:		scottl
2007-06-11 00:49:46 +00:00
Ariff Abdullah
79462204f1 Fix broken binary issues with latest gcc 4.x due to bitfield signess
mishaps for emu10k1 [1] and few other places.

Reported/Submitted/Tested by:	Ed Schouten <ed@fxq.nl> [1]
2007-05-27 20:12:51 +00:00
Joel Dahl
ecdbb0d42b Fix detection of PC-9821 V166 internal sound card.
PR:		kern/105600
Submitted by:	rotus <rotus@takamanohara.dyndns.org>
Approved by:	ariff
2007-05-19 10:53:01 +00:00
Ariff Abdullah
2e334adf6a sndbuf_alloc() now accept dmaflags argument which will be forwarded to
internal bus_dmammem_alloc() for greater flexibility on setting up DMA /
page attributes.
2007-04-18 18:26:41 +00:00
Ariff Abdullah
4582b3a100 Fix severe out-of-bound mtx "type" pointer, causing WITNESS refcount
confusions and panic provided that the following conditions are met:

  1) WITNESS is enabled (watch/trace).
  2) Using modules, instead of statically linked (Not a strict
     requirement, but easier to reproduce this way).
  3) 2 or more modules share the same mtx type ("sound softc").
     - They might share the same name (strcmp() == 0), but it always
       point to different address.
  4) Repetitive kldunload/load on any module that shares the same mtx
     type (Not a strict requirement, but easier to reproduce this way).

     Consider module A and module B:
     - From enroll() - subr_witness.c:
       * Load module A. Everything seems fine right now.
         wA-w_refcount == 1 ; wA-w_name = "sound softc"
       * Load module B.
       * w->w_name == description will always fail.
         ("sound softc" from A and B point to different address).
       * wA->w_refcount > 0 && strcmp(description, wA->w_name) == 0
       * enroll() will return wA instead of returning (possibly unique)
         wB.
         wA->w_refcount++ , == 2.
       * Unload module A, mtx_destroy(), wA->w_name become invalid,
         but wA->w_refcount-- become 1 instead of 0. wA will not be
         removed from witness list.
       * Some other places call mtx_init(), iterating witness list,
         found wA, failed on wA->w_name == description
       * wA->w_refcount > 0 && strcmp(description, wA->w_name)
       * Panic on strcmp() since wA->w_name no longer point to valid
         address.

Note that this could happened in other places as well, not just sound
(eg. consider lots of drivers that share simmilar MTX_NETWORK_LOCK).

Solutions (for sound case):
  1) Provide unique mtx type string for each mutex creation (chosen)
  or
  2) Put "sound softc" global variable somewhere and use it.
2007-03-15 16:41:27 +00:00
Ariff Abdullah
2cc08b748c - Compile time compatibility for pre/post newbus API (intr filter)
changes. This should ease the job of maintaining codebase since much
  of the regression tests are done across os versions.
- bus_setup_intr() -> snd_setup_intr().
2007-02-23 19:40:13 +00:00
Alexander Leidinger
0b989078d7 MFp4 (114068):
Use bus_get_dma_tag() to obtain the parent DMA tag to make the drivers
        a little bit more non-ia32/amd64 friendly.

        There is no man page for bus_get_dma_tag, so this is modelled after
        rev. 1.62 of src/sys/dev/sound/pci/es137x.c by marius.

        Inspired by:	commit by marius
2007-02-23 13:47:34 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Joel Dahl
155414e2e4 Remove dead email address.
Requested by:	luigi
2007-02-02 13:44:09 +00:00
Joel Dahl
a0afd24d9c Clean up the BSD license to match the preferred license in
/usr/share/examples/etc/bsd-style-copyright.  I've fixed a
few minor wording and formatting differences.

Approved by:	luigi, Hannu Savolainen <hannu@opensound.com>
2007-02-02 13:39:20 +00:00
Joel Dahl
262e034444 Add a standard BSD license to these files.
Discussed with:	rwatson
Approved by:	luigi
2007-02-02 13:33:35 +00:00
John Baldwin
73dbd3da73 Remove various bits of conditional Alpha code and fixup a few comments. 2006-05-12 05:04:46 +00:00
John Baldwin
3e20eaf592 Remove the snd_ess identify routine for the sound device in Alpha PWS
machines.
2006-05-12 04:11:25 +00:00
Ariff Abdullah
02dbda9d17 Recover (?) support for AD1815 based ISA soundcards.
PR:		kern/94388
Submitted by:	Krzysztof Kotlenga <piernik at gmail dot com>
MFC after:	3 days
2006-03-21 03:47:25 +00:00
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
d8f1a170d9 Fix broken capabilites. There are possible calculation errors within
ess_calcspeed8() and ess_calcspeed9() that need to be fixed as well
(TODO).

Reported by:	[1] Claude Buisson <cbuisson at nerim.net>
MFC after:	3 days

[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003566.html
2006-01-16 20:01:33 +00:00
Ariff Abdullah
33291bca01 Fix left/right channel mixed-up during recording by splitting recdev
mask to recdev_l and recdev_r, since each have its own unique mask.

Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
Approved by:	netchild (mentor)
2005-11-14 18:16:59 +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
0725262365 Fix panic caused by full duplex operation.
From the PR:
---snip---
The vibra16X supports full duplex. I traced the Windows driver, and what is
does is that it programs one DMA channel 8-bit, and the other 16-bit. There
might be some kind of auto detection logic here, because it always uses 8-bit
for playback, even if I play 16-bit sound ...
---snip---

PR:		80977
Submitted by:	Hans Petter Selasky <hselasky@c2i.net>
2005-09-10 17:33:58 +00:00
Alexander Leidinger
4442c32be7 Style fix.
Noticed by:	njl
2005-07-31 18:59:47 +00:00
Alexander Leidinger
c249345405 - Fixup the locking.
- Don't mark MPSAFE (yet).
- DSP_CMD_DMAEXIT_8 doesn't work on old cards, use sb_reset_dsp() instead.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:53:53 +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
Alexander Leidinger
205d75821e Add another ID.
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-07-31 13:49:47 +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
Warner Losh
d2b677bb1a Use BUS_PROBE_DEFAULT in preference to 0 and BUS_PROBE_LOW_PRIORITY in
preference to some random negative number to allow other drivers a
bite at the apple.
2005-03-01 08:58:06 +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
Warner Losh
993fd0c509 PNP BIOS devices are fundamentally different than ISA PNP devices.
These devices should be probed first because they are at fixed
locations and cannot be turned off.  ISA PNP devices, on the other
hand, can be turned off and often can be flexible in the resources
they use.  Probe them last, as always.
2004-12-07 05:30:02 +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
Nate Lawson
8909901fdd Add acpi attachments for ISA sound drivers. This is needed so they'll
probe and attach when ACPI is enabled.

Submitted by:	takawata (sbc fix)
MFC after:	1 day
2004-10-11 19:52:31 +00:00
Don Lewis
2e715afcac Change sb_lock() calls to sbc_lockassert() and remove the sb_unlock()
calls in sb_cmd2() and sb_getmixer().  The lock has already be grabbed
before these functions are called.

This is a RELENG_5 candidate.

PR:		71189
Submitted by:	stephane
MFC after:	3 days
2004-09-12 18:19:42 +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
Josef El-Rayes
134896e1fc Improve mapping of relative to absolute volume.
I added bounds checking to the patch and cg improved
the formular.

Submitted by:	Andriy Gapon <avg@icyb.net.ua>
PR:		kern/65485
Approved by:	cg
Reviewed by:	imp, rwatson, le
2004-06-14 15:01:16 +00:00
Seigo Tanimura
a5dc42def9 Axe the old midi drivers and framework. matk has developed a new
module-friendly midi subsystem to be merged soon.
2004-06-01 06:22:59 +00:00
Don Lewis
63625ec31e Remove extraneous spaces. 2004-05-13 11:33:44 +00:00
Don Lewis
9d2820eaac Implement sbc_lockassert() and sb_lockassert() functions to allow
proper locking to be checked at runtime.

Remove sb_lock() and sb_unlock() calls from sb_reset_dsp() because the
latter is called from sb_setup() with the lock already held.  Add a
call to sb_lockassert().

Surround the call to sb_reset_dsp() in sb16_attach() with sb_lock()
and sb_unlock() calls.

Tested by:	Bartek Marcinkiewicz <junior AT p233.if.pwr.wroc.pl>
2004-05-13 11:32:54 +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
Mathew Kanner
0d8ed52ea5 Augment /dev/sndstat with the module names, if applicable.
Approved by:	  tanimura (mentor)
2004-03-06 15:52:42 +00:00
Daniel Eischen
ec49974ac2 Don't attempt to destroy the driver mutex when it hasn't yet
been created.  This has been sitting in my local tree for
far too long; I can't believe noone else has come across this
yet.
2003-10-29 21:54:37 +00:00