Version:  2.0.40 2.2.26 2.4.37 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 4.0 4.1 4.2 4.3 4.4

Linux/sound/isa/cs423x/cs4236.c

  1 /*
  2  *  Driver for generic CS4232/CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips
  3  *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  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 
 22 #include <linux/init.h>
 23 #include <linux/err.h>
 24 #include <linux/isa.h>
 25 #include <linux/pnp.h>
 26 #include <linux/module.h>
 27 #include <sound/core.h>
 28 #include <sound/wss.h>
 29 #include <sound/mpu401.h>
 30 #include <sound/opl3.h>
 31 #include <sound/initval.h>
 32 
 33 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 34 MODULE_LICENSE("GPL");
 35 MODULE_DESCRIPTION("Cirrus Logic CS4232-9");
 36 MODULE_SUPPORTED_DEVICE("{{Turtle Beach,TBS-2000},"
 37                 "{Turtle Beach,Tropez Plus},"
 38                 "{SIC CrystalWave 32},"
 39                 "{Hewlett Packard,Omnibook 5500},"
 40                 "{TerraTec,Maestro 32/96},"
 41                 "{Philips,PCA70PS}},"
 42                 "{{Crystal Semiconductors,CS4235},"
 43                 "{Crystal Semiconductors,CS4236},"
 44                 "{Crystal Semiconductors,CS4237},"
 45                 "{Crystal Semiconductors,CS4238},"
 46                 "{Crystal Semiconductors,CS4239},"
 47                 "{Acer,AW37},"
 48                 "{Acer,AW35/Pro},"
 49                 "{Crystal,3D},"
 50                 "{Crystal Computer,TidalWave128},"
 51                 "{Dell,Optiplex GX1},"
 52                 "{Dell,Workstation 400 sound},"
 53                 "{EliteGroup,P5TX-LA sound},"
 54                 "{Gallant,SC-70P},"
 55                 "{Gateway,E1000 Onboard CS4236B},"
 56                 "{Genius,Sound Maker 3DJ},"
 57                 "{Hewlett Packard,HP6330 sound},"
 58                 "{IBM,PC 300PL sound},"
 59                 "{IBM,Aptiva 2137 E24},"
 60                 "{IBM,IntelliStation M Pro},"
 61                 "{Intel,Marlin Spike Mobo CS4235},"
 62                 "{Intel PR440FX Onboard},"
 63                 "{Guillemot,MaxiSound 16 PnP},"
 64                 "{NewClear,3D},"
 65                 "{TerraTec,AudioSystem EWS64L/XL},"
 66                 "{Typhoon Soundsystem,CS4236B},"
 67                 "{Turtle Beach,Malibu},"
 68                 "{Unknown,Digital PC 5000 Onboard}}");
 69 
 70 MODULE_ALIAS("snd_cs4232");
 71 
 72 #define IDENT "CS4232+"
 73 #define DEV_NAME "cs4232+"
 74 
 75 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
 76 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
 77 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
 78 #ifdef CONFIG_PNP
 79 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
 80 #endif
 81 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;     /* PnP setup */
 82 static long cport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;    /* PnP setup */
 83 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;/* PnP setup */
 84 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;  /* PnP setup */
 85 static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;  /* PnP setup */
 86 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* 5,7,9,11,12,15 */
 87 static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;    /* 9,11,12,15 */
 88 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;       /* 0,1,3,5,6,7 */
 89 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;       /* 0,1,3,5,6,7 */
 90 
 91 module_param_array(index, int, NULL, 0444);
 92 MODULE_PARM_DESC(index, "Index value for " IDENT " soundcard.");
 93 module_param_array(id, charp, NULL, 0444);
 94 MODULE_PARM_DESC(id, "ID string for " IDENT " soundcard.");
 95 module_param_array(enable, bool, NULL, 0444);
 96 MODULE_PARM_DESC(enable, "Enable " IDENT " soundcard.");
 97 #ifdef CONFIG_PNP
 98 module_param_array(isapnp, bool, NULL, 0444);
 99 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
