Lines Matching refs:sonic
61 #define SV_REG(sonic, x) ((sonic)->enh_port + SV_REG_##x) argument
251 static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic, in snd_sonicvibes_setdmaa() argument
256 outl(addr, sonic->dmaa_port + SV_DMA_ADDR0); in snd_sonicvibes_setdmaa()
257 outl(count, sonic->dmaa_port + SV_DMA_COUNT0); in snd_sonicvibes_setdmaa()
258 outb(0x18, sonic->dmaa_port + SV_DMA_MODE); in snd_sonicvibes_setdmaa()
260 dev_dbg(sonic->card->dev, "program dmaa: addr = 0x%x, paddr = 0x%x\n", in snd_sonicvibes_setdmaa()
261 addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); in snd_sonicvibes_setdmaa()
265 static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic, in snd_sonicvibes_setdmac() argument
272 outl(addr, sonic->dmac_port + SV_DMA_ADDR0); in snd_sonicvibes_setdmac()
273 outl(count, sonic->dmac_port + SV_DMA_COUNT0); in snd_sonicvibes_setdmac()
274 outb(0x14, sonic->dmac_port + SV_DMA_MODE); in snd_sonicvibes_setdmac()
276 dev_dbg(sonic->card->dev, "program dmac: addr = 0x%x, paddr = 0x%x\n", in snd_sonicvibes_setdmac()
277 addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); in snd_sonicvibes_setdmac()
281 static inline unsigned int snd_sonicvibes_getdmaa(struct sonicvibes * sonic) in snd_sonicvibes_getdmaa() argument
283 return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1; in snd_sonicvibes_getdmaa()
286 static inline unsigned int snd_sonicvibes_getdmac(struct sonicvibes * sonic) in snd_sonicvibes_getdmac() argument
289 return ((inl(sonic->dmac_port + SV_DMA_COUNT0) & 0xffffff) + 1) << 1; in snd_sonicvibes_getdmac()
292 static void snd_sonicvibes_out1(struct sonicvibes * sonic, in snd_sonicvibes_out1() argument
296 outb(reg, SV_REG(sonic, INDEX)); in snd_sonicvibes_out1()
298 outb(value, SV_REG(sonic, DATA)); in snd_sonicvibes_out1()
302 static void snd_sonicvibes_out(struct sonicvibes * sonic, in snd_sonicvibes_out() argument
308 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_out()
309 outb(reg, SV_REG(sonic, INDEX)); in snd_sonicvibes_out()
311 outb(value, SV_REG(sonic, DATA)); in snd_sonicvibes_out()
313 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_out()
316 static unsigned char snd_sonicvibes_in1(struct sonicvibes * sonic, unsigned char reg) in snd_sonicvibes_in1() argument
320 outb(reg, SV_REG(sonic, INDEX)); in snd_sonicvibes_in1()
322 value = inb(SV_REG(sonic, DATA)); in snd_sonicvibes_in1()
327 static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char reg) in snd_sonicvibes_in() argument
332 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_in()
333 outb(reg, SV_REG(sonic, INDEX)); in snd_sonicvibes_in()
335 value = inb(SV_REG(sonic, DATA)); in snd_sonicvibes_in()
337 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_in()
342 static void snd_sonicvibes_debug(struct sonicvibes * sonic)
344 dev_dbg(sonic->card->dev,
346 inb(SV_REG(sonic, INDEX)), inb(SV_REG(sonic, STATUS)));
347 dev_dbg(sonic->card->dev,
349 snd_sonicvibes_in(sonic, 0x00), snd_sonicvibes_in(sonic, 0x20));
350 dev_dbg(sonic->card->dev,
352 snd_sonicvibes_in(sonic, 0x01), snd_sonicvibes_in(sonic, 0x21));
353 dev_dbg(sonic->card->dev,
355 snd_sonicvibes_in(sonic, 0x02), snd_sonicvibes_in(sonic, 0x22));
356 dev_dbg(sonic->card->dev,
358 snd_sonicvibes_in(sonic, 0x03), snd_sonicvibes_in(sonic, 0x23));
359 dev_dbg(sonic->card->dev,
361 snd_sonicvibes_in(sonic, 0x04), snd_sonicvibes_in(sonic, 0x24));
362 dev_dbg(sonic->card->dev,
364 snd_sonicvibes_in(sonic, 0x05), snd_sonicvibes_in(sonic, 0x25));
365 dev_dbg(sonic->card->dev,
367 snd_sonicvibes_in(sonic, 0x06), snd_sonicvibes_in(sonic, 0x26));
368 dev_dbg(sonic->card->dev,
370 snd_sonicvibes_in(sonic, 0x07), snd_sonicvibes_in(sonic, 0x27));
371 dev_dbg(sonic->card->dev,
373 snd_sonicvibes_in(sonic, 0x08), snd_sonicvibes_in(sonic, 0x28));
374 dev_dbg(sonic->card->dev,
376 snd_sonicvibes_in(sonic, 0x09), snd_sonicvibes_in(sonic, 0x29));
377 dev_dbg(sonic->card->dev,
379 snd_sonicvibes_in(sonic, 0x0a), snd_sonicvibes_in(sonic, 0x2a));
380 dev_dbg(sonic->card->dev,
382 snd_sonicvibes_in(sonic, 0x0b), snd_sonicvibes_in(sonic, 0x2b));
383 dev_dbg(sonic->card->dev,
385 snd_sonicvibes_in(sonic, 0x0c), snd_sonicvibes_in(sonic, 0x2c));
386 dev_dbg(sonic->card->dev,
388 snd_sonicvibes_in(sonic, 0x0d), snd_sonicvibes_in(sonic, 0x2d));
389 dev_dbg(sonic->card->dev,
391 snd_sonicvibes_in(sonic, 0x0e), snd_sonicvibes_in(sonic, 0x2e));
392 dev_dbg(sonic->card->dev,
394 snd_sonicvibes_in(sonic, 0x0f), snd_sonicvibes_in(sonic, 0x2f));
395 dev_dbg(sonic->card->dev,
397 snd_sonicvibes_in(sonic, 0x10), snd_sonicvibes_in(sonic, 0x30));
398 dev_dbg(sonic->card->dev,
400 snd_sonicvibes_in(sonic, 0x11), snd_sonicvibes_in(sonic, 0x31));
401 dev_dbg(sonic->card->dev,
403 snd_sonicvibes_in(sonic, 0x12), snd_sonicvibes_in(sonic, 0x32));
404 dev_dbg(sonic->card->dev,
406 snd_sonicvibes_in(sonic, 0x13), snd_sonicvibes_in(sonic, 0x33));
407 dev_dbg(sonic->card->dev,
409 snd_sonicvibes_in(sonic, 0x14), snd_sonicvibes_in(sonic, 0x34));
410 dev_dbg(sonic->card->dev,
412 snd_sonicvibes_in(sonic, 0x15), snd_sonicvibes_in(sonic, 0x35));
413 dev_dbg(sonic->card->dev,
415 snd_sonicvibes_in(sonic, 0x16), snd_sonicvibes_in(sonic, 0x36));
416 dev_dbg(sonic->card->dev,
418 snd_sonicvibes_in(sonic, 0x17), snd_sonicvibes_in(sonic, 0x37));
419 dev_dbg(sonic->card->dev,
421 snd_sonicvibes_in(sonic, 0x18), snd_sonicvibes_in(sonic, 0x38));
422 dev_dbg(sonic->card->dev,
424 snd_sonicvibes_in(sonic, 0x19), snd_sonicvibes_in(sonic, 0x39));
425 dev_dbg(sonic->card->dev,
427 snd_sonicvibes_in(sonic, 0x1a), snd_sonicvibes_in(sonic, 0x3a));
428 dev_dbg(sonic->card->dev,
430 snd_sonicvibes_in(sonic, 0x1b), snd_sonicvibes_in(sonic, 0x3b));
431 dev_dbg(sonic->card->dev,
433 snd_sonicvibes_in(sonic, 0x1c), snd_sonicvibes_in(sonic, 0x3c));
434 dev_dbg(sonic->card->dev,
436 snd_sonicvibes_in(sonic, 0x1d), snd_sonicvibes_in(sonic, 0x3d));
437 dev_dbg(sonic->card->dev,
439 snd_sonicvibes_in(sonic, 0x1e), snd_sonicvibes_in(sonic, 0x3e));
440 dev_dbg(sonic->card->dev,
442 snd_sonicvibes_in(sonic, 0x1f), snd_sonicvibes_in(sonic, 0x3f));
447 static void snd_sonicvibes_setfmt(struct sonicvibes * sonic, in snd_sonicvibes_setfmt() argument
453 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_setfmt()
454 outb(SV_MCE | SV_IREG_DMA_DATA_FMT, SV_REG(sonic, INDEX)); in snd_sonicvibes_setfmt()
456 sonic->format = inb(SV_REG(sonic, DATA)); in snd_sonicvibes_setfmt()
459 sonic->format = (sonic->format & mask) | value; in snd_sonicvibes_setfmt()
460 outb(sonic->format, SV_REG(sonic, DATA)); in snd_sonicvibes_setfmt()
462 outb(0, SV_REG(sonic, INDEX)); in snd_sonicvibes_setfmt()
464 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_setfmt()
498 dev_dbg(sonic->card->dev, in snd_sonicvibes_pll()
500 dev_dbg(sonic->card->dev, in snd_sonicvibes_pll()
505 static void snd_sonicvibes_setpll(struct sonicvibes * sonic, in snd_sonicvibes_setpll() argument
513 if (sonic != NULL) { in snd_sonicvibes_setpll()
514 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_setpll()
515 snd_sonicvibes_out1(sonic, reg, m); in snd_sonicvibes_setpll()
516 snd_sonicvibes_out1(sonic, reg + 1, r | n); in snd_sonicvibes_setpll()
517 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_setpll()
521 static void snd_sonicvibes_set_adc_rate(struct sonicvibes * sonic, unsigned int rate) in snd_sonicvibes_set_adc_rate() argument
534 snd_sonicvibes_setpll(sonic, SV_IREG_ADC_PLL, rate); in snd_sonicvibes_set_adc_rate()
536 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_set_adc_rate()
537 snd_sonicvibes_out1(sonic, SV_IREG_ADC_ALT_RATE, (div - 1) << 4); in snd_sonicvibes_set_adc_rate()
538 snd_sonicvibes_out1(sonic, SV_IREG_ADC_CLOCK, clock); in snd_sonicvibes_set_adc_rate()
539 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_set_adc_rate()
567 static void snd_sonicvibes_set_dac_rate(struct sonicvibes * sonic, unsigned int rate) in snd_sonicvibes_set_dac_rate() argument
575 spin_lock_irqsave(&sonic->reg_lock, flags); in snd_sonicvibes_set_dac_rate()
576 snd_sonicvibes_out1(sonic, SV_IREG_PCM_RATE_HIGH, div >> 8); in snd_sonicvibes_set_dac_rate()
577 snd_sonicvibes_out1(sonic, SV_IREG_PCM_RATE_LOW, div); in snd_sonicvibes_set_dac_rate()
578 spin_unlock_irqrestore(&sonic->reg_lock, flags); in snd_sonicvibes_set_dac_rate()
581 static int snd_sonicvibes_trigger(struct sonicvibes * sonic, int what, int cmd) in snd_sonicvibes_trigger() argument
585 spin_lock(&sonic->reg_lock); in snd_sonicvibes_trigger()
587 if (!(sonic->enable & what)) { in snd_sonicvibes_trigger()
588 sonic->enable |= what; in snd_sonicvibes_trigger()
589 snd_sonicvibes_out1(sonic, SV_IREG_PC_ENABLE, sonic->enable); in snd_sonicvibes_trigger()
592 if (sonic->enable & what) { in snd_sonicvibes_trigger()
593 sonic->enable &= ~what; in snd_sonicvibes_trigger()
594 snd_sonicvibes_out1(sonic, SV_IREG_PC_ENABLE, sonic->enable); in snd_sonicvibes_trigger()
599 spin_unlock(&sonic->reg_lock); in snd_sonicvibes_trigger()
605 struct sonicvibes *sonic = dev_id; in snd_sonicvibes_interrupt() local
608 status = inb(SV_REG(sonic, STATUS)); in snd_sonicvibes_interrupt()
612 outb(sonic->irqmask = ~0, SV_REG(sonic, IRQMASK)); in snd_sonicvibes_interrupt()
613 dev_err(sonic->card->dev, in snd_sonicvibes_interrupt()
617 if (sonic->pcm) { in snd_sonicvibes_interrupt()
619 snd_pcm_period_elapsed(sonic->playback_substream); in snd_sonicvibes_interrupt()
621 snd_pcm_period_elapsed(sonic->capture_substream); in snd_sonicvibes_interrupt()
623 if (sonic->rmidi) { in snd_sonicvibes_interrupt()
625 snd_mpu401_uart_interrupt(irq, sonic->rmidi->private_data); in snd_sonicvibes_interrupt()
631 spin_lock(&sonic->reg_lock); in snd_sonicvibes_interrupt()
632 udreg = snd_sonicvibes_in1(sonic, SV_IREG_UD_BUTTON); in snd_sonicvibes_interrupt()
636 oleft = mleft = snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ANALOG); in snd_sonicvibes_interrupt()
637 oright = mright = snd_sonicvibes_in1(sonic, SV_IREG_RIGHT_ANALOG); in snd_sonicvibes_interrupt()
656 snd_sonicvibes_out1(sonic, SV_IREG_LEFT_ANALOG, oleft); in snd_sonicvibes_interrupt()
657 snd_sonicvibes_out1(sonic, SV_IREG_RIGHT_ANALOG, oright); in snd_sonicvibes_interrupt()
658 spin_unlock(&sonic->reg_lock); in snd_sonicvibes_interrupt()
659 snd_ctl_notify(sonic->card, SNDRV_CTL_EVENT_MASK_VALUE, &sonic->master_mute->id); in snd_sonicvibes_interrupt()
660 snd_ctl_notify(sonic->card, SNDRV_CTL_EVENT_MASK_VALUE, &sonic->master_volume->id); in snd_sonicvibes_interrupt()
672 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_playback_trigger() local
673 return snd_sonicvibes_trigger(sonic, 1, cmd); in snd_sonicvibes_playback_trigger()
679 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_capture_trigger() local
680 return snd_sonicvibes_trigger(sonic, 2, cmd); in snd_sonicvibes_capture_trigger()
685 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_playback_prepare() local
691 sonic->p_dma_size = size; in snd_sonicvibes_playback_prepare()
697 snd_sonicvibes_setfmt(sonic, ~3, fmt); in snd_sonicvibes_playback_prepare()
698 snd_sonicvibes_set_dac_rate(sonic, runtime->rate); in snd_sonicvibes_playback_prepare()
699 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_playback_prepare()
700 snd_sonicvibes_setdmaa(sonic, runtime->dma_addr, size); in snd_sonicvibes_playback_prepare()
701 snd_sonicvibes_out1(sonic, SV_IREG_DMA_A_UPPER, count >> 8); in snd_sonicvibes_playback_prepare()
702 snd_sonicvibes_out1(sonic, SV_IREG_DMA_A_LOWER, count); in snd_sonicvibes_playback_prepare()
703 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_playback_prepare()
709 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_capture_prepare() local
715 sonic->c_dma_size = size; in snd_sonicvibes_capture_prepare()
722 snd_sonicvibes_setfmt(sonic, ~0x30, fmt); in snd_sonicvibes_capture_prepare()
723 snd_sonicvibes_set_adc_rate(sonic, runtime->rate); in snd_sonicvibes_capture_prepare()
724 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_capture_prepare()
725 snd_sonicvibes_setdmac(sonic, runtime->dma_addr, size); in snd_sonicvibes_capture_prepare()
726 snd_sonicvibes_out1(sonic, SV_IREG_DMA_C_UPPER, count >> 8); in snd_sonicvibes_capture_prepare()
727 snd_sonicvibes_out1(sonic, SV_IREG_DMA_C_LOWER, count); in snd_sonicvibes_capture_prepare()
728 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_capture_prepare()
734 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_playback_pointer() local
737 if (!(sonic->enable & 1)) in snd_sonicvibes_playback_pointer()
739 ptr = sonic->p_dma_size - snd_sonicvibes_getdmaa(sonic); in snd_sonicvibes_playback_pointer()
745 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_capture_pointer() local
747 if (!(sonic->enable & 2)) in snd_sonicvibes_capture_pointer()
749 ptr = sonic->c_dma_size - snd_sonicvibes_getdmac(sonic); in snd_sonicvibes_capture_pointer()
793 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_playback_open() local
796 sonic->mode |= SV_MODE_PLAY; in snd_sonicvibes_playback_open()
797 sonic->playback_substream = substream; in snd_sonicvibes_playback_open()
805 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_capture_open() local
808 sonic->mode |= SV_MODE_CAPTURE; in snd_sonicvibes_capture_open()
809 sonic->capture_substream = substream; in snd_sonicvibes_capture_open()
818 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_playback_close() local
820 sonic->playback_substream = NULL; in snd_sonicvibes_playback_close()
821 sonic->mode &= ~SV_MODE_PLAY; in snd_sonicvibes_playback_close()
827 struct sonicvibes *sonic = snd_pcm_substream_chip(substream); in snd_sonicvibes_capture_close() local
829 sonic->capture_substream = NULL; in snd_sonicvibes_capture_close()
830 sonic->mode &= ~SV_MODE_CAPTURE; in snd_sonicvibes_capture_close()
850 static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device) in snd_sonicvibes_pcm() argument
855 err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm); in snd_sonicvibes_pcm()
864 pcm->private_data = sonic; in snd_sonicvibes_pcm()
867 sonic->pcm = pcm; in snd_sonicvibes_pcm()
870 &sonic->pci->dev, 64*1024, 128*1024); in snd_sonicvibes_pcm()
895 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_get_mux() local
897 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_get_mux()
898 …ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT… in snd_sonicvibes_get_mux()
899 …ucontrol->value.enumerated.item[1] = ((snd_sonicvibes_in1(sonic, SV_IREG_RIGHT_ADC) & SV_RECSRC_OU… in snd_sonicvibes_get_mux()
900 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_get_mux()
906 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_put_mux() local
915 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_put_mux()
916 oval1 = snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC); in snd_sonicvibes_put_mux()
917 oval2 = snd_sonicvibes_in1(sonic, SV_IREG_RIGHT_ADC); in snd_sonicvibes_put_mux()
921 snd_sonicvibes_out1(sonic, SV_IREG_LEFT_ADC, left); in snd_sonicvibes_put_mux()
922 snd_sonicvibes_out1(sonic, SV_IREG_RIGHT_ADC, right); in snd_sonicvibes_put_mux()
923 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_put_mux()
946 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_get_single() local
952 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_get_single()
953 ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, reg)>> shift) & mask; in snd_sonicvibes_get_single()
954 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_get_single()
962 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_put_single() local
974 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_put_single()
975 oval = snd_sonicvibes_in1(sonic, reg); in snd_sonicvibes_put_single()
978 snd_sonicvibes_out1(sonic, reg, val); in snd_sonicvibes_put_single()
979 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_put_single()
1002 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_get_double() local
1010 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_get_double()
1011 ucontrol->value.integer.value[0] = (snd_sonicvibes_in1(sonic, left_reg) >> shift_left) & mask; in snd_sonicvibes_get_double()
1012 ucontrol->value.integer.value[1] = (snd_sonicvibes_in1(sonic, right_reg) >> shift_right) & mask; in snd_sonicvibes_get_double()
1013 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_get_double()
1023 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_put_double() local
1041 spin_lock_irq(&sonic->reg_lock); in snd_sonicvibes_put_double()
1042 oval1 = snd_sonicvibes_in1(sonic, left_reg); in snd_sonicvibes_put_double()
1043 oval2 = snd_sonicvibes_in1(sonic, right_reg); in snd_sonicvibes_put_double()
1047 snd_sonicvibes_out1(sonic, left_reg, val1); in snd_sonicvibes_put_double()
1048 snd_sonicvibes_out1(sonic, right_reg, val2); in snd_sonicvibes_put_double()
1049 spin_unlock_irq(&sonic->reg_lock); in snd_sonicvibes_put_double()
1079 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol); in snd_sonicvibes_master_free() local
1080 sonic->master_mute = NULL; in snd_sonicvibes_master_free()
1081 sonic->master_volume = NULL; in snd_sonicvibes_master_free()
1084 static int snd_sonicvibes_mixer(struct sonicvibes *sonic) in snd_sonicvibes_mixer() argument
1091 if (snd_BUG_ON(!sonic || !sonic->card)) in snd_sonicvibes_mixer()
1093 card = sonic->card; in snd_sonicvibes_mixer()
1097 kctl = snd_ctl_new1(&snd_sonicvibes_controls[idx], sonic); in snd_sonicvibes_mixer()
1116 struct sonicvibes *sonic = entry->private_data; in snd_sonicvibes_proc_read() local
1119 tmp = sonic->srs_space & 0x0f; in snd_sonicvibes_proc_read()
1121 sonic->srs_space & 0x80 ? "off" : "on"); in snd_sonicvibes_proc_read()
1127 tmp = sonic->srs_center & 0x0f; in snd_sonicvibes_proc_read()
1133 tmp = sonic->wave_source & 0x03; in snd_sonicvibes_proc_read()
1137 tmp = sonic->mpu_switch; in snd_sonicvibes_proc_read()
1143 static void snd_sonicvibes_proc_init(struct sonicvibes *sonic) in snd_sonicvibes_proc_init() argument
1145 snd_card_ro_proc_new(sonic->card, "sonicvibes", sonic, in snd_sonicvibes_proc_init()
1157 static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) in snd_sonicvibes_create_gameport() argument
1162 sonic->gameport = gp = gameport_allocate_port(); in snd_sonicvibes_create_gameport()
1164 dev_err(sonic->card->dev, in snd_sonicvibes_create_gameport()
1170 gameport_set_phys(gp, "pci%s/gameport0", pci_name(sonic->pci)); in snd_sonicvibes_create_gameport()
1171 gameport_set_dev_parent(gp, &sonic->pci->dev); in snd_sonicvibes_create_gameport()
1172 gp->io = sonic->game_port; in snd_sonicvibes_create_gameport()
1176 err = snd_ctl_add(sonic->card, in snd_sonicvibes_create_gameport()
1177 snd_ctl_new1(&snd_sonicvibes_game_control, sonic)); in snd_sonicvibes_create_gameport()
1184 static void snd_sonicvibes_free_gameport(struct sonicvibes *sonic) in snd_sonicvibes_free_gameport() argument
1186 if (sonic->gameport) { in snd_sonicvibes_free_gameport()
1187 gameport_unregister_port(sonic->gameport); in snd_sonicvibes_free_gameport()
1188 sonic->gameport = NULL; in snd_sonicvibes_free_gameport()
1192 static inline int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) { return -ENOSYS; } in snd_sonicvibes_create_gameport() argument
1193 static inline void snd_sonicvibes_free_gameport(struct sonicvibes *sonic) { } in snd_sonicvibes_free_gameport() argument
1198 struct sonicvibes *sonic = card->private_data; in snd_sonicvibes_free() local
1200 snd_sonicvibes_free_gameport(sonic); in snd_sonicvibes_free()
1201 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port); in snd_sonicvibes_free()
1202 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); in snd_sonicvibes_free()
1210 struct sonicvibes *sonic = card->private_data; in snd_sonicvibes_create() local
1225 spin_lock_init(&sonic->reg_lock); in snd_sonicvibes_create()
1226 sonic->card = card; in snd_sonicvibes_create()
1227 sonic->pci = pci; in snd_sonicvibes_create()
1228 sonic->irq = -1; in snd_sonicvibes_create()
1234 sonic->sb_port = pci_resource_start(pci, 0); in snd_sonicvibes_create()
1235 sonic->enh_port = pci_resource_start(pci, 1); in snd_sonicvibes_create()
1236 sonic->synth_port = pci_resource_start(pci, 2); in snd_sonicvibes_create()
1237 sonic->midi_port = pci_resource_start(pci, 3); in snd_sonicvibes_create()
1238 sonic->game_port = pci_resource_start(pci, 4); in snd_sonicvibes_create()
1241 IRQF_SHARED, KBUILD_MODNAME, sonic)) { in snd_sonicvibes_create()
1245 sonic->irq = pci->irq; in snd_sonicvibes_create()
1246 card->sync_irq = sonic->irq; in snd_sonicvibes_create()
1271 sonic->res_dmaa = devm_request_region(&pci->dev, dmaa, 0x10, in snd_sonicvibes_create()
1273 if (!sonic->res_dmaa) { in snd_sonicvibes_create()
1279 sonic->res_dmac = devm_request_region(&pci->dev, dmac, 0x10, in snd_sonicvibes_create()
1281 if (!sonic->res_dmac) { in snd_sonicvibes_create()
1288 pci_read_config_dword(pci, 0x40, &sonic->dmaa_port); in snd_sonicvibes_create()
1289 pci_read_config_dword(pci, 0x48, &sonic->dmac_port); in snd_sonicvibes_create()
1290 sonic->dmaa_port &= ~0x0f; in snd_sonicvibes_create()
1291 sonic->dmac_port &= ~0x0f; in snd_sonicvibes_create()
1292 pci_write_config_dword(pci, 0x40, sonic->dmaa_port | 9); /* enable + enhanced */ in snd_sonicvibes_create()
1293 pci_write_config_dword(pci, 0x48, sonic->dmac_port | 9); /* enable */ in snd_sonicvibes_create()
1295 outb(SV_RESET, SV_REG(sonic, CONTROL)); /* reset chip */ in snd_sonicvibes_create()
1297 outb(0, SV_REG(sonic, CONTROL)); /* release reset */ in snd_sonicvibes_create()
1299 outb(SV_ENHANCED | SV_INTA | (reverb ? SV_REVERB : 0), SV_REG(sonic, CONTROL)); in snd_sonicvibes_create()
1300 inb(SV_REG(sonic, STATUS)); /* clear IRQs */ in snd_sonicvibes_create()
1302 snd_sonicvibes_out(sonic, SV_IREG_DRIVE_CTRL, 0); /* drive current 16mA */ in snd_sonicvibes_create()
1304 snd_sonicvibes_out(sonic, SV_IREG_DRIVE_CTRL, 0x40); /* drive current 8mA */ in snd_sonicvibes_create()
1306 snd_sonicvibes_out(sonic, SV_IREG_PC_ENABLE, sonic->enable = 0); /* disable playback & capture */ in snd_sonicvibes_create()
1307 outb(sonic->irqmask = ~(SV_DMAA_MASK | SV_DMAC_MASK | SV_UD_MASK), SV_REG(sonic, IRQMASK)); in snd_sonicvibes_create()
1308 inb(SV_REG(sonic, STATUS)); /* clear IRQs */ in snd_sonicvibes_create()
1309 snd_sonicvibes_out(sonic, SV_IREG_ADC_CLOCK, 0); /* use PLL as clock source */ in snd_sonicvibes_create()
1310 snd_sonicvibes_out(sonic, SV_IREG_ANALOG_POWER, 0); /* power up analog parts */ in snd_sonicvibes_create()
1311 snd_sonicvibes_out(sonic, SV_IREG_DIGITAL_POWER, 0); /* power up digital parts */ in snd_sonicvibes_create()
1312 snd_sonicvibes_setpll(sonic, SV_IREG_ADC_PLL, 8000); in snd_sonicvibes_create()
1313 snd_sonicvibes_out(sonic, SV_IREG_SRS_SPACE, sonic->srs_space = 0x80); /* SRS space off */ in snd_sonicvibes_create()
1314 snd_sonicvibes_out(sonic, SV_IREG_SRS_CENTER, sonic->srs_center = 0x00);/* SRS center off */ in snd_sonicvibes_create()
1315 snd_sonicvibes_out(sonic, SV_IREG_MPU401, sonic->mpu_switch = 0x05); /* MPU-401 switch */ in snd_sonicvibes_create()
1316 snd_sonicvibes_out(sonic, SV_IREG_WAVE_SOURCE, sonic->wave_source = 0x00); /* onboard ROM */ in snd_sonicvibes_create()
1317 snd_sonicvibes_out(sonic, SV_IREG_PCM_RATE_LOW, (8000 * 65536 / SV_FULLRATE) & 0xff); in snd_sonicvibes_create()
1318 snd_sonicvibes_out(sonic, SV_IREG_PCM_RATE_HIGH, ((8000 * 65536 / SV_FULLRATE) >> 8) & 0xff); in snd_sonicvibes_create()
1319 snd_sonicvibes_out(sonic, SV_IREG_LEFT_ADC, mge ? 0xd0 : 0xc0); in snd_sonicvibes_create()
1320 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_ADC, 0xc0); in snd_sonicvibes_create()
1321 snd_sonicvibes_out(sonic, SV_IREG_LEFT_AUX1, 0x9f); in snd_sonicvibes_create()
1322 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_AUX1, 0x9f); in snd_sonicvibes_create()
1323 snd_sonicvibes_out(sonic, SV_IREG_LEFT_CD, 0x9f); in snd_sonicvibes_create()
1324 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_CD, 0x9f); in snd_sonicvibes_create()
1325 snd_sonicvibes_out(sonic, SV_IREG_LEFT_LINE, 0x9f); in snd_sonicvibes_create()
1326 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_LINE, 0x9f); in snd_sonicvibes_create()
1327 snd_sonicvibes_out(sonic, SV_IREG_MIC, 0x8f); in snd_sonicvibes_create()
1328 snd_sonicvibes_out(sonic, SV_IREG_LEFT_SYNTH, 0x9f); in snd_sonicvibes_create()
1329 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_SYNTH, 0x9f); in snd_sonicvibes_create()
1330 snd_sonicvibes_out(sonic, SV_IREG_LEFT_AUX2, 0x9f); in snd_sonicvibes_create()
1331 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_AUX2, 0x9f); in snd_sonicvibes_create()
1332 snd_sonicvibes_out(sonic, SV_IREG_LEFT_ANALOG, 0x9f); in snd_sonicvibes_create()
1333 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_ANALOG, 0x9f); in snd_sonicvibes_create()
1334 snd_sonicvibes_out(sonic, SV_IREG_LEFT_PCM, 0xbf); in snd_sonicvibes_create()
1335 snd_sonicvibes_out(sonic, SV_IREG_RIGHT_PCM, 0xbf); in snd_sonicvibes_create()
1336 snd_sonicvibes_out(sonic, SV_IREG_ADC_OUTPUT_CTRL, 0xfc); in snd_sonicvibes_create()
1338 snd_sonicvibes_debug(sonic); in snd_sonicvibes_create()
1340 sonic->revision = snd_sonicvibes_in(sonic, SV_IREG_REVISION); in snd_sonicvibes_create()
1342 snd_sonicvibes_proc_init(sonic); in snd_sonicvibes_create()
1360 struct sonicvibes *sonic = mpu->private_data; in snd_sonicvibes_midi_input_open() local
1361 outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); in snd_sonicvibes_midi_input_open()
1367 struct sonicvibes *sonic = mpu->private_data; in snd_sonicvibes_midi_input_close() local
1368 outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); in snd_sonicvibes_midi_input_close()
1371 static int snd_sonicvibes_midi(struct sonicvibes *sonic, in snd_sonicvibes_midi() argument
1375 struct snd_card *card = sonic->card; in snd_sonicvibes_midi()
1379 mpu->private_data = sonic; in snd_sonicvibes_midi()
1383 err = snd_ctl_add(card, snd_ctl_new1(&snd_sonicvibes_midi_controls[idx], sonic)); in snd_sonicvibes_midi()
1395 struct sonicvibes *sonic; in __snd_sonic_probe() local
1408 sizeof(*sonic), &card); in __snd_sonic_probe()
1411 sonic = card->private_data; in __snd_sonic_probe()
1422 sonic->revision, in __snd_sonic_probe()
1424 sonic->irq); in __snd_sonic_probe()
1426 err = snd_sonicvibes_pcm(sonic, 0); in __snd_sonic_probe()
1429 err = snd_sonicvibes_mixer(sonic); in __snd_sonic_probe()
1433 sonic->midi_port, in __snd_sonic_probe()
1439 snd_sonicvibes_midi(sonic, midi_uart); in __snd_sonic_probe()
1440 err = snd_opl3_create(card, sonic->synth_port, in __snd_sonic_probe()
1441 sonic->synth_port + 2, in __snd_sonic_probe()
1449 err = snd_sonicvibes_create_gameport(sonic); in __snd_sonic_probe()