Commit Graph

132 Commits

Author SHA1 Message Date
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
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
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
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
6e64c174bd prevent excessively small buffer sizes resulting in hundreds of irqs per
second
2001-01-24 01:15:50 +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
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
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
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
6a6ee5bb35 compensate for broken codecs that return 0xffff on unimplemented registers
instead of 0.
2000-12-24 03:33:21 +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
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
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
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
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
d16b567379 implement SNDCTL_DSP_POST 2000-10-27 22:20:45 +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
c0960a5e91 handle AFMT_QUERY right 2000-10-26 01:34:54 +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
Cameron Grant
341f16cc60 dynamify- probe codec for supported channels
add channel mappings for mixer
2000-09-17 23:51:00 +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
cd2c103ae0 initial support for multiple ac97 codecs 2000-09-05 21:08:01 +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
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
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
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
071280d442 MFS: module macro changes 2000-08-09 18:46:48 +00:00
Cameron Grant
1874ec255c MFS: sync with peter's isadma fixup 2000-08-09 01:22:09 +00:00