diff options
Diffstat (limited to 'sound/isa')
-rw-r--r-- | sound/isa/Kconfig | 61 | ||||
-rw-r--r-- | sound/isa/cs423x/cs4231_lib.c | 118 | ||||
-rw-r--r-- | sound/isa/opti9xx/opti92x-ad1848.c | 1126 | ||||
-rw-r--r-- | sound/isa/sb/Makefile | 2 | ||||
-rw-r--r-- | sound/isa/wavefront/wavefront_synth.c | 2 |
5 files changed, 173 insertions, 1136 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 1ff9f631084f..5769a13c1d95 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig | |||
@@ -21,12 +21,17 @@ config SND_SB16_DSP | |||
21 | select SND_PCM | 21 | select SND_PCM |
22 | select SND_SB_COMMON | 22 | select SND_SB_COMMON |
23 | 23 | ||
24 | menu "ISA devices" | 24 | menuconfig SND_ISA |
25 | depends on SND!=n && ISA && ISA_DMA_API | 25 | bool "ISA sound devices" |
26 | depends on ISA && ISA_DMA_API | ||
27 | default y | ||
28 | help | ||
29 | Support for sound devices connected via the ISA bus. | ||
30 | |||
31 | if SND_ISA | ||
26 | 32 | ||
27 | config SND_ADLIB | 33 | config SND_ADLIB |
28 | tristate "AdLib FM card" | 34 | tristate "AdLib FM card" |
29 | depends on SND | ||
30 | select SND_OPL3_LIB | 35 | select SND_OPL3_LIB |
31 | help | 36 | help |
32 | Say Y here to include support for AdLib FM cards. | 37 | Say Y here to include support for AdLib FM cards. |
@@ -36,7 +41,7 @@ config SND_ADLIB | |||
36 | 41 | ||
37 | config SND_AD1816A | 42 | config SND_AD1816A |
38 | tristate "Analog Devices SoundPort AD1816A" | 43 | tristate "Analog Devices SoundPort AD1816A" |
39 | depends on SND && PNP && ISA | 44 | depends on PNP |
40 | select ISAPNP | 45 | select ISAPNP |
41 | select SND_OPL3_LIB | 46 | select SND_OPL3_LIB |
42 | select SND_MPU401_UART | 47 | select SND_MPU401_UART |
@@ -50,7 +55,6 @@ config SND_AD1816A | |||
50 | 55 | ||
51 | config SND_AD1848 | 56 | config SND_AD1848 |
52 | tristate "Generic AD1848/CS4248 driver" | 57 | tristate "Generic AD1848/CS4248 driver" |
53 | depends on SND | ||
54 | select SND_AD1848_LIB | 58 | select SND_AD1848_LIB |
55 | help | 59 | help |
56 | Say Y here to include support for AD1848 (Analog Devices) or | 60 | Say Y here to include support for AD1848 (Analog Devices) or |
@@ -64,7 +68,7 @@ config SND_AD1848 | |||
64 | 68 | ||
65 | config SND_ALS100 | 69 | config SND_ALS100 |
66 | tristate "Avance Logic ALS100/ALS120" | 70 | tristate "Avance Logic ALS100/ALS120" |
67 | depends on SND && PNP && ISA | 71 | depends on PNP |
68 | select ISAPNP | 72 | select ISAPNP |
69 | select SND_OPL3_LIB | 73 | select SND_OPL3_LIB |
70 | select SND_MPU401_UART | 74 | select SND_MPU401_UART |
@@ -78,7 +82,7 @@ config SND_ALS100 | |||
78 | 82 | ||
79 | config SND_AZT2320 | 83 | config SND_AZT2320 |
80 | tristate "Aztech Systems AZT2320" | 84 | tristate "Aztech Systems AZT2320" |
81 | depends on SND && PNP && ISA | 85 | depends on PNP |
82 | select ISAPNP | 86 | select ISAPNP |
83 | select SND_OPL3_LIB | 87 | select SND_OPL3_LIB |
84 | select SND_MPU401_UART | 88 | select SND_MPU401_UART |
@@ -92,7 +96,6 @@ config SND_AZT2320 | |||
92 | 96 | ||
93 | config SND_CMI8330 | 97 | config SND_CMI8330 |
94 | tristate "C-Media CMI8330" | 98 | tristate "C-Media CMI8330" |
95 | depends on SND | ||
96 | select SND_AD1848_LIB | 99 | select SND_AD1848_LIB |
97 | select SND_SB16_DSP | 100 | select SND_SB16_DSP |
98 | help | 101 | help |
@@ -104,7 +107,6 @@ config SND_CMI8330 | |||
104 | 107 | ||
105 | config SND_CS4231 | 108 | config SND_CS4231 |
106 | tristate "Generic Cirrus Logic CS4231 driver" | 109 | tristate "Generic Cirrus Logic CS4231 driver" |
107 | depends on SND | ||
108 | select SND_MPU401_UART | 110 | select SND_MPU401_UART |
109 | select SND_CS4231_LIB | 111 | select SND_CS4231_LIB |
110 | help | 112 | help |
@@ -116,7 +118,6 @@ config SND_CS4231 | |||
116 | 118 | ||
117 | config SND_CS4232 | 119 | config SND_CS4232 |
118 | tristate "Generic Cirrus Logic CS4232 driver" | 120 | tristate "Generic Cirrus Logic CS4232 driver" |
119 | depends on SND | ||
120 | select SND_OPL3_LIB | 121 | select SND_OPL3_LIB |
121 | select SND_MPU401_UART | 122 | select SND_MPU401_UART |
122 | select SND_CS4231_LIB | 123 | select SND_CS4231_LIB |
@@ -129,7 +130,6 @@ config SND_CS4232 | |||
129 | 130 | ||
130 | config SND_CS4236 | 131 | config SND_CS4236 |
131 | tristate "Generic Cirrus Logic CS4236+ driver" | 132 | tristate "Generic Cirrus Logic CS4236+ driver" |
132 | depends on SND | ||
133 | select SND_OPL3_LIB | 133 | select SND_OPL3_LIB |
134 | select SND_MPU401_UART | 134 | select SND_MPU401_UART |
135 | select SND_CS4231_LIB | 135 | select SND_CS4231_LIB |
@@ -142,7 +142,7 @@ config SND_CS4236 | |||
142 | 142 | ||
143 | config SND_DT019X | 143 | config SND_DT019X |
144 | tristate "Diamond Technologies DT-019X, Avance Logic ALS-007" | 144 | tristate "Diamond Technologies DT-019X, Avance Logic ALS-007" |
145 | depends on SND && PNP && ISA | 145 | depends on PNP |
146 | select ISAPNP | 146 | select ISAPNP |
147 | select SND_OPL3_LIB | 147 | select SND_OPL3_LIB |
148 | select SND_MPU401_UART | 148 | select SND_MPU401_UART |
@@ -156,7 +156,7 @@ config SND_DT019X | |||
156 | 156 | ||
157 | config SND_ES968 | 157 | config SND_ES968 |
158 | tristate "Generic ESS ES968 driver" | 158 | tristate "Generic ESS ES968 driver" |
159 | depends on SND && PNP && ISA | 159 | depends on PNP |
160 | select ISAPNP | 160 | select ISAPNP |
161 | select SND_MPU401_UART | 161 | select SND_MPU401_UART |
162 | select SND_SB8_DSP | 162 | select SND_SB8_DSP |
@@ -168,7 +168,6 @@ config SND_ES968 | |||
168 | 168 | ||
169 | config SND_ES1688 | 169 | config SND_ES1688 |
170 | tristate "Generic ESS ES688/ES1688 driver" | 170 | tristate "Generic ESS ES688/ES1688 driver" |
171 | depends on SND | ||
172 | select SND_OPL3_LIB | 171 | select SND_OPL3_LIB |
173 | select SND_MPU401_UART | 172 | select SND_MPU401_UART |
174 | select SND_PCM | 173 | select SND_PCM |
@@ -181,7 +180,6 @@ config SND_ES1688 | |||
181 | 180 | ||
182 | config SND_ES18XX | 181 | config SND_ES18XX |
183 | tristate "Generic ESS ES18xx driver" | 182 | tristate "Generic ESS ES18xx driver" |
184 | depends on SND | ||
185 | select SND_OPL3_LIB | 183 | select SND_OPL3_LIB |
186 | select SND_MPU401_UART | 184 | select SND_MPU401_UART |
187 | select SND_PCM | 185 | select SND_PCM |
@@ -193,7 +191,7 @@ config SND_ES18XX | |||
193 | 191 | ||
194 | config SND_SC6000 | 192 | config SND_SC6000 |
195 | tristate "Gallant SC-6000, Audio Excel DSP 16" | 193 | tristate "Gallant SC-6000, Audio Excel DSP 16" |
196 | depends on SND && HAS_IOPORT | 194 | depends on HAS_IOPORT |
197 | select SND_AD1848_LIB | 195 | select SND_AD1848_LIB |
198 | select SND_OPL3_LIB | 196 | select SND_OPL3_LIB |
199 | select SND_MPU401_UART | 197 | select SND_MPU401_UART |
@@ -204,15 +202,10 @@ config SND_SC6000 | |||
204 | To compile this driver as a module, choose M here: the module | 202 | To compile this driver as a module, choose M here: the module |
205 | will be called snd-sc6000. | 203 | will be called snd-sc6000. |
206 | 204 | ||
207 | config SND_GUS_SYNTH | ||
208 | tristate | ||
209 | |||
210 | config SND_GUSCLASSIC | 205 | config SND_GUSCLASSIC |
211 | tristate "Gravis UltraSound Classic" | 206 | tristate "Gravis UltraSound Classic" |
212 | depends on SND | ||
213 | select SND_RAWMIDI | 207 | select SND_RAWMIDI |
214 | select SND_PCM | 208 | select SND_PCM |
215 | select SND_GUS_SYNTH | ||
216 | help | 209 | help |
217 | Say Y here to include support for Gravis UltraSound Classic | 210 | Say Y here to include support for Gravis UltraSound Classic |
218 | soundcards. | 211 | soundcards. |
@@ -222,11 +215,9 @@ config SND_GUSCLASSIC | |||
222 | 215 | ||
223 | config SND_GUSEXTREME | 216 | config SND_GUSEXTREME |
224 | tristate "Gravis UltraSound Extreme" | 217 | tristate "Gravis UltraSound Extreme" |
225 | depends on SND | ||
226 | select SND_HWDEP | 218 | select SND_HWDEP |
227 | select SND_MPU401_UART | 219 | select SND_MPU401_UART |
228 | select SND_PCM | 220 | select SND_PCM |
229 | select SND_GUS_SYNTH | ||
230 | help | 221 | help |
231 | Say Y here to include support for Gravis UltraSound Extreme | 222 | Say Y here to include support for Gravis UltraSound Extreme |
232 | soundcards. | 223 | soundcards. |
@@ -236,10 +227,8 @@ config SND_GUSEXTREME | |||
236 | 227 | ||
237 | config SND_GUSMAX | 228 | config SND_GUSMAX |
238 | tristate "Gravis UltraSound MAX" | 229 | tristate "Gravis UltraSound MAX" |
239 | depends on SND | ||
240 | select SND_RAWMIDI | 230 | select SND_RAWMIDI |
241 | select SND_CS4231_LIB | 231 | select SND_CS4231_LIB |
242 | select SND_GUS_SYNTH | ||
243 | help | 232 | help |
244 | Say Y here to include support for Gravis UltraSound MAX | 233 | Say Y here to include support for Gravis UltraSound MAX |
245 | soundcards. | 234 | soundcards. |
@@ -249,10 +238,9 @@ config SND_GUSMAX | |||
249 | 238 | ||
250 | config SND_INTERWAVE | 239 | config SND_INTERWAVE |
251 | tristate "AMD InterWave, Gravis UltraSound PnP" | 240 | tristate "AMD InterWave, Gravis UltraSound PnP" |
252 | depends on SND && PNP && ISA | 241 | depends on PNP |
253 | select SND_RAWMIDI | 242 | select SND_RAWMIDI |
254 | select SND_CS4231_LIB | 243 | select SND_CS4231_LIB |
255 | select SND_GUS_SYNTH | ||
256 | help | 244 | help |
257 | Say Y here to include support for AMD InterWave based | 245 | Say Y here to include support for AMD InterWave based |
258 | soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, | 246 | soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, |
@@ -263,10 +251,9 @@ config SND_INTERWAVE | |||
263 | 251 | ||
264 | config SND_INTERWAVE_STB | 252 | config SND_INTERWAVE_STB |
265 | tristate "AMD InterWave + TEA6330T (UltraSound 32-Pro)" | 253 | tristate "AMD InterWave + TEA6330T (UltraSound 32-Pro)" |
266 | depends on SND && PNP && ISA | 254 | depends on PNP |
267 | select SND_RAWMIDI | 255 | select SND_RAWMIDI |
268 | select SND_CS4231_LIB | 256 | select SND_CS4231_LIB |
269 | select SND_GUS_SYNTH | ||
270 | help | 257 | help |
271 | Say Y here to include support for AMD InterWave based | 258 | Say Y here to include support for AMD InterWave based |
272 | soundcards with a TEA6330T bass and treble regulator | 259 | soundcards with a TEA6330T bass and treble regulator |
@@ -277,7 +264,6 @@ config SND_INTERWAVE_STB | |||
277 | 264 | ||
278 | config SND_OPL3SA2 | 265 | config SND_OPL3SA2 |
279 | tristate "Yamaha OPL3-SA2/SA3" | 266 | tristate "Yamaha OPL3-SA2/SA3" |
280 | depends on SND | ||
281 | select SND_OPL3_LIB | 267 | select SND_OPL3_LIB |
282 | select SND_MPU401_UART | 268 | select SND_MPU401_UART |
283 | select SND_CS4231_LIB | 269 | select SND_CS4231_LIB |
@@ -290,7 +276,6 @@ config SND_OPL3SA2 | |||
290 | 276 | ||
291 | config SND_OPTI92X_AD1848 | 277 | config SND_OPTI92X_AD1848 |
292 | tristate "OPTi 82C92x - AD1848" | 278 | tristate "OPTi 82C92x - AD1848" |
293 | depends on SND | ||
294 | select SND_OPL3_LIB | 279 | select SND_OPL3_LIB |
295 | select SND_OPL4_LIB | 280 | select SND_OPL4_LIB |
296 | select SND_MPU401_UART | 281 | select SND_MPU401_UART |
@@ -304,7 +289,6 @@ config SND_OPTI92X_AD1848 | |||
304 | 289 | ||
305 | config SND_OPTI92X_CS4231 | 290 | config SND_OPTI92X_CS4231 |
306 | tristate "OPTi 82C92x - CS4231" | 291 | tristate "OPTi 82C92x - CS4231" |
307 | depends on SND | ||
308 | select SND_OPL3_LIB | 292 | select SND_OPL3_LIB |
309 | select SND_OPL4_LIB | 293 | select SND_OPL4_LIB |
310 | select SND_MPU401_UART | 294 | select SND_MPU401_UART |
@@ -318,10 +302,9 @@ config SND_OPTI92X_CS4231 | |||
318 | 302 | ||
319 | config SND_OPTI93X | 303 | config SND_OPTI93X |
320 | tristate "OPTi 82C93x" | 304 | tristate "OPTi 82C93x" |
321 | depends on SND | ||
322 | select SND_OPL3_LIB | 305 | select SND_OPL3_LIB |
323 | select SND_MPU401_UART | 306 | select SND_MPU401_UART |
324 | select SND_PCM | 307 | select SND_CS4231_LIB |
325 | help | 308 | help |
326 | Say Y here to include support for soundcards based on Opti | 309 | Say Y here to include support for soundcards based on Opti |
327 | 82C93x chips. | 310 | 82C93x chips. |
@@ -331,7 +314,6 @@ config SND_OPTI93X | |||
331 | 314 | ||
332 | config SND_MIRO | 315 | config SND_MIRO |
333 | tristate "Miro miroSOUND PCM1pro/PCM12/PCM20radio driver" | 316 | tristate "Miro miroSOUND PCM1pro/PCM12/PCM20radio driver" |
334 | depends on SND | ||
335 | select SND_OPL4_LIB | 317 | select SND_OPL4_LIB |
336 | select SND_CS4231_LIB | 318 | select SND_CS4231_LIB |
337 | select SND_MPU401_UART | 319 | select SND_MPU401_UART |
@@ -345,7 +327,6 @@ config SND_MIRO | |||
345 | 327 | ||
346 | config SND_SB8 | 328 | config SND_SB8 |
347 | tristate "Sound Blaster 1.0/2.0/Pro (8-bit)" | 329 | tristate "Sound Blaster 1.0/2.0/Pro (8-bit)" |
348 | depends on SND | ||
349 | select SND_OPL3_LIB | 330 | select SND_OPL3_LIB |
350 | select SND_RAWMIDI | 331 | select SND_RAWMIDI |
351 | select SND_SB8_DSP | 332 | select SND_SB8_DSP |
@@ -358,7 +339,6 @@ config SND_SB8 | |||
358 | 339 | ||
359 | config SND_SB16 | 340 | config SND_SB16 |
360 | tristate "Sound Blaster 16 (PnP)" | 341 | tristate "Sound Blaster 16 (PnP)" |
361 | depends on SND | ||
362 | select SND_OPL3_LIB | 342 | select SND_OPL3_LIB |
363 | select SND_MPU401_UART | 343 | select SND_MPU401_UART |
364 | select SND_SB16_DSP | 344 | select SND_SB16_DSP |
@@ -371,7 +351,6 @@ config SND_SB16 | |||
371 | 351 | ||
372 | config SND_SBAWE | 352 | config SND_SBAWE |
373 | tristate "Sound Blaster AWE (32,64) (PnP)" | 353 | tristate "Sound Blaster AWE (32,64) (PnP)" |
374 | depends on SND | ||
375 | select SND_OPL3_LIB | 354 | select SND_OPL3_LIB |
376 | select SND_MPU401_UART | 355 | select SND_MPU401_UART |
377 | select SND_SB16_DSP | 356 | select SND_SB16_DSP |
@@ -393,7 +372,6 @@ config SND_SB16_CSP | |||
393 | 372 | ||
394 | config SND_SGALAXY | 373 | config SND_SGALAXY |
395 | tristate "Aztech Sound Galaxy" | 374 | tristate "Aztech Sound Galaxy" |
396 | depends on SND | ||
397 | select SND_AD1848_LIB | 375 | select SND_AD1848_LIB |
398 | help | 376 | help |
399 | Say Y here to include support for Aztech Sound Galaxy | 377 | Say Y here to include support for Aztech Sound Galaxy |
@@ -404,7 +382,6 @@ config SND_SGALAXY | |||
404 | 382 | ||
405 | config SND_SSCAPE | 383 | config SND_SSCAPE |
406 | tristate "Ensoniq SoundScape PnP driver" | 384 | tristate "Ensoniq SoundScape PnP driver" |
407 | depends on SND | ||
408 | select SND_HWDEP | 385 | select SND_HWDEP |
409 | select SND_MPU401_UART | 386 | select SND_MPU401_UART |
410 | select SND_CS4231_LIB | 387 | select SND_CS4231_LIB |
@@ -417,7 +394,6 @@ config SND_SSCAPE | |||
417 | 394 | ||
418 | config SND_WAVEFRONT | 395 | config SND_WAVEFRONT |
419 | tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" | 396 | tristate "Turtle Beach Maui,Tropez,Tropez+ (Wavefront)" |
420 | depends on SND | ||
421 | select FW_LOADER | 397 | select FW_LOADER |
422 | select SND_OPL3_LIB | 398 | select SND_OPL3_LIB |
423 | select SND_MPU401_UART | 399 | select SND_MPU401_UART |
@@ -439,4 +415,5 @@ config SND_WAVEFRONT_FIRMWARE_IN_KERNEL | |||
439 | you need to install the firmware files from the | 415 | you need to install the firmware files from the |
440 | alsa-firmware package. | 416 | alsa-firmware package. |
441 | 417 | ||
442 | endmenu | 418 | endif # SND_ISA |
419 | |||
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index 0aa8649e5c7f..521db705d179 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c | |||
@@ -119,6 +119,42 @@ static unsigned char snd_cs4231_original_image[32] = | |||
119 | 0x00, /* 1f/31 - cbrl */ | 119 | 0x00, /* 1f/31 - cbrl */ |
120 | }; | 120 | }; |
121 | 121 | ||
122 | static unsigned char snd_opti93x_original_image[32] = | ||
123 | { | ||
124 | 0x00, /* 00/00 - l_mixout_outctrl */ | ||
125 | 0x00, /* 01/01 - r_mixout_outctrl */ | ||
126 | 0x88, /* 02/02 - l_cd_inctrl */ | ||
127 | 0x88, /* 03/03 - r_cd_inctrl */ | ||
128 | 0x88, /* 04/04 - l_a1/fm_inctrl */ | ||
129 | 0x88, /* 05/05 - r_a1/fm_inctrl */ | ||
130 | 0x80, /* 06/06 - l_dac_inctrl */ | ||
131 | 0x80, /* 07/07 - r_dac_inctrl */ | ||
132 | 0x00, /* 08/08 - ply_dataform_reg */ | ||
133 | 0x00, /* 09/09 - if_conf */ | ||
134 | 0x00, /* 0a/10 - pin_ctrl */ | ||
135 | 0x00, /* 0b/11 - err_init_reg */ | ||
136 | 0x0a, /* 0c/12 - id_reg */ | ||
137 | 0x00, /* 0d/13 - reserved */ | ||
138 | 0x00, /* 0e/14 - ply_upcount_reg */ | ||
139 | 0x00, /* 0f/15 - ply_lowcount_reg */ | ||
140 | 0x88, /* 10/16 - reserved/l_a1_inctrl */ | ||
141 | 0x88, /* 11/17 - reserved/r_a1_inctrl */ | ||
142 | 0x88, /* 12/18 - l_line_inctrl */ | ||
143 | 0x88, /* 13/19 - r_line_inctrl */ | ||
144 | 0x88, /* 14/20 - l_mic_inctrl */ | ||
145 | 0x88, /* 15/21 - r_mic_inctrl */ | ||
146 | 0x80, /* 16/22 - l_out_outctrl */ | ||
147 | 0x80, /* 17/23 - r_out_outctrl */ | ||
148 | 0x00, /* 18/24 - reserved */ | ||
149 | 0x00, /* 19/25 - reserved */ | ||
150 | 0x00, /* 1a/26 - reserved */ | ||
151 | 0x00, /* 1b/27 - reserved */ | ||
152 | 0x00, /* 1c/28 - cap_dataform_reg */ | ||
153 | 0x00, /* 1d/29 - reserved */ | ||
154 | 0x00, /* 1e/30 - cap_upcount_reg */ | ||
155 | 0x00 /* 1f/31 - cap_lowcount_reg */ | ||
156 | }; | ||
157 | |||
122 | /* | 158 | /* |
123 | * Basic I/O functions | 159 | * Basic I/O functions |
124 | */ | 160 | */ |
@@ -895,7 +931,7 @@ static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream) | |||
895 | return 0; | 931 | return 0; |
896 | } | 932 | } |
897 | 933 | ||
898 | static void snd_cs4231_overrange(struct snd_cs4231 *chip) | 934 | void snd_cs4231_overrange(struct snd_cs4231 *chip) |
899 | { | 935 | { |
900 | unsigned long flags; | 936 | unsigned long flags; |
901 | unsigned char res; | 937 | unsigned char res; |
@@ -1054,8 +1090,11 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1054 | chip->image[CS4231_IFACE_CTRL] = | 1090 | chip->image[CS4231_IFACE_CTRL] = |
1055 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | | 1091 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | |
1056 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); | 1092 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); |
1057 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; | 1093 | if (chip->hardware != CS4231_HW_OPTI93X) { |
1058 | chip->image[CS4231_ALT_FEATURE_2] = chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; | 1094 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; |
1095 | chip->image[CS4231_ALT_FEATURE_2] = | ||
1096 | chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; | ||
1097 | } | ||
1059 | ptr = (unsigned char *) &chip->image; | 1098 | ptr = (unsigned char *) &chip->image; |
1060 | snd_cs4231_mce_down(chip); | 1099 | snd_cs4231_mce_down(chip); |
1061 | spin_lock_irqsave(&chip->reg_lock, flags); | 1100 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -1376,6 +1415,7 @@ const char *snd_cs4231_chip_id(struct snd_cs4231 *chip) | |||
1376 | case CS4231_HW_INTERWAVE: return "AMD InterWave"; | 1415 | case CS4231_HW_INTERWAVE: return "AMD InterWave"; |
1377 | case CS4231_HW_OPL3SA2: return chip->card->shortname; | 1416 | case CS4231_HW_OPL3SA2: return chip->card->shortname; |
1378 | case CS4231_HW_AD1845: return "AD1845"; | 1417 | case CS4231_HW_AD1845: return "AD1845"; |
1418 | case CS4231_HW_OPTI93X: return "OPTi 93x"; | ||
1379 | default: return "???"; | 1419 | default: return "???"; |
1380 | } | 1420 | } |
1381 | } | 1421 | } |
@@ -1401,8 +1441,13 @@ static int snd_cs4231_new(struct snd_card *card, | |||
1401 | chip->rate_constraint = snd_cs4231_xrate; | 1441 | chip->rate_constraint = snd_cs4231_xrate; |
1402 | chip->set_playback_format = snd_cs4231_playback_format; | 1442 | chip->set_playback_format = snd_cs4231_playback_format; |
1403 | chip->set_capture_format = snd_cs4231_capture_format; | 1443 | chip->set_capture_format = snd_cs4231_capture_format; |
1404 | memcpy(&chip->image, &snd_cs4231_original_image, sizeof(snd_cs4231_original_image)); | 1444 | if (chip->hardware == CS4231_HW_OPTI93X) |
1405 | 1445 | memcpy(&chip->image, &snd_opti93x_original_image, | |
1446 | sizeof(snd_opti93x_original_image)); | ||
1447 | else | ||
1448 | memcpy(&chip->image, &snd_cs4231_original_image, | ||
1449 | sizeof(snd_cs4231_original_image)); | ||
1450 | |||
1406 | *rchip = chip; | 1451 | *rchip = chip; |
1407 | return 0; | 1452 | return 0; |
1408 | } | 1453 | } |
@@ -1790,6 +1835,48 @@ CS4231_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | |||
1790 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1) | 1835 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1) |
1791 | }; | 1836 | }; |
1792 | 1837 | ||
1838 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | ||
1839 | CS4231_DOUBLE("Master Playback Switch", 0, | ||
1840 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | ||
1841 | CS4231_DOUBLE("Master Playback Volume", 0, | ||
1842 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | ||
1843 | CS4231_DOUBLE("PCM Playback Switch", 0, | ||
1844 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | ||
1845 | CS4231_DOUBLE("PCM Playback Volume", 0, | ||
1846 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), | ||
1847 | CS4231_DOUBLE("FM Playback Switch", 0, | ||
1848 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
1849 | CS4231_DOUBLE("FM Playback Volume", 0, | ||
1850 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), | ||
1851 | CS4231_DOUBLE("Line Playback Switch", 0, | ||
1852 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | ||
1853 | CS4231_DOUBLE("Line Playback Volume", 0, | ||
1854 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), | ||
1855 | CS4231_DOUBLE("Mic Playback Switch", 0, | ||
1856 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), | ||
1857 | CS4231_DOUBLE("Mic Playback Volume", 0, | ||
1858 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), | ||
1859 | CS4231_DOUBLE("Mic Boost", 0, | ||
1860 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | ||
1861 | CS4231_DOUBLE("CD Playback Switch", 0, | ||
1862 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | ||
1863 | CS4231_DOUBLE("CD Playback Volume", 0, | ||
1864 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), | ||
1865 | CS4231_DOUBLE("Aux Playback Switch", 0, | ||
1866 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), | ||
1867 | CS4231_DOUBLE("Aux Playback Volume", 0, | ||
1868 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), | ||
1869 | CS4231_DOUBLE("Capture Volume", 0, | ||
1870 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
1871 | { | ||
1872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1873 | .name = "Capture Source", | ||
1874 | .info = snd_cs4231_info_mux, | ||
1875 | .get = snd_cs4231_get_mux, | ||
1876 | .put = snd_cs4231_put_mux, | ||
1877 | } | ||
1878 | }; | ||
1879 | |||
1793 | int snd_cs4231_mixer(struct snd_cs4231 *chip) | 1880 | int snd_cs4231_mixer(struct snd_cs4231 *chip) |
1794 | { | 1881 | { |
1795 | struct snd_card *card; | 1882 | struct snd_card *card; |
@@ -1802,10 +1889,22 @@ int snd_cs4231_mixer(struct snd_cs4231 *chip) | |||
1802 | 1889 | ||
1803 | strcpy(card->mixername, chip->pcm->name); | 1890 | strcpy(card->mixername, chip->pcm->name); |
1804 | 1891 | ||
1805 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { | 1892 | if (chip->hardware == CS4231_HW_OPTI93X) |
1806 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4231_controls[idx], chip))) < 0) | 1893 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { |
1807 | return err; | 1894 | err = snd_ctl_add(card, |
1808 | } | 1895 | snd_ctl_new1(&snd_opti93x_controls[idx], |
1896 | chip)); | ||
1897 | if (err < 0) | ||
1898 | return err; | ||
1899 | } | ||
1900 | else | ||
1901 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { | ||
1902 | err = snd_ctl_add(card, | ||
1903 | snd_ctl_new1(&snd_cs4231_controls[idx], | ||
1904 | chip)); | ||
1905 | if (err < 0) | ||
1906 | return err; | ||
1907 | } | ||
1809 | return 0; | 1908 | return 0; |
1810 | } | 1909 | } |
1811 | 1910 | ||
@@ -1815,6 +1914,7 @@ EXPORT_SYMBOL(snd_cs4236_ext_out); | |||
1815 | EXPORT_SYMBOL(snd_cs4236_ext_in); | 1914 | EXPORT_SYMBOL(snd_cs4236_ext_in); |
1816 | EXPORT_SYMBOL(snd_cs4231_mce_up); | 1915 | EXPORT_SYMBOL(snd_cs4231_mce_up); |
1817 | EXPORT_SYMBOL(snd_cs4231_mce_down); | 1916 | EXPORT_SYMBOL(snd_cs4231_mce_down); |
1917 | EXPORT_SYMBOL(snd_cs4231_overrange); | ||
1818 | EXPORT_SYMBOL(snd_cs4231_interrupt); | 1918 | EXPORT_SYMBOL(snd_cs4231_interrupt); |
1819 | EXPORT_SYMBOL(snd_cs4231_chip_id); | 1919 | EXPORT_SYMBOL(snd_cs4231_chip_id); |
1820 | EXPORT_SYMBOL(snd_cs4231_create); | 1920 | EXPORT_SYMBOL(snd_cs4231_create); |
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index fe1afc13a01d..41c047e665ec 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c | |||
@@ -33,15 +33,10 @@ | |||
33 | #include <asm/io.h> | 33 | #include <asm/io.h> |
34 | #include <asm/dma.h> | 34 | #include <asm/dma.h> |
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #ifdef CS4231 | 36 | #if defined(CS4231) || defined(OPTi93X) |
37 | #include <sound/cs4231.h> | 37 | #include <sound/cs4231.h> |
38 | #else | 38 | #else |
39 | #ifndef OPTi93X | ||
40 | #include <sound/ad1848.h> | 39 | #include <sound/ad1848.h> |
41 | #else | ||
42 | #include <sound/control.h> | ||
43 | #include <sound/pcm.h> | ||
44 | #endif /* OPTi93X */ | ||
45 | #endif /* CS4231 */ | 40 | #endif /* CS4231 */ |
46 | #include <sound/mpu401.h> | 41 | #include <sound/mpu401.h> |
47 | #include <sound/opl3.h> | 42 | #include <sound/opl3.h> |
@@ -109,7 +104,6 @@ module_param(dma2, int, 0444); | |||
109 | MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver."); | 104 | MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver."); |
110 | #endif /* CS4231 || OPTi93X */ | 105 | #endif /* CS4231 || OPTi93X */ |
111 | 106 | ||
112 | #define OPTi9XX_HW_DETECT 0 | ||
113 | #define OPTi9XX_HW_82C928 1 | 107 | #define OPTi9XX_HW_82C928 1 |
114 | #define OPTi9XX_HW_82C929 2 | 108 | #define OPTi9XX_HW_82C929 2 |
115 | #define OPTi9XX_HW_82C924 3 | 109 | #define OPTi9XX_HW_82C924 3 |
@@ -123,105 +117,12 @@ MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver."); | |||
123 | 117 | ||
124 | #ifdef OPTi93X | 118 | #ifdef OPTi93X |
125 | 119 | ||
126 | #define OPTi93X_INDEX 0x00 | ||
127 | #define OPTi93X_DATA 0x01 | ||
128 | #define OPTi93X_STATUS 0x02 | 120 | #define OPTi93X_STATUS 0x02 |
129 | #define OPTi93X_DDATA 0x03 | ||
130 | #define OPTi93X_PORT(chip, r) ((chip)->port + OPTi93X_##r) | 121 | #define OPTi93X_PORT(chip, r) ((chip)->port + OPTi93X_##r) |
131 | 122 | ||
132 | #define OPTi93X_MIXOUT_LEFT 0x00 | ||
133 | #define OPTi93X_MIXOUT_RIGHT 0x01 | ||
134 | #define OPTi93X_CD_LEFT_INPUT 0x02 | ||
135 | #define OPTi93X_CD_RIGHT_INPUT 0x03 | ||
136 | #define OPTi930_AUX_LEFT_INPUT 0x04 | ||
137 | #define OPTi930_AUX_RIGHT_INPUT 0x05 | ||
138 | #define OPTi931_FM_LEFT_INPUT 0x04 | ||
139 | #define OPTi931_FM_RIGHT_INPUT 0x05 | ||
140 | #define OPTi93X_DAC_LEFT 0x06 | ||
141 | #define OPTi93X_DAC_RIGHT 0x07 | ||
142 | #define OPTi93X_PLAY_FORMAT 0x08 | ||
143 | #define OPTi93X_IFACE_CONF 0x09 | ||
144 | #define OPTi93X_PIN_CTRL 0x0a | ||
145 | #define OPTi93X_ERR_INIT 0x0b | ||
146 | #define OPTi93X_ID 0x0c | ||
147 | #define OPTi93X_PLAY_UPR_CNT 0x0e | ||
148 | #define OPTi93X_PLAY_LWR_CNT 0x0f | ||
149 | #define OPTi931_AUX_LEFT_INPUT 0x10 | ||
150 | #define OPTi931_AUX_RIGHT_INPUT 0x11 | ||
151 | #define OPTi93X_LINE_LEFT_INPUT 0x12 | ||
152 | #define OPTi93X_LINE_RIGHT_INPUT 0x13 | ||
153 | #define OPTi93X_MIC_LEFT_INPUT 0x14 | ||
154 | #define OPTi93X_MIC_RIGHT_INPUT 0x15 | ||
155 | #define OPTi93X_OUT_LEFT 0x16 | ||
156 | #define OPTi93X_OUT_RIGHT 0x17 | ||
157 | #define OPTi93X_CAPT_FORMAT 0x1c | ||
158 | #define OPTi93X_CAPT_UPR_CNT 0x1e | ||
159 | #define OPTi93X_CAPT_LWR_CNT 0x1f | ||
160 | |||
161 | #define OPTi93X_TRD 0x20 | ||
162 | #define OPTi93X_MCE 0x40 | ||
163 | #define OPTi93X_INIT 0x80 | ||
164 | |||
165 | #define OPTi93X_MIXOUT_MIC_GAIN 0x20 | ||
166 | #define OPTi93X_MIXOUT_LINE 0x00 | ||
167 | #define OPTi93X_MIXOUT_CD 0x40 | ||
168 | #define OPTi93X_MIXOUT_MIC 0x80 | ||
169 | #define OPTi93X_MIXOUT_MIXER 0xc0 | ||
170 | |||
171 | #define OPTi93X_STEREO 0x10 | ||
172 | #define OPTi93X_LINEAR_8 0x00 | ||
173 | #define OPTi93X_ULAW_8 0x20 | ||
174 | #define OPTi93X_LINEAR_16_LIT 0x40 | ||
175 | #define OPTi93X_ALAW_8 0x60 | ||
176 | #define OPTi93X_ADPCM_16 0xa0 | ||
177 | #define OPTi93X_LINEAR_16_BIG 0xc0 | ||
178 | |||
179 | #define OPTi93X_CAPTURE_PIO 0x80 | ||
180 | #define OPTi93X_PLAYBACK_PIO 0x40 | ||
181 | #define OPTi93X_AUTOCALIB 0x08 | ||
182 | #define OPTi93X_SINGLE_DMA 0x04 | ||
183 | #define OPTi93X_CAPTURE_ENABLE 0x02 | ||
184 | #define OPTi93X_PLAYBACK_ENABLE 0x01 | ||
185 | |||
186 | #define OPTi93X_IRQ_ENABLE 0x02 | ||
187 | |||
188 | #define OPTi93X_DMA_REQUEST 0x10 | ||
189 | #define OPTi93X_CALIB_IN_PROGRESS 0x20 | ||
190 | |||
191 | #define OPTi93X_IRQ_PLAYBACK 0x04 | 123 | #define OPTi93X_IRQ_PLAYBACK 0x04 |
192 | #define OPTi93X_IRQ_CAPTURE 0x08 | 124 | #define OPTi93X_IRQ_CAPTURE 0x08 |
193 | 125 | ||
194 | |||
195 | struct snd_opti93x { | ||
196 | unsigned long port; | ||
197 | struct resource *res_port; | ||
198 | int irq; | ||
199 | int dma1; | ||
200 | int dma2; | ||
201 | |||
202 | struct snd_opti9xx *chip; | ||
203 | unsigned short hardware; | ||
204 | unsigned char image[32]; | ||
205 | |||
206 | unsigned char mce_bit; | ||
207 | unsigned short mode; | ||
208 | int mute; | ||
209 | |||
210 | spinlock_t lock; | ||
211 | |||
212 | struct snd_card *card; | ||
213 | struct snd_pcm *pcm; | ||
214 | struct snd_pcm_substream *playback_substream; | ||
215 | struct snd_pcm_substream *capture_substream; | ||
216 | unsigned int p_dma_size; | ||
217 | unsigned int c_dma_size; | ||
218 | }; | ||
219 | |||
220 | #define OPTi93X_MODE_NONE 0x00 | ||
221 | #define OPTi93X_MODE_PLAY 0x01 | ||
222 | #define OPTi93X_MODE_CAPTURE 0x02 | ||
223 | #define OPTi93X_MODE_OPEN (OPTi93X_MODE_PLAY | OPTi93X_MODE_CAPTURE) | ||
224 | |||
225 | #endif /* OPTi93X */ | 126 | #endif /* OPTi93X */ |
226 | 127 | ||
227 | struct snd_opti9xx { | 128 | struct snd_opti9xx { |
@@ -234,6 +135,7 @@ struct snd_opti9xx { | |||
234 | unsigned long mc_base_size; | 135 | unsigned long mc_base_size; |
235 | #ifdef OPTi93X | 136 | #ifdef OPTi93X |
236 | unsigned long mc_indir_index; | 137 | unsigned long mc_indir_index; |
138 | struct snd_cs4231 *codec; | ||
237 | #endif /* OPTi93X */ | 139 | #endif /* OPTi93X */ |
238 | unsigned long pwd_reg; | 140 | unsigned long pwd_reg; |
239 | 141 | ||
@@ -491,16 +393,9 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) | |||
491 | break; | 393 | break; |
492 | 394 | ||
493 | #else /* OPTi93X */ | 395 | #else /* OPTi93X */ |
494 | case OPTi9XX_HW_82C930: | ||
495 | case OPTi9XX_HW_82C931: | 396 | case OPTi9XX_HW_82C931: |
496 | case OPTi9XX_HW_82C933: | 397 | case OPTi9XX_HW_82C933: |
497 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); | 398 | /* |
498 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); | ||
499 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0x10 | | ||
500 | (chip->hardware == OPTi9XX_HW_82C930 ? 0x00 : 0x04), | ||
501 | 0x34); | ||
502 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x20, 0xbf); | ||
503 | /* | ||
504 | * The BTC 1817DW has QS1000 wavetable which is connected | 399 | * The BTC 1817DW has QS1000 wavetable which is connected |
505 | * to the serial digital input of the OPTI931. | 400 | * to the serial digital input of the OPTI931. |
506 | */ | 401 | */ |
@@ -510,6 +405,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip) | |||
510 | * or digital input signal. | 405 | * or digital input signal. |
511 | */ | 406 | */ |
512 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01); | 407 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01); |
408 | case OPTi9XX_HW_82C930: /* FALL THROUGH */ | ||
409 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); | ||
410 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); | ||
411 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0x10 | | ||
412 | (chip->hardware == OPTi9XX_HW_82C930 ? 0x00 : 0x04), | ||
413 | 0x34); | ||
414 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(5), 0x20, 0xbf); | ||
513 | break; | 415 | break; |
514 | #endif /* OPTi93X */ | 416 | #endif /* OPTi93X */ |
515 | 417 | ||
@@ -654,979 +556,23 @@ __skip_mpu: | |||
654 | 556 | ||
655 | #ifdef OPTi93X | 557 | #ifdef OPTi93X |
656 | 558 | ||
657 | static unsigned char snd_opti93x_default_image[32] = | ||
658 | { | ||
659 | 0x00, /* 00/00 - l_mixout_outctrl */ | ||
660 | 0x00, /* 01/01 - r_mixout_outctrl */ | ||
661 | 0x88, /* 02/02 - l_cd_inctrl */ | ||
662 | 0x88, /* 03/03 - r_cd_inctrl */ | ||
663 | 0x88, /* 04/04 - l_a1/fm_inctrl */ | ||
664 | 0x88, /* 05/05 - r_a1/fm_inctrl */ | ||
665 | 0x80, /* 06/06 - l_dac_inctrl */ | ||
666 | 0x80, /* 07/07 - r_dac_inctrl */ | ||
667 | 0x00, /* 08/08 - ply_dataform_reg */ | ||
668 | 0x00, /* 09/09 - if_conf */ | ||
669 | 0x00, /* 0a/10 - pin_ctrl */ | ||
670 | 0x00, /* 0b/11 - err_init_reg */ | ||
671 | 0x0a, /* 0c/12 - id_reg */ | ||
672 | 0x00, /* 0d/13 - reserved */ | ||
673 | 0x00, /* 0e/14 - ply_upcount_reg */ | ||
674 | 0x00, /* 0f/15 - ply_lowcount_reg */ | ||
675 | 0x88, /* 10/16 - reserved/l_a1_inctrl */ | ||
676 | 0x88, /* 11/17 - reserved/r_a1_inctrl */ | ||
677 | 0x88, /* 12/18 - l_line_inctrl */ | ||
678 | 0x88, /* 13/19 - r_line_inctrl */ | ||
679 | 0x88, /* 14/20 - l_mic_inctrl */ | ||
680 | 0x88, /* 15/21 - r_mic_inctrl */ | ||
681 | 0x80, /* 16/22 - l_out_outctrl */ | ||
682 | 0x80, /* 17/23 - r_out_outctrl */ | ||
683 | 0x00, /* 18/24 - reserved */ | ||
684 | 0x00, /* 19/25 - reserved */ | ||
685 | 0x00, /* 1a/26 - reserved */ | ||
686 | 0x00, /* 1b/27 - reserved */ | ||
687 | 0x00, /* 1c/28 - cap_dataform_reg */ | ||
688 | 0x00, /* 1d/29 - reserved */ | ||
689 | 0x00, /* 1e/30 - cap_upcount_reg */ | ||
690 | 0x00 /* 1f/31 - cap_lowcount_reg */ | ||
691 | }; | ||
692 | |||
693 | |||
694 | static int snd_opti93x_busy_wait(struct snd_opti93x *chip) | ||
695 | { | ||
696 | int timeout; | ||
697 | |||
698 | for (timeout = 250; timeout-- > 0; udelay(10)) | ||
699 | if (!(inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_INIT)) | ||
700 | return 0; | ||
701 | |||
702 | snd_printk("chip still busy.\n"); | ||
703 | return -EBUSY; | ||
704 | } | ||
705 | |||
706 | static unsigned char snd_opti93x_in(struct snd_opti93x *chip, unsigned char reg) | ||
707 | { | ||
708 | snd_opti93x_busy_wait(chip); | ||
709 | outb(chip->mce_bit | (reg & 0x1f), OPTi93X_PORT(chip, INDEX)); | ||
710 | return inb(OPTi93X_PORT(chip, DATA)); | ||
711 | } | ||
712 | |||
713 | static void snd_opti93x_out(struct snd_opti93x *chip, unsigned char reg, | ||
714 | unsigned char value) | ||
715 | { | ||
716 | snd_opti93x_busy_wait(chip); | ||
717 | outb(chip->mce_bit | (reg & 0x1f), OPTi93X_PORT(chip, INDEX)); | ||
718 | outb(value, OPTi93X_PORT(chip, DATA)); | ||
719 | } | ||
720 | |||
721 | static void snd_opti93x_out_image(struct snd_opti93x *chip, unsigned char reg, | ||
722 | unsigned char value) | ||
723 | { | ||
724 | snd_opti93x_out(chip, reg, chip->image[reg] = value); | ||
725 | } | ||
726 | |||
727 | static void snd_opti93x_out_mask(struct snd_opti93x *chip, unsigned char reg, | ||
728 | unsigned char mask, unsigned char value) | ||
729 | { | ||
730 | snd_opti93x_out_image(chip, reg, | ||
731 | (chip->image[reg] & ~mask) | (value & mask)); | ||
732 | } | ||
733 | |||
734 | |||
735 | static void snd_opti93x_mce_up(struct snd_opti93x *chip) | ||
736 | { | ||
737 | snd_opti93x_busy_wait(chip); | ||
738 | |||
739 | chip->mce_bit = OPTi93X_MCE; | ||
740 | if (!(inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_MCE)) | ||
741 | outb(chip->mce_bit, OPTi93X_PORT(chip, INDEX)); | ||
742 | } | ||
743 | |||
744 | static void snd_opti93x_mce_down(struct snd_opti93x *chip) | ||
745 | { | ||
746 | snd_opti93x_busy_wait(chip); | ||
747 | |||
748 | chip->mce_bit = 0; | ||
749 | if (inb(OPTi93X_PORT(chip, INDEX)) & OPTi93X_MCE) | ||
750 | outb(chip->mce_bit, OPTi93X_PORT(chip, INDEX)); | ||
751 | } | ||
752 | |||
753 | #define snd_opti93x_mute_reg(chip, reg, mute) \ | ||
754 | snd_opti93x_out(chip, reg, mute ? 0x80 : chip->image[reg]); | ||
755 | |||
756 | static void snd_opti93x_mute(struct snd_opti93x *chip, int mute) | ||
757 | { | ||
758 | mute = mute ? 1 : 0; | ||
759 | if (chip->mute == mute) | ||
760 | return; | ||
761 | |||
762 | chip->mute = mute; | ||
763 | |||
764 | snd_opti93x_mute_reg(chip, OPTi93X_CD_LEFT_INPUT, mute); | ||
765 | snd_opti93x_mute_reg(chip, OPTi93X_CD_RIGHT_INPUT, mute); | ||
766 | switch (chip->hardware) { | ||
767 | case OPTi9XX_HW_82C930: | ||
768 | snd_opti93x_mute_reg(chip, OPTi930_AUX_LEFT_INPUT, mute); | ||
769 | snd_opti93x_mute_reg(chip, OPTi930_AUX_RIGHT_INPUT, mute); | ||
770 | break; | ||
771 | case OPTi9XX_HW_82C931: | ||
772 | case OPTi9XX_HW_82C933: | ||
773 | snd_opti93x_mute_reg(chip, OPTi931_FM_LEFT_INPUT, mute); | ||
774 | snd_opti93x_mute_reg(chip, OPTi931_FM_RIGHT_INPUT, mute); | ||
775 | snd_opti93x_mute_reg(chip, OPTi931_AUX_LEFT_INPUT, mute); | ||
776 | snd_opti93x_mute_reg(chip, OPTi931_AUX_RIGHT_INPUT, mute); | ||
777 | } | ||
778 | snd_opti93x_mute_reg(chip, OPTi93X_DAC_LEFT, mute); | ||
779 | snd_opti93x_mute_reg(chip, OPTi93X_DAC_RIGHT, mute); | ||
780 | snd_opti93x_mute_reg(chip, OPTi93X_LINE_LEFT_INPUT, mute); | ||
781 | snd_opti93x_mute_reg(chip, OPTi93X_LINE_RIGHT_INPUT, mute); | ||
782 | snd_opti93x_mute_reg(chip, OPTi93X_MIC_LEFT_INPUT, mute); | ||
783 | snd_opti93x_mute_reg(chip, OPTi93X_MIC_RIGHT_INPUT, mute); | ||
784 | snd_opti93x_mute_reg(chip, OPTi93X_OUT_LEFT, mute); | ||
785 | snd_opti93x_mute_reg(chip, OPTi93X_OUT_RIGHT, mute); | ||
786 | } | ||
787 | |||
788 | |||
789 | static unsigned int snd_opti93x_get_count(unsigned char format, | ||
790 | unsigned int size) | ||
791 | { | ||
792 | switch (format & 0xe0) { | ||
793 | case OPTi93X_LINEAR_16_LIT: | ||
794 | case OPTi93X_LINEAR_16_BIG: | ||
795 | size >>= 1; | ||
796 | break; | ||
797 | case OPTi93X_ADPCM_16: | ||
798 | return size >> 2; | ||
799 | } | ||
800 | return (format & OPTi93X_STEREO) ? (size >> 1) : size; | ||
801 | } | ||
802 | |||
803 | static unsigned int rates[] = { 5512, 6615, 8000, 9600, 11025, 16000, | ||
804 | 18900, 22050, 27428, 32000, 33075, 37800, | ||
805 | 44100, 48000 }; | ||
806 | #define RATES ARRAY_SIZE(rates) | ||
807 | |||
808 | static struct snd_pcm_hw_constraint_list hw_constraints_rates = { | ||
809 | .count = RATES, | ||
810 | .list = rates, | ||
811 | .mask = 0, | ||
812 | }; | ||
813 | |||
814 | static unsigned char bits[] = { 0x01, 0x0f, 0x00, 0x0e, 0x03, 0x02, | ||
815 | 0x05, 0x07, 0x04, 0x06, 0x0d, 0x09, | ||
816 | 0x0b, 0x0c}; | ||
817 | |||
818 | static unsigned char snd_opti93x_get_freq(unsigned int rate) | ||
819 | { | ||
820 | unsigned int i; | ||
821 | |||
822 | for (i = 0; i < RATES; i++) { | ||
823 | if (rate == rates[i]) | ||
824 | return bits[i]; | ||
825 | } | ||
826 | snd_BUG(); | ||
827 | return bits[RATES-1]; | ||
828 | } | ||
829 | |||
830 | static unsigned char snd_opti93x_get_format(struct snd_opti93x *chip, | ||
831 | unsigned int format, int channels) | ||
832 | { | ||
833 | unsigned char retval = OPTi93X_LINEAR_8; | ||
834 | |||
835 | switch (format) { | ||
836 | case SNDRV_PCM_FORMAT_MU_LAW: | ||
837 | retval = OPTi93X_ULAW_8; | ||
838 | break; | ||
839 | case SNDRV_PCM_FORMAT_A_LAW: | ||
840 | retval = OPTi93X_ALAW_8; | ||
841 | break; | ||
842 | case SNDRV_PCM_FORMAT_S16_LE: | ||
843 | retval = OPTi93X_LINEAR_16_LIT; | ||
844 | break; | ||
845 | case SNDRV_PCM_FORMAT_S16_BE: | ||
846 | retval = OPTi93X_LINEAR_16_BIG; | ||
847 | break; | ||
848 | case SNDRV_PCM_FORMAT_IMA_ADPCM: | ||
849 | retval = OPTi93X_ADPCM_16; | ||
850 | } | ||
851 | return (channels > 1) ? (retval | OPTi93X_STEREO) : retval; | ||
852 | } | ||
853 | |||
854 | |||
855 | static void snd_opti93x_playback_format(struct snd_opti93x *chip, unsigned char fmt) | ||
856 | { | ||
857 | unsigned char mask; | ||
858 | |||
859 | snd_opti93x_mute(chip, 1); | ||
860 | |||
861 | snd_opti93x_mce_up(chip); | ||
862 | mask = (chip->mode & OPTi93X_MODE_CAPTURE) ? 0xf0 : 0xff; | ||
863 | snd_opti93x_out_mask(chip, OPTi93X_PLAY_FORMAT, mask, fmt); | ||
864 | snd_opti93x_mce_down(chip); | ||
865 | |||
866 | snd_opti93x_mute(chip, 0); | ||
867 | } | ||
868 | |||
869 | static void snd_opti93x_capture_format(struct snd_opti93x *chip, unsigned char fmt) | ||
870 | { | ||
871 | snd_opti93x_mute(chip, 1); | ||
872 | |||
873 | snd_opti93x_mce_up(chip); | ||
874 | if (!(chip->mode & OPTi93X_MODE_PLAY)) | ||
875 | snd_opti93x_out_mask(chip, OPTi93X_PLAY_FORMAT, 0x0f, fmt); | ||
876 | else | ||
877 | fmt = chip->image[OPTi93X_PLAY_FORMAT] & 0xf0; | ||
878 | snd_opti93x_out_image(chip, OPTi93X_CAPT_FORMAT, fmt); | ||
879 | snd_opti93x_mce_down(chip); | ||
880 | |||
881 | snd_opti93x_mute(chip, 0); | ||
882 | } | ||
883 | |||
884 | |||
885 | static int snd_opti93x_open(struct snd_opti93x *chip, unsigned int mode) | ||
886 | { | ||
887 | unsigned long flags; | ||
888 | |||
889 | spin_lock_irqsave(&chip->lock, flags); | ||
890 | |||
891 | if (chip->mode & mode) { | ||
892 | spin_unlock_irqrestore(&chip->lock, flags); | ||
893 | return -EAGAIN; | ||
894 | } | ||
895 | |||
896 | if (!(chip->mode & OPTi93X_MODE_OPEN)) { | ||
897 | outb(0x00, OPTi93X_PORT(chip, STATUS)); | ||
898 | snd_opti93x_out_mask(chip, OPTi93X_PIN_CTRL, | ||
899 | OPTi93X_IRQ_ENABLE, OPTi93X_IRQ_ENABLE); | ||
900 | chip->mode = mode; | ||
901 | } | ||
902 | else | ||
903 | chip->mode |= mode; | ||
904 | |||
905 | spin_unlock_irqrestore(&chip->lock, flags); | ||
906 | return 0; | ||
907 | } | ||
908 | |||
909 | static void snd_opti93x_close(struct snd_opti93x *chip, unsigned int mode) | ||
910 | { | ||
911 | unsigned long flags; | ||
912 | |||
913 | spin_lock_irqsave(&chip->lock, flags); | ||
914 | |||
915 | chip->mode &= ~mode; | ||
916 | if (chip->mode & OPTi93X_MODE_OPEN) { | ||
917 | spin_unlock_irqrestore(&chip->lock, flags); | ||
918 | return; | ||
919 | } | ||
920 | |||
921 | snd_opti93x_mute(chip, 1); | ||
922 | |||
923 | outb(0, OPTi93X_PORT(chip, STATUS)); | ||
924 | snd_opti93x_out_mask(chip, OPTi93X_PIN_CTRL, OPTi93X_IRQ_ENABLE, | ||
925 | ~OPTi93X_IRQ_ENABLE); | ||
926 | |||
927 | snd_opti93x_mce_up(chip); | ||
928 | snd_opti93x_out_image(chip, OPTi93X_IFACE_CONF, 0x00); | ||
929 | snd_opti93x_mce_down(chip); | ||
930 | chip->mode = 0; | ||
931 | |||
932 | snd_opti93x_mute(chip, 0); | ||
933 | spin_unlock_irqrestore(&chip->lock, flags); | ||
934 | } | ||
935 | |||
936 | static int snd_opti93x_trigger(struct snd_pcm_substream *substream, | ||
937 | unsigned char what, int cmd) | ||
938 | { | ||
939 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
940 | |||
941 | switch (cmd) { | ||
942 | case SNDRV_PCM_TRIGGER_START: | ||
943 | case SNDRV_PCM_TRIGGER_STOP: | ||
944 | { | ||
945 | unsigned int what = 0; | ||
946 | struct snd_pcm_substream *s; | ||
947 | snd_pcm_group_for_each_entry(s, substream) { | ||
948 | if (s == chip->playback_substream) { | ||
949 | what |= OPTi93X_PLAYBACK_ENABLE; | ||
950 | snd_pcm_trigger_done(s, substream); | ||
951 | } else if (s == chip->capture_substream) { | ||
952 | what |= OPTi93X_CAPTURE_ENABLE; | ||
953 | snd_pcm_trigger_done(s, substream); | ||
954 | } | ||
955 | } | ||
956 | spin_lock(&chip->lock); | ||
957 | if (cmd == SNDRV_PCM_TRIGGER_START) { | ||
958 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, what, what); | ||
959 | if (what & OPTi93X_CAPTURE_ENABLE) | ||
960 | udelay(50); | ||
961 | } else | ||
962 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, what, 0x00); | ||
963 | spin_unlock(&chip->lock); | ||
964 | break; | ||
965 | } | ||
966 | default: | ||
967 | return -EINVAL; | ||
968 | } | ||
969 | return 0; | ||
970 | } | ||
971 | |||
972 | static int snd_opti93x_playback_trigger(struct snd_pcm_substream *substream, int cmd) | ||
973 | { | ||
974 | return snd_opti93x_trigger(substream, | ||
975 | OPTi93X_PLAYBACK_ENABLE, cmd); | ||
976 | } | ||
977 | |||
978 | static int snd_opti93x_capture_trigger(struct snd_pcm_substream *substream, int cmd) | ||
979 | { | ||
980 | return snd_opti93x_trigger(substream, | ||
981 | OPTi93X_CAPTURE_ENABLE, cmd); | ||
982 | } | ||
983 | |||
984 | static int snd_opti93x_hw_params(struct snd_pcm_substream *substream, | ||
985 | struct snd_pcm_hw_params *hw_params) | ||
986 | { | ||
987 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | ||
988 | } | ||
989 | |||
990 | |||
991 | static int snd_opti93x_hw_free(struct snd_pcm_substream *substream) | ||
992 | { | ||
993 | snd_pcm_lib_free_pages(substream); | ||
994 | return 0; | ||
995 | } | ||
996 | |||
997 | |||
998 | static int snd_opti93x_playback_prepare(struct snd_pcm_substream *substream) | ||
999 | { | ||
1000 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1001 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1002 | unsigned long flags; | ||
1003 | unsigned char format; | ||
1004 | unsigned int count = snd_pcm_lib_period_bytes(substream); | ||
1005 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | ||
1006 | |||
1007 | spin_lock_irqsave(&chip->lock, flags); | ||
1008 | |||
1009 | chip->p_dma_size = size; | ||
1010 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, | ||
1011 | OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO, | ||
1012 | ~(OPTi93X_PLAYBACK_ENABLE | OPTi93X_PLAYBACK_PIO)); | ||
1013 | |||
1014 | snd_dma_program(chip->dma1, runtime->dma_addr, size, | ||
1015 | DMA_MODE_WRITE | DMA_AUTOINIT); | ||
1016 | |||
1017 | format = snd_opti93x_get_freq(runtime->rate); | ||
1018 | format |= snd_opti93x_get_format(chip, runtime->format, | ||
1019 | runtime->channels); | ||
1020 | snd_opti93x_playback_format(chip, format); | ||
1021 | format = chip->image[OPTi93X_PLAY_FORMAT]; | ||
1022 | |||
1023 | count = snd_opti93x_get_count(format, count) - 1; | ||
1024 | snd_opti93x_out_image(chip, OPTi93X_PLAY_LWR_CNT, count); | ||
1025 | snd_opti93x_out_image(chip, OPTi93X_PLAY_UPR_CNT, count >> 8); | ||
1026 | |||
1027 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1028 | return 0; | ||
1029 | } | ||
1030 | |||
1031 | static int snd_opti93x_capture_prepare(struct snd_pcm_substream *substream) | ||
1032 | { | ||
1033 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1034 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1035 | unsigned long flags; | ||
1036 | unsigned char format; | ||
1037 | unsigned int count = snd_pcm_lib_period_bytes(substream); | ||
1038 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | ||
1039 | |||
1040 | spin_lock_irqsave(&chip->lock, flags); | ||
1041 | |||
1042 | chip->c_dma_size = size; | ||
1043 | snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, | ||
1044 | OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 0); | ||
1045 | |||
1046 | snd_dma_program(chip->dma2, runtime->dma_addr, size, | ||
1047 | DMA_MODE_READ | DMA_AUTOINIT); | ||
1048 | |||
1049 | format = snd_opti93x_get_freq(runtime->rate); | ||
1050 | format |= snd_opti93x_get_format(chip, runtime->format, | ||
1051 | runtime->channels); | ||
1052 | snd_opti93x_capture_format(chip, format); | ||
1053 | format = chip->image[OPTi93X_CAPT_FORMAT]; | ||
1054 | |||
1055 | count = snd_opti93x_get_count(format, count) - 1; | ||
1056 | snd_opti93x_out_image(chip, OPTi93X_CAPT_LWR_CNT, count); | ||
1057 | snd_opti93x_out_image(chip, OPTi93X_CAPT_UPR_CNT, count >> 8); | ||
1058 | |||
1059 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1060 | return 0; | ||
1061 | } | ||
1062 | |||
1063 | static snd_pcm_uframes_t snd_opti93x_playback_pointer(struct snd_pcm_substream *substream) | ||
1064 | { | ||
1065 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1066 | size_t ptr; | ||
1067 | |||
1068 | if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_PLAYBACK_ENABLE)) | ||
1069 | return 0; | ||
1070 | |||
1071 | ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size); | ||
1072 | return bytes_to_frames(substream->runtime, ptr); | ||
1073 | } | ||
1074 | |||
1075 | static snd_pcm_uframes_t snd_opti93x_capture_pointer(struct snd_pcm_substream *substream) | ||
1076 | { | ||
1077 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1078 | size_t ptr; | ||
1079 | |||
1080 | if (!(chip->image[OPTi93X_IFACE_CONF] & OPTi93X_CAPTURE_ENABLE)) | ||
1081 | return 0; | ||
1082 | |||
1083 | ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size); | ||
1084 | return bytes_to_frames(substream->runtime, ptr); | ||
1085 | } | ||
1086 | |||
1087 | |||
1088 | static void snd_opti93x_overrange(struct snd_opti93x *chip) | ||
1089 | { | ||
1090 | unsigned long flags; | ||
1091 | |||
1092 | spin_lock_irqsave(&chip->lock, flags); | ||
1093 | |||
1094 | if (snd_opti93x_in(chip, OPTi93X_ERR_INIT) & (0x08 | 0x02)) | ||
1095 | chip->capture_substream->runtime->overrange++; | ||
1096 | |||
1097 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1098 | } | ||
1099 | |||
1100 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) | 559 | static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id) |
1101 | { | 560 | { |
1102 | struct snd_opti93x *codec = dev_id; | 561 | struct snd_cs4231 *codec = dev_id; |
562 | struct snd_opti9xx *chip = codec->card->private_data; | ||
1103 | unsigned char status; | 563 | unsigned char status; |
1104 | 564 | ||
1105 | status = snd_opti9xx_read(codec->chip, OPTi9XX_MC_REG(11)); | 565 | status = snd_opti9xx_read(chip, OPTi9XX_MC_REG(11)); |
1106 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) | 566 | if ((status & OPTi93X_IRQ_PLAYBACK) && codec->playback_substream) |
1107 | snd_pcm_period_elapsed(codec->playback_substream); | 567 | snd_pcm_period_elapsed(codec->playback_substream); |
1108 | if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { | 568 | if ((status & OPTi93X_IRQ_CAPTURE) && codec->capture_substream) { |
1109 | snd_opti93x_overrange(codec); | 569 | snd_cs4231_overrange(codec); |
1110 | snd_pcm_period_elapsed(codec->capture_substream); | 570 | snd_pcm_period_elapsed(codec->capture_substream); |
1111 | } | 571 | } |
1112 | outb(0x00, OPTi93X_PORT(codec, STATUS)); | 572 | outb(0x00, OPTi93X_PORT(codec, STATUS)); |
1113 | return IRQ_HANDLED; | 573 | return IRQ_HANDLED; |
1114 | } | 574 | } |
1115 | 575 | ||
1116 | |||
1117 | static struct snd_pcm_hardware snd_opti93x_playback = { | ||
1118 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | ||
1119 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), | ||
1120 | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM | | ||
1121 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE), | ||
1122 | .rates = SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_8000_48000, | ||
1123 | .rate_min = 5512, | ||
1124 | .rate_max = 48000, | ||
1125 | .channels_min = 1, | ||
1126 | .channels_max = 2, | ||
1127 | .buffer_bytes_max = (128*1024), | ||
1128 | .period_bytes_min = 64, | ||
1129 | .period_bytes_max = (128*1024), | ||
1130 | .periods_min = 1, | ||
1131 | .periods_max = 1024, | ||
1132 | .fifo_size = 0, | ||
1133 | }; | ||
1134 | |||
1135 | static struct snd_pcm_hardware snd_opti93x_capture = { | ||
1136 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | ||
1137 | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START), | ||
1138 | .formats = (SNDRV_PCM_FMTBIT_MU_LAW | SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_IMA_ADPCM | | ||
1139 | SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE), | ||
1140 | .rates = SNDRV_PCM_RATE_8000_48000, | ||
1141 | .rate_min = 5512, | ||
1142 | .rate_max = 48000, | ||
1143 | .channels_min = 1, | ||
1144 | .channels_max = 2, | ||
1145 | .buffer_bytes_max = (128*1024), | ||
1146 | .period_bytes_min = 64, | ||
1147 | .period_bytes_max = (128*1024), | ||
1148 | .periods_min = 1, | ||
1149 | .periods_max = 1024, | ||
1150 | .fifo_size = 0, | ||
1151 | }; | ||
1152 | |||
1153 | static int snd_opti93x_playback_open(struct snd_pcm_substream *substream) | ||
1154 | { | ||
1155 | int error; | ||
1156 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1157 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1158 | |||
1159 | if ((error = snd_opti93x_open(chip, OPTi93X_MODE_PLAY)) < 0) | ||
1160 | return error; | ||
1161 | snd_pcm_set_sync(substream); | ||
1162 | chip->playback_substream = substream; | ||
1163 | runtime->hw = snd_opti93x_playback; | ||
1164 | snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); | ||
1165 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); | ||
1166 | return error; | ||
1167 | } | ||
1168 | |||
1169 | static int snd_opti93x_capture_open(struct snd_pcm_substream *substream) | ||
1170 | { | ||
1171 | int error; | ||
1172 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1173 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
1174 | |||
1175 | if ((error = snd_opti93x_open(chip, OPTi93X_MODE_CAPTURE)) < 0) | ||
1176 | return error; | ||
1177 | runtime->hw = snd_opti93x_capture; | ||
1178 | snd_pcm_set_sync(substream); | ||
1179 | chip->capture_substream = substream; | ||
1180 | snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); | ||
1181 | snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); | ||
1182 | return error; | ||
1183 | } | ||
1184 | |||
1185 | static int snd_opti93x_playback_close(struct snd_pcm_substream *substream) | ||
1186 | { | ||
1187 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1188 | |||
1189 | chip->playback_substream = NULL; | ||
1190 | snd_opti93x_close(chip, OPTi93X_MODE_PLAY); | ||
1191 | return 0; | ||
1192 | } | ||
1193 | |||
1194 | static int snd_opti93x_capture_close(struct snd_pcm_substream *substream) | ||
1195 | { | ||
1196 | struct snd_opti93x *chip = snd_pcm_substream_chip(substream); | ||
1197 | |||
1198 | chip->capture_substream = NULL; | ||
1199 | snd_opti93x_close(chip, OPTi93X_MODE_CAPTURE); | ||
1200 | return 0; | ||
1201 | } | ||
1202 | |||
1203 | |||
1204 | static void snd_opti93x_init(struct snd_opti93x *chip) | ||
1205 | { | ||
1206 | unsigned long flags; | ||
1207 | int i; | ||
1208 | |||
1209 | spin_lock_irqsave(&chip->lock, flags); | ||
1210 | snd_opti93x_mce_up(chip); | ||
1211 | |||
1212 | for (i = 0; i < 32; i++) | ||
1213 | snd_opti93x_out_image(chip, i, snd_opti93x_default_image[i]); | ||
1214 | |||
1215 | snd_opti93x_mce_down(chip); | ||
1216 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1217 | } | ||
1218 | |||
1219 | static int snd_opti93x_probe(struct snd_opti93x *chip) | ||
1220 | { | ||
1221 | unsigned long flags; | ||
1222 | unsigned char val; | ||
1223 | |||
1224 | spin_lock_irqsave(&chip->lock, flags); | ||
1225 | val = snd_opti93x_in(chip, OPTi93X_ID) & 0x0f; | ||
1226 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1227 | |||
1228 | return (val == 0x0a) ? 0 : -ENODEV; | ||
1229 | } | ||
1230 | |||
1231 | static int snd_opti93x_free(struct snd_opti93x *chip) | ||
1232 | { | ||
1233 | release_and_free_resource(chip->res_port); | ||
1234 | if (chip->dma1 >= 0) { | ||
1235 | disable_dma(chip->dma1); | ||
1236 | free_dma(chip->dma1); | ||
1237 | } | ||
1238 | if (chip->dma2 >= 0) { | ||
1239 | disable_dma(chip->dma2); | ||
1240 | free_dma(chip->dma2); | ||
1241 | } | ||
1242 | if (chip->irq >= 0) { | ||
1243 | free_irq(chip->irq, chip); | ||
1244 | } | ||
1245 | kfree(chip); | ||
1246 | return 0; | ||
1247 | } | ||
1248 | |||
1249 | static int snd_opti93x_dev_free(struct snd_device *device) | ||
1250 | { | ||
1251 | struct snd_opti93x *chip = device->device_data; | ||
1252 | return snd_opti93x_free(chip); | ||
1253 | } | ||
1254 | |||
1255 | static const char *snd_opti93x_chip_id(struct snd_opti93x *codec) | ||
1256 | { | ||
1257 | switch (codec->hardware) { | ||
1258 | case OPTi9XX_HW_82C930: return "82C930"; | ||
1259 | case OPTi9XX_HW_82C931: return "82C931"; | ||
1260 | case OPTi9XX_HW_82C933: return "82C933"; | ||
1261 | default: return "???"; | ||
1262 | } | ||
1263 | } | ||
1264 | |||
1265 | static int snd_opti93x_create(struct snd_card *card, struct snd_opti9xx *chip, | ||
1266 | int dma1, int dma2, | ||
1267 | struct snd_opti93x **rcodec) | ||
1268 | { | ||
1269 | static struct snd_device_ops ops = { | ||
1270 | .dev_free = snd_opti93x_dev_free, | ||
1271 | }; | ||
1272 | int error; | ||
1273 | struct snd_opti93x *codec; | ||
1274 | |||
1275 | *rcodec = NULL; | ||
1276 | codec = kzalloc(sizeof(*codec), GFP_KERNEL); | ||
1277 | if (codec == NULL) | ||
1278 | return -ENOMEM; | ||
1279 | codec->irq = -1; | ||
1280 | codec->dma1 = -1; | ||
1281 | codec->dma2 = -1; | ||
1282 | |||
1283 | if ((codec->res_port = request_region(chip->wss_base + 4, 4, "OPTI93x CODEC")) == NULL) { | ||
1284 | snd_printk(KERN_ERR "opti9xx: can't grab port 0x%lx\n", chip->wss_base + 4); | ||
1285 | snd_opti93x_free(codec); | ||
1286 | return -EBUSY; | ||
1287 | } | ||
1288 | if (request_dma(dma1, "OPTI93x - 1")) { | ||
1289 | snd_printk(KERN_ERR "opti9xx: can't grab DMA1 %d\n", dma1); | ||
1290 | snd_opti93x_free(codec); | ||
1291 | return -EBUSY; | ||
1292 | } | ||
1293 | codec->dma1 = chip->dma1; | ||
1294 | if (request_dma(dma2, "OPTI93x - 2")) { | ||
1295 | snd_printk(KERN_ERR "opti9xx: can't grab DMA2 %d\n", dma2); | ||
1296 | snd_opti93x_free(codec); | ||
1297 | return -EBUSY; | ||
1298 | } | ||
1299 | codec->dma2 = chip->dma2; | ||
1300 | |||
1301 | if (request_irq(chip->irq, snd_opti93x_interrupt, IRQF_DISABLED, DEV_NAME" - WSS", codec)) { | ||
1302 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); | ||
1303 | snd_opti93x_free(codec); | ||
1304 | return -EBUSY; | ||
1305 | } | ||
1306 | |||
1307 | codec->card = card; | ||
1308 | codec->port = chip->wss_base + 4; | ||
1309 | codec->irq = chip->irq; | ||
1310 | |||
1311 | spin_lock_init(&codec->lock); | ||
1312 | codec->hardware = chip->hardware; | ||
1313 | codec->chip = chip; | ||
1314 | |||
1315 | if ((error = snd_opti93x_probe(codec))) { | ||
1316 | snd_opti93x_free(codec); | ||
1317 | return error; | ||
1318 | } | ||
1319 | |||
1320 | snd_opti93x_init(codec); | ||
1321 | |||
1322 | /* Register device */ | ||
1323 | if ((error = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops)) < 0) { | ||
1324 | snd_opti93x_free(codec); | ||
1325 | return error; | ||
1326 | } | ||
1327 | |||
1328 | *rcodec = codec; | ||
1329 | return 0; | ||
1330 | } | ||
1331 | |||
1332 | static struct snd_pcm_ops snd_opti93x_playback_ops = { | ||
1333 | .open = snd_opti93x_playback_open, | ||
1334 | .close = snd_opti93x_playback_close, | ||
1335 | .ioctl = snd_pcm_lib_ioctl, | ||
1336 | .hw_params = snd_opti93x_hw_params, | ||
1337 | .hw_free = snd_opti93x_hw_free, | ||
1338 | .prepare = snd_opti93x_playback_prepare, | ||
1339 | .trigger = snd_opti93x_playback_trigger, | ||
1340 | .pointer = snd_opti93x_playback_pointer, | ||
1341 | }; | ||
1342 | |||
1343 | static struct snd_pcm_ops snd_opti93x_capture_ops = { | ||
1344 | .open = snd_opti93x_capture_open, | ||
1345 | .close = snd_opti93x_capture_close, | ||
1346 | .ioctl = snd_pcm_lib_ioctl, | ||
1347 | .hw_params = snd_opti93x_hw_params, | ||
1348 | .hw_free = snd_opti93x_hw_free, | ||
1349 | .prepare = snd_opti93x_capture_prepare, | ||
1350 | .trigger = snd_opti93x_capture_trigger, | ||
1351 | .pointer = snd_opti93x_capture_pointer, | ||
1352 | }; | ||
1353 | |||
1354 | static int snd_opti93x_pcm(struct snd_opti93x *codec, int device, struct snd_pcm **rpcm) | ||
1355 | { | ||
1356 | int error; | ||
1357 | struct snd_pcm *pcm; | ||
1358 | |||
1359 | if ((error = snd_pcm_new(codec->card, "OPTi 82C93X", device, 1, 1, &pcm)) < 0) | ||
1360 | return error; | ||
1361 | |||
1362 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_opti93x_playback_ops); | ||
1363 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_opti93x_capture_ops); | ||
1364 | |||
1365 | pcm->private_data = codec; | ||
1366 | pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; | ||
1367 | |||
1368 | strcpy(pcm->name, snd_opti93x_chip_id(codec)); | ||
1369 | |||
1370 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | ||
1371 | snd_dma_isa_data(), | ||
1372 | 64*1024, codec->dma1 > 3 || codec->dma2 > 3 ? 128*1024 : 64*1024); | ||
1373 | |||
1374 | codec->pcm = pcm; | ||
1375 | if (rpcm) | ||
1376 | *rpcm = pcm; | ||
1377 | return 0; | ||
1378 | } | ||
1379 | |||
1380 | /* | ||
1381 | * MIXER part | ||
1382 | */ | ||
1383 | |||
1384 | static int snd_opti93x_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
1385 | { | ||
1386 | static char *texts[4] = { | ||
1387 | "Line1", "Aux", "Mic", "Mix" | ||
1388 | }; | ||
1389 | |||
1390 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
1391 | uinfo->count = 2; | ||
1392 | uinfo->value.enumerated.items = 4; | ||
1393 | if (uinfo->value.enumerated.item > 3) | ||
1394 | uinfo->value.enumerated.item = 3; | ||
1395 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | ||
1396 | return 0; | ||
1397 | } | ||
1398 | |||
1399 | static int snd_opti93x_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1400 | { | ||
1401 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1402 | unsigned long flags; | ||
1403 | |||
1404 | spin_lock_irqsave(&chip->lock, flags); | ||
1405 | ucontrol->value.enumerated.item[0] = (chip->image[OPTi93X_MIXOUT_LEFT] & OPTi93X_MIXOUT_MIXER) >> 6; | ||
1406 | ucontrol->value.enumerated.item[1] = (chip->image[OPTi93X_MIXOUT_RIGHT] & OPTi93X_MIXOUT_MIXER) >> 6; | ||
1407 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1408 | return 0; | ||
1409 | } | ||
1410 | |||
1411 | static int snd_opti93x_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1412 | { | ||
1413 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1414 | unsigned long flags; | ||
1415 | unsigned short left, right; | ||
1416 | int change; | ||
1417 | |||
1418 | if (ucontrol->value.enumerated.item[0] > 3 || | ||
1419 | ucontrol->value.enumerated.item[1] > 3) | ||
1420 | return -EINVAL; | ||
1421 | left = ucontrol->value.enumerated.item[0] << 6; | ||
1422 | right = ucontrol->value.enumerated.item[1] << 6; | ||
1423 | spin_lock_irqsave(&chip->lock, flags); | ||
1424 | left = (chip->image[OPTi93X_MIXOUT_LEFT] & ~OPTi93X_MIXOUT_MIXER) | left; | ||
1425 | right = (chip->image[OPTi93X_MIXOUT_RIGHT] & ~OPTi93X_MIXOUT_MIXER) | right; | ||
1426 | change = left != chip->image[OPTi93X_MIXOUT_LEFT] || | ||
1427 | right != chip->image[OPTi93X_MIXOUT_RIGHT]; | ||
1428 | snd_opti93x_out_image(chip, OPTi93X_MIXOUT_LEFT, left); | ||
1429 | snd_opti93x_out_image(chip, OPTi93X_MIXOUT_RIGHT, right); | ||
1430 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1431 | return change; | ||
1432 | } | ||
1433 | |||
1434 | #if 0 | ||
1435 | |||
1436 | #define OPTi93X_SINGLE(xname, xindex, reg, shift, mask, invert) \ | ||
1437 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | ||
1438 | .info = snd_opti93x_info_single, \ | ||
1439 | .get = snd_opti93x_get_single, .put = snd_opti93x_put_single, \ | ||
1440 | .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } | ||
1441 | |||
1442 | static int snd_opti93x_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
1443 | { | ||
1444 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
1445 | |||
1446 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
1447 | uinfo->count = 1; | ||
1448 | uinfo->value.integer.min = 0; | ||
1449 | uinfo->value.integer.max = mask; | ||
1450 | return 0; | ||
1451 | } | ||
1452 | |||
1453 | static int snd_opti93x_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1454 | { | ||
1455 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1456 | unsigned long flags; | ||
1457 | int reg = kcontrol->private_value & 0xff; | ||
1458 | int shift = (kcontrol->private_value >> 8) & 0xff; | ||
1459 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
1460 | int invert = (kcontrol->private_value >> 24) & 0xff; | ||
1461 | |||
1462 | spin_lock_irqsave(&chip->lock, flags); | ||
1463 | ucontrol->value.integer.value[0] = (chip->image[reg] >> shift) & mask; | ||
1464 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1465 | if (invert) | ||
1466 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | ||
1467 | return 0; | ||
1468 | } | ||
1469 | |||
1470 | static int snd_opti93x_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1471 | { | ||
1472 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1473 | unsigned long flags; | ||
1474 | int reg = kcontrol->private_value & 0xff; | ||
1475 | int shift = (kcontrol->private_value >> 8) & 0xff; | ||
1476 | int mask = (kcontrol->private_value >> 16) & 0xff; | ||
1477 | int invert = (kcontrol->private_value >> 24) & 0xff; | ||
1478 | int change; | ||
1479 | unsigned short val; | ||
1480 | |||
1481 | val = (ucontrol->value.integer.value[0] & mask); | ||
1482 | if (invert) | ||
1483 | val = mask - val; | ||
1484 | val <<= shift; | ||
1485 | spin_lock_irqsave(&chip->lock, flags); | ||
1486 | val = (chip->image[reg] & ~(mask << shift)) | val; | ||
1487 | change = val != chip->image[reg]; | ||
1488 | snd_opti93x_out(chip, reg, val); | ||
1489 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1490 | return change; | ||
1491 | } | ||
1492 | |||
1493 | #endif /* single */ | ||
1494 | |||
1495 | #define OPTi93X_DOUBLE(xname, xindex, left_reg, right_reg, shift_left, shift_right, mask, invert) \ | ||
1496 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ | ||
1497 | .info = snd_opti93x_info_double, \ | ||
1498 | .get = snd_opti93x_get_double, .put = snd_opti93x_put_double, \ | ||
1499 | .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } | ||
1500 | |||
1501 | #define OPTi93X_DOUBLE_INVERT_INVERT(xctl) \ | ||
1502 | do { xctl.private_value ^= 22; } while (0) | ||
1503 | #define OPTi93X_DOUBLE_CHANGE_REGS(xctl, left_reg, right_reg) \ | ||
1504 | do { xctl.private_value &= ~0x0000ffff; \ | ||
1505 | xctl.private_value |= left_reg | (right_reg << 8); } while (0) | ||
1506 | |||
1507 | static int snd_opti93x_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
1508 | { | ||
1509 | int mask = (kcontrol->private_value >> 24) & 0xff; | ||
1510 | |||
1511 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | ||
1512 | uinfo->count = 2; | ||
1513 | uinfo->value.integer.min = 0; | ||
1514 | uinfo->value.integer.max = mask; | ||
1515 | return 0; | ||
1516 | } | ||
1517 | |||
1518 | static int snd_opti93x_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1519 | { | ||
1520 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1521 | unsigned long flags; | ||
1522 | int left_reg = kcontrol->private_value & 0xff; | ||
1523 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | ||
1524 | int shift_left = (kcontrol->private_value >> 16) & 0x07; | ||
1525 | int shift_right = (kcontrol->private_value >> 19) & 0x07; | ||
1526 | int mask = (kcontrol->private_value >> 24) & 0xff; | ||
1527 | int invert = (kcontrol->private_value >> 22) & 1; | ||
1528 | |||
1529 | spin_lock_irqsave(&chip->lock, flags); | ||
1530 | ucontrol->value.integer.value[0] = (chip->image[left_reg] >> shift_left) & mask; | ||
1531 | ucontrol->value.integer.value[1] = (chip->image[right_reg] >> shift_right) & mask; | ||
1532 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1533 | if (invert) { | ||
1534 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | ||
1535 | ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; | ||
1536 | } | ||
1537 | return 0; | ||
1538 | } | ||
1539 | |||
1540 | static int snd_opti93x_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
1541 | { | ||
1542 | struct snd_opti93x *chip = snd_kcontrol_chip(kcontrol); | ||
1543 | unsigned long flags; | ||
1544 | int left_reg = kcontrol->private_value & 0xff; | ||
1545 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | ||
1546 | int shift_left = (kcontrol->private_value >> 16) & 0x07; | ||
1547 | int shift_right = (kcontrol->private_value >> 19) & 0x07; | ||
1548 | int mask = (kcontrol->private_value >> 24) & 0xff; | ||
1549 | int invert = (kcontrol->private_value >> 22) & 1; | ||
1550 | int change; | ||
1551 | unsigned short val1, val2; | ||
1552 | |||
1553 | val1 = ucontrol->value.integer.value[0] & mask; | ||
1554 | val2 = ucontrol->value.integer.value[1] & mask; | ||
1555 | if (invert) { | ||
1556 | val1 = mask - val1; | ||
1557 | val2 = mask - val2; | ||
1558 | } | ||
1559 | val1 <<= shift_left; | ||
1560 | val2 <<= shift_right; | ||
1561 | spin_lock_irqsave(&chip->lock, flags); | ||
1562 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; | ||
1563 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; | ||
1564 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; | ||
1565 | snd_opti93x_out_image(chip, left_reg, val1); | ||
1566 | snd_opti93x_out_image(chip, right_reg, val2); | ||
1567 | spin_unlock_irqrestore(&chip->lock, flags); | ||
1568 | return change; | ||
1569 | } | ||
1570 | |||
1571 | static struct snd_kcontrol_new snd_opti93x_controls[] __devinitdata = { | ||
1572 | OPTi93X_DOUBLE("Master Playback Switch", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | ||
1573 | OPTi93X_DOUBLE("Master Playback Volume", 0, OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | ||
1574 | OPTi93X_DOUBLE("PCM Playback Switch", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 7, 7, 1, 1), | ||
1575 | OPTi93X_DOUBLE("PCM Playback Volume", 0, OPTi93X_DAC_LEFT, OPTi93X_DAC_RIGHT, 0, 0, 31, 1), | ||
1576 | OPTi93X_DOUBLE("FM Playback Switch", 0, OPTi931_FM_LEFT_INPUT, OPTi931_FM_RIGHT_INPUT, 7, 7, 1, 1), | ||
1577 | OPTi93X_DOUBLE("FM Playback Volume", 0, OPTi931_FM_LEFT_INPUT, OPTi931_FM_RIGHT_INPUT, 1, 1, 15, 1), | ||
1578 | OPTi93X_DOUBLE("Line Playback Switch", 0, OPTi93X_LINE_LEFT_INPUT, OPTi93X_LINE_RIGHT_INPUT, 7, 7, 1, 1), | ||
1579 | OPTi93X_DOUBLE("Line Playback Volume", 0, OPTi93X_LINE_LEFT_INPUT, OPTi93X_LINE_RIGHT_INPUT, 1, 1, 15, 1), | ||
1580 | OPTi93X_DOUBLE("Mic Playback Switch", 0, OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), | ||
1581 | OPTi93X_DOUBLE("Mic Playback Volume", 0, OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), | ||
1582 | OPTi93X_DOUBLE("Mic Boost", 0, OPTi93X_MIXOUT_LEFT, OPTi93X_MIXOUT_RIGHT, 5, 5, 1, 1), | ||
1583 | OPTi93X_DOUBLE("CD Playback Switch", 0, OPTi93X_CD_LEFT_INPUT, OPTi93X_CD_RIGHT_INPUT, 7, 7, 1, 1), | ||
1584 | OPTi93X_DOUBLE("CD Playback Volume", 0, OPTi93X_CD_LEFT_INPUT, OPTi93X_CD_RIGHT_INPUT, 1, 1, 15, 1), | ||
1585 | OPTi93X_DOUBLE("Aux Playback Switch", 0, OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), | ||
1586 | OPTi93X_DOUBLE("Aux Playback Volume", 0, OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), | ||
1587 | OPTi93X_DOUBLE("Capture Volume", 0, OPTi93X_MIXOUT_LEFT, OPTi93X_MIXOUT_RIGHT, 0, 0, 15, 0), | ||
1588 | { | ||
1589 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1590 | .name = "Capture Source", | ||
1591 | .info = snd_opti93x_info_mux, | ||
1592 | .get = snd_opti93x_get_mux, | ||
1593 | .put = snd_opti93x_put_mux, | ||
1594 | } | ||
1595 | }; | ||
1596 | |||
1597 | static int __devinit snd_opti93x_mixer(struct snd_opti93x *chip) | ||
1598 | { | ||
1599 | struct snd_card *card; | ||
1600 | struct snd_kcontrol_new knew; | ||
1601 | int err; | ||
1602 | unsigned int idx; | ||
1603 | |||
1604 | snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); | ||
1605 | |||
1606 | card = chip->card; | ||
1607 | |||
1608 | strcpy(card->mixername, snd_opti93x_chip_id(chip)); | ||
1609 | |||
1610 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { | ||
1611 | knew = snd_opti93x_controls[idx]; | ||
1612 | if (chip->hardware == OPTi9XX_HW_82C930) { | ||
1613 | if (strstr(knew.name, "FM")) /* skip FM controls */ | ||
1614 | continue; | ||
1615 | else if (strcmp(knew.name, "Mic Playback Volume")) | ||
1616 | OPTi93X_DOUBLE_INVERT_INVERT(knew); | ||
1617 | else if (strstr(knew.name, "Aux")) | ||
1618 | OPTi93X_DOUBLE_CHANGE_REGS(knew, OPTi930_AUX_LEFT_INPUT, OPTi930_AUX_RIGHT_INPUT); | ||
1619 | else if (strcmp(knew.name, "PCM Playback Volume")) | ||
1620 | OPTi93X_DOUBLE_INVERT_INVERT(knew); | ||
1621 | else if (strcmp(knew.name, "Master Playback Volume")) | ||
1622 | OPTi93X_DOUBLE_INVERT_INVERT(knew); | ||
1623 | } | ||
1624 | if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_opti93x_controls[idx], chip))) < 0) | ||
1625 | return err; | ||
1626 | } | ||
1627 | return 0; | ||
1628 | } | ||
1629 | |||
1630 | #endif /* OPTi93X */ | 576 | #endif /* OPTi93X */ |
1631 | 577 | ||
1632 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, | 578 | static int __devinit snd_card_opti9xx_detect(struct snd_card *card, |
@@ -1739,8 +685,16 @@ static void snd_card_opti9xx_free(struct snd_card *card) | |||
1739 | { | 685 | { |
1740 | struct snd_opti9xx *chip = card->private_data; | 686 | struct snd_opti9xx *chip = card->private_data; |
1741 | 687 | ||
1742 | if (chip) | 688 | if (chip) { |
689 | #ifdef OPTi93X | ||
690 | struct snd_cs4231 *codec = chip->codec; | ||
691 | if (codec->irq > 0) { | ||
692 | disable_irq(codec->irq); | ||
693 | free_irq(codec->irq, codec); | ||
694 | } | ||
695 | #endif | ||
1743 | release_and_free_resource(chip->res_mc_base); | 696 | release_and_free_resource(chip->res_mc_base); |
697 | } | ||
1744 | } | 698 | } |
1745 | 699 | ||
1746 | static int __devinit snd_opti9xx_probe(struct snd_card *card) | 700 | static int __devinit snd_opti9xx_probe(struct snd_card *card) |
@@ -1748,11 +702,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
1748 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; | 702 | static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
1749 | int error; | 703 | int error; |
1750 | struct snd_opti9xx *chip = card->private_data; | 704 | struct snd_opti9xx *chip = card->private_data; |
1751 | #if defined(OPTi93X) | 705 | #if defined(CS4231) || defined(OPTi93X) |
1752 | struct snd_opti93x *codec; | ||
1753 | #elif defined(CS4231) | ||
1754 | struct snd_cs4231 *codec; | 706 | struct snd_cs4231 *codec; |
707 | #ifdef CS4231 | ||
1755 | struct snd_timer *timer; | 708 | struct snd_timer *timer; |
709 | #endif | ||
1756 | #else | 710 | #else |
1757 | struct snd_ad1848 *codec; | 711 | struct snd_ad1848 *codec; |
1758 | #endif | 712 | #endif |
@@ -1784,26 +738,34 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card) | |||
1784 | if ((error = snd_opti9xx_configure(chip))) | 738 | if ((error = snd_opti9xx_configure(chip))) |
1785 | return error; | 739 | return error; |
1786 | 740 | ||
1787 | #if defined(OPTi93X) | 741 | #if defined(CS4231) || defined(OPTi93X) |
1788 | if ((error = snd_opti93x_create(card, chip, chip->dma1, chip->dma2, &codec))) | ||
1789 | return error; | ||
1790 | if ((error = snd_opti93x_pcm(codec, 0, &pcm)) < 0) | ||
1791 | return error; | ||
1792 | if ((error = snd_opti93x_mixer(codec)) < 0) | ||
1793 | return error; | ||
1794 | #elif defined(CS4231) | ||
1795 | if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, | 742 | if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, |
1796 | chip->irq, chip->dma1, chip->dma2, | 743 | chip->irq, chip->dma1, chip->dma2, |
1797 | CS4231_HW_DETECT, | 744 | #ifdef CS4231 |
1798 | 0, | 745 | CS4231_HW_DETECT, 0, |
746 | #else /* OPTi93x */ | ||
747 | CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ, | ||
748 | #endif | ||
1799 | &codec)) < 0) | 749 | &codec)) < 0) |
1800 | return error; | 750 | return error; |
751 | #ifdef OPTi93X | ||
752 | chip->codec = codec; | ||
753 | #endif | ||
1801 | if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) | 754 | if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) |
1802 | return error; | 755 | return error; |
1803 | if ((error = snd_cs4231_mixer(codec)) < 0) | 756 | if ((error = snd_cs4231_mixer(codec)) < 0) |
1804 | return error; | 757 | return error; |
758 | #ifdef CS4231 | ||
1805 | if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) | 759 | if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) |
1806 | return error; | 760 | return error; |
761 | #else /* OPTI93X */ | ||
762 | error = request_irq(chip->irq, snd_opti93x_interrupt, | ||
763 | IRQF_DISABLED, DEV_NAME" - WSS", codec); | ||
764 | if (error < 0) { | ||
765 | snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); | ||
766 | return error; | ||
767 | } | ||
768 | #endif | ||
1807 | #else | 769 | #else |
1808 | if ((error = snd_ad1848_create(card, chip->wss_base + 4, | 770 | if ((error = snd_ad1848_create(card, chip->wss_base + 4, |
1809 | chip->irq, chip->dma1, | 771 | chip->irq, chip->dma1, |
diff --git a/sound/isa/sb/Makefile b/sound/isa/sb/Makefile index c9d1c986d70e..1098a56b2f4b 100644 --- a/sound/isa/sb/Makefile +++ b/sound/isa/sb/Makefile | |||
@@ -34,5 +34,3 @@ ifeq ($(CONFIG_SND_SB16_CSP),y) | |||
34 | obj-$(CONFIG_SND_SBAWE) += snd-sb16-csp.o | 34 | obj-$(CONFIG_SND_SBAWE) += snd-sb16-csp.o |
35 | endif | 35 | endif |
36 | obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-emu8000-synth.o | 36 | obj-$(call sequencer,$(CONFIG_SND_SBAWE)) += snd-emu8000-synth.o |
37 | |||
38 | obj-m := $(sort $(obj-m)) | ||
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c index 95eeca163354..0bb9b9256601 100644 --- a/sound/isa/wavefront/wavefront_synth.c +++ b/sound/isa/wavefront/wavefront_synth.c | |||
@@ -1939,7 +1939,7 @@ static int __devinit | |||
1939 | wavefront_download_firmware (snd_wavefront_t *dev, char *path) | 1939 | wavefront_download_firmware (snd_wavefront_t *dev, char *path) |
1940 | 1940 | ||
1941 | { | 1941 | { |
1942 | unsigned char *buf; | 1942 | const unsigned char *buf; |
1943 | int len, err; | 1943 | int len, err; |
1944 | int section_cnt_downloaded = 0; | 1944 | int section_cnt_downloaded = 0; |
1945 | const struct firmware *firmware; | 1945 | const struct firmware *firmware; |