patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / sound / initval.h
1 #ifndef __SOUND_INITVAL_H
2 #define __SOUND_INITVAL_H
3
4 /*
5  *  Init values for soundcard modules
6  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
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
24 #ifndef MODULE_GENERIC_STRING
25 #ifdef MODULE
26 #define MODULE_GENERIC_STRING(name, string) \
27 static const char __module_generic_string_##name [] \
28   __attribute__ ((unused, __section__(".modstring"))) = #name "=" string;
29 #else
30 #define MODULE_GENERIC_STRING(name, string)
31 #endif
32 #endif
33
34 #define MODULE_CLASSES(val) MODULE_GENERIC_STRING(info_classes, val)
35 #define MODULE_DEVICES(val) MODULE_GENERIC_STRING(info_devices, val)
36 #define MODULE_PARM_SYNTAX(id, val) MODULE_GENERIC_STRING(info_parm_##id, val)
37
38 #define SNDRV_AUTO_PORT         1
39 #define SNDRV_AUTO_IRQ          0xffff
40 #define SNDRV_AUTO_DMA          0xffff
41 #define SNDRV_AUTO_DMA_SIZE     (0x7fffffff)
42
43 #define SNDRV_DEFAULT_IDX1      (-1)
44 #define SNDRV_DEFAULT_STR1      NULL
45 #define SNDRV_DEFAULT_ENABLE1   1
46 #define SNDRV_DEFAULT_PORT1     SNDRV_AUTO_PORT
47 #define SNDRV_DEFAULT_IRQ1      SNDRV_AUTO_IRQ
48 #define SNDRV_DEFAULT_DMA1      SNDRV_AUTO_DMA
49 #define SNDRV_DEFAULT_DMA_SIZE1 SNDRV_AUTO_DMA_SIZE
50 #define SNDRV_DEFAULT_PTR1      SNDRV_DEFAULT_STR1
51
52 #define SNDRV_DEFAULT_IDX       { [0 ... (SNDRV_CARDS-1)] = -1 }
53 #define SNDRV_DEFAULT_STR       { [0 ... (SNDRV_CARDS-1)] = NULL }
54 #define SNDRV_DEFAULT_ENABLE    { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
55 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
56 #ifdef CONFIG_PNP
57 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
58 #else
59 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
60 #endif
61 #define SNDRV_DEFAULT_PORT      { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
62 #define SNDRV_DEFAULT_IRQ       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
63 #define SNDRV_DEFAULT_DMA       { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
64 #define SNDRV_DEFAULT_DMA_SIZE  { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
65 #define SNDRV_DEFAULT_PTR       SNDRV_DEFAULT_STR
66
67 #define SNDRV_BOOLEAN_TRUE_DESC "allows:{{0,Disabled},{1,Enabled}},default:1,dialog:check"
68 #define SNDRV_BOOLEAN_FALSE_DESC "allows:{{0,Disabled},{1,Enabled}},default:0,dialog:check"
69
70 #define SNDRV_ENABLED           "enable:(enable)"
71
72 #define SNDRV_INDEX_DESC        SNDRV_ENABLED ",allows:{{0,7}},unique,skill:required,dialog:list"
73 #define SNDRV_ID_DESC           SNDRV_ENABLED ",unique"
74 #define SNDRV_ENABLE_DESC       SNDRV_BOOLEAN_FALSE_DESC
75 #define SNDRV_ISAPNP_DESC       SNDRV_ENABLED "," SNDRV_BOOLEAN_TRUE_DESC
76 #define SNDRV_DMA8_DESC         SNDRV_ENABLED ",allows:{{0,1},{3}},dialog:list"
77 #define SNDRV_DMA16_DESC        SNDRV_ENABLED ",allows:{{5,7}},dialog:list"
78 #define SNDRV_DMA_DESC          SNDRV_ENABLED ",allows:{{0,1},{3},{5,7}},dialog:list"
79 #define SNDRV_IRQ_DESC          SNDRV_ENABLED ",allows:{{5},{7},{9},{10,12},{14,15}},dialog:list"
80 #define SNDRV_DMA_SIZE_DESC     SNDRV_ENABLED ",allows:{{4,128}},default:64,skill:advanced"
81 #define SNDRV_DMA8_SIZE_DESC    SNDRV_ENABLED ",allows:{{4, 64}},default:64,skill:advanced"
82 #define SNDRV_DMA16_SIZE_DESC   SNDRV_ENABLED ",allows:{{4,128}},default:64,skill:advanced"
83 #define SNDRV_PORT12_DESC       SNDRV_ENABLED ",allows:{{0,0x3fff}},base:16"
84 #define SNDRV_PORT_DESC         SNDRV_ENABLED ",allows:{{0,0xffff}},base:16"
85
86 #ifdef SNDRV_LEGACY_AUTO_PROBE
87 static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
88 {
89         int result = 0; /* number of detected cards */
90
91         while ((signed long)*ports != -1) {
92                 if (probe(*ports) >= 0)
93                         result++;
94                 ports++;
95         }
96         return result;
97 }
98 #endif
99
100 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
101 #include <linux/interrupt.h>
102
103 static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
104 {
105         return IRQ_HANDLED;
106 }
107
108 static int snd_legacy_find_free_irq(int *irq_table)
109 {
110         while (*irq_table != -1) {
111                 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
112                                  SA_INTERRUPT, "ALSA Test IRQ", (void *) irq_table)) {
113                         free_irq(*irq_table, (void *) irq_table);
114                         return *irq_table;
115                 }
116                 irq_table++;
117         }
118         return -1;
119 }
120 #endif
121
122 #ifdef SNDRV_LEGACY_FIND_FREE_DMA
123 static int snd_legacy_find_free_dma(int *dma_table)
124 {
125         while (*dma_table != -1) {
126                 if (!request_dma(*dma_table, "ALSA Test DMA")) {
127                         free_dma(*dma_table);
128                         return *dma_table;
129                 }
130                 dma_table++;
131         }
132         return -1;
133 }
134 #endif
135
136 #endif /* __SOUND_INITVAL_H */