wavefront.c (3d5271f9883cba7b54762bc4fe027d4172f06db7) wavefront.c (542172f31d41e689988aedcf0d6e67dfe757736a)
1/*
2 * ALSA card-level driver for Turtle Beach Wavefront cards
3 * (Maui,Tropez,Tropez+)
4 *
5 * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 67 unchanged lines hidden (view full) ---

76MODULE_PARM_DESC(ics2115_irq, "IRQ # for ICS2115.");
77module_param_array(ics2115_port, long, NULL, 0444);
78MODULE_PARM_DESC(ics2115_port, "Port # for ICS2115.");
79module_param_array(fm_port, long, NULL, 0444);
80MODULE_PARM_DESC(fm_port, "FM port #.");
81module_param_array(use_cs4232_midi, bool, NULL, 0444);
82MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
83
1/*
2 * ALSA card-level driver for Turtle Beach Wavefront cards
3 * (Maui,Tropez,Tropez+)
4 *
5 * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 67 unchanged lines hidden (view full) ---

76MODULE_PARM_DESC(ics2115_irq, "IRQ # for ICS2115.");
77module_param_array(ics2115_port, long, NULL, 0444);
78MODULE_PARM_DESC(ics2115_port, "Port # for ICS2115.");
79module_param_array(fm_port, long, NULL, 0444);
80MODULE_PARM_DESC(fm_port, "FM port #.");
81module_param_array(use_cs4232_midi, bool, NULL, 0444);
82MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
83
84static snd_card_t *snd_wavefront_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
84static struct snd_card *snd_wavefront_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
85
86#ifdef CONFIG_PNP
87
88static struct pnp_card_device_id snd_wavefront_pnpids[] = {
89 /* Tropez */
90 { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },
91 /* Tropez+ */
92 { .id = "CSC7632", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },

--- 181 unchanged lines hidden (view full) ---

274 if (acard->wavefront.interrupts_are_midi) {
275 snd_wavefront_midi_interrupt (acard);
276 } else {
277 snd_wavefront_internal_interrupt (acard);
278 }
279 return IRQ_HANDLED;
280}
281
85
86#ifdef CONFIG_PNP
87
88static struct pnp_card_device_id snd_wavefront_pnpids[] = {
89 /* Tropez */
90 { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },
91 /* Tropez+ */
92 { .id = "CSC7632", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },

--- 181 unchanged lines hidden (view full) ---

274 if (acard->wavefront.interrupts_are_midi) {
275 snd_wavefront_midi_interrupt (acard);
276 } else {
277 snd_wavefront_internal_interrupt (acard);
278 }
279 return IRQ_HANDLED;
280}
281
282static snd_hwdep_t * __devinit
283snd_wavefront_new_synth (snd_card_t *card,
282static struct snd_hwdep * __devinit
283snd_wavefront_new_synth (struct snd_card *card,
284 int hw_dev,
285 snd_wavefront_card_t *acard)
286{
284 int hw_dev,
285 snd_wavefront_card_t *acard)
286{
287 snd_hwdep_t *wavefront_synth;
287 struct snd_hwdep *wavefront_synth;
288
289 if (snd_wavefront_detect (acard) < 0) {
290 return NULL;
291 }
292
293 if (snd_wavefront_start (&acard->wavefront) < 0) {
294 return NULL;
295 }

--- 4 unchanged lines hidden (view full) ---

300 "WaveFront (ICS2115) wavetable synthesizer");
301 wavefront_synth->ops.open = snd_wavefront_synth_open;
302 wavefront_synth->ops.release = snd_wavefront_synth_release;
303 wavefront_synth->ops.ioctl = snd_wavefront_synth_ioctl;
304
305 return wavefront_synth;
306}
307
288
289 if (snd_wavefront_detect (acard) < 0) {
290 return NULL;
291 }
292
293 if (snd_wavefront_start (&acard->wavefront) < 0) {
294 return NULL;
295 }

--- 4 unchanged lines hidden (view full) ---

