• Home
  • Raw
  • Download

Lines Matching refs:devc

86 int sb_dsp_command(sb_devc * devc, unsigned char val)  in sb_dsp_command()  argument
113 int sb_dsp_get_byte(sb_devc * devc) in sb_dsp_get_byte() argument
125 static void sb_intr (sb_devc *devc) in sb_intr() argument
130 if (devc->model == MDL_SB16) in sb_intr()
132 src = sb_getmixer(devc, IRQ_STAT); /* Interrupt source register */ in sb_intr()
135 if(devc->midi_irq_cookie) in sb_intr()
136 uart401intr(devc->irq, devc->midi_irq_cookie); in sb_intr()
141 if (devc->intr_active && (!devc->fullduplex || (src & 0x01))) in sb_intr()
143 switch (devc->irq_mode) in sb_intr()
146 DMAbuf_outputintr(devc->dev, 1); in sb_intr()
150 DMAbuf_inputintr(devc->dev); in sb_intr()
157 sb_midi_interrupt(devc); in sb_intr()
165 else if (devc->intr_active_16 && (src & 0x02)) in sb_intr()
167 switch (devc->irq_mode_16) in sb_intr()
170 DMAbuf_outputintr(devc->dev, 1); in sb_intr()
174 DMAbuf_inputintr(devc->dev); in sb_intr()
192 if (devc->model == MDL_SB16 && src & 0x02) in sb_intr()
196 static void pci_intr(sb_devc *devc) in pci_intr() argument
198 int src = inb(devc->pcibase+0x1A); in pci_intr()
201 sb_intr(devc); in pci_intr()
206 sb_devc *devc = dev_id; in sbintr() local
208 devc->irq_ok = 1; in sbintr()
210 switch (devc->model) { in sbintr()
212 pci_intr (devc); in sbintr()
216 ess_intr (devc); in sbintr()
219 sb_intr (devc); in sbintr()
225 int sb_dsp_reset(sb_devc * devc) in sb_dsp_reset() argument
229 if (devc->model == MDL_ESS) return ess_dsp_reset (devc); in sb_dsp_reset()
250 static void dsp_get_vers(sb_devc * devc) in dsp_get_vers() argument
257 spin_lock_irqsave(&devc->lock, flags); in dsp_get_vers()
258 devc->major = devc->minor = 0; in dsp_get_vers()
259 sb_dsp_command(devc, 0xe1); /* Get version */ in dsp_get_vers()
265 if (devc->major == 0) in dsp_get_vers()
266 devc->major = inb(DSP_READ); in dsp_get_vers()
269 devc->minor = inb(DSP_READ); in dsp_get_vers()
274 spin_unlock_irqrestore(&devc->lock, flags); in dsp_get_vers()
275 DDB(printk("DSP version %d.%02d\n", devc->major, devc->minor)); in dsp_get_vers()
278 static int sb16_set_dma_hw(sb_devc * devc) in sb16_set_dma_hw() argument
282 if (devc->dma8 != 0 && devc->dma8 != 1 && devc->dma8 != 3) in sb16_set_dma_hw()
284 printk(KERN_ERR "SB16: Invalid 8 bit DMA (%d)\n", devc->dma8); in sb16_set_dma_hw()
287 bits = (1 << devc->dma8); in sb16_set_dma_hw()
289 if (devc->dma16 >= 5 && devc->dma16 <= 7) in sb16_set_dma_hw()
290 bits |= (1 << devc->dma16); in sb16_set_dma_hw()
292 sb_setmixer(devc, DMA_NR, bits); in sb16_set_dma_hw()
296 static void sb16_set_mpu_port(sb_devc * devc, struct address_info *hw_config) in sb16_set_mpu_port() argument
301 unsigned char bits = sb_getmixer(devc, 0x84) & ~0x06; in sb16_set_mpu_port()
306 sb_setmixer(devc, 0x84, bits | 0x04); in sb16_set_mpu_port()
310 sb_setmixer(devc, 0x84, bits | 0x00); in sb16_set_mpu_port()
314 sb_setmixer(devc, 0x84, bits | 0x02); /* Disable MPU */ in sb16_set_mpu_port()
319 static int sb16_set_irq_hw(sb_devc * devc, int level) in sb16_set_irq_hw() argument
341 sb_setmixer(devc, IRQ_NR, ival); in sb16_set_irq_hw()
345 static void relocate_Jazz16(sb_devc * devc, struct address_info *hw_config) in relocate_Jazz16() argument
380 static int init_Jazz16(sb_devc * devc, struct address_info *hw_config) in init_Jazz16() argument
388 if (!sb_dsp_command(devc, 0xfa)) in init_Jazz16()
391 if (sb_dsp_get_byte(devc) != 0x12) in init_Jazz16()
417 devc->dma16 = hw_config->dma2; in init_Jazz16()
419 if (!sb_dsp_command(devc, 0xfb)) in init_Jazz16()
422 if (!sb_dsp_command(devc, jazz_dma_bits[hw_config->dma] | in init_Jazz16()
426 if (!sb_dsp_command(devc, jazz_irq_bits[hw_config->irq])) in init_Jazz16()
432 devc->model = MDL_JAZZ; in init_Jazz16()
436 devc->caps |= SB_NO_MIDI; in init_Jazz16()
440 static void relocate_ess1688(sb_devc * devc) in relocate_ess1688() argument
444 switch (devc->base) in relocate_ess1688()
484 inb(devc->base); in relocate_ess1688()
485 if (sb_dsp_reset(devc)) /* Bingo */ in relocate_ess1688()
503 sb_devc *devc = &sb_info; in sb_dsp_detect() local
508 if(sbmo) memcpy(&devc->sbmo, sbmo, sizeof(struct sb_module_options)); in sb_dsp_detect()
520 spin_lock_init(&devc->lock); in sb_dsp_detect()
521 devc->type = hw_config->card_subtype; in sb_dsp_detect()
523 devc->base = hw_config->io_base; in sb_dsp_detect()
524 devc->irq = hw_config->irq; in sb_dsp_detect()
525 devc->dma8 = hw_config->dma; in sb_dsp_detect()
527 devc->dma16 = -1; in sb_dsp_detect()
528 devc->pcibase = pciio; in sb_dsp_detect()
532 devc->model = MDL_ESSPCI; in sb_dsp_detect()
533 devc->caps |= SB_PCI_IRQ; in sb_dsp_detect()
540 devc->model = MDL_YMPCI; in sb_dsp_detect()
541 devc->caps |= SB_PCI_IRQ; in sb_dsp_detect()
548 if (devc->sbmo.acer) in sb_dsp_detect()
552 spin_lock_irqsave(&devc->lock, flags); in sb_dsp_detect()
553 inb(devc->base + 0x09); in sb_dsp_detect()
554 inb(devc->base + 0x09); in sb_dsp_detect()
555 inb(devc->base + 0x09); in sb_dsp_detect()
556 inb(devc->base + 0x0b); in sb_dsp_detect()
557 inb(devc->base + 0x09); in sb_dsp_detect()
558 inb(devc->base + 0x0b); in sb_dsp_detect()
559 inb(devc->base + 0x09); in sb_dsp_detect()
560 inb(devc->base + 0x09); in sb_dsp_detect()
561 inb(devc->base + 0x0b); in sb_dsp_detect()
562 inb(devc->base + 0x09); in sb_dsp_detect()
563 inb(devc->base + 0x00); in sb_dsp_detect()
564 spin_unlock_irqrestore(&devc->lock, flags); in sb_dsp_detect()
570 if (sb_dsp_reset(devc)) in sb_dsp_detect()
571 dsp_get_vers(devc); in sb_dsp_detect()
573 devc->major = 0; in sb_dsp_detect()
575 if (devc->type == 0 || devc->type == MDL_JAZZ || devc->type == MDL_SMW) in sb_dsp_detect()
576 if (devc->major == 0 || (devc->major == 3 && devc->minor == 1)) in sb_dsp_detect()
577 relocate_Jazz16(devc, hw_config); in sb_dsp_detect()
579 if (devc->major == 0 && (devc->type == MDL_ESS || devc->type == 0)) in sb_dsp_detect()
580 relocate_ess1688(devc); in sb_dsp_detect()
582 if (!sb_dsp_reset(devc)) in sb_dsp_detect()
590 if (devc->major == 0) in sb_dsp_detect()
591 dsp_get_vers(devc); in sb_dsp_detect()
593 if (devc->major == 3 && devc->minor == 1) in sb_dsp_detect()
595 if (devc->type == MDL_AZTECH) /* SG Washington? */ in sb_dsp_detect()
597 if (sb_dsp_command(devc, 0x09)) in sb_dsp_detect()
598 if (sb_dsp_command(devc, 0x00)) /* Enter WSS mode */ in sb_dsp_detect()
605 devc->caps = SB_NO_AUDIO | SB_NO_MIDI; /* Mixer only */ in sb_dsp_detect()
606 devc->model = MDL_AZTECH; in sb_dsp_detect()
611 if(devc->type == MDL_ESSPCI) in sb_dsp_detect()
612 devc->model = MDL_ESSPCI; in sb_dsp_detect()
614 if(devc->type == MDL_YMPCI) in sb_dsp_detect()
617 devc->model = MDL_YMPCI; in sb_dsp_detect()
625 detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL); in sb_dsp_detect()
631 …MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base… in sb_dsp_detect()
637 sb_devc *devc; in sb_dsp_init() local
653 devc = detected_devc; in sb_dsp_init()
656 if (devc->base != hw_config->io_base) in sb_dsp_init()
659 release_region(devc->base, 16); in sb_dsp_init()
666 devc->caps = hw_config->driver_use_1; in sb_dsp_init()
668 if (!((devc->caps & SB_NO_AUDIO) && (devc->caps & SB_NO_MIDI)) && hw_config->irq > 0) in sb_dsp_init()
676 int i=(devc->caps&SB_PCI_IRQ)?IRQF_SHARED:0; in sb_dsp_init()
678 if (request_irq(hw_config->irq, sbintr, i, "soundblaster", devc) < 0) in sb_dsp_init()
681 release_region(devc->base, 16); in sb_dsp_init()
684 devc->irq_ok = 0; in sb_dsp_init()
686 if (devc->major == 4) in sb_dsp_init()
687 if (!sb16_set_irq_hw(devc, devc->irq)) /* Unsupported IRQ */ in sb_dsp_init()
689 free_irq(devc->irq, devc); in sb_dsp_init()
690 release_region(devc->base, 16); in sb_dsp_init()
693 if ((devc->type == 0 || devc->type == MDL_ESS) && in sb_dsp_init()
694 devc->major == 3 && devc->minor == 1) in sb_dsp_init()
696 if ((devc->type != 0 && devc->type != MDL_ESS) || in sb_dsp_init()
697 !ess_init(devc, hw_config)) in sb_dsp_init()
699 if ((devc->type != 0 && devc->type != MDL_JAZZ && in sb_dsp_init()
700 devc->type != MDL_SMW) || !init_Jazz16(devc, hw_config)) in sb_dsp_init()
706 if (devc->major == 4 && devc->minor <= 11 ) /* Won't work */ in sb_dsp_init()
707 devc->irq_ok = 1; in sb_dsp_init()
712 for (n = 0; n < 3 && devc->irq_ok == 0; n++) in sb_dsp_init()
714 if (sb_dsp_command(devc, 0xf2)) /* Cause interrupt immediately */ in sb_dsp_init()
718 for (i = 0; !devc->irq_ok && i < 10000; i++); in sb_dsp_init()
721 if (!devc->irq_ok) in sb_dsp_init()
722 printk(KERN_WARNING "sb: Interrupt test on IRQ%d failed - Probable IRQ conflict\n", devc->irq); in sb_dsp_init()
725 DDB(printk("IRQ test OK (IRQ%d)\n", devc->irq)); in sb_dsp_init()
730 last_sb = devc; in sb_dsp_init()
732 switch (devc->major) in sb_dsp_init()
735 devc->model = hw_config->card_subtype = MDL_SB1; in sb_dsp_init()
739 if (devc->minor == 0) in sb_dsp_init()
740 devc->model = hw_config->card_subtype = MDL_SB2; in sb_dsp_init()
742 devc->model = hw_config->card_subtype = MDL_SB201; in sb_dsp_init()
746 switch (devc->model) { in sb_dsp_init()
748 devc->model = hw_config->card_subtype = MDL_SBPRO; in sb_dsp_init()
753 ess_dsp_init(devc, hw_config); in sb_dsp_init()
759 devc->model = hw_config->card_subtype = MDL_SB16; in sb_dsp_init()
767 if ((devc->minor == 2) && sb_getmixer(devc,0x3c) && sb_getmixer(devc,0x4c)) in sb_dsp_init()
769 mixer30 = sb_getmixer(devc,0x30); in sb_dsp_init()
770 sb_setmixer(devc,0x22,(mixer22=sb_getmixer(devc,0x22)) & 0x0f); in sb_dsp_init()
771 sb_setmixer(devc,0x30,0xff); in sb_dsp_init()
774 if ((sb_getmixer(devc,0x30) != 0xff) || ((sb_getmixer(devc,0x22) & 0xf0) != 0x10)) in sb_dsp_init()
776 devc->submodel = SUBMDL_ALS100; in sb_dsp_init()
782 sb_setmixer(devc,0x3c,0x1f); /* Enable all inputs */ in sb_dsp_init()
783 sb_setmixer(devc,0x4c,0x1f); in sb_dsp_init()
784 sb_setmixer(devc,0x22,mixer22); /* Restore 0x22 to original value */ in sb_dsp_init()
785 devc->submodel = SUBMDL_ALS007; in sb_dsp_init()
789 sb_setmixer(devc,0x30,mixer30); in sb_dsp_init()
795 devc->dma16 = devc->dma8; in sb_dsp_init()
799 devc->dma16 = devc->dma8; in sb_dsp_init()
802 devc->dma16 = hw_config->dma2; in sb_dsp_init()
804 if(!sb16_set_dma_hw(devc)) { in sb_dsp_init()
805 free_irq(devc->irq, devc); in sb_dsp_init()
810 devc->caps |= SB_NO_MIDI; in sb_dsp_init()
813 if (!(devc->caps & SB_NO_MIXER)) in sb_dsp_init()
814 if (devc->major == 3 || devc->major == 4) in sb_dsp_init()
815 sb_mixer_init(devc, owner); in sb_dsp_init()
817 if (!(devc->caps & SB_NO_MIDI)) in sb_dsp_init()
818 sb_dsp_midi_init(devc, owner); in sb_dsp_init()
823 sprintf(name, "%s (%d.%02d)", hw_config->name, devc->major, devc->minor); in sb_dsp_init()
833 if (devc->model <= MDL_SBPRO) in sb_dsp_init()
835 …if (devc->major == 3 && devc->minor != 1) /* "True" SB Pro should have v3.1 (rare ones may have 3.… in sb_dsp_init()
842 else if (!sb_be_quiet && devc->model == MDL_SBPRO) in sb_dsp_init()
844 …N_INFO "SB DSP version is just %d.%02d which means that your card is\n", devc->major, devc->minor); in sb_dsp_init()
849 hw_config->card_subtype = devc->model; in sb_dsp_init()
850 hw_config->slots[0]=devc->dev; in sb_dsp_init()
851 last_devc = devc; /* For SB MPU detection */ in sb_dsp_init()
853 if (!(devc->caps & SB_NO_AUDIO) && devc->dma8 >= 0) in sb_dsp_init()
855 if (sound_alloc_dma(devc->dma8, "SoundBlaster8")) in sb_dsp_init()
857 printk(KERN_WARNING "Sound Blaster: Can't allocate 8 bit DMA channel %d\n", devc->dma8); in sb_dsp_init()
859 if (devc->dma16 >= 0 && devc->dma16 != devc->dma8) in sb_dsp_init()
861 if (sound_alloc_dma(devc->dma16, "SoundBlaster16")) in sb_dsp_init()
862 printk(KERN_WARNING "Sound Blaster: can't allocate 16 bit DMA channel %d.\n", devc->dma16); in sb_dsp_init()
864 sb_audio_init(devc, name, owner); in sb_dsp_init()
865 hw_config->slots[0]=devc->dev; in sb_dsp_init()
879 sb_devc *devc; in sb_dsp_unload() local
881 devc = audio_devs[hw_config->slots[0]]->devc; in sb_dsp_unload()
883 if (devc && devc->base == hw_config->io_base) in sb_dsp_unload()
885 if ((devc->model & MDL_ESS) && devc->pcibase) in sb_dsp_unload()
886 release_region(devc->pcibase, 8); in sb_dsp_unload()
888 release_region(devc->base, 16); in sb_dsp_unload()
890 if (!(devc->caps & SB_NO_AUDIO)) in sb_dsp_unload()
892 sound_free_dma(devc->dma8); in sb_dsp_unload()
893 if (devc->dma16 >= 0) in sb_dsp_unload()
894 sound_free_dma(devc->dma16); in sb_dsp_unload()
896 if (!(devc->caps & SB_NO_AUDIO && devc->caps & SB_NO_MIDI)) in sb_dsp_unload()
898 if (devc->irq > 0) in sb_dsp_unload()
899 free_irq(devc->irq, devc); in sb_dsp_unload()
901 sb_mixer_unload(devc); in sb_dsp_unload()
906 sound_unload_mididev(devc->my_mididev); in sb_dsp_unload()
907 sound_unload_audiodev(devc->dev); in sb_dsp_unload()
909 kfree(devc); in sb_dsp_unload()
924 void sb_setmixer(sb_devc * devc, unsigned int port, unsigned int value) in sb_setmixer() argument
928 if (devc->model == MDL_ESS) { in sb_setmixer()
929 ess_setmixer (devc, port, value); in sb_setmixer()
933 spin_lock_irqsave(&devc->lock, flags); in sb_setmixer()
940 spin_unlock_irqrestore(&devc->lock, flags); in sb_setmixer()
943 unsigned int sb_getmixer(sb_devc * devc, unsigned int port) in sb_getmixer() argument
948 if (devc->model == MDL_ESS) return ess_getmixer (devc, port); in sb_getmixer()
950 spin_lock_irqsave(&devc->lock, flags); in sb_getmixer()
957 spin_unlock_irqrestore(&devc->lock, flags); in sb_getmixer()
963 (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val) in sb_chgmixer() argument
967 value = sb_getmixer(devc, reg); in sb_chgmixer()
969 sb_setmixer(devc, reg, value); in sb_chgmixer()
976 static void smw_putmem(sb_devc * devc, int base, int addr, unsigned char val) in smw_putmem() argument
989 static unsigned char smw_getmem(sb_devc * devc, int base, int addr) in smw_getmem() argument
1004 static int smw_midi_init(sb_devc * devc, struct address_info *hw_config) in smw_midi_init() argument
1027 smw_putmem(devc, mp_base, 0, 0x00); in smw_midi_init()
1028 smw_putmem(devc, mp_base, 1, 0xff); in smw_midi_init()
1031 if (smw_getmem(devc, mp_base, 0) != 0x00 || smw_getmem(devc, mp_base, 1) != 0xff) in smw_midi_init()
1033 …o microcontroller RAM detected (%02x, %02x)\n", smw_getmem(devc, mp_base, 0), smw_getmem(devc, mp_… in smw_midi_init()
1040 devc->model = MDL_SMW; in smw_midi_init()
1041 smw_mixer_init(devc); in smw_midi_init()
1062 smw_putmem(devc, mp_base, i, smw_ucode[i]); in smw_midi_init()
1069 if (smw_getmem(devc, mp_base, i) != smw_ucode[i]) in smw_midi_init()
1109 static int init_Jazz16_midi(sb_devc * devc, struct address_info *hw_config) in init_Jazz16_midi() argument
1112 int sb_base = devc->base; in init_Jazz16_midi()
1167 smw_midi_init(devc, hw_config); in init_Jazz16_midi()
1169 if (!sb_dsp_command(devc, 0xfb)) in init_Jazz16_midi()
1172 if (!sb_dsp_command(devc, jazz_dma_bits[devc->dma8] | in init_Jazz16_midi()
1173 (jazz_dma_bits[devc->dma16] << 4))) in init_Jazz16_midi()
1176 if (!sb_dsp_command(devc, jazz_irq_bits[devc->irq] | in init_Jazz16_midi()
1185 sb_devc *devc = last_devc; in probe_sbmpu() local
1198 if(devc->model == MDL_SB16 && devc->minor >= 12) in probe_sbmpu()
1200 unsigned char bits = sb_getmixer(devc, 0x84) & ~0x06; in probe_sbmpu()
1201 sb_setmixer(devc, 0x84, bits | 0x02); /* Disable MPU */ in probe_sbmpu()
1207 if (devc->model == MDL_ESS) in probe_sbmpu()
1215 if (!ess_midi_init(devc, hw_config)) { in probe_sbmpu()
1220 devc->midi_irq_cookie = NULL; in probe_sbmpu()
1233 switch (devc->model) in probe_sbmpu()
1242 if (hw_config->irq < 3 || hw_config->irq == devc->irq) in probe_sbmpu()
1243 hw_config->irq = -devc->irq; in probe_sbmpu()
1244 if (devc->minor > 12) /* What is Vibra's version??? */ in probe_sbmpu()
1245 sb16_set_mpu_port(devc, hw_config); in probe_sbmpu()
1249 if (hw_config->irq < 3 || hw_config->irq == devc->irq) in probe_sbmpu()
1250 hw_config->irq = -devc->irq; in probe_sbmpu()
1251 if (!init_Jazz16_midi(devc, hw_config)) in probe_sbmpu()
1265 last_sb->midi_irq_cookie=midi_devs[hw_config->slots[4]]->devc; in probe_sbmpu()