blob: e930dbb9d7f45813ff68615e1ea7a18ba0a246e8 [file] [log] [blame]
Thomas Gleixner77512ba2019-06-03 07:44:53 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -03002/*
3 * helper functions for vmalloc capture buffers
4 *
Magnus Damm5d6aaf52008-07-16 21:27:49 -03005 * The functions expect the hardware being able to scatter gather
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -03006 * (i.e. the buffers are not linear in physical memory, but fragmented
7 * into PAGE_SIZE chunks). They also assume the driver does not need
8 * to touch the video data.
9 *
Mauro Carvalho Chehab32590812018-04-25 05:34:48 -040010 * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org>
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030011 */
Mauro Carvalho Chehab59d34482008-04-13 15:10:00 -030012#ifndef _VIDEOBUF_VMALLOC_H
13#define _VIDEOBUF_VMALLOC_H
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030014
15#include <media/videobuf-core.h>
16
17/* --------------------------------------------------------------------- */
18
Pawel Osciak7a022642010-03-17 04:01:04 -030019struct videobuf_vmalloc_memory {
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030020 u32 magic;
21
Laurent Pinchartbb6dbe72010-05-11 10:36:34 -030022 void *vaddr;
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030023
Pawel Osciak7a022642010-03-17 04:01:04 -030024 /* remap_vmalloc_range seems to need to run
25 * after mmap() on some cases */
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030026 struct vm_area_struct *vma;
27};
28
Pawel Osciak7a022642010-03-17 04:01:04 -030029void videobuf_queue_vmalloc_init(struct videobuf_queue *q,
Jonathan Corbet38a54f32009-11-17 19:43:41 -030030 const struct videobuf_queue_ops *ops,
Jonathan Corbetf8b0bca2009-11-23 14:29:35 -030031 struct device *dev,
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030032 spinlock_t *irqlock,
33 enum v4l2_buf_type type,
34 enum v4l2_field field,
35 unsigned int msize,
Hans Verkuil08bff032010-09-20 17:39:46 -030036 void *priv,
37 struct mutex *ext_lock);
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030038
Pawel Osciak7a022642010-03-17 04:01:04 -030039void *videobuf_to_vmalloc(struct videobuf_buffer *buf);
Mauro Carvalho Chehab87b9ad02007-08-02 23:31:33 -030040
Pawel Osciak7a022642010-03-17 04:01:04 -030041void videobuf_vmalloc_free(struct videobuf_buffer *buf);
Mauro Carvalho Chehab59d34482008-04-13 15:10:00 -030042
43#endif