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
184
185
|
/*
* Samsung Exynos5 SoC series FIMC-IS driver
*
*
* Copyright (c) 2011 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 IS_FRAME_MGR_H
#define IS_FRAME_MGR_H
#include <linux/kthread.h>
#include <linux/videodev2.h>
#include "is-time.h"
#include "is-config.h"
#include "is_framemgr_config.h"
/* #define TRACE_FRAME */
#define FMGR_IDX_0 (1 << 0 )
#define FMGR_IDX_1 (1 << 1 )
#define FMGR_IDX_2 (1 << 2 )
#define FMGR_IDX_3 (1 << 3 )
#define FMGR_IDX_4 (1 << 4 )
#define FMGR_IDX_5 (1 << 5 )
#define FMGR_IDX_6 (1 << 6 )
#define FMGR_IDX_7 (1 << 7 )
#define FMGR_IDX_8 (1 << 8 )
#define FMGR_IDX_9 (1 << 9 )
#define FMGR_IDX_10 (1 << 10)
#define FMGR_IDX_11 (1 << 11)
#define FMGR_IDX_12 (1 << 12)
#define FMGR_IDX_13 (1 << 13)
#define FMGR_IDX_14 (1 << 14)
#define FMGR_IDX_15 (1 << 15)
#define FMGR_IDX_16 (1 << 16)
#define FMGR_IDX_17 (1 << 17)
#define FMGR_IDX_18 (1 << 18)
#define FMGR_IDX_19 (1 << 19)
#define FMGR_IDX_20 (1 << 20)
#define FMGR_IDX_21 (1 << 21)
#define FMGR_IDX_22 (1 << 22)
#define FMGR_IDX_23 (1 << 23)
#define FMGR_IDX_24 (1 << 24)
#define FMGR_IDX_25 (1 << 25)
#define FMGR_IDX_26 (1 << 26)
#define FMGR_IDX_27 (1 << 27)
#define FMGR_IDX_28 (1 << 28)
#define FMGR_IDX_29 (1 << 29)
#define FMGR_IDX_30 (1 << 30)
#define FMGR_IDX_31 (1 << 31)
#define framemgr_e_barrier_irqs(this, index, flag) \
do { \
this->sindex |= index; \
spin_lock_irqsave(&this->slock, flag); \
} while (0)
#define framemgr_x_barrier_irqr(this, index, flag) \
do { \
spin_unlock_irqrestore(&this->slock, flag); \
this->sindex &= ~index; \
} while (0)
#define framemgr_e_barrier_irq(this, index) \
do { \
this->sindex |= index; \
spin_lock_irq(&this->slock); \
} while (0)
#define framemgr_x_barrier_irq(this, index) \
do { \
spin_unlock_irq(&this->slock); \
this->sindex &= ~index; \
} while (0)
#define framemgr_e_barrier(this, index) \
do { \
this->sindex |= index; \
spin_lock(&this->slock); \
} while (0)
#define framemgr_x_barrier(this, index) \
do { \
spin_unlock(&this->slock); \
this->sindex &= ~index; \
} while (0)
enum is_frame_state {
FS_FREE,
FS_REQUEST,
FS_PROCESS,
FS_COMPLETE,
FS_STRIPE_PROCESS,
FS_INVALID
};
#define FS_HW_FREE FS_FREE
#define FS_HW_REQUEST FS_REQUEST
#define FS_HW_CONFIGURE FS_PROCESS
#define FS_HW_WAIT_DONE FS_COMPLETE
#define FS_HW_INVALID FS_INVALID
#define NR_FRAME_STATE FS_INVALID
enum is_frame_mem_state {
/* initialized memory */
FRAME_MEM_INIT,
/* mapped memory */
FRAME_MEM_MAPPED
};
struct is_frame;
typedef void (*votf_s_addr)(void *, unsigned long, struct is_frame *);
typedef void (*votf_s_oneshot)(void *, unsigned long);
struct votf_action {
unsigned long id; /* enum is_subdev_id */
void *data; /* struct including HW SFR base address */
votf_s_addr s_addr; /* function for DMA address setting */
votf_s_oneshot s_oneshot; /* function for oneshot enable */
};
struct is_framemgr {
unsigned long id;
char name[IS_STR_LEN];
spinlock_t slock;
ulong sindex;
u32 num_frames;
struct is_frame *frames;
u32 queued_count[NR_FRAME_STATE];
struct list_head queued_list[NR_FRAME_STATE];
struct votf_action master; /* WDMA */
struct votf_action slave; /* RDMA */
u32 batch_num;
u32 proc_warn_cnt;
};
static const char * const hw_frame_state_name[NR_FRAME_STATE] = {
"Free",
"Request",
"Configure",
"Wait_Done"
};
static const char * const frame_state_name[NR_FRAME_STATE] = {
"Free",
"Request",
"Process",
"Complete"
};
ulong frame_fcount(struct is_frame *frame, void *data);
int put_frame(struct is_framemgr *this, struct is_frame *frame,
enum is_frame_state state);
struct is_frame *get_frame(struct is_framemgr *this,
enum is_frame_state state);
int trans_frame(struct is_framemgr *this, struct is_frame *frame,
enum is_frame_state state);
struct is_frame *peek_frame(struct is_framemgr *this,
enum is_frame_state state);
struct is_frame *peek_frame_tail(struct is_framemgr *this,
enum is_frame_state state);
struct is_frame *find_frame(struct is_framemgr *this,
enum is_frame_state state,
ulong (*fn)(struct is_frame *, void *), void *data);
struct is_frame *find_stripe_process_frame(struct is_framemgr *this,
u32 fcount);
void print_frame_queue(struct is_framemgr *this,
enum is_frame_state state);
int frame_manager_probe(struct is_framemgr *this, u32 id, const char *name);
int frame_manager_open(struct is_framemgr *this, u32 buffers);
int frame_manager_close(struct is_framemgr *this);
int frame_manager_flush(struct is_framemgr *this);
void frame_manager_print_queues(struct is_framemgr *this);
#if defined(ENABLE_CLOG_RESERVED_MEM)
void frame_manager_dump_queues(struct is_framemgr *this);
#endif
void frame_manager_print_info_queues(struct is_framemgr *this);
#endif
|