Commit Graph

40 Commits

Author SHA1 Message Date
Josef El-Rayes
ae6d3a22dc Fix uninitialized variable, that breaks the build.
Approved by: hmp
Reviewed by: chris
Pointy hat to: josef (for ignoring warning)
2004-06-25 16:34:33 +00:00
Josef El-Rayes
8ba7f5cfee Change the possibility to configure pcm(4) via boot/loader.conf
to use boot/device.hints now

As discussed on cvs-src@

Reviewed by:	Hiten Pandya <hmp@backplane.com>
2004-06-24 17:41:20 +00:00
Josef El-Rayes
9d12118e78 Enable pcm to read kenv variables to set default values for
mixer channels.

e.g.: pcm0.line=0

to muten input line per default.

Approved by:    cg
Reviewed by:    le, stefanf
Requested by:   Eugene Grosbein <eugen@grosbein.pp.ru> (implicitly)
PR:             kern/63771
2004-06-20 15:38:11 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
4555065861 As previously announced: discontinue use of makedev() call in soundcode.
This takes us a lot closer to refcounting dev_t.

This patch originally by cg@ with a few minor changes by me.

It is largely untested, but has been HEADSUP'ed twice, so presumably
people have not found any issues with it.

Submitted by:	cg@
2004-01-17 10:37:11 +00:00
Scott Long
42c3555cff Fix sound LOR problems:
dsp_open: rearrange to only hold one lock at a time

dsp_close: ditto

mixer_hwvol_init: delete locking, the only consumer seems to
be the ess driver and it only call it a creation time, I
think the device will be stable across the sleepable malloc.

cmi interrupt routine: Release locks while caller chn_intr,
either this or do what emu10k1 does which is have no locks
at in the interrupt handler.

Submitted by:	mat@cnd.mcgill.ca
2003-11-11 05:38:28 +00:00
Cameron Grant
3f22597838 update my email address. 2003-09-07 16:28:03 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Cameron Grant
00acb1337e (hopefully) fix build breakage some people are seeing
Approved by:	re
2002-11-26 18:16:27 +00:00
Brian Feldman
ca33ae2367 Fix some of the places where sound(4) can sleep with a lock held. (Help
courtesy of fenner).
2002-07-25 04:49:45 +00:00
Mark Murray
64d85ef750 Use semicolons at the end of function-like macros for the sake of
consistency, style and future cleanliness.
2002-07-15 13:03:10 +00:00
John Baldwin
489c22ebb8 Add lock type arguments to callers of snd_mtxcreate(). 2002-04-04 20:56:47 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Cameron Grant
1662598f0c MFS: allow multiple opens of mixer devices 2001-08-23 11:56:07 +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
Cameron Grant
4712b1eba1 set default 'monitor' volume (ac97 headphones) to 75% 2001-07-01 18:53:24 +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
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
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
82db23e2af MFS: 4.x/5.x compatibility #ifdefs 2001-02-27 07:01:49 +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
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
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
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
Peter Wemm
8ac2d635c4 Fix warnings by moving static functions before they are used. 2000-09-03 05:32:09 +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
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
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
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
Cameron Grant
ef9308b1ce repo-copied to make way for newmidi, this commit updates include paths 1999-11-20 16:50:33 +00:00
Cameron Grant
0513a1a1cb set default ogain to 50 since some sb cards produce no sound at 0 1999-11-15 23:22:52 +00:00
Peter Wemm
53c5a968fe $Id$ -> $FreeBSD$ 1999-09-01 06:58:27 +00:00
Cameron Grant
987e59726a say hello to newpcm. it is not yet enabled, requiring new pnp code from dfr
to compile successfully.  further details will be provided in the commit
enabling newpcm.
1999-09-01 04:08:39 +00:00