Linux 2.6.13-rc3
[linux-2.6/next.git] / include / sound / initval.h
blob2bf1508825a4cbac3897c1344cf109ec3ca7278b
1 #ifndef __SOUND_INITVAL_H
2 #define __SOUND_INITVAL_H
4 /*
5 * Init values for soundcard modules
6 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
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.
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.
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
24 #define SNDRV_AUTO_PORT 1
25 #define SNDRV_AUTO_IRQ 0xffff
26 #define SNDRV_AUTO_DMA 0xffff
27 #define SNDRV_AUTO_DMA_SIZE (0x7fffffff)
29 #define SNDRV_DEFAULT_IDX1 (-1)
30 #define SNDRV_DEFAULT_STR1 NULL
31 #define SNDRV_DEFAULT_ENABLE1 1
32 #define SNDRV_DEFAULT_PORT1 SNDRV_AUTO_PORT
33 #define SNDRV_DEFAULT_IRQ1 SNDRV_AUTO_IRQ
34 #define SNDRV_DEFAULT_DMA1 SNDRV_AUTO_DMA
35 #define SNDRV_DEFAULT_DMA_SIZE1 SNDRV_AUTO_DMA_SIZE
36 #define SNDRV_DEFAULT_PTR1 SNDRV_DEFAULT_STR1
38 #define SNDRV_DEFAULT_IDX { [0 ... (SNDRV_CARDS-1)] = -1 }
39 #define SNDRV_DEFAULT_STR { [0 ... (SNDRV_CARDS-1)] = NULL }
40 #define SNDRV_DEFAULT_ENABLE { 1, [1 ... (SNDRV_CARDS-1)] = 0 }
41 #define SNDRV_DEFAULT_ENABLE_PNP { [0 ... (SNDRV_CARDS-1)] = 1 }
42 #ifdef CONFIG_PNP
43 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE_PNP
44 #else
45 #define SNDRV_DEFAULT_ENABLE_ISAPNP SNDRV_DEFAULT_ENABLE
46 #endif
47 #define SNDRV_DEFAULT_PORT { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_PORT }
48 #define SNDRV_DEFAULT_IRQ { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_IRQ }
49 #define SNDRV_DEFAULT_DMA { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA }
50 #define SNDRV_DEFAULT_DMA_SIZE { [0 ... (SNDRV_CARDS-1)] = SNDRV_AUTO_DMA_SIZE }
51 #define SNDRV_DEFAULT_PTR SNDRV_DEFAULT_STR
53 #ifdef SNDRV_LEGACY_AUTO_PROBE
54 static int snd_legacy_auto_probe(unsigned long *ports, int (*probe)(unsigned long port))
56 int result = 0; /* number of detected cards */
58 while ((signed long)*ports != -1) {
59 if (probe(*ports) >= 0)
60 result++;
61 ports++;
63 return result;
65 #endif
67 #ifdef SNDRV_LEGACY_FIND_FREE_IRQ
68 #include <linux/interrupt.h>
70 static irqreturn_t snd_legacy_empty_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
72 return IRQ_HANDLED;
75 static int snd_legacy_find_free_irq(int *irq_table)
77 while (*irq_table != -1) {
78 if (!request_irq(*irq_table, snd_legacy_empty_irq_handler,
79 SA_INTERRUPT, "ALSA Test IRQ", (void *) irq_table)) {
80 free_irq(*irq_table, (void *) irq_table);
81 return *irq_table;
83 irq_table++;
85 return -1;
87 #endif
89 #ifdef SNDRV_LEGACY_FIND_FREE_DMA
90 static int snd_legacy_find_free_dma(int *dma_table)
92 while (*dma_table != -1) {
93 if (!request_dma(*dma_table, "ALSA Test DMA")) {
94 free_dma(*dma_table);
95 return *dma_table;
97 dma_table++;
99 return -1;
101 #endif
103 #endif /* __SOUND_INITVAL_H */