Lines Matching +full:x +full:- +full:rp
1 // SPDX-License-Identifier: GPL-2.0-or-later
15 #include "cx25821-sram.h"
16 #include "cx25821-video.h"
19 MODULE_AUTHOR("Shu Lin - Hiep Huynh");
26 static unsigned int card[] = {[0 ... (CX25821_MAXBOARDS - 1)] = UNSET };
330 pr_cont("0x%08x [ %s", in cx25821_risc_decode()
332 for (i = ARRAY_SIZE(bits) - 1; i >= 0; i--) { in cx25821_risc_decode()
356 /* PLL-A setting for the Audio Master Clock */ in cx25821_registers_init()
366 /* PLL-B setting for Mobilygen Host Bus Interface */ in cx25821_registers_init()
376 /* PLL-C setting for video upstream channel */ in cx25821_registers_init()
386 /* PLL-D setting for audio upstream channel */ in cx25821_registers_init()
401 /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for in cx25821_registers_init()
402 * channel A-C in cx25821_registers_init()
403 * select 656/VIP DST for downstream Channel A - C */ in cx25821_registers_init()
424 if (ch->cmds_start == 0) { in cx25821_sram_channel_setup()
425 cx_write(ch->ptr1_reg, 0); in cx25821_sram_channel_setup()
426 cx_write(ch->ptr2_reg, 0); in cx25821_sram_channel_setup()
427 cx_write(ch->cnt2_reg, 0); in cx25821_sram_channel_setup()
428 cx_write(ch->cnt1_reg, 0); in cx25821_sram_channel_setup()
433 cdt = ch->cdt; in cx25821_sram_channel_setup()
434 lines = ch->fifo_size / bpl; in cx25821_sram_channel_setup()
447 cx_write(cdt + 16 * i, ch->fifo_start + bpl * i); in cx25821_sram_channel_setup()
455 cx_write(ch->fifo_start + 4 * i, i); in cx25821_sram_channel_setup()
458 if (ch->jumponly) in cx25821_sram_channel_setup()
459 cx_write(ch->cmds_start + 0, 8); in cx25821_sram_channel_setup()
461 cx_write(ch->cmds_start + 0, risc); in cx25821_sram_channel_setup()
463 cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ in cx25821_sram_channel_setup()
464 cx_write(ch->cmds_start + 8, cdt); in cx25821_sram_channel_setup()
465 cx_write(ch->cmds_start + 12, (lines * 16) >> 3); in cx25821_sram_channel_setup()
466 cx_write(ch->cmds_start + 16, ch->ctrl_start); in cx25821_sram_channel_setup()
468 if (ch->jumponly) in cx25821_sram_channel_setup()
469 cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2)); in cx25821_sram_channel_setup()
471 cx_write(ch->cmds_start + 20, 64 >> 2); in cx25821_sram_channel_setup()
474 cx_write(ch->cmds_start + i, 0); in cx25821_sram_channel_setup()
477 cx_write(ch->ptr1_reg, ch->fifo_start); in cx25821_sram_channel_setup()
478 cx_write(ch->ptr2_reg, cdt); in cx25821_sram_channel_setup()
479 cx_write(ch->cnt2_reg, (lines * 16) >> 3); in cx25821_sram_channel_setup()
480 cx_write(ch->cnt1_reg, (bpl >> 3) - 1); in cx25821_sram_channel_setup()
492 if (ch->cmds_start == 0) { in cx25821_sram_channel_setup_audio()
493 cx_write(ch->ptr1_reg, 0); in cx25821_sram_channel_setup_audio()
494 cx_write(ch->ptr2_reg, 0); in cx25821_sram_channel_setup_audio()
495 cx_write(ch->cnt2_reg, 0); in cx25821_sram_channel_setup_audio()
496 cx_write(ch->cnt1_reg, 0); in cx25821_sram_channel_setup_audio()
501 cdt = ch->cdt; in cx25821_sram_channel_setup_audio()
502 lines = ch->fifo_size / bpl; in cx25821_sram_channel_setup_audio()
515 cx_write(cdt + 16 * i, ch->fifo_start + bpl * i); in cx25821_sram_channel_setup_audio()
522 if (ch->jumponly) in cx25821_sram_channel_setup_audio()
523 cx_write(ch->cmds_start + 0, 8); in cx25821_sram_channel_setup_audio()
525 cx_write(ch->cmds_start + 0, risc); in cx25821_sram_channel_setup_audio()
527 cx_write(ch->cmds_start + 4, 0); /* 64 bits 63-32 */ in cx25821_sram_channel_setup_audio()
528 cx_write(ch->cmds_start + 8, cdt); in cx25821_sram_channel_setup_audio()
529 cx_write(ch->cmds_start + 12, (lines * 16) >> 3); in cx25821_sram_channel_setup_audio()
530 cx_write(ch->cmds_start + 16, ch->ctrl_start); in cx25821_sram_channel_setup_audio()
533 if (ch->jumponly) in cx25821_sram_channel_setup_audio()
534 cx_write(ch->cmds_start + 20, 0x80000000 | (64 >> 2)); in cx25821_sram_channel_setup_audio()
536 cx_write(ch->cmds_start + 20, 64 >> 2); in cx25821_sram_channel_setup_audio()
540 cx_write(ch->cmds_start + i, 0); in cx25821_sram_channel_setup_audio()
543 cx_write(ch->ptr1_reg, ch->fifo_start); in cx25821_sram_channel_setup_audio()
544 cx_write(ch->ptr2_reg, cdt); in cx25821_sram_channel_setup_audio()
545 cx_write(ch->cnt2_reg, (lines * 16) >> 3); in cx25821_sram_channel_setup_audio()
546 cx_write(ch->cnt1_reg, (bpl >> 3) - 1); in cx25821_sram_channel_setup_audio()
573 pr_warn("%s: %s - dma channel status dump\n", dev->name, ch->name); in cx25821_sram_channel_dump()
575 pr_warn("cmds + 0x%2x: %-15s: 0x%08x\n", in cx25821_sram_channel_dump()
576 i * 4, name[i], cx_read(ch->cmds_start + 4 * i)); in cx25821_sram_channel_dump()
580 risc = cx_read(ch->cmds_start + 4 * (i + 14)); in cx25821_sram_channel_dump()
581 pr_warn("cmds + 0x%2x: risc%d: ", j + i * 4, i); in cx25821_sram_channel_dump()
586 risc = cx_read(ch->ctrl_start + 4 * i); in cx25821_sram_channel_dump()
587 /* No consideration for bits 63-32 */ in cx25821_sram_channel_dump()
589 pr_warn("ctrl + 0x%2x (0x%08x): iq %x: ", in cx25821_sram_channel_dump()
590 i * 4, ch->ctrl_start + 4 * i, i); in cx25821_sram_channel_dump()
593 risc = cx_read(ch->ctrl_start + 4 * (i + j)); in cx25821_sram_channel_dump()
594 pr_warn("ctrl + 0x%2x : iq %x: 0x%08x [ arg #%d ]\n", in cx25821_sram_channel_dump()
599 pr_warn(" : fifo: 0x%08x -> 0x%x\n", in cx25821_sram_channel_dump()
600 ch->fifo_start, ch->fifo_start + ch->fifo_size); in cx25821_sram_channel_dump()
601 pr_warn(" : ctrl: 0x%08x -> 0x%x\n", in cx25821_sram_channel_dump()
602 ch->ctrl_start, ch->ctrl_start + 6 * 16); in cx25821_sram_channel_dump()
603 pr_warn(" : ptr1_reg: 0x%08x\n", in cx25821_sram_channel_dump()
604 cx_read(ch->ptr1_reg)); in cx25821_sram_channel_dump()
605 pr_warn(" : ptr2_reg: 0x%08x\n", in cx25821_sram_channel_dump()
606 cx_read(ch->ptr2_reg)); in cx25821_sram_channel_dump()
607 pr_warn(" : cnt1_reg: 0x%08x\n", in cx25821_sram_channel_dump()
608 cx_read(ch->cnt1_reg)); in cx25821_sram_channel_dump()
609 pr_warn(" : cnt2_reg: 0x%08x\n", in cx25821_sram_channel_dump()
610 cx_read(ch->cnt2_reg)); in cx25821_sram_channel_dump()
636 pr_info("\n%s: %s - dma Audio channel status dump\n", in cx25821_sram_channel_dump_audio()
637 dev->name, ch->name); in cx25821_sram_channel_dump_audio()
640 pr_info("%s: cmds + 0x%2x: %-15s: 0x%08x\n", in cx25821_sram_channel_dump_audio()
641 dev->name, i * 4, name[i], in cx25821_sram_channel_dump_audio()
642 cx_read(ch->cmds_start + 4 * i)); in cx25821_sram_channel_dump_audio()
646 risc = cx_read(ch->cmds_start + 4 * (i + 14)); in cx25821_sram_channel_dump_audio()
647 pr_warn("cmds + 0x%2x: risc%d: ", j + i * 4, i); in cx25821_sram_channel_dump_audio()
652 risc = cx_read(ch->ctrl_start + 4 * i); in cx25821_sram_channel_dump_audio()
653 /* No consideration for bits 63-32 */ in cx25821_sram_channel_dump_audio()
655 pr_warn("ctrl + 0x%2x (0x%08x): iq %x: ", in cx25821_sram_channel_dump_audio()
656 i * 4, ch->ctrl_start + 4 * i, i); in cx25821_sram_channel_dump_audio()
660 risc = cx_read(ch->ctrl_start + 4 * (i + j)); in cx25821_sram_channel_dump_audio()
661 pr_warn("ctrl + 0x%2x : iq %x: 0x%08x [ arg #%d ]\n", in cx25821_sram_channel_dump_audio()
666 pr_warn(" : fifo: 0x%08x -> 0x%x\n", in cx25821_sram_channel_dump_audio()
667 ch->fifo_start, ch->fifo_start + ch->fifo_size); in cx25821_sram_channel_dump_audio()
668 pr_warn(" : ctrl: 0x%08x -> 0x%x\n", in cx25821_sram_channel_dump_audio()
669 ch->ctrl_start, ch->ctrl_start + 6 * 16); in cx25821_sram_channel_dump_audio()
670 pr_warn(" : ptr1_reg: 0x%08x\n", in cx25821_sram_channel_dump_audio()
671 cx_read(ch->ptr1_reg)); in cx25821_sram_channel_dump_audio()
672 pr_warn(" : ptr2_reg: 0x%08x\n", in cx25821_sram_channel_dump_audio()
673 cx_read(ch->ptr2_reg)); in cx25821_sram_channel_dump_audio()
674 pr_warn(" : cnt1_reg: 0x%08x\n", in cx25821_sram_channel_dump_audio()
675 cx_read(ch->cnt1_reg)); in cx25821_sram_channel_dump_audio()
676 pr_warn(" : cnt2_reg: 0x%08x\n", in cx25821_sram_channel_dump_audio()
677 cx_read(ch->cnt2_reg)); in cx25821_sram_channel_dump_audio()
680 risc = cx_read(ch->cmds_start + 56 + (i * 4)); in cx25821_sram_channel_dump_audio()
681 pr_warn("instruction %d = 0x%x\n", i, risc); in cx25821_sram_channel_dump_audio()
686 pr_warn("\nread cdt loc=0x%x\n", risc); in cx25821_sram_channel_dump_audio()
689 pr_cont("0x%x ", n); in cx25821_sram_channel_dump_audio()
694 CX25821_INFO(" CLK_RST = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
697 CX25821_INFO(" PLL_A_POST_STAT_BIST = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
699 CX25821_INFO(" PLL_A_INT_FRAC = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
702 CX25821_INFO(" PLL_B_POST_STAT_BIST = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
704 CX25821_INFO(" PLL_B_INT_FRAC = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
707 CX25821_INFO(" PLL_C_POST_STAT_BIST = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
709 CX25821_INFO(" PLL_C_INT_FRAC = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
712 CX25821_INFO(" PLL_D_POST_STAT_BIST = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
714 CX25821_INFO(" PLL_D_INT_FRAC = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
716 value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); in cx25821_sram_channel_dump_audio()
717 CX25821_INFO(" AFE_AB_DIAG_CTRL (0x10900090) = 0x%x\n\n", value); in cx25821_sram_channel_dump_audio()
730 cx_write(dev->channels[i].sram_channels->dma_ctl, 0); in cx25821_shutdown()
731 cx_write(dev->channels[i].sram_channels->int_msk, 0); in cx25821_shutdown()
736 cx_write(dev->channels[i].sram_channels->dma_ctl, 0); in cx25821_shutdown()
737 cx_write(dev->channels[i].sram_channels->int_msk, 0); in cx25821_shutdown()
755 cx_write(dev->channels[channel_select].sram_channels->pix_frmt, in cx25821_set_pixel_format()
758 dev->channels[channel_select].pixel_formats = format; in cx25821_set_pixel_format()
764 cx_write(ch->pix_frmt, PIXEL_FRMT_422); in cx25821_set_vip_mode()
765 cx_write(ch->vip_ctl, PIXEL_ENGINE_VIP1); in cx25821_set_vip_mode()
778 cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff); in cx25821_initialize()
792 cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); in cx25821_initialize()
793 cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels, in cx25821_initialize()
795 dev->channels[i].pixel_formats = PIXEL_FRMT_422; in cx25821_initialize()
796 dev->channels[i].use_cif_resolution = 0; in cx25821_initialize()
802 dev->channels[i].pixel_formats = PIXEL_FRMT_422; in cx25821_initialize()
803 cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); in cx25821_initialize()
807 dev->channels[SRAM_CH08].sram_channels, 128, 0); in cx25821_initialize()
814 if (request_mem_region(pci_resource_start(dev->pci, 0), in cx25821_get_resources()
815 pci_resource_len(dev->pci, 0), dev->name)) in cx25821_get_resources()
818 pr_err("%s: can't get MMIO memory @ 0x%llx\n", in cx25821_get_resources()
819 dev->name, (unsigned long long)pci_resource_start(dev->pci, 0)); in cx25821_get_resources()
821 return -EBUSY; in cx25821_get_resources()
826 dev->hwrevision = cx_read(RDR_CFG2) & 0xff; in cx25821_dev_checkrevision()
828 pr_info("Hardware revision = 0x%02x\n", dev->hwrevision); in cx25821_dev_checkrevision()
837 if (dev->lmmio != NULL) { in cx25821_iounmap()
838 iounmap(dev->lmmio); in cx25821_iounmap()
839 dev->lmmio = NULL; in cx25821_iounmap()
848 mutex_init(&dev->lock); in cx25821_dev_setup()
850 dev->nr = ++cx25821_devcount; in cx25821_dev_setup()
851 sprintf(dev->name, "cx25821[%d]", dev->nr); in cx25821_dev_setup()
853 if (dev->nr >= ARRAY_SIZE(card)) { in cx25821_dev_setup()
854 CX25821_INFO("dev->nr >= %zd", ARRAY_SIZE(card)); in cx25821_dev_setup()
855 return -ENODEV; in cx25821_dev_setup()
857 if (dev->pci->device != 0x8210) { in cx25821_dev_setup()
858 pr_info("%s(): Exiting. Incorrect Hardware device = 0x%02x\n", in cx25821_dev_setup()
859 __func__, dev->pci->device); in cx25821_dev_setup()
860 return -ENODEV; in cx25821_dev_setup()
862 pr_info("Athena Hardware device = 0x%02x\n", dev->pci->device); in cx25821_dev_setup()
865 dev->clk_freq = 28000000; in cx25821_dev_setup()
867 dev->channels[i].dev = dev; in cx25821_dev_setup()
868 dev->channels[i].id = i; in cx25821_dev_setup()
869 dev->channels[i].sram_channels = &cx25821_sram_channels[i]; in cx25821_dev_setup()
873 dev->board = 1; /* card[dev->nr]; */ in cx25821_dev_setup()
874 dev->_max_num_decoders = MAX_DECODERS; in cx25821_dev_setup()
876 dev->pci_bus = dev->pci->bus->number; in cx25821_dev_setup()
877 dev->pci_slot = PCI_SLOT(dev->pci->devfn); in cx25821_dev_setup()
878 dev->pci_irqmask = 0x001f00; in cx25821_dev_setup()
881 dev->i2c_bus[0].nr = 0; in cx25821_dev_setup()
882 dev->i2c_bus[0].dev = dev; in cx25821_dev_setup()
883 dev->i2c_bus[0].reg_stat = I2C1_STAT; in cx25821_dev_setup()
884 dev->i2c_bus[0].reg_ctrl = I2C1_CTRL; in cx25821_dev_setup()
885 dev->i2c_bus[0].reg_addr = I2C1_ADDR; in cx25821_dev_setup()
886 dev->i2c_bus[0].reg_rdata = I2C1_RDATA; in cx25821_dev_setup()
887 dev->i2c_bus[0].reg_wdata = I2C1_WDATA; in cx25821_dev_setup()
888 dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */ in cx25821_dev_setup()
891 pr_err("%s: No more PCIe resources for subsystem: %04x:%04x\n", in cx25821_dev_setup()
892 dev->name, dev->pci->subsystem_vendor, in cx25821_dev_setup()
893 dev->pci->subsystem_device); in cx25821_dev_setup()
895 cx25821_devcount--; in cx25821_dev_setup()
896 return -EBUSY; in cx25821_dev_setup()
900 dev->base_io_addr = pci_resource_start(dev->pci, 0); in cx25821_dev_setup()
902 if (!dev->base_io_addr) { in cx25821_dev_setup()
904 return -ENODEV; in cx25821_dev_setup()
907 dev->lmmio = ioremap(dev->base_io_addr, pci_resource_len(dev->pci, 0)); in cx25821_dev_setup()
909 if (!dev->lmmio) { in cx25821_dev_setup()
912 return -ENOMEM; in cx25821_dev_setup()
915 dev->bmmio = (u8 __iomem *) dev->lmmio; in cx25821_dev_setup()
917 pr_info("%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", in cx25821_dev_setup()
918 dev->name, dev->pci->subsystem_vendor, in cx25821_dev_setup()
919 dev->pci->subsystem_device, cx25821_boards[dev->board].name, in cx25821_dev_setup()
920 dev->board, card[dev->nr] == dev->board ? in cx25821_dev_setup()
926 cx25821_i2c_register(&dev->i2c_bus[0]); in cx25821_dev_setup()
927 /* cx25821_i2c_register(&dev->i2c_bus[1]); in cx25821_dev_setup()
928 * cx25821_i2c_register(&dev->i2c_bus[2]); */ in cx25821_dev_setup()
943 if (!dev->base_io_addr) in cx25821_dev_unregister()
946 release_mem_region(dev->base_io_addr, pci_resource_len(dev->pci, 0)); in cx25821_dev_unregister()
948 for (i = 0; i < MAX_VID_CAP_CHANNEL_NUM - 1; i++) { in cx25821_dev_unregister()
955 cx25821_free_mem_upstream(&dev->channels[i]); in cx25821_dev_unregister()
960 cx25821_i2c_unregister(&dev->i2c_bus[0]); in cx25821_dev_unregister()
972 if (risc->cpu && risc->size < size) { in cx25821_riscmem_alloc()
973 dma_free_coherent(&pci->dev, risc->size, risc->cpu, risc->dma); in cx25821_riscmem_alloc()
974 risc->cpu = NULL; in cx25821_riscmem_alloc()
976 if (NULL == risc->cpu) { in cx25821_riscmem_alloc()
977 cpu = dma_alloc_coherent(&pci->dev, size, &dma, GFP_KERNEL); in cx25821_riscmem_alloc()
979 return -ENOMEM; in cx25821_riscmem_alloc()
980 risc->cpu = cpu; in cx25821_riscmem_alloc()
981 risc->dma = dma; in cx25821_riscmem_alloc()
982 risc->size = size; in cx25821_riscmem_alloc()
988 static __le32 *cx25821_risc_field(__le32 * rp, struct scatterlist *sglist, in cx25821_risc_field() argument
997 *(rp++) = cpu_to_le32(RISC_JUMP); in cx25821_risc_field()
998 *(rp++) = cpu_to_le32(0); in cx25821_risc_field()
999 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field()
1004 *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); in cx25821_risc_field()
1010 offset -= sg_dma_len(sg); in cx25821_risc_field()
1013 if (bpl <= sg_dma_len(sg) - offset) { in cx25821_risc_field()
1015 *(rp++) = cpu_to_le32(RISC_WRITE | RISC_SOL | RISC_EOL | in cx25821_risc_field()
1017 *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset); in cx25821_risc_field()
1018 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field()
1023 *(rp++) = cpu_to_le32(RISC_WRITE | RISC_SOL | in cx25821_risc_field()
1024 (sg_dma_len(sg) - offset)); in cx25821_risc_field()
1025 *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset); in cx25821_risc_field()
1026 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field()
1027 todo -= (sg_dma_len(sg) - offset); in cx25821_risc_field()
1031 *(rp++) = cpu_to_le32(RISC_WRITE | in cx25821_risc_field()
1033 *(rp++) = cpu_to_le32(sg_dma_address(sg)); in cx25821_risc_field()
1034 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field()
1035 todo -= sg_dma_len(sg); in cx25821_risc_field()
1038 *(rp++) = cpu_to_le32(RISC_WRITE | RISC_EOL | todo); in cx25821_risc_field()
1039 *(rp++) = cpu_to_le32(sg_dma_address(sg)); in cx25821_risc_field()
1040 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field()
1047 return rp; in cx25821_risc_field()
1057 __le32 *rp; in cx25821_risc_buffer() local
1080 rp = risc->cpu; in cx25821_risc_buffer()
1083 rp = cx25821_risc_field(rp, sglist, top_offset, 0, bpl, padding, in cx25821_risc_buffer()
1088 rp = cx25821_risc_field(rp, sglist, bottom_offset, 0x200, bpl, in cx25821_risc_buffer()
1093 risc->jmp = rp; in cx25821_risc_buffer()
1094 BUG_ON((risc->jmp - risc->cpu + 3) * sizeof(*risc->cpu) > risc->size); in cx25821_risc_buffer()
1099 static __le32 *cx25821_risc_field_audio(__le32 * rp, struct scatterlist *sglist, in cx25821_risc_field_audio() argument
1109 *(rp++) = cpu_to_le32(RISC_RESYNC | sync_line); in cx25821_risc_field_audio()
1115 offset -= sg_dma_len(sg); in cx25821_risc_field_audio()
1124 if (bpl <= sg_dma_len(sg) - offset) { in cx25821_risc_field_audio()
1126 *(rp++) = cpu_to_le32(RISC_WRITE | sol | RISC_EOL | in cx25821_risc_field_audio()
1128 *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset); in cx25821_risc_field_audio()
1129 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field_audio()
1134 *(rp++) = cpu_to_le32(RISC_WRITE | sol | in cx25821_risc_field_audio()
1135 (sg_dma_len(sg) - offset)); in cx25821_risc_field_audio()
1136 *(rp++) = cpu_to_le32(sg_dma_address(sg) + offset); in cx25821_risc_field_audio()
1137 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field_audio()
1138 todo -= (sg_dma_len(sg) - offset); in cx25821_risc_field_audio()
1142 *(rp++) = cpu_to_le32(RISC_WRITE | in cx25821_risc_field_audio()
1144 *(rp++) = cpu_to_le32(sg_dma_address(sg)); in cx25821_risc_field_audio()
1145 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field_audio()
1146 todo -= sg_dma_len(sg); in cx25821_risc_field_audio()
1149 *(rp++) = cpu_to_le32(RISC_WRITE | RISC_EOL | todo); in cx25821_risc_field_audio()
1150 *(rp++) = cpu_to_le32(sg_dma_address(sg)); in cx25821_risc_field_audio()
1151 *(rp++) = cpu_to_le32(0); /* bits 63-32 */ in cx25821_risc_field_audio()
1157 return rp; in cx25821_risc_field_audio()
1167 __le32 *rp; in cx25821_risc_databuffer_audio() local
1183 rp = risc->cpu; in cx25821_risc_databuffer_audio()
1184 rp = cx25821_risc_field_audio(rp, sglist, 0, NO_SYNC_LINE, bpl, 0, in cx25821_risc_databuffer_audio()
1188 risc->jmp = rp; in cx25821_risc_databuffer_audio()
1189 BUG_ON((risc->jmp - risc->cpu + 2) * sizeof(*risc->cpu) > risc->size); in cx25821_risc_databuffer_audio()
1196 if (WARN_ON(buf->risc.size == 0)) in cx25821_free_buffer()
1198 dma_free_coherent(&dev->pci->dev, buf->risc.size, buf->risc.cpu, in cx25821_free_buffer()
1199 buf->risc.dma); in cx25821_free_buffer()
1200 memset(&buf->risc, 0, sizeof(buf->risc)); in cx25821_free_buffer()
1218 vid_status = cx_read(dev->channels[i]. in cx25821_irq()
1219 sram_channels->int_stat); in cx25821_irq()
1238 printk(KERN_DEBUG pr_fmt("%s: %s [0x%x]"), name, tag, bits); in cx25821_print_irqbits()
1270 return -ENOMEM; in cx25821_initdev()
1272 err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev); in cx25821_initdev()
1277 dev->pci = pci_dev; in cx25821_initdev()
1279 err = -EIO; in cx25821_initdev()
1291 pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); in cx25821_initdev()
1292 pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); in cx25821_initdev()
1293 pr_info("%s/0: found at %s, rev: %d, irq: %d, latency: %d, mmio: 0x%llx\n", in cx25821_initdev()
1294 dev->name, pci_name(pci_dev), dev->pci_rev, pci_dev->irq, in cx25821_initdev()
1295 dev->pci_lat, (unsigned long long)dev->base_io_addr); in cx25821_initdev()
1298 err = dma_set_mask(&pci_dev->dev, 0xffffffff); in cx25821_initdev()
1300 pr_err("%s/0: Oops: no 32bit PCI DMA ???\n", dev->name); in cx25821_initdev()
1301 err = -EIO; in cx25821_initdev()
1305 err = request_irq(pci_dev->irq, cx25821_irq, in cx25821_initdev()
1306 IRQF_SHARED, dev->name, dev); in cx25821_initdev()
1309 pr_err("%s: can't get IRQ %d\n", dev->name, pci_dev->irq); in cx25821_initdev()
1322 v4l2_device_unregister(&dev->v4l2_dev); in cx25821_initdev()
1337 if (pci_dev->irq) in cx25821_finidev()
1338 free_irq(pci_dev->irq, dev); in cx25821_finidev()
1360 /* --- end of list --- */