Lines Matching refs:emu

159 	dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n",
166 dev_dbg(emu->card->dev,
169 dev_dbg(emu->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
192 dev_dbg(emu->card->dev, "epcm device=%d, channel_id=%d\n",
232 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
234 int channel = substream->pcm->device - emu->p16v_device_offset;
235 u32 *table_base = (u32 *)(emu->p16v_buffer->area+(8*16*channel));
241 dev_dbg(emu->card->dev,
248 dev_dbg(emu->card->dev,
251 dev_dbg(emu->card->dev,
253 emu->p16v_buffer->addr, emu->p16v_buffer->area,
254 emu->p16v_buffer->bytes);
256 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
260 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel,
264 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel,
268 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel,
273 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel,
277 /* FIXME: Check emu->buffer.size before actually writing to it. */
283 snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_ADDR, channel, emu->p16v_buffer->addr+(8*16*channel));
284 snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_SIZE, channel, (runtime->periods - 1) << 19);
285 snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_PTR, channel, 0);
286 snd_emu10k1_ptr20_write(emu, PLAYBACK_DMA_ADDR, channel, runtime->dma_addr);
287 //snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes
288 snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, 0); // buffer size in bytes
289 snd_emu10k1_ptr20_write(emu, PLAYBACK_POINTER, channel, 0);
290 snd_emu10k1_ptr20_write(emu, PLAYBACK_FIFO_END_ADDRESS, channel, 0);
291 snd_emu10k1_ptr20_write(emu, PLAYBACK_FIFO_POINTER, channel, 0);
299 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
301 int channel = substream->pcm->device - emu->p16v_device_offset;
304 dev_dbg(emu->card->dev, "prepare capture:channel_number=%d, rate=%d, "
313 snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, channel, A_I2S_CAPTURE_44100);
316 snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, channel, A_I2S_CAPTURE_96000);
319 snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, channel, A_I2S_CAPTURE_192000);
323 snd_emu10k1_ptr_write(emu, A_I2S_CAPTURE_RATE, channel, A_I2S_CAPTURE_48000);
326 /* FIXME: Check emu->buffer.size before actually writing to it. */
327 snd_emu10k1_ptr20_write(emu, CAPTURE_FIFO_POINTER, channel, 0);
328 snd_emu10k1_ptr20_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr);
329 snd_emu10k1_ptr20_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size) << 16); // buffer size in bytes
330 snd_emu10k1_ptr20_write(emu, CAPTURE_POINTER, channel, 0);
331 //snd_emu10k1_ptr20_write(emu, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC or Line in */
332 //snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) | (0x110000<<channel));
337 static void snd_p16v_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb)
342 spin_lock_irqsave(&emu->emu_lock, flags);
343 enable = inl(emu->port + INTE2) | intrenb;
344 outl(enable, emu->port + INTE2);
345 spin_unlock_irqrestore(&emu->emu_lock, flags);
348 static void snd_p16v_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb)
353 spin_lock_irqsave(&emu->emu_lock, flags);
354 disable = inl(emu->port + INTE2) & (~intrenb);
355 outl(disable, emu->port + INTE2);
356 spin_unlock_irqrestore(&emu->emu_lock, flags);
359 static void snd_p16v_interrupt(struct snd_emu10k1 *emu)
363 while ((status = inl(emu->port + IPR2)) != 0) {
366 /* dev_dbg(emu->card->dev, "p16v status=0x%x\n", status); */
369 emu->pcm_p16v->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
375 dev_err(emu->card->dev,
382 emu->pcm_p16v->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
385 /* dev_info(emu->card->dev, "capture int found\n"); */
387 /* dev_info(emu->card->dev, "capture period_elapsed\n"); */
391 outl(status, emu->port + IPR2); /* ack all */
399 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
418 if (snd_pcm_substream_chip(s) != emu ||
422 channel = substream->pcm->device-emu->p16v_device_offset;
423 /* dev_dbg(emu->card->dev, "p16v channel=%d\n", channel); */
429 /* dev_dbg(emu->card->dev, "basic=0x%x, inte=0x%x\n", basic, inte); */
433 snd_p16v_intr_enable(emu, inte);
434 snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0)| (basic));
437 snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & ~(basic));
438 snd_p16v_intr_disable(emu, inte);
451 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
459 snd_p16v_intr_enable(emu, inte);
460 snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0)|(0x100<<channel));
464 snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & ~(0x100<<channel));
465 snd_p16v_intr_disable(emu, inte);
466 //snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) & ~(0x110000<<channel));
480 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
483 int channel = substream->pcm->device - emu->p16v_device_offset;
488 ptr3 = snd_emu10k1_ptr20_read(emu, PLAYBACK_LIST_PTR, channel);
489 ptr1 = snd_emu10k1_ptr20_read(emu, PLAYBACK_POINTER, channel);
490 ptr4 = snd_emu10k1_ptr20_read(emu, PLAYBACK_LIST_PTR, channel);
491 if (ptr3 != ptr4) ptr1 = snd_emu10k1_ptr20_read(emu, PLAYBACK_POINTER, channel);
505 struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
513 ptr1 = snd_emu10k1_ptr20_read(emu, CAPTURE_POINTER, channel);
518 dev_warn(emu->card->dev, "buffer capture limited!\n");
521 dev_dbg(emu->card->dev, "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
547 int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
554 /* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */
555 emu->p16v_device_offset = device;
557 err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm);
561 pcm->private_data = emu;
570 emu->pcm_p16v = pcm;
571 emu->p16v_interrupt = snd_p16v_interrupt;
577 &emu->pci->dev,
581 dev_dbg(emu->card->dev,
590 &emu->pci->dev,
593 dev_dbg(emu->card->dev,
614 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
619 value = snd_emu10k1_ptr20_read(emu, reg, high_low);
633 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
638 oval = value = snd_emu10k1_ptr20_read(emu, reg, 0);
649 snd_emu10k1_ptr20_write(emu, reg, 0, value);
669 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
671 ucontrol->value.enumerated.item[0] = emu->p16v_capture_source;
678 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
687 change = (emu->p16v_capture_source != val);
689 emu->p16v_capture_source = val;
691 mask = snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & 0xffff;
692 snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, source | mask);
708 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
710 ucontrol->value.enumerated.item[0] = emu->p16v_capture_channel;
717 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
725 change = (emu->p16v_capture_channel != val);
727 emu->p16v_capture_channel = val;
728 tmp = snd_emu10k1_ptr20_read(emu, CAPTURE_P16V_SOURCE, 0) & 0xfffc;
729 snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, tmp | val);
772 int snd_p16v_mixer(struct snd_emu10k1 *emu)
775 struct snd_card *card = emu->card;
778 err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i], emu));
789 int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
791 emu->p16v_saved = vmalloc(array_size(NUM_CHS * 4, 0x80));
792 if (! emu->p16v_saved)
797 void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu)
799 vfree(emu->p16v_saved);
802 void snd_p16v_suspend(struct snd_emu10k1 *emu)
807 val = emu->p16v_saved;
810 *val = snd_emu10k1_ptr20_read(emu, i, ch);
813 void snd_p16v_resume(struct snd_emu10k1 *emu)
818 val = emu->p16v_saved;
821 snd_emu10k1_ptr20_write(emu, i, ch, *val);