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