^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * ALSA card-level driver for Turtle Beach Wavefront cards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * (Maui,Tropez,Tropez+)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/isa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/pnp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <sound/initval.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <sound/opl3.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <sound/wss.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <sound/snd_wavefront.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) MODULE_AUTHOR("Paul Barton-Davis <pbd@op.net>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) MODULE_DESCRIPTION("Turtle Beach Wavefront");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static long cs4232_mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) static int cs4232_mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 9,11,12,15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) static long ics2115_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static int ics2115_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,9,11,12,15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static bool use_cs4232_midi[SNDRV_CARDS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) module_param_array(index, int, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) MODULE_PARM_DESC(index, "Index value for WaveFront soundcard.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) module_param_array(id, charp, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) MODULE_PARM_DESC(id, "ID string for WaveFront soundcard.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) module_param_array(enable, bool, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) MODULE_PARM_DESC(enable, "Enable WaveFront soundcard.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) module_param_array(isapnp, bool, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) MODULE_PARM_DESC(isapnp, "ISA PnP detection for WaveFront soundcards.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) module_param_hw_array(cs4232_pcm_port, long, ioport, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) MODULE_PARM_DESC(cs4232_pcm_port, "Port # for CS4232 PCM interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) module_param_hw_array(cs4232_pcm_irq, int, irq, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) MODULE_PARM_DESC(cs4232_pcm_irq, "IRQ # for CS4232 PCM interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) module_param_hw_array(dma1, int, dma, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) MODULE_PARM_DESC(dma1, "DMA1 # for CS4232 PCM interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) module_param_hw_array(dma2, int, dma, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) MODULE_PARM_DESC(dma2, "DMA2 # for CS4232 PCM interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) module_param_hw_array(cs4232_mpu_port, long, ioport, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) MODULE_PARM_DESC(cs4232_mpu_port, "port # for CS4232 MPU-401 interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) module_param_hw_array(cs4232_mpu_irq, int, irq, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) MODULE_PARM_DESC(cs4232_mpu_irq, "IRQ # for CS4232 MPU-401 interface.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) module_param_hw_array(ics2115_irq, int, irq, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) MODULE_PARM_DESC(ics2115_irq, "IRQ # for ICS2115.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) module_param_hw_array(ics2115_port, long, ioport, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) MODULE_PARM_DESC(ics2115_port, "Port # for ICS2115.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) module_param_hw_array(fm_port, long, ioport, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) MODULE_PARM_DESC(fm_port, "FM port #.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) module_param_array(use_cs4232_midi, bool, NULL, 0444);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) MODULE_PARM_DESC(use_cs4232_midi, "Use CS4232 MPU-401 interface (inaccessibly located inside your computer)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static int isa_registered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) static int pnp_registered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static const struct pnp_card_device_id snd_wavefront_pnpids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* Tropez */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) /* Tropez+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) { .id = "CSC7632", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) { .id = "" }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) MODULE_DEVICE_TABLE(pnp_card, snd_wavefront_pnpids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) const struct pnp_card_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct pnp_dev *pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) /* Check for each logical device. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) /* CS4232 chip (aka "windows sound system") is logical device 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if (acard->wss == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) /* there is a game port at logical device 1, but we ignore it completely */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) /* the control interface is logical device 2, but we ignore it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) completely. in fact, nobody even seems to know what it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) does.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) /* Only configure the CS4232 MIDI interface if its been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) specifically requested. It is logical device 3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if (use_cs4232_midi[dev]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) if (acard->mpu == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) /* The ICS2115 synth is logical device 4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (acard->synth == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) /* PCM/FM initialization */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) pdev = acard->wss;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* An interesting note from the Tropez+ FAQ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) Q. [Ports] Why is the base address of the WSS I/O ports off by 4?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) A. WSS I/O requires a block of 8 I/O addresses ("ports"). Of these, the first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 4 are used to identify and configure the board. With the advent of PnP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) these first 4 addresses have become obsolete, and software applications
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) only use the last 4 addresses to control the codec chip. Therefore, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) base address setting "skips past" the 4 unused addresses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) err = pnp_activate_dev(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) snd_printk(KERN_ERR "PnP WSS pnp configure failure\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) cs4232_pcm_port[dev] = pnp_port_start(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) fm_port[dev] = pnp_port_start(pdev, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) dma1[dev] = pnp_dma(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) dma2[dev] = pnp_dma(pdev, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) cs4232_pcm_irq[dev] = pnp_irq(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* Synth initialization */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) pdev = acard->synth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) err = pnp_activate_dev(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) ics2115_port[dev] = pnp_port_start(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) ics2115_irq[dev] = pnp_irq(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) /* CS4232 MPU initialization. Configure this only if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) explicitly requested, since its physically inaccessible and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) consumes another IRQ.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) if (use_cs4232_midi[dev]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) pdev = acard->mpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) err = pnp_activate_dev(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) cs4232_mpu_port[dev] = SNDRV_AUTO_PORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) cs4232_mpu_port[dev] = pnp_port_start(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) cs4232_mpu_irq[dev] = pnp_irq(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) snd_printk (KERN_INFO "CS4232 MPU: port=0x%lx, irq=%i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) cs4232_mpu_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) cs4232_mpu_irq[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) snd_printdd ("CS4232: pcm port=0x%lx, fm port=0x%lx, dma1=%i, dma2=%i, irq=%i\nICS2115: port=0x%lx, irq=%i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) cs4232_pcm_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) fm_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) dma1[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) dma2[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) cs4232_pcm_irq[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ics2115_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) ics2115_irq[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) #endif /* CONFIG_PNP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) static irqreturn_t snd_wavefront_ics2115_interrupt(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) snd_wavefront_card_t *acard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) acard = (snd_wavefront_card_t *) dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) if (acard == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) return IRQ_NONE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) if (acard->wavefront.interrupts_are_midi) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) snd_wavefront_midi_interrupt (acard);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) snd_wavefront_internal_interrupt (acard);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static struct snd_hwdep *snd_wavefront_new_synth(struct snd_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int hw_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) snd_wavefront_card_t *acard)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct snd_hwdep *wavefront_synth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) if (snd_wavefront_detect (acard) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) if (snd_wavefront_start (&acard->wavefront) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) if (snd_hwdep_new(card, "WaveFront", hw_dev, &wavefront_synth) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) strcpy (wavefront_synth->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) "WaveFront (ICS2115) wavetable synthesizer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) wavefront_synth->ops.open = snd_wavefront_synth_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) wavefront_synth->ops.release = snd_wavefront_synth_release;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) wavefront_synth->ops.ioctl = snd_wavefront_synth_ioctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) return wavefront_synth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static struct snd_hwdep *snd_wavefront_new_fx(struct snd_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) int hw_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) snd_wavefront_card_t *acard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) unsigned long port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) struct snd_hwdep *fx_processor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) if (snd_wavefront_fx_start (&acard->wavefront)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) snd_printk (KERN_ERR "cannot initialize YSS225 FX processor");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) if (snd_hwdep_new (card, "YSS225", hw_dev, &fx_processor) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) sprintf (fx_processor->name, "YSS225 FX Processor at 0x%lx", port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) fx_processor->ops.open = snd_wavefront_fx_open;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) fx_processor->ops.release = snd_wavefront_fx_release;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) fx_processor->ops.ioctl = snd_wavefront_fx_ioctl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) return fx_processor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) static snd_wavefront_mpu_id internal_id = internal_mpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) static snd_wavefront_mpu_id external_id = external_mpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) int midi_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) snd_wavefront_card_t *acard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) unsigned long port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) snd_wavefront_mpu_id mpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) struct snd_rawmidi *rmidi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) static int first = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) if (first) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) first = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) acard->wavefront.midi.base = port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) if (snd_wavefront_midi_start (acard)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) snd_printk (KERN_ERR "cannot initialize MIDI interface\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) if (snd_rawmidi_new (card, "WaveFront MIDI", midi_dev, 1, 1, &rmidi) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) if (mpu == internal_mpu) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) strcpy(rmidi->name, "WaveFront MIDI (Internal)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) rmidi->private_data = &internal_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) strcpy(rmidi->name, "WaveFront MIDI (External)");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) rmidi->private_data = &external_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_wavefront_midi_output);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_wavefront_midi_input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) SNDRV_RAWMIDI_INFO_INPUT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) SNDRV_RAWMIDI_INFO_DUPLEX;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) return rmidi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) static void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) snd_wavefront_free(struct snd_card *card)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) if (acard) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) release_and_free_resource(acard->wavefront.res_base);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) if (acard->wavefront.irq > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) free_irq(acard->wavefront.irq, (void *)acard);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) static int snd_wavefront_card_new(struct device *pdev, int dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) struct snd_card **cardp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) snd_wavefront_card_t *acard;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) sizeof(snd_wavefront_card_t), &card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) acard = card->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) acard->wavefront.irq = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) spin_lock_init(&acard->wavefront.irq_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) init_waitqueue_head(&acard->wavefront.interrupt_sleeper);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) spin_lock_init(&acard->wavefront.midi.open);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) spin_lock_init(&acard->wavefront.midi.virtual);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) acard->wavefront.card = card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) card->private_free = snd_wavefront_free;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) *cardp = card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) snd_wavefront_probe (struct snd_card *card, int dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) snd_wavefront_card_t *acard = card->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) struct snd_wss *chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) struct snd_hwdep *wavefront_synth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) struct snd_rawmidi *ics2115_internal_rmidi = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) struct snd_rawmidi *ics2115_external_rmidi = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) struct snd_hwdep *fx_processor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) int hw_dev = 0, midi_dev = 0, err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /* --------- PCM --------------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) err = snd_wss_create(card, cs4232_pcm_port[dev], -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) cs4232_pcm_irq[dev], dma1[dev], dma2[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) WSS_HW_DETECT, 0, &chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) snd_printk(KERN_ERR "can't allocate WSS device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) err = snd_wss_pcm(chip, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) err = snd_wss_timer(chip, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) /* ---------- OPL3 synth --------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) struct snd_opl3 *opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) err = snd_opl3_create(card, fm_port[dev], fm_port[dev] + 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) OPL3_HW_OPL3_CS, 0, &opl3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) snd_printk (KERN_ERR "can't allocate or detect OPL3 synth\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) err = snd_opl3_hwdep_new(opl3, hw_dev, 1, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) hw_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) /* ------- ICS2115 Wavetable synth ------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) acard->wavefront.res_base = request_region(ics2115_port[dev], 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) "ICS2115");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) if (acard->wavefront.res_base == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) snd_printk(KERN_ERR "unable to grab ICS2115 i/o region 0x%lx-0x%lx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) ics2115_port[dev], ics2115_port[dev] + 16 - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) if (request_irq(ics2115_irq[dev], snd_wavefront_ics2115_interrupt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 0, "ICS2115", acard)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) snd_printk(KERN_ERR "unable to use ICS2115 IRQ %d\n", ics2115_irq[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) return -EBUSY;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) acard->wavefront.irq = ics2115_irq[dev];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) card->sync_irq = acard->wavefront.irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) acard->wavefront.base = ics2115_port[dev];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) wavefront_synth = snd_wavefront_new_synth(card, hw_dev, acard);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) if (wavefront_synth == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) snd_printk (KERN_ERR "can't create WaveFront synth device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) strcpy (wavefront_synth->name, "ICS2115 Wavetable MIDI Synthesizer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) wavefront_synth->iface = SNDRV_HWDEP_IFACE_ICS2115;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) hw_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) /* --------- Mixer ------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) err = snd_wss_mixer(chip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) snd_printk (KERN_ERR "can't allocate mixer device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) /* -------- CS4232 MPU-401 interface -------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) cs4232_mpu_port[dev], 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) cs4232_mpu_irq[dev], NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) if (err < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) midi_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) /* ------ ICS2115 internal MIDI ------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) if (ics2115_port[dev] > 0 && ics2115_port[dev] != SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) ics2115_internal_rmidi =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) snd_wavefront_new_midi (card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) midi_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) acard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) ics2115_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) internal_mpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) if (ics2115_internal_rmidi == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) snd_printk (KERN_ERR "can't setup ICS2115 internal MIDI device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) midi_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) /* ------ ICS2115 external MIDI ------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) if (ics2115_port[dev] > 0 && ics2115_port[dev] != SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) ics2115_external_rmidi =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) snd_wavefront_new_midi (card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) midi_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) acard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) ics2115_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) external_mpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) if (ics2115_external_rmidi == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) snd_printk (KERN_ERR "can't setup ICS2115 external MIDI device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) midi_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) /* FX processor for Tropez+ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) if (acard->wavefront.has_fx) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) fx_processor = snd_wavefront_new_fx (card,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) hw_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) acard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) ics2115_port[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) if (fx_processor == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) snd_printk (KERN_ERR "can't setup FX device\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) hw_dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) strcpy(card->driver, "Tropez+");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) strcpy(card->shortname, "Turtle Beach Tropez+");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) /* Need a way to distinguish between Maui and Tropez */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) strcpy(card->driver, "WaveFront");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) strcpy(card->shortname, "Turtle Beach WaveFront");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) /* ----- Register the card --------- */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) /* Not safe to include "Turtle Beach" in longname, due to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) length restrictions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) sprintf(card->longname, "%s PCM 0x%lx irq %d dma %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) card->driver,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) chip->port,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) cs4232_pcm_irq[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) dma1[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) if (dma2[dev] >= 0 && dma2[dev] < 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) sprintf (card->longname + strlen (card->longname),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) " MPU-401 0x%lx irq %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) cs4232_mpu_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) cs4232_mpu_irq[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) sprintf (card->longname + strlen (card->longname),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) " SYNTH 0x%lx irq %d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) ics2115_port[dev],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) ics2115_irq[dev]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) return snd_card_register(card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) static int snd_wavefront_isa_match(struct device *pdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) unsigned int dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) if (!enable[dev])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) if (isapnp[dev])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) snd_printk(KERN_ERR "specify CS4232 port\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) if (ics2115_port[dev] == SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) snd_printk(KERN_ERR "specify ICS2115 port\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) static int snd_wavefront_isa_probe(struct device *pdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) unsigned int dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) err = snd_wavefront_card_new(pdev, dev, &card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) if ((err = snd_wavefront_probe(card, dev)) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) snd_card_free(card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) dev_set_drvdata(pdev, card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) static int snd_wavefront_isa_remove(struct device *devptr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) unsigned int dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) snd_card_free(dev_get_drvdata(devptr));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) #define DEV_NAME "wavefront"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) static struct isa_driver snd_wavefront_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) .match = snd_wavefront_isa_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) .probe = snd_wavefront_isa_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) .remove = snd_wavefront_isa_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) /* FIXME: suspend, resume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) .name = DEV_NAME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) const struct pnp_card_device_id *pid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) static int dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) struct snd_card *card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) int res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) for ( ; dev < SNDRV_CARDS; dev++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) if (enable[dev] && isapnp[dev])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) if (dev >= SNDRV_CARDS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) res = snd_wavefront_card_new(&pcard->card->dev, dev, &card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) if (res < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) return res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) snd_printk (KERN_ERR "isapnp detection failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) snd_card_free (card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) if ((res = snd_wavefront_probe(card, dev)) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) return res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) pnp_set_card_drvdata(pcard, card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) dev++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) static void snd_wavefront_pnp_remove(struct pnp_card_link *pcard)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) snd_card_free(pnp_get_card_drvdata(pcard));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) pnp_set_card_drvdata(pcard, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) static struct pnp_card_driver wavefront_pnpc_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) .flags = PNP_DRIVER_RES_DISABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) .name = "wavefront",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) .id_table = snd_wavefront_pnpids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) .probe = snd_wavefront_pnp_detect,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) .remove = snd_wavefront_pnp_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) /* FIXME: suspend,resume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) #endif /* CONFIG_PNP */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) static int __init alsa_card_wavefront_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) err = isa_register_driver(&snd_wavefront_driver, SNDRV_CARDS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) if (!err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) isa_registered = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) err = pnp_register_card_driver(&wavefront_pnpc_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) if (!err)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) pnp_registered = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) if (isa_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) static void __exit alsa_card_wavefront_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) #ifdef CONFIG_PNP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) if (pnp_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) pnp_unregister_card_driver(&wavefront_pnpc_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) if (isa_registered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) isa_unregister_driver(&snd_wavefront_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) module_init(alsa_card_wavefront_init)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) module_exit(alsa_card_wavefront_exit)