aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /sound/isa
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/Kconfig36
-rw-r--r--sound/isa/Makefile4
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/azt2320.c2
-rw-r--r--sound/isa/galaxy/Makefile10
-rw-r--r--sound/isa/galaxy/azt1605.c91
-rw-r--r--sound/isa/galaxy/azt2316.c111
-rw-r--r--sound/isa/galaxy/galaxy.c652
-rw-r--r--sound/isa/gus/gusmax.c4
-rw-r--r--sound/isa/opl3sa2.c2
-rw-r--r--sound/isa/sb/emu8000.c2
-rw-r--r--sound/isa/sb/sb8.c2
-rw-r--r--sound/isa/sgalaxy.c369
-rw-r--r--sound/isa/wavefront/wavefront_midi.c2
-rw-r--r--sound/isa/wss/wss_lib.c2
15 files changed, 900 insertions, 391 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index c6990c680796..52064cfa91f3 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -77,6 +77,32 @@ config SND_ALS100
77 To compile this driver as a module, choose M here: the module 77 To compile this driver as a module, choose M here: the module
78 will be called snd-als100. 78 will be called snd-als100.
79 79
80config SND_AZT1605
81 tristate "Aztech AZT1605 Driver"
82 depends on SND
83 select SND_WSS_LIB
84 select SND_MPU401_UART
85 select SND_OPL3_LIB
86 help
87 Say Y here to include support for Aztech Sound Galaxy cards
88 based on the AZT1605 chipset.
89
90 To compile this driver as a module, choose M here: the module
91 will be called snd-azt1605.
92
93config SND_AZT2316
94 tristate "Aztech AZT2316 Driver"
95 depends on SND
96 select SND_WSS_LIB
97 select SND_MPU401_UART
98 select SND_OPL3_LIB
99 help
100 Say Y here to include support for Aztech Sound Galaxy cards
101 based on the AZT2316 chipset.
102
103 To compile this driver as a module, choose M here: the module
104 will be called snd-azt2316.
105
80config SND_AZT2320 106config SND_AZT2320
81 tristate "Aztech Systems AZT2320" 107 tristate "Aztech Systems AZT2320"
82 depends on PNP 108 depends on PNP
@@ -351,16 +377,6 @@ config SND_SB16_CSP
351 coprocessor can do variable tasks like various compression and 377 coprocessor can do variable tasks like various compression and
352 decompression algorithms. 378 decompression algorithms.
353 379
354config SND_SGALAXY
355 tristate "Aztech Sound Galaxy"
356 select SND_WSS_LIB
357 help
358 Say Y here to include support for Aztech Sound Galaxy
359 soundcards.
360
361 To compile this driver as a module, choose M here: the module
362 will be called snd-sgalaxy.
363
364config SND_SSCAPE 380config SND_SSCAPE
365 tristate "Ensoniq SoundScape driver" 381 tristate "Ensoniq SoundScape driver"
366 select SND_MPU401_UART 382 select SND_MPU401_UART
diff --git a/sound/isa/Makefile b/sound/isa/Makefile
index c73d30c4f462..8d781e419e2e 100644
--- a/sound/isa/Makefile
+++ b/sound/isa/Makefile
@@ -10,7 +10,6 @@ snd-cmi8330-objs := cmi8330.o
10snd-es18xx-objs := es18xx.o 10snd-es18xx-objs := es18xx.o
11snd-opl3sa2-objs := opl3sa2.o 11snd-opl3sa2-objs := opl3sa2.o
12snd-sc6000-objs := sc6000.o 12snd-sc6000-objs := sc6000.o
13snd-sgalaxy-objs := sgalaxy.o
14snd-sscape-objs := sscape.o 13snd-sscape-objs := sscape.o
15 14
16# Toplevel Module Dependency 15# Toplevel Module Dependency
@@ -21,8 +20,7 @@ obj-$(CONFIG_SND_CMI8330) += snd-cmi8330.o
21obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o 20obj-$(CONFIG_SND_ES18XX) += snd-es18xx.o
22obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o 21obj-$(CONFIG_SND_OPL3SA2) += snd-opl3sa2.o
23obj-$(CONFIG_SND_SC6000) += snd-sc6000.o 22obj-$(CONFIG_SND_SC6000) += snd-sc6000.o
24obj-$(CONFIG_SND_SGALAXY) += snd-sgalaxy.o
25obj-$(CONFIG_SND_SSCAPE) += snd-sscape.o 23obj-$(CONFIG_SND_SSCAPE) += snd-sscape.o
26 24
27obj-$(CONFIG_SND) += ad1816a/ ad1848/ cs423x/ es1688/ gus/ msnd/ opti9xx/ \ 25obj-$(CONFIG_SND) += ad1816a/ ad1848/ cs423x/ es1688/ galaxy/ gus/ msnd/ opti9xx/ \
28 sb/ wavefront/ wss/ 26 sb/ wavefront/ wss/
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index bbcbf92a8ebe..3cb75bc97699 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -162,7 +162,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
162 sizeof(struct snd_card_ad1816a), &card); 162 sizeof(struct snd_card_ad1816a), &card);
163 if (error < 0) 163 if (error < 0)
164 return error; 164 return error;
165 acard = (struct snd_card_ad1816a *)card->private_data; 165 acard = card->private_data;
166 166
167 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { 167 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) {
168 snd_card_free(card); 168 snd_card_free(card);
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index f7aa637b0d18..aac8dc15c2fe 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -188,7 +188,7 @@ static int __devinit snd_card_azt2320_probe(int dev,
188 sizeof(struct snd_card_azt2320), &card); 188 sizeof(struct snd_card_azt2320), &card);
189 if (error < 0) 189 if (error < 0)
190 return error; 190 return error;
191 acard = (struct snd_card_azt2320 *)card->private_data; 191 acard = card->private_data;
192 192
193 if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { 193 if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) {
194 snd_card_free(card); 194 snd_card_free(card);
diff --git a/sound/isa/galaxy/Makefile b/sound/isa/galaxy/Makefile
new file mode 100644
index 000000000000..e307066d4315
--- /dev/null
+++ b/sound/isa/galaxy/Makefile
@@ -0,0 +1,10 @@
1#
2# Makefile for ALSA
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4#
5
6snd-azt1605-objs := azt1605.o
7snd-azt2316-objs := azt2316.o
8
9obj-$(CONFIG_SND_AZT1605) += snd-azt1605.o
10obj-$(CONFIG_SND_AZT2316) += snd-azt2316.o
diff --git a/sound/isa/galaxy/azt1605.c b/sound/isa/galaxy/azt1605.c
new file mode 100644
index 000000000000..9a97643cb713
--- /dev/null
+++ b/sound/isa/galaxy/azt1605.c
@@ -0,0 +1,91 @@
1/*
2 * Aztech AZT1605 Driver
3 * Copyright (C) 2007,2010 Rene Herman
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#define AZT1605
21
22#define CRD_NAME "Aztech AZT1605"
23#define DRV_NAME "AZT1605"
24#define DEV_NAME "azt1605"
25
26#define GALAXY_DSP_MAJOR 2
27#define GALAXY_DSP_MINOR 1
28
29#define GALAXY_CONFIG_SIZE 3
30
31/*
32 * 24-bit config register
33 */
34
35#define GALAXY_CONFIG_SBA_220 (0 << 0)
36#define GALAXY_CONFIG_SBA_240 (1 << 0)
37#define GALAXY_CONFIG_SBA_260 (2 << 0)
38#define GALAXY_CONFIG_SBA_280 (3 << 0)
39#define GALAXY_CONFIG_SBA_MASK GALAXY_CONFIG_SBA_280
40
41#define GALAXY_CONFIG_MPUA_300 (0 << 2)
42#define GALAXY_CONFIG_MPUA_330 (1 << 2)
43
44#define GALAXY_CONFIG_MPU_ENABLE (1 << 3)
45
46#define GALAXY_CONFIG_GAME_ENABLE (1 << 4)
47
48#define GALAXY_CONFIG_CD_PANASONIC (1 << 5)
49#define GALAXY_CONFIG_CD_MITSUMI (1 << 6)
50#define GALAXY_CONFIG_CD_MASK (\
51 GALAXY_CONFIG_CD_PANASONIC | GALAXY_CONFIG_CD_MITSUMI)
52
53#define GALAXY_CONFIG_UNUSED (1 << 7)
54#define GALAXY_CONFIG_UNUSED_MASK GALAXY_CONFIG_UNUSED
55
56#define GALAXY_CONFIG_SBIRQ_2 (1 << 8)
57#define GALAXY_CONFIG_SBIRQ_3 (1 << 9)
58#define GALAXY_CONFIG_SBIRQ_5 (1 << 10)
59#define GALAXY_CONFIG_SBIRQ_7 (1 << 11)
60
61#define GALAXY_CONFIG_MPUIRQ_2 (1 << 12)
62#define GALAXY_CONFIG_MPUIRQ_3 (1 << 13)
63#define GALAXY_CONFIG_MPUIRQ_5 (1 << 14)
64#define GALAXY_CONFIG_MPUIRQ_7 (1 << 15)
65
66#define GALAXY_CONFIG_WSSA_530 (0 << 16)
67#define GALAXY_CONFIG_WSSA_604 (1 << 16)
68#define GALAXY_CONFIG_WSSA_E80 (2 << 16)
69#define GALAXY_CONFIG_WSSA_F40 (3 << 16)
70
71#define GALAXY_CONFIG_WSS_ENABLE (1 << 18)
72
73#define GALAXY_CONFIG_CDIRQ_11 (1 << 19)
74#define GALAXY_CONFIG_CDIRQ_12 (1 << 20)
75#define GALAXY_CONFIG_CDIRQ_15 (1 << 21)
76#define GALAXY_CONFIG_CDIRQ_MASK (\
77 GALAXY_CONFIG_CDIRQ_11 | GALAXY_CONFIG_CDIRQ_12 |\
78 GALAXY_CONFIG_CDIRQ_15)
79
80#define GALAXY_CONFIG_CDDMA_DISABLE (0 << 22)
81#define GALAXY_CONFIG_CDDMA_0 (1 << 22)
82#define GALAXY_CONFIG_CDDMA_1 (2 << 22)
83#define GALAXY_CONFIG_CDDMA_3 (3 << 22)
84#define GALAXY_CONFIG_CDDMA_MASK GALAXY_CONFIG_CDDMA_3
85
86#define GALAXY_CONFIG_MASK (\
87 GALAXY_CONFIG_SBA_MASK | GALAXY_CONFIG_CD_MASK |\
88 GALAXY_CONFIG_UNUSED_MASK | GALAXY_CONFIG_CDIRQ_MASK |\
89 GALAXY_CONFIG_CDDMA_MASK)
90
91#include "galaxy.c"
diff --git a/sound/isa/galaxy/azt2316.c b/sound/isa/galaxy/azt2316.c
new file mode 100644
index 000000000000..189441141df6
--- /dev/null
+++ b/sound/isa/galaxy/azt2316.c
@@ -0,0 +1,111 @@
1/*
2 * Aztech AZT2316 Driver
3 * Copyright (C) 2007,2010 Rene Herman
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#define AZT2316
21
22#define CRD_NAME "Aztech AZT2316"
23#define DRV_NAME "AZT2316"
24#define DEV_NAME "azt2316"
25
26#define GALAXY_DSP_MAJOR 3
27#define GALAXY_DSP_MINOR 1
28
29#define GALAXY_CONFIG_SIZE 4
30
31/*
32 * 32-bit config register
33 */
34
35#define GALAXY_CONFIG_SBA_220 (0 << 0)
36#define GALAXY_CONFIG_SBA_240 (1 << 0)
37#define GALAXY_CONFIG_SBA_260 (2 << 0)
38#define GALAXY_CONFIG_SBA_280 (3 << 0)
39#define GALAXY_CONFIG_SBA_MASK GALAXY_CONFIG_SBA_280
40
41#define GALAXY_CONFIG_SBIRQ_2 (1 << 2)
42#define GALAXY_CONFIG_SBIRQ_5 (1 << 3)
43#define GALAXY_CONFIG_SBIRQ_7 (1 << 4)
44#define GALAXY_CONFIG_SBIRQ_10 (1 << 5)
45
46#define GALAXY_CONFIG_SBDMA_DISABLE (0 << 6)
47#define GALAXY_CONFIG_SBDMA_0 (1 << 6)
48#define GALAXY_CONFIG_SBDMA_1 (2 << 6)
49#define GALAXY_CONFIG_SBDMA_3 (3 << 6)
50
51#define GALAXY_CONFIG_WSSA_530 (0 << 8)
52#define GALAXY_CONFIG_WSSA_604 (1 << 8)
53#define GALAXY_CONFIG_WSSA_E80 (2 << 8)
54#define GALAXY_CONFIG_WSSA_F40 (3 << 8)
55
56#define GALAXY_CONFIG_WSS_ENABLE (1 << 10)
57
58#define GALAXY_CONFIG_GAME_ENABLE (1 << 11)
59
60#define GALAXY_CONFIG_MPUA_300 (0 << 12)
61#define GALAXY_CONFIG_MPUA_330 (1 << 12)
62
63#define GALAXY_CONFIG_MPU_ENABLE (1 << 13)
64
65#define GALAXY_CONFIG_CDA_310 (0 << 14)
66#define GALAXY_CONFIG_CDA_320 (1 << 14)
67#define GALAXY_CONFIG_CDA_340 (2 << 14)
68#define GALAXY_CONFIG_CDA_350 (3 << 14)
69#define GALAXY_CONFIG_CDA_MASK GALAXY_CONFIG_CDA_350
70
71#define GALAXY_CONFIG_CD_DISABLE (0 << 16)
72#define GALAXY_CONFIG_CD_PANASONIC (1 << 16)
73#define GALAXY_CONFIG_CD_SONY (2 << 16)
74#define GALAXY_CONFIG_CD_MITSUMI (3 << 16)
75#define GALAXY_CONFIG_CD_AZTECH (4 << 16)
76#define GALAXY_CONFIG_CD_UNUSED_5 (5 << 16)
77#define GALAXY_CONFIG_CD_UNUSED_6 (6 << 16)
78#define GALAXY_CONFIG_CD_UNUSED_7 (7 << 16)
79#define GALAXY_CONFIG_CD_MASK GALAXY_CONFIG_CD_UNUSED_7
80
81#define GALAXY_CONFIG_CDDMA8_DISABLE (0 << 20)
82#define GALAXY_CONFIG_CDDMA8_0 (1 << 20)
83#define GALAXY_CONFIG_CDDMA8_1 (2 << 20)
84#define GALAXY_CONFIG_CDDMA8_3 (3 << 20)
85#define GALAXY_CONFIG_CDDMA8_MASK GALAXY_CONFIG_CDDMA8_3
86
87#define GALAXY_CONFIG_CDDMA16_DISABLE (0 << 22)
88#define GALAXY_CONFIG_CDDMA16_5 (1 << 22)
89#define GALAXY_CONFIG_CDDMA16_6 (2 << 22)
90#define GALAXY_CONFIG_CDDMA16_7 (3 << 22)
91#define GALAXY_CONFIG_CDDMA16_MASK GALAXY_CONFIG_CDDMA16_7
92
93#define GALAXY_CONFIG_MPUIRQ_2 (1 << 24)
94#define GALAXY_CONFIG_MPUIRQ_5 (1 << 25)
95#define GALAXY_CONFIG_MPUIRQ_7 (1 << 26)
96#define GALAXY_CONFIG_MPUIRQ_10 (1 << 27)
97
98#define GALAXY_CONFIG_CDIRQ_5 (1 << 28)
99#define GALAXY_CONFIG_CDIRQ_11 (1 << 29)
100#define GALAXY_CONFIG_CDIRQ_12 (1 << 30)
101#define GALAXY_CONFIG_CDIRQ_15 (1 << 31)
102#define GALAXY_CONFIG_CDIRQ_MASK (\
103 GALAXY_CONFIG_CDIRQ_5 | GALAXY_CONFIG_CDIRQ_11 |\
104 GALAXY_CONFIG_CDIRQ_12 | GALAXY_CONFIG_CDIRQ_15)
105
106#define GALAXY_CONFIG_MASK (\
107 GALAXY_CONFIG_SBA_MASK | GALAXY_CONFIG_CDA_MASK |\
108 GALAXY_CONFIG_CD_MASK | GALAXY_CONFIG_CDDMA16_MASK |\
109 GALAXY_CONFIG_CDDMA8_MASK | GALAXY_CONFIG_CDIRQ_MASK)
110
111#include "galaxy.c"
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
new file mode 100644
index 000000000000..ee54df082b9c
--- /dev/null
+++ b/sound/isa/galaxy/galaxy.c
@@ -0,0 +1,652 @@
1/*
2 * Aztech AZT1605/AZT2316 Driver
3 * Copyright (C) 2007,2010 Rene Herman
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/isa.h>
23#include <linux/delay.h>
24#include <linux/io.h>
25#include <asm/processor.h>
26#include <sound/core.h>
27#include <sound/initval.h>
28#include <sound/wss.h>
29#include <sound/mpu401.h>
30#include <sound/opl3.h>
31
32MODULE_DESCRIPTION(CRD_NAME);
33MODULE_AUTHOR("Rene Herman");
34MODULE_LICENSE("GPL");
35
36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
39
40module_param_array(index, int, NULL, 0444);
41MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
42module_param_array(id, charp, NULL, 0444);
43MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard.");
44module_param_array(enable, bool, NULL, 0444);
45MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
46
47static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
48static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
49static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
50static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
51static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
52static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
53static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
54static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
55
56module_param_array(port, long, NULL, 0444);
57MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
58module_param_array(wss_port, long, NULL, 0444);
59MODULE_PARM_DESC(wss_port, "WSS port # for " CRD_NAME " driver.");
60module_param_array(mpu_port, long, NULL, 0444);
61MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver.");
62module_param_array(fm_port, long, NULL, 0444);
63MODULE_PARM_DESC(fm_port, "FM port # for " CRD_NAME " driver.");
64module_param_array(irq, int, NULL, 0444);
65MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver.");
66module_param_array(mpu_irq, int, NULL, 0444);
67MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver.");
68module_param_array(dma1, int, NULL, 0444);
69MODULE_PARM_DESC(dma1, "Playback DMA # for " CRD_NAME " driver.");
70module_param_array(dma2, int, NULL, 0444);
71MODULE_PARM_DESC(dma2, "Capture DMA # for " CRD_NAME " driver.");
72
73/*
74 * Generic SB DSP support routines
75 */
76
77#define DSP_PORT_RESET 0x6
78#define DSP_PORT_READ 0xa
79#define DSP_PORT_COMMAND 0xc
80#define DSP_PORT_STATUS 0xc
81#define DSP_PORT_DATA_AVAIL 0xe
82
83#define DSP_SIGNATURE 0xaa
84
85#define DSP_COMMAND_GET_VERSION 0xe1
86
87static int __devinit dsp_get_byte(void __iomem *port, u8 *val)
88{
89 int loops = 1000;
90
91 while (!(ioread8(port + DSP_PORT_DATA_AVAIL) & 0x80)) {
92 if (!loops--)
93 return -EIO;
94 cpu_relax();
95 }
96 *val = ioread8(port + DSP_PORT_READ);
97 return 0;
98}
99
100static int __devinit dsp_reset(void __iomem *port)
101{
102 u8 val;
103
104 iowrite8(1, port + DSP_PORT_RESET);
105 udelay(10);
106 iowrite8(0, port + DSP_PORT_RESET);
107
108 if (dsp_get_byte(port, &val) < 0 || val != DSP_SIGNATURE)
109 return -ENODEV;
110
111 return 0;
112}
113
114static int __devinit dsp_command(void __iomem *port, u8 cmd)
115{
116 int loops = 1000;
117
118 while (ioread8(port + DSP_PORT_STATUS) & 0x80) {
119 if (!loops--)
120 return -EIO;
121 cpu_relax();
122 }
123 iowrite8(cmd, port + DSP_PORT_COMMAND);
124 return 0;
125}
126
127static int __devinit dsp_get_version(void __iomem *port, u8 *major, u8 *minor)
128{
129 int err;
130
131 err = dsp_command(port, DSP_COMMAND_GET_VERSION);
132 if (err < 0)
133 return err;
134
135 err = dsp_get_byte(port, major);
136 if (err < 0)
137 return err;
138
139 err = dsp_get_byte(port, minor);
140 if (err < 0)
141 return err;
142
143 return 0;
144}
145
146/*
147 * Generic WSS support routines
148 */
149
150#define WSS_CONFIG_DMA_0 (1 << 0)
151#define WSS_CONFIG_DMA_1 (2 << 0)
152#define WSS_CONFIG_DMA_3 (3 << 0)
153#define WSS_CONFIG_DUPLEX (1 << 2)
154#define WSS_CONFIG_IRQ_7 (1 << 3)
155#define WSS_CONFIG_IRQ_9 (2 << 3)
156#define WSS_CONFIG_IRQ_10 (3 << 3)
157#define WSS_CONFIG_IRQ_11 (4 << 3)
158
159#define WSS_PORT_CONFIG 0
160#define WSS_PORT_SIGNATURE 3
161
162#define WSS_SIGNATURE 4
163
164static int __devinit wss_detect(void __iomem *wss_port)
165{
166 if ((ioread8(wss_port + WSS_PORT_SIGNATURE) & 0x3f) != WSS_SIGNATURE)
167 return -ENODEV;
168
169 return 0;
170}
171
172static void wss_set_config(void __iomem *wss_port, u8 wss_config)
173{
174 iowrite8(wss_config, wss_port + WSS_PORT_CONFIG);
175}
176
177/*
178 * Aztech Sound Galaxy specifics
179 */
180
181#define GALAXY_PORT_CONFIG 1024
182#define CONFIG_PORT_SET 4
183
184#define DSP_COMMAND_GALAXY_8 8
185#define GALAXY_COMMAND_GET_TYPE 5
186
187#define DSP_COMMAND_GALAXY_9 9
188#define GALAXY_COMMAND_WSSMODE 0
189#define GALAXY_COMMAND_SB8MODE 1
190
191#define GALAXY_MODE_WSS GALAXY_COMMAND_WSSMODE
192#define GALAXY_MODE_SB8 GALAXY_COMMAND_SB8MODE
193
194struct snd_galaxy {
195 void __iomem *port;
196 void __iomem *config_port;
197 void __iomem *wss_port;
198 u32 config;
199 struct resource *res_port;
200 struct resource *res_config_port;
201 struct resource *res_wss_port;
202};
203
204static u32 config[SNDRV_CARDS];
205static u8 wss_config[SNDRV_CARDS];
206
207static int __devinit snd_galaxy_match(struct device *dev, unsigned int n)
208{
209 if (!enable[n])
210 return 0;
211
212 switch (port[n]) {
213 case SNDRV_AUTO_PORT:
214 dev_err(dev, "please specify port\n");
215 return 0;
216 case 0x220:
217 config[n] |= GALAXY_CONFIG_SBA_220;
218 break;
219 case 0x240:
220 config[n] |= GALAXY_CONFIG_SBA_240;
221 break;
222 case 0x260:
223 config[n] |= GALAXY_CONFIG_SBA_260;
224 break;
225 case 0x280:
226 config[n] |= GALAXY_CONFIG_SBA_280;
227 break;
228 default:
229 dev_err(dev, "invalid port %#lx\n", port[n]);
230 return 0;
231 }
232
233 switch (wss_port[n]) {
234 case SNDRV_AUTO_PORT:
235 dev_err(dev, "please specify wss_port\n");
236 return 0;
237 case 0x530:
238 config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_530;
239 break;
240 case 0x604:
241 config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_604;
242 break;
243 case 0xe80:
244 config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_E80;
245 break;
246 case 0xf40:
247 config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_F40;
248 break;
249 default:
250 dev_err(dev, "invalid WSS port %#lx\n", wss_port[n]);
251 return 0;
252 }
253
254 switch (irq[n]) {
255 case SNDRV_AUTO_IRQ:
256 dev_err(dev, "please specify irq\n");
257 return 0;
258 case 7:
259 wss_config[n] |= WSS_CONFIG_IRQ_7;
260 break;
261 case 2:
262 irq[n] = 9;
263 case 9:
264 wss_config[n] |= WSS_CONFIG_IRQ_9;
265 break;
266 case 10:
267 wss_config[n] |= WSS_CONFIG_IRQ_10;
268 break;
269 case 11:
270 wss_config[n] |= WSS_CONFIG_IRQ_11;
271 break;
272 default:
273 dev_err(dev, "invalid IRQ %d\n", irq[n]);
274 return 0;
275 }
276
277 switch (dma1[n]) {
278 case SNDRV_AUTO_DMA:
279 dev_err(dev, "please specify dma1\n");
280 return 0;
281 case 0:
282 wss_config[n] |= WSS_CONFIG_DMA_0;
283 break;
284 case 1:
285 wss_config[n] |= WSS_CONFIG_DMA_1;
286 break;
287 case 3:
288 wss_config[n] |= WSS_CONFIG_DMA_3;
289 break;
290 default:
291 dev_err(dev, "invalid playback DMA %d\n", dma1[n]);
292 return 0;
293 }
294
295 if (dma2[n] == SNDRV_AUTO_DMA || dma2[n] == dma1[n]) {
296 dma2[n] = -1;
297 goto mpu;
298 }
299
300 wss_config[n] |= WSS_CONFIG_DUPLEX;
301 switch (dma2[n]) {
302 case 0:
303 break;
304 case 1:
305 if (dma1[n] == 0)
306 break;
307 default:
308 dev_err(dev, "invalid capture DMA %d\n", dma2[n]);
309 return 0;
310 }
311
312mpu:
313 switch (mpu_port[n]) {
314 case SNDRV_AUTO_PORT:
315 dev_warn(dev, "mpu_port not specified; not using MPU-401\n");
316 mpu_port[n] = -1;
317 goto fm;
318 case 0x300:
319 config[n] |= GALAXY_CONFIG_MPU_ENABLE | GALAXY_CONFIG_MPUA_300;
320 break;
321 case 0x330:
322 config[n] |= GALAXY_CONFIG_MPU_ENABLE | GALAXY_CONFIG_MPUA_330;
323 break;
324 default:
325 dev_err(dev, "invalid MPU port %#lx\n", mpu_port[n]);
326 return 0;
327 }
328
329 switch (mpu_irq[n]) {
330 case SNDRV_AUTO_IRQ:
331 dev_warn(dev, "mpu_irq not specified: using polling mode\n");
332 mpu_irq[n] = -1;
333 break;
334 case 2:
335 mpu_irq[n] = 9;
336 case 9:
337 config[n] |= GALAXY_CONFIG_MPUIRQ_2;
338 break;
339#ifdef AZT1605
340 case 3:
341 config[n] |= GALAXY_CONFIG_MPUIRQ_3;
342 break;
343#endif
344 case 5:
345 config[n] |= GALAXY_CONFIG_MPUIRQ_5;
346 break;
347 case 7:
348 config[n] |= GALAXY_CONFIG_MPUIRQ_7;
349 break;
350#ifdef AZT2316
351 case 10:
352 config[n] |= GALAXY_CONFIG_MPUIRQ_10;
353 break;
354#endif
355 default:
356 dev_err(dev, "invalid MPU IRQ %d\n", mpu_irq[n]);
357 return 0;
358 }
359
360 if (mpu_irq[n] == irq[n]) {
361 dev_err(dev, "cannot share IRQ between WSS and MPU-401\n");
362 return 0;
363 }
364
365fm:
366 switch (fm_port[n]) {
367 case SNDRV_AUTO_PORT:
368 dev_warn(dev, "fm_port not specified: not using OPL3\n");
369 fm_port[n] = -1;
370 break;
371 case 0x388:
372 break;
373 default:
374 dev_err(dev, "illegal FM port %#lx\n", fm_port[n]);
375 return 0;
376 }
377
378 config[n] |= GALAXY_CONFIG_GAME_ENABLE;
379 return 1;
380}
381
382static int __devinit galaxy_init(struct snd_galaxy *galaxy, u8 *type)
383{
384 u8 major;
385 u8 minor;
386 int err;
387
388 err = dsp_reset(galaxy->port);
389 if (err < 0)
390 return err;
391
392 err = dsp_get_version(galaxy->port, &major, &minor);
393 if (err < 0)
394 return err;
395
396 if (major != GALAXY_DSP_MAJOR || minor != GALAXY_DSP_MINOR)
397 return -ENODEV;
398
399 err = dsp_command(galaxy->port, DSP_COMMAND_GALAXY_8);
400 if (err < 0)
401 return err;
402
403 err = dsp_command(galaxy->port, GALAXY_COMMAND_GET_TYPE);
404 if (err < 0)
405 return err;
406
407 err = dsp_get_byte(galaxy->port, type);
408 if (err < 0)
409 return err;
410
411 return 0;
412}
413
414static int __devinit galaxy_set_mode(struct snd_galaxy *galaxy, u8 mode)
415{
416 int err;
417
418 err = dsp_command(galaxy->port, DSP_COMMAND_GALAXY_9);
419 if (err < 0)
420 return err;
421
422 err = dsp_command(galaxy->port, mode);
423 if (err < 0)
424 return err;
425
426#ifdef AZT1605
427 /*
428 * Needed for MPU IRQ on AZT1605, but AZT2316 loses WSS again
429 */
430 err = dsp_reset(galaxy->port);
431 if (err < 0)
432 return err;
433#endif
434
435 return 0;
436}
437
438static void galaxy_set_config(struct snd_galaxy *galaxy, u32 config)
439{
440 u8 tmp = ioread8(galaxy->config_port + CONFIG_PORT_SET);
441 int i;
442
443 iowrite8(tmp | 0x80, galaxy->config_port + CONFIG_PORT_SET);
444 for (i = 0; i < GALAXY_CONFIG_SIZE; i++) {
445 iowrite8(config, galaxy->config_port + i);
446 config >>= 8;
447 }
448 iowrite8(tmp & 0x7f, galaxy->config_port + CONFIG_PORT_SET);
449 msleep(10);
450}
451
452static void __devinit galaxy_config(struct snd_galaxy *galaxy, u32 config)
453{
454 int i;
455
456 for (i = GALAXY_CONFIG_SIZE; i; i--) {
457 u8 tmp = ioread8(galaxy->config_port + i - 1);
458 galaxy->config = (galaxy->config << 8) | tmp;
459 }
460 config |= galaxy->config & GALAXY_CONFIG_MASK;
461 galaxy_set_config(galaxy, config);
462}
463
464static int __devinit galaxy_wss_config(struct snd_galaxy *galaxy, u8 wss_config)
465{
466 int err;
467
468 err = wss_detect(galaxy->wss_port);
469 if (err < 0)
470 return err;
471
472 wss_set_config(galaxy->wss_port, wss_config);
473
474 err = galaxy_set_mode(galaxy, GALAXY_MODE_WSS);
475 if (err < 0)
476 return err;
477
478 return 0;
479}
480
481static void snd_galaxy_free(struct snd_card *card)
482{
483 struct snd_galaxy *galaxy = card->private_data;
484
485 if (galaxy->wss_port) {
486 wss_set_config(galaxy->wss_port, 0);
487 ioport_unmap(galaxy->wss_port);
488 release_and_free_resource(galaxy->res_wss_port);
489 }
490 if (galaxy->config_port) {
491 galaxy_set_config(galaxy, galaxy->config);
492 ioport_unmap(galaxy->config_port);
493 release_and_free_resource(galaxy->res_config_port);
494 }
495 if (galaxy->port) {
496 ioport_unmap(galaxy->port);
497 release_and_free_resource(galaxy->res_port);
498 }
499}
500
501static int __devinit snd_galaxy_probe(struct device *dev, unsigned int n)
502{
503 struct snd_galaxy *galaxy;
504 struct snd_wss *chip;
505 struct snd_card *card;
506 u8 type;
507 int err;
508
509 err = snd_card_create(index[n], id[n], THIS_MODULE, sizeof *galaxy,
510 &card);
511 if (err < 0)
512 return err;
513
514 snd_card_set_dev(card, dev);
515
516 card->private_free = snd_galaxy_free;
517 galaxy = card->private_data;
518
519 galaxy->res_port = request_region(port[n], 16, DRV_NAME);
520 if (!galaxy->res_port) {
521 dev_err(dev, "could not grab ports %#lx-%#lx\n", port[n],
522 port[n] + 15);
523 err = -EBUSY;
524 goto error;
525 }
526 galaxy->port = ioport_map(port[n], 16);
527
528 err = galaxy_init(galaxy, &type);
529 if (err < 0) {
530 dev_err(dev, "did not find a Sound Galaxy at %#lx\n", port[n]);
531 goto error;
532 }
533 dev_info(dev, "Sound Galaxy (type %d) found at %#lx\n", type, port[n]);
534
535 galaxy->res_config_port = request_region(port[n] + GALAXY_PORT_CONFIG,
536 16, DRV_NAME);
537 if (!galaxy->res_config_port) {
538 dev_err(dev, "could not grab ports %#lx-%#lx\n",
539 port[n] + GALAXY_PORT_CONFIG,
540 port[n] + GALAXY_PORT_CONFIG + 15);
541 err = -EBUSY;
542 goto error;
543 }
544 galaxy->config_port = ioport_map(port[n] + GALAXY_PORT_CONFIG, 16);
545
546 galaxy_config(galaxy, config[n]);
547
548 galaxy->res_wss_port = request_region(wss_port[n], 4, DRV_NAME);
549 if (!galaxy->res_wss_port) {
550 dev_err(dev, "could not grab ports %#lx-%#lx\n", wss_port[n],
551 wss_port[n] + 3);
552 err = -EBUSY;
553 goto error;
554 }
555 galaxy->wss_port = ioport_map(wss_port[n], 4);
556
557 err = galaxy_wss_config(galaxy, wss_config[n]);
558 if (err < 0) {
559 dev_err(dev, "could not configure WSS\n");
560 goto error;
561 }
562
563 strcpy(card->driver, DRV_NAME);
564 strcpy(card->shortname, DRV_NAME);
565 sprintf(card->longname, "%s at %#lx/%#lx, irq %d, dma %d/%d",
566 card->shortname, port[n], wss_port[n], irq[n], dma1[n],
567 dma2[n]);
568
569 err = snd_wss_create(card, wss_port[n] + 4, -1, irq[n], dma1[n],
570 dma2[n], WSS_HW_DETECT, 0, &chip);
571 if (err < 0)
572 goto error;
573
574 err = snd_wss_pcm(chip, 0, NULL);
575 if (err < 0)
576 goto error;
577
578 err = snd_wss_mixer(chip);
579 if (err < 0)
580 goto error;
581
582 err = snd_wss_timer(chip, 0, NULL);
583 if (err < 0)
584 goto error;
585
586 if (mpu_port[n] >= 0) {
587 err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
588 mpu_port[n], 0, mpu_irq[n],
589 IRQF_DISABLED, NULL);
590 if (err < 0)
591 goto error;
592 }
593
594 if (fm_port[n] >= 0) {
595 struct snd_opl3 *opl3;
596
597 err = snd_opl3_create(card, fm_port[n], fm_port[n] + 2,
598 OPL3_HW_AUTO, 0, &opl3);
599 if (err < 0) {
600 dev_err(dev, "no OPL device at %#lx\n", fm_port[n]);
601 goto error;
602 }
603 err = snd_opl3_timer_new(opl3, 1, 2);
604 if (err < 0)
605 goto error;
606
607 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
608 if (err < 0)
609 goto error;
610 }
611
612 err = snd_card_register(card);
613 if (err < 0)
614 goto error;
615
616 dev_set_drvdata(dev, card);
617 return 0;
618
619error:
620 snd_card_free(card);
621 return err;
622}
623
624static int __devexit snd_galaxy_remove(struct device *dev, unsigned int n)
625{
626 snd_card_free(dev_get_drvdata(dev));
627 dev_set_drvdata(dev, NULL);
628 return 0;
629}
630
631static struct isa_driver snd_galaxy_driver = {
632 .match = snd_galaxy_match,
633 .probe = snd_galaxy_probe,
634 .remove = __devexit_p(snd_galaxy_remove),
635
636 .driver = {
637 .name = DEV_NAME
638 }
639};
640
641static int __init alsa_card_galaxy_init(void)
642{
643 return isa_register_driver(&snd_galaxy_driver, SNDRV_CARDS);
644}
645
646static void __exit alsa_card_galaxy_exit(void)
647{
648 isa_unregister_driver(&snd_galaxy_driver);
649}
650
651module_init(alsa_card_galaxy_init);
652module_exit(alsa_card_galaxy_exit);
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index f26eac8d8110..3e4a58b72913 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -191,7 +191,7 @@ static int __devinit snd_gusmax_mixer(struct snd_wss *chip)
191 191
192static void snd_gusmax_free(struct snd_card *card) 192static void snd_gusmax_free(struct snd_card *card)
193{ 193{
194 struct snd_gusmax *maxcard = (struct snd_gusmax *)card->private_data; 194 struct snd_gusmax *maxcard = card->private_data;
195 195
196 if (maxcard == NULL) 196 if (maxcard == NULL)
197 return; 197 return;
@@ -219,7 +219,7 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
219 if (err < 0) 219 if (err < 0)
220 return err; 220 return err;
221 card->private_free = snd_gusmax_free; 221 card->private_free = snd_gusmax_free;
222 maxcard = (struct snd_gusmax *)card->private_data; 222 maxcard = card->private_data;
223 maxcard->card = card; 223 maxcard->card = card;
224 maxcard->irq = -1; 224 maxcard->irq = -1;
225 225
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 265abcce9dba..9b915e27b5bd 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -264,7 +264,7 @@ static int __devinit snd_opl3sa2_detect(struct snd_card *card)
264 snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1); 264 snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1);
265 return -ENODEV; 265 return -ENODEV;
266 } 266 }
267 /* try if the MIC register is accesible */ 267 /* try if the MIC register is accessible */
268 tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC); 268 tmp = snd_opl3sa2_read(chip, OPL3SA2_MIC);
269 snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a); 269 snd_opl3sa2_write(chip, OPL3SA2_MIC, 0x8a);
270 if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) { 270 if (((tmp1 = snd_opl3sa2_read(chip, OPL3SA2_MIC)) & 0x9f) != 0x8a) {
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 0c40951b6523..5d61f5a29130 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -370,7 +370,7 @@ init_arrays(struct snd_emu8000 *emu)
370 370
371/* 371/*
372 * Size the onboard memory. 372 * Size the onboard memory.
373 * This is written so as not to need arbitary delays after the write. It 373 * This is written so as not to need arbitrary delays after the write. It
374 * seems that the only way to do this is to use the one channel and keep 374 * seems that the only way to do this is to use the one channel and keep
375 * reallocating between read and write. 375 * reallocating between read and write.
376 */ 376 */
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 81284a8fa0ce..2259e3f726a7 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -72,7 +72,7 @@ static irqreturn_t snd_sb8_interrupt(int irq, void *dev_id)
72 72
73static void snd_sb8_free(struct snd_card *card) 73static void snd_sb8_free(struct snd_card *card)
74{ 74{
75 struct snd_sb8 *acard = (struct snd_sb8 *)card->private_data; 75 struct snd_sb8 *acard = card->private_data;
76 76
77 if (acard == NULL) 77 if (acard == NULL)
78 return; 78 return;
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
deleted file mode 100644
index 6fe27b9d9440..000000000000
--- a/sound/isa/sgalaxy.c
+++ /dev/null
@@ -1,369 +0,0 @@
1/*
2 * Driver for Aztech Sound Galaxy cards
3 * Copyright (c) by Christopher Butler <chrisb@sandy.force9.co.uk.
4 *
5 * I don't have documentation for this card, I based this driver on the
6 * driver for OSS/Free included in the kernel source (drivers/sound/sgalaxy.c)
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#include <linux/init.h>
25#include <linux/err.h>
26#include <linux/isa.h>
27#include <linux/delay.h>
28#include <linux/time.h>
29#include <linux/interrupt.h>
30#include <linux/moduleparam.h>
31#include <asm/dma.h>
32#include <sound/core.h>
33#include <sound/sb.h>
34#include <sound/wss.h>
35#include <sound/control.h>
36#define SNDRV_LEGACY_FIND_FREE_IRQ
37#define SNDRV_LEGACY_FIND_FREE_DMA
38#include <sound/initval.h>
39
40MODULE_AUTHOR("Christopher Butler <chrisb@sandy.force9.co.uk>");
41MODULE_DESCRIPTION("Aztech Sound Galaxy");
42MODULE_LICENSE("GPL");
43MODULE_SUPPORTED_DEVICE("{{Aztech Systems,Sound Galaxy}}");
44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
48static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240 */
49static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530,0xe80,0xf40,0x604 */
50static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 7,9,10,11 */
51static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */
52
53module_param_array(index, int, NULL, 0444);
54MODULE_PARM_DESC(index, "Index value for Sound Galaxy soundcard.");
55module_param_array(id, charp, NULL, 0444);
56MODULE_PARM_DESC(id, "ID string for Sound Galaxy soundcard.");
57module_param_array(sbport, long, NULL, 0444);
58MODULE_PARM_DESC(sbport, "Port # for Sound Galaxy SB driver.");
59module_param_array(wssport, long, NULL, 0444);
60MODULE_PARM_DESC(wssport, "Port # for Sound Galaxy WSS driver.");
61module_param_array(irq, int, NULL, 0444);
62MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver.");
63module_param_array(dma1, int, NULL, 0444);
64MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver.");
65
66#define SGALAXY_AUXC_LEFT 18
67#define SGALAXY_AUXC_RIGHT 19
68
69#define PFX "sgalaxy: "
70
71/*
72
73 */
74
75#define AD1848P1( port, x ) ( port + c_d_c_AD1848##x )
76
77/* from lowlevel/sb/sb.c - to avoid having to allocate a struct snd_sb for the */
78/* short time we actually need it.. */
79
80static int snd_sgalaxy_sbdsp_reset(unsigned long port)
81{
82 int i;
83
84 outb(1, SBP1(port, RESET));
85 udelay(10);
86 outb(0, SBP1(port, RESET));
87 udelay(30);
88 for (i = 0; i < 1000 && !(inb(SBP1(port, DATA_AVAIL)) & 0x80); i++);
89 if (inb(SBP1(port, READ)) != 0xaa) {
90 snd_printd("sb_reset: failed at 0x%lx!!!\n", port);
91 return -ENODEV;
92 }
93 return 0;
94}
95
96static int __devinit snd_sgalaxy_sbdsp_command(unsigned long port,
97 unsigned char val)
98{
99 int i;
100
101 for (i = 10000; i; i--)
102 if ((inb(SBP1(port, STATUS)) & 0x80) == 0) {
103 outb(val, SBP1(port, COMMAND));
104 return 1;
105 }
106
107 return 0;
108}
109
110static irqreturn_t snd_sgalaxy_dummy_interrupt(int irq, void *dev_id)
111{
112 return IRQ_NONE;
113}
114
115static int __devinit snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
116{
117 static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1,
118 0x10, 0x18, 0x20, -1, -1, -1, -1};
119 static int dma_bits[] = {1, 2, 0, 3};
120 int tmp, tmp1;
121
122 if ((tmp = inb(port + 3)) == 0xff)
123 {
124 snd_printdd("I/O address dead (0x%lx)\n", port);
125 return 0;
126 }
127#if 0
128 snd_printdd("WSS signature = 0x%x\n", tmp);
129#endif
130
131 if ((tmp & 0x3f) != 0x04 &&
132 (tmp & 0x3f) != 0x0f &&
133 (tmp & 0x3f) != 0x00) {
134 snd_printdd("No WSS signature detected on port 0x%lx\n",
135 port + 3);
136 return 0;
137 }
138
139#if 0
140 snd_printdd(PFX "setting up IRQ/DMA for WSS\n");
141#endif
142
143 /* initialize IRQ for WSS codec */
144 tmp = interrupt_bits[irq % 16];
145 if (tmp < 0)
146 return -EINVAL;
147
148 if (request_irq(irq, snd_sgalaxy_dummy_interrupt, IRQF_DISABLED, "sgalaxy", NULL)) {
149 snd_printk(KERN_ERR "sgalaxy: can't grab irq %d\n", irq);
150 return -EIO;
151 }
152
153 outb(tmp | 0x40, port);
154 tmp1 = dma_bits[dma % 4];
155 outb(tmp | tmp1, port);
156
157 free_irq(irq, NULL);
158
159 return 0;
160}
161
162static int __devinit snd_sgalaxy_detect(int dev, int irq, int dma)
163{
164#if 0
165 snd_printdd(PFX "switching to WSS mode\n");
166#endif
167
168 /* switch to WSS mode */
169 snd_sgalaxy_sbdsp_reset(sbport[dev]);
170
171 snd_sgalaxy_sbdsp_command(sbport[dev], 9);
172 snd_sgalaxy_sbdsp_command(sbport[dev], 0);
173
174 udelay(400);
175 return snd_sgalaxy_setup_wss(wssport[dev], irq, dma);
176}
177
178static struct snd_kcontrol_new snd_sgalaxy_controls[] = {
179WSS_DOUBLE("Aux Playback Switch", 0,
180 SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7, 7, 1, 1),
181WSS_DOUBLE("Aux Playback Volume", 0,
182 SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0)
183};
184
185static int __devinit snd_sgalaxy_mixer(struct snd_wss *chip)
186{
187 struct snd_card *card = chip->card;
188 struct snd_ctl_elem_id id1, id2;
189 unsigned int idx;
190 int err;
191
192 memset(&id1, 0, sizeof(id1));
193 memset(&id2, 0, sizeof(id2));
194 id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
195 /* reassign AUX0 to LINE */
196 strcpy(id1.name, "Aux Playback Switch");
197 strcpy(id2.name, "Line Playback Switch");
198 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
199 return err;
200 strcpy(id1.name, "Aux Playback Volume");
201 strcpy(id2.name, "Line Playback Volume");
202 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
203 return err;
204 /* reassign AUX1 to FM */
205 strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
206 strcpy(id2.name, "FM Playback Switch");
207 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
208 return err;
209 strcpy(id1.name, "Aux Playback Volume");
210 strcpy(id2.name, "FM Playback Volume");
211 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
212 return err;
213 /* build AUX2 input */
214 for (idx = 0; idx < ARRAY_SIZE(snd_sgalaxy_controls); idx++) {
215 err = snd_ctl_add(card,
216 snd_ctl_new1(&snd_sgalaxy_controls[idx], chip));
217 if (err < 0)
218 return err;
219 }
220 return 0;
221}
222
223static int __devinit snd_sgalaxy_match(struct device *devptr, unsigned int dev)
224{
225 if (!enable[dev])
226 return 0;
227 if (sbport[dev] == SNDRV_AUTO_PORT) {
228 snd_printk(KERN_ERR PFX "specify SB port\n");
229 return 0;
230 }
231 if (wssport[dev] == SNDRV_AUTO_PORT) {
232 snd_printk(KERN_ERR PFX "specify WSS port\n");
233 return 0;
234 }
235 return 1;
236}
237
238static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
239{
240 static int possible_irqs[] = {7, 9, 10, 11, -1};
241 static int possible_dmas[] = {1, 3, 0, -1};
242 int err, xirq, xdma1;
243 struct snd_card *card;
244 struct snd_wss *chip;
245
246 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
247 if (err < 0)
248 return err;
249
250 xirq = irq[dev];
251 if (xirq == SNDRV_AUTO_IRQ) {
252 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
253 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
254 err = -EBUSY;
255 goto _err;
256 }
257 }
258 xdma1 = dma1[dev];
259 if (xdma1 == SNDRV_AUTO_DMA) {
260 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
261 snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
262 err = -EBUSY;
263 goto _err;
264 }
265 }
266
267 if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0)
268 goto _err;
269
270 err = snd_wss_create(card, wssport[dev] + 4, -1,
271 xirq, xdma1, -1,
272 WSS_HW_DETECT, 0, &chip);
273 if (err < 0)
274 goto _err;
275 card->private_data = chip;
276
277 err = snd_wss_pcm(chip, 0, NULL);
278 if (err < 0) {
279 snd_printdd(PFX "error creating new WSS PCM device\n");
280 goto _err;
281 }
282 err = snd_wss_mixer(chip);
283 if (err < 0) {
284 snd_printdd(PFX "error creating new WSS mixer\n");
285 goto _err;
286 }
287 if ((err = snd_sgalaxy_mixer(chip)) < 0) {
288 snd_printdd(PFX "the mixer rewrite failed\n");
289 goto _err;
290 }
291
292 strcpy(card->driver, "Sound Galaxy");
293 strcpy(card->shortname, "Sound Galaxy");
294 sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
295 wssport[dev], xirq, xdma1);
296
297 snd_card_set_dev(card, devptr);
298
299 if ((err = snd_card_register(card)) < 0)
300 goto _err;
301
302 dev_set_drvdata(devptr, card);
303 return 0;
304
305 _err:
306 snd_card_free(card);
307 return err;
308}
309
310static int __devexit snd_sgalaxy_remove(struct device *devptr, unsigned int dev)
311{
312 snd_card_free(dev_get_drvdata(devptr));
313 dev_set_drvdata(devptr, NULL);
314 return 0;
315}
316
317#ifdef CONFIG_PM
318static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
319 pm_message_t state)
320{
321 struct snd_card *card = dev_get_drvdata(pdev);
322 struct snd_wss *chip = card->private_data;
323
324 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
325 chip->suspend(chip);
326 return 0;
327}
328
329static int snd_sgalaxy_resume(struct device *pdev, unsigned int n)
330{
331 struct snd_card *card = dev_get_drvdata(pdev);
332 struct snd_wss *chip = card->private_data;
333
334 chip->resume(chip);
335 snd_wss_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]);
336 snd_wss_out(chip, SGALAXY_AUXC_RIGHT, chip->image[SGALAXY_AUXC_RIGHT]);
337
338 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
339 return 0;
340}
341#endif
342
343#define DEV_NAME "sgalaxy"
344
345static struct isa_driver snd_sgalaxy_driver = {
346 .match = snd_sgalaxy_match,
347 .probe = snd_sgalaxy_probe,
348 .remove = __devexit_p(snd_sgalaxy_remove),
349#ifdef CONFIG_PM
350 .suspend = snd_sgalaxy_suspend,
351 .resume = snd_sgalaxy_resume,
352#endif
353 .driver = {
354 .name = DEV_NAME
355 },
356};
357
358static int __init alsa_card_sgalaxy_init(void)
359{
360 return isa_register_driver(&snd_sgalaxy_driver, SNDRV_CARDS);
361}
362
363static void __exit alsa_card_sgalaxy_exit(void)
364{
365 isa_unregister_driver(&snd_sgalaxy_driver);
366}
367
368module_init(alsa_card_sgalaxy_init)
369module_exit(alsa_card_sgalaxy_exit)
diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c
index f14a7c0b6998..65329f3abc30 100644
--- a/sound/isa/wavefront/wavefront_midi.c
+++ b/sound/isa/wavefront/wavefront_midi.c
@@ -537,7 +537,7 @@ snd_wavefront_midi_start (snd_wavefront_card_t *card)
537 } 537 }
538 538
539 /* Turn on Virtual MIDI, but first *always* turn it off, 539 /* Turn on Virtual MIDI, but first *always* turn it off,
540 since otherwise consectutive reloads of the driver will 540 since otherwise consecutive reloads of the driver will
541 never cause the hardware to generate the initial "internal" or 541 never cause the hardware to generate the initial "internal" or
542 "external" source bytes in the MIDI data stream. This 542 "external" source bytes in the MIDI data stream. This
543 is pretty important, since the internal hardware generally will 543 is pretty important, since the internal hardware generally will
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c
index 9191b32d9130..2a42cc377957 100644
--- a/sound/isa/wss/wss_lib.c
+++ b/sound/isa/wss/wss_lib.c
@@ -424,7 +424,7 @@ void snd_wss_mce_down(struct snd_wss *chip)
424 424
425 /* 425 /*
426 * Wait for (possible -- during init auto-calibration may not be set) 426 * Wait for (possible -- during init auto-calibration may not be set)
427 * calibration process to start. Needs upto 5 sample periods on AD1848 427 * calibration process to start. Needs up to 5 sample periods on AD1848
428 * which at the slowest possible rate of 5.5125 kHz means 907 us. 428 * which at the slowest possible rate of 5.5125 kHz means 907 us.
429 */ 429 */
430 msleep(1); 430 msleep(1);