Commit Graph

686 Commits

Author SHA1 Message Date
Scott Long
19f2be11b0 Limit the device to only one playback channel until I can figure out why
a) newpcm insists on using only the highest number channel available, and
b) the maestro3 driver no longer likes anything above channel 0.
2001-07-19 20:53:52 +00:00
Scott Long
e93d24c2f0 Fix an off-by-one error in the dma tag. This was causing the VM system to
freak out occasionally.

MFC after:	1 week
2001-07-19 20:51:29 +00:00
Peter Wemm
57385865a9 Somehow I missed this. Use INTR_TYPE_AV (high priority) instead of
INTR_TYPE_TTY (lowest priority).
2001-07-09 23:44:54 +00:00
Cameron Grant
41a019c08d * simplify
* add support for mic record channel

* add support for setblocksize

* make mpsafe

* make getptr accurate

* reduce buffer size from 64k to 16k for better synchronisation
2001-07-03 17:27:13 +00:00
Cameron Grant
cbe7d6a3ed remove obsolete typedefs.
only define INTR_TYPE_AV if it is not already defined.
2001-07-03 12:53:09 +00:00
Brian Feldman
bc0e6469ff Correct obviously wrong mistakes. 2001-07-02 23:47:23 +00:00
Matt Jacob
5640e0ac5a make it compile again in -current 2001-07-02 17:36:11 +00:00
Brian Feldman
5e6abe66d8 Detect the device on e.g. Dell OptiPlex GX110s. 2001-07-02 15:29:38 +00:00
Brian Feldman
0cfa4761f7 Make all this compile on 4.3, modulus sbuf. 2001-07-02 15:27:28 +00:00
Cameron Grant
1b6c76a2fe intel ich/ich2 driver - this needs some work but is functional enough for
the impatient.

Hardware...
Provided by:    ps
Lost by:        <censored>
Found by:       <censored>
Not delivered by:       Ashley Penney <ashp@unloved.org>
Retrieved by:   greid, Andrew McKay <andy@openirc.co.uk>
Delivered by:   Andrew McKay <andy@openirc.co.uk>

PR:             kern/25507
Submitted by:   Katsurajima Naoto <raven@katsurajima.seya.yokohama.jp>
2001-07-01 19:38:58 +00:00
Cameron Grant
113375dc42 add module version/dependancies 2001-07-01 18:59:15 +00:00
Cameron Grant
c76f01164f don't set a flag that is already set 2001-07-01 18:57:16 +00:00
Cameron Grant
4712b1eba1 set default 'monitor' volume (ac97 headphones) to 75% 2001-07-01 18:53:24 +00:00
Cameron Grant
f637a36cfd don't flag the playback hardchan as busy on devices with only one of them.
if a device has vchans already but they are all busy, allocate another one
at open() time, up to a maximum of hw.snd.maxvchans.

when creating/destroying vchans, don't make/remove a devnode for the
first/last one as it replaces a hardchan.
2001-06-27 19:59:45 +00:00
Cameron Grant
aa0baad55b tidy up/simplify dsp_clone() 2001-06-27 19:51:02 +00:00
Cameron Grant
cd9766c5f8 add a tunable/sysctl, hw.snd.autovchans. if this is set to a value n where
n > 0, n vchans will be assigned to any devices that subsequently register
with a single playback channel.
2001-06-26 21:54:55 +00:00
Cameron Grant
8e81760b1a the turtle beach santacruz implements ac97 eapd in an inverted sense -
inform the ac97 code of this.
2001-06-23 18:00:06 +00:00
Cameron Grant
f00f162a5f add defines and ifdefs so this code will compile on 4.x
add spls so this code will work on 4.x
2001-06-23 17:36:51 +00:00
Cameron Grant
79bb7d52b3 move a private struct definition from ac97.h to ac97.c
add proper handling of cards which take eapd=1 to mean 'produce sound'
instead of 'external amplifier power down'
2001-06-23 17:32:40 +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
b30d115684 stop csa from panicing in clkrun_hack() - we were using free'd memory
don't leak memory in clkrun_hack()

Submitted by:	grog (partially)
2001-06-18 19:58:03 +00:00
Thomas Moestl
916076fefc Call bus_teardown_intr when csa_attach fails after the interrupt has
been set up.

PR:		kern/28178
Reviewed by:	cg
MFC after:	2 weeks
2001-06-18 18:36:34 +00:00
Cameron Grant
74ffd13814 use devclass_get_maxunit() correctly 2001-06-18 00:10:47 +00:00
Cameron Grant
faeebea2b8 revise dsp_clone() to return the first nonbusy channel instead of simply
cycling channel numbers.

remove unused fields from struct snddev_info.
2001-06-17 23:23:06 +00:00
Cameron Grant
5210620e98 fix a potential panic in dsp_clone() if no pcm devices were detected 2001-06-17 20:15:29 +00:00
Peter Wemm
46700f1259 Use INTR_TYPE_AV for the interrupt handlers because:
1: most drivers are sensitive to timing, and
2: the handlers are MPSAFE and need a chance to get into the kernel
before some other non-mpsafe handler blocks the ithread on Giant in
shared irq cases.

