Home | History | Annotate | only in /src/sys/dev/audio
History log of /src/sys/dev/audio
RevisionDateAuthorComments
 1.4 21-Jul-2021  skrll need <sys/param.h> for COHERENCY_UNIT

Minor KNF along the way.
 1.3 11-Jan-2020  isaki branches: 1.3.10;
Remove old debug #ifdefs.
 1.2 08-May-2019  isaki branches: 1.2.2; 1.2.6;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file alaw.c was initially added on branch isaki-audio2.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.6.1 17-Jan-2020  ad Sync with head.
 1.2.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file alaw.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.3.10.1 01-Aug-2021  thorpej Sync with HEAD.
 1.147 15-Oct-2025  thorpej Use device_setprop_string().
 1.146 27-May-2024  nia audio(4): Handle delta == 0 in audio_volume_(up|down).

These functions are used by the pmf power handler functions to deal
with keyboard volume up/down key presses.

However, delta is optional, and may not be returned by certain hardware
drivers, including the earliest reference drivers (it is unlikely that
these are used on any systems with pmf volume keys on the keyboard,
but still).

XXX it may make sense to have 16 as a minimum bound for delta, since
pressing the volume up key on a keyboard 255 times doesn't sound
particularly fun.
 1.145 01-Oct-2023  mlelstv Fix output for big-endian hardware.
Also optimize the output scaling routine.
 1.144 05-Jun-2023  mlelstv We cannot handle input with precision != stride yet.
Drain input buffer for unhandled input.
 1.143 23-Apr-2023  mlelstv print stage formats with AUDIO_DEBUG
 1.142 23-Apr-2023  mlelstv Be a little bit more informative on device timeout.
 1.141 23-Apr-2023  mlelstv Whitespace
 1.140 23-Apr-2023  mlelstv Add 24bit/32bit hardware support.
 1.139 23-Apr-2023  mlelstv Whitespace
 1.138 23-Apr-2023  mlelstv Make audio_device information available to drvctl and devpubd.
 1.137 17-Apr-2023  mlelstv Input and output codecs produce and consume internal audio data, so
don't byteswap it.
 1.136 25-Aug-2022  riastradh branches: 1.136.4;
audio(4): Fix bug in detaching audio16 and beyond.

The minor numbers have only four bits for the unit number, so unit
numbers past 15 can't be represented as is. Attempting to revoke
them was once harmless, when the system made no attempt to avoid
open/detach races; now it crashes because vdevgone assumes that the
minor number can be mapped back to an autoconf device, but it's the
wrong one. With this change, we stop trying to revoke units beyond
15, because they can't be opened anyway (which may be a bug in its
own right, requiring expansion of the minor number encoding!).

Reported-by: syzbot+6634ffd48997ae9b1eb0@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=db40a795a0b078f9b3b9fa0d3b7a9addcd2534de

Reported-by: syzbot+d2df39bb3f72975c0a97@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=cbdd598287529cff9a8c4230263f7414df88db4b

Reported-by: syzbot+1404969f68424f8f6e4b@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=6e4782408d0351769215fe433986f1844a546774

Reported-by: syzbot+2a4174a65609b3a00abb@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=886bbee544c2337683e24c801f9b632630a24681

Reported-by: syzbot+c0d9e49f22e571650736@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=7fb2e5576ebae731e859283f85c97747d2824f35

Reported-by: syzbot+583ba2cdb8aa6e59a4bf@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=2af44f5245eba572ebfb222070b9fd1378854303
 1.135 13-Aug-2022  isaki audio: Rework about usrbuf allocation.
- Allocate the usrbuf from kmem(9) instead of uvm(9). The usrbuf has used
uvm(9), in case mmap(2) might be issued later. However, despite the most
apps don't use mmap(2), allocating (and reallocating) uvm(9) every time
would be expensive. In addition, uvm(9) for recording usrbuf was totally
pointless now.
- For playback, the usrbuf memory will be allocated in pages. Because the
usrbuf for playback is mostly near 64KB for backward compatibility.
This will reduce reallocation especially from the initial ulaw to the most
commonly used format like slinear16/2ch/48kHz.
- When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to
uvm(9).
- Prohibit changing playback format once mmap(2) is called.
It follows netbsd-7.
- For recording, the usrbuf memory will be allocated in the requested size
every time as before. Because the usrbuf for recording is only one block
and is enough small to the page in the most case.
Inspired by PR kern/56947.
 1.134 06-Jul-2022  riastradh uvm(9): fo_mmap caller guarantees positive size.

No functional change intended, just sprinkling assertions to make it
clearer.
 1.133 23-Apr-2022  isaki audio(4): Fix a typo in comment. Remove several old comments.
 1.132 23-Apr-2022  isaki audio(4): Clean up about audio_realloc().
- audio_realloc() never returns NULL, so there is no need to check it.
- audio_free() is no point in this case.
 1.131 23-Apr-2022  isaki audio(4): Remove no longer used counters.
These were used at very early phase of development.
 1.130 23-Apr-2022  isaki audio(4): Restore(implement) AUDIO_GETIOFFS ioctl.
 1.129 23-Apr-2022  isaki audio(4): Fix an (unintended) minor behavior on AUDIO_FLUSH.
On NetBSD7, when AUDIO_FLUSH was issued, .offset of AUDIO_GETOOFFS was
reinitialized (to one block ahead from zero) or unchanged depend on
whether the user encoding is hardware native or not (probably).
I don't believe that it's intended or we need to maintain it.
Now, AUDIO_FLUSH always clears the offset to zero.
 1.128 21-Apr-2022  macallan #if 0 now unused audio_track_is_record() to appease clang
 1.127 20-Apr-2022  isaki audio(4): Rework AUDIO_GETOOFFS.
- Count .samples/.deltablks in blocks. It makes .deltablks integer wrap
around safe.
- Remove suspicious one block offset from .offset. I added the offset
because it was observed so on NetBSD7. But according to manpage, it
should not be. And it looks fine without the offset.
- Related to that, remove a comment in AUDIO_WSEEK.
Limit the user-visible buffer to usrbuf only.
 1.126 20-Apr-2022  isaki audio(4): Make recording buffer more robust.
Previously, main buffer in recording track was usrbuf, which is the closest
buffer to the userland. Because, this buffer arrangement was symmetrical
with the playback track, and had affinity with the past implementation.
However, in the current implementation, read(2) (from user application)
takes recorded block out from inputbuf, which is the closest buffer to
rmixer, to usrbuf. So it was not good way to use the usrbuf as main buffer.
Now, usrbuf in recording track holds only fragment bytes in order to
transfer to the userland, and main buffer in recording track is the inputbuf,
the closest to rmixer.

Buffer size of the inputbuf is also modified. Previously, it was less than
64KB or at least 4 blocks. This had affinity with playback track and the
past implementation. But this was not appropriate for both formats with
too large frames or too small frames. In large frames (for example,
192kHz/12ch), 184KB buffer would be allocated but it corresponds to only
40msec. In opposite, in small frames (for example, 8000Hz/1ch), 64KB
buffer would be allocated and it corresponds to 4.1 seconds. But for such
machines that have 8000Hz/1ch device, in-kernel 64KB memory would probably
be expensive.
Now, inputbuf will always be allocated 16(NBLKIN) blocks, regardless of its
hardware format. It corresponds to 160msec on modern archs (if blk_ms=10),
or 640msec on antique archs (if blk_ms=40).
 1.125 20-Apr-2022  isaki audio(4): Make debug messages better in audio_ioctl() and mixier_ioctl().
Divide by case. Reduce to one line if possible.
 1.124 19-Apr-2022  riastradh audio(4): Wait for opens to drain in detach.

Otherwise detach may barge ahead and start freeing things before open
has finished and is about to use them after free.

