summaryrefslogtreecommitdiffstats
path: root/sys/dev/audio.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Set byte order the default encoding in the attach method toratchov2016-01-201-2/+6
| | | | | | native byte order. No behaviour change, as attach time parameters are just hints, except thay this makes audioctl output nicer if the device was never opened.
* missing breakjsg2016-01-091-1/+2
| | | | ok ratchov@ deraadt@
* "harware" -> "hardware"mmcc2015-12-141-2/+2
|
* Fix condition used while seaching candidates for "record level"ratchov2015-09-041-3/+5
| | | | | control for wskbd. This may fix "record level" keys on certain keyboards.
* Fix spacing and be more verbose in printfs under #ifdef AUDIO_DEBUG.ratchov2015-07-291-4/+6
| | | | No binary change.
* add missing space, from Donovan Watteau <tsoomi at gmail.com>ratchov2015-07-281-2/+2
| | | | thanks!
* In case the system misses enough audio interrupts for DMAratchov2015-07-281-3/+46
| | | | | | | | pointers to wrap, recover by detecting and compensating for the missed interrupts. Fixes certain audio hangs on MP machines. with help from armani@, typos fixed by Alexey Suslikov
* Add the AUDIO_GETPOS ioctl() to fetch a snapshot of the 4 countersratchov2015-07-281-4/+14
| | | | | | returned by AUDIO_GETxOFFS and AUDIO_xERROR ioctls. ok deraadt
* Switch back into counting bytes rather than blocks. We can't justratchov2015-07-241-12/+14
| | | | | multiply the block count by the block size to get the bytes count because they won't wrap correctly.
* Represent the current stream position in blocks rather than bytesratchov2015-07-221-12/+12
| | | | just because it's simpler this way. No behaviour change.
* Reimplement the audio driver in a simpler way, removing unused/unusableratchov2015-06-251-3133/+1498
| | | | | | 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.
* LITTE_ENDIAN -> LITTLE_ENDIANjsg2015-05-221-2/+2
| | | | ok ratchov@
* Remove all audio format conversion code from the kernel (btw holdingratchov2015-05-111-71/+100
| | | | | | | | | 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@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-4/+4
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* Let a volume key event unmute. This makes the software state follow thekettenis2015-02-071-1/+13
| | | | | | | hardware behaviour on Thinkpads making it harder for software state and hardware state get out of sync. ok deraadt@
* remove the second void * argument on tasks.dlg2015-01-271-4/+4
| | | | | | | | | | | | | | | | | | | | | when workqs were introduced, we provided a second argument so you could pass a thing and some context to work on it in. there were very few things that took advantage of the second argument, so when i introduced pools i suggested removing it. since tasks were meant to replace workqs, it was requested that we keep the second argument to make porting from workqs to tasks easier. now that workqs are gone, i had a look at the use of the second argument again and found only one good use of it (vdsp(4) on sparc64 if you're interested) and a tiny handful of questionable uses. the vast majority of tasks only used a single argument. i have since modified all tasks that used two args to only use one, so now we can remove the second argument. so this is a mechanical change. all tasks only passed NULL as their second argument, so we can just remove it. ok krw@
* rework the audio key handling to allocate a message to send to thedlg2015-01-201-22/+32
| | | | | | | | | | | task, rather than abusing task arguments to carry long values around. this is unreliable, but so was the previous mechanism, just in a different way. if you're so low on memory that you cant change the volume, you probably have other more important problems going on too. tested by jim smith
* Use <sys/endian.h> instead of <machine/endian.h>guenther2014-12-191-3/+2
| | | | ok dlg@ mpi@ bcook@ millert@ miod@
* Replace a plethora of historical protection options with justderaadt2014-11-161-8/+8
| | | | | | | PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-3/+3
| | | | after discussions with beck deraadt kettenis.
* fix format mistakes visible if AUDIO_DEBUG is definedratchov2014-05-191-13/+13
|
* don't do a timeout+task song and dance, instead use DVACT_WAKEUP directly.deraadt2013-12-171-33/+12
| | | | | | There will be slight burps on resume due to other drivers being slow with wakeup. ok kettenis ratchov
* Add a DVACT_WAKEUP op to the *_activate() API. This is called after thederaadt2013-12-061-6/+4
| | | | | | | | 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
* the stuff in audiovar.h is only used in audio.c, so move it in there todlg2013-11-281-2/+121
| | | | | | | | take the temptation of using it elsewhere and fumbling with audio internals away from the rest of the kernel. ok mpi@ ratchov@ "if it is worth doing, just do it." deraadt@
* Convert wskbd_set_mixervolume() to use a task internally instead ofmpi2013-11-041-24/+45
| | | | | | being called in a workq. ok kettenis@
* replace workqs with tasks.dlg2013-10-301-4/+4
| | | | ok mpi@
* Introduce a global interrupt-aware mutex protecting dataratchov2013-05-151-114/+92
| | | | | | | | | | | | | 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
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-3/+1
| | | | | | | | 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
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* Microphone mute button support from acpithinkpad (or elsewhere).deraadt2011-06-061-9/+12
| | | | | | | The audio side is a bit lacking; it does not yet mute all types of devices. from Alexander Polakov ok jakemsr
* Don'tmiod2010-11-181-10/+3
| | | | | | | | | #include "foo.h" #if NFOO > 0 (whole file) #endif since config(8) file inclusion rules already do it for you. ok deraadt@
* change quiescing to not call the audio_hw_if halt method in interruptjakemsr2010-09-211-13/+22
| | | | | context, because drivers (like eso(4) and envy(4)) might want to sleep in their halt method.
* DVACT_{QUIESCE,RESUME} for audio(4)jakemsr2010-09-121-2/+148
| | | | | | | | | | | | | | | | | | DVACT_QUIESCE: 1) waits until ringbuffer current position wraps back to the start of the buffer 2) stops playback and/or recording by way of the hardware drivers' "halt" audio_hw_if method 3) blocks userland access to audio device 4) saves the current state of the master mute, then mutes it DVACT_RESUME: 1) reprogram hardware stream parameters for playback or recording if they were active at DVACT_QUIESCE by way of hardware drivers' "set_params" audio_hw_if method 2) start playback or recording if they were active at DVACT_QUIESCE by way of hardware drivers' "trigger" or "start" audio_hw_if method 3) restores master mute state as it was at DVACT_QUIESCE 4) wakes up blocked userland processes accessing the hardware
* add two new members to structs audio_encoding and audio_prinfo.jakemsr2010-07-151-22/+53
| | | | | | | | | | 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
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-2/+1
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* in the get_default_parameters method, give the low level drivers ajakemsr2009-10-271-5/+5
| | | | | | | pointer to the low level driver's softc, not audio's softc. nothing is actually using this yet. ok ratchov
* Get rid of devact enum, substitute it with an int and coresponding defines.pirofti2009-10-131-3/+3
| | | | | | This is needed for the addition of further suspend/resume actions. Okay deraadt@, marco@.
* fix previous: start playback when at least one block of data hasjakemsr2009-06-181-8/+8
| | | | | | | been written to the device, instead of waiting for a write(2) when the buffer is or will be over the high water mark. ok ratchov@
* don't call uiomove(9) at IPL_AUDIO, slightly simplify the coderatchov2009-03-211-85/+46
| | | | help from and ok jakemsr
* first stage of removing ``copying & needfeel'' flags thatratchov2009-03-161-72/+30
| | | | | | make the audio driver missing blocks and, thus, breaking full-duplex apps. help and ok jakemsr
* deal with sample precisions that are not a power of 2.jakemsr2009-01-161-14/+14
| | | | discussed with and ok ratchov; manpage tweak from naddy, thanks
* for devices that do not allow independent setting of recording andjakemsr2008-10-301-2/+2
| | | | | | | | playback parameters (like the macppc i2s devices), be sure to synchronise recording parameters to playback parameters when configuring for full-duplex operation, as audio(4) dictates. ok ratchov
* audio(9) says low level drivers are allowed to change the requestedjakemsr2008-10-251-9/+9
| | | | | | | | | | | | | | 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@
* account for data expansion due to emulation in AUDIO_GET{I,O}OFFSjakemsr2008-09-291-5/+5
| | | | | | ioctls. ok ratchov@
* 'flus' -> 'flush', 'waitinf' -> 'waiting'. From Dawe via tech@.krw2008-08-101-2/+2
|
* When paused (or overrun), the record ring pointers are not incrementedratchov2008-07-291-1/+5
| | | | | | | | | properly in audio_rint(), the periodic boundary conditions aren't met. This causes, later read(2) to return EFAULT while trying to access unmapped regions of the kernel address space. Fix this by using the correct pointer arithmetic. ok jakemsr@
* allow low level audio drivers to specify a default sample format,jakemsr2008-04-211-7/+20
| | | | | | | | | instead of 8-bit mono mulaw @ 8kHz. this is just the infrastructure; no drivers are specifying a default yet. ok ratchov@, deanna@
* if full-duplex is being turned on, also set the oprtational mode tojakemsr2008-04-041-2/+10
| | | | | | for both recording and playback. ok ratchov
* add audio(4) driver the ability to use different block sizes for play andratchov2008-03-221-18/+45
| | | | | | | | record modes. This makes possible to have blocks of the same duration if the play and record formats are different. The API change is backward compatible, so it shouldn't be noticed by current audio ports. ok jakemsr