Reviewed by:	cg  (in principle)
2001-06-16 22:59:46 +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
Cameron Grant
b8f0d9e0b2 various locking fixes, rework open logic and channel registration
PR:             kern/28084
2001-06-14 13:31:30 +00:00
Cameron Grant
94faf89997 identify es1371 revision a 2001-06-11 00:32:18 +00:00
Cameron Grant
7d07ee8c6b get clkrun the right way around
remove debug messages
2001-06-11 00:29:25 +00:00
Dag-Erling Smørgrav
d647935801 sbuf_new(9) now returns a struct sbuf * instead of an int. If the caller
does not provide a struct sbuf, sbuf_new(9) will allocate one and return
a pointer to it.
2001-06-10 15:48:04 +00:00
Seigo Tanimura
e6577f69a4 Catch up to csareg.h rev 1.3.
Forgotten by:	cg
2001-06-08 11:57:39 +00:00
Peter Wemm
0978669829 "Fix" the previous initial attempt at fixing TUNABLE_INT(). This time
around, use a common function for looking up and extracting the tunables
from the kernel environment.  This saves duplicating the same function
over and over again.  This way typically has an overhead of 8 bytes + the
path string, versus about 26 bytes + the path string.
2001-06-08 05:24:21 +00:00
Cameron Grant
49c5e6e20a lock sound device when adding/removing channels
implement setblocksize for vchans
don't panic when doing certain ioctls or aborting on a vchan
xmms now works with vchans
2001-06-07 20:06:22 +00:00
Peter Wemm
4422746fdf Back out part of my previous commit. This was a last minute change
and I botched testing.  This is a perfect example of how NOT to do
this sort of thing. :-(
2001-06-07 03:17:26 +00:00
Peter Wemm
81930014ef Make the TUNABLE_*() macros look and behave more consistantly like the
SYSCTL_*() macros.  TUNABLE_INT_DECL() was an odd name because it didn't
actually declare the int, which is what the name suggests it would do.
2001-06-06 22:17:08 +00:00
Joerg Wunsch
b794010414 Move out the files from src/sys/isa/ic/ to src/sys/dev/ic/, so they
can be made userland-visible as <dev/ic/...>.  Also, those files are
not supposed to contain any bus-specific details at all, so placing
them under .../isa/ has been a misnomer from the beginning.

The files in src/sys/dev/ic/ have been repo-copied from their old
location (this commit is a forced null commit there to record this
message).
2001-06-04 21:04:14 +00:00
Cameron Grant
3c20ba7175 fix typo 2001-05-30 22:46:40 +00:00
Cameron Grant
8d41a999cd no longer used 2001-05-30 22:41:04 +00:00
Cameron Grant
20ac1df714 update this driver to use new firmware and incorporate many fixes.
this works on cs4630 chips, and should implement the clkrun hack for
thinkpads- this will display diagnostic messages when triggered until its
correctness is established.
2001-05-30 22:38:31 +00:00
Cameron Grant
6cf2606901 state the licencing terms for this file
Obtained From:	Yamaha
2001-05-30 19:05:47 +00:00
Cameron Grant
285648f9d2 beginnings of virtual playback channel support
instead of using two malloced arrays for storing channel lists, use an
slist.  convert the sndstat device to use sbufs and optionally provide more
detail about channel state.

vchans are software mixed playback channels.  they are not enabled by this
commit.  they use the feeder infrastructure to emulate normal playback
channels in a manner transparent to applications, whilst providing as many
channels are desired, especially suitable for devices with only one hardware
playback channel.  in the future they will provide additional features.

those wishing to test this functionality will need to add vchan.c to
sys/conf/files and use 'sysctl -w hw.snd.pcm0.vchans' to enable it.

blocksize and auto-rate selection are not yet supported.
2001-05-27 17:22:00 +00:00
Cameron Grant
4dce85407c add a new method for retrieving feeder parameters 2001-05-27 14:49:14 +00:00
Cameron Grant
fc60109d91 don't erase info in sndbuf_setup()
set free'd pointers to NULL in sndbuf_free()
add a new function
2001-05-27 14:39:34 +00:00
Scott Long
7edce08ac4 Fix DMA on machines with more than 128MB.
Obtained from:	cg
MFC after:	5 days
2001-05-25 16:05:22 +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
Seigo Tanimura
9d68b59376 - Eliminate locks in functions called only during probe and attach.
- Finish transmitting data to mpu when a buffer gets empty.

Submitted by:	KUROSAWA Takahiro <fwkg7679@mb.infoweb.ne.jp>
2001-05-08 12:15:26 +00:00
Cameron Grant
799c04bad3 this file has been unused for some time now 2001-05-05 05:32:22 +00:00
Mark Murray
fb919e4d5a Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)
2001-05-01 08:13:21 +00:00
Cameron Grant
cd94939222 don't unlock the channel in chn_read, msleep will do it for us.
PR:		kern/26430
2001-04-29 02:31:02 +00:00
Cameron Grant
680307ae14 be more specific in identifying the chip type 2001-04-27 22:26:36 +00:00
Cameron Grant
15418cf2bb get the parameters to pci_write_config the right way round. this may fix
some non-functional cards/machines
2001-04-24 22:35:11 +00:00
Orion Hodson
1f2b9fe67a Initial version of Avance Logic ALS4000 pcm driver. 2001-04-23 21:53:12 +00:00
Orion Hodson
5090c9953c Add power on to start sequence for 4.x kernels.
PR:		kern/26255
Submitted by:	WATANABE Kiyoshi <aab10490@pop16.odn.ne.jp>
2001-04-19 13:23:50 +00:00
George C A Reid
e572fcd463 Add another card to the list of Neomagic 256AV's which don't have AC97
codecs. Also, add some additional code to check for future cards without
this feature - attempting to initialise them as AC97 cards will hang the
machine.

PR:		26427
Reviewed by:	cg
2001-04-10 14:28:21 +00:00
Cameron Grant
f72b6281c2 lock the mutex, not the softc pointer. 2001-04-10 13:52:26 +00:00
Cameron Grant
941431caa8 comment out a boot-time debug message 2001-04-09 21:33:47 +00:00
George C A Reid
9de0de1dd4 Reinitialise the DSP and mixer after a resume from suspend
PR:		22372
Submitted by:	Hiroyuki Aizu <aizu@jaist.ac.jp>
Reviewed by:	cg
2001-04-08 23:02:06 +00:00
Cameron Grant
60391e107d add a software sample rate conversion feeder. this uses linear
interpolation for reasonable quality whilst not using too much cpu time.
2001-04-08 20:26:22 +00:00
Cameron Grant
66a3addbf2 minor tweaks in speed and format setting routines.
don't stop exploring the feeders if a feeder fails to initialise.
2001-04-08 20:20:52 +00:00
Cameron Grant
7c3968cc32 fix feeder initialisation methods to return correct result codes. 2001-04-08 20:17:03 +00:00
Cameron Grant
2753645ced if the feeder chain returned no data, do not try to acquire the data. 2001-04-08 20:14:14 +00:00
George C A Reid
46ae634c56 Add yet another chip revision of the ES1371 which requires initialisation
delays

PR:		26415
Submitted by:	Jose M. Alcaide <jose@we.lc.ehu.es>
Reviewed by:	cg
2001-04-08 00:07:53 +00:00
Orion Hodson
7370c6a68a Quieten when re-triggering. 2001-04-07 14:12:53 +00:00
Orion Hodson
8b330062da Centralize DMA buffer configuration.
Simplify initialization and remove offending DMA channel resets there.
The resets trash whatever is pointed to DMA registers, but at cmi_attach()
time the DMA registers have not been initialized with valid addresses.

Reviewed by:	Cameron Grant <gandalf@vilnya.demon.co.uk>
2001-04-04 13:48:33 +00:00
Seigo Tanimura
6c2b22e90e Again initialize a mutex well, then lock it.
PR:		kern/26188
Submitted by:	Jim Bloom <bloom@acm.org>
2001-04-03 05:15:58 +00:00
Orion Hodson
417f47c4d5 - Added suspend/resume support.
- Added 4 speaker enable to initialization sequence.

- Removed delays between register pokes which appear to aggravate a
  problem this card has sampling at 44.1kHz.  With any form of delay,
  skew relative to system clock at 44.1kHz is usually in range 0-25%
  (now 0-3%).  No other rates exhibit this problem.

- Changed structs cmi_* to sc_*.

Approved by:    Cameron Grant <gandalf@vilnya.demon.co.uk>
2001-03-29 15:36:31 +00:00
John Baldwin
0006681fe6 Switch from save/disable/restore_intr() to critical_enter/exit(). 2001-03-28 03:06:10 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Cameron Grant
26799605fc fix whitespace bogons 2001-03-25 21:43:24 +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
c78683be1f when writing to one of the setup registers, a 32-bit write is required.
this apparently fixes problems initialising certain es1371/es1373/ct5880
revisions.