100 #endif
101 module_param_array(port, long, NULL, 0444);
102 MODULE_PARM_DESC(port, "Port # for " IDENT " driver.");
103 module_param_array(cport, long, NULL, 0444);
104 MODULE_PARM_DESC(cport, "Control port # for " IDENT " driver.");
105 module_param_array(mpu_port, long, NULL, 0444);
106 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " IDENT " driver.");
107 module_param_array(fm_port, long, NULL, 0444);
108 MODULE_PARM_DESC(fm_port, "FM port # for " IDENT " driver.");
109 module_param_array(sb_port, long, NULL, 0444);
110 MODULE_PARM_DESC(sb_port, "SB port # for " IDENT " driver (optional).");
111 module_param_array(irq, int, NULL, 0444);
112 MODULE_PARM_DESC(irq, "IRQ # for " IDENT " driver.");
113 module_param_array(mpu_irq, int, NULL, 0444);
114 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " IDENT " driver.");
115 module_param_array(dma1, int, NULL, 0444);
116 MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver.");
117 module_param_array(dma2, int, NULL, 0444);
118 MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver.");
119 
120 #ifdef CONFIG_PNP
121 static int isa_registered;
122 static int pnpc_registered;
123 static int pnp_registered;
124 #endif /* CONFIG_PNP */
125 
126 struct snd_card_cs4236 {
127         struct snd_wss *chip;
128         struct resource *res_sb_port;
129 #ifdef CONFIG_PNP
130         struct pnp_dev *wss;
131         struct pnp_dev *ctrl;
132         struct pnp_dev *mpu;
133 #endif
134 };
135 
136 #ifdef CONFIG_PNP
137 
138 /*
139  * PNP BIOS
140  */
141 static const struct pnp_device_id snd_cs423x_pnpbiosids[] = {
142         { .id = "CSC0100" },
143         { .id = "CSC0000" },
144         /* Guillemot Turtlebeach something appears to be cs4232 compatible
145          * (untested) */
146         { .id = "GIM0100" },
147         { .id = "" }
148 };
149 MODULE_DEVICE_TABLE(pnp, snd_cs423x_pnpbiosids);
150 
151 #define CS423X_ISAPNP_DRIVER    "cs4232_isapnp"
152 static struct pnp_card_device_id snd_cs423x_pnpids[] = {
153         /* Philips PCA70PS */
154         { .id = "CSC0d32", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } },
155         /* TerraTec Maestro 32/96 (CS4232) */
156         { .id = "CSC1a32", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
157         /* HP Omnibook 5500 onboard */
158         { .id = "CSC4232", .devs = { { "CSC0000" }, { "CSC0002" }, { "CSC0003" } } },
159         /* Unnamed CS4236 card (Made in Taiwan) */
160         { .id = "CSC4236", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
161         /* Turtle Beach TBS-2000 (CS4232) */
162         { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSCb006" } } },
163         /* Turtle Beach Tropez Plus (CS4232) */
164         { .id = "CSC7632", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } },
165         /* SIC CrystalWave 32 (CS4232) */
166         { .id = "CSCf032", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
167         /* Netfinity 3000 on-board soundcard */
168         { .id = "CSCe825", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC010f" } } },
169         /* Intel Marlin Spike Motherboard - CS4235 */
170         { .id = "CSC0225", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
171         /* Intel Marlin Spike Motherboard (#2) - CS4235 */
172         { .id = "CSC0225", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC0103" } } },
173         /* Unknown Intel mainboard - CS4235 */
174         { .id = "CSC0225", .devs = { { "CSC0100" }, { "CSC0110" } } },
175         /* Genius Sound Maker 3DJ - CS4237B */
176         { .id = "CSC0437", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
177         /* Digital PC 5000 Onboard - CS4236B */
178         { .id = "CSC0735", .devs = { { "CSC0000" }, { "CSC0010" } } },
179         /* some unknown CS4236B */
180         { .id = "CSC0b35", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
181         /* Intel PR440FX Onboard sound */
182         { .id = "CSC0b36", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
183         /* CS4235 on mainboard without MPU */
184         { .id = "CSC1425", .devs = { { "CSC0100" }, { "CSC0110" } } },
185         /* Gateway E1000 Onboard CS4236B */
186         { .id = "CSC1335", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
187         /* HP 6330 Onboard sound */
188         { .id = "CSC1525", .devs = { { "CSC0100" }, { "CSC0110" }, { "CSC0103" } } },
189         /* Crystal Computer TidalWave128 */
190         { .id = "CSC1e37", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
191         /* ACER AW37 - CS4235 */
192         { .id = "CSC4236", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
193         /* build-in soundcard in EliteGroup P5TX-LA motherboard - CS4237B */
194         { .id = "CSC4237", .devs = { { "CSC0000" }, { "CSC0010" }, { "CSC0003" } } },
195         /* Crystal 3D - CS4237B */
196         { .id = "CSC4336", .devs = { { "CSC00