Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
drivers
media
platform
s5p-fimc
fimc-lite.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2012 Samsung Electronics Co., Ltd.
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*/
8
9
#ifndef FIMC_LITE_H_
10
#define FIMC_LITE_H_
11
12
#include <
linux/sizes.h
>
13
#include <
linux/io.h
>
14
#include <
linux/irqreturn.h
>
15
#include <
linux/platform_device.h
>
16
#include <linux/sched.h>
17
#include <
linux/spinlock.h
>
18
#include <linux/types.h>
19
#include <linux/videodev2.h>
20
21
#include <
media/media-entity.h
>
22
#include <
media/videobuf2-core.h
>
23
#include <
media/v4l2-device.h
>
24
#include <
media/v4l2-mediabus.h
>
25
#include <
media/s5p_fimc.h
>
26
27
#include "
fimc-core.h
"
28
29
#define FIMC_LITE_DRV_NAME "exynos-fimc-lite"
30
#define FLITE_CLK_NAME "flite"
31
#define FIMC_LITE_MAX_DEVS 2
32
#define FLITE_REQ_BUFS_MIN 2
33
34
/* Bit index definitions for struct fimc_lite::state */
35
enum
{
36
ST_FLITE_LPM
,
37
ST_FLITE_PENDING
,
38
ST_FLITE_RUN
,
39
ST_FLITE_STREAM
,
40
ST_FLITE_SUSPENDED
,
41
ST_FLITE_OFF
,
42
ST_FLITE_IN_USE
,
43
ST_FLITE_CONFIG
,
44
ST_SENSOR_STREAM
,
45
};
46
47
#define FLITE_SD_PAD_SINK 0
48
#define FLITE_SD_PAD_SOURCE 1
49
#define FLITE_SD_PADS_NUM 2
50
51
struct
flite_variant
{
52
unsigned
short
max_width
;
53
unsigned
short
max_height
;
54
unsigned
short
out_width_align
;
55
unsigned
short
win_hor_offs_align
;
56
unsigned
short
out_hor_offs_align
;
57
};
58
59
struct
flite_drvdata
{
60
struct
flite_variant
*
variant
[
FIMC_LITE_MAX_DEVS
];
61
};
62
63
#define fimc_lite_get_drvdata(_pdev) \
64
((struct flite_drvdata *) platform_get_device_id(_pdev)->driver_data)
65
66
struct
fimc_lite_events
{
67
unsigned
int
data_overflow
;
68
};
69
70
#define FLITE_MAX_PLANES 1
71
78
struct
flite_frame
{
79
u16
f_width
;
80
u16
f_height
;
81
struct
v4l2_rect
rect
;
82
};
83
90
struct
flite_buffer
{
91
struct
vb2_buffer
vb
;
92
struct
list_head
list
;
93
dma_addr_t
paddr
;
94
};
95
132
struct
fimc_lite
{
133
struct
platform_device
*
pdev
;
134
struct
flite_variant
*
variant
;
135
struct
v4l2_device
*
v4l2_dev
;
136
struct
video_device
vfd
;
137
struct
v4l2_fh
fh
;
138
struct
vb2_alloc_ctx *
alloc_ctx
;
139
struct
v4l2_subdev
subdev
;
140
struct
media_pad
vd_pad
;
141
struct
media_pad
subdev_pads
[
FLITE_SD_PADS_NUM
];
142
struct
v4l2_ctrl_handler
ctrl_handler
;
143
struct
v4l2_ctrl
*
test_pattern
;
144
u32
index
;
145
struct
fimc_pipeline
pipeline
;
146
const
struct
fimc_pipeline_ops
*
pipeline_ops
;
147
148
struct
mutex
lock
;
149
spinlock_t
slock
;
150
151
struct
clk
*
clock
;
152
void
__iomem
*
regs
;
153
wait_queue_head_t
irq_queue
;
154
155
const
struct
fimc_fmt
*
fmt
;
156
unsigned
long
payload
[
FLITE_MAX_PLANES
];
157
struct
flite_frame
inp_frame
;
158
struct
flite_frame
out_frame
;
159
enum
fimc_datapath
out_path
;
160
unsigned
int
source_subdev_grp_id
;
161
162
unsigned
long
state
;
163
struct
list_head
pending_buf_q
;
164
struct
list_head
active_buf_q
;
165
struct
vb2_queue
vb_queue
;
166
unsigned
int
frame_count
;
167
unsigned
int
reqbufs_count
;
168
int
ref_count
;
169
170
struct
fimc_lite_events
events
;
171
};
172
173
static
inline
bool
fimc_lite_active(
struct
fimc_lite
*fimc)
174
{
175
unsigned
long
flags
;
176
bool
ret
;
177
178
spin_lock_irqsave
(&fimc->
slock
, flags);
179
ret = fimc->
state
& (1 <<
ST_FLITE_RUN
) ||
180
fimc->
state
& (1 <<
ST_FLITE_PENDING
);
181
spin_unlock_irqrestore(&fimc->
slock
, flags);
182
return
ret
;
183
}
184
185
static
inline
void
fimc_lite_active_queue_add(
struct
fimc_lite
*
dev
,
186
struct
flite_buffer
*
buf
)
187
{
188
list_add_tail
(&buf->
list
, &dev->
active_buf_q
);
189
}
190
191
static
inline
struct
flite_buffer
*fimc_lite_active_queue_pop(
192
struct
fimc_lite
*
dev
)
193
{
194
struct
flite_buffer
*
buf
=
list_entry
(dev->
active_buf_q
.next,
195
struct
flite_buffer
,
list
);
196
list_del
(&buf->
list
);
197
return
buf
;
198
}
199
200
static
inline
void
fimc_lite_pending_queue_add(
struct
fimc_lite
*
dev
,
201
struct
flite_buffer
*
buf
)
202
{
203
list_add_tail
(&buf->
list
, &dev->
pending_buf_q
);
204
}
205
206
static
inline
struct
flite_buffer
*fimc_lite_pending_queue_pop(
207
struct
fimc_lite
*
dev
)
208
{
209
struct
flite_buffer
*
buf
=
list_entry
(dev->
pending_buf_q
.next,
210
struct
flite_buffer
,
list
);
211
list_del
(&buf->
list
);
212
return
buf
;
213
}
214
215
#endif
/* FIMC_LITE_H_ */
Generated on Thu Jan 10 2013 13:49:37 for Linux Kernel by
1.8.2