diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-07-16 20:33:39 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:25:37 -0400 |
commit | 2cc45cf25a2c14da6d18b7570a23ec09fb8f439a (patch) | |
tree | 2e49e60a6d13964681ce8b754ec0f9bf6a608805 /include/media/videobuf-dma-contig.h | |
parent | 5d6aaf50e2986d3289d16fc2859c490c66a1be63 (diff) |
V4L/DVB (8341): videobuf: Add physically contiguous queue code V3
This is V3 of the physically contiguous videobuf queues patch.
Useful for hardware such as the SuperH Mobile CEU which doesn't
support scatter gatter bus mastering.
Since it may be difficult to allocate large chunks of physically
contiguous memory after some uptime due to fragmentation, this code
allocates memory using dma_alloc_coherent(). Architectures supporting
dma_declare_coherent_memory() can easily avoid fragmentation issues
by using dma_declare_coherent_memory() to force dma_alloc_coherent()
to allocate from a certain pre-allocated memory area.
Changes since V2
- use dma_handle for physical address
- use "scatter gather" instead of "scatter gatter"
Changes since V1:
- use dev_err() instead of pr_err()
- remember size in struct videobuf_dma_contig_memory
- keep struct videobuf_dma_contig_memory in .c file
- let videobuf_to_dma_contig() return dma_addr_t
- implement __videobuf_sync()
- return statements, white space and other minor fixes
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'include/media/videobuf-dma-contig.h')
-rw-r--r-- | include/media/videobuf-dma-contig.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/media/videobuf-dma-contig.h b/include/media/videobuf-dma-contig.h new file mode 100644 index 000000000000..549386681aab --- /dev/null +++ b/include/media/videobuf-dma-contig.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * helper functions for physically contiguous capture buffers | ||
3 | * | ||
4 | * The functions support hardware lacking scatter gather support | ||
5 | * (i.e. the buffers must be linear in physical memory) | ||
6 | * | ||
7 | * Copyright (c) 2008 Magnus Damm | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 | ||
12 | */ | ||
13 | #ifndef _VIDEOBUF_DMA_CONTIG_H | ||
14 | #define _VIDEOBUF_DMA_CONTIG_H | ||
15 | |||
16 | #include <linux/dma-mapping.h> | ||
17 | #include <media/videobuf-core.h> | ||
18 | |||
19 | void videobuf_queue_dma_contig_init(struct videobuf_queue *q, | ||
20 | struct videobuf_queue_ops *ops, | ||
21 | struct device *dev, | ||
22 | spinlock_t *irqlock, | ||
23 | enum v4l2_buf_type type, | ||
24 | enum v4l2_field field, | ||
25 | unsigned int msize, | ||
26 | void *priv); | ||
27 | |||
28 | dma_addr_t videobuf_to_dma_contig(struct videobuf_buffer *buf); | ||
29 | void videobuf_dma_contig_free(struct videobuf_queue *q, | ||
30 | struct videobuf_buffer *buf); | ||
31 | |||
32 | #endif /* _VIDEOBUF_DMA_CONTIG_H */ | ||