Reported-by: syzbot+31d2619e72c2c8436cc9@syzkaller.appspotmail.com
 1.123 09-Apr-2022  riastradh audio(4): Use membar_acquire, not membar_enter.

Cheaper and adequate to make an atomic_swap into a load-acquire.
 1.122 31-Mar-2022  pgoyette For device modules that provide both auto-config and /dev/xxx
interfaces, make sure that initialization and destruction
follow the proper sequence. This is triggered by the recent
changes to the devsw stuff; per riastradh@ the required call
sequence is:

devsw_attach()
config_init_component() or config_cf*_attach()
...
config_fini_component() or config_cf*_detach()
devsw_detach()

While here, add a few missing calls to some of the detach
routines.

Testing of these changes has been limited to:
1. compile without build break
2. no related test failures from atf
3. modload/modunload work as well as
before.

No functional device testing done, since I don't have any
of these devices. Let me know of any damage I might cause
here!

XXX Some of the modules affected by this commit are already
XXX broken; see kern/56772. This commit does not break
any additional modules (as far as I know).
 1.121 28-Mar-2022  riastradh audio(4): Use d_cfdriver/devtounit to avoid open/detach races.
 1.120 26-Mar-2022  isaki Add terminology comments.
 1.119 26-Mar-2022  isaki Improve comments.
 1.118 26-Mar-2022  isaki Remove a dead code in audio_track_record().
 1.117 26-Mar-2022  isaki Clarify the assertion in audio_rmixer_process().
By previous commit (r1.116), the assersion no longer fires even without
this modification. But the condition was a bit inaccurate.
There is no need to check the data length must be aligned to blocks here
(though it also should be aligned now). What we should check here is that
the tail must be aligned.
 1.116 26-Mar-2022  isaki Fix conditions that audio_read() calls audio_track_record().
audio_track_record() must be called when usrbuf has at least one free block.

I hope that this will fix the panic reported in PR kern/56644.
When an user process specifies the hardware format as its recording format
(i.e., there is no track conversions), if the user process read(2) a small
amount of data and the rmixer_process then runs, depending on the conditions,
the panic may happen. I have never reproduced it because it's difficult to
do intentionally.

Thanks Y.Sugahara and riastradh@ for help and comments.
 1.115 14-Mar-2022  riastradh audio(4): Fix typo in previous -- atomic_store_release, not reease.

Built the wrong kernel to compile-test AUDIO_DEBUG, oops.
 1.114 14-Mar-2022  riastradh audio(4): Membar audit.

Won't affect anything on x86 because atomic r/m/w operations are
always full sequential consistency barriers, but might potentially
fix problems on, e.g., arm.

Note 1: I'm not clear on why the track lock is a bespoke mutex made
out of an atomic -- why not just mutex(9)?

Note 2: I'm not convinced the audio_mlog_flush synchronization is
correct; what happens if the softint runs on two CPUs at the same
time and swaps mlog_wpage simultaneously?

Note 3: Should maybe use atomic_load/store_relaxed for mlog_full and
mlog_drop, and atomic_inc/dec for mlog_refs.
 1.113 12-Dec-2021  andvar fix various typos, mainly in comments.
 1.112 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.111 05-Dec-2021  msaitoh s/faciliate/facilitate/ in comment.
 1.110 10-Oct-2021  riastradh audio(9): Issue pserialize_perform outside sc_lock in audiodetach.

Breaks another deadlock between sc_lock and high-priority xcalls at
softint serial. With any luck, this should be the last such softint
deadlock in audio!
 1.109 10-Oct-2021  riastradh audio(9): Call hw_if->getdev without sc_lock.

Holding sc_lock is not necessary -- I reviewed all ~70 cases in-tree,
and none of them rely on state protected by sc_lock. Essentially
everything just copies from static data or data initialized at attach
time.

(Exceptions: tms320av110.c issues a bus_space_read_1, but I don't see
any reason why that needs to be serialized; and uaudio.c reads from
sc_dying, but that's not necessary and also not protected by sc_lock
anyway.)

Holding sc_lock is harmful because at least hdafg(4) can trigger module
autoload that leads to pserialize_perform, which waits for logic to run
at softint serial on all CPUs; at the same time, audio_softintr_rd/wr
run at softint serial and take sc_lock, so this leads to deadlock.
 1.108 26-Sep-2021  thorpej Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89
 1.107 07-Sep-2021  andvar s/aquire/acquire/ in comments, also one typo fix acqure->acquire.
 1.106 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.105 21-Jul-2021  isaki branches: 1.105.2;
AUDIO_SETINFO: fix a bug that the gain and the balance could not be set
at the same time. Fix PR kern/56308.
 1.104 08-Jun-2021  riastradh audio(4): Revert revision 1.96 and redo it another way.

Instead of refusing to open /dev/audioN for writes when the device
doesn't support playback, just refuse to issue writes.

Although it seems more sensible to me to reject writable opens early
on, and it seems Solaris does so, this makes querying device
properties a little trickier and is a change to the NetBSD semantics.
 1.103 04-Jun-2021  riastradh audio(4): When closing /dev/audioN, drain before removing from list.

Previously, in revision 1.100, I factored the SLIST_REMOVE out of
audio_unlink and audio_close up into audioclose since it is now used
by /dev/audio, /dev/audioctl, and /dev/mixer alike. But I didn't
realize that the order

1. audio_track_drain
2. SLIST_REMOVE from sc_files

was significant; it matters because audio_track_drain waits for
wakeups that are delivered by hardware interrupts only to files
listed in sc_files.

This also fixes a bug introduced with the audiobell -- it was missing
the SLIST_REMOVE altogether.

For now, duplicate the SLIST_REMOVE calls in a few more places --
this is suboptimal but I want to make sure the logic works before
factoring it all out to tidy up.
 1.102 01-Jun-2021  riastradh branches: 1.102.2;
audio(4): audio_unlink never fails, so make it return void.
 1.101 01-Jun-2021  riastradh audio(4): Insert mixers and audioctls into sc_files on open too.

This is necessary so that on detach we set file->dying before any
operations, particularly audioclose, try to acquire a psref by the
time the audio softc is gone.

Candidate fix for PR kern/56164.
 1.100 01-Jun-2021  riastradh audio(4): No need to set file->dying when closing the file.

No other file operations are possible by the time we get to
audioclose.
 1.99 01-Jun-2021  riastradh audio(4): Grab sc->sc_cred under sc->sc_lock before freeing.

Otherwise we may race with open, leaking a cred no longer in use and
freeing a cred still in use.
 1.98 01-Jun-2021  riastradh audio(4): Use kmem_alloc(sizeof(*p)) style.
 1.97 01-Jun-2021  riastradh audio(4): Make sure to return ENXIO if device is being detached.

Don't return 0 indicating successful open of an unusable device!
 1.96 01-Jun-2021  riastradh audio(4): Set AUMODE_PLAY/RECORD only if asked _and_ supported.

If one is requested and _not_ supported, fail; otherwise we might
enter audio_write with a null play track and crash on KASSERT.
 1.95 02-May-2021  nia audio: Only score hardware formats by channel count at count<=2

Scoring by channel count makes sense when you are using hardware that
supports mono and stereo formats. However, if your hardware also supports
surround formats, defaulting to those might be confusing. So, don't
prefer them.

Problem reported and fix tested by tcmart14 with a 2015 model Macbook Pro.
 1.94 26-Apr-2021  thorpej audioprint(): handle AUDIODEV_TYPE_AUX.
 1.93 26-Apr-2021  thorpej audio_attach_mi(): Be explicit about using the "audiobus" interface attribute,
