OpenBSD CVS

CVS log for src/sys/dev/audio.c


[BACK] Up to [local] / src / sys / dev

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.207 / (download) - annotate - [select for diffs], Fri Jun 7 08:48:10 2024 UTC (3 days, 13 hours ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.206: +1 -3 lines
Diff to previous 1.206 (colored)

remove unused IPL_SOFTAUDIO define, missed in rev 1.200

Revision 1.206 / (download) - annotate - [select for diffs], Fri Feb 10 14:34:16 2023 UTC (15 months, 4 weeks ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.205: +3 -3 lines
Diff to previous 1.205 (colored)

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@

Revision 1.205 / (download) - annotate - [select for diffs], Tue Nov 8 17:53:01 2022 UTC (19 months ago) by kn
Branch: MAIN
Changes since 1.204: +2 -2 lines
Diff to previous 1.204 (colored)

fix indent

Revision 1.204 / (download) - annotate - [select for diffs], Wed Nov 2 10:41:34 2022 UTC (19 months, 1 week ago) by kn
Branch: MAIN
Changes since 1.203: +1 -9 lines
Diff to previous 1.203 (colored)

Remove audio(9) speaker_ctl(), let open() handle speakers where needed

Only five legacy half-duplex hardware drivers require this function to
change between playing and recording:
	i386: ess(4), gus(4), pas(4), sb(4)
	luna88k: nec86(4)

If defined, it is always called early in audio_open(), so just move the
call from audio(4) to each hardware driver's open() handler.

SPKR_ON/OFF remain defined to leave driver-specific code unchanged.

Further cleanup (unchecked speaker_ctl() return values,
FWRITE -> AUMODE_PLAY -> SPKR_ON dances, etc.) can happen later.

Builds fine on i386.
OK ratchov

Revision 1.203 / (download) - annotate - [select for diffs], Fri Oct 28 15:13:59 2022 UTC (19 months, 1 week ago) by kn
Branch: MAIN
Changes since 1.202: +1 -10 lines
Diff to previous 1.202 (colored)

Remove unused audio(9) get_props()/AUDIO_PROP_FULLDUPLEX

All audio drivers have been cleaned up and, if needed, now check for duplex
mode in their open() handler.

OK ratchov miod

Revision 1.202 / (download) - annotate - [select for diffs], Wed Oct 26 20:19:07 2022 UTC (19 months, 2 weeks ago) by kn
Branch: MAIN
Changes since 1.201: +9 -9 lines
Diff to previous 1.201 (colored)

Make audio(9) get_props() optional, remove it from duplex drivers

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

Revision 1.201 / (download) - annotate - [select for diffs], Wed Oct 19 19:59:06 2022 UTC (19 months, 3 weeks ago) by kn
Branch: MAIN
Changes since 1.200: +1 -6 lines
Diff to previous 1.200 (colored)

Remove unused setfd member from struct audio_hw_if

All consumers now use C99 struct init and none of them sets `.setfd'.

OK ratchov miod

Revision 1.200 / (download) - annotate - [select for diffs], Sun Jul 31 03:31:36 2022 UTC (22 months, 1 week ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.199: +32 -87 lines
Diff to previous 1.199 (colored)

Replace selwakeup() with KNOTE() in audio(4)

KNOTE() is safe to use at IPL_AUDIO. Remove the now-unnecessary
deferring that uses soft interrupts.

Remove selwakeup() calls from audio_detach() because klist_invalidate()
wakes up any remaining kevent/poll/select waiters.

OK mpi@

Revision 1.199 / (download) - annotate - [select for diffs], Sat Jul 2 08:50:41 2022 UTC (23 months, 1 week ago) by visa
Branch: MAIN
Changes since 1.198: +1 -62 lines
Diff to previous 1.198 (colored)

Remove unused device poll functions.

Also remove unneeded includes of <sys/poll.h> and <sys/select.h>.

Some addenda from jsg@.

OK miod@ mpi@

Revision 1.198 / (download) - annotate - [select for diffs], Mon Mar 21 19:22:39 2022 UTC (2 years, 2 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.197: +5 -4 lines
Diff to previous 1.197 (colored)

Constify struct {audio,midi,radio,video}_hw_if. No functional change.

ok mpi@ ratchov@ "More const is good" deraadt@

Revision 1.197 / (download) - annotate - [select for diffs], Tue Feb 22 07:34:06 2022 UTC (2 years, 3 months ago) by visa
Branch: MAIN
Changes since 1.196: +56 -39 lines
Diff to previous 1.196 (colored)

Make audio(4) event filters MP-safe

Add f_modify and f_process callbacks, and initialize the knote lists
to use audio_lock. This makes audio_lock cover the device's knote
processing.

OK mpi@

Revision 1.196 / (download) - annotate - [select for diffs], Wed Feb 16 06:23:42 2022 UTC (2 years, 3 months ago) by anton
Branch: MAIN
Changes since 1.195: +39 -6 lines
Diff to previous 1.195 (colored)

Currently, wskbd_set_mixervolume() only adjusts the volume of the first
attached audio device, i.e. audio0. This approach does not work well
while using additional audio devices equipped with physical volume keys
since those would only affect the volume of audio0.

Instead, correlate audio and ucc devices attached over USB in order to
adjust the volume of the correct audio device. This is done by passing a
cookie from the common point of attachment which is later used to
correlate the audio and wskbd device.

The same approach could be adopted for audio and wskbd devices attaching
on a different bus. Keep in mind that it's of importance to make use of
and increment the same global cookie identifier to avoid collisions.

Makes the volume keys on my Logitech G435 Headset do the right thing.

ok ratchov@

Revision 1.195 / (download) - annotate - [select for diffs], Wed Feb 16 06:21:18 2022 UTC (2 years, 3 months ago) by anton
Branch: MAIN
Changes since 1.194: +5 -2 lines
Diff to previous 1.194 (colored)

Make room for a cookie argument passed to audio_attach_mi(). Currently
unused but intended to be used to correlate audio and wskbd devices.

ok ratchov@

Revision 1.194 / (download) - annotate - [select for diffs], Sun Jan 9 05:42:36 2022 UTC (2 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.193: +2 -2 lines
Diff to previous 1.193 (colored)

spelling
feedback and ok tb@ jmc@ ok ratchov@

Revision 1.193 / (download) - annotate - [select for diffs], Sun May 16 15:12:37 2021 UTC (3 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.192: +3 -3 lines
Diff to previous 1.192 (colored)

panic does not require a \n at the end.  When one is provided, it looks wrong.

Revision 1.192 / (download) - annotate - [select for diffs], Fri Dec 25 12:59:51 2020 UTC (3 years, 5 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.191: +5 -5 lines
Diff to previous 1.191 (colored)

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@

Revision 1.191 / (download) - annotate - [select for diffs], Tue May 19 06:32:24 2020 UTC (4 years ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.190: +179 -2 lines
Diff to previous 1.190 (colored)

Implement kqueue(2) support.

Assert that the KERNEL_LOCK() has to be held before grabbing `audio_lock'
to prevent lock ordering issues inside selwakeup().

ok visa@, ratchov@

Revision 1.190 / (download) - annotate - [select for diffs], Sat May 16 11:07:52 2020 UTC (4 years ago) by ratchov
Branch: MAIN
Changes since 1.189: +26 -6 lines
Diff to previous 1.189 (colored)

Use softintr to call selwakeup() in the mixer code code-path

ok mpi

Revision 1.189 / (download) - annotate - [select for diffs], Sat Apr 18 21:32:21 2020 UTC (4 years, 1 month ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.188: +1 -17 lines
Diff to previous 1.188 (colored)

Remove support for unused /dev/mixer device nodes.

ok deraadt

Revision 1.188 / (download) - annotate - [select for diffs], Sun Mar 8 15:15:57 2020 UTC (4 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.187: +5 -1 lines
Diff to previous 1.187 (colored)

Wake up processes reading the mixer when the device is detached.

Revision 1.187 / (download) - annotate - [select for diffs], Thu Feb 13 21:00:48 2020 UTC (4 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.186: +40 -12 lines
Diff to previous 1.186 (colored)

Fix missing locking during calls to selwakeup().

selwakeup() was called in the interrupt handler, i.e. with the
audio_lock held. We can't just grab the KERNEL_LOCK needed by
selwakeup(), because locks would be taken in the wrong order. Solve
this by defering selwakeup() calls to a softintr, called with the
KERNEL_LOCK held.

Mostly from mpi@, ok mpi@.

Revision 1.186 / (download) - annotate - [select for diffs], Wed Jan 29 06:04:05 2020 UTC (4 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.185: +158 -3 lines
Diff to previous 1.185 (colored)

Add support for notifications about audio(4) controls changes.

Whenever a "mixer" control is changed by a program or with volume
keys, its index may be read from the /dev/audioctlN device using
the read(2) syscall. Only one reader at a time is allowed.

Revision 1.185 / (download) - annotate - [select for diffs], Fri Jan 24 05:38:33 2020 UTC (4 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.184: +5 -5 lines
Diff to previous 1.184 (colored)

Rename audio_mixer_{read,write} to audio_mixer_{get,set}.

The audio_mixer_{read,write} names are misleading: these functions are
not the methods of the read and write syscalls. No object change.

Revision 1.184 / (download) - annotate - [select for diffs], Wed Dec 18 00:27:47 2019 UTC (4 years, 5 months ago) by cheloha
Branch: MAIN
Changes since 1.183: +7 -7 lines
Diff to previous 1.183 (colored)

audio(4): msleep(9) -> msleep_nsec(9)

ok ratchov@

Revision 1.183 / (download) - annotate - [select for diffs], Mon Oct 7 10:47:08 2019 UTC (4 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.182: +5 -5 lines
Diff to previous 1.182 (colored)

Convert infinite tsleep(9) to tsleep_nsec(9).

ok ratchov@

Revision 1.182 / (download) - annotate - [select for diffs], Tue Sep 10 07:39:39 2019 UTC (4 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.181: +16 -1 lines
Diff to previous 1.181 (colored)

If the requensted block size is too large, then use half the
buffer size instead of failing. Problem found and fix tested
by Joe Davis <me at jo.ie>, thanks!

Revision 1.181 / (download) - annotate - [select for diffs], Thu Sep 5 05:33:57 2019 UTC (4 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.180: +50 -5 lines
Diff to previous 1.180 (colored)

Add the set_blksz() and set_nblks() audio driver functions.

The first sets the block size in frames, which is necessarily common
to play and recording directions no matter the number of channels. The
second sets the number of blocks per buffer for the given
direction. Together, these two functions allow audio drivers to easily
set the block size, matching both playback and recording constraints.

The round_blocksize() didn't allow to do so because it returns the
block size in *bytes*. Since the driver doesn't know if it's called
for the play or for the record block size, it's impossible to
calculate the block size in all cases if play and record number of
channels are different.

ok mpi@

Revision 1.180 / (download) - annotate - [select for diffs], Sat Aug 17 05:04:56 2019 UTC (4 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.179: +22 -20 lines
Diff to previous 1.179 (colored)

Move play blocks count from the audio_softc to the audio_buf structure.

As the audio_buf structure is per-direction, this makes play and
recording code similar. No behavior change.

Revision 1.179 / (download) - annotate - [select for diffs], Sat Aug 17 04:57:52 2019 UTC (4 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.178: +108 -80 lines
Diff to previous 1.178 (colored)

Move block size and block count calculations in their own routines.

Makes the code easier to read, no behabior change.

Revision 1.178 / (download) - annotate - [select for diffs], Fri Apr 5 06:14:13 2019 UTC (5 years, 2 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.177: +6 -4 lines
Diff to previous 1.177 (colored)

Try to start playback after play buffer pointers are advanced.

Allows playback to start automatically as soon as there's enough data,
even if the AUDIO_START ioctl is not called. This is mainly useful to
quickly test & debug low level drivers with simple shell commands.

Revision 1.177 / (download) - annotate - [select for diffs], Sun Mar 31 17:55:09 2019 UTC (5 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.176: +3 -3 lines
Diff to previous 1.176 (colored)

Don't try to recover when DMA pointers wrap if the driver is
using bounce buffers. In this case, hardware underruns are managed
by the driver on the bounce buffers, not the audio ring buffer.

Revision 1.176 / (download) - annotate - [select for diffs], Tue Mar 12 08:16:29 2019 UTC (5 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.175: +12 -4 lines
Diff to previous 1.175 (colored)

Add new copy_output() and underrun() methods to support drivers
using bounce buffers, like the uaudio(4) driver.

ok mpi

Revision 1.175 / (download) - annotate - [select for diffs], Mon Dec 31 17:12:34 2018 UTC (5 years, 5 months ago) by kettenis
Branch: MAIN
Changes since 1.174: +7 -20 lines
Diff to previous 1.174 (colored)

Use the return value of task_add(9) to determine whether the task was
already scheduled and whether we have to unref the device ourselves.

ok tedu@, ratchov@

Revision 1.174 / (download) - annotate - [select for diffs], Thu Dec 27 17:57:58 2018 UTC (5 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.173: +5 -1 lines
Diff to previous 1.173 (colored)

must remember to unref device if setting the task isn't done.
ok anton

Revision 1.173 / (download) - annotate - [select for diffs], Wed Oct 31 02:25:26 2018 UTC (5 years, 7 months ago) by miko
Branch: MAIN
Changes since 1.172: +7 -7 lines
Diff to previous 1.172 (colored)

sc argument of start_output, start_input, trigger_output and trigger_input
is void* so no need to cast; ok ratchov@

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jun 24 23:54:22 2018 UTC (5 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.171: +3 -10 lines
Diff to previous 1.171 (colored)

Save all mixer elements in the suspend/resume array instead of only
enum, sets, and values. This is simpler and less error prone. This
fixes the record.enable elements replacing the last few hardware
mixer controls.

Help from Laurence Tratt, tested by landry@

Revision 1.171 / (download) - annotate - [select for diffs], Sat May 26 10:16:13 2018 UTC (6 years ago) by ratchov
Branch: MAIN
Changes since 1.170: +17 -4 lines
Diff to previous 1.170 (colored)

In addition to "on" and "off", allow the audio "record.enable" mixer
knob to take the new "sysctl" value, which is the default. In this
case, the device behavior is determined by the new "kern.audio.record"
sysctl(2), which defaults to zero.

ok florian

Revision 1.170 / (download) - annotate - [select for diffs], Sat May 26 10:13:18 2018 UTC (6 years ago) by ratchov
Branch: MAIN
Changes since 1.169: +106 -12 lines
Diff to previous 1.169 (colored)

Add a "record.enable" mixer knob to control recording. When recording
is disabled, the device records silence. The control may be modified
only by root and defaults to "off", ie. recording is disabled by
default.

ok florian, deraadt

Revision 1.169 / (download) - annotate - [select for diffs], Wed Apr 11 04:48:31 2018 UTC (6 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.168: +64 -1 lines
Diff to previous 1.168 (colored)

Add mixer save/restore capability to the audio(4) driver and
use it during suspend/resume. Remove driver-specific mixer
save/restore bits that don't need to be duplicated in every
low-lever driver.

ok mpi

Revision 1.168 / (download) - annotate - [select for diffs], Wed Mar 21 07:02:02 2018 UTC (6 years, 2 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Fix the way we detect xrun on the recording end, which may prevent the
ring read pointer from wrapping, in turn allowing the process to read
past the ring boundaries.

ok deraadt@

Revision 1.167 / (download) - annotate - [select for diffs], Wed Jan 10 09:03:26 2018 UTC (6 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.166: +1 -2 lines
Diff to previous 1.166 (colored)

Remove assignement of sc->round to itself that makes no sense. From
Michael W. Bombardieri, thanks.

Revision 1.166 / (download) - annotate - [select for diffs], Thu Nov 23 06:07:55 2017 UTC (6 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.165: +3 -4 lines
Diff to previous 1.165 (colored)

No need to grab the audio lock to call audio_canstart() as it checks
whether the device is started before using structures shared with the
interrupt handler. From Michael W. Bombardieri, tested by me.

Revision 1.165 / (download) - annotate - [select for diffs], Mon Jun 26 07:02:16 2017 UTC (6 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.164: +2 -3 lines
Diff to previous 1.164 (colored)

Factor a variable assignment in audiopoll().
From Michael Bombardieri, thanks.

Revision 1.164 / (download) - annotate - [select for diffs], Tue May 16 05:48:07 2017 UTC (7 years ago) by ratchov
Branch: MAIN
Changes since 1.163: +2 -10 lines
Diff to previous 1.163 (colored)

Remove references to /dev/soundN, which was removed last year.
From Jan Stary <hans at stare.cz>, thanks.

Revision 1.163 / (download) - annotate - [select for diffs], Wed May 3 06:56:54 2017 UTC (7 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.162: +4 -5 lines
Diff to previous 1.162 (colored)

style improvement from Michael W. Bombardieri <mb at ii.net>

Revision 1.162 / (download) - annotate - [select for diffs], Tue Mar 28 05:20:22 2017 UTC (7 years, 2 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.161: +8 -8 lines
Diff to previous 1.161 (colored)

Simplify rate/channels/bits bounds checking code. From
Michael W. Bombardieri <mb at ii.net>. Thanks.

Revision 1.161 / (download) - annotate - [select for diffs], Sat Mar 11 10:12:45 2017 UTC (7 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.160: +1 -20 lines
Diff to previous 1.160 (colored)

AUDIO_ENCODING_{S,U}LINEAR constants are neither used by low level
drivers nor exposed to user-land. Remove definitions and code to
handle convertions.

Revision 1.160 / (download) - annotate - [select for diffs], Tue Jan 3 06:42:11 2017 UTC (7 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored)

If gain is above MAX, no need to check whether it's below MIN.
From Michael W. Bombardieri. Thanks.

Revision 1.159 / (download) - annotate - [select for diffs], Tue Dec 20 15:59:07 2016 UTC (7 years, 5 months ago) by ratchov
Branch: MAIN
Changes since 1.158: +8 -8 lines
Diff to previous 1.158 (colored)

Fix many typos. From Michael W. Bombardieri <mb at ii.net>. Thanks

Revision 1.158 / (download) - annotate - [select for diffs], Mon Dec 12 06:23:03 2016 UTC (7 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.157: +4 -14 lines
Diff to previous 1.157 (colored)

Remove few useless #ifdef AUDIO_DEBUG, spotted by
Michael W. Bombardieri <mb at ii.net>. Thanks

Revision 1.157 / (download) - annotate - [select for diffs], Tue Nov 8 06:04:25 2016 UTC (7 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.156: +3 -11 lines
Diff to previous 1.156 (colored)

Log start/stop of DMA if AUDIO_DEBUG is defined and be less verbose
about buffer parameters. No behaviour change.

Revision 1.156 / (download) - annotate - [select for diffs], Sun Oct 9 11:37:23 2016 UTC (7 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.155: +37 -25 lines
Diff to previous 1.155 (colored)

Don't allocate struct mixer_devinfo instances on the stack.  It is a fairly
large data structure and if the compiler gets clever and inlines some code
we hit the stack size compiler warning.  This makes things compile with clang.

ok ratchov@

Revision 1.155 / (download) - annotate - [select for diffs], Thu Oct 6 05:29:19 2016 UTC (7 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.154: +15 -4 lines
Diff to previous 1.154 (colored)

Fix the condition used to decide whether to automatically start the
device, and factor it into a single function. Without this fix, if the
device is open in full-duplex mode, it could start with empty play
buffer.

Revision 1.154 / (download) - annotate - [select for diffs], Tue Oct 4 23:02:03 2016 UTC (7 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.153: +36 -4 lines
Diff to previous 1.153 (colored)

At acpithinkpad attach time determine the value of the mute, and defer
telling the audio subsystem about this later on in boot.  (Mute state
is maintained by the BIOS over a suspend, hibernate, reboot, etc -- this
may be last missing piece of the puzzle we tore our hair out in Brisbane)
diagnosis and code by Anton Lindqvist, ok ratchov

Revision 1.153 / (download) - annotate - [select for diffs], Mon Sep 19 06:46:43 2016 UTC (7 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.152: +1 -2 lines
Diff to previous 1.152 (colored)

Remove unused getdev() audio driver functions.

Revision 1.152 / (download) - annotate - [select for diffs], Wed Sep 14 06:12:19 2016 UTC (7 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.151: +0 -1 lines
Diff to previous 1.151 (colored)

Remove drain(), query_encoding(), mappage() and get_default_params()
methods from all audio drivers and from the audio_if structure as they
are never called.

Revision 1.151 / (download) - annotate - [select for diffs], Wed Aug 31 07:22:43 2016 UTC (7 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.150: +1 -225 lines
Diff to previous 1.150 (colored)

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.

Revision 1.150 / (download) - annotate - [select for diffs], Tue Jun 21 06:38:28 2016 UTC (7 years, 11 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.149: +3 -3 lines
Diff to previous 1.149 (colored)

fix typos in comments and spacing

Revision 1.149 / (download) - annotate - [select for diffs], Sat Jun 18 07:59:30 2016 UTC (7 years, 11 months ago) by ratchov
Branch: MAIN
Changes since 1.148: +12 -0 lines
Diff to previous 1.148 (colored)

Add a new AUDIO_GETSTATUS ioctl to get various audio driver variables.
It's intended for use with diagnostic tools (like audioctl) and is of
no use to audio programs.

Revision 1.148 / (download) - annotate - [select for diffs], Wed Jun 1 09:48:20 2016 UTC (8 years ago) by mglocker
Branch: MAIN
Changes since 1.147: +10 -2 lines
Diff to previous 1.147 (colored)

New USB device driver for Audio/Video capture devices based on the
Fushicai USBTV007 chip.

The chip specific code has been written by Lubomir Rintel and Federico
Simoncelli.  Patrick Keshishian has ported it to OpenBSD and wrote the
remaining code based on uvideo(4).

Input and help also from mpi@ and ratchov@.

ok mpi

Revision 1.147 / (download) - annotate - [select for diffs], Wed May 11 16:16:58 2016 UTC (8 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.146: +11 -3 lines
Diff to previous 1.146 (colored)

Use round_blocksize() to determine the maximum hardware block size (in
bytes) then, adjust the block size accordingly. Fixes zaudio(4) not
starting when large blocks are requested. Found and reported by
Andre Smagin <as at smagin.com>, thanks.

Revision 1.146 / (download) - annotate - [select for diffs], Wed May 11 07:51:45 2016 UTC (8 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.145: +8 -7 lines
Diff to previous 1.145 (colored)

Dont reuse "mult" local variable. Use separate variable for hardware
block size multiplier (in bytes) and for the driver block size
multiplier (in frames). No behaviour change.

Revision 1.145 / (download) - annotate - [select for diffs], Wed Mar 16 06:46:39 2016 UTC (8 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.144: +147 -0 lines
Diff to previous 1.144 (colored)

Expose new audio ioctls that do one thing only: start and stop DMA,
set and get parameters. This is much simpler.

ok semarie, armani, tweaks from jmc

Revision 1.144 / (download) - annotate - [select for diffs], Fri Jan 29 15:14:23 2016 UTC (8 years, 4 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.143: +11 -5 lines
Diff to previous 1.143 (colored)

Move the AUDIO_GETDEV ioctl in its own routine.

Revision 1.143 / (download) - annotate - [select for diffs], Wed Jan 20 19:01:39 2016 UTC (8 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.142: +5 -1 lines
Diff to previous 1.142 (colored)

make AUDIO_GETDEV ioctl return the device name (ex "azalia0") rather
than driver specific strings.

ok kettenis

Revision 1.142 / (download) - annotate - [select for diffs], Wed Jan 20 07:59:55 2016 UTC (8 years, 4 months ago) by ratchov
Branch: MAIN
Changes since 1.141: +5 -1 lines
Diff to previous 1.141 (colored)

Set byte order the default encoding in the attach method to
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.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Jan 9 23:24:31 2016 UTC (8 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.140: +2 -1 lines
Diff to previous 1.140 (colored)

missing break
ok ratchov@ deraadt@

Revision 1.140 / (download) - annotate - [select for diffs], Mon Dec 14 03:04:10 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
Changes since 1.139: +2 -2 lines
Diff to previous 1.139 (colored)

"harware" -> "hardware"

Revision 1.139 / (download) - annotate - [select for diffs], Fri Sep 4 16:02:19 2015 UTC (8 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.138: +5 -3 lines
Diff to previous 1.138 (colored)

Fix condition used while seaching candidates for "record level"
control for wskbd. This may fix "record level" keys on certain
keyboards.

Revision 1.138 / (download) - annotate - [select for diffs], Wed Jul 29 21:13:32 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.137: +6 -4 lines
Diff to previous 1.137 (colored)

Fix spacing and be more verbose in printfs under #ifdef AUDIO_DEBUG.
No binary change.

Revision 1.137 / (download) - annotate - [select for diffs], Tue Jul 28 21:04:28 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.136: +2 -2 lines
Diff to previous 1.136 (colored)

add missing space, from Donovan Watteau <tsoomi at gmail.com>
thanks!

Revision 1.136 / (download) - annotate - [select for diffs], Tue Jul 28 20:57:35 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.135: +46 -3 lines
Diff to previous 1.135 (colored)

In case the system misses enough audio interrupts for DMA
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

Revision 1.135 / (download) - annotate - [select for diffs], Tue Jul 28 20:45:02 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.134: +14 -4 lines
Diff to previous 1.134 (colored)

Add the AUDIO_GETPOS ioctl() to fetch a snapshot of the 4 counters
returned by AUDIO_GETxOFFS and AUDIO_xERROR ioctls.

ok deraadt

Revision 1.134 / (download) - annotate - [select for diffs], Fri Jul 24 08:56:45 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.133: +14 -12 lines
Diff to previous 1.133 (colored)

Switch back into counting bytes rather than blocks. We can't just
multiply the block count by the block size to get the bytes count
because they won't wrap correctly.

Revision 1.133 / (download) - annotate - [select for diffs], Wed Jul 22 19:06:28 2015 UTC (8 years, 10 months ago) by ratchov
Branch: MAIN
Changes since 1.132: +12 -12 lines
Diff to previous 1.132 (colored)

Represent the current stream position in blocks rather than bytes
just because it's simpler this way. No behaviour change.

Revision 1.132 / (download) - annotate - [select for diffs], Thu Jun 25 06:43:45 2015 UTC (8 years, 11 months ago) by ratchov
Branch: MAIN
Changes since 1.131: +1574 -3209 lines
Diff to previous 1.131 (colored)

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.

Revision 1.131 / (download) - annotate - [select for diffs], Fri May 22 12:46:38 2015 UTC (9 years ago) by jsg
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

LITTE_ENDIAN -> LITTLE_ENDIAN
ok ratchov@

Revision 1.130 / (download) - annotate - [select for diffs], Mon May 11 06:46:21 2015 UTC (9 years, 1 month ago) by ratchov
Branch: MAIN
Changes since 1.129: +100 -71 lines
Diff to previous 1.129 (colored)

Remove all audio format conversion code from the kernel (btw holding
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@

Revision 1.129 / (download) - annotate - [select for diffs], Tue Feb 10 21:56:09 2015 UTC (9 years, 4 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.128: +4 -4 lines
Diff to previous 1.128 (colored)

First step towards making uiomove() take a size_t size argument:
- 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@

Revision 1.128 / (download) - annotate - [select for diffs], Sat Feb 7 01:49:05 2015 UTC (9 years, 4 months ago) by kettenis
Branch: MAIN
Changes since 1.127: +13 -1 lines
Diff to previous 1.127 (colored)

Let a volume key event unmute.  This makes the software state follow the
hardware behaviour on Thinkpads making it harder for software state and
hardware state get out of sync.

ok deraadt@

Revision 1.127 / (download) - annotate - [select for diffs], Tue Jan 27 03:17:35 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.126: +4 -4 lines
Diff to previous 1.126 (colored)

remove the second void * argument on tasks.

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@

Revision 1.126 / (download) - annotate - [select for diffs], Tue Jan 20 04:54:23 2015 UTC (9 years, 4 months ago) by dlg
Branch: MAIN
Changes since 1.125: +32 -22 lines
Diff to previous 1.125 (colored)

rework the audio key handling to allocate a message to send to the
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

Revision 1.125 / (download) - annotate - [select for diffs], Fri Dec 19 22:44:58 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.124: +2 -3 lines
Diff to previous 1.124 (colored)

Use <sys/endian.h> instead of <machine/endian.h>

ok dlg@ mpi@ bcook@ millert@ miod@

Revision 1.124 / (download) - annotate - [select for diffs], Sun Nov 16 12:30:59 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.123: +8 -8 lines
Diff to previous 1.123 (colored)

Replace a plethora of historical protection options with just
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

Revision 1.123 / (download) - annotate - [select for diffs], Sun Sep 14 14:17:24 2014 UTC (9 years, 8 months ago) by jsg
Branch: MAIN
Changes since 1.122: +1 -2 lines
Diff to previous 1.122 (colored)

remove uneeded proc.h includes
ok mpi@ kspillner@

Revision 1.122 / (download) - annotate - [select for diffs], Sat Jul 12 18:48:17 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.121: +3 -3 lines
Diff to previous 1.121 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.121 / (download) - annotate - [select for diffs], Mon May 19 07:00:15 2014 UTC (10 years ago) by ratchov
Branch: MAIN
Changes since 1.120: +13 -13 lines
Diff to previous 1.120 (colored)

fix format mistakes visible if AUDIO_DEBUG is defined

Revision 1.120 / (download) - annotate - [select for diffs], Tue Dec 17 14:55:16 2013 UTC (10 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.119: +12 -33 lines
Diff to previous 1.119 (colored)

don't do a timeout+task song and dance, instead use DVACT_WAKEUP directly.
There will be slight burps on resume due to other drivers being slow with
wakeup.
ok kettenis ratchov

Revision 1.119 / (download) - annotate - [select for diffs], Fri Dec 6 21:03:02 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.118: +4 -6 lines
Diff to previous 1.118 (colored)

Add a DVACT_WAKEUP op to the *_activate() API.  This is called after the
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

Revision 1.118 / (download) - annotate - [select for diffs], Thu Nov 28 00:38:50 2013 UTC (10 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.117: +121 -2 lines
Diff to previous 1.117 (colored)

the stuff in audiovar.h is only used in audio.c, so move it in there to
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@

Revision 1.117 / (download) - annotate - [select for diffs], Mon Nov 4 11:57:26 2013 UTC (10 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.116: +45 -24 lines
Diff to previous 1.116 (colored)

Convert wskbd_set_mixervolume() to use a task internally instead of
being called in a workq.

ok kettenis@

Revision 1.116 / (download) - annotate - [select for diffs], Wed Oct 30 02:13:52 2013 UTC (10 years, 7 months ago) by dlg
Branch: MAIN
Changes since 1.115: +4 -4 lines
Diff to previous 1.115 (colored)

replace workqs with tasks.

ok mpi@

Revision 1.115 / (download) - annotate - [select for diffs], Wed May 15 08:29:24 2013 UTC (11 years ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.114: +92 -114 lines
Diff to previous 1.114 (colored)

Introduce a global interrupt-aware mutex protecting data
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

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jul 3 15:47:16 2011 UTC (12 years, 11 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.113: +1 -3 lines
Diff to previous 1.113 (colored)

Remove config_activate() and DVACT_ACTIVATE.  PCMCIA's the only thing
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

Revision 1.113 / (download) - annotate - [select for diffs], Sat Jul 2 22:20:07 2011 UTC (12 years, 11 months ago) by nicm
Branch: MAIN
Changes since 1.112: +2 -2 lines
Diff to previous 1.112 (colored)

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt

Revision 1.112 / (download) - annotate - [select for diffs], Mon Jun 6 06:13:45 2011 UTC (13 years ago) by deraadt
Branch: MAIN
Changes since 1.111: +12 -9 lines
Diff to previous 1.111 (colored)

Microphone mute button support from acpithinkpad (or elsewhere).
The audio side is a bit lacking; it does not yet mute all types of
devices.
from Alexander Polakov
ok jakemsr

Revision 1.111 / (download) - annotate - [select for diffs], Thu Nov 18 21:15:14 2010 UTC (13 years, 6 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.110: +3 -10 lines
Diff to previous 1.110 (colored)

Don't
  #include "foo.h"
  #if NFOO > 0
  (whole file)
  #endif
since config(8) file inclusion rules already do it for you.
ok deraadt@

Revision 1.110 / (download) - annotate - [select for diffs], Tue Sep 21 20:08:11 2010 UTC (13 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.109: +22 -13 lines
Diff to previous 1.109 (colored)

change quiescing to not call the audio_hw_if halt method in interrupt
context, because drivers (like eso(4) and envy(4)) might want to sleep
in their halt method.

Revision 1.109 / (download) - annotate - [select for diffs], Sun Sep 12 02:01:17 2010 UTC (13 years, 9 months ago) by jakemsr
Branch: MAIN
Changes since 1.108: +148 -2 lines
Diff to previous 1.108 (colored)

DVACT_{QUIESCE,RESUME} for audio(4)
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

Revision 1.108 / (download) - annotate - [select for diffs], Thu Jul 15 03:43:11 2010 UTC (13 years, 11 months ago) by jakemsr
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.107: +53 -22 lines
Diff to previous 1.107 (colored)

add two new members to structs audio_encoding and audio_prinfo.
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

Revision 1.107 / (download) - annotate - [select for diffs], Mon Nov 9 17:53:39 2009 UTC (14 years, 7 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.106: +1 -2 lines
Diff to previous 1.106 (colored)

Every selwakeup() should have a matching KNOTE() (even if kqueue isn't
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

Revision 1.106 / (download) - annotate - [select for diffs], Tue Oct 27 12:13:33 2009 UTC (14 years, 7 months ago) by jakemsr
Branch: MAIN
Changes since 1.105: +5 -5 lines
Diff to previous 1.105 (colored)

in the get_default_parameters method, give the low level drivers a
pointer to the low level driver's softc, not audio's softc.  nothing
is actually using this yet.

ok ratchov

Revision 1.105 / (download) - annotate - [select for diffs], Tue Oct 13 19:33:16 2009 UTC (14 years, 8 months ago) by pirofti
Branch: MAIN
Changes since 1.104: +3 -3 lines
Diff to previous 1.104 (colored)

Get rid of devact enum, substitute it with an int and coresponding defines.

This is needed for the addition of further suspend/resume actions.

Okay deraadt@, marco@.

Revision 1.104 / (download) - annotate - [select for diffs], Thu Jun 18 22:55:56 2009 UTC (14 years, 11 months ago) by jakemsr
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.103: +8 -8 lines
Diff to previous 1.103 (colored)

fix previous: start playback when at least one block of data has
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@

Revision 1.101.2.1 / (download) - annotate - [select for diffs], Mon Apr 27 20:45:26 2009 UTC (15 years, 1 month ago) by ratchov
Branch: OPENBSD_4_5
Changes since 1.101: +65 -146 lines
Diff to previous 1.101 (colored) next main 1.102 (colored)

On very high system load, an audio interrupt may occur while the audio
process is filling audio ring buffers. This triggers bogus (and useless)
correction code in the audio(4) driver causing the audio application to go
out of sync, and in turn causing continuous stuttering until the application
is restarted.

from current, ok deraadt@

Revision 1.103 / (download) - annotate - [select for diffs], Sat Mar 21 13:16:21 2009 UTC (15 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.102: +46 -85 lines
Diff to previous 1.102 (colored)

don't call uiomove(9) at IPL_AUDIO, slightly simplify the code
help from and ok jakemsr

Revision 1.102 / (download) - annotate - [select for diffs], Mon Mar 16 19:45:09 2009 UTC (15 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.101: +30 -72 lines
Diff to previous 1.101 (colored)

first stage of removing ``copying & needfeel'' flags that
make the audio driver missing blocks and, thus, breaking
full-duplex apps.
help and ok jakemsr

Revision 1.101 / (download) - annotate - [select for diffs], Fri Jan 16 23:07:33 2009 UTC (15 years, 4 months ago) by jakemsr
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE
Branch point for: OPENBSD_4_5
Changes since 1.100: +14 -14 lines
Diff to previous 1.100 (colored)

deal with sample precisions that are not a power of 2.

discussed with and ok ratchov; manpage tweak from naddy, thanks

Revision 1.100 / (download) - annotate - [select for diffs], Thu Oct 30 03:46:56 2008 UTC (15 years, 7 months ago) by jakemsr
Branch: MAIN
Changes since 1.99: +2 -2 lines
Diff to previous 1.99 (colored)


for devices that do not allow independent setting of recording and
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

Revision 1.99 / (download) - annotate - [select for diffs], Sat Oct 25 22:30:43 2008 UTC (15 years, 7 months ago) by jakemsr
Branch: MAIN
Changes since 1.98: +9 -9 lines
Diff to previous 1.98 (colored)


audio(9) says low level drivers are allowed to change the requested
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@

Revision 1.98 / (download) - annotate - [select for diffs], Mon Sep 29 02:27:38 2008 UTC (15 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.97: +5 -5 lines
Diff to previous 1.97 (colored)

account for data expansion due to emulation in AUDIO_GET{I,O}OFFS
ioctls.

ok ratchov@

Revision 1.97 / (download) - annotate - [select for diffs], Sun Aug 10 12:03:53 2008 UTC (15 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

'flus' -> 'flush', 'waitinf' -> 'waiting'. From Dawe via tech@.

Revision 1.96 / (download) - annotate - [select for diffs], Tue Jul 29 05:59:11 2008 UTC (15 years, 10 months ago) by ratchov
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.95: +5 -1 lines
Diff to previous 1.95 (colored)

When paused (or overrun), the record ring pointers are not incremented
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@

Revision 1.95 / (download) - annotate - [select for diffs], Mon Apr 21 00:32:42 2008 UTC (16 years, 1 month ago) by jakemsr
Branch: MAIN
Changes since 1.94: +20 -7 lines
Diff to previous 1.94 (colored)


allow low level audio drivers to specify a default sample format,
instead of 8-bit mono mulaw @ 8kHz.

this is just the infrastructure; no drivers are specifying a default
yet.

ok ratchov@, deanna@

Revision 1.94 / (download) - annotate - [select for diffs], Fri Apr 4 04:57:16 2008 UTC (16 years, 2 months ago) by jakemsr
Branch: MAIN
Changes since 1.93: +10 -2 lines
Diff to previous 1.93 (colored)

if full-duplex is being turned on, also set the oprtational mode to
for both recording and playback.

ok ratchov

Revision 1.93 / (download) - annotate - [select for diffs], Sat Mar 22 11:05:31 2008 UTC (16 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.92: +45 -18 lines
Diff to previous 1.92 (colored)

add audio(4) driver the ability to use different block sizes for play and
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

Revision 1.92 / (download) - annotate - [select for diffs], Sat Mar 22 07:48:58 2008 UTC (16 years, 2 months ago) by ratchov
Branch: MAIN
Changes since 1.91: +6 -6 lines
Diff to previous 1.91 (colored)

when setting the block size, use the scale factor only once in
audiosetinfo(), so the block size don't get scaled twice. Also fix the
formula used in audiosetinfo().

ok jakemsr

Revision 1.91 / (download) - annotate - [select for diffs], Wed Mar 12 20:33:13 2008 UTC (16 years, 3 months ago) by ratchov
Branch: MAIN
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

Set the default high water mark to the buffer size, instead of the buffer
size minus one block. Otherwise, recording cannot work with 32kB blocks.

ok jakemsr@

Revision 1.90 / (download) - annotate - [select for diffs], Thu Feb 28 09:15:04 2008 UTC (16 years, 3 months ago) by jakemsr
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.89: +8 -5 lines
Diff to previous 1.89 (colored)


from audio(4):

      blocksize sets the current audio blocksize.  The generic audio
      driver layer and the hardware driver have the opportunity to ad-
      just this block size to get it within implementation-required
      limits.  Upon return from an AUDIO_SETINFO call, the actual
      blocksize set is returned in this field.  Normally the blocksize
      is calculated to correspond to 50ms of sound and it is recalcu-
      lated when the encoding parameter changes, but if the blocksize
      is set explicitly this value becomes sticky, i.e., it remains
      even when the encoding is changed.  The stickiness can be cleared
      by reopening the device or setting the blocksize to 0.

however, there were insufficient checks to make the blocksize is
actually sticky once it is set by the user.  this adds them.

ok ratchov@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Nov 17 13:31:30 2007 UTC (16 years, 6 months ago) by ratchov
Branch: MAIN
Changes since 1.88: +73 -37 lines
Diff to previous 1.88 (colored)

use tables to determine the best control to use for play.gain, record.gain
and monitor_gain; this makes play.gain always usable as general purpose
volume knob even on devices that don't have outputs.master.

ok jakemsr@, deanna@

Revision 1.88 / (download) - annotate - [select for diffs], Sun Oct 28 13:27:05 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.87: +24 -35 lines
Diff to previous 1.87 (colored)

prepare audio(4) for addition of the envy(4) driver: enable 32bit samples
(basically only audio_fill_silence() must be updated) and bump max channel
number to 12

ok jakemsr@

Revision 1.87 / (download) - annotate - [select for diffs], Sun Oct 28 13:23:01 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.86: +23 -13 lines
Diff to previous 1.86 (colored)

the pointer we give to audio_fill_silence() may point in the middle of a
sample (eg. if write(2) have written an odd number of bytes and 16bit
encoding is used), so we'll not properly write silence. To fix this,
round start pointer to fill with silence uncomplete samples too.

ok jakemsr@

Revision 1.86 / (download) - annotate - [select for diffs], Sat Oct 27 08:52:47 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

fix: when a block is captured audio_rint() is called, we must
consider that the ring buffer has overrrun if (used >= usedhigh) and not
if (used >= usedhigh + blksize), otherwise recording doesn't work when
large enough blocks are used

ok jakemsr@

Revision 1.85 / (download) - annotate - [select for diffs], Thu Oct 25 18:13:42 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.84: +9 -5 lines
Diff to previous 1.84 (colored)

sc->sc_pr.usedlow must be multiple of the block size, fix
audio_calcwater() to do so

ok jakemsr@

Revision 1.84 / (download) - annotate - [select for diffs], Thu Oct 25 18:11:15 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

return POLLOUT as long as (lowat + 1) isn't reached. without this audio(4)
is unusable with lowat = 1

ok jakemsr@

Revision 1.83 / (download) - annotate - [select for diffs], Tue Oct 23 17:43:41 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.82: +47 -36 lines
Diff to previous 1.82 (colored)

add a new audio_set_blksize() function that sets (and adjusts) the block
size to the given number of frames per second, all changes pass through it.
If parameters are changed or the user requested a new block size (or both),
the block size is recalculated.

ok jakemsr

Revision 1.82 / (download) - annotate - [select for diffs], Fri Oct 19 15:31:02 2007 UTC (16 years, 7 months ago) by ratchov
Branch: MAIN
Changes since 1.81: +8 -5 lines
Diff to previous 1.81 (colored)

fix audio_calc_blksize() not to return larger block sizes than
the buffer size

ok jakemsr

Revision 1.81 / (download) - annotate - [select for diffs], Wed Oct 3 21:49:13 2007 UTC (16 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.80: +43 -2 lines
Diff to previous 1.80 (colored)


add two new audio ioctls, AUDIO_GETPRINFO and AUDIO_GETRRINFO, and the
data structure these ioctls use, audio_bufinfo.

these ioctls return information about the play and record buffers
into the audio_bufinfo structure.

these are being added to aid in porting non-native audio applications
and libraries, and to fix issues in our OSS audio emulation.  these
ioctls exist only on OpenBSD and should not be used in code intended
for distribution.

ok ratchov

Revision 1.80 / (download) - annotate - [select for diffs], Mon Sep 24 19:45:03 2007 UTC (16 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

accept values > 1 for "output_muted". That's what SunOS do. Suggested
by deanna@

ok jakemsr@

Revision 1.79 / (download) - annotate - [select for diffs], Mon Sep 24 19:23:41 2007 UTC (16 years, 8 months ago) by ratchov
Branch: MAIN
Changes since 1.78: +3 -1 lines
Diff to previous 1.78 (colored)

fix audioctl(1) returning  bugus values of 'output_muted' because of
uninitialized variable.

found by deanna@, ok jackmsr@

Revision 1.78 / (download) - annotate - [select for diffs], Mon Sep 17 13:46:11 2007 UTC (16 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.77: +9 -1 lines
Diff to previous 1.77 (colored)

implement the output_muted member of audio_info_t as found in original
Sun audio.

input from and ok ratchov

Revision 1.77 / (download) - annotate - [select for diffs], Mon Sep 17 13:35:46 2007 UTC (16 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.76: +28 -114 lines
Diff to previous 1.76 (colored)


use au_get_gain()/au_set_gain() and the new au_get_mute()/au_set_mute()
functions instead of doing things the hard way.

also add some bits to au_set_gain() so it sets a gain that is within
limits.  its possible to pass in an out-of-range value through
audioctl(1) as well.

ok ratchov

Revision 1.76 / (download) - annotate - [select for diffs], Mon Sep 17 13:33:29 2007 UTC (16 years, 8 months ago) by jakemsr
Branch: MAIN
Changes since 1.75: +71 -1 lines
Diff to previous 1.75 (colored)

add functions to mute/unmute output

ok ratchov

Revision 1.75 / (download) - annotate - [select for diffs], Mon Sep 10 22:24:04 2007 UTC (16 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.74: +2 -1 lines
Diff to previous 1.74 (colored)

fix uninitialized linked list head

ok jakemsr@

Revision 1.74 / (download) - annotate - [select for diffs], Mon Sep 10 05:34:32 2007 UTC (16 years, 9 months ago) by ratchov
Branch: MAIN
Changes since 1.73: +3 -1 lines
Diff to previous 1.73 (colored)

initialize sc_outports->master and sc_inports->master. Fixes "set failed"
errors when running audioctl(1) on devices without master controls

ok jakemsr@

Revision 1.73 / (download) - annotate - [select for diffs], Sun Sep 9 02:55:18 2007 UTC (16 years, 9 months ago) by jakemsr
Branch: MAIN
Changes since 1.72: +3 -3 lines
Diff to previous 1.72 (colored)

don't try to set the recording gain or balance through /dev/audio[ctl]
if the selected recording port is not a port the limited /dev/audio[ctl]
interface to mixer controls supports.

ok ratchov@

Revision 1.72 / (download) - annotate - [select for diffs], Wed Aug 8 05:51:23 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.71: +4 -2 lines
Diff to previous 1.71 (colored)

revert the change in rev 1.60 of audio.c and the corresponding
documentation change

the audio layer is still too "imperfect" for this change

fixes problems reported aanriot, matthieu and dtucker

requested by deraadt

Revision 1.71 / (download) - annotate - [select for diffs], Thu Aug 2 07:24:46 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.70: +25 -11 lines
Diff to previous 1.70 (colored)

for consistency, keep the count of dropped data in HW sample size, and
convert to userland sample size when needed.

why this subsystem wasn't written with samples as the basic unit of
measure is beyond me.

Revision 1.70 / (download) - annotate - [select for diffs], Thu Aug 2 07:15:49 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.69: +33 -8 lines
Diff to previous 1.69 (colored)

the MI audio layer never really knows what encoding the hardware uses;
the hardware drivers just set a conversion function.

when the MI audio layer needs to add silence, it adds silence in the
userland format, but the amount added is for the hardware sample size.

this diff fixes both record mode by sending the right amount, and
play mode by converting the silence to the right format.

Revision 1.69 / (download) - annotate - [select for diffs], Tue Jul 31 03:11:14 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored)

always ignore attempts to set the record or play port to 0.

this interface to mixer functionality is very limited, and is only
used for recording.  it only recognizes 'mic', 'cd', and 'line' as
valid recording inputs.  many devices have other inputs.  because of
the way AUDIO_INITINFO works, it is impossible to expand this API to
include all devices.

this fixes another common cause of audioctl(1) problems.  AUDIO_GETINFO
returns 0 for record.port when the recording port is something other
than 'mic', 'cd', or 'line', and the subsequent AUDIO_SETINFO would
fail on this.

Revision 1.68 / (download) - annotate - [select for diffs], Wed Jul 18 19:27:08 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.67: +10 -4 lines
Diff to previous 1.67 (colored)

- when traversing mixer fields in the attach routine and connecting
  the mixer layer to the audio layer, differentiate between the
  'monitor' class and the 'outputs' class instead of lumping them
  together.  not all mixers have a monitor class entry which was
  causing the outputs class to be ignored.

- look for monitor port in the monitor class, but if the monitor
  port is not found in the monitor class look in the outputs class
  as well.  the code was effectively looking in both the monitor and
  outputs classes before, so this is no real change.

sets up audio_info.play.[gain|balance] correctly on at least emu(4),
auich(4), auvia(4) and snapper(4) ... probably most other AC'97 devices
as well.  as a result, audioctl(1) works much better and the overall
volume can be set with /dev/audio instead of needing to go through
/dev/mixer.

from deanna@

thanks again to those who tested this change

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jul 18 18:34:32 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.66: +22 -22 lines
Diff to previous 1.66 (colored)


move the processing of the pause attribute to the end of audiosetinfo(),
to allow buffer sizes and pointer to the buffer to be set to reasonable
values for the sample size of the data to be read/written.

fixes kernel corruption seen with azalia and probably other drivers
that are using something other than 8kHz monaural mulaw as the default
encoding when doing 'dd if=/dev/audio of=foo' as the first audio
operation after boot.

problem reported by deanna@

Revision 1.66 / (download) - annotate - [select for diffs], Tue Jul 17 22:59:19 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.65: +14 -10 lines
Diff to previous 1.65 (colored)


more places where the difference between the hardware sample size
and the userland sample size matters.

there may be different sample size factors for play and record,
so use the appropriate factor when userland sets the blocksize.

the reported blocksize, hiwat and lowat are only for the play buffer.
IMO, it would be good to report the record blocksize, hiwat and lowat
as well, but that is another issue.

tested with emu(4) and an auvia(4) modified to only do stereo in
hardware.

Revision 1.65 / (download) - annotate - [select for diffs], Tue Jul 17 10:35:10 2007 UTC (16 years, 10 months ago) by jakemsr
Branch: MAIN
Changes since 1.64: +5 -4 lines
Diff to previous 1.64 (colored)

- the data in the read buffer, that was put there by the hardware,
  may not be the same sample size as what userland is to receive.
  account for the discrepency between the sample sizes when comparing
  how much to copy out with what userland expects.

- only copy out the part of the buffer that is in the format userland
  expects.

emu(4) can now record with all encodings it claims to be able to.
that is, dd if=/dev/audio of=foo does as audio(4) says (monaural
mu-law) and does it correctly.

AFAIKS, the only other driver that sets a read factor is uaudio(4),
and that depends on what the hardware supports.

tested on i386, amd64 and sgi with 3 different emu(4) cards

Revision 1.64 / (download) - annotate - [select for diffs], Sat Jul 14 02:31:33 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.63: +73 -215 lines
Diff to previous 1.63 (colored)

- ANSI function declarations
- remove argument names from function prototypes

OK jasper@, ray@, "Didn't notice any errors" marc@

Revision 1.63 / (download) - annotate - [select for diffs], Tue Jul 10 08:45:37 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.62: +3 -3 lines
Diff to previous 1.62 (colored)

fix the bug rev 1.56 uncovered and rev 1.62 worked around.

data is expanded before it goes in the buffer.  all sizes
and offsets used internally are of this expanded data.
there's no need to compensate for this fact except when
showing information to the user in case their actions
depend on how many bytes are in the buffer.

Revision 1.62 / (download) - annotate - [select for diffs], Mon Jul 9 09:18:47 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.61: +1 -1 lines
Diff to previous 1.61 (colored)

take into account possible expansion and be more careful not to
try to go past the end of the buffer.

this and the last commit allow ffplay and gnash to work properly
on devices that may need to do mono to stereo conversion, like
auich(4).

problem reported by and much debugging deanna@

Revision 1.61 / (download) - annotate - [select for diffs], Mon Jul 9 09:13:04 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

give the user what they expect instead of what we're working with
by taking into account expansion we may have done in cases such as
playing monoaural media on a device that only plays stereo, like
auich(4).

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jul 6 04:40:20 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.59: +2 -4 lines
Diff to previous 1.59 (colored)

- enable full-duplex mode by default if a device is opened
  read-write and it supports full-duplex operation.
- update documentation to match this behaviour.

see http://marc.info/?l=openbsd-tech&m=118310788926431&w=2 for
more background on this change

"patches look correct to me" marc@

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jul 6 04:25:28 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

the AUDIO_WSEEK ioctl should return the number of bytes in the play
buffer, not the record buffer.

inspired by recent similar change in NetBSD.

"patches look correct to me" marc@

Revision 1.58 / (download) - annotate - [select for diffs], Fri Jul 6 04:12:50 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.57: +6 -6 lines
Diff to previous 1.57 (colored)

be sure to respect the pause attribute

originally from Alexandre Ratchov

"patches look correct to me" marco@

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jul 6 04:10:34 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.56: +5 -2 lines
Diff to previous 1.56 (colored)

- there is no need for audio_init_ringbuffer() to always set the "pause"
  attribute to '0'.  this function may be called when executing an
  AUDIO_SETINFO ioctl where the pause attribute was set to '1', and
  setting it to '0' in this function will cause unexpected bahaviour.
- according to audio(4), the AUDIO_FLUSH ioctl "restarts recording
  and playback".  therefor, it should set the pause attributes to '0'.
  this was previously accomplished indirectly, because it calls
  audio_init_ringbuffer(), which was setting pause to '0'.
- the pause attribute must be set to '0' in audio_open() so that
  recording and playback buffers can be "activated" when the device
  is opened.  this was apparently forgotten when audiosetinfo()
  was split off of audio_open() and the logic in audiosetinfo()
  was changed to accomodate being run at times other than open().
  also, this only really affects read() with poll(), which may
  explain why the problem was not noticed for some time.

originally part of a patch Alexandre Ratchov sent to tech@ a
while back

fixes PR 3813

"patches look correct to me" marco@

Revision 1.56 / (download) - annotate - [select for diffs], Fri Jul 6 03:20:07 2007 UTC (16 years, 11 months ago) by jakemsr
Branch: MAIN
Changes since 1.55: +8 -4 lines
Diff to previous 1.55 (colored)

The poll(2) syscall doesn't work correctly on audio(4) devices.
For instance, it may not set POLLIN when samples become available,
or may set POLLOUT when write(2) will block.

Fix this by making conditions used by poll (FILTREAD and FILTWRITE
macros) match the blocking conditions in audio_read() and audio_write().

originally from Alexandre Ratchov, with a small tweak by me.

"patches look correct to me" marco@

Revision 1.55 / (download) - annotate - [select for diffs], Thu May 31 22:23:13 2007 UTC (17 years ago) by tedu
Branch: MAIN
Changes since 1.54: +7 -7 lines
Diff to previous 1.54 (colored)

switch wskbd hotkeys over to workq.  this eliminates quite a bit of code,
so remove the option too.  if you have audio and wskbd, you have hotkeys.
ok dlg

Revision 1.54 / (download) - annotate - [select for diffs], Sun Jan 7 13:35:51 2007 UTC (17 years, 5 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.53: +7 -4 lines
Diff to previous 1.53 (colored)

Protect against zero blocksize (causing a divide by zero) in audiogetinfo().

Revision 1.53 / (download) - annotate - [select for diffs], Wed Nov 29 13:34:31 2006 UTC (17 years, 6 months ago) by miod
Branch: MAIN
Changes since 1.52: +5 -5 lines
Diff to previous 1.52 (colored)

Compile the mixer tuning via keyboard code if NWSKBD_HOTKEY if nonzero
rather than NWSKBD being nonzero.

Revision 1.52 / (download) - annotate - [select for diffs], Wed Nov 1 03:37:23 2006 UTC (17 years, 7 months ago) by tedu
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51 (colored)

poll errors should be POLLERR, not some random E value
from alexandre ratchov.  ok claudio

Revision 1.51 / (download) - annotate - [select for diffs], Fri Jun 23 06:27:11 2006 UTC (17 years, 11 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.50: +1 -2 lines
Diff to previous 1.50 (colored)

In a drivers activate() entry point, if on DVACT_DEACTIVATE it does
something, then it MUST return zero on DVACT_ACTIVATE, not EOPNOTSUPP;
this very popular bug has been cut and pasted a lot of times...
ok deraadt@ mickey@

Revision 1.50 / (download) - annotate - [select for diffs], Mon May 29 20:23:13 2006 UTC (18 years ago) by miod
Branch: MAIN
Changes since 1.49: +168 -1 lines
Diff to previous 1.49 (colored)

Add support for the audio volume keys found on many laptops' builtin
keyboard. These specific keys are posted to a kernel thread which will
issue mixer commands if an audio device exists.

Written by Alexey Vatchenko <avv , mail zp ua> with tweaks by deraadt@ and I.

Revision 1.49 / (download) - annotate - [select for diffs], Sun Mar 12 10:34:50 2006 UTC (18 years, 3 months ago) by jakemsr
Branch: MAIN
Changes since 1.48: +3 -1 lines
Diff to previous 1.48 (colored)

explicitly initialize a couple variables

OK brad@

Revision 1.48 / (download) - annotate - [select for diffs], Mon Jan 2 05:21:37 2006 UTC (18 years, 5 months ago) by brad
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.47: +1 -10 lines
Diff to previous 1.47 (colored)

remove last traces of __BROKEN_INDIRECT_CONFIG.

Thanks to aanriot@ and Michael Knudsen for checking that alpha/i386/macppc
kernels still compile.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Nov 21 18:16:38 2005 UTC (18 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

Move contents of sys/select.h to sys/selinfo.h in preparation for a
userland-visible sys/select.h.  Consistent with what Net and Free do.
OK deraadt@, tested with full ports build by naddy@.

Revision 1.46 / (download) - annotate - [select for diffs], Thu Jun 2 19:04:18 2005 UTC (19 years ago) by joris
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.45: +3 -2 lines
Diff to previous 1.45 (colored)



correctly close the audio device in audio_open() if one of the
precision parameters is zero.

ok tedu@

Revision 1.45 / (download) - annotate - [select for diffs], Thu Apr 14 05:39:17 2005 UTC (19 years, 2 months ago) by brad
Branch: MAIN
Changes since 1.44: +7 -7 lines
Diff to previous 1.44 (colored)

Make sure recording is started before we return EWOULDBLOCK in a read().

From NetBSD

ok mickey@

Revision 1.44 / (download) - annotate - [select for diffs], Sat Jul 10 11:48:30 2004 UTC (19 years, 11 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.43: +5 -7 lines
Diff to previous 1.43 (colored)

replace strange cpp magic by straight code

ok deraadt@

Revision 1.20.2.7 / (download) - annotate - [select for diffs], Thu Feb 19 10:56:13 2004 UTC (20 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.20.2.6: +21 -27 lines
Diff to previous 1.20.2.6 (colored) to branchpoint 1.20 (colored) next main 1.21 (colored)

Merge of current from two weeks agointo the SMP branch

Revision 1.43 / (download) - annotate - [select for diffs], Fri Jan 9 21:32:23 2004 UTC (20 years, 5 months ago) by brad
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.42: +1 -3 lines
Diff to previous 1.42 (colored)

remove uvm_extern.h

tested on alpha, i386, powerpc, sparc64, m68k.

ok miod@

Revision 1.42 / (download) - annotate - [select for diffs], Tue Sep 23 16:51:12 2003 UTC (20 years, 8 months ago) by millert
Branch: MAIN
Changes since 1.41: +22 -26 lines
Diff to previous 1.41 (colored)

Replace select backends with poll backends.  selscan() and pollscan()
now call the poll backend.  With this change we implement greater
poll(2) functionality instead of emulating it via the select backend.
Adapted from NetBSD and including some changes from FreeBSD.
Tested by many, deraadt@ OK

Revision 1.32.2.4 / (download) - annotate - [select for diffs], Mon May 19 22:01:42 2003 UTC (21 years ago) by tedu
Branch: UBC
Changes since 1.32.2.3: +2 -2 lines
Diff to previous 1.32.2.3 (colored) to branchpoint 1.32 (colored) next main 1.33 (colored)

sync

Revision 1.20.2.6 / (download) - annotate - [select for diffs], Fri Mar 28 00:38:09 2003 UTC (21 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.20.2.5: +336 -255 lines
Diff to previous 1.20.2.5 (colored) to branchpoint 1.20 (colored)

Sync the SMP branch with 3.3

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jan 26 23:16:14 2003 UTC (21 years, 4 months ago) by jason
Branch: MAIN
CVS Tags: UBC_SYNC_A, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

compute record high water mark from record parameters not play parameters; from NetBSD kern/19614

Revision 1.32.2.3 / (download) - annotate - [select for diffs], Tue Oct 29 00:33:23 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.32.2.2: +336 -255 lines
Diff to previous 1.32.2.2 (colored) to branchpoint 1.32 (colored)

sync to -current

Revision 1.40 / (download) - annotate - [select for diffs], Mon Aug 26 16:20:04 2002 UTC (21 years, 9 months ago) by mickey
Branch: MAIN
CVS Tags: UBC_SYNC_B, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.39: +230 -230 lines
Diff to previous 1.39 (colored)

space cleanup; some from grendel@zeitbombe.org

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jun 16 01:36:22 2002 UTC (22 years ago) by mickey
Branch: MAIN
Changes since 1.38: +113 -32 lines
Diff to previous 1.38 (colored)

implement kqueue for audio; tested on wiggy and niels@ ok

Revision 1.32.2.2 / (download) - annotate - [select for diffs], Tue Jun 11 03:42:15 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.32.2.1: +63 -63 lines
Diff to previous 1.32.2.1 (colored) to branchpoint 1.32 (colored)

Sync UBC branch to -current

Revision 1.20.2.5 / (download) - annotate - [select for diffs], Thu Mar 28 12:29:44 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.20.2.4: +60 -60 lines
Diff to previous 1.20.2.4 (colored) to branchpoint 1.20 (colored)

Merge in -current from about a week ago

Revision 1.38 / (download) - annotate - [select for diffs], Thu Mar 14 01:26:51 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.37: +61 -61 lines
Diff to previous 1.37 (colored)

First round of __P removal in sys

Revision 1.20.2.4 / (download) - annotate - [select for diffs], Wed Mar 6 02:11:42 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.20.2.3: +6 -8 lines
Diff to previous 1.20.2.3 (colored) to branchpoint 1.20 (colored)

Merge in trunk

Revision 1.37 / (download) - annotate - [select for diffs], Wed Feb 6 14:25:09 2002 UTC (22 years, 4 months ago) by fgsch
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

correct monitor port matching.

Revision 1.36 / (download) - annotate - [select for diffs], Mon Feb 4 20:42:25 2002 UTC (22 years, 4 months ago) by fgsch
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

if we have a monitor port, don't get it, set it.

Revision 1.32.2.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:29 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.32: +5 -7 lines
Diff to previous 1.32 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.35 / (download) - annotate - [select for diffs], Sun Jan 20 19:56:53 2002 UTC (22 years, 4 months ago) by ericj
Branch: MAIN
Changes since 1.34: +1 -5 lines
Diff to previous 1.34 (colored)


make all audio drivers use the new allocm and round_buffersize decl's.
will ease porting, and generally cleans up a bit

Revision 1.34 / (download) - annotate - [select for diffs], Thu Jan 10 18:49:07 2002 UTC (22 years, 5 months ago) by mickey
Branch: MAIN
Changes since 1.33: +3 -3 lines
Diff to previous 1.33 (colored)

return ENOTTY not EINVAL in default: in *ioctl()

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jan 9 17:59:37 2002 UTC (22 years, 5 months ago) by mickey
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

make sure mixer was opened for write for AUDIO_MIXER_WRITE

Revision 1.20.2.3 / (download) - annotate - [select for diffs], Tue Nov 13 21:09:59 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.20.2.2: +14 -12 lines
Diff to previous 1.20.2.2 (colored) to branchpoint 1.20 (colored)

Merge in -current

Revision 1.32 / (download) - annotate - [select for diffs], Tue Nov 6 19:53:18 2001 UTC (22 years, 7 months ago) by miod
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.
(Look ma, I might have broken the tree)

Revision 1.31 / (download) - annotate - [select for diffs], Thu Nov 1 12:13:46 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.30: +4 -3 lines
Diff to previous 1.30 (colored)

Change d_mmap in struct cdevsw from:
        int     (*d_mmap)       __P((dev_t, int, int));
to:
	paddr_t	(*d_mmap)	__P((dev_t, off_t, int));

This allows us to mmap devices past 4GB offsets.

Revision 1.30 / (download) - annotate - [select for diffs], Wed Oct 31 11:00:24 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.29: +10 -9 lines
Diff to previous 1.29 (colored)

Change the audio_hm_if->mappage interface to return paddr_t and take off_t
as the mmap offset.

Revision 1.20.2.2 / (download) - annotate - [select for diffs], Wed Oct 31 03:22:40 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.20.2.1: +12 -8 lines
Diff to previous 1.20.2.1 (colored) to branchpoint 1.20 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.29 / (download) - annotate - [select for diffs], Thu Sep 20 17:02:31 2001 UTC (22 years, 8 months ago) by mpech
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok

Revision 1.28 / (download) - annotate - [select for diffs], Sat Aug 11 22:49:19 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.27: +1 -2 lines
Diff to previous 1.27 (colored)

no need to include vm_prot.h here.

Revision 1.27 / (download) - annotate - [select for diffs], Fri Jul 27 15:26:16 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.26: +3 -3 lines
Diff to previous 1.26 (colored)

Correct return values from audiommap.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jul 3 07:41:53 2001 UTC (22 years, 11 months ago) by hugh
Branch: MAIN
Changes since 1.25: +9 -4 lines
Diff to previous 1.25 (colored)

Make the audio device play nice with revoke(2) by having it reset
both directions if neither read nor write flags are set on close.
Cleared by niklas and with some analysis by bjc.

Revision 1.20.2.1 / (download) - annotate - [select for diffs], Mon May 14 22:23:00 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.20: +249 -64 lines
Diff to previous 1.20 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jan 28 09:45:26 2001 UTC (23 years, 4 months ago) by aaron
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.24: +2 -1 lines
Diff to previous 1.24 (colored)

Add a field to mixer_devinto_t that indicates the minimum delta to change
mixer value. A value of 0 indicates that the driver doesn't supply a delta.
The change is backwards compatible. From NetBSD (needed for uaudio(4) update).

Revision 1.24 / (download) - annotate - [select for diffs], Thu Nov 9 21:31:33 2000 UTC (23 years, 7 months ago) by mickey
Branch: MAIN
Changes since 1.23: +3 -3 lines
Diff to previous 1.23 (colored)

cast pointer to a long for alpha's sake; pointed out by ericj@

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jul 19 09:04:37 2000 UTC (23 years, 10 months ago) by csapuntz
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.22: +19 -11 lines
Diff to previous 1.22 (colored)



As in NetBSD, added direction to allocm/round_buffer_size APIs.
Accomplished by adding functions to audio_hw_if instead of redoing
current ones so as to minimize need to change drivers.

For Neomagic, tell the AC97 subsystem that we don't support reads.

Revision 1.22 / (download) - annotate - [select for diffs], Wed May 24 13:44:17 2000 UTC (24 years ago) by ho
Branch: MAIN
Changes since 1.21: +224 -54 lines
Diff to previous 1.21 (colored)

Permit detach of audio devices, such as uaudio. Selected code
from NetBSD/Lennart Augustsson. (niklas@ ok)

Revision 1.21 / (download) - annotate - [select for diffs], Mon Apr 10 19:49:14 2000 UTC (24 years, 2 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.20: +7 -1 lines
Diff to previous 1.20 (colored)

make .mpg playing more usefull, i.e. supply entropy

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jan 3 19:38:12 2000 UTC (24 years, 5 months ago) by fgsch
Branch: MAIN
CVS Tags: SMP_BASE
Branch point for: SMP
Changes since 1.19: +3 -16 lines
Diff to previous 1.19 (colored)

Remove dependencies between midi & audio. midi now will compile on
speaker only systems.

Revision 1.19 / (download) - annotate - [select for diffs], Sun Dec 5 18:35:33 1999 UTC (24 years, 6 months ago) by espie
Branch: MAIN
CVS Tags: kame_19991208
Changes since 1.18: +3 -1 lines
Diff to previous 1.18 (colored)

Pass device mode to query_encoding in the structure to fill, so
that devices that don't need it are not affected.

eso has those weird 16 bits mode that differ in endianess depending
on READ/WRITE. Use this to avoid setting AUDIO_FLAGS_EMULATED needlessly.

Reorder eso modes slightly so that emulated modes are always last.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Nov 20 18:51:58 1999 UTC (24 years, 6 months ago) by espie
Branch: MAIN
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (colored)

ioctl arguments are u_long.
Replaces `undefined' code with `defined' behavior...

gcc 2.96 performs switch cases range analysis, warns about unreachable
cases, and weeds them out.

In

switch(i) {
case VALUE:
}

VALUE is first coerced into the type of i.  If i is signed, VALUE is
unsigned and exceeds i range, you lose... the result of the conversion
is undefined.

Revision 1.17 / (download) - annotate - [select for diffs], Sat Jun 19 19:49:02 1999 UTC (24 years, 11 months ago) by jason
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.16: +10 -4 lines
Diff to previous 1.16 (colored)

From NetBSD:
Don't clobber the error returned by uiomove() when starting the audio
output (in case we got a partial block).

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jan 2 00:02:39 1999 UTC (25 years, 5 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.15: +21 -9 lines
Diff to previous 1.15 (colored)

Midi & sequencer support from NetBSD, mostly by Lennart Augustsson

Revision 1.15 / (download) - annotate - [select for diffs], Fri Nov 20 15:57:19 1998 UTC (25 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

careful off handling in mmap routines

Revision 1.14 / (download) - annotate - [select for diffs], Tue Nov 3 21:00:09 1998 UTC (25 years, 7 months ago) by downsj
Branch: MAIN
Changes since 1.13: +163 -180 lines
Diff to previous 1.13 (colored)

Partial sync with NetBSD, adds new trigger methods.

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jul 24 01:59:38 1998 UTC (25 years, 10 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.12: +1 -3 lines
Diff to previous 1.12 (colored)

Kill the god damned COMPAT_12.  Thanks, guys.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Apr 26 21:03:06 1998 UTC (26 years, 1 month ago) by provos
Branch: MAIN
Changes since 1.11: +1914 -967 lines
Diff to previous 1.11 (colored)

update audio from NetBSD, mostly by Lennart Augustsson <augustss@cs.chalmers.se>

Revision 1.11 / (download) - annotate - [select for diffs], Sat Apr 25 04:57:13 1998 UTC (26 years, 1 month ago) by millert
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

Change a '< sc->sc_lowat' to '<= sc->sc_lowat' for consistency with rest of
source.  I've had this in my tree forever and I don't recall the originator.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Jul 10 23:06:29 1997 UTC (26 years, 11 months ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.9: +248 -156 lines
Diff to previous 1.9 (colored)

sync with NETBSD 30/3/97 + adapating aria.c

Revision 1.9 / (download) - annotate - [select for diffs], Wed Apr 9 14:46:12 1997 UTC (27 years, 2 months ago) by kstailey
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.8: +1 -1 lines
Diff to previous 1.8 (colored)

change space to "_" in tsleep() string

Revision 1.8 / (download) - annotate - [select for diffs], Sun May 26 00:26:49 1996 UTC (28 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)

sync 0521

Revision 1.7 / (download) - annotate - [select for diffs], Sun Apr 21 22:19:38 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.6: +11 -20 lines
Diff to previous 1.6 (colored)

partial sync with netbsd 960418, more to come

Revision 1.6 / (download) - annotate - [select for diffs], Thu Apr 18 23:46:55 1996 UTC (28 years, 1 month ago) by niklas
Branch: MAIN
Changes since 1.5: +66 -40 lines
Diff to previous 1.5 (colored)

NetBSD 960317 merge

Revision 1.5 / (download) - annotate - [select for diffs], Sat Mar 2 00:29:19 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.4: +67 -30 lines
Diff to previous 1.4 (colored)

From NetBSD: sync with 960217 sources

Revision 1.4 / (download) - annotate - [select for diffs], Tue Feb 27 09:43:15 1996 UTC (28 years, 3 months ago) by niklas
Branch: MAIN
Changes since 1.3: +30 -21 lines
Diff to previous 1.3 (colored)

From NetBSD: update to 960217 sources

Revision 1.3 / (download) - annotate - [select for diffs], Mon Jan 8 07:44:56 1996 UTC (28 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +5 -7 lines
Diff to previous 1.2 (colored)

from netbsd; Make the block size always a whole number of samples

Revision 1.2 / (download) - annotate - [select for diffs], Mon Nov 20 09:36:56 1995 UTC (28 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)

provide floor for sampling rate; from khym@bga.com; netbsd pr#1770

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:52:28 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:52:28 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.