summaryrefstree
path: root/kernel/drivers/vision/vpu/vpuo-pu.h
blob: daefc9339ac1857a09eb17ddb205341e8a5fefdd (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Samsung Exynos SoC series VPU driver
 *
 * Copyright (c) 2015 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef VPU_OBJ_PU_H_
#define VPU_OBJ_PU_H_

#include "vs4l.h"

#define VPUO_PU_MAX_PORT		(VPUL_PU_MAX_PORTS * 2)
#define VPUO_PU_MAX_BUFFER		VPUL_MAX_3DNN_LAYERS_IN_PROC_BASE

enum vpuo_type {
	VPU_TYPE_SIGNED,
	VPU_TYPE_UNSIGNED
};

struct vpuo_channel {
	__u16			enable:1;
	__u16			type:1;
	__u16			effective_bit:6;
	__u16			width;
	__u16			height;
};

struct vpuo_border {
	/*
	 * [X] BORDER MODE
	 * <0> constant fill
	 * <1> not supported
	 * <2> replicating fill
	 */
	__u16 mode;
	struct {
		__u16		up:4;
		__u16		down:4;
		__u16		left:4;
		__u16		right:4;
	} direction;
	__u32 constant;
};

enum vpuo_sram_mode {
	VPU_SRAM_MODE_AUTO,
	VPU_SRAM_MODE_MANUAL
};

enum vpuo_sram_type {
	VPU_SRAM_TYPE_SMALL,
	VPU_SRAM_TYPE_LARGE
};

struct vpuo_sram {
	__u8			mode;
	__u8			type;
	__u8			port;
};

enum vpuo_tile_mode {
	VPU_TILE_MODE_AUTO,
	VPU_TILE_MODE_MANUAL
};

struct vpuo_tile {
	__u8			mode;
	__u16			width;
	__u16			height;
};

enum vpuo_pu_state {
	VPUO_PU_STATE_FORMAT,
	VPUO_PU_STATE_MAPPED,
	VPUO_PU_STATE_IN,
	VPUO_PU_STATE_OT,
	VPUO_PU_STATE_IM
};

struct vpuo_pu {
	u32				id;
	u32				index;
	u32				type;
	u32				level;
	u32				target;
	void				*sfr;
	void				*parent;
	struct list_head		level_entry; /* chain level entry */
	struct list_head		cleaf_entry; /* chain leaf entry */
	struct list_head		vleaf_entry; /* vertex leaf entry */
	struct list_head		gleaf_entry; /* graph leaf entry */
	unsigned long			state;

	struct vpul_pu			*desc_upu;
	struct vpul_pu			*desc_mpu;

	u32				inpu_cnt;
	u32				otpu_cnt;
	struct vpuo_pu			*inpu[VPUO_PU_MAX_PORT];
	struct vpuo_pu			*otpu[VPUO_PU_MAX_PORT];

	/* DMA parameter */
	struct vb_container		*container[VPU_MAX_BUFFER];
	u32				buffer_cnt;
	u32				buffer_shm[VPUO_PU_MAX_BUFFER];
	u32				buffer_idx[VPUO_PU_MAX_BUFFER];
	u32				*buffer_ptr[VPUO_PU_MAX_BUFFER];
	u32				buffer[VPUO_PU_MAX_BUFFER];
};

int vpuo_pu_create(struct vpuo_pu **pu,
	char *desc_ubase,
	char *desc_mbase,
	struct vpul_pu *desc_upu,
	struct vpul_pu *desc_mpu,
	void *parent);
int vpuo_pu_destroy(struct vpuo_pu *pu);

#endif