as the caller may be a device that carries more than one.
 1.92 24-Apr-2021  thorpej branches: 1.92.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.91 14-Feb-2021  isaki branches: 1.91.2;
Add missing curlwp_bindx() corresponding to curlwp_bind().
Pointed out by riastradh@.
 1.90 09-Feb-2021  isaki Protect also audioopen() and audiobellopen() from audiodetach() with
psref(9), as well as others(audioread, audiowrite, etc..).
- Rename audio_file_enter to audio_sc_acquire_fromfile, audio_file_exit
to audio_sc_release, for clarify. These are the reference counter for
this sc.
- Introduce audio_sc_acquire_foropen for audio{,bell}open.
- audio_open needs to examine sc_dying again before inserting it into
sc_files, in order to keep sc_files consistency.
The race between audiodetach and audioopen is pointed out by riastradh@.
Thank you for many advices.
 1.89 09-Feb-2021  isaki Change the lock conditions to call audio_unlink().
This can remove a different copy of audio_exlock_enter() in audio_unlink()
and can use normal one. Also, in audiodetach(), this can set the exlock
at more natual order (before calling audio_unlink()).
No noticeable functional changes are intended.
Thanks for comments, riastradh@.
 1.88 15-Jan-2021  isaki Improve error messages.
- prefix MD device name if it's considered to be related to the MD driver.
- revise some messages.
 1.87 15-Jan-2021  isaki Change (harmless) zero-length debug messages.
sys/modules is compiled with -Wzero-length-format and this
makes sys/modules compilable even if AUDIO_DEBUG is defined.
 1.86 19-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.85 13-Dec-2020  isaki Revise comments.
 1.84 13-Dec-2020  isaki Fix a return value of audiopoll().
fo_poll is expected to return revents rather than errno on error.
 1.83 13-Dec-2020  isaki Avoid a dead lock in audiodetach, since rev 1.63.
audio_unlink() must be called without exlock held (and
audio_mixer_destroy() must be called with exlock held).
This makes unplugging during playing/recording work (again).
Reported by Julian Coleman on current-users:
http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html
 1.82 13-Dec-2020  isaki Add missing newline.
 1.81 09-Dec-2020  isaki Rewrite error handling on audio_open().
This also fixes a few resource leaks on error case.
 1.80 09-Dec-2020  isaki Fix that audio_open() didn't halt the recording mixer correctly
if fd_allocfile() failed, since rev 1.65.
Will fix PR kern/55848.
 1.79 07-Sep-2020  isaki branches: 1.79.2;
Fix misspellings in comment.
 1.78 23-Aug-2020  isaki Improve debug messages.
 1.77 23-Aug-2020  isaki Improve and update comments.
 1.76 23-Aug-2020  isaki Style fixes.
 1.75 29-May-2020  isaki Fix suspend/resume.
- Revert temporary usage of sc_[pr]busy during suspend. These indicate
whether the mixer needs to be restarted or not.
- Avoid timeout error when about to suspend.
 1.74 26-May-2020  nia audio: Only restart recording mixer on resume if it's already been started
 1.73 26-May-2020  nia audio: remove comment that is no longer valid
 1.72 26-May-2020  nia audio: Restore compat with Solaris for 8-bit LINEAR.

It's always signed, unless it's LINEAR8.

PR kern/55175
 1.71 26-May-2020  nia audio: Fix logic for resuming when the device is in use.

audio_[r/p]mixer_start should never be called when the device is
marked busy.

Resolves a panic on resume when audio is playing, PR kern/55301
 1.70 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.69 01-May-2020  isaki Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.
Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).
But please don't be eager to make the default value shorter.

<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.68 29-Apr-2020  isaki Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.
Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.
 1.67 19-Apr-2020  isaki Improve the blocksize notation.
The blocksize is expressed in bytes, and the millisecond notation
is supplementary information to make it easier to understand.
 1.66 17-Apr-2020  isaki Improve diagnostic messages.
 1.65 26-Mar-2020  isaki branches: 1.65.2;
Fix to start recording immediately when open() with READ mode is
called (unless pause).
- Opening /dev/audio always initializes pause with false. Therefore
it always starts recording.
- Opening /dev/sound inherites pause from the sticky parameter.
Therefore whether /dev/sound starts recording or not depends on the
sticky pause parameter.
This fixes two problems:
- Opening /dev/audio didn't start recording after merging isaki-audio2.
- Opening /dev/sound didn't start recording regardless of the sticky
pause, probably since long time ago (at least netbsd-7).
 1.64 07-Mar-2020  isaki Fix/Update comments about allocm/freem.
 1.63 07-Mar-2020  isaki Split sc_lock and sc_exlock.
Most (probably all) malloc/free (or routines which may sleep) now can be
called without holding mutex.
Pointed out by riastradh@.
 1.62 04-Mar-2020  isaki Restore backward compatibility with netbsd-7 audio.
For sticky parameters (encoding, precision, channels, sample_rate and pause):
- AUDIO_SETINFO for nonexistent track updates sticky parameters.
- AUDIO_GETINFO for nonexistent track reads sticky parameters.
For blocksize, hiwat, lowat and {play.record}.buffer_size:
- AUDIO_SETINFO for nonexistent track does nothing.
- AUDIO_GETINFO for nonexistent track returns dummy non-zero values.
Nonexistent track is a playback track on O_RDONLY descriptor for example,
or both tracks on /dev/audioctl.
 1.61 01-Mar-2020  isaki Improve an error message about round_blocksize.
 1.60 01-Mar-2020  isaki Fix wrong parameter displayed in debug messages.
 1.59 01-Mar-2020  isaki Reinitialize the sticky parameters whenever the hardware format is changed.
When the number of the hardware channels becomes less than the number of
channels that sticky parameters remember, subsequent open("/dev/sound") will
fail without this treatment. This is for rev 1.43.
 1.58 29-Feb-2020  isaki Minor fix. audio_prinfo.pause is u_char, not bool.
 1.57 29-Feb-2020  isaki Release memories on audiobellclose.
It's rest of the last commit.
 1.56 23-Feb-2020  isaki Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@
 1.55 23-Feb-2020  isaki Improve error handling around audio_hw_probe().
It was difficult to return multiple errors.
 1.54 23-Feb-2020  isaki Make start_input/halt_input optional if the driver has no recording,
make start_output/halt_output optional if the driver has no playback.
And remove such never called functions.
 1.53 22-Feb-2020  chs remove some unnecessary includes of internal UVM headers.
 1.52 22-Feb-2020  isaki Make calling get_props() lockless.
get_props() of all MD drivers now can be called without sc_lock.
 1.51 22-Feb-2020  isaki On audio_[pr]mixer_halt(), it's better to reset parameters in intr_lock.
 1.50 22-Feb-2020  isaki Add KASSERTs. audio_[pr]mixer_start() need exlock.
 1.49 22-Feb-2020  isaki Move #if DIAGNOSTIC..#endif to correct place.
It should ignore stray interrupts regardless of DIAGNOSTIC.
 1.48 22-Feb-2020  isaki hw_if->query_format is already mandatory method. Drop null checks.
 1.47 22-Feb-2020  isaki Improve KASSERT messages.
 1.46 22-Feb-2020  isaki Change two aprint_error_dev() to device_printf() (and improve messages).
This is also called from other than boot.
 1.45 22-Feb-2020  isaki const-ify. These arguments are no longer written back.
 1.44 22-Feb-2020  isaki Fix/Update comments.
 1.43 22-Feb-2020  isaki Limit the number of channels that userland apps can set (by AUDIO_SETINFO)
