Lines Matching full:mem
38 struct videobuf_dma_contig_memory *mem, in __videobuf_dc_alloc() argument
41 mem->size = size; in __videobuf_dc_alloc()
42 mem->vaddr = dma_alloc_coherent(dev, mem->size, in __videobuf_dc_alloc()
43 &mem->dma_handle, flags); in __videobuf_dc_alloc()
45 if (!mem->vaddr) { in __videobuf_dc_alloc()
46 dev_err(dev, "memory alloc size %ld failed\n", mem->size); in __videobuf_dc_alloc()
50 dev_dbg(dev, "dma mapped data is at %p (%ld)\n", mem->vaddr, mem->size); in __videobuf_dc_alloc()
56 struct videobuf_dma_contig_memory *mem) in __videobuf_dc_free() argument
58 dma_free_coherent(dev, mem->size, mem->vaddr, mem->dma_handle); in __videobuf_dc_free()
60 mem->vaddr = NULL; in __videobuf_dc_free()
84 struct videobuf_dma_contig_memory *mem; in videobuf_vm_close() local
100 mem = q->bufs[i]->priv; in videobuf_vm_close()
101 if (mem) { in videobuf_vm_close()
108 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in videobuf_vm_close()
114 i, mem->vaddr); in videobuf_vm_close()
116 __videobuf_dc_free(q->dev, mem); in videobuf_vm_close()
117 mem->vaddr = NULL; in videobuf_vm_close()
137 * @mem: per-buffer private videobuf-dma-contig data
141 static void videobuf_dma_contig_user_put(struct videobuf_dma_contig_memory *mem) in videobuf_dma_contig_user_put() argument
143 mem->dma_handle = 0; in videobuf_dma_contig_user_put()
144 mem->size = 0; in videobuf_dma_contig_user_put()
149 * @mem: per-buffer private videobuf-dma-contig data
157 static int videobuf_dma_contig_user_get(struct videobuf_dma_contig_memory *mem, in videobuf_dma_contig_user_get() argument
169 mem->size = PAGE_ALIGN(vb->size + offset); in videobuf_dma_contig_user_get()
178 if ((untagged_baddr + mem->size) > vma->vm_end) in videobuf_dma_contig_user_get()
185 while (pages_done < (mem->size >> PAGE_SHIFT)) { in videobuf_dma_contig_user_get()
191 mem->dma_handle = (this_pfn << PAGE_SHIFT) + offset; in videobuf_dma_contig_user_get()
211 struct videobuf_dma_contig_memory *mem; in __videobuf_alloc() local
214 vb = kzalloc(size + sizeof(*mem), GFP_KERNEL); in __videobuf_alloc()
217 mem = vb->priv; in __videobuf_alloc()
218 mem->magic = MAGIC_DC_MEM; in __videobuf_alloc()
226 struct videobuf_dma_contig_memory *mem = buf->priv; in __videobuf_to_vaddr() local
228 BUG_ON(!mem); in __videobuf_to_vaddr()
229 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in __videobuf_to_vaddr()
231 return mem->vaddr; in __videobuf_to_vaddr()
238 struct videobuf_dma_contig_memory *mem = vb->priv; in __videobuf_iolock() local
240 BUG_ON(!mem); in __videobuf_iolock()
241 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in __videobuf_iolock()
248 if (!mem->vaddr) { in __videobuf_iolock()
258 return videobuf_dma_contig_user_get(mem, vb); in __videobuf_iolock()
261 if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(vb->size), in __videobuf_iolock()
278 struct videobuf_dma_contig_memory *mem; in __videobuf_mmap_mapper() local
294 mem = buf->priv; in __videobuf_mmap_mapper()
295 BUG_ON(!mem); in __videobuf_mmap_mapper()
296 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in __videobuf_mmap_mapper()
298 if (__videobuf_dc_alloc(q->dev, mem, PAGE_ALIGN(buf->bsize), in __videobuf_mmap_mapper()
313 retval = vm_iomap_memory(vma, mem->dma_handle, mem->size); in __videobuf_mmap_mapper()
317 dma_free_coherent(q->dev, mem->size, in __videobuf_mmap_mapper()
318 mem->vaddr, mem->dma_handle); in __videobuf_mmap_mapper()
364 struct videobuf_dma_contig_memory *mem = buf->priv; in videobuf_to_dma_contig() local
366 BUG_ON(!mem); in videobuf_to_dma_contig()
367 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in videobuf_to_dma_contig()
369 return mem->dma_handle; in videobuf_to_dma_contig()
376 struct videobuf_dma_contig_memory *mem = buf->priv; in videobuf_dma_contig_free() local
387 if (!mem) in videobuf_dma_contig_free()
390 MAGIC_CHECK(mem->magic, MAGIC_DC_MEM); in videobuf_dma_contig_free()
394 videobuf_dma_contig_user_put(mem); in videobuf_dma_contig_free()
399 if (mem->vaddr) { in videobuf_dma_contig_free()
400 __videobuf_dc_free(q->dev, mem); in videobuf_dma_contig_free()
401 mem->vaddr = NULL; in videobuf_dma_contig_free()