Confirmed working by: Richard J Kuhns <rjk@grauel.com>
PR:		i386/25944
2001-03-24 20:36:59 +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
715082895a * power up the external amplifier
* after chip reset, reapply power settings
2001-03-23 16:39:01 +00:00
Cameron Grant
73770282cf add/correct a bunch of codec ids
Obtained from:	linux, alsa, various datasheets
2001-03-22 02:41:24 +00:00
Orion Hodson
50aac86c8a Change type of channel speed variable from "int" to "u_int32_t" to
avoid overflow when scaling playback rate.  Fixes 44.1k playback from
being 48k (I am deaf to this difference...).
2001-03-21 14:10:51 +00:00
Orion Hodson
bd01f3f982 Change ordering of SPDIF register pokes. SPDIF enable needs to be the
last poke in sequence.  Enabling SPDIF was coercing output rate to
48K, not good for 44.1K tracks.
2001-03-21 12:51:37 +00:00
Orion Hodson
dfe67249d2 pcm driver for S3 Sonicvibes chipset.
Reviewed by:	Cameron Grant
2001-03-19 00:26:41 +00:00
Cameron Grant
c6c3b893e5 destroy child devices on detach to prevent ever-increasing numbers of
pcm/midi devices trying to attach if the module is repeatedly loaded and
unloaded.
2001-03-17 16:04:25 +00:00
Cameron Grant
bd22a64c45 fix a typo preventing the second dma channel being released
use isa_dma_release when releasing dma channels
2001-03-16 21:04:14 +00:00
Cameron Grant
effbadb7eb don't leak memory allocated for feeders at module unload
kill the fake channel when unregistering
2001-03-16 20:58:44 +00:00
Seigo Tanimura
5ddde3e6fd - Do not touch the Giant.
Requested by:	jhb

- Initialize a mutex prior to locking it.

Spotted by:	dcs
2001-03-14 07:29:47 +00:00
Cameron Grant
9a1ec7ebfd fix a panic triggerable by anyone with read/write access to the audio
devices.  opening /dev/{dsp,dspW,audio}0 and then opening a different device
from that list and closing it resulted in a panic when any operation is
performed on the first fd.

we prevent this happening by denying the second open unless it uses the same
minor device as the first.

PR:		kern/25519
2001-03-13 18:43:22 +00:00
Cameron Grant
86c1b69bbb increase timeouts for ad_wait_init() 2001-03-05 17:59:36 +00:00
Cameron Grant
415dc6874f MFS: don't ignore the result of mixer_init() 2001-03-05 17:51:28 +00:00
Cameron Grant
1c46beb55c only mess with the power state on 5.x 2001-03-05 17:30:43 +00:00
Cameron Grant
a0585a78aa MFS: add kobj.h to reduce diffs from -stable 2001-03-05 16:47:35 +00:00
Cameron Grant
96aa9dc9e1 MFS: don't pagefault in sndbuf_clear 2001-03-05 16:45:38 +00:00
Cameron Grant
b3ada620e8 MFS: #ifdef dynamic sysctl stuff to reduce diffs from -stable 2001-03-05 16:43:43 +00:00
Cameron Grant
00d6c0c690 MFS: add '# KOBJ' as the first line of each .m file to reduce diffs from
-stable
2001-03-05 16:42:06 +00:00
Cameron Grant
dec507e8f7 enable per-device sysctls unconditionally 2001-03-05 15:58:05 +00:00
Cameron Grant
a983d57528 nuke the splstack stuff, snd_mtx* will now be no-ops on 4.x 2001-03-05 15:49:42 +00:00
Scott Long
ea0e6ecfe9 Don't re-init the mixer on resume. This keeps the channel volumes from
being trashed when you suspend, though this may need to be revisited if we
ever get suspend-to-disk implememted.
2001-02-27 18:40:07 +00:00
Cameron Grant
1b0dabf0c0 Add speaker volume adjusting support
Submitted by:	Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
PR:		i386/21452
2001-02-27 12:44:31 +00:00
Cameron Grant
37209180a5 add functions for sound drivers to use for locking and setting up interrupt
handlers.  these are not yet used, but will allow compatibility for driver
modules from 5.x to 4.x.
2001-02-27 07:45:09 +00:00
Cameron Grant
82db23e2af MFS: 4.x/5.x compatibility #ifdefs 2001-02-27 07:01:49 +00:00
Cameron Grant
041e207dec MFS: 4.x/5.x compatibility #defines 2001-02-27 06:58:55 +00:00
Seigo Tanimura
87a636ccb0 - Mutexify midi(4). The driver runs under the giant lock by default.
If you ever want to run midi(4) out of the giant lock, uncomment
MIDI_OUTOFGIANT in midi.h. Confirmed to work for csamidi with WITNESS
and INVARIANTS.

- midi_info, midi_open and seq_info are now tailqs, allowing arbitrary
numbers of devices to be configured.

- Do not send an active sensing message to reset midi modules.

- Clone /dev/sequencer*. /dev/sequencer0 and /dev/sequencer are generated
upon initialization.
2001-02-26 07:36:24 +00:00
Seigo Tanimura
941afeb22d Encapselate midi_info, nmidi and nsynth into midi.c. 2001-02-18 15:58:56 +00:00
Yoshihiro Takahashi
38bc72e431 Don't assume bus_space_handle_t == the start address of resource.
Use rman_get_start() instead.
2001-02-16 13:29:41 +00:00
Cameron Grant
40765b397d add a format feeder for conversion from alaw to ulaw and vice versa.
Submitted by:   Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-13 22:00:57 +00:00
Cameron Grant
7ec3c4620e make attempts to set unsupported speeds or formats non-sticky. this should
fix problems with apps that probe for a variety of settings.

Submitted by:	Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-13 21:57:34 +00:00
Cameron Grant
9725922ed9 add power management support.
Submitted by:	Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-13 21:00:22 +00:00
Cameron Grant
d55a14469f back out rev 1.49, looks like i committed it from the wrong tree.
include the changes 1.49 was supposed to have.

Noticed by:	peter
2001-02-07 20:45:40 +00:00
Cameron Grant
9d7227e565 conditionalize "hwptr went backwards" messages
modify default buffer size heuristic to not max out at 4k.  mpg123 should now
behave better under load.
2001-02-07 06:48:28 +00:00
Cameron Grant
17e401f8a9 add driver for CS4281 sound chips
Submitted by:   Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-04 19:23:35 +00:00
Cameron Grant
ebbb717721 add driver for CMedia CMI8338/CMI8738 sound chips
Submitted by:   Orion Hodson <O.Hodson@cs.ucl.ac.uk>
2001-02-04 19:13:40 +00:00
Cameron Grant
d60a6a8e0c quieten the esscontrol device 2001-02-02 16:41:06 +00:00
Scott Long
a5108eaebf Driver for the ESS Maestro3 and Allegro sound chips. Note that due to the
amount of GPL'd firmware in the driver, it will only be built as a module.

