Lines Matching +full:aux +full:- +full:devs

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for Yamaha OPL3-SA[2,3] soundcards
26 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
30 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
43 MODULE_PARM_DESC(index, "Index value for OPL3-SA soundcard.");
45 MODULE_PARM_DESC(id, "ID string for OPL3-SA soundcard.");
47 MODULE_PARM_DESC(enable, "Enable OPL3-SA soundcard.");
53 MODULE_PARM_DESC(port, "Port # for OPL3-SA driver.");
55 MODULE_PARM_DESC(sb_port, "SB port # for OPL3-SA driver.");
57 MODULE_PARM_DESC(wss_port, "WSS port # for OPL3-SA driver.");
59 MODULE_PARM_DESC(fm_port, "FM port # for OPL3-SA driver.");
61 MODULE_PARM_DESC(midi_port, "MIDI port # for OPL3-SA driver.");
63 MODULE_PARM_DESC(irq, "IRQ # for OPL3-SA driver.");
65 MODULE_PARM_DESC(dma1, "DMA1 # for OPL3-SA driver.");
67 MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver.");
133 /* Yamaha YMF719E-S (Genius Sound Maker 3DX) */
134 { .id = "YMH0020", .devs = { { "YMH0021" } } },
135 /* Yamaha OPL3-SA3 (integrated on Intel's Pentium II AL440LX motherboard) */
136 { .id = "YMH0030", .devs = { { "YMH0021" } } },
137 /* Yamaha OPL3-SA2 */
138 { .id = "YMH0800", .devs = { { "YMH0021" } } },
139 /* Yamaha OPL3-SA2 */
140 { .id = "YMH0801", .devs = { { "YMH0021" } } },
142 { .id = "NMX2200", .devs = { { "YMH2210" } } },
144 { .id = "NMX2200", .devs = { { "NMX2210" } } },
145 /* --- */
162 outb(reg, chip->port); /* register */ in __snd_opl3sa2_read()
163 result = inb(chip->port + 1); in __snd_opl3sa2_read()
177 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_read()
179 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_read()
189 outb(reg, chip->port); /* register */ in __snd_opl3sa2_write()
190 outb(value, chip->port + 1); in __snd_opl3sa2_write()
191 chip->ctlregs[reg] = value; in __snd_opl3sa2_write()
198 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_write()
200 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_write()
205 struct snd_opl3sa2 *chip = card->private_data; in snd_opl3sa2_detect()
210 port = chip->port; in snd_opl3sa2_detect()
211 chip->res_port = devm_request_region(card->dev, port, 2, in snd_opl3sa2_detect()
212 "OPL3-SA control"); in snd_opl3sa2_detect()
213 if (!chip->res_port) { in snd_opl3sa2_detect()
215 return -EBUSY; in snd_opl3sa2_detect()
221 chip->version = 0; in snd_opl3sa2_detect()
224 snd_printd("OPL3-SA [0x%lx] detect = 0x%x\n", port, tmp); in snd_opl3sa2_detect()
225 return -ENODEV; in snd_opl3sa2_detect()
229 chip->version = 2; /* YMF711 */ in snd_opl3sa2_detect()
232 chip->version = 3; in snd_opl3sa2_detect()
233 /* 0x02 - standard */ in snd_opl3sa2_detect()
234 /* 0x03 - YM715B */ in snd_opl3sa2_detect()
235 /* 0x04 - YM719 - OPL-SA4? */ in snd_opl3sa2_detect()
236 /* 0x05 - OPL3-SA3 - Libretto 100 */ in snd_opl3sa2_detect()
237 /* 0x07 - unknown - Neomagic MagicWave 3D */ in snd_opl3sa2_detect()
240 str[0] = chip->version + '0'; in snd_opl3sa2_detect()
242 strcat(card->shortname, str); in snd_opl3sa2_detect()
246 snd_printd("OPL3-SA [0x%lx] detect (1) = 0x%x (0x%x)\n", port, tmp, tmp1); in snd_opl3sa2_detect()
247 return -ENODEV; in snd_opl3sa2_detect()
254 snd_printd("OPL3-SA [0x%lx] detect (2) = 0x%x (0x%x)\n", port, tmp, tmp1); in snd_opl3sa2_detect()
255 return -ENODEV; in snd_opl3sa2_detect()
259 /* Power Management - full on */ in snd_opl3sa2_detect()
261 if (chip->version > 2) { in snd_opl3sa2_detect()
263 snd_opl3sa2_write(chip, OPL3SA2_SYS_CTRL, (chip->ymode << 4)); in snd_opl3sa2_detect()
268 …snd_opl3sa2_write(chip, OPL3SA2_IRQ_CONFIG, 0x0d); /* Interrupt Channel Configuration - IRQ A = OP… in snd_opl3sa2_detect()
269 if (chip->single_dma) { in snd_opl3sa2_detect()
270 snd_opl3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x03); /* DMA Configuration - DMA A = WSS-R + WSS-P */ in snd_opl3sa2_detect()
272 …l3sa2_write(chip, OPL3SA2_DMA_CONFIG, 0x21); /* DMA Configuration - DMA B = WSS-R, DMA A = WSS-P */ in snd_opl3sa2_detect()
274 snd_opl3sa2_write(chip, OPL3SA2_MISC, 0x80 | (tmp & 7)); /* Miscellaneous - default */ in snd_opl3sa2_detect()
275 if (chip->version > 2) { in snd_opl3sa2_detect()
276 snd_opl3sa2_write(chip, OPL3SA3_DGTL_DOWN, 0x00); /* Digital Block Partial Power Down - default */ in snd_opl3sa2_detect()
277 snd_opl3sa2_write(chip, OPL3SA3_ANLG_DOWN, 0x00); /* Analog Block Partial Power Down - default */ in snd_opl3sa2_detect()
292 chip = card->private_data; in snd_opl3sa2_interrupt()
297 snd_opl3_interrupt(chip->synth); in snd_opl3sa2_interrupt()
300 if ((status & 0x10) && chip->rmidi != NULL) { in snd_opl3sa2_interrupt()
302 snd_mpu401_uart_interrupt(irq, chip->rmidi->private_data); in snd_opl3sa2_interrupt()
307 snd_wss_interrupt(irq, chip->wss); in snd_opl3sa2_interrupt()
315 if (chip->master_switch && chip->master_volume) { in snd_opl3sa2_interrupt()
317 &chip->master_switch->id); in snd_opl3sa2_interrupt()
319 &chip->master_volume->id); in snd_opl3sa2_interrupt()
343 int reg = kcontrol->private_value & 0xff; in snd_opl3sa2_get_single()
344 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_opl3sa2_get_single()
345 int mask = (kcontrol->private_value >> 16) & 0xff; in snd_opl3sa2_get_single()
346 int invert = (kcontrol->private_value >> 24) & 0xff; in snd_opl3sa2_get_single()
348 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_get_single()
349 ucontrol->value.integer.value[0] = (chip->ctlregs[reg] >> shift) & mask; in snd_opl3sa2_get_single()
350 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_get_single()
352 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; in snd_opl3sa2_get_single()
360 int reg = kcontrol->private_value & 0xff; in snd_opl3sa2_put_single()
361 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_opl3sa2_put_single()
362 int mask = (kcontrol->private_value >> 16) & 0xff; in snd_opl3sa2_put_single()
363 int invert = (kcontrol->private_value >> 24) & 0xff; in snd_opl3sa2_put_single()
367 val = (ucontrol->value.integer.value[0] & mask); in snd_opl3sa2_put_single()
369 val = mask - val; in snd_opl3sa2_put_single()
371 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_put_single()
372 oval = chip->ctlregs[reg]; in snd_opl3sa2_put_single()
376 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_put_single()
398 int left_reg = kcontrol->private_value & 0xff; in snd_opl3sa2_get_double()
399 int right_reg = (kcontrol->private_value >> 8) & 0xff; in snd_opl3sa2_get_double()
400 int shift_left = (kcontrol->private_value >> 16) & 0x07; in snd_opl3sa2_get_double()
401 int shift_right = (kcontrol->private_value >> 19) & 0x07; in snd_opl3sa2_get_double()
402 int mask = (kcontrol->private_value >> 24) & 0xff; in snd_opl3sa2_get_double()
403 int invert = (kcontrol->private_value >> 22) & 1; in snd_opl3sa2_get_double()
405 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_get_double()
406 ucontrol->value.integer.value[0] = (chip->ctlregs[left_reg] >> shift_left) & mask; in snd_opl3sa2_get_double()
407 ucontrol->value.integer.value[1] = (chip->ctlregs[right_reg] >> shift_right) & mask; in snd_opl3sa2_get_double()
408 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_get_double()
410 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; in snd_opl3sa2_get_double()
411 ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; in snd_opl3sa2_get_double()
420 int left_reg = kcontrol->private_value & 0xff; in snd_opl3sa2_put_double()
421 int right_reg = (kcontrol->private_value >> 8) & 0xff; in snd_opl3sa2_put_double()
422 int shift_left = (kcontrol->private_value >> 16) & 0x07; in snd_opl3sa2_put_double()
423 int shift_right = (kcontrol->private_value >> 19) & 0x07; in snd_opl3sa2_put_double()
424 int mask = (kcontrol->private_value >> 24) & 0xff; in snd_opl3sa2_put_double()
425 int invert = (kcontrol->private_value >> 22) & 1; in snd_opl3sa2_put_double()
429 val1 = ucontrol->value.integer.value[0] & mask; in snd_opl3sa2_put_double()
430 val2 = ucontrol->value.integer.value[1] & mask; in snd_opl3sa2_put_double()
432 val1 = mask - val1; in snd_opl3sa2_put_double()
433 val2 = mask - val2; in snd_opl3sa2_put_double()
437 spin_lock_irqsave(&chip->reg_lock, flags); in snd_opl3sa2_put_double()
439 oval1 = chip->ctlregs[left_reg]; in snd_opl3sa2_put_double()
440 oval2 = chip->ctlregs[right_reg]; in snd_opl3sa2_put_double()
447 oval1 = chip->ctlregs[left_reg]; in snd_opl3sa2_put_double()
452 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_opl3sa2_put_double()
456 static const DECLARE_TLV_DB_SCALE(db_scale_master, -3000, 200, 0);
457 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
470 OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0),
471 OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0),
472 OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)
478 chip->master_switch = NULL; in snd_opl3sa2_master_free()
479 chip->master_volume = NULL; in snd_opl3sa2_master_free()
484 struct snd_opl3sa2 *chip = card->private_data; in snd_opl3sa2_mixer()
494 strcpy(id1.name, "Aux Playback Switch"); in snd_opl3sa2_mixer()
501 strcpy(id1.name, "Aux Playback Volume"); in snd_opl3sa2_mixer()
509 strcpy(id1.name, "Aux Playback Switch"); id1.index = 1; in snd_opl3sa2_mixer()
516 strcpy(id1.name, "Aux Playback Volume"); in snd_opl3sa2_mixer()
530 case 0: chip->master_switch = kctl; kctl->private_free = snd_opl3sa2_master_free; break; in snd_opl3sa2_mixer()
531 case 1: chip->master_volume = kctl; kctl->private_free = snd_opl3sa2_master_free; break; in snd_opl3sa2_mixer()
534 if (chip->version > 2) { in snd_opl3sa2_mixer()
549 struct snd_opl3sa2 *chip = card->private_data; in snd_opl3sa2_suspend()
552 chip->wss->suspend(chip->wss); in snd_opl3sa2_suspend()
568 chip = card->private_data; in snd_opl3sa2_resume()
575 snd_opl3sa2_write(chip, i, chip->ctlregs[i]); in snd_opl3sa2_resume()
577 if (chip->version > 2) { in snd_opl3sa2_resume()
579 snd_opl3sa2_write(chip, i, chip->ctlregs[i]); in snd_opl3sa2_resume()
582 chip->wss->resume(chip->wss); in snd_opl3sa2_resume()
595 return -EBUSY; in snd_opl3sa2_pnp()
605 snd_printdd("%sPnP OPL3-SA: sb port=0x%lx, wss port=0x%lx, fm port=0x%lx, midi port=0x%lx\n", in snd_opl3sa2_pnp()
607 snd_printdd("%sPnP OPL3-SA: control port=0x%lx, dma1=%i, dma2=%i, irq=%i\n", in snd_opl3sa2_pnp()
624 strcpy(card->driver, "OPL3SA2"); in snd_opl3sa2_card_new()
625 strcpy(card->shortname, "Yamaha OPL3-SA"); in snd_opl3sa2_card_new()
626 chip = card->private_data; in snd_opl3sa2_card_new()
627 spin_lock_init(&chip->reg_lock); in snd_opl3sa2_card_new()
628 chip->irq = -1; in snd_opl3sa2_card_new()
642 chip = card->private_data; in snd_opl3sa2_probe()
643 chip->ymode = opl3sa3_ymode[dev] & 0x03 ; in snd_opl3sa2_probe()
644 chip->port = port[dev]; in snd_opl3sa2_probe()
649 chip->single_dma = 1; in snd_opl3sa2_probe()
653 err = devm_request_irq(card->dev, xirq, snd_opl3sa2_interrupt, 0, in snd_opl3sa2_probe()
654 "OPL3-SA2", card); in snd_opl3sa2_probe()
657 return -ENODEV; in snd_opl3sa2_probe()
659 chip->irq = xirq; in snd_opl3sa2_probe()
660 card->sync_irq = chip->irq; in snd_opl3sa2_probe()
662 wss_port[dev] + 4, -1, in snd_opl3sa2_probe()
669 chip->wss = wss; in snd_opl3sa2_probe()
691 err = snd_opl3_hwdep_new(opl3, 0, 1, &chip->synth); in snd_opl3sa2_probe()
698 MPU401_INFO_IRQ_HOOK, -1, in snd_opl3sa2_probe()
699 &chip->rmidi); in snd_opl3sa2_probe()
703 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", in snd_opl3sa2_probe()
704 card->shortname, chip->port, xirq, xdma1); in snd_opl3sa2_probe()
706 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); in snd_opl3sa2_probe()
720 return -ENOENT; /* we have another procedure - card */ in snd_opl3sa2_pnp_detect()
726 return -ENODEV; in snd_opl3sa2_pnp_detect()
728 err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); in snd_opl3sa2_pnp_detect()
731 err = snd_opl3sa2_pnp(dev, card->private_data, pdev); in snd_opl3sa2_pnp_detect()
754 .name = "snd-opl3sa2-pnpbios",
771 pdev = pnp_request_card_device(pcard, id->devs[0].id, NULL); in snd_opl3sa2_pnp_cdetect()
774 id->devs[0].id); in snd_opl3sa2_pnp_cdetect()
775 return -EBUSY; in snd_opl3sa2_pnp_cdetect()
782 return -ENODEV; in snd_opl3sa2_pnp_cdetect()
784 err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); in snd_opl3sa2_pnp_cdetect()
787 err = snd_opl3sa2_pnp(dev, card->private_data, pdev); in snd_opl3sa2_pnp_cdetect()
811 .name = "snd-opl3sa2-cpnp",