to the number of channels supported by the hardware or less, if the hardware
supports multi channels.
- On monaural or stereo hardware, userland apps can always set 1ch or 2ch.
The kernel (audio layer) can convert mono-stereo each other.
- On 3ch (2.1ch) hardware, for example, userland apps can set 1, 2, or 3ch,
but not 4ch or more.
This allows userland apps to know actual number of channels supported by
the hardware in the same way as before.
PR kern/54973.
 1.42 15-Feb-2020  isaki Remove incorrect KASSERT(!mutex_owned()).
Pointed out by riastradh@.
 1.41 11-Jan-2020  isaki Simplify async_mixer handling.
- It makes FIOASYNC code in mixer_ioctl() symmetric.
- For readability, mixer_async_{add,remove}() should take pid argument
though pid is always curproc.
 1.40 11-Jan-2020  isaki Remove old debug #ifdefs.
 1.39 08-Jan-2020  isaki Fix an resource leak on audiobell close.
audioclose() freed audio_file_t structure, but only audiobellclose
didn't pass there. I change that all of freeing audio_file_t is done
by each *_close().
 1.38 08-Jan-2020  isaki Remove obsoleted comment.
 1.37 08-Jan-2020  isaki branches: 1.37.2;
Move mutex_exit() correct place to protect sc_async_mixer.
Thanks maxv@!
 1.36 27-Dec-2019  msaitoh s/sucess/success/ in comment.
 1.35 26-Dec-2019  isaki Improve and simplify around audio_realloc().
 1.34 26-Dec-2019  isaki Use M_WAITOK instead of M_NOWAIT.
These allocations don't require NOWAIT constraints.
Will fix PR kern/54796.
 1.33 06-Nov-2019  isaki Fix a wrong calculation of recording ring buffer. Reported on
http://mail-index.netbsd.org/current-users/2019/11/04/msg036976.html
 1.32 18-Oct-2019  msaitoh s/initalize/initialize/ in comment or printf message.
 1.31 06-Sep-2019  isaki Tune some debug message level.
These messages are important for debugging hardware driver.
 1.30 29-Aug-2019  isaki Fix lock assertion on async I/O mode.
psignal() must be called without any spin locks.
Thanks maxv@!
 1.29 23-Aug-2019  maxv Add missing mutex, we were hitting a KASSERT.
 1.28 10-Jul-2019  isaki branches: 1.28.2;
Use kmem_alloc/free() instead of old kern_malloc/free().
 1.27 10-Jul-2019  isaki Fix freem() argument. The 3rd argument is bufsize, not direction...
 1.26 07-Jul-2019  isaki Avoid memory reallocation on SET_FORMAT.
 1.25 07-Jul-2019  isaki Rearrange some KASSERT and debug messages, to sync with others.
 1.24 07-Jul-2019  isaki Fix to evaluate the validity of this track at earlier on audio_read().
It fixes a panic on read() against descriptor opened as O_RDWR on the
half duplex device.
 1.23 06-Jul-2019  isaki Implement auto recovery of the mixing volume.
 1.22 26-Jun-2019  isaki Improve debug message and remove duplicated one.
 1.21 26-Jun-2019  isaki Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible. It may improve timbre.
If it cannot represent a sine wave, it falls back to a triangular
wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
Now audiobellopen() initializes playback parameters other than
sample_rate, and new audiobellsetrate() sets sample_rate.
 1.20 25-Jun-2019  isaki Put the lowered mixing volume back when all playback tracks are closed.
TODO: about long life descriptor.
 1.19 23-Jun-2019  isaki Restore sysctl_teardown which was unintentionally dropped.
 1.18 19-Jun-2019  isaki Don't wait until a block is filled.
This improves that short sound breaks.
 1.17 12-Jun-2019  isaki Fill silence if the last block of the first track is not filled.
 1.16 10-Jun-2019  isaki branches: 1.16.2;
Use AUDIO_SCALEDOWN() macro rather than seemingly strange ifdefs.
Discussed on source-changes-d.
 1.15 10-Jun-2019  isaki Add missing newline to some error messages.
 1.14 10-Jun-2019  isaki Call get_props() once at attach.
 1.13 08-Jun-2019  isaki Improve checking and displaying property.
- Full/half duplex and independentness are valid only on bidirectional
device.
- MMAP is no longer hardware driver's property.
 1.12 08-Jun-2019  isaki Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.11 06-Jun-2019  isaki Revert rev1.7.
Don't take care of incorrect drivers. They should be fixed.
PR kern/54264. OK'ed by nakayama@-san.
 1.10 25-May-2019  isaki Fix typo in comment.
 1.9 23-May-2019  isaki Remove unnecessary file lock.
It has been introduced to prevent multiple syscalls entering
simultaneously. But it's completely unnecessary.
It fixes firefox problem in PR kern/54177.
 1.8 21-May-2019  isaki Adjust debug message. Inspired from PR kern/54177.
 1.7 13-May-2019  nakayama audio_open:
On full duplex hardware, the flags passed to hw_if->open() is always
(FREAD | FWRITE). But some devices (e.g. uaudio) check its
capabilities at open(), so unidirection devices like USB speakers
always return EACCES.

Avoid open() failure on such devices by checking the capabilities of
the device and changing the flags passed to hw_if->open().
 1.6 13-May-2019  nakayama sysctl "multiuser" type is CTLTYPE_BOOL, so use bool instead of int.
 1.5 13-May-2019  nakayama audio_hw_probe:
Return error if both play and record probes failed.

Avoid audio is disabled on devices with only play like USB speakers.
 1.4 13-May-2019  nakayama audioattach:
Output the cause of the audio device disabled along with the error code.
 1.3 11-May-2019  maya Don't use a confusing GCC extension. NFC
 1.2 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file audio.c was initially added on branch isaki-audio2.
 1.1.2.9 05-May-2019  isaki Revive multiuser control.
 1.1.2.8 04-May-2019  isaki Improve comments.
 1.1.2.7 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.6 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.1.2.5 03-May-2019  isaki Remove dev/audiovar.h. It already have been just a link to
dev/audio/audiovar.h in this branch.
 1.1.2.4 03-May-2019  isaki Remove query_encoding and set_params interfaces from audio_hw_if
and remove related backward compatible routines.
All drivers were converted to use new query_format/set_format.
 1.1.2.3 27-Apr-2019  isaki Add audio_indexof_format(). It finds index matches with specified
audio_param_t from array of audio_format_t.
Formerly, it was auconv_set_converter() that convert userland
params to the hardware native (linear) format and such conversion
is unnecessary in audio2. But some drivers have gotten index from
this format array using auconv_set_converter(). This function is
an alternative to such usage.
 1.1.2.2 24-Apr-2019  isaki Accept if bufsize returned from round_buffersize() is a multiple of
