Thomas Gleixner | 77512ba | 2019-06-03 07:44:53 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 2 | /* |
| 3 | * helper functions for vmalloc capture buffers |
| 4 | * |
Magnus Damm | 5d6aaf5 | 2008-07-16 21:27:49 -0300 | [diff] [blame] | 5 | * The functions expect the hardware being able to scatter gather |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 6 | * (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 Chehab | 3259081 | 2018-04-25 05:34:48 -0400 | [diff] [blame] | 10 | * (c) 2007 Mauro Carvalho Chehab, <mchehab@kernel.org> |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 11 | */ |
Mauro Carvalho Chehab | 59d3448 | 2008-04-13 15:10:00 -0300 | [diff] [blame] | 12 | #ifndef _VIDEOBUF_VMALLOC_H |
| 13 | #define _VIDEOBUF_VMALLOC_H |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 14 | |
| 15 | #include <media/videobuf-core.h> |
| 16 | |
| 17 | /* --------------------------------------------------------------------- */ |
| 18 | |
Pawel Osciak | 7a02264 | 2010-03-17 04:01:04 -0300 | [diff] [blame] | 19 | struct videobuf_vmalloc_memory { |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 20 | u32 magic; |
| 21 | |
Laurent Pinchart | bb6dbe7 | 2010-05-11 10:36:34 -0300 | [diff] [blame] | 22 | void *vaddr; |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 23 | |
Pawel Osciak | 7a02264 | 2010-03-17 04:01:04 -0300 | [diff] [blame] | 24 | /* remap_vmalloc_range seems to need to run |
| 25 | * after mmap() on some cases */ |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 26 | struct vm_area_struct *vma; |
| 27 | }; |
| 28 | |
Pawel Osciak | 7a02264 | 2010-03-17 04:01:04 -0300 | [diff] [blame] | 29 | void videobuf_queue_vmalloc_init(struct videobuf_queue *q, |
Jonathan Corbet | 38a54f3 | 2009-11-17 19:43:41 -0300 | [diff] [blame] | 30 | const struct videobuf_queue_ops *ops, |
Jonathan Corbet | f8b0bca | 2009-11-23 14:29:35 -0300 | [diff] [blame] | 31 | struct device *dev, |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 32 | spinlock_t *irqlock, |
| 33 | enum v4l2_buf_type type, |
| 34 | enum v4l2_field field, |
| 35 | unsigned int msize, |
Hans Verkuil | 08bff03 | 2010-09-20 17:39:46 -0300 | [diff] [blame] | 36 | void *priv, |
| 37 | struct mutex *ext_lock); |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 38 | |
Pawel Osciak | 7a02264 | 2010-03-17 04:01:04 -0300 | [diff] [blame] | 39 | void *videobuf_to_vmalloc(struct videobuf_buffer *buf); |
Mauro Carvalho Chehab | 87b9ad0 | 2007-08-02 23:31:33 -0300 | [diff] [blame] | 40 | |
Pawel Osciak | 7a02264 | 2010-03-17 04:01:04 -0300 | [diff] [blame] | 41 | void videobuf_vmalloc_free(struct videobuf_buffer *buf); |
Mauro Carvalho Chehab | 59d3448 | 2008-04-13 15:10:00 -0300 | [diff] [blame] | 42 | |
| 43 | #endif |