WIP FPC-III support
[linux/fpc-iii.git] / include / linux / dma-heap.h
blob454e354d1ffb7e10ab62bafe36d147b58d56aba9
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * DMABUF Heaps Allocation Infrastructure
5 * Copyright (C) 2011 Google, Inc.
6 * Copyright (C) 2019 Linaro Ltd.
7 */
9 #ifndef _DMA_HEAPS_H
10 #define _DMA_HEAPS_H
12 #include <linux/cdev.h>
13 #include <linux/types.h>
15 struct dma_heap;
17 /**
18 * struct dma_heap_ops - ops to operate on a given heap
19 * @allocate: allocate dmabuf and return fd
21 * allocate returns dmabuf fd on success, -errno on error.
23 struct dma_heap_ops {
24 int (*allocate)(struct dma_heap *heap,
25 unsigned long len,
26 unsigned long fd_flags,
27 unsigned long heap_flags);
30 /**
31 * struct dma_heap_export_info - information needed to export a new dmabuf heap
32 * @name: used for debugging/device-node name
33 * @ops: ops struct for this heap
34 * @priv: heap exporter private data
36 * Information needed to export a new dmabuf heap.
38 struct dma_heap_export_info {
39 const char *name;
40 const struct dma_heap_ops *ops;
41 void *priv;
44 /**
45 * dma_heap_get_drvdata() - get per-heap driver data
46 * @heap: DMA-Heap to retrieve private data for
48 * Returns:
49 * The per-heap data for the heap.
51 void *dma_heap_get_drvdata(struct dma_heap *heap);
53 /**
54 * dma_heap_add - adds a heap to dmabuf heaps
55 * @exp_info: information needed to register this heap
57 struct dma_heap *dma_heap_add(const struct dma_heap_export_info *exp_info);
59 #endif /* _DMA_HEAPS_H */