1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 #ifndef __SOUND_SEQ_DEVICE_H
3 #define __SOUND_SEQ_DEVICE_H
6 * ALSA sequencer device management
7 * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
11 * registered device information
14 struct snd_seq_device
{
16 struct snd_card
*card
; /* sound card */
17 int device
; /* device number */
18 const char *id
; /* driver id */
19 char name
[80]; /* device name */
20 int argsize
; /* size of the argument */
21 void *driver_data
; /* private data for driver */
22 void *private_data
; /* private data for the caller */
23 void (*private_free
)(struct snd_seq_device
*device
);
27 #define to_seq_dev(_dev) \
28 container_of(_dev, struct snd_seq_device, dev)
30 /* sequencer driver */
34 * Initialize the device with given parameters.
36 * 1. call snd_hwdep_new
37 * 2. allocate private data and initialize it
38 * 3. call snd_hwdep_register
39 * 4. store the instance to dev->driver_data pointer.
42 * Release the private data.
43 * Typically, call snd_device_free(dev->card, dev->driver_data)
45 struct snd_seq_driver
{
46 struct device_driver driver
;
51 #define to_seq_drv(_drv) \
52 container_of(_drv, struct snd_seq_driver, driver)
58 void snd_seq_device_load_drivers(void);
60 #define snd_seq_device_load_drivers()
62 int snd_seq_device_new(struct snd_card
*card
, int device
, const char *id
,
63 int argsize
, struct snd_seq_device
**result
);
65 #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
67 int __must_check
__snd_seq_driver_register(struct snd_seq_driver
*drv
,
69 #define snd_seq_driver_register(drv) \
70 __snd_seq_driver_register(drv, THIS_MODULE)
71 void snd_seq_driver_unregister(struct snd_seq_driver
*drv
);
73 #define module_snd_seq_driver(drv) \
74 module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
77 * id strings for generic devices
79 #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
80 #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
81 #define SNDRV_SEQ_DEV_ID_UMP "seq-ump-client"
83 #endif /* __SOUND_SEQ_DEVICE_H */