blksize.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.16.2.4 21-Apr-2020  martin Sync with HEAD
 1.16.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.16.2.2 10-Jun-2019  christos Sync with HEAD
 1.16.2.1 10-Jun-2019  christos file audio.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.28.2.23 28-Jul-2021  snj Pull up following revision(s) (requested by isaki in ticket #1325):
sys/dev/audio/audio.c: revision 1.105
AUDIO_SETINFO: fix a bug that the gain and the balance could not be set
at the same time. Fix PR kern/56308.
 1.28.2.22 05-May-2021  martin Pull up following revision(s) (requested by nia in ticket #1268):

sys/dev/audio/audio.c: revision 1.95

audio: Only score hardware formats by channel count at count<=2

Scoring by channel count makes sense when you are using hardware that
supports mono and stereo formats. However, if your hardware also supports
surround formats, defaulting to those might be confusing. So, don't
prefer them.

Problem reported and fix tested by tcmart14 with a 2015 model Macbook Pro.
 1.28.2.21 01-Mar-2021  martin Pull up following revision(s) (requested by isaki in ticket #1219):

sys/dev/audio/audio.c: revision 1.89
sys/dev/audio/audio.c: revision 1.90
sys/dev/audio/audio.c: revision 1.91

Change the lock conditions to call audio_unlink().

This can remove a different copy of audio_exlock_enter() in audio_unlink()
and can use normal one. Also, in audiodetach(), this can set the exlock
at more natual order (before calling audio_unlink()).

No noticeable functional changes are intended.
Thanks for comments, riastradh@.

Protect also audioopen() and audiobellopen() from audiodetach() with
psref(9), as well as others(audioread, audiowrite, etc..).
- Rename audio_file_enter to audio_sc_acquire_fromfile, audio_file_exit
to audio_sc_release, for clarify. These are the reference counter for
this sc.
- Introduce audio_sc_acquire_foropen for audio{,bell}open.
- audio_open needs to examine sc_dying again before inserting it into
sc_files, in order to keep sc_files consistency.

The race between audiodetach and audioopen is pointed out by riastradh@.
Thank you for many advices.

Add missing curlwp_bindx() corresponding to curlwp_bind().
Pointed out by riastradh@.
 1.28.2.20 28-Feb-2021  martin Pull up following revision(s) (requested by isaki in ticket #1218):

sys/dev/audio/audio.c: revision 1.84

Fix a return value of audiopoll().
fo_poll is expected to return revents rather than errno on error.
 1.28.2.19 28-Feb-2021  martin Pull up following revision(s) (requested by isaki in ticket #1217):

sys/dev/audio/audio.c: revision 1.46
sys/dev/audio/audio.c: revision 1.82
sys/dev/audio/audio.c: revision 1.85
sys/dev/audio/audio.c: revision 1.87
sys/dev/audio/audio.c: revision 1.88

Change two aprint_error_dev() to device_printf() (and improve messages).
This is also called from other than boot.

Add missing newline.

Revise comments.

Change (harmless) zero-length debug messages.
sys/modules is compiled with -Wzero-length-format and this
makes sys/modules compilable even if AUDIO_DEBUG is defined.

Improve error messages.
- prefix MD device name if it's considered to be related to the MD driver.
- revise some messages.
 1.28.2.18 19-Dec-2020  martin Pull up following revision(s) (requested by isaki in ticket #1158):

sys/dev/audio/audio.c: revision 1.83

Avoid a dead lock in audiodetach, since rev 1.63.
audio_unlink() must be called without exlock held (and
audio_mixer_destroy() must be called with exlock held).

This makes unplugging during playing/recording work (again).

Reported by Julian Coleman on current-users:
http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html
 1.28.2.17 19-Dec-2020  martin Pull up following revision(s) (requested by isaki in ticket #1156):

sys/dev/audio/audio.c: revision 1.80
sys/dev/audio/audio.c: revision 1.81

Fix that audio_open() didn't halt the recording mixer correctly
if fd_allocfile() failed, since rev 1.65.

Will fix PR kern/55848.

-

Rewrite error handling on audio_open().
This also fixes a few resource leaks on error case.
 1.28.2.16 07-Jun-2020  martin Pull up following revision(s) (requested by isaki in ticket #950):

sys/dev/audio/audio.c: revision 1.71
sys/dev/audio/audio.c: revision 1.73
sys/dev/audio/audio.c: revision 1.74
sys/dev/audio/audio.c: revision 1.75
sys/dev/audio/audiovar.h: revision 1.12

audio: Fix logic for resuming when the device is in use.

audio_[r/p]mixer_start should never be called when the device is
marked busy.

Resolves a panic on resume when audio is playing, PR kern/55301

audio: remove comment that is no longer valid

audio: Only restart recording mixer on resume if it's already been started

Fix suspend/resume.
- Revert temporary usage of sc_[pr]busy during suspend. These indicate
whether the mixer needs to be restarted or not.
- Avoid timeout error when about to suspend.
 1.28.2.15 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #911):

sys/dev/audio/audiodef.h: revision 1.13
sys/dev/audio/audiodef.h: revision 1.14
sys/arch/sparc/include/param.h: revision 1.74
sys/arch/evbarm/conf/GENERIC64: revision 1.148
sys/arch/sh3/include/param.h: revision 1.25
sys/arch/evbarm/conf/GENERIC: revision 1.75
sys/arch/m68k/include/param.h: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.564
sys/arch/hppa/include/param.h: revision 1.27
sys/dev/audio/audio.c: revision 1.68
sys/arch/vax/include/param.h: revision 1.63
sys/dev/audio/audio.c: revision 1.69

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.

- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.

Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.


Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.

Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).

But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.28.2.14 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #910):

sys/dev/audio/audio.c: revision 1.49
sys/dev/audio/audio.c: revision 1.61
sys/dev/audio/audio.c: revision 1.66
sys/dev/audio/audio.c: revision 1.67

Move #if DIAGNOSTIC..#endif to correct place.
It should ignore stray interrupts regardless of DIAGNOSTIC.

Improve an error message about round_blocksize.

Improve diagnostic messages.

Improve the blocksize notation.
The blocksize is expressed in bytes, and the millisecond notation
is supplementary information to make it easier to understand.
 1.28.2.13 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #909):

sys/dev/audio/audio.c: revision 1.65

Fix to start recording immediately when open() with READ mode is
called (unless pause).
- Opening /dev/audio always initializes pause with false. Therefore
it always starts recording.
- Opening /dev/sound inherites pause from the sticky parameter.
Therefore whether /dev/sound starts recording or not depends on the
sticky pause parameter.

This fixes two problems:
- Opening /dev/audio didn't start recording after merging isaki-audio2.
- Opening /dev/sound didn't start recording regardless of the sticky
pause, probably since long time ago (at least netbsd-7).
 1.28.2.12 30-Apr-2020  martin Pull up following revision(s) (requested by isaki in ticket #877):

sys/dev/audio/audio.c: revision 1.55
sys/dev/audio/audio.c: revision 1.41
sys/dev/audio/audio.c: revision 1.48
sys/dev/audio/audiovar.h: revision 1.7
sys/dev/audio/audio.c: revision 1.63 (via patch)
sys/dev/audio/audiovar.h: revision 1.11
sys/dev/audio/audio.c: revision 1.64

Simplify async_mixer handling.
- It makes FIOASYNC code in mixer_ioctl() symmetric.
- For readability, mixer_async_{add,remove}() should take pid argument
though pid is always curproc.

hw_if->query_format is already mandatory method. Drop null checks.

Improve error handling around audio_hw_probe().
It was difficult to return multiple errors.

Split sc_lock and sc_exlock.

Most (probably all) malloc/free (or routines which may sleep) now can be
called without holding mutex.
Pointed out by riastradh@.

Fix/Update comments about allocm/freem.
 1.28.2.11 30-Apr-2020  martin Pull up following revision(s) (requested by isaki in ticket #876):

sys/dev/audio/audio.c: revision 1.60
sys/dev/audio/audio.c: revision 1.62

Fix wrong parameter displayed in debug messages.

Restore backward compatibility with netbsd-7 audio.

For sticky parameters (encoding, precision, channels, sample_rate and pause):
- AUDIO_SETINFO for nonexistent track updates sticky parameters.
- AUDIO_GETINFO for nonexistent track reads sticky parameters.

For blocksize, hiwat, lowat and {play.record}.buffer_size:
- AUDIO_SETINFO for nonexistent track does nothing.
- AUDIO_GETINFO for nonexistent track returns dummy non-zero values.

Nonexistent track is a playback track on O_RDONLY descriptor for example,
or both tracks on /dev/audioctl.
 1.28.2.10 30-Apr-2020  martin Pull up following revision(s) (requested by isaki in ticket #875):

sys/dev/audio/audio.c: revision 1.59
share/man/man4/audio.4: revision 1.102
share/man/man4/audio.4: revision 1.103
sys/dev/audio/audio.c: revision 1.43

Limit the number of channels that userland apps can set (by AUDIO_SETINFO)
to the number of channels supported by the hardware or less, if the hardware
supports multi channels.
- On monaural or stereo hardware, userland apps can always set 1ch or 2ch.
The kernel (audio layer) can convert mono-stereo each other.
- On 3ch (2.1ch) hardware, for example, userland apps can set 1, 2, or 3ch,
but not 4ch or more.

This allows userland apps to know actual number of channels supported by
the hardware in the same way as before.

PR kern/54973.


Reinitialize the sticky parameters whenever the hardware format is changed.

When the number of the hardware channels becomes less than the number of
channels that sticky parameters remember, subsequent open("/dev/sound") will
fail without this treatment. This is for rev 1.43.


Add description about channel limitation introduced in audio.c 1.43.
PR kern/54973.

Remove trailing whitespace.
 1.28.2.9 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #794):

sys/dev/audio/audiodef.h: revision 1.10
sys/dev/audio/audio.c: revision 1.56 (via patch)
sys/dev/audio/audio.c: revision 1.57
sys/dev/audio/audiovar.h: revision 1.8
sys/dev/audio/audio.c: revision 1.38

Remove obsoleted comment.

Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@

Release memories on audiobellclose.
It's rest of the last commit.
 1.28.2.8 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #793):

sys/dev/audio/audio.c: revision 1.42
sys/dev/audio/audio.c: revision 1.47
sys/dev/audio/audiodef.h: revision 1.9

Remove incorrect KASSERT(!mutex_owned()).
Pointed out by riastradh@.

Improve KASSERT messages.
 1.28.2.7 21-Jan-2020  martin Pull up following revision(s) (requested by isaki in ticket #620):

sys/dev/audio/audio.c: revision 1.39

Fix an resource leak on audiobell close.
audioclose() freed audio_file_t structure, but only audiobellclose
didn't pass there. I change that all of freeing audio_file_t is done
by each *_close().
 1.28.2.6 21-Jan-2020  martin Pull up following revision(s) (requested by isaki in ticket #619):

sys/dev/audio/audio.c: revision 1.37

Move mutex_exit() correct place to protect sc_async_mixer.
Thanks maxv@!
 1.28.2.5 02-Jan-2020  martin Pull up following revision(s) (requested by isaki in ticket #593):

sys/dev/audio/audio.c: revision 1.34
sys/dev/audio/audio.c: revision 1.35

Use M_WAITOK instead of M_NOWAIT.
These allocations don't require NOWAIT constraints.

Will fix PR kern/54796.

-

Improve and simplify around audio_realloc().
 1.28.2.4 19-Nov-2019  martin Pull up following revision(s) (requested by isaki in ticket #448):

sys/dev/audio/audio.c: revision 1.33

Fix a wrong calculation of recording ring buffer. Reported on
http://mail-index.netbsd.org/current-users/2019/11/04/msg036976.html
 1.28.2.3 06-Oct-2019  martin Pull up following revision(s) (requested by isaki in ticket #286):

sys/dev/audio/audio.c: revision 1.31

Tune some debug message level.
These messages are important for debugging hardware driver.
 1.28.2.2 06-Oct-2019  martin Pull up following revision(s) (requested by isaki in ticket #285):

sys/dev/audio/audiovar.h: revision 1.5
sys/dev/audio/audio.c: revision 1.30

Fix lock assertion on async I/O mode.
psignal() must be called without any spin locks.
Thanks maxv@!
 1.28.2.1 06-Oct-2019  martin Pull up following revision(s) (requested by isaki in ticket #284):

sys/dev/audio/audio.c: revision 1.29

Add missing mutex, we were hitting a KASSERT.
 1.37.2.2 29-Feb-2020  ad Sync with head.
 1.37.2.1 17-Jan-2020  ad Sync with head.
 1.65.2.1 20-Apr-2020  bouyer Sync with HEAD
 1.79.2.3 03-Apr-2021  thorpej Sync with HEAD.
 1.79.2.2 03-Jan-2021  thorpej Sync w/ HEAD.
 1.79.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.91.2.8 06-Apr-2021  thorpej audiosearch(): Remove a stray CFARG_LOCATORS tag.
 1.91.2.7 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.91.2.6 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.91.2.5 03-Apr-2021  thorpej config_attach_loc() -> config_attach() with CFARG_LOCATORS argument.
 1.91.2.4 28-Mar-2021  thorpej audio only has one interface attribute, so no need to be explcit about it.
audio also doesn't have locators, so don't pass any to config_search().
 1.91.2.3 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.91.2.2 21-Mar-2021  thorpej In "rescan" routines, always pass locators and the interface attribute
straight through to config_search(). Also, for devices that carry only
one interface attribute, no need to do an ifattr_match(), because
rescan_with_cfdata() will have already validated that the parent is
eligible, which includes an interface attribute check.
 1.91.2.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.92.2.3 01-Aug-2021  thorpej Sync with HEAD.
 1.92.2.2 17-Jun-2021  thorpej Sync w/ HEAD.
 1.92.2.1 13-May-2021  thorpej Sync with HEAD.
 1.102.2.1 06-Jun-2021  cjep sync with head
 1.105.2.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.136.4.1 26-Mar-2024  martin Pull up following revision(s) (requested by mlelstv in ticket #650):

sys/dev/audio/audio.c: revision 1.137

Input and output codecs produce and consume internal audio data, so
don't byteswap it.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 04-May-2019  isaki branches: 1.1.2;
file audio_dai.h was initially added on branch isaki-audio2.
 1.1.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.1 04-May-2019  isaki Move dev/audio_dai.h -> dev/audio/audio_dai.h
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file audio_dai.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.3 13-Sep-2020  isaki Support audio descriptor for fstat(1).
sys/dev/audio/*.h: export only what we need for fstat.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 04-May-2019  isaki branches: 1.1.2;
file audio_if.h was initially added on branch isaki-audio2.
 1.1.2.2 08-May-2019  isaki Good bye stream_filter.
 1.1.2.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file audio_if.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.5 21-Jul-2021  skrll need <sys/param.h> for COHERENCY_UNIT

Minor KNF along the way.
 1.4 20-Mar-2021  isaki branches: 1.4.2;
Fix and improve the buffer length calculation to avoid zero length
even if blk_ms is small.
This fixes PR kern/56059.
 1.3 26-Jun-2019  isaki branches: 1.3.2; 1.3.10; 1.3.12;
Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible. It may improve timbre.
If it cannot represent a sine wave, it falls back to a triangular
wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
Now audiobellopen() initializes playback parameters other than
sample_rate, and new audiobellsetrate() sets sample_rate.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 04-May-2019  isaki branches: 1.1.2;
file audiobell.c was initially added on branch isaki-audio2.
 1.1.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.1 04-May-2019  isaki Move dev/audiobell* -> dev/audio/audiobell*.
 1.2.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file audiobell.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.3.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3.2.1 06-Apr-2021  martin Pull up following revision(s) (requested by isaki in ticket #1241):

sys/dev/audio/audiobell.c: revision 1.4

Fix and improve the buffer length calculation to avoid zero length
even if blk_ms is small.

This fixes PR kern/56059.
 1.4.2.1 01-Aug-2021  thorpej Sync with HEAD.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 04-May-2019  isaki branches: 1.1.2;
file audiobellvar.h was initially added on branch isaki-audio2.
 1.1.2.1 04-May-2019  isaki Move dev/audiobell* -> dev/audio/audiobell*.
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file audiobellvar.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.20 13-Aug-2022  isaki audio: Rework about usrbuf allocation.
- Allocate the usrbuf from kmem(9) instead of uvm(9). The usrbuf has used
uvm(9), in case mmap(2) might be issued later. However, despite the most
apps don't use mmap(2), allocating (and reallocating) uvm(9) every time
would be expensive. In addition, uvm(9) for recording usrbuf was totally
pointless now.
- For playback, the usrbuf memory will be allocated in pages. Because the
usrbuf for playback is mostly near 64KB for backward compatibility.
This will reduce reallocation especially from the initial ulaw to the most
commonly used format like slinear16/2ch/48kHz.
- When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to
uvm(9).
- Prohibit changing playback format once mmap(2) is called.
It follows netbsd-7.
- For recording, the usrbuf memory will be allocated in the requested size
every time as before. Because the usrbuf for recording is only one block
and is enough small to the page in the most case.
Inspired by PR kern/56947.
 1.19 23-Apr-2022  isaki audio(4): Remove no longer used counters.
These were used at very early phase of development.
 1.18 20-Apr-2022  isaki audio(4): Rework AUDIO_GETOOFFS.
- Count .samples/.deltablks in blocks. It makes .deltablks integer wrap
around safe.
- Remove suspicious one block offset from .offset. I added the offset
because it was observed so on NetBSD7. But according to manpage, it
should not be. And it looks fine without the offset.
- Related to that, remove a comment in AUDIO_WSEEK.
Limit the user-visible buffer to usrbuf only.
 1.17 20-Apr-2022  isaki audio(4): Make recording buffer more robust.
Previously, main buffer in recording track was usrbuf, which is the closest
buffer to the userland. Because, this buffer arrangement was symmetrical
with the playback track, and had affinity with the past implementation.
However, in the current implementation, read(2) (from user application)
takes recorded block out from inputbuf, which is the closest buffer to
rmixer, to usrbuf. So it was not good way to use the usrbuf as main buffer.
Now, usrbuf in recording track holds only fragment bytes in order to
transfer to the userland, and main buffer in recording track is the inputbuf,
the closest to rmixer.

Buffer size of the inputbuf is also modified. Previously, it was less than
64KB or at least 4 blocks. This had affinity with playback track and the
past implementation. But this was not appropriate for both formats with
too large frames or too small frames. In large frames (for example,
192kHz/12ch), 184KB buffer would be allocated but it corresponds to only
40msec. In opposite, in small frames (for example, 8000Hz/1ch), 64KB
buffer would be allocated and it corresponds to 4.1 seconds. But for such
machines that have 8000Hz/1ch device, in-kernel 64KB memory would probably
be expensive.
Now, inputbuf will always be allocated 16(NBLKIN) blocks, regardless of its
hardware format. It corresponds to 160msec on modern archs (if blk_ms=10),
or 640msec on antique archs (if blk_ms=40).
 1.16 21-Aug-2021  andvar s/recoding/recording/ in comments where it didn't actually mean recoding.
 1.15 13-Sep-2020  isaki Support audio descriptor for fstat(1).
sys/dev/audio/*.h: export only what we need for fstat.
 1.14 29-Apr-2020  isaki Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.
Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.
 1.13 28-Mar-2020  isaki Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.
- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.
 1.12 05-Mar-2020  riastradh Revert "Include opt_diagnostic.h for DIAGNOSTIC."

This did not do what I thought it did. opt_diagnostic.h is only for
the unused _DIAGNOSTIC, which seems like an abortive attempt to
incrementally convert DIAGNOSTIC to an opt_*.h option rather than a
command-line option.
 1.11 05-Mar-2020  riastradh Include opt_diagnostic.h for DIAGNOSTIC.

...at least, in header files, which may not have already included
libkern.h.
 1.10 23-Feb-2020  isaki Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@
 1.9 22-Feb-2020  isaki Improve KASSERT messages.
 1.8 25-Jan-2020  jmcneill defopt AUDIO_BLK_MS
 1.7 06-Jul-2019  isaki branches: 1.7.2; 1.7.4;
Implement auto recovery of the mixing volume.
 1.6 26-Jun-2019  isaki Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible. It may improve timbre.
If it cannot represent a sine wave, it falls back to a triangular
wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
Now audiobellopen() initializes playback parameters other than
sample_rate, and new audiobellsetrate() sets sample_rate.
 1.5 25-Jun-2019  isaki Put the lowered mixing volume back when all playback tracks are closed.
TODO: about long life descriptor.
 1.4 10-Jun-2019  isaki branches: 1.4.2;
Use AUDIO_SCALEDOWN() macro rather than seemingly strange ifdefs.
Discussed on source-changes-d.
 1.3 23-May-2019  isaki Remove unnecessary file lock.
It has been introduced to prevent multiple syscalls entering
simultaneously. But it's completely unnecessary.
It fixes firefox problem in PR kern/54177.
 1.2 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file audiodef.h was initially added on branch isaki-audio2.
 1.1.2.2 24-Apr-2019  isaki Accept if bufsize returned from round_buffersize() is a multiple of
blksize.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.4.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.2.2 10-Jun-2019  christos Sync with HEAD
 1.4.2.1 10-Jun-2019  christos file audiodef.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.7.4.2 29-Feb-2020  ad Sync with head.
 1.7.4.1 25-Jan-2020  ad Sync with head.
 1.7.2.4 18-May-2020  martin Pull up following revision(s) (requested by isaki in ticket #911):

sys/dev/audio/audiodef.h: revision 1.13
sys/dev/audio/audiodef.h: revision 1.14
sys/arch/sparc/include/param.h: revision 1.74
sys/arch/evbarm/conf/GENERIC64: revision 1.148
sys/arch/sh3/include/param.h: revision 1.25
sys/arch/evbarm/conf/GENERIC: revision 1.75
sys/arch/m68k/include/param.h: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.564
sys/arch/hppa/include/param.h: revision 1.27
sys/dev/audio/audio.c: revision 1.68
sys/arch/vax/include/param.h: revision 1.63
sys/dev/audio/audio.c: revision 1.69

Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.

- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.

Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.

Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.


Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.

Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.

For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).

But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
 1.7.2.3 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #794):

sys/dev/audio/audiodef.h: revision 1.10
sys/dev/audio/audio.c: revision 1.56 (via patch)
sys/dev/audio/audio.c: revision 1.57
sys/dev/audio/audiovar.h: revision 1.8
sys/dev/audio/audio.c: revision 1.38

Remove obsoleted comment.

Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@

Release memories on audiobellclose.
It's rest of the last commit.
 1.7.2.2 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #793):

sys/dev/audio/audio.c: revision 1.42
sys/dev/audio/audio.c: revision 1.47
sys/dev/audio/audiodef.h: revision 1.9

Remove incorrect KASSERT(!mutex_owned()).
Pointed out by riastradh@.

Improve KASSERT messages.
 1.7.2.1 27-Jan-2020  martin Pull up following revision(s) (requested by nia in ticket #657):

sys/dev/files.audio: revision 1.13
sys/dev/files.audio: revision 1.14
sys/arch/amd64/conf/GENERIC: revision 1.559
sys/arch/evbarm/conf/GENERIC: revision 1.71
sys/arch/evbarm/conf/GENERIC64: revision 1.134
sys/dev/audio/audiodef.h: revision 1.8

Set AUDIO_BLK_MS=4 - unlikely to cause significant overhead on non-m68k.

Several of us have been setting this in /etc/sysctl.conf for months, to
get better performance from applications that require synced audio, etc.
It's also mentioned as a good value with low overhead on most archs here:
href="https://mail-index.netbsd.org/tech-kern/2019/12/07/msg025830.html

We could probably go lower, but this is low enough to make most/all
software run well, removing frame drops. It's also low enough to get
emulators/mednafen to stop complaining in the console.

defopt AUDIO_BLK_MS

Follow amd64 and set AUDIO_BLK_MS=4 by default

defopt -> defparam (oops)
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file audiofil.h was initially added on branch isaki-audio2.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file audiofil.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.13 23-Apr-2023  mlelstv Enable 24bit support by default.
 1.12 29-May-2020  isaki Fix suspend/resume.
- Revert temporary usage of sc_[pr]busy during suspend. These indicate
whether the mixer needs to be restarted or not.
- Avoid timeout error when about to suspend.
 1.11 07-Mar-2020  isaki Split sc_lock and sc_exlock.
Most (probably all) malloc/free (or routines which may sleep) now can be
called without holding mutex.
Pointed out by riastradh@.
 1.10 05-Mar-2020  riastradh Revert "Include opt_diagnostic.h for DIAGNOSTIC."

This did not do what I thought it did. opt_diagnostic.h is only for
the unused _DIAGNOSTIC, which seems like an abortive attempt to
incrementally convert DIAGNOSTIC to an opt_*.h option rather than a
command-line option.
 1.9 05-Mar-2020  riastradh Include opt_diagnostic.h for DIAGNOSTIC.

...at least, in header files, which may not have already included
libkern.h.
 1.8 23-Feb-2020  isaki Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@
 1.7 11-Jan-2020  isaki Simplify async_mixer handling.
- It makes FIOASYNC code in mixer_ioctl() symmetric.
- For readability, mixer_async_{add,remove}() should take pid argument
though pid is always curproc.
 1.6 11-Jan-2020  isaki Remove old debug #ifdefs.
 1.5 29-Aug-2019  isaki branches: 1.5.2;
Fix lock assertion on async I/O mode.
psignal() must be called without any spin locks.
Thanks maxv@!
 1.4 26-Jun-2019  isaki branches: 1.4.2;
Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible. It may improve timbre.
If it cannot represent a sine wave, it falls back to a triangular
wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
Now audiobellopen() initializes playback parameters other than
sample_rate, and new audiobellsetrate() sets sample_rate.
 1.3 10-Jun-2019  isaki branches: 1.3.2;
Call get_props() once at attach.
 1.2 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file audiovar.h was initially added on branch isaki-audio2.
 1.1.2.3 05-May-2019  isaki Revive multiuser control.
 1.1.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.3.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.2.2 10-Jun-2019  christos Sync with HEAD
 1.3.2.1 10-Jun-2019  christos file audiovar.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.4.2.4 07-Jun-2020  martin Pull up following revision(s) (requested by isaki in ticket #950):

sys/dev/audio/audio.c: revision 1.71
sys/dev/audio/audio.c: revision 1.73
sys/dev/audio/audio.c: revision 1.74
sys/dev/audio/audio.c: revision 1.75
sys/dev/audio/audiovar.h: revision 1.12

audio: Fix logic for resuming when the device is in use.

audio_[r/p]mixer_start should never be called when the device is
marked busy.

Resolves a panic on resume when audio is playing, PR kern/55301

audio: remove comment that is no longer valid

audio: Only restart recording mixer on resume if it's already been started

Fix suspend/resume.
- Revert temporary usage of sc_[pr]busy during suspend. These indicate
whether the mixer needs to be restarted or not.
- Avoid timeout error when about to suspend.
 1.4.2.3 30-Apr-2020  martin Pull up following revision(s) (requested by isaki in ticket #877):

sys/dev/audio/audio.c: revision 1.55
sys/dev/audio/audio.c: revision 1.41
sys/dev/audio/audio.c: revision 1.48
sys/dev/audio/audiovar.h: revision 1.7
sys/dev/audio/audio.c: revision 1.63 (via patch)
sys/dev/audio/audiovar.h: revision 1.11
sys/dev/audio/audio.c: revision 1.64

Simplify async_mixer handling.
- It makes FIOASYNC code in mixer_ioctl() symmetric.
- For readability, mixer_async_{add,remove}() should take pid argument
though pid is always curproc.

hw_if->query_format is already mandatory method. Drop null checks.

Improve error handling around audio_hw_probe().
It was difficult to return multiple errors.

Split sc_lock and sc_exlock.

Most (probably all) malloc/free (or routines which may sleep) now can be
called without holding mutex.
Pointed out by riastradh@.

Fix/Update comments about allocm/freem.
 1.4.2.2 21-Mar-2020  martin Pull up following revision(s) (requested by isaki in ticket #794):

sys/dev/audio/audiodef.h: revision 1.10
sys/dev/audio/audio.c: revision 1.56 (via patch)
sys/dev/audio/audio.c: revision 1.57
sys/dev/audio/audiovar.h: revision 1.8
sys/dev/audio/audio.c: revision 1.38

Remove obsoleted comment.

Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@

Release memories on audiobellclose.
It's rest of the last commit.
 1.4.2.1 06-Oct-2019  martin Pull up following revision(s) (requested by isaki in ticket #285):

sys/dev/audio/audiovar.h: revision 1.5
sys/dev/audio/audio.c: revision 1.30

Fix lock assertion on async I/O mode.
psignal() must be called without any spin locks.
Thanks maxv@!
 1.5.2.2 29-Feb-2020  ad Sync with head.
 1.5.2.1 17-Jan-2020  ad Sync with head.
 1.5 20-Apr-2024  isaki Fix typo in comment.
 1.4 21-Jul-2021  skrll need <sys/param.h> for COHERENCY_UNIT

Minor KNF along the way.
 1.3 11-Jan-2020  isaki branches: 1.3.10;
Remove old debug #ifdefs.
 1.2 08-May-2019  isaki branches: 1.2.2; 1.2.6;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file linear.c was initially added on branch isaki-audio2.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.6.1 17-Jan-2020  ad Sync with head.
 1.2.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file linear.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.3.10.1 01-Aug-2021  thorpej Sync with HEAD.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file linear.h was initially added on branch isaki-audio2.
 1.1.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file linear.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.6 02-Feb-2024  andvar fix various typos in comments.
 1.5 21-Jul-2021  skrll need <sys/param.h> for COHERENCY_UNIT

Minor KNF along the way.
 1.4 12-Sep-2020  isaki branches: 1.4.6;
Improve slinear16-to-mulaw conversion calculation.
It's about 2~3 times faster on my amd64 and x68k(68030).
 1.3 11-Jan-2020  isaki Remove old debug #ifdefs.
 1.2 08-May-2019  isaki branches: 1.2.2; 1.2.6;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file mulaw.c was initially added on branch isaki-audio2.
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.6.1 17-Jan-2020  ad Sync with head.
 1.2.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file mulaw.c was added on branch phil-wifi on 2019-06-10 22:07:06 +0000
 1.4.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.2 08-May-2019  isaki branches: 1.2.2;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.1 21-Apr-2019  isaki branches: 1.1.2;
file mulaw.h was initially added on branch isaki-audio2.
 1.1.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.1.2.1 21-Apr-2019  isaki Reimplement audio subsystem.
http://mail-index.netbsd.org/tech-kern/2019/04/01/msg024944.html
At first step, audio and devices tightly coupled to audio.
audio.c -> dev/audio.c: completely rewritten.
mulaw.c -> audio/mulaw.c, audio/alaw.c: improve quality.
audiovar.h, mulaw.h: should be removed.
audio/linear.c: efficient new linear-linear converter.
auconv.[ch]: should be removed but need some functions for now.
aurateconv, auvolconv: removed (new audio.c handles it).
audiobell.c: efficient and small new bell driver.
audiobelldata.h: removed 4KB sine wave data.
pad/pad.c: catch up audio, but not cloneable for now.
 1.2.2.2 10-Jun-2019  christos Sync with HEAD
 1.2.2.1 08-May-2019  christos file mulaw.h was added on branch phil-wifi on 2019-06-10 22:07:06 +0000

RSS XML Feed