300 "WaveFront (ICS2115) wavetable synthesizer");
301 wavefront_synth->ops.open = snd_wavefront_synth_open;
302 wavefront_synth->ops.release = snd_wavefront_synth_release;
303 wavefront_synth->ops.ioctl = snd_wavefront_synth_ioctl;
304
305 return wavefront_synth;
306}
307
308static snd_hwdep_t * __devinit
309snd_wavefront_new_fx (snd_card_t *card,
308static struct snd_hwdep * __devinit
309snd_wavefront_new_fx (struct snd_card *card,
310 int hw_dev,
311 snd_wavefront_card_t *acard,
312 unsigned long port)
313
314{
310 int hw_dev,
311 snd_wavefront_card_t *acard,
312 unsigned long port)
313
314{
315 snd_hwdep_t *fx_processor;
315 struct snd_hwdep *fx_processor;
316
317 if (snd_wavefront_fx_start (&acard->wavefront)) {
318 snd_printk ("cannot initialize YSS225 FX processor");
319 return NULL;
320 }
321
322 if (snd_hwdep_new (card, "YSS225", hw_dev, &fx_processor) < 0)
323 return NULL;
324 sprintf (fx_processor->name, "YSS225 FX Processor at 0x%lx", port);
325 fx_processor->ops.open = snd_wavefront_fx_open;
326 fx_processor->ops.release = snd_wavefront_fx_release;
327 fx_processor->ops.ioctl = snd_wavefront_fx_ioctl;
328
329 return fx_processor;
330}
331
332static snd_wavefront_mpu_id internal_id = internal_mpu;
333static snd_wavefront_mpu_id external_id = external_mpu;
334
316
317 if (snd_wavefront_fx_start (&acard->wavefront)) {
318 snd_printk ("cannot initialize YSS225 FX processor");
319 return NULL;
320 }
321
322 if (snd_hwdep_new (card, "YSS225", hw_dev, &fx_processor) < 0)
323 return NULL;
324 sprintf (fx_processor->name, "YSS225 FX Processor at 0x%lx", port);
325 fx_processor->ops.open = snd_wavefront_fx_open;
326 fx_processor->ops.release = snd_wavefront_fx_release;
327 fx_processor->ops.ioctl = snd_wavefront_fx_ioctl;
328
329 return fx_processor;
330}
331
332static snd_wavefront_mpu_id internal_id = internal_mpu;
333static snd_wavefront_mpu_id external_id = external_mpu;
334
335static snd_rawmidi_t * __devinit
336snd_wavefront_new_midi (snd_card_t *card,
335static struct snd_rawmidi *__devinit
336snd_wavefront_new_midi (struct snd_card *card,
337 int midi_dev,
338 snd_wavefront_card_t *acard,
339 unsigned long port,
340 snd_wavefront_mpu_id mpu)
341
342{
337 int midi_dev,
338 snd_wavefront_card_t *acard,
339 unsigned long port,
340 snd_wavefront_mpu_id mpu)
341
342{
343 snd_rawmidi_t *rmidi;
343 struct snd_rawmidi *rmidi;
344 static int first = 1;
345
346 if (first) {
347 first = 0;
348 acard->wavefront.midi.base = port;
349 if (snd_wavefront_midi_start (acard)) {
350 snd_printk ("cannot initialize MIDI interface\n");
351 return NULL;

--- 17 unchanged lines hidden (view full) ---

369 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
370 SNDRV_RAWMIDI_INFO_INPUT |
371 SNDRV_RAWMIDI_INFO_DUPLEX;
372
373 return rmidi;
374}
375
376static void
344 static int first = 1;
345
346 if (first) {
347 first = 0;
348 acard->wavefront.midi.base = port;
349 if (snd_wavefront_midi_start (acard)) {
350 snd_printk ("cannot initialize MIDI interface\n");
351 return NULL;

--- 17 unchanged lines hidden (view full) ---

369 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
370 SNDRV_RAWMIDI_INFO_INPUT |
371 SNDRV_RAWMIDI_INFO_DUPLEX;
372
373 return rmidi;
374}
375
376static void
377snd_wavefront_free(snd_card_t *card)
377snd_wavefront_free(struct snd_card *card)
378{
379 snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data;
380
381 if (acard) {
382 release_and_free_resource(acard->wavefront.res_base);
383 if (acard->wavefront.irq > 0)
384 free_irq(acard->wavefront.irq, (void *)acard);
385 }
386}
387
388static int __devinit
389snd_wavefront_probe (int dev, struct pnp_card_link *pcard,
390 const struct pnp_card_device_id *pid)
391{
378{
379 snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data;
380
381 if (acard) {
382 release_and_free_resource(acard->wavefront.res_base);
383 if (acard->wavefront.irq > 0)
384 free_irq(acard->wavefront.irq, (void *)acard);
385 }
386}
387
388static int __devinit
389snd_wavefront_probe (int dev, struct pnp_card_link *pcard,
390 const struct pnp_card_device_id *pid)
391{
392 snd_card_t *card;
392 struct snd_card *card;
393 snd_wavefront_card_t *acard;
393 snd_wavefront_card_t *acard;
394 cs4231_t *chip;
395 snd_hwdep_t *wavefront_synth;
396 snd_rawmidi_t *ics2115_internal_rmidi = NULL;
397 snd_rawmidi_t *ics2115_external_rmidi = NULL;
398 snd_hwdep_t *fx_processor;
394 struct snd_cs4231 *chip;
395 struct snd_hwdep *wavefront_synth;
396 struct snd_rawmidi *ics2115_internal_rmidi = NULL;
397 struct snd_rawmidi *ics2115_external_rmidi = NULL;
398 struct snd_hwdep *fx_processor;
399 int hw_dev = 0, midi_dev = 0, err;
400
401#ifdef CONFIG_PNP
402 if (!isapnp[dev]) {
403#endif
404 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
405 snd_printk("specify CS4232 port\n");
406 return -EINVAL;

--- 55 unchanged lines hidden (view full) ---

462 if ((err = snd_cs4231_timer (chip, 0, NULL)) < 0) {
463 snd_card_free(card);
464 return err;
465 }
466
467 /* ---------- OPL3 synth --------- */
468
469 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
399 int hw_dev = 0, midi_dev = 0, err;
400
401#ifdef CONFIG_PNP
402 if (!isapnp[dev]) {
403#endif
404 if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
405 snd_printk("specify CS4232 port\n");
406 return -EINVAL;

--- 55 unchanged lines hidden (view full) ---

462 if ((err = snd_cs4231_timer (chip, 0, NULL)) < 0) {
463 snd_card_free(card);
464 return err;
465 }
466
467 /* ---------- OPL3 synth --------- */
468
469 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
470 opl3_t *opl3;
470 struct snd_opl3 *opl3;
471
472 if ((err = snd_opl3_create(card,
473 fm_port[dev],
474 fm_port[dev] + 2,
475 OPL3_HW_OPL3_CS,
476 0, &opl3)) < 0) {
477 snd_printk ("can't allocate or detect OPL3 synth\n");
478 snd_card_free(card);

--- 174 unchanged lines hidden (view full) ---

653 return 0;
654 }
655
656 return -ENODEV;
657}
658
659static void __devexit snd_wavefront_pnp_remove(struct pnp_card_link * pcard)
660{
471
472 if ((err = snd_opl3_create(card,
473 fm_port[dev],
474 fm_port[dev] + 2,
475 OPL3_HW_OPL3_CS,
476 0, &opl3)) < 0) {
477 snd_printk ("can't allocate or detect OPL3 synth\n");
478 snd_card_free(card);

--- 174 unchanged lines hidden (view full) ---

653 return 0;
654 }
655
656 return -ENODEV;
657}
658
659static void __devexit snd_wavefront_pnp_remove(struct pnp_card_link * pcard)
660{
661 snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard);
661 struct snd_card *card = (struct snd_card *) pnp_get_card_drvdata(pcard);
662
663 snd_card_disconnect(card);
664 snd_card_free_in_thread(card);
665}
666
667static struct pnp_card_driver wavefront_pnpc_driver = {
668 .flags = PNP_DRIVER_RES_DISABLE,
669 .name = "wavefront",

--- 49 unchanged lines hidden ---
662
663 snd_card_disconnect(card);
664 snd_card_free_in_thread(card);
665}
666
667static struct pnp_card_driver wavefront_pnpc_driver = {
668 .flags = PNP_DRIVER_RES_DISABLE,
669 .name = "wavefront",

--- 49 unchanged lines hidden ---