sound: Get rid of unused MIDIQ macros
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 3f8a85a085c710f50b8bcd4efe915268882129d2)
sound: Merge chn_intr() with chn_intr_locked()
There is no scenario where chn_intr() is called with the channel lock
already held.
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D53854
(cherry picked from commit 0794365d5d3cc93940b873553382288a2a2c88c4)
sound: Allocate mpu401 with M_WAITOK
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit fd1312d3629cda9691c67af6154946cd55467076)
sys/conf/files: Fix sndstat path
Reported by: CI
Fixes: bafa8c951d8c ("sound: Move sndstat out of pcm/")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 8c7a7d7df508faa75515d4f0b8ef58c30ad4ccc9)
snd_uaudio: Do not use pcm_channel->lock to protect uaudio_chan
This is a layering violation, but it also makes the control flow
confusing; snd_uaudio(4) should have its own lock to protect its
structures.
Fixes: 5cc34a83e1 ("Revert "sound: Merge chn_intr() with chn_intr_locked()"")
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54102
(cherry picked from commit c234740c9d34c2b953c6010f6a01b0aca9648c08)
sound: Make mpu_if definitions static
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 3094c5e388df296f1b84579f70a5583ddc3bc26a)
sound: Retire mpu_callbackp()
It is the exact same as mpu_callback().
No functional changed intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit e3b57ceffef0158a72a7a5aedfa9df88b3a8a88b)
sound: Get rid of unused midi/midi.c defines
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 4a2d1532e84135a50ba8414ceaafc0c3a1bfe94b)
sound: Move sndstat out of pcm/
Needed by follow-up patches that will add sndstat support for midi/
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54140
(cherry picked from commit bafa8c951d8cfaec75e774af03d7ab6fadb448b9)
sound: Improve snd_midi->{in,out}q allocation
Currently we lock and allocate the buffers with M_NOWAIT, without
checking if the return value of malloc(). This is not necessary as
subsequent check below will eventually check that. However, for
correctness, allocate the buffers with M_WAITOK (there is no reason not
to) and lock afterwards.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54131
(cherry picked from commit b9db6c21287311b9e861893c065289d987a75804)
sound: Take device type into account in sndstat
sndstat will be extended to work with MIDI devices as well, so separate
functionality based on the device type.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54141
(cherry picked from commit 2aa16666e2fa5c98be8d330cd0c32c9dc3801ba7)
sound: Remove dead if-statement
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit d2baf9301be3093c5f53a7ce1de858a0c690cd07)
sound: Merge midi_destroy() with midi_uninit()
Also always call MPU_UNINIT(). It does not make sense not to if we are
deallocating everything.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54192
(cherry picked from commit d912ea5879cd6b1042671ae3986d496c63be4d49)
snd_dummy: Initial MIDI support
Because testing the midi/ code of sound(4) requires a physical MIDI
device, add some basic MIDI support to snd_dummy(4) so that we can test
patches to midi/ easier.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54127
(cherry picked from commit e963472ef8533fb39b581e746cdc2ddc7447dca2)
sound: Retire midi_devs and mstat_lock
Nowadays midi_devs only has two uses:
1. To verify in midi_init() if a given device unit exists, as well as to
calculate the next device unit. Instead, make sure we always get a
unique unit and channel number using unr(9).
2. To keep track of all midi devices, so that it can destroy them all at
once in midi_sysuninit(). However, since we stopped building midi as
a kernel module, there is no reason to do that, simply let the
drivers tear down the devices themselves.
Also retire mstat_lock since it's only used to protect midi_devs.
PR: 261071
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54126
(cherry picked from commit c508be8ca9578ef6e3e4b31de1baca8038c0e0ae)
sound: Retire MIDI_DEBUG
Better logging will be implemented.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit c288595c4eac14616f94c5b7eb84aad2eeeffc1f)
sound: Rename midi_cdevsw name to "midi"
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit d6121f7b508bf889359e116da1efab08f848e129)
sound: Retire snd_midi->qlock
snd_midi->qlock is used to protect snd_midi->{in,out}q. However, apart
from the numerous LORs present already in the code, there is no reason
not to use snd_midi->lock, as we do for the rest of the structure
Started by: https://github.com/freebsd/freebsd-src/pull/1902
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: dev_nicolas-provost.fr
Differential Revision: https://reviews.freebsd.org/D54129
(cherry picked from commit 4cc78f5dd7c2e82571ced6e23fa22d48c6cd1697)
sound: Stop building midi as a module
There is no reason for this. The midi functions are used by drivers
on-demand anyway. Use SYSINIT(9) instead to do the appropriate
(de-)initilizations.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D54125
(cherry picked from commit 45bb10e0ed5a0b87adcae33635400b5bc36337ec)
sound: Get rid of unnecessary breaks
No functional change intended.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
(cherry picked from commit 21a2aa785d7d7610b3e90e028ae782893d8c095a)