Lines Matching defs:vpu_dev

16 	struct vpu_device *vpu_dev = dev_get_drvdata(dev);
18 if (!vpu_dev->common_mem.vaddr) {
21 if (vpu_dev->product_code == WAVE515_CODE)
22 vpu_dev->common_mem.size = WAVE515_SIZE_COMMON;
24 vpu_dev->common_mem.size = WAVE521_SIZE_COMMON;
26 ret = wave5_vdi_allocate_dma_memory(vpu_dev, &vpu_dev->common_mem);
34 &vpu_dev->common_mem.daddr, vpu_dev->common_mem.size, vpu_dev->common_mem.vaddr);
41 struct vpu_device *vpu_dev = dev_get_drvdata(dev);
50 if (!PRODUCT_CODE_W_SERIES(vpu_dev->product_code)) {
51 WARN_ONCE(1, "unsupported product code: 0x%x\n", vpu_dev->product_code);
56 if (wave5_vdi_read_register(vpu_dev, W5_VCPU_CUR_PC) == 0) {
60 wave5_vdi_write_register(vpu_dev, (i * 4) + 0x100, 0x0);
70 struct vpu_device *vpu_dev = dev_get_drvdata(dev);
72 vpu_dev->vdb_register = NULL;
73 wave5_vdi_free_dma_memory(vpu_dev, &vpu_dev->common_mem);
78 void wave5_vdi_write_register(struct vpu_device *vpu_dev, u32 addr, u32 data)
80 writel(data, vpu_dev->vdb_register + addr);
83 unsigned int wave5_vdi_read_register(struct vpu_device *vpu_dev, u32 addr)
85 return readl(vpu_dev->vdb_register + addr);
88 int wave5_vdi_clear_memory(struct vpu_device *vpu_dev, struct vpu_buf *vb)
91 dev_err(vpu_dev->dev, "%s: unable to clear unmapped buffer\n", __func__);
99 int wave5_vdi_write_memory(struct vpu_device *vpu_dev, struct vpu_buf *vb, size_t offset,
103 dev_err(vpu_dev->dev, "%s: unable to write to unmapped buffer\n", __func__);
108 dev_err(vpu_dev->dev, "%s: buffer too small\n", __func__);
117 int wave5_vdi_allocate_dma_memory(struct vpu_device *vpu_dev, struct vpu_buf *vb)
123 dev_err(vpu_dev->dev, "%s: requested size==0\n", __func__);
127 vaddr = dma_alloc_coherent(vpu_dev->dev, vb->size, &daddr, GFP_KERNEL);
136 int wave5_vdi_free_dma_memory(struct vpu_device *vpu_dev, struct vpu_buf *vb)
142 dev_err(vpu_dev->dev, "%s: requested free of unmapped buffer\n", __func__);
144 dma_free_coherent(vpu_dev->dev, vb->size, vb->vaddr, vb->daddr);
151 int wave5_vdi_allocate_array(struct vpu_device *vpu_dev, struct vpu_buf *array, unsigned int count,
164 wave5_vdi_free_dma_memory(vpu_dev, &array[i]);
166 ret = wave5_vdi_allocate_dma_memory(vpu_dev, &vb_buf);
173 wave5_vdi_free_dma_memory(vpu_dev, &array[i]);
178 void wave5_vdi_allocate_sram(struct vpu_device *vpu_dev)
180 struct vpu_buf *vb = &vpu_dev->sram_buf;
185 if (!vpu_dev->sram_pool || vb->vaddr)
188 size = min_t(size_t, vpu_dev->sram_size, gen_pool_avail(vpu_dev->sram_pool));
189 vaddr = gen_pool_dma_alloc(vpu_dev->sram_pool, size, &daddr);
196 dev_dbg(vpu_dev->dev, "%s: sram daddr: %pad, size: %zu, vaddr: 0x%p\n",
200 void wave5_vdi_free_sram(struct vpu_device *vpu_dev)
202 struct vpu_buf *vb = &vpu_dev->sram_buf;
207 gen_pool_free(vpu_dev->sram_pool, (unsigned long)vb->vaddr, vb->size);