Approved by:	cg
2001-02-01 20:29:16 +00:00
Cameron Grant
1a8de399e7 don't grope around inside snd_dbuf structures as they will change in future 2001-01-24 01:36:15 +00:00
Cameron Grant
2707da0758 fix certain cards failing to attach
Submitted by:	Russell Cattelan <cattelan@thebarn.com>
2001-01-24 01:27:31 +00:00
Cameron Grant
03d18442f6 fix blocksizing for playback, implement blocksizing for record 2001-01-24 01:22:53 +00:00
Cameron Grant
7ed9700b1f some cosmetics, changed channel setup and revamped irq handling - ignore
repeated interrupts
2001-01-24 01:20:04 +00:00
Cameron Grant
6e64c174bd prevent excessively small buffer sizes resulting in hundreds of irqs per
second
2001-01-24 01:15:50 +00:00
John Baldwin
399fde35e8 Tag unused functions with __unused. 2001-01-23 22:18:41 +00:00
John Baldwin
e97abfe751 Catch up to the name changes in the hwvol API. 2001-01-11 23:26:38 +00:00
John Baldwin
4fb369f815 - Move all of the hwvol functions into a mixer_hwvol_* namespace, and make
all of the hwvol members of struct snd_mixer live in a hwvol_* namespace.
- When changing the mixer device via the hwvol_mixer sysctl, reset the
  muted state so that a mute operation on a new device won't try to
  unmute the new device with the old device's saved volume.
- When the volume is muted, if a down or up volume request is received,
  first restore the saved volume level and then adjust it.

Reviewed by:	cg
2001-01-11 23:26:16 +00:00
John Baldwin
a3e893e04f Woops, use the SYSCTL_STATIC_CHILDREN() macro instead of manually
expanding it for _hw_snd.
2001-01-11 23:22:33 +00:00
John Baldwin
0f32b57ac4 Call mixer_hwinit() when attaching. 2001-01-05 07:07:48 +00:00
John Baldwin
cc486d8061 - Make the 'hwvol_mixer' and 'hwvol_step' variables be specific to a
specific snd_mixer device rather than global across all mixers.
- Add per-mixer mute status and saved mute_level so that the mixer_hwmute()
  function can now toggle the mute state when the mute button is pressed.
- Create a dynamic sysctl tree hw.snd.pcmX when a pcm device is registered.
- Move the hw.snd.hwvol_* sysctl's to hw.snd.pcmX.hwvol_* so that they
  are now properly device-specific.  Eventually when the mixers become
  their own devices these sysctl's will move to live under a mixerX tree.
- Change the interface of the hwvol_mixer sysctl so that it reports the
  name of the current mixer device instead of the number and is settable
  with the name instead of the number.
- Add a new function mixer_hwinit() used to setup the dynamic sysctl's
  needed for the hwvol support that can be called by drivers that support
  hwvol.

Reviewed by:	cg
2001-01-05 07:07:03 +00:00
John Baldwin
6d97297a6a The 'maxchans' count is one more than the number of channels, so
'chancount' never got up to equaling 'maxchans'.  As a result,
pcm_makelinks() was never called, and one always had to set the sysctl to
get the /dev/mixer and other symlinks generated in the DEVFS case.  Instead,
change the test in pcm_addchan() to call pcm_makelinks() after the first
channel is initialized, since the aliases are linked to channel 0.

Reviewed by:	cg
2001-01-04 23:49:00 +00:00
Warner Losh
94648ce60d Add the ES1681, as found in my Digital HiNote UltraII. It works with
the ES18xx DSP code and is now my MP3 juke box engine.

Reviewed by:	cg
2001-01-04 17:12:57 +00:00
John Baldwin
fa465e99e0 Rename the loader tunable from hw.sndunit to hw.snd.unit.
Submitted by:	cg
2001-01-03 02:09:31 +00:00
John Baldwin
1b40801722 - When acknowledging interrupts, write the value 0xff to the interrupt
status register rather than 0.  Without this, a single hardware volume
  event triggers an interrupt storm.
- Implement hardware volume control for the Maestro chips.  This version
  only handles the case where both channels are adjusted at the same time.

Reviewed by:	cg
2001-01-03 01:32:57 +00:00
John Baldwin
d0d4e34743 Add a new API for soundcards that have hardware volume control:
- The mixer_hwmute() function can be called when a soundcard receives a
  mute request.
- The mixer_hwstep() function can be used to adjust the volume of one or
  both channels.
- The 'hw.snd.hwvol_step' sysctl determines the amount that mixer_hwstep()
  adjusts the volume by on each call.
- The 'hw.snd.hwvol_mixer' sysctl specifies the mixer device to adjust the
  volume on for both functions.  The values used correspond to the
  SOUNDCARD_MIXER_* constants.
2001-01-03 01:29:47 +00:00
John Baldwin
b3b7ccfe38 Create a new sysctl node 'hw.snd' and move 'hw.sndunit' to
'hw.snd.unit'.

Reviewed by:	cg
2001-01-03 01:25:26 +00:00
Cameron Grant
826737698c change irq handler slightly, get rid of superflous messages 2000-12-27 04:04:36 +00:00
Cameron Grant
b87eb3b531 move parametric defines and structure definitions from .h to .c 2000-12-25 02:49:28 +00:00
Cameron Grant
a6b5683876 indent debugging printfs, change a couple of messages slightly 2000-12-25 02:21:16 +00:00
Cameron Grant
6a2e12e0dd update to return correct blocksize- these chips have a fixed irq rate, so
block size varies only with format and rate.
2000-12-25 01:42:13 +00:00
Cameron Grant
f0fb042e84 fairly substantial rewrite- seperate out play/record code, implement
setblocksize, simplify resource allocation
2000-12-24 03:56:41 +00:00
Cameron Grant
6a6ee5bb35 compensate for broken codecs that return 0xffff on unimplemented registers
instead of 0.
2000-12-24 03:33:21 +00:00
Cameron Grant
ac083c91f8 implement setblocksize properly 2000-12-23 22:24:43 +00:00
Cameron Grant
f4084c4526 fix a panic if the requested blocksize was greater than the data rate,
resulting in a divide by 0.
2000-12-23 06:09:43 +00:00
Cameron Grant
e246070f8a kill a warning 2000-12-23 05:19:32 +00:00
Cameron Grant
b4f8389d56 fix a typo 2000-12-23 05:16:39 +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
688ca063da fix a debugging leftover (min speed=48khz) 2000-12-20 05:21:17 +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
Julian Elischer
07076ce1f7 Bump the buffersize from 0x1000 to 0x4000.
0x1000 gets underflows on my dell 7500 whenever I moved the mouse.
(reported as "hwptr went backwards...", with jumpy sound)
Sounds great now....
2000-11-21 12:22:11 +00:00
Cameron Grant
612276f48c do not blindly assume 8khz is supported on open(). try for 8khz but respect
minspeed/maxspeed specified by the hw driver.

