xref: /OK3568_Linux_fs/kernel/include/media/videobuf-vmalloc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * helper functions for vmalloc capture buffers
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * The functions expect the hardware being able to scatter gather
6*4882a593Smuzhiyun  * (i.e. the buffers are not linear in physical memory, but fragmented
7*4882a593Smuzhiyun  * into PAGE_SIZE chunks).  They also assume the driver does not need
8*4882a593Smuzhiyun  * to touch the video data.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun #ifndef _VIDEOBUF_VMALLOC_H
13*4882a593Smuzhiyun #define _VIDEOBUF_VMALLOC_H
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun #include <media/videobuf-core.h>
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun /* --------------------------------------------------------------------- */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun struct videobuf_vmalloc_memory {
20*4882a593Smuzhiyun 	u32                 magic;
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun 	void                *vaddr;
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun 	/* remap_vmalloc_range seems to need to run
25*4882a593Smuzhiyun 	 * after mmap() on some cases */
26*4882a593Smuzhiyun 	struct vm_area_struct *vma;
27*4882a593Smuzhiyun };
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
30*4882a593Smuzhiyun 			 const struct videobuf_queue_ops *ops,
31*4882a593Smuzhiyun 			 struct device *dev,
32*4882a593Smuzhiyun 			 spinlock_t *irqlock,
33*4882a593Smuzhiyun 			 enum v4l2_buf_type type,
34*4882a593Smuzhiyun 			 enum v4l2_field field,
35*4882a593Smuzhiyun 			 unsigned int msize,
36*4882a593Smuzhiyun 			 void *priv,
37*4882a593Smuzhiyun 			 struct mutex *ext_lock);
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun void videobuf_vmalloc_free(struct videobuf_buffer *buf);
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #endif
44