• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/sound/isa/gus/

Lines Matching defs:gus

32 #include <sound/gus.h>
45 struct snd_gus_card * gus;
64 static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data)
101 if (!snd_gf1_dma_transfer_block(pcmp->gus, &block, 0, 0))
110 struct snd_gus_card * gus = pcmp->gus;
127 rate = snd_gf1_translate_freq(gus, runtime->rate << 4);
147 vol = !voice ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right;
148 spin_lock_irqsave(&gus->reg_lock, flags);
149 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number);
150 snd_gf1_write8(gus, SNDRV_GF1_VB_PAN, pan);
151 snd_gf1_write16(gus, SNDRV_GF1_VW_FREQUENCY, rate);
152 snd_gf1_write_addr(gus, SNDRV_GF1_VA_START, begin << 4, voice_ctrl & 4);
153 snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, end << 4, voice_ctrl & 4);
154 snd_gf1_write_addr(gus, SNDRV_GF1_VA_CURRENT, curr << 4, voice_ctrl & 4);
155 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, SNDRV_GF1_MIN_VOLUME << 4);
156 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_RATE, 0x2f);
157 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_START, SNDRV_GF1_MIN_OFFSET);
158 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_END, vol >> 8);
159 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, ramp_ctrl);
160 if (!gus->gf1.enh_mode) {
161 snd_gf1_delay(gus);
162 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, ramp_ctrl);
164 spin_unlock_irqrestore(&gus->reg_lock, flags);
166 spin_lock_irqsave(&gus->reg_lock, flags);
168 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number);
169 if (gus->gf1.enh_mode)
170 snd_gf1_write8(gus, SNDRV_GF1_VB_MODE, 0x00); /* deactivate voice */
171 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice_ctrl);
175 if (!gus->gf1.enh_mode) {
176 snd_gf1_delay(gus);
178 snd_gf1_select_voice(gus, pcmp->pvoices[voice]->number);
179 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice_ctrl);
183 spin_unlock_irqrestore(&gus->reg_lock, flags);
186 static void snd_gf1_pcm_interrupt_wave(struct snd_gus_card * gus,
197 snd_gf1_smart_stop_voice(gus, pvoice->number);
203 snd_gf1_smart_stop_voice(gus, pvoice->number);
206 gus = pcmp->gus;
209 spin_lock(&gus->reg_lock);
210 snd_gf1_select_voice(gus, pvoice->number);
211 voice_ctrl = snd_gf1_read8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL) & ~0x8b;
212 ramp_ctrl = (snd_gf1_read8(gus, SNDRV_GF1_VB_VOLUME_CONTROL) & ~0xa4) | 0x03;
229 snd_gf1_select_voice(gus, pcmp->pvoices[idx]->number);
230 snd_gf1_write_addr(gus, SNDRV_GF1_VA_END, end << 4, voice_ctrl & 4);
231 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice_ctrl);
232 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, ramp_ctrl);
235 if (!gus->gf1.enh_mode) {
236 snd_gf1_delay(gus);
239 snd_gf1_select_voice(gus, pcmp->pvoices[idx]->number);
240 snd_gf1_write8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL, voice_ctrl);
241 snd_gf1_write8(gus, SNDRV_GF1_VB_VOLUME_CONTROL, ramp_ctrl);
245 spin_unlock(&gus->reg_lock);
250 static void snd_gf1_pcm_interrupt_volume(struct snd_gus_card * gus,
258 spin_lock(&gus->reg_lock);
259 snd_gf1_select_voice(gus, pvoice->number);
260 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
261 spin_unlock(&gus->reg_lock);
271 vol = !cvoice ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right;
272 spin_lock(&gus->reg_lock);
273 snd_gf1_select_voice(gus, pvoice->number);
274 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, vol);
276 spin_unlock(&gus->reg_lock);
279 static void snd_gf1_pcm_volume_change(struct snd_gus_card * gus)
283 static int snd_gf1_pcm_poke_block(struct snd_gus_card *gus, unsigned char *buf,
293 (int)buf, pos, count, gus->gf1.port);
300 if (gus->interwave) {
301 spin_lock_irqsave(&gus->reg_lock, flags);
302 snd_gf1_write8(gus, SNDRV_GF1_GB_MEMORY_CONTROL, 0x01 | (invert ? 0x08 : 0x00));
303 snd_gf1_dram_addr(gus, pos);
305 outb(SNDRV_GF1_GW_DRAM_IO16, GUSP(gus, GF1REGSEL));
306 outsw(GUSP(gus, GF1DATALOW), buf, len >> 1);
308 outsb(GUSP(gus, DRAM), buf, len);
310 spin_unlock_irqrestore(&gus->reg_lock, flags);
318 snd_gf1_poke(gus, pos++, *buf++);
319 snd_gf1_poke(gus, pos++, *buf++ ^ invert);
323 snd_gf1_poke(gus, pos++, *buf++ ^ invert);
356 struct snd_gus_card *gus = pcmp->gus;
361 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0)
386 struct snd_gus_card *gus = pcmp->gus;
391 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0)
400 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
410 snd_gf1_mem_free(&gus->gf1.mem_alloc, pcmp->memory);
413 if ((block = snd_gf1_mem_alloc(&gus->gf1.mem_alloc,
423 if ((pcmp->pvoices[0] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0)) == NULL)
431 if ((pcmp->pvoices[1] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0)) == NULL)
439 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[1]);
453 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[0]);
457 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[1]);
461 snd_gf1_mem_free(&pcmp->gus->gf1.mem_alloc, pcmp->memory);
482 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
494 snd_gf1_stop_voices(gus, voice, voice);
497 snd_gf1_stop_voices(gus, voice, voice);
507 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
514 spin_lock(&gus->reg_lock);
516 snd_gf1_select_voice(gus, pcmp->pvoices[0]->number);
517 voice_ctrl = snd_gf1_read8(gus, SNDRV_GF1_VB_ADDRESS_CONTROL);
518 pos = (snd_gf1_read_addr(gus, SNDRV_GF1_VA_CURRENT, voice_ctrl & 4) >> 4) - pcmp->memory;
523 spin_unlock(&gus->reg_lock);
542 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
544 gus->c_dma_size = params_buffer_bytes(hw_params);
545 gus->c_period_size = params_period_bytes(hw_params);
546 gus->c_pos = 0;
547 gus->gf1.pcm_rcntrl_reg = 0x21; /* IRQ at end, enable & start */
549 gus->gf1.pcm_rcntrl_reg |= 2;
550 if (gus->gf1.dma2 > 3)
551 gus->gf1.pcm_rcntrl_reg |= 4;
553 gus->gf1.pcm_rcntrl_reg |= 0x80;
564 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
567 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RECORD_RATE, runtime->rate_den - 2);
568 snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */
569 snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL); /* Sampling Control Register */
570 snd_dma_program(gus->gf1.dma2, runtime->dma_addr, gus->c_period_size, DMA_MODE_READ);
577 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
581 val = gus->gf1.pcm_rcntrl_reg;
588 spin_lock(&gus->reg_lock);
589 snd_gf1_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, val);
590 snd_gf1_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL);
591 spin_unlock(&gus->reg_lock);
597 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
598 int pos = snd_dma_pointer(gus->gf1.dma2, gus->c_period_size);
599 pos = bytes_to_frames(substream->runtime, (gus->c_pos + pos) % gus->c_dma_size);
603 static void snd_gf1_pcm_interrupt_dma_read(struct snd_gus_card * gus)
605 snd_gf1_i_write8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL, 0); /* disable sampling */
606 snd_gf1_i_look8(gus, SNDRV_GF1_GB_REC_DMA_CONTROL); /* Sampling Control Register */
607 if (gus->pcm_cap_substream != NULL) {
608 snd_gf1_pcm_capture_prepare(gus->pcm_cap_substream);
609 snd_gf1_pcm_capture_trigger(gus->pcm_cap_substream, SNDRV_PCM_TRIGGER_START);
610 gus->c_pos += gus->c_period_size;
611 snd_pcm_period_elapsed(gus->pcm_cap_substream);
659 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
666 pcmp->gus = gus;
674 if ((err = snd_gf1_dma_init(gus)) < 0)
679 snd_pcm_limit_isa_dma_size(gus->gf1.dma1, &runtime->hw.buffer_bytes_max);
680 snd_pcm_limit_isa_dma_size(gus->gf1.dma1, &runtime->hw.period_bytes_max);
687 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
694 snd_gf1_dma_done(gus);
701 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
703 gus->gf1.interrupt_handler_dma_read = snd_gf1_pcm_interrupt_dma_read;
704 gus->pcm_cap_substream = substream;
706 snd_pcm_limit_isa_dma_size(gus->gf1.dma2, &runtime->hw.buffer_bytes_max);
707 snd_pcm_limit_isa_dma_size(gus->gf1.dma2, &runtime->hw.period_bytes_max);
715 struct snd_gus_card *gus = snd_pcm_substream_chip(substream);
717 gus->pcm_cap_substream = NULL;
718 snd_gf1_set_default_handlers(gus, SNDRV_GF1_HANDLER_DMA_READ);
733 struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol);
736 spin_lock_irqsave(&gus->pcm_volume_level_lock, flags);
737 ucontrol->value.integer.value[0] = gus->gf1.pcm_volume_level_left1;
738 ucontrol->value.integer.value[1] = gus->gf1.pcm_volume_level_right1;
739 spin_unlock_irqrestore(&gus->pcm_volume_level_lock, flags);
745 struct snd_gus_card *gus = snd_kcontrol_chip(kcontrol);
755 spin_lock_irqsave(&gus->pcm_volume_level_lock, flags);
756 change = val1 != gus->gf1.pcm_volume_level_left1 ||
757 val2 != gus->gf1.pcm_volume_level_right1;
758 gus->gf1.pcm_volume_level_left1 = val1;
759 gus->gf1.pcm_volume_level_right1 = val2;
760 gus->gf1.pcm_volume_level_left = snd_gf1_lvol_to_gvol_raw(val1 << 9) << 4;
761 gus->gf1.pcm_volume_level_right = snd_gf1_lvol_to_gvol_raw(val2 << 9) << 4;
762 spin_unlock_irqrestore(&gus->pcm_volume_level_lock, flags);
764 spin_lock_irqsave(&gus->voice_alloc, flags);
766 pvoice = &gus->gf1.voices[idx];
773 spin_lock(&gus->reg_lock);
774 snd_gf1_select_voice(gus, pvoice->number);
775 snd_gf1_ctrl_stop(gus, SNDRV_GF1_VB_VOLUME_CONTROL);
776 vol = pvoice == pcmp->pvoices[0] ? gus->gf1.pcm_volume_level_left : gus->gf1.pcm_volume_level_right;
777 snd_gf1_write16(gus, SNDRV_GF1_VW_VOLUME, vol);
779 spin_unlock(&gus->reg_lock);
781 spin_unlock_irqrestore(&gus->voice_alloc, flags);
827 int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm)
837 card = gus->card;
838 capture = !gus->interwave && !gus->ess_flag && !gus->ace_flag ? 1 : 0;
840 gus->interwave ? "AMD InterWave" : "GF1",
842 gus->gf1.pcm_channels / 2,
847 pcm->private_data = gus;
854 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);
860 if (gus->gf1.dma2 == gus->gf1.dma1)
864 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);
867 if (gus->interwave) {
868 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
871 gus->pcm = pcm;
873 if (gus->codec_flag)
874 kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control1, gus);
876 kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control, gus);