Submitted by:	Andrew Gordon <arg@arg1.demon.co.uk>
2000-11-18 03:43:04 +00:00
Cameron Grant
ab3978871b adjust dma channels for vibra16x; recording should now work. full duplex does
not work on vibra16x, so is disabled.
2000-11-07 00:38:59 +00:00
Cameron Grant
d19811446d slight mods to isa dma and channel flushing code 2000-11-07 00:32:35 +00:00
Cameron Grant
41b3c72639 if a channel dies, rejuvenate it on close() 2000-11-07 00:29:24 +00:00
Cameron Grant
4e2e565cbd add AFMT_8BIT for easier determination of formats 2000-11-06 22:22:52 +00:00
Cameron Grant
e258e032ac fix paste-o in mixer code - actually set right channel volume instead of
doing the left channel twice.
2000-11-06 02:47:43 +00:00
Cameron Grant
b7d3143b0d fix es1370 mixer by adding reinit function to it's mixer function list. 2000-11-06 02:37:28 +00:00
Cameron Grant
b15e2b4bee kill old sb driver 2000-11-01 00:56:52 +00:00
Cameron Grant
6093b91dea switch over to new sb8/sb16 code 2000-11-01 00:53:16 +00:00
Cameron Grant
5bc2a29c8c add commented-out dependancies on the new sb8 and sb16 drivers 2000-10-28 19:35:54 +00:00
Cameron Grant
eadd0f839e split up sb16 and sb/sbpro drivers
we do not support sb versions <2.00, and the sb8 driver has not been tested
yet.

these drivers are not yet enabled by default.
2000-10-28 19:20:03 +00:00
Cameron Grant
d16b567379 implement SNDCTL_DSP_POST 2000-10-27 22:20:45 +00:00
Poul-Henning Kamp
46aa3347cb Convert all users of fldoff() to offsetof(). fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.

Define __offsetof() in <machine/ansi.h>

Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>

Remove myriad of local offsetof() definitions.

Remove includes of <stddef.h> in kernel code.

NB: Kernelcode should *never* include from /usr/include !

Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.

Deprecate <struct.h> with a warning.  The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.

Paritials reviews by:   various.
Significant brucifications by:  bde
2000-10-27 11:45:49 +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
Cameron Grant
badd7dc127 do not attach to soundblaster 1.x - they are unsupported 2000-10-26 20:31:16 +00:00
Cameron Grant
c0960a5e91 handle AFMT_QUERY right 2000-10-26 01:34:54 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Maxim Sobolev
6e3c38712b Reduce buffer size from 64K to 4K.
Approved by:	cg
2000-10-09 14:54:32 +00:00
Nick Sayer
04c24efdc1 Add suspend/resume hooks.
Submitted by: sean@stat.duke.edu
2000-09-28 14:02:49 +00:00
Cameron Grant
c9c6ba09e4 prepare for adding a rate conversion feeder.
move format conversion feeders to feeder_fmt.c - no pertinent history so no
repo-copy.
2000-09-23 22:11:32 +00:00
Cameron Grant
33c878f034 only probe mandatory channels on known bad codecs 2000-09-23 22:00:09 +00:00
John Baldwin
1204fd85a4 Enable the snd_maestro module and have the snd_driver module depend on it.
Approved by:	cg
2000-09-23 17:35:37 +00:00
Seigo Tanimura
c74c29ca6b Since the unit number of a midi/sequencer device is expressed in 4
bits, we can configure only up to 16 units.
2000-09-18 10:17:38 +00:00
Cameron Grant
341f16cc60 dynamify- probe codec for supported channels
add channel mappings for mixer
2000-09-17 23:51:00 +00:00
Cameron Grant
7dfc932548 fix warnings 2000-09-17 23:46:32 +00:00
Cameron Grant
0a1fe8922f disable 16bit mono support- this will be handled by software conversion to
stereo as hardware mono is very noisy
2000-09-09 21:31:06 +00:00
Cameron Grant
58359dc594 add 16bit mono/stereo conversion feeder
prefer feeder chains of length 1 over length 2
2000-09-09 21:24:03 +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
7d60928719 ess maestro driver - not enabled by default
Submitted by:   Taku YAMAMOTO <taku@cent.saitama-u.ac.jp>
2000-09-06 20:10:55 +00:00
Cameron Grant
cd2c103ae0 initial support for multiple ac97 codecs 2000-09-05 21:08:01 +00:00
Cameron Grant
c02f3f7aee add detach support 2000-09-05 21:06:11 +00:00
Cameron Grant
85a6a5dce4 allow a null setdir implementation 2000-09-05 21:00:45 +00:00
Cameron Grant
c9b53085be be more verbose about failed unload attempts 2000-09-05 20:58:51 +00:00
Cameron Grant
37ab02c0ed tidy up a little, add a mask for 32bit formats 2000-09-05 20:56:31 +00:00
Peter Wemm
8ac2d635c4 Fix warnings by moving static functions before they are used. 2000-09-03 05:32:09 +00:00
Cameron Grant
f776b5abb8 update for phk's last devfs commit 2000-09-02 23:14:46 +00:00
Poul-Henning Kamp
db90128160 Avoid the modules madness I inadvertently introduced by making the
cloning infrastructure standard in kern_conf.  Modules are now
the same with or without devfs support.

If you need to detect if devfs is present, in modules or elsewhere,
check the integer variable "devfs_present".

This happily removes an ugly hack from kern/vfs_conf.c.

This forces a rename of the eventhandler and the standard clone
helper function.

Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include
like <sys/queue.h>

