Lines Matching +full:pci +full:- +full:dev
1 // SPDX-License-Identifier: GPL-2.0-only
15 * Now at least i can play Legacy DOOM with MIDI music :-)
20 #include <linux/pci.h>
24 #include <linux/dma-mapping.h>
31 static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 };
40 MODULE_PARM_DESC(pcifix, "Enable VIA-workaround for " CARD_NAME " soundcard.");
44 MODULE_DEVICE_TABLE(pci, snd_vortex_ids);
51 dev_info(&vortex->dev, "vortex latency is 0xff\n"); in vortex_fix_latency()
53 dev_warn(&vortex->dev, in vortex_fix_latency()
54 "could not set vortex latency: pci error 0x%x\n", rc); in vortex_fix_latency()
64 * only set the bit (Extend PCI#2 Internal Master for in vortex_fix_agp_bridge()
75 dev_info(&via->dev, "bridge config is 0x%x\n", value | 0x10); in vortex_fix_agp_bridge()
77 dev_warn(&via->dev, in vortex_fix_agp_bridge()
78 "could not set vortex latency: pci error 0x%x\n", rc); in vortex_fix_agp_bridge()
101 dev_info(&vortex->dev, in snd_vortex_workaround()
124 // component-destructor
128 vortex_t *vortex = card->private_data; in snd_vortex_free()
134 // chip-specific constructor
137 snd_vortex_create(struct snd_card *card, struct pci_dev *pci) in snd_vortex_create() argument
139 vortex_t *chip = card->private_data; in snd_vortex_create()
142 // check PCI availability (DMA). in snd_vortex_create()
143 err = pcim_enable_device(pci); in snd_vortex_create()
146 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32))) { in snd_vortex_create()
147 dev_err(card->dev, "error to set DMA mask\n"); in snd_vortex_create()
148 return -ENXIO; in snd_vortex_create()
151 chip->card = card; in snd_vortex_create()
154 chip->pci_dev = pci; in snd_vortex_create()
155 chip->vendor = pci->vendor; in snd_vortex_create()
156 chip->device = pci->device; in snd_vortex_create()
157 chip->card = card; in snd_vortex_create()
158 chip->irq = -1; in snd_vortex_create()
160 // (1) PCI resource allocation in snd_vortex_create()
163 chip->mmio = pcim_iomap_region(pci, 0, KBUILD_MODNAME); in snd_vortex_create()
164 if (IS_ERR(chip->mmio)) in snd_vortex_create()
165 return PTR_ERR(chip->mmio); in snd_vortex_create()
167 chip->io = pci_resource_start(pci, 0); in snd_vortex_create()
174 dev_err(card->dev, "hw core init failed\n"); in snd_vortex_create()
178 err = devm_request_irq(&pci->dev, pci->irq, vortex_interrupt, in snd_vortex_create()
181 dev_err(card->dev, "cannot grab irq\n"); in snd_vortex_create()
184 chip->irq = pci->irq; in snd_vortex_create()
185 card->sync_irq = chip->irq; in snd_vortex_create()
186 card->private_free = snd_vortex_free; in snd_vortex_create()
188 pci_set_master(pci); in snd_vortex_create()
189 // End of PCI setup. in snd_vortex_create()
193 // constructor -- see "Constructor" sub-section
195 __snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) in __snd_vortex_probe() argument
197 static int dev; in __snd_vortex_probe() local
203 if (dev >= SNDRV_CARDS) in __snd_vortex_probe()
204 return -ENODEV; in __snd_vortex_probe()
205 if (!enable[dev]) { in __snd_vortex_probe()
206 dev++; in __snd_vortex_probe()
207 return -ENOENT; in __snd_vortex_probe()
210 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, in __snd_vortex_probe()
214 chip = card->private_data; in __snd_vortex_probe()
217 err = snd_vortex_create(card, pci); in __snd_vortex_probe()
220 snd_vortex_workaround(pci, pcifix[dev]); in __snd_vortex_probe()
223 strscpy(card->driver, CARD_NAME_SHORT); in __snd_vortex_probe()
224 sprintf(card->shortname, "Aureal Vortex %s", CARD_NAME_SHORT); in __snd_vortex_probe()
225 sprintf(card->longname, "%s at 0x%lx irq %i", in __snd_vortex_probe()
226 card->shortname, chip->io, chip->irq); in __snd_vortex_probe()
268 dev_err(card->dev, "Can't initialize Aureal wavetable synth\n"); in __snd_vortex_probe()
273 strscpy(wave->name, "Aureal Synth"); in __snd_vortex_probe()
274 arg->hwptr = vortex; in __snd_vortex_probe()
275 arg->index = 1; in __snd_vortex_probe()
276 arg->seq_ports = seq_ports[dev]; in __snd_vortex_probe()
277 arg->max_voices = max_synth_voices[dev]; in __snd_vortex_probe()
282 err = pci_read_config_word(pci, PCI_DEVICE_ID, &chip->device); in __snd_vortex_probe()
285 err = pci_read_config_word(pci, PCI_VENDOR_ID, &chip->vendor); in __snd_vortex_probe()
288 chip->rev = pci->revision; in __snd_vortex_probe()
290 if ((chip->rev) != 0xfe && (chip->rev) != 0xfa) { in __snd_vortex_probe()
291 dev_alert(card->dev, in __snd_vortex_probe()
293 chip->rev); in __snd_vortex_probe()
294 dev_alert(card->dev, in __snd_vortex_probe()
295 "Please email the results of 'lspci -vv' to openvortex-dev@nongnu.org.\n"); in __snd_vortex_probe()
296 return -ENODEV; in __snd_vortex_probe()
305 pci_set_drvdata(pci, card); in __snd_vortex_probe()
306 dev++; in __snd_vortex_probe()
313 snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) in snd_vortex_probe() argument
315 return snd_card_free_on_error(&pci->dev, __snd_vortex_probe(pci, pci_id)); in snd_vortex_probe()