blob: ddc0d504cf39b3009fe6e22fefab9d7e1da30b0a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __SOUND_SEQ_DEVICE_H
2#define __SOUND_SEQ_DEVICE_H
3
4/*
5 * ALSA sequencer device management
6 * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024/*
25 * registered device information
26 */
27
Linus Torvalds1da177e2005-04-16 15:20:36 -070028struct snd_seq_device {
29 /* device info */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010030 struct snd_card *card; /* sound card */
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 int device; /* device number */
Takashi Iwaiaf03c242015-02-12 13:40:50 +010032 const char *id; /* driver id */
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 char name[80]; /* device name */
34 int argsize; /* size of the argument */
35 void *driver_data; /* private data for driver */
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 void *private_data; /* private data for the caller */
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010037 void (*private_free)(struct snd_seq_device *device);
Takashi Iwai7c37ae52015-02-12 10:51:59 +010038 struct device dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070039};
40
Takashi Iwai7c37ae52015-02-12 10:51:59 +010041#define to_seq_dev(_dev) \
42 container_of(_dev, struct snd_seq_device, dev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070043
Takashi Iwai05662202015-02-12 13:43:22 +010044/* sequencer driver */
45
Linus Torvalds1da177e2005-04-16 15:20:36 -070046/* driver operators
Takashi Iwai05662202015-02-12 13:43:22 +010047 * probe:
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 * Initialize the device with given parameters.
49 * Typically,
50 * 1. call snd_hwdep_new
51 * 2. allocate private data and initialize it
52 * 3. call snd_hwdep_register
53 * 4. store the instance to dev->driver_data pointer.
54 *
Takashi Iwai05662202015-02-12 13:43:22 +010055 * remove:
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 * Release the private data.
57 * Typically, call snd_device_free(dev->card, dev->driver_data)
58 */
Takashi Iwai05662202015-02-12 13:43:22 +010059struct snd_seq_driver {
60 struct device_driver driver;
61 char *id;
62 int argsize;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063};
64
Takashi Iwai05662202015-02-12 13:43:22 +010065#define to_seq_drv(_drv) \
66 container_of(_drv, struct snd_seq_driver, driver)
67
Linus Torvalds1da177e2005-04-16 15:20:36 -070068/*
69 * prototypes
70 */
Takashi Iwai72496ed2015-02-11 22:39:51 +010071#ifdef CONFIG_MODULES
Linus Torvalds1da177e2005-04-16 15:20:36 -070072void snd_seq_device_load_drivers(void);
Takashi Iwai72496ed2015-02-11 22:39:51 +010073#else
74#define snd_seq_device_load_drivers()
75#endif
Takashi Iwaiaf03c242015-02-12 13:40:50 +010076int snd_seq_device_new(struct snd_card *card, int device, const char *id,
77 int argsize, struct snd_seq_device **result);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Takashi Iwaic7e0b5b2005-11-17 14:04:02 +010079#define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device))
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
Takashi Iwai05662202015-02-12 13:43:22 +010081int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv,
82 struct module *mod);
83#define snd_seq_driver_register(drv) \
84 __snd_seq_driver_register(drv, THIS_MODULE)
85void snd_seq_driver_unregister(struct snd_seq_driver *drv);
86
87#define module_snd_seq_driver(drv) \
88 module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister)
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
90/*
91 * id strings for generic devices
92 */
93#define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi"
94#define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth"
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096#endif /* __SOUND_SEQ_DEVICE_H */