Remove all #includes of opt_devfs.h they no longer matter.
2000-09-02 19:17:34 +00:00
Cameron Grant
f3dcf66158 add a missing return statement, doh. 2000-09-02 18:55:01 +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
f2d00399d1 remove stuff accidentally left in last commit 2000-08-29 20:53:56 +00:00
Cameron Grant
1088e98b00 suspend/resume for ds1 driver
PR:		misc/20891
Submitted by:	Ira L. Cooper <ira@mit.edu>
2000-08-29 20:50:42 +00:00
Cameron Grant
c07a337569 make the test for hwptr going backwards more picky- now it only triggers if
15/16 of the buffer is skipped or we go backwards by < 1/16 of buffer size.
2000-08-29 16:32:26 +00:00
Cameron Grant
7c438dbe9c add devfs support. when devfs is enabled, sysctl hw.sndunit is used to set
which sound unit the /dev/{dsp,mixer,dspW,audio} links point at.  this can
also be set from the loader.
2000-08-29 16:21:33 +00:00
Cameron Grant
dacda62ff2 add driver for forte-media fm801
PR:             conf/20698
Submitted by:   dimmy the wild <diwil@dataart.com>
2000-08-29 16:12:28 +00:00
Doug Rabson
e6171135a7 Fix disordered arguments to bus_space_barrier(). 2000-08-28 21:02:18 +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
fa06efc7e6 fix SNDCTL_DSP_GETODELAY
PR:		kern/20340
Submitted by:	Takashi SHIRAI <shirai@nintendo.co.jp>
2000-08-19 18:29:46 +00:00
Cameron Grant
4e77c04865 don't complain about bad irqs if using a shared irq 2000-08-19 18:22:20 +00:00
Cameron Grant
becc0678b7 Recognize ESS 1888 in Dell Latitude XPi
PR:		kern/18714
Submitted by:	Sean O'Connell <sean@stat.Duke.EDU>
2000-08-19 18:17:15 +00:00
Nick Sayer
6ba60b3c4a This patch appears to solve the problems with recording resulting
in bogus hwptr warnings. Further comments sought on -hackers
were not forthcoming. I can only hope that calling DELAY() like
this doesn't cause any heartburn.
2000-08-13 19:20:02 +00:00
Nick Sayer
fc35953a16 Missed a step when activating the solo driver. 2000-08-09 20:28:19 +00:00
Cameron Grant
4873b46dc7 change irq handling slightly
add another non-ac97 256av
2000-08-09 18:51:27 +00:00
Cameron Grant
071280d442 MFS: module macro changes 2000-08-09 18:46:48 +00:00
Nick Sayer
0edeb3dc90 A couple of cosmetic fixes, plus a biggie: When checking the DMA
position, channel 1's dma position register must be quiescent. So
the driver will spl, pause the DMA, delay a bit and hold as still as
possible while snapping the picture.

I'm sure there HAS to be a better way to do this, but if there is, it's
not documented.

So far as I can tell, this fixes recording, which means the Solo is open
for business.
2000-08-09 07:14:56 +00:00
Cameron Grant
1874ec255c MFS: sync with peter's isadma fixup 2000-08-09 01:22:09 +00:00
Cameron Grant
ba90ebe703 activate via82c686 audio driver 2000-08-09 01:08:59 +00:00
Cameron Grant
fb9f118e6f new driver: via 82c686 chipset audio
not personally tested, but i'm assured it works

Submitted by:	David Jones <dej@ox.org>
PR:		kern/20161
2000-08-09 00:55:55 +00:00
Cameron Grant
5fd7b0878e warn if hwptr goes backwards 2000-08-09 00:42:00 +00:00
Cameron Grant
6c1146c0b8 fix the staticy sound issue
use timer instead of per-channel interrupts

do playback like the linux driver - may fix nmi-with-ecc issue
2000-08-06 18:10:05 +00:00
Nick Sayer
05a1fdb459 Simplex devices will always report EBUSY on 2nd (and subsequent)
opens if the reference count is not decremented on close.

Note that this may result in the reference count being corrupted
on full duplex devices (due to mismatching opens/closes), but the
code doesn't use the reference count for anything on full duplex
devices.
2000-08-02 22:47:44 +00:00
Nick Sayer
3ac1ca3363 1. Increase the size of the DMA buffer.
2. Offer half duplex with both playback and record on channel 1 or
full duplex with playback always on channel 2 as a compile-time option.

3. 16 bit record output is byte swapped for some dumb reason. Report the _BE
AFMTs for recording.
2000-08-02 22:45:57 +00:00
Nick Sayer
a7e1150660 Undo some of my own damage. With this patch, it appears that both
recording and playback now work correctly.
2000-08-02 19:37:43 +00:00
Nick Sayer
bb7f26c3d9 Fix channel 1 playback the rest of the way. There are a couple of
hiccups, but playback now proceeds mostly normally using both channel 1
and 2.
2000-08-02 15:09:39 +00:00
Nick Sayer
19a0702e86 Get playback on channel 1 closer to working. 8 bit samples work.
16 bit samples have some sort of choppiness, the nature of which
is not completely clear, but it clearly has something to do with
dma buffer synchronization. But at least channel 1 makes noise now.
2000-08-02 08:01:00 +00:00
Nick Sayer
8eb3acc9be Fix channel 1, sort of. recording now generates IRQs and the output
appears to be the correct length, but quality of output has not yet
been tested. Also, full duplex audio (that is, playback on channel 1)
does not yet work. Two constants and I am there!

Obtained from:	major hints from ALSA
2000-08-02 06:36:55 +00:00
Nick Sayer
80a8e065eb Reverse the sense of the signed/unsigned formatting bit.
This dramatically cleans up playback quality, at least with mxaudio.
2000-08-01 04:18:15 +00:00
Cameron Grant
fd1aaeccce almost-there ess solo-1 driver, committed so people can tell me why it
doesn't generate irqs.
2000-07-31 16:17:40 +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
Cameron Grant
1c60ef3f3c fix a potential local DoS attack 2000-07-30 19:38:26 +00:00
Cameron Grant
e04387c95a fix a bug where opening /dev/dsp twice resulted in it being busy until reboot 2000-07-30 19:36:13 +00:00
Cameron Grant
3c1b957d66 do the ac97 init delay for all chips and increase it to 500ms 2000-07-30 02:33:37 +00:00
Cameron Grant
d98c7b9a99 make this file suitable for 4-stable as well as 5-current 2000-07-18 21:23:48 +00:00
Richard Seaman Jr.
307754cbe2 PR:19945
Reviewed by:tanimura
Fix boot panic introduced by newmidi code.
2000-07-18 20:18:16 +00:00
Seigo Tanimura
fb0ef52838 Finally merge newmidi.
(I had been busy for my own research activity until the last weekend)

Supported devices:

SB Midi Port			(sbc + midi)
SB OPL3				(sbc + midi)
16550 UART			(midi, needs a trick in your hint)
CS461x Midi Port		(csa + midi)

OSS-compatible sequencer	(seq)

Supported playing software:

playmidi			(We definitely need more)

Notes:

/dev/midistat now reports installed midi drivers. /dev/sndstat reports
only pcm drivers. We need the new name(pcmstat?).

EMU8000(SB AWE) does not sound yet but does get probed so that the OPL3
synth on an AWE card works.

TODO:

MSS/PCI bridge drivers
Midi-tty interface to support general serial devices
Modules
2000-07-11 11:49:33 +00:00
Cameron Grant
e71eb9c328 do-nothing module that depends on all sound drivers 2000-07-03 21:00:44 +00:00
Cameron Grant
f314f3dad2 add module metadata. this is a hack, sound drivers will eventually present a
bus to which pcm, mixer, etc will attach.
2000-07-03 20:52:27 +00:00
Ollivier Robert
c790e2240e This is the patch to make my soundcard, a Creative Ensoniq AudioPCI (an
es1371 chip, device id 0x58801274 rev 0x02).

