summaryrefslogtreecommitdiff
path: root/sys/dev/pci/emuxki.c
AgeCommit message (Collapse)Author
2022-10-26Make audio(9) get_props() optional, remove it from duplex driversKlemens Nanni
The property bits of audio(9) are obsolete and ought to be removed completely. sys/dev/audio.c:audio_open() currently uses get_props() to bail out if read *and* write was requested on a non-duplex driver. Drivers that currently support playing but not recording need adjustment before the API can be cleaned up. Drivers that advertise themselves as full duplex, i.e. those that always return AUDIO_PROP_FULLDUPLEX unconditionally in their get_props() currently always succeed this check. As this is the only property, losen audio_open()'s DIAGNOSTIC check and only do the duplex check if the driver provides get_props(). This allows for simple removal of get_props() from full-duplex drivers without adding any other code or without changing functionality. This includes all audio drivers under sys/dev/pci/ (maestro(4) being the only unfinished exception here). Other drivers as well as the API change can then follow in smaller diffs. This builds on amd64, arm64, i386, macppc and sparc64. amd64 with azalia(4) still plays, records as well as plays and records at the same time on my X230 as tested with $ aucat -i play.wav [-o rec.wav] alpha and hppa tests by miod OK ratchov miod
2022-10-19Use C99 struct init for struct audio_hw_ifKlemens Nanni
This audio(9) struct will lose a member, but drivers init their struct quite inconsistently, most pre-C99 style. Use C99 style everywhere, to get rid of all annoying differences and allow for easy member removals/additions: - don't change current order of members - no explicit NULL members - no comments or blank lines - trailing comma in last member line GENERIC.MP builds fine with this on arm64, amd64, i386 and sparc64. macppc and alpha build-tested by miod OK ratchov miod
2022-10-18Remove unused AUDIO_PROP_{MMAP,INDEPENDENT}Klemens Nanni
AUDIO_PROP_FULLDUPLEX is the only audio(9) in use, the other two died with commit 1cf2860827c8ca659d8097d8da94a5ae5b888c53 Author: ratchov <ratchov@openbsd.org> Date: Thu Jun 25 06:43:45 2015 +0000 Reimplement the audio driver in a simpler way, removing unused/unusable functionality. Same API and ABI except for the removed bits and no behaviour change for programs using libsndio. With help from armani@ and mpi@, thanks. but remained defined and set in drivers. and the following merely moved them when they were dead code already: commit 9215aa3dfad387bca877a805534df6dcfe8722eb Author: ratchov <ratchov@openbsd.org> Date: Wed Aug 31 07:22:43 2016 +0000 Delete unused ioctls and associated macros. Move macros that are still used internally by low-level drivers from sys/audioio.h to dev/audio_if.h instead of deleting them. None of this is used in base or ports; codesearch.debian.net only shows AUDIO_PROP_{CAPTURE,PLAYBACK} in firefox-esr, mozjs and cubeb. ratchov points out that audio_if.h and audioio.h are private interfaces and the codesearch shows SunOS and NetBSD bits (#ifdef'd out on OpenBSD). OK ratchov
2022-03-21Constify struct {audio,midi,radio,video}_hw_if. No functional change.Miod Vallat
ok mpi@ ratchov@ "More const is good" deraadt@
2022-03-11Constify struct cfattach.Martin Pieuchot
2022-02-16Make room for a cookie argument passed to audio_attach_mi(). CurrentlyAnton Lindqvist
unused but intended to be used to correlate audio and wskbd devices. ok ratchov@
2022-01-09spellingJonathan Gray
feedback and ok tb@ jmc@ ok ratchov@
2020-06-17Do not do logical negation of a bitshifted field.mortimer
Prompted by warning from clang 10. ok patrick@
2018-09-13clarify that config_activate_children() is called unconditionally in ↵miko
*activate(). ok ratchov@
2017-09-08If you use sys/param.h, you don't need sys/types.hTheo de Raadt
2016-09-19Remove unused getdev() audio driver functions.Alexandre Ratchov
2016-09-14Remove drain(), query_encoding(), mappage() and get_default_params()Alexandre Ratchov
methods from all audio drivers and from the audio_if structure as they are never called.
2015-08-11Don't inline long functions as this tends to increase object sizeAlexandre Ratchov
with no benefit. ok millert, "correct" deraadt
2015-05-11Remove all audio format conversion code from the kernel (btw holdingAlexandre Ratchov
the kernel_lock), as we already do better conversions in user-mode. Yet, no need for every single driver to fiddle with the conversion code as they are done transparently by common MI code. With help from armani and miod, support from mpi ok armani@
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2014-07-13Some reallocarray() use; review Jean-Philippe Ouellet, patrick keshishianTheo de Raadt
ok tedu
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2013-12-06Add a DVACT_WAKEUP op to the *_activate() API. This is called after theTheo de Raadt
kernel resumes normal (non-cold, able to run processes, etc) operation. Previously we were relying on specific DVACT_RESUME op's in drivers creating callback/threads themselves, but that has become too common, indicating the need for a built-in mechanism. ok dlg kettenis, tested by a sufficient amount of people
2013-06-23Remove unsigned comparison < 0.Brad Smith
Pointed out by LLVM. ok ratchov@
2013-05-24Since audio code is mp safe, establish isa and pci audio interruptsAlexandre Ratchov
with the IPL_MPSAFE flag. In certain circumstances, this prevents interrupt handlers from waiting the global kernel_lock possibly (hold by slower code) to be released. ok kettenis
2013-05-15Introduce a global interrupt-aware mutex protecting dataAlexandre Ratchov
structures (including sound-card registers) from concurent access by syscall and interrupt code-paths. Since critical sections remain the same, calls to splraise/spllower can be safely replaced by calls to mtx_enter/mtx_leave with two exceptions: (1) mutexes are not reentrant (the inner splraise is thus removed), and (2) we're not allowed to sleep with a mutex (either msleep is used or the mutex is released before sleeping). ok and help from kettenis, a lot of work from armani
2011-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
2011-06-17M_WAITOK cleanup of two cases:Michael Knudsen
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is pointless (malloc() will panic if it can't allocate) so remove the check and the call. 2) Allocating with M_WAITOK, checking for NULL, and then gracefully handling failure to allocate is pointless. Instead also pass M_CANFAIL so malloc() doesn't panic so we can actually handle it gracefully. 1) was done using Coccinelle. Input from oga. ok miod.
2011-04-03use nitems(); no binary change for drivers that are compiled on amd64.Jasper Lievisse Adriaanse
ok claudio@
2010-09-12silly me. use the switch() variable, not the case value.Jacob Meuser
2010-09-12autoconf activate suspend/resume for emu(4). uses audio(4)Jacob Meuser
DVACT_{QUIESCE,RESUME}. not 100% right yet. after resume, interrupts, DMA, and the mixer appear to be working, but no sound is produced. cookie for whoever finds the problem.
2010-09-10the open() functions give us flags like FREAD and FWRITE from sys/fcntl.h.Jacob Meuser
the AUOPEN_ macros from sys/dev/audiovar.h are for something else.
2010-07-15add two new members to structs audio_encoding and audio_prinfo.Jacob Meuser
for both structs, the new members are 'bps' and 'msb', which describe the number of bytes per sample and data alignment in the sample, respectively. drivers must properly set these fields in the 'query_encoding', 'set_parameters' and 'get_default_params' hardware interface methods. discussed with ratchov, deraadt
2009-03-29make various strings ("can't map mem space" and similar) more consistentStuart Henderson
between instances, saving space in the kernel. feedback from many (some incorporated, some left for future work). ok deraadt, kettenis, "why not" miod.
2008-12-09Replace the sc_type/sc_details enum's in the softc struct with a sc_flagsBrad Smith
flags field and use the flags as appropriate. ok jakemsg@
2008-10-29support for Audigy 2 Value based on patch from Dennis SuhoninJacob Meuser
(openlunatic at gmail). tested by Dawe (dawedawe at gmx de), thanks, and me. does not disturb currenlty working emu(4) devices.
2008-10-25audio(9) says low level drivers are allowed to change the requestedJacob Meuser
values of the audio_params structure during AUDIO_SETINFO if the hardware cannot be set to exactly the requested mode. some drivers do this sometimes. others always return EINVAL if there isn't an exact match. be more consistent. only return EINVAL if an absurd parameter was requested, otherwise return a supported set of parameters, as close as possible to what was requested. with/ok ratchov@
2008-06-26First pass at removing clauses 3 and 4 from NetBSD licenses.Ray Lai
Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
2008-05-29use ac97 default parameters for these ac97 based drivers.Jacob Meuser
this makes the emulation expansion factor 1 by default since there's no emulation. previously the factor was 2 because these drivers emulate 8-bit ulaw playback with 16-bit linear encodings. having a factor other than 1 by default creates block size and hiwat/lowat issues with applications that set the block size and hiwat before other parameters. ok ratchov@
2008-04-21allow low level audio drivers to specify a default sample format,Jacob Meuser
instead of 8-bit mono mulaw @ 8kHz. this is just the infrastructure; no drivers are specifying a default yet. ok ratchov@, deanna@
2008-03-10the Dell SoundBlaster Live! 5.1 cards differ enough from "regular"Jacob Meuser
SB Live!/5.1/Audigy/2/4 cards that both OSS and ALSA provide separate modules from their emu10k1 drivers to support them. and in PR 5143, we see that emu(4) does not support these Dell SBLive! cards, so don't attach emu(4) to them. ok ratchov, brad
2008-02-22as can be seen in emuxki_voice_set_srate(), the sample rate needs toJacob Meuser
be set separately on each channel. if changing the number of channels make sure to set the sample rate on each channels. fixes problems with src/regress/sys/dev/audio/autest.c, and the hydrogen port/package, which set stereo mode either after or without changing sample rates. ok ratchov@
2007-07-10emu(4) incorrectly overrides the requested recoding format, settingJacob Meuser
it to 16-bit slinear_le. this appears to be the result of a mistake in porting the driver from NetBSD. when this driver was ported, NetBSD had some members in it's 'audio_params' structure that OpenBSD doesn't have. in particular, NetBSD had 'hw_encoding' and 'hw_precision', which store what the hardware is presenting. the 'encoding' and 'precision' members store what the audio layer is presenting (both in NetBSD and OpenBSD) and can be different than what the hardware is presenting. the original NetBSD code was setting 'hw_encoding' and 'hw_precision', and in porting was changed to 'encoding' and 'precision'. with this change the hardware is still presenting 16-bit slinear_le; having the variable 'b16' set to '1' is enough to ensure this. however now the audio layer will convert it to the requested format, instead of always outputting 16-bit slinear_le.
2006-01-20- match another revision of Audigy cardsJacob Meuser
- figure sample size into start of voice buffer location
2005-11-30- add initial SB Audigy supportBrad Smith
- add big-endian support - fix a few typos From NetBSD - use pci_matchbyid() Known working SB Live's tested by numerous users with no reported regressions; though no one has stepped up to test out the Audigy support yet. ok deraadt@
2005-11-21Move contents of sys/select.h to sys/selinfo.h in preparation for aTodd C. Miller
userland-visible sys/select.h. Consistent with what Net and Free do. OK deraadt@, tested with full ports build by naddy@.
2005-08-09do not set PCI_COMMAND_MASTER_ENABLE explicitly as it's already set in ↵Michael Shalayeff
pcisubmatch(); kettenis@ testing; brad@ ok
2004-09-02Prevent mixer from resetting volume back to blead-from-the-ears.Marco Peereboom
From NetBSD via Antoine Jacoutot <ajacoutot at lphp.org> Ok millert@ mickey@ deraadt@
2004-04-14make it compileMichael Shalayeff
2004-04-14another SoundBlaster LiveBrad Smith
From: NetBSD ok mickey@
2004-02-24record code, from netbsd; via jakemsr@jakemsr.comTheo de Raadt
2003-11-07adress -> address, and a few more; all from Jonathon Gray;Jason McIntyre
(mvme68k/mvme88k) vs.c and (vax) if_le.c ok miod@ isakmpd ones ok ho@
2003-04-27strcpy/sprintf cleanup of sys/dev. miod@, deraadt@ says to commit.Hakan Olsson
2003-04-26managment -> management;Jason McIntyre
ok mickey@
2003-02-18intial -> initialJason McIntyre
ok mickey@