blob: b396de0bedd717f5894a9b13774904becac6d4af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Samsung Exynos SoC series dsp driver
*
* Copyright (c) 2019 Samsung Electronics Co., Ltd.
* http://www.samsung.com/
*/
#ifndef __DSP_MEMORY_H__
#define __DSP_MEMORY_H__
#include <linux/dma-buf.h>
#include "dsp-hw-memory.h"
#define DSP_PRIV_MEM_NAME_LEN (16)
struct dsp_system;
struct dsp_buffer {
int fd;
size_t size;
unsigned int offset;
bool cached;
struct list_head list;
struct dma_buf *dbuf;
size_t dbuf_size;
enum dma_data_direction dir;
struct dma_buf_attachment *attach;
struct sg_table *sgt;
dma_addr_t iova;
void *kvaddr;
};
struct dsp_priv_mem {
char name[DSP_PRIV_MEM_NAME_LEN];
size_t size;
size_t min_size;
size_t max_size;
size_t used_size;
long flags;
bool kmap;
bool fixed_iova;
bool backup;
struct dma_buf *dbuf;
size_t dbuf_size;
enum dma_data_direction dir;
struct dma_buf_attachment *attach;
struct sg_table *sgt;
dma_addr_t iova;
void *kvaddr;
void *bac_kvaddr;
};
int dsp_memory_map_buffer(struct dsp_memory *mem, struct dsp_buffer *buf);
int dsp_memory_unmap_buffer(struct dsp_memory *mem, struct dsp_buffer *buf);
int dsp_memory_sync_for_device(struct dsp_memory *mem, struct dsp_buffer *buf);
int dsp_memory_sync_for_cpu(struct dsp_memory *mem, struct dsp_buffer *buf);
int dsp_memory_alloc(struct dsp_memory *mem, struct dsp_priv_mem *pmem);
void dsp_memory_free(struct dsp_memory *mem, struct dsp_priv_mem *pmem);
int dsp_memory_ion_alloc(struct dsp_memory *mem, struct dsp_priv_mem *pmem);
void dsp_memory_ion_free(struct dsp_memory *mem, struct dsp_priv_mem *pmem);
int dsp_memory_open(struct dsp_memory *mem);
int dsp_memory_close(struct dsp_memory *mem);
int dsp_memory_probe(struct dsp_system *sys);
void dsp_memory_remove(struct dsp_memory *mem);
#endif
|