Submitted by:	Kenneth Wayne Culver <culverk@wam.umd.edu>
2000-07-02 14:17:41 +00:00
Cameron Grant
946e608646 add record channel irq timeouts too 2000-06-20 23:42:08 +00:00
Cameron Grant
e4d5b2502d fix a bug where opening for write would not fail if channel allocation failed
when playing, if we stall for 1s with no data advancing, abort and mark the
channel dead - fail all future operations
2000-06-20 23:27:12 +00:00
Cameron Grant
03cab0581f make mixer reads return the value written instead of the value set
people seem to want this even though it breaks oss spec compliance
2000-06-19 20:31:58 +00:00
Cameron Grant
fa5e422d98 replace a line erroneously removed in 1.28, should fix xmms
make buf_clear handle unaligned lengths
2000-06-17 19:29:40 +00:00
Cameron Grant
70776a9c0b add alpha-quality recording code and handle pci error interrupts - this may
prevent the card generating an nmi on ecc systems.  for now a message is
printed on every pci error and it seems every time we start playng we get one
2000-06-13 23:24:40 +00:00
Cameron Grant
20a874f116 handle closing differently - should fix the end-of-sample cutoff bug 2000-06-13 23:18:43 +00:00
Brian Somers
a54185c7ba Add (another) PnP entry for the ESS ES1869 (Compaq OEM)
Submitted by:	mdharnois@home.com
PR:		19206
2000-06-12 09:09:37 +00:00
Peter Wemm
a99bef94ed Untangle some #include between gusc.c/mss.c - gusc.c could create
an attachment node for something that may not have been compiled in.
2000-06-10 07:20:54 +00:00
Peter Wemm
cb73359d42 Unused include: #include "sbc.h" 2000-06-10 07:17:29 +00:00
Peter Wemm
83fc8b6d34 Unused includes: #include "pci.h", #include "pcm.h" 2000-06-10 07:15:15 +00:00
Dan Moschuk
7bf9834a55 Increase delay from 10mu to 1000mu when reading play control size. This
allows the YMF744 to initialize properly.
2000-06-09 16:44:30 +00:00
Cameron Grant
1a50bd2e37 handle duplex properly in the AIOGCAP ioctl - this may (partially?) fix rat 2000-06-07 11:51:30 +00:00
Cameron Grant
2f9aa04e7f this driver does not support the cs4281 and probably never will, different code
will be required
2000-06-06 22:42:57 +00:00
Cameron Grant
dafad92c7d support recording 2000-06-06 22:34:09 +00:00
Cameron Grant
20cdda004b improve recording 2000-06-06 22:30:22 +00:00
Cameron Grant
9c3268206d don't panic if we try to add a channel we said we wouldn't 2000-06-06 22:24:53 +00:00
Peter Wemm
3e0f102e57 With this evil hack the DS1 driver works on our Intel desktop
motherboards that use YMF740's.  It has a strange subvendor and subdevice
ID and requires a disturbingly long delay after the ac97 codec init.
Cameron hasn't had this driver tested on another 740 yet, so we don't know
if this is a quirk of all 740's, or if its just something about the codec
that Intel used.
2000-06-01 03:58:27 +00:00
Cameron Grant
17dbf67736 if a device has no play or no record channels, set its simplex flag. 2000-06-01 01:32:30 +00:00
Cameron Grant
e05327ee1b if we get bad values for playctrlsize, the firmware may not have initialised
yet so retry.
2000-06-01 01:29:05 +00:00
Cameron Grant
2176a9588a add a bit more diagnostic info for the bus_dmamap_load failure case 2000-05-31 19:04:12 +00:00
Cameron Grant
bd68ce8be9 yamaha ds1/ds1e pci sound driver - work in progress, mixer and playback only.
tested on ymf724f only.

conf/files entry is commented out, enable it manually to test this code and
let me know results.
2000-05-31 03:21:36 +00:00
Jun Kuriyama
81c0587fa1 Add more ESS1869 PnP Sound Card PnPid.
Submitted by:	MIHIRA Yoshiro
PR:		kern/17349
2000-05-29 07:43:51 +00:00
Peter Wemm
4cbef178df Use the correct name for a mapping register, not the old FreeBSD 2.x
compatability name.
2000-05-28 15:15:14 +00:00
Cameron Grant
94e3845ccd fix the return value of the SOUND_PCM_WRITE_CHANNELS ioctl
re-enable old pcm ioctls
2000-05-27 14:40:17 +00:00
Cameron Grant
d28089a10d move various fields from pcm_channel to snd_dbuf
improve chn_read code- don't stop/restart on overrun, just dump data

more error checking on ioctls
2000-05-26 21:55:13 +00:00
Cameron Grant
04553e63a5 if we have a codec init routine, fail the attach if init fails 2000-05-26 21:42:50 +00:00
Cameron Grant
35f9e4a1db handle emulated dma reads
don't try to get sample size from snd_dbuf
2000-05-26 21:15:47 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder
740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Yoshihiro Takahashi
d2fce85dba Oops, rman_get_bushandle() should be converted to rman_get_virtual()
if resources are mapped to memory.
2000-05-20 16:15:50 +00:00
Yoshihiro Takahashi
7c14268dbd Supported the mss on PC-98 and Sound Blaster 98.
Submitted by:	"T.Yamaoka" <taka@windows.squares.net>
2000-05-19 15:41:52 +00:00
Cameron Grant
942aeab734 fix a speed bug that nobody noticed 2000-05-15 02:10:27 +00:00
Poul-Henning Kamp
9626b608de Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by:    peter
2000-05-05 09:59:14 +00:00
Cameron Grant
52064e0a88 fix the 100% cpu in xmms issue 2000-05-04 19:06:34 +00:00
Poul-Henning Kamp
eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Cameron Grant
a618cffeb8 duh, i forgot to change a bitmask, sorry alexander
Submitted by:	Alexander Matey <matey@cis.ohio-state.edu>
2000-04-26 23:08:12 +00:00
Cameron Grant
dd1863690a fix minor numbers for multi-channel devices
Submitted by:	Alexander Matey <matey@cis.ohio-state.edu>
2000-04-26 20:06:52 +00:00
Cameron Grant
35d9c60d76 repo-copied to sys/gnu/dev/sound/pci/emu10k1.h 2000-04-26 19:53:46 +00:00
Cameron Grant
0ffbc64fe6 update for new location of emu10k1.h under sys/gnu 2000-04-26 19:51:19 +00:00
Cameron Grant
a0e22dd8db implement settrigger according to spec
fixes for non-blocking mode
2000-04-23 18:09:18 +00:00
Cameron Grant
f23598ec2c maybe make cmi8330 work - no feedback yet
implement bass/treble for yamaha opl-sax chips
2000-04-23 17:57:35 +00:00
Cameron Grant
19b6ac092e try the fix from creative bugzilla for nmi problem
Obtained from:	creative labs bugzilla
2000-04-18 19:11:38 +00:00
Cameron Grant
8ae4c159aa more mmap fixes 2000-04-17 17:06:47 +00:00
Cameron Grant
674c45bd04 make drivers start at beginning of buffer when triggered - improves mmap.
not all tested.

