• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/sound/pci/

Lines Matching defs:viadev

75 #define VIADEV_REG(viadev, x) ((viadev)->port + VIA_REG_##x)
216 struct viadev {
247 struct viadev devs[VIA_MAX_MODEM_DEVS];
275 static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream,
346 static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream,
458 static void snd_via82xx_channel_reset(struct via82xx_modem *chip, struct viadev *viadev)
461 VIADEV_REG(viadev, OFFSET_CONTROL));
462 inb(VIADEV_REG(viadev, OFFSET_CONTROL));
465 outb(0x00, VIADEV_REG(viadev, OFFSET_CONTROL));
467 outb(0x03, VIADEV_REG(viadev, OFFSET_STATUS));
468 outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */
469 // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR));
470 viadev->lastpos = 0;
493 struct viadev *viadev = &chip->devs[i];
494 unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS));
498 if (viadev->substream && viadev->running) {
500 snd_pcm_period_elapsed(viadev->substream);
503 outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */
519 struct viadev *viadev = substream->runtime->private_data;
526 viadev->running = 1;
530 viadev->running = 0;
534 viadev->running = 0;
537 viadev->running = 1;
542 outb(val, VIADEV_REG(viadev, OFFSET_CONTROL));
544 snd_via82xx_channel_reset(chip, viadev);
556 #define check_invalid_pos(viadev,pos) \
557 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
558 viadev->lastpos < viadev->bufsize2))
560 static inline unsigned int calc_linear_pos(struct viadev *viadev, unsigned int idx,
565 size = viadev->idx_table[idx].size;
566 res = viadev->idx_table[idx].offset + size - count;
572 res = viadev->lastpos;
573 } else if (check_invalid_pos(viadev, res)) {
577 "count = 0x%x\n", idx, viadev->tbl_entries, viadev->lastpos,
578 viadev->bufsize2, viadev->idx_table[idx].offset,
579 viadev->idx_table[idx].size, count);
584 res = viadev->lastpos;
588 res = viadev->idx_table[idx].offset;
593 res = viadev->idx_table[idx].offset + size;
594 if (check_invalid_pos(viadev, res)) {
597 res = viadev->lastpos;
601 viadev->lastpos = res; /* remember the last position */
602 if (res >= viadev->bufsize)
603 res -= viadev->bufsize;
613 struct viadev *viadev = substream->runtime->private_data;
616 if (snd_BUG_ON(!viadev->tbl_entries))
618 if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE))
622 count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)) & 0xffffff;
626 ptr = inl(VIADEV_REG(viadev, OFFSET_CURR_PTR));
627 if (ptr <= (unsigned int)viadev->table.addr)
630 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) %
631 viadev->tbl_entries;
632 res = calc_linear_pos(viadev, idx, count);
646 struct viadev *viadev = substream->runtime->private_data;
652 err = build_via_table(viadev, substream, chip->pci,
671 struct viadev *viadev = substream->runtime->private_data;
673 clean_via_table(viadev, substream, chip->pci);
682 static void snd_via82xx_set_table_ptr(struct via82xx_modem *chip, struct viadev *viadev)
685 outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR));
696 struct viadev *viadev = substream->runtime->private_data;
698 snd_via82xx_channel_reset(chip, viadev);
700 snd_via82xx_set_table_ptr(chip, viadev);
702 VIADEV_REG(viadev, OFFSET_TYPE));
734 static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev *viadev,
757 runtime->private_data = viadev;
758 viadev->substream = substream;
770 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number];
772 return snd_via82xx_modem_pcm_open(chip, viadev, substream);
781 struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device];
783 return snd_via82xx_modem_pcm_open(chip, viadev, substream);
791 struct viadev *viadev = substream->runtime->private_data;
793 viadev->substream = NULL;