aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/media/sunxi/cedar/ve/cedar_ve_priv.h
blob: ca347d416f47ad3820f108382475c7f568f1e10a (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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// SPDX-License-Identifier: GPL-2.0
#ifndef _CEDAR_VE_PRIV_H_
#define _CEDAR_VE_PRIV_H_
#include "ve_mem_list.h"

#ifndef CEDARDEV_MAJOR
#define CEDARDEV_MAJOR (150)
#endif
#ifndef CEDARDEV_MINOR
#define CEDARDEV_MINOR (0)
#endif

#define VE_CLK_HIGH_WATER (900)
#define VE_CLK_LOW_WATER (100)

#define PRINTK_IOMMU_ADDR 0

#define VE_DEBUGFS_MAX_CHANNEL 16
#define VE_DEBUGFS_BUF_SIZE 1024

#define CEDAR_RUN_LIST_NONULL -1
#define CEDAR_NONBLOCK_TASK 0
#define CEDAR_BLOCK_TASK 1
#define CLK_REL_TIME 10000
#define TIMER_CIRCLE 50
#define TASK_INIT 0x00
#define TASK_TIMEOUT 0x55
#define TASK_RELEASE 0xaa
#define SIG_CEDAR 35

struct ve_debugfs_proc
{
	unsigned int len;
	char data[VE_DEBUGFS_BUF_SIZE * VE_DEBUGFS_MAX_CHANNEL];
};

struct ve_debugfs_buffer
{
	unsigned char cur_channel_id;
	unsigned int proc_len[VE_DEBUGFS_MAX_CHANNEL];
	char *proc_buf[VE_DEBUGFS_MAX_CHANNEL];
	char *data;
	struct mutex lock_proc;
};

struct __cedarv_task
{
	int task_prio;
	int ID;
	unsigned long timeout;
	unsigned int frametime;
	unsigned int block_mode;
};

struct cedarv_engine_task
{
	struct __cedarv_task t;
	struct list_head list;
	struct task_struct *task_handle;
	unsigned int status;
	unsigned int running;
	unsigned int is_first_task;
};

struct cedarv_engine_task_info
{
	int task_prio;
	unsigned int frametime;
	unsigned int total_time;
};

struct cedarv_regop
{
	unsigned long addr;
	unsigned int value;
};

struct cedarv_env_infomation_compat
{
	unsigned int phymem_start;
	int phymem_total_size;
	uint32_t address_macc;
};

struct __cedarv_task_compat
{
	int task_prio;
	int ID;
	uint32_t timeout;
	unsigned int frametime;
	unsigned int block_mode;
};

struct cedarv_regop_compat
{
	uint32_t addr;
	unsigned int value;
};

struct VE_PROC_INFO
{
	unsigned char channel_id;
	unsigned int proc_info_len;
};

struct cedar_dev
{
	struct cdev cdev;			 /* char device struct*/
	struct device *dev;			 /* ptr to class device struct*/
	struct device *platform_dev; /* ptr to class device struct */
	struct class *class;		 /* class for auto create device node */

	struct semaphore sem; /* mutual exclusion semaphore */

	wait_queue_head_t wq; /* wait queue for poll ops */

	struct timer_list cedar_engine_timer;
	struct timer_list cedar_engine_timer_rel;

	uint32_t irq;		   /* cedar video engine irq number */
	uint32_t de_irq_flag;  /* flag of video decoder engine irq generated */
	uint32_t de_irq_value; /* value of video decoder engine irq */
	uint32_t en_irq_flag;  /* flag of video encoder engine irq generated */
	uint32_t en_irq_value; /* value of video encoder engine irq */
	uint32_t irq_has_enable;
	uint32_t ref_count;
	int last_min_freq;

	uint32_t jpeg_irq_flag;	 /* flag of video jpeg dec irq generated */
	uint32_t jpeg_irq_value; /* value of video jpeg dec  irq */

	struct mutex lock_vdec;
	struct mutex lock_jdec;
	struct mutex lock_venc;
	struct mutex lock_00_reg;
	struct mutex lock_04_reg;
	struct aw_mem_list_head list; /* buffer list */
	struct mutex lock_mem;

	struct clk *ahb_clk;
	struct clk *mod_clk;
	struct clk *ram_clk;
	struct reset_control *rstc;
	int capabilities;
	phys_addr_t phy_addr;

	void __iomem *regs_macc;
};

struct ve_info
{ /* each object will bind a new file handler */
	unsigned int set_vol_flag;
	struct mutex lock_flag_io;
	uint32_t lock_flags; /* if flags is 0, means unlock status */
};

struct user_iommu_param
{
	int fd;
	unsigned int iommu_addr;
};

struct cedarv_iommu_buffer
{
	struct aw_mem_list_head i_list;
	int fd;
	unsigned long iommu_addr;
	struct dma_buf *dma_buf;
	struct dma_buf_attachment *attachment;
	struct sg_table *sgt;
	int p_id;
};

struct cedar_variant
{
	int capabilities;
	unsigned long mod_rate;
};

#define CEDARV_ISP_OLD (1 << 0)
#define CEDARV_ISP_NEW (1 << 1)

#endif