not sure about aureal.c or csapcm.c
2000-04-17 16:57:12 +00:00
Cameron Grant
603ddb6d5d make mmap sort-of work. there seem to be interactions with certain hw
drivers, so still work in progress.

do various mmap-related ioctls right.

improve blocksize control.

bits of cleanup.
2000-04-15 05:04:12 +00:00
Cameron Grant
7c7f2a4a81 make poll() dtrt, previously when playing it would trigger if there was less
than 1 byte ready to play instead of room for at least 1 byte to be written.
similarly for recording.
2000-04-05 05:54:02 +00:00
Cameron Grant
2d3ce9d56e decrease buffer size to 4k
use a seperate channel for generating irqs so we get a buffer-half-empty
interrupt, prevents repeating on underflow
2000-04-05 02:14:26 +00:00
Cameron Grant
bd18f33408 allow /dev/dsp to be opened seperately for reading and writing. 2000-04-05 01:13:42 +00:00
Cameron Grant
119a24a450 try increasing 2ndbuffer size to 64k 2000-04-05 00:56:02 +00:00
Cameron Grant
8b455f8d05 move buffer size definition to .c file for consistency, and reduce it to 4k 2000-04-05 00:38:00 +00:00
Cameron Grant
97b3c9d804 make the click on starting output go away 2000-04-04 02:16:15 +00:00
Cameron Grant
8046c76306 fix missing defines and prototype for emu_vdump() 2000-04-03 00:28:43 +00:00
Cameron Grant
c067afaa06 unfinished sblive driver, playback/mixer only for now - not enabled in
conf/files

i don't seem to be clearing the cache right resulting in a short initial
burst of noise, despite doing the same as creative and alsa.  i'm committing
now so more eyes can pore over the code.
2000-04-02 07:41:17 +00:00
Cameron Grant
e620d95952 fail in attach if we seem to have no ac97 codec 2000-04-01 22:24:03 +00:00
Cameron Grant
0a3eb835c2 bump the buffer size from 4k to 16k. should improve performance under load. 2000-04-01 21:28:09 +00:00
Cameron Grant
57376530f0 split up ess and sb code
rewrite ess mixer to use native registers
rewrite play/rec code to use more accurate timer when available
add code to use audio2 for playback, but disable it as no irqs are generated
2000-03-28 18:31:01 +00:00
Cameron Grant
6b4b88f7a2 don't check extended features on codecs known to hang. should fix neomagic
problems.
2000-03-24 03:14:35 +00:00
Cameron Grant
87374c3d7a toast warnings on i386 2000-03-20 15:50:08 +00:00
Cameron Grant
3252a47be9 make als120 cards which report dsp version 3.x whilst only supporting 4.x
and *not* 3.x commands work
2000-03-20 15:34:27 +00:00
Cameron Grant
39004e693d update the ac97 layer:
* add a callback for initialising the mixer interface
* support ac97 2.1 variable rate audio feature

fix ac97-using drivers for the above

add suspend/resume support for neomagic
2000-03-20 15:30:50 +00:00
Cameron Grant
a0b4946276 add a function to reinitialize the mixer, to be called by drivers on
resuming after suspend
2000-03-20 15:21:50 +00:00
Nick Hibma
efb572af98 Spelling mistake 2000-03-15 22:11:00 +00:00
Poul-Henning Kamp
d8b47cbb70 Stop isadma from abusing the B_READ, B_RAW and B_WRITE flags.
Define ISADMA_{READ,WRITE,RAW} macros with the same numeric
values as the B_{READ,WRITE,RAW} and use them instead throughout.
2000-03-13 10:19:32 +00:00
Seigo Tanimura
ca6da1de5e Add the logical ID of Avance Logic ALS100. The vendor ID is also
checked, which was introduced in 1.18.

PR:		kern/16487
Submitted by:	Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de>
Approved by:	jkh
2000-03-09 02:13:21 +00:00
Cameron Grant
1a7d73a130 Partial fix: the following patch correctly configures the card for dual
channel DMA. The problem was that the SDC bit (0x04) can only be set in
the MCE state.

PR:		kern/16587
Submitted by:	Matthew Reimer <mreimer@vpop.net>
Approved by:	jkh (in person)
2000-03-05 15:51:09 +00:00
Cameron Grant
73bd6f4aab fix ess end-of-buffer repeating
Submitted by:	nhibma
Approved by:	jkh
2000-02-14 23:37:02 +00:00
Peter Wemm
5775b1a2b6 Tidy up stray or bogus #if NFOO > 0 and #include "foo.h". 2000-01-29 18:48:30 +00:00
Peter Wemm
96e00123b4 Remove a rather bizzare set of #ifdefs and #defines that all worked out
to be a NO-OP.
2000-01-29 18:44:01 +00:00
Cameron Grant
a05382d9ae differentiate cmi8330 and als100 pnp cards based on their vendor id. this
is a kludge for 4.0
2000-01-29 00:18:29 +00:00
Andrew Gallatin
de6d75328e Add support for detection of the ESS 1688 found on my Dell Latitude LM 2000-01-28 04:28:11 +00:00
Cameron Grant
45248baa3c handle simplex devices right 2000-01-26 20:27:45 +00:00
Peter Wemm
a3a2b1e1b2 Note the PnP id's for the NMX2210 next to the id's where they are used.
The pnpbios doesn't supply a description in the case we've seen so
supply one.
2000-01-23 13:17:03 +00:00
Seigo Tanimura
8f7076b8ff The pointer of the serial FIFO in the DSP seems to make an error
upon starting/stopping the DSP. Correct the pointer in addition
to clearing the FIFO.
2000-01-23 07:04:02 +00:00
Cameron Grant
f2410ff244 kludge to fix the end-of-sample repeating bug. i don't know why it happens;
none of my hw does it, but this should fix it for now.

Tested by:	wpaul
2000-01-18 18:59:03 +00:00
Cameron Grant
03a00905d3 update ac97 layer to use device_printf when printing messages 2000-01-18 17:13:43 +00:00
Peter Wemm
615407b5a0 Some SB128's (ES1371) have a different PCI vendor id. Vendor == 0x3274
instead of the normal 0x1274.

Tested by:	des
2000-01-17 07:54:00 +00:00
Cameron Grant
9bc502089a fix missing \n in sndstat output 2000-01-16 12:52:22 +00:00
Cameron Grant
0a12fe07e7 oops, best play format was set to unsigned 16 bit instead of signed 16 bit
stereo.  remenant from testing.
2000-01-16 12:05:07 +00:00
Cameron Grant
724efc44ec attach to non-ac97 neomagic chips and hope that ac97 ones do not have the
same pnpbios id
2000-01-13 06:11:32 +00:00
Cameron Grant
5b4c3f3ca0 be less verbose 2000-01-13 06:00:57 +00:00
Daniel Eischen
d404cb51ee Add support for detection of the ESS 1878 chip. 2000-01-12 11:16:23 +00:00