summaryrefslogtreecommitdiff
path: root/sys/dev/midi.c
AgeCommit message (Collapse)Author
2021-09-26Change the kqueue filterops::f_isfd field to filterops::f_flags, andthorpej
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
2021-08-07Merge thorpej-cfargs2.thorpej
2021-04-26midi_attach_mi(): Be explicit about using the "midibus" interface attribute,thorpej
as the caller may be a device that carries more than one.
2021-04-24Merge thorpej-cfargs branch:thorpej
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?).
2020-12-19Use sel{record,remove}_knote().thorpej
2020-05-23Move proc_lock into the data segment. It was dynamically allocated becausead
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
2019-05-08Merge isaki-audio2 branch, the overhaul of audio subsystem.isaki
- 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
2017-10-28Kill some more extern cfdriver xyz_cd in favour of #include "ioconf.h".riastradh
2017-10-25Use C99 initializer for filteropsmaya
Mostly done with spatch with touchups for indentation @@ expression a; identifier b,c,d; identifier p; @@ const struct filterops p = - { a, b, c, d + { + .f_isfd = a, + .f_attach = b, + .f_detach = c, + .f_event = d, };
2017-06-01Add infrastructure for modularization of audio, midi, and sequencerpgoyette
2016-07-14- Use aprint*() more in xxx_attach().msaitoh
- Add missing aprint_naive("\n"). - Remove extra spaces and tabs. - KNF.
2016-07-07KNF. Remove extra spaces. No functional change.msaitoh
2014-12-30- check sc->dying after sleeping in several more places, andmrg
convert it into EIO error where necessary. - remove a wrong additional mutex_exit() call. - make sure to check sc->dying under the device lock.
2014-12-22various clean ups for midi and sequencer:mrg
midi specific: - add reference counting for midi operations, and ensure that detach waits for other threads to complete before tearing down the device completely. - in detach, halt midi callouts before destroying them - re-check sc->dying after sleeping in midiread() - in real_writebytes(), make sure we're open and not dying - make sure we drop the interrupt lock before calling any code that may want to check thread locks. this is now safe due to the above changes. sequencer specific: - avoid caching the midi softc in the sequencer softc. instead, every time we want to use it, look it up again and make sure it still exists. this fixes various crashes i've seen in the usb midi code when detaching the umidi while it is active.
2014-07-25Add d_discard to all struct cdevsw instances I could find.dholland
All have been set to "nodiscard"; some should get a real implementation.
2014-03-16Change (mostly mechanically) every cdevsw/bdevsw I can find to usedholland
designated initializers. I have not built every extant kernel so I have probably broken at least one build; however I've also found and fixed some wrong cdevsw/bdevsw entries so even if so I think we come out ahead.
2013-09-14Quell a few "unused variable" warnings (where the variables are generatedmartin
by macros)
2012-04-09Tidy up a little, the way that midi attachment code worksplunky
- change midi_attach() to omit the 'parent' arg (there are only two callers of this and it is not used) - change midisyn_attach() to midisyn_init(), so not needing a midi_softc, and fix the midi_pcppi driver to set hw_if and hw_hdl directly in its midi_softc before calling midi_attach() - add a device_t to opl_softc structure, change opl drivers to store the device 'self' in opl_softc and fix opl_attach() to use this opl_softc->dev field directly rather than a field in an otherwise unused midi_softc - remove unnecessary midi_softc from opl and cms drivers (child device provides that) reviewed by mrg
2012-04-05midi_attach() does not actually ever use the parent deviceplunky
pointer, so no need to store it in sc_dev. Further, remove the sc_dev field entirely since it is easily confused with the dev field, which is the 'self' device pointer. Fix the comment.
2012-04-05move the pmf_device_register() for midi.c and midi_pcppi.c to midi_attach()plunky
for symmetry, since it is removed in midi detach code and don't need to call device_pmf_is_registered() before registering it
2012-01-10Call aprint_naive for quiet boot message.njoly
2011-11-24set hwif_softc around midi_attach()s call to ->getinfo(), like the oldmrg
code, so that midi_register_hw_if_ext() works. add a mutex for this to avoid multiple midi_attach()s fighting over it. XXX: this is an ugly interface
2011-11-23Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. Fromjmcneill
the original ad-audiomp branch notes: Add MP locking to the audio drivers. Making the audio drivers MP safe is necessary before efforts can be made to make the VM system MP safe. The are two locks per device instance, an ISR lock and a character device lock. The ISR lock replaces calls to splaudio()/splx(), and will be held across calls to device methods which were called at splaudio() before (e.g. trigger_output). The character device lock is held across calls to nearly all of the methods, excluding some only used for initialization, e.g. get_locks. Welcome to 5.99.57.
2010-07-27printf() size_t with 'z' format modifier in debug code.jakllsch
2009-12-06Simplify these device-activation hooks using the following semanticdyoung
patch. XXX sc_dying must die. @@ type device_t; identifier act, midi_softc, midiactivate, sc, self; @@ int midiactivate(device_t self, enum devact act) { ( struct midi_softc *sc = device_private(self); | - struct midi_softc *sc; + struct midi_softc *sc = device_private(self); ... - sc = device_private(self); ) ... switch (act) { - case DVACT_ACTIVATE: - return (EOPNOTSUPP); - case DVACT_DEACTIVATE: ( sc->dying | sc->sc_dying ) = ( 1 | true ) ; - break; + return 0; + default: + return EOPNOTSUPP; } - return (0); }
2009-08-23I'm not so sure this is actually CPU-intensive in 2009, so don't print it.jmcneill
2009-04-07Cosmetic: in a debug statement, use "%s", __func__ instead of adyoung
misspelling of the detach routine's name.
2008-06-12use device_lookup to get device_tcegger
2008-06-10device_private(device_lookup()) -> device_lookup_private()cegger
ok cube@
2008-04-30Make various bits of debug code compile again.ad
2008-04-28Remove clause 3 and 4 from TNF licensesmartin
2008-04-24Network protocol interrupts can now block on locks, so merge the globalsad
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock). Implications: - Inspecting process state requires thread context, so signals can no longer be sent from a hardware interrupt handler. Signal activity must be deferred to a soft interrupt or kthread. - As the proc state locking is simplified, it's now safe to take exit() and wait() out from under kernel_lock. - The system spends less time at IPL_SCHED, and there is less lock activity.
2008-03-05Fix fallout from midi(4)'s softc split.cube
2008-03-05Include sys/device.h for device_ttnn
2008-03-04Split device_t/softc for midi(4), and other related cosmetic changes.cube
2008-03-01Welcome to 4.99.55:rmind
- Add a lot of missing selinit() and seldestroy() calls. - Merge selwakeup() and selnotify() calls into a single selnotify(). - Add an additional 'events' argument to selnotify() call. It will indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown, zero may be used. Note: please pass appropriate value of 'events' where possible. Proposed on: <tech-kern>
2007-12-16add null pmf handlers.christos
2007-12-05Do not "return 1" from kqfilter for errors. That value is passedpooka
directly to the userland caller and results in a mysterious EPERM. Instead, return EINVAL or something else sensible depending on the case.
2007-12-01aprintify, on behalf of xtraemejmcneill
2007-10-08Use the softint API.ad
2007-07-09Merge some of the less invasive changes from the vmlocking branch:ad
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
2007-06-16Correct format strings for ptrdiff_t and size_t arguments in DPRINTFs,pavel
so that a kernel with AUDIO_DEBUG builds.
2007-03-04Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.christos
2007-02-15Defer wakeup() to the soft interrupt also.ad
2007-02-09Merge newlock2 to head.ad
2006-11-16__unused removal on arguments; approved by core.christos
2006-10-12Add __unused as necessary.thorpej
2006-10-12- sprinkle __unused on function decls.christos
- fix a couple of unused bugs - no more -Wno-unused for i386
2006-09-02add missing initializerchristos
2006-07-02Uppercase CPU.wiz