blob: 639544b4fb044c3560196f451d5990c778f7a8e2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * ALSA sequencer main module
3 * Copyright (c) 1998-1999 by Frank van de Pol <fvdpol@coil.demon.nl>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 */
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/init.h>
Paul Gortmaker65a77212011-07-15 13:13:37 -040023#include <linux/module.h>
Paul Gortmaker51990e82012-01-22 11:23:42 -050024#include <linux/device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <sound/core.h>
26#include <sound/initval.h>
27
28#include <sound/seq_kernel.h>
29#include "seq_clientmgr.h"
30#include "seq_memory.h"
31#include "seq_queue.h"
32#include "seq_lock.h"
33#include "seq_timer.h"
34#include "seq_system.h"
35#include "seq_info.h"
Kay Sievers03cfe6f2010-11-23 17:43:19 +010036#include <sound/minors.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#include <sound/seq_device.h>
38
39#if defined(CONFIG_SND_SEQ_DUMMY_MODULE)
Clemens Ladischaa1e77e2005-12-12 09:36:01 +010040int seq_client_load[15] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 14] = -1};
Linus Torvalds1da177e2005-04-16 15:20:36 -070041#else
Clemens Ladischaa1e77e2005-12-12 09:36:01 +010042int seq_client_load[15] = {[0 ... 14] = -1};
Linus Torvalds1da177e2005-04-16 15:20:36 -070043#endif
44int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
45int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
46int seq_default_timer_card = -1;
Clemens Ladischa4f508b2005-09-06 08:00:19 +020047int seq_default_timer_device =
Takashi Iwaibbaf5e92008-10-24 18:16:50 +020048#ifdef CONFIG_SND_SEQ_HRTIMER_DEFAULT
49 SNDRV_TIMER_GLOBAL_HRTIMER
Clemens Ladischa4f508b2005-09-06 08:00:19 +020050#else
51 SNDRV_TIMER_GLOBAL_SYSTEM
52#endif
53 ;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054int seq_default_timer_subdevice = 0;
55int seq_default_timer_resolution = 0; /* Hz */
56
Jaroslav Kyselac1017a42007-10-15 09:50:19 +020057MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@perex.cz>");
Linus Torvalds1da177e2005-04-16 15:20:36 -070058MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer.");
59MODULE_LICENSE("GPL");
60
61module_param_array(seq_client_load, int, NULL, 0444);
62MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod.");
63module_param(seq_default_timer_class, int, 0644);
64MODULE_PARM_DESC(seq_default_timer_class, "The default timer class.");
65module_param(seq_default_timer_sclass, int, 0644);
66MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class.");
67module_param(seq_default_timer_card, int, 0644);
68MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number.");
69module_param(seq_default_timer_device, int, 0644);
70MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number.");
71module_param(seq_default_timer_subdevice, int, 0644);
72MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number.");
73module_param(seq_default_timer_resolution, int, 0644);
74MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz.");
75
Kay Sievers03cfe6f2010-11-23 17:43:19 +010076MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_SEQUENCER);
77MODULE_ALIAS("devname:snd/seq");
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079/*
80 * INIT PART
81 */
82
83static int __init alsa_seq_init(void)
84{
85 int err;
86
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 if ((err = client_init_data()) < 0)
88 goto error;
89
90 /* init memory, room for selected events */
91 if ((err = snd_sequencer_memory_init()) < 0)
92 goto error;
93
94 /* init event queues */
95 if ((err = snd_seq_queues_init()) < 0)
96 goto error;
97
98 /* register sequencer device */
99 if ((err = snd_sequencer_device_init()) < 0)
100 goto error;
101
102 /* register proc interface */
103 if ((err = snd_seq_info_init()) < 0)
104 goto error;
105
106 /* register our internal client */
107 if ((err = snd_seq_system_client_init()) < 0)
108 goto error;
109
Takashi Iwai68ab6102014-10-15 14:06:25 +0200110 snd_seq_autoload_init();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 error:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 return err;
113}
114
115static void __exit alsa_seq_exit(void)
116{
117 /* unregister our internal client */
118 snd_seq_system_client_done();
119
120 /* unregister proc interface */
121 snd_seq_info_done();
122
123 /* delete timing queues */
124 snd_seq_queues_delete();
125
126 /* unregister sequencer device */
127 snd_sequencer_device_done();
128
129 /* release event memory */
130 snd_sequencer_memory_done();
Takashi Iwai68ab6102014-10-15 14:06:25 +0200131
132 snd_seq_autoload_exit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133}
134
135module_init(alsa_seq_init)
136module_exit(alsa_seq_exit)