Searched refs:viadev (Results 1 - 3 of 3) sorted by relevance

/linux-4.1.27/sound/pci/
H A Dvia82xx_modem.c78 #define VIADEV_REG(viadev, x) ((viadev)->port + VIA_REG_##x)
219 struct viadev { struct
250 struct viadev devs[VIA_MAX_MODEM_DEVS];
278 static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream, build_via_table()
350 static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream, clean_via_table()
463 static void snd_via82xx_channel_reset(struct via82xx_modem *chip, struct viadev *viadev) snd_via82xx_channel_reset() argument
466 VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
467 inb(VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
470 outb(0x00, VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
472 outb(0x03, VIADEV_REG(viadev, OFFSET_STATUS)); snd_via82xx_channel_reset()
473 outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */ snd_via82xx_channel_reset()
474 // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR)); snd_via82xx_channel_reset()
475 viadev->lastpos = 0; snd_via82xx_channel_reset()
498 struct viadev *viadev = &chip->devs[i]; snd_via82xx_interrupt() local
499 unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); snd_via82xx_interrupt()
503 if (viadev->substream && viadev->running) { snd_via82xx_interrupt()
505 snd_pcm_period_elapsed(viadev->substream); snd_via82xx_interrupt()
508 outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ snd_via82xx_interrupt()
524 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_pcm_trigger() local
531 viadev->running = 1; snd_via82xx_pcm_trigger()
535 viadev->running = 0; snd_via82xx_pcm_trigger()
539 viadev->running = 0; snd_via82xx_pcm_trigger()
542 viadev->running = 1; snd_via82xx_pcm_trigger()
547 outb(val, VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_pcm_trigger()
549 snd_via82xx_channel_reset(chip, viadev); snd_via82xx_pcm_trigger()
561 #define check_invalid_pos(viadev,pos) \
562 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
563 viadev->lastpos < viadev->bufsize2))
566 struct viadev *viadev, calc_linear_pos()
572 size = viadev->idx_table[idx].size; calc_linear_pos()
573 res = viadev->idx_table[idx].offset + size - count; calc_linear_pos()
580 res = viadev->lastpos; calc_linear_pos()
581 } else if (check_invalid_pos(viadev, res)) { calc_linear_pos()
585 idx, viadev->tbl_entries, viadev->lastpos, calc_linear_pos()
586 viadev->bufsize2, viadev->idx_table[idx].offset, calc_linear_pos()
587 viadev->idx_table[idx].size, count); calc_linear_pos()
592 res = viadev->lastpos; calc_linear_pos()
596 res = viadev->idx_table[idx].offset; calc_linear_pos()
601 res = viadev->idx_table[idx].offset + size; calc_linear_pos()
602 if (check_invalid_pos(viadev, res)) { calc_linear_pos()
605 res = viadev->lastpos; calc_linear_pos()
609 viadev->lastpos = res; /* remember the last position */ calc_linear_pos()
610 if (res >= viadev->bufsize) calc_linear_pos()
611 res -= viadev->bufsize; calc_linear_pos()
621 struct viadev *viadev = substream->runtime->private_data; snd_via686_pcm_pointer() local
624 if (snd_BUG_ON(!viadev->tbl_entries)) snd_via686_pcm_pointer()
626 if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE)) snd_via686_pcm_pointer()
630 count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)) & 0xffffff; snd_via686_pcm_pointer()
634 ptr = inl(VIADEV_REG(viadev, OFFSET_CURR_PTR)); snd_via686_pcm_pointer()
635 if (ptr <= (unsigned int)viadev->table.addr) snd_via686_pcm_pointer()
638 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % snd_via686_pcm_pointer()
639 viadev->tbl_entries; snd_via686_pcm_pointer()
640 res = calc_linear_pos(chip, viadev, idx, count); snd_via686_pcm_pointer()
654 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_hw_params() local
660 err = build_via_table(viadev, substream, chip->pci, snd_via82xx_hw_params()
679 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_hw_free() local
681 clean_via_table(viadev, substream, chip->pci); snd_via82xx_hw_free()
690 static void snd_via82xx_set_table_ptr(struct via82xx_modem *chip, struct viadev *viadev) snd_via82xx_set_table_ptr() argument
693 outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); snd_via82xx_set_table_ptr()
704 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_pcm_prepare() local
706 snd_via82xx_channel_reset(chip, viadev); snd_via82xx_pcm_prepare()
708 snd_via82xx_set_table_ptr(chip, viadev); snd_via82xx_pcm_prepare()
710 VIADEV_REG(viadev, OFFSET_TYPE)); snd_via82xx_pcm_prepare()
742 static int snd_via82xx_modem_pcm_open(struct via82xx_modem *chip, struct viadev *viadev, snd_via82xx_modem_pcm_open() argument
765 runtime->private_data = viadev; snd_via82xx_modem_pcm_open()
766 viadev->substream = substream; snd_via82xx_modem_pcm_open()
778 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; snd_via82xx_playback_open() local
780 return snd_via82xx_modem_pcm_open(chip, viadev, substream); snd_via82xx_playback_open()
789 struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; snd_via82xx_capture_open() local
791 return snd_via82xx_modem_pcm_open(chip, viadev, substream); snd_via82xx_capture_open()
799 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_pcm_close() local
801 viadev->substream = NULL; snd_via82xx_pcm_close()
565 calc_linear_pos(struct via82xx_modem *chip, struct viadev *viadev, unsigned int idx, unsigned int count) calc_linear_pos() argument
H A Dvia82xx.c139 #define VIADEV_REG(viadev, x) ((viadev)->port + VIA_REG_##x)
324 struct viadev { struct
383 struct viadev devs[VIA_MAX_DEVS];
425 static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substream, build_via_table()
496 static int clean_via_table(struct viadev *dev, struct snd_pcm_substream *substream, clean_via_table()
607 static void snd_via82xx_channel_reset(struct via82xx *chip, struct viadev *viadev) snd_via82xx_channel_reset() argument
610 VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
611 inb(VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
614 outb(0x00, VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_channel_reset()
616 outb(0x03, VIADEV_REG(viadev, OFFSET_STATUS)); snd_via82xx_channel_reset()
617 outb(0x00, VIADEV_REG(viadev, OFFSET_TYPE)); /* for via686 */ snd_via82xx_channel_reset()
618 // outl(0, VIADEV_REG(viadev, OFFSET_CURR_PTR)); snd_via82xx_channel_reset()
619 viadev->lastpos = 0; snd_via82xx_channel_reset()
620 viadev->hwptr_done = 0; snd_via82xx_channel_reset()
645 struct viadev *viadev = &chip->devs[i]; snd_via686_interrupt() local
646 unsigned char c_status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); snd_via686_interrupt()
649 if (viadev->substream && viadev->running) { snd_via686_interrupt()
656 viadev->hwptr_done = 0; snd_via686_interrupt()
658 viadev->hwptr_done += viadev->fragsize; snd_via686_interrupt()
659 viadev->in_interrupt = c_status; snd_via686_interrupt()
661 snd_pcm_period_elapsed(viadev->substream); snd_via686_interrupt()
663 viadev->in_interrupt = 0; snd_via686_interrupt()
665 outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ snd_via686_interrupt()
686 struct viadev *viadev = &chip->devs[i]; snd_via8233_interrupt() local
690 shadow_status = (status >> viadev->shadow_shift) & snd_via8233_interrupt()
697 substream = viadev->substream; snd_via8233_interrupt()
698 if (substream && viadev->running) { snd_via8233_interrupt()
705 viadev->hwptr_done = 0; snd_via8233_interrupt()
707 viadev->hwptr_done += viadev->fragsize; snd_via8233_interrupt()
708 viadev->in_interrupt = c_status; snd_via8233_interrupt()
710 viadev->in_interrupt |= VIA_REG_STAT_ACTIVE; snd_via8233_interrupt()
716 viadev->in_interrupt = 0; snd_via8233_interrupt()
718 outb(c_status, VIADEV_REG(viadev, OFFSET_STATUS)); /* ack */ snd_via8233_interrupt()
735 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_pcm_trigger() local
746 viadev->running = 1; snd_via82xx_pcm_trigger()
751 viadev->running = 0; snd_via82xx_pcm_trigger()
755 viadev->running = 0; snd_via82xx_pcm_trigger()
758 viadev->running = 1; snd_via82xx_pcm_trigger()
763 outb(val, VIADEV_REG(viadev, OFFSET_CONTROL)); snd_via82xx_pcm_trigger()
765 snd_via82xx_channel_reset(chip, viadev); snd_via82xx_pcm_trigger()
778 #define check_invalid_pos(viadev,pos) \
779 ((pos) < viadev->lastpos && ((pos) >= viadev->bufsize2 ||\
780 viadev->lastpos < viadev->bufsize2))
783 struct viadev *viadev, calc_linear_pos()
789 size = viadev->idx_table[idx].size; calc_linear_pos()
790 base = viadev->idx_table[idx].offset; calc_linear_pos()
792 if (res >= viadev->bufsize) calc_linear_pos()
793 res -= viadev->bufsize; calc_linear_pos()
800 res = viadev->lastpos; calc_linear_pos()
807 int delta = res - viadev->lastpos; calc_linear_pos()
809 delta += viadev->bufsize; calc_linear_pos()
810 if ((unsigned int)delta > viadev->fragsize) calc_linear_pos()
813 if (check_invalid_pos(viadev, res)) { calc_linear_pos()
817 idx, viadev->tbl_entries, calc_linear_pos()
818 viadev->lastpos, viadev->bufsize2, calc_linear_pos()
819 viadev->idx_table[idx].offset, calc_linear_pos()
820 viadev->idx_table[idx].size, count); calc_linear_pos()
824 if (check_invalid_pos(viadev, res)) { calc_linear_pos()
827 res = viadev->lastpos; calc_linear_pos()
840 struct viadev *viadev = substream->runtime->private_data; snd_via686_pcm_pointer() local
843 if (snd_BUG_ON(!viadev->tbl_entries)) snd_via686_pcm_pointer()
845 if (!(inb(VIADEV_REG(viadev, OFFSET_STATUS)) & VIA_REG_STAT_ACTIVE)) snd_via686_pcm_pointer()
849 count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)) & 0xffffff; snd_via686_pcm_pointer()
853 ptr = inl(VIADEV_REG(viadev, OFFSET_CURR_PTR)); snd_via686_pcm_pointer()
854 if (ptr <= (unsigned int)viadev->table.addr) snd_via686_pcm_pointer()
857 idx = ((ptr - (unsigned int)viadev->table.addr) / 8 - 1) % viadev->tbl_entries; snd_via686_pcm_pointer()
858 res = calc_linear_pos(chip, viadev, idx, count); snd_via686_pcm_pointer()
859 viadev->lastpos = res; /* remember the last position */ snd_via686_pcm_pointer()
871 struct viadev *viadev = substream->runtime->private_data; snd_via8233_pcm_pointer() local
875 if (snd_BUG_ON(!viadev->tbl_entries)) snd_via8233_pcm_pointer()
879 count = inl(VIADEV_REG(viadev, OFFSET_CURR_COUNT)); snd_via8233_pcm_pointer()
880 status = viadev->in_interrupt; snd_via8233_pcm_pointer()
882 status = inb(VIADEV_REG(viadev, OFFSET_STATUS)); snd_via8233_pcm_pointer()
895 if (idx >= viadev->tbl_entries) { snd_via8233_pcm_pointer()
899 viadev->tbl_entries); snd_via8233_pcm_pointer()
901 res = viadev->lastpos; snd_via8233_pcm_pointer()
904 res = calc_linear_pos(chip, viadev, idx, count); snd_via8233_pcm_pointer()
907 res = viadev->hwptr_done; snd_via8233_pcm_pointer()
908 if (!viadev->in_interrupt) { snd_via8233_pcm_pointer()
913 res += viadev->fragsize; snd_via8233_pcm_pointer()
918 viadev->lastpos = res; snd_via8233_pcm_pointer()
933 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_hw_params() local
939 err = build_via_table(viadev, substream, chip->pci, snd_via82xx_hw_params()
955 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_hw_free() local
957 clean_via_table(viadev, substream, chip->pci); snd_via82xx_hw_free()
966 static void snd_via82xx_set_table_ptr(struct via82xx *chip, struct viadev *viadev) snd_via82xx_set_table_ptr() argument
969 outl((u32)viadev->table.addr, VIADEV_REG(viadev, OFFSET_TABLE_PTR)); snd_via82xx_set_table_ptr()
977 static void via686_setup_format(struct via82xx *chip, struct viadev *viadev, via686_setup_format() argument
980 snd_via82xx_channel_reset(chip, viadev); via686_setup_format()
982 snd_via82xx_set_table_ptr(chip, viadev); via686_setup_format()
986 ((viadev->reg_offset & 0x10) == 0 ? VIA_REG_TYPE_INT_LSAMPLE : 0) | via686_setup_format()
988 VIA_REG_TYPE_INT_FLAG, VIADEV_REG(viadev, OFFSET_TYPE)); via686_setup_format()
994 struct viadev *viadev = substream->runtime->private_data; snd_via686_playback_prepare() local
999 via686_setup_format(chip, viadev, runtime); snd_via686_playback_prepare()
1006 struct viadev *viadev = substream->runtime->private_data; snd_via686_capture_prepare() local
1010 via686_setup_format(chip, viadev, runtime); snd_via686_capture_prepare()
1040 struct viadev *viadev = substream->runtime->private_data; snd_via8233_playback_prepare() local
1051 if (chip->spdif_on && viadev->reg_offset == 0x30) snd_via8233_playback_prepare()
1060 snd_via82xx_channel_reset(chip, viadev); snd_via8233_playback_prepare()
1061 snd_via82xx_set_table_ptr(chip, viadev); snd_via8233_playback_prepare()
1062 outb(chip->playback_volume[viadev->reg_offset / 0x10][0], snd_via8233_playback_prepare()
1063 VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_L)); snd_via8233_playback_prepare()
1064 outb(chip->playback_volume[viadev->reg_offset / 0x10][1], snd_via8233_playback_prepare()
1065 VIADEV_REG(viadev, OFS_PLAYBACK_VOLUME_R)); snd_via8233_playback_prepare()
1070 VIADEV_REG(viadev, OFFSET_STOP_IDX)); snd_via8233_playback_prepare()
1082 struct viadev *viadev = substream->runtime->private_data; snd_via8233_multi_prepare() local
1093 snd_via82xx_channel_reset(chip, viadev); snd_via8233_multi_prepare()
1094 snd_via82xx_set_table_ptr(chip, viadev); snd_via8233_multi_prepare()
1099 outb(fmt, VIADEV_REG(viadev, OFS_MULTPLAY_FORMAT)); snd_via8233_multi_prepare()
1119 outl(0xff000000 | slots, VIADEV_REG(viadev, OFFSET_STOP_IDX)); snd_via8233_multi_prepare()
1131 struct viadev *viadev = substream->runtime->private_data; snd_via8233_capture_prepare() local
1137 snd_via82xx_channel_reset(chip, viadev); snd_via8233_capture_prepare()
1138 snd_via82xx_set_table_ptr(chip, viadev); snd_via8233_capture_prepare()
1139 outb(VIA_REG_CAPTURE_FIFO_ENABLE, VIADEV_REG(viadev, OFS_CAPTURE_FIFO)); snd_via8233_capture_prepare()
1143 VIADEV_REG(viadev, OFFSET_STOP_IDX)); snd_via8233_capture_prepare()
1178 static int snd_via82xx_pcm_open(struct via82xx *chip, struct viadev *viadev, snd_via82xx_pcm_open() argument
1189 ratep = &chip->rates[viadev->direction]; snd_via82xx_pcm_open()
1192 if (chip->spdif_on && viadev->reg_offset == 0x30) { snd_via82xx_pcm_open()
1196 } else if (chip->dxs_fixed && viadev->reg_offset < 0x40) { snd_via82xx_pcm_open()
1200 } else if (chip->dxs_src && viadev->reg_offset < 0x40) { snd_via82xx_pcm_open()
1208 int idx = viadev->direction ? AC97_RATES_ADC : AC97_RATES_FRONT_DAC; snd_via82xx_pcm_open()
1229 runtime->private_data = viadev; snd_via82xx_pcm_open()
1230 viadev->substream = substream; snd_via82xx_pcm_open()
1242 struct viadev *viadev = &chip->devs[chip->playback_devno + substream->number]; snd_via686_playback_open() local
1245 if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) snd_via686_playback_open()
1256 struct viadev *viadev; snd_via8233_playback_open() local
1260 viadev = &chip->devs[chip->playback_devno + substream->number]; snd_via8233_playback_open()
1261 if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) snd_via8233_playback_open()
1263 stream = viadev->reg_offset / 0x10; snd_via8233_playback_open()
1284 struct viadev *viadev = &chip->devs[chip->multi_devno]; snd_via8233_multi_open() local
1298 if ((err = snd_via82xx_pcm_open(chip, viadev, substream)) < 0) snd_via8233_multi_open()
1314 struct viadev *viadev = &chip->devs[chip->capture_devno + substream->pcm->device]; snd_via82xx_capture_open() local
1316 return snd_via82xx_pcm_open(chip, viadev, substream); snd_via82xx_capture_open()
1325 struct viadev *viadev = substream->runtime->private_data; snd_via82xx_pcm_close() local
1329 ratep = &chip->rates[viadev->direction]; snd_via82xx_pcm_close()
1336 if (! viadev->direction) { snd_via82xx_pcm_close()
1347 viadev->substream = NULL; snd_via82xx_pcm_close()
1354 struct viadev *viadev = substream->runtime->private_data; snd_via8233_playback_close() local
1357 stream = viadev->reg_offset / 0x10; snd_via8233_playback_close()
782 calc_linear_pos(struct via82xx *chip, struct viadev *viadev, unsigned int idx, unsigned int count) calc_linear_pos() argument
/linux-4.1.27/drivers/media/platform/
H A Dvia-camera.c63 struct viafb_dev *viadev; member in struct:via_camera
311 spin_lock(&cam->viadev->reg_lock); viacam_quick_irq()
318 spin_unlock(&cam->viadev->reg_lock); viacam_quick_irq()
330 spin_lock_irqsave(&cam->viadev->reg_lock, flags); viacam_next_buffer()
343 spin_unlock_irqrestore(&cam->viadev->reg_lock, flags); viacam_next_buffer()
414 int nbuf = cam->viadev->camera_fbmem_size/cam->sensor_format.sizeimage; viacam_ctlr_cbufs()
540 spin_lock_irqsave(&cam->viadev->reg_lock, flags); viacam_config_controller()
544 spin_unlock_irqrestore(&cam->viadev->reg_lock, flags); viacam_config_controller()
554 spin_lock_irq(&cam->viadev->reg_lock); viacam_start_engine()
560 spin_unlock_irq(&cam->viadev->reg_lock); viacam_start_engine()
566 spin_lock_irq(&cam->viadev->reg_lock); viacam_stop_engine()
571 spin_unlock_irq(&cam->viadev->reg_lock); viacam_stop_engine()
679 &cam->platdev->dev, &cam->viadev->reg_lock, viacam_open()
1312 struct viafb_dev *viadev = pdev->dev.platform_data; viacam_probe() local
1335 if (viadev->camera_fbmem_size < (VGA_HEIGHT*VGA_WIDTH*4)) { viacam_probe()
1339 if (viadev->engine_mmio == NULL) { viacam_probe()
1355 cam->viadev = viadev; viacam_probe()
1362 cam->mmio = viadev->engine_mmio; viacam_probe()
1363 cam->fbmem = viadev->fbmem; viacam_probe()
1364 cam->fb_offset = viadev->camera_fbmem_offset; viacam_probe()
1382 pdev->dev.dma_mask = &viadev->pdev->dma_mask; viacam_probe()
1414 ret = request_threaded_irq(viadev->pdev->irq, viacam_quick_irq, viacam_probe()
1441 free_irq(viadev->pdev->irq, cam); viacam_probe()
1456 struct viafb_dev *viadev = pdev->dev.platform_data; viacam_remove() local
1460 free_irq(viadev->pdev->irq, cam); viacam_remove()

Completed in 146 milliseconds