Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | #include <linux/init.h> |
Paul Gortmaker | 65a7721 | 2011-07-15 13:13:37 -0400 | [diff] [blame] | 23 | #include <linux/module.h> |
Paul Gortmaker | 51990e8 | 2012-01-22 11:23:42 -0500 | [diff] [blame] | 24 | #include <linux/device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #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 Sievers | 03cfe6f | 2010-11-23 17:43:19 +0100 | [diff] [blame] | 36 | #include <sound/minors.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <sound/seq_device.h> |
| 38 | |
| 39 | #if defined(CONFIG_SND_SEQ_DUMMY_MODULE) |
Clemens Ladisch | aa1e77e | 2005-12-12 09:36:01 +0100 | [diff] [blame] | 40 | int seq_client_load[15] = {[0] = SNDRV_SEQ_CLIENT_DUMMY, [1 ... 14] = -1}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | #else |
Clemens Ladisch | aa1e77e | 2005-12-12 09:36:01 +0100 | [diff] [blame] | 42 | int seq_client_load[15] = {[0 ... 14] = -1}; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #endif |
| 44 | int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; |
| 45 | int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; |
| 46 | int seq_default_timer_card = -1; |
Clemens Ladisch | a4f508b | 2005-09-06 08:00:19 +0200 | [diff] [blame] | 47 | int seq_default_timer_device = |
Takashi Iwai | bbaf5e9 | 2008-10-24 18:16:50 +0200 | [diff] [blame] | 48 | #ifdef CONFIG_SND_SEQ_HRTIMER_DEFAULT |
| 49 | SNDRV_TIMER_GLOBAL_HRTIMER |
| 50 | #elif defined(CONFIG_SND_SEQ_RTCTIMER_DEFAULT) |
Clemens Ladisch | a4f508b | 2005-09-06 08:00:19 +0200 | [diff] [blame] | 51 | SNDRV_TIMER_GLOBAL_RTC |
| 52 | #else |
| 53 | SNDRV_TIMER_GLOBAL_SYSTEM |
| 54 | #endif |
| 55 | ; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | int seq_default_timer_subdevice = 0; |
| 57 | int seq_default_timer_resolution = 0; /* Hz */ |
| 58 | |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 59 | MODULE_AUTHOR("Frank van de Pol <fvdpol@coil.demon.nl>, Jaroslav Kysela <perex@perex.cz>"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | MODULE_DESCRIPTION("Advanced Linux Sound Architecture sequencer."); |
| 61 | MODULE_LICENSE("GPL"); |
| 62 | |
| 63 | module_param_array(seq_client_load, int, NULL, 0444); |
| 64 | MODULE_PARM_DESC(seq_client_load, "The numbers of global (system) clients to load through kmod."); |
| 65 | module_param(seq_default_timer_class, int, 0644); |
| 66 | MODULE_PARM_DESC(seq_default_timer_class, "The default timer class."); |
| 67 | module_param(seq_default_timer_sclass, int, 0644); |
| 68 | MODULE_PARM_DESC(seq_default_timer_sclass, "The default timer slave class."); |
| 69 | module_param(seq_default_timer_card, int, 0644); |
| 70 | MODULE_PARM_DESC(seq_default_timer_card, "The default timer card number."); |
| 71 | module_param(seq_default_timer_device, int, 0644); |
| 72 | MODULE_PARM_DESC(seq_default_timer_device, "The default timer device number."); |
| 73 | module_param(seq_default_timer_subdevice, int, 0644); |
| 74 | MODULE_PARM_DESC(seq_default_timer_subdevice, "The default timer subdevice number."); |
| 75 | module_param(seq_default_timer_resolution, int, 0644); |
| 76 | MODULE_PARM_DESC(seq_default_timer_resolution, "The default timer resolution in Hz."); |
| 77 | |
Kay Sievers | 03cfe6f | 2010-11-23 17:43:19 +0100 | [diff] [blame] | 78 | MODULE_ALIAS_CHARDEV(CONFIG_SND_MAJOR, SNDRV_MINOR_SEQUENCER); |
| 79 | MODULE_ALIAS("devname:snd/seq"); |
| 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | /* |
| 82 | * INIT PART |
| 83 | */ |
| 84 | |
| 85 | static int __init alsa_seq_init(void) |
| 86 | { |
| 87 | int err; |
| 88 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | if ((err = client_init_data()) < 0) |
| 90 | goto error; |
| 91 | |
| 92 | /* init memory, room for selected events */ |
| 93 | if ((err = snd_sequencer_memory_init()) < 0) |
| 94 | goto error; |
| 95 | |
| 96 | /* init event queues */ |
| 97 | if ((err = snd_seq_queues_init()) < 0) |
| 98 | goto error; |
| 99 | |
| 100 | /* register sequencer device */ |
| 101 | if ((err = snd_sequencer_device_init()) < 0) |
| 102 | goto error; |
| 103 | |
| 104 | /* register proc interface */ |
| 105 | if ((err = snd_seq_info_init()) < 0) |
| 106 | goto error; |
| 107 | |
| 108 | /* register our internal client */ |
| 109 | if ((err = snd_seq_system_client_init()) < 0) |
| 110 | goto error; |
| 111 | |
Takashi Iwai | 68ab610 | 2014-10-15 14:06:25 +0200 | [diff] [blame] | 112 | snd_seq_autoload_init(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | error: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | return err; |
| 115 | } |
| 116 | |
| 117 | static void __exit alsa_seq_exit(void) |
| 118 | { |
| 119 | /* unregister our internal client */ |
| 120 | snd_seq_system_client_done(); |
| 121 | |
| 122 | /* unregister proc interface */ |
| 123 | snd_seq_info_done(); |
| 124 | |
| 125 | /* delete timing queues */ |
| 126 | snd_seq_queues_delete(); |
| 127 | |
| 128 | /* unregister sequencer device */ |
| 129 | snd_sequencer_device_done(); |
| 130 | |
| 131 | /* release event memory */ |
| 132 | snd_sequencer_memory_done(); |
Takashi Iwai | 68ab610 | 2014-10-15 14:06:25 +0200 | [diff] [blame] | 133 | |
| 134 | snd_seq_autoload_exit(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | module_init(alsa_seq_init) |
| 138 | module_exit(alsa_seq_exit) |