1
2
3
4
5
6
7
8
9
10
11
12
13
14 #ifndef OMAP3_ISP_CCDC_H
15 #define OMAP3_ISP_CCDC_H
16
17 #include <linux/omap3isp.h>
18 #include <linux/workqueue.h>
19
20 #include "ispvideo.h"
21
22 enum ccdc_input_entity {
23 CCDC_INPUT_NONE,
24 CCDC_INPUT_PARALLEL,
25 CCDC_INPUT_CSI2A,
26 CCDC_INPUT_CCP2B,
27 CCDC_INPUT_CSI2C
28 };
29
30 #define CCDC_OUTPUT_MEMORY (1 << 0)
31 #define CCDC_OUTPUT_PREVIEW (1 << 1)
32 #define CCDC_OUTPUT_RESIZER (1 << 2)
33
34 #define OMAP3ISP_CCDC_NEVENTS 16
35
36 struct ispccdc_fpc {
37 void *addr;
38 dma_addr_t dma;
39 unsigned int fpnum;
40 };
41
42 enum ispccdc_lsc_state {
43 LSC_STATE_STOPPED = 0,
44 LSC_STATE_STOPPING = 1,
45 LSC_STATE_RUNNING = 2,
46 LSC_STATE_RECONFIG = 3,
47 };
48
49 struct ispccdc_lsc_config_req {
50 struct list_head list;
51 struct omap3isp_ccdc_lsc_config config;
52 unsigned char enable;
53
54 struct {
55 void *addr;
56 dma_addr_t dma;
57 struct sg_table sgt;
58 } table;
59 };
60
61
62
63
64 struct ispccdc_lsc {
65 enum ispccdc_lsc_state state;
66 struct work_struct table_work;
67
68
69 spinlock_t req_lock;
70 struct ispccdc_lsc_config_req *request;
71 struct ispccdc_lsc_config_req *active;
72 struct list_head free_queue;
73 };
74
75 #define CCDC_STOP_NOT_REQUESTED 0x00
76 #define CCDC_STOP_REQUEST 0x01
77 #define CCDC_STOP_EXECUTED (0x02 | CCDC_STOP_REQUEST)
78 #define CCDC_STOP_CCDC_FINISHED 0x04
79 #define CCDC_STOP_LSC_FINISHED 0x08
80 #define CCDC_STOP_FINISHED \
81 (CCDC_STOP_EXECUTED | CCDC_STOP_CCDC_FINISHED | CCDC_STOP_LSC_FINISHED)
82
83 #define CCDC_EVENT_VD1 0x10
84 #define CCDC_EVENT_VD0 0x20
85 #define CCDC_EVENT_LSC_DONE 0x40
86
87
88 #define CCDC_PAD_SINK 0
89 #define CCDC_PAD_SOURCE_OF 1
90 #define CCDC_PAD_SOURCE_VP 2
91 #define CCDC_PADS_NUM 3
92
93 #define CCDC_FIELD_TOP 1
94 #define CCDC_FIELD_BOTTOM 2
95 #define CCDC_FIELD_BOTH 3
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 struct isp_ccdc_device {
128 struct v4l2_subdev subdev;
129 struct media_pad pads[CCDC_PADS_NUM];
130 struct v4l2_mbus_framefmt formats[CCDC_PADS_NUM];
131 struct v4l2_rect crop;
132
133 enum ccdc_input_entity input;
134 unsigned int output;
135 struct isp_video video_out;
136
137 unsigned int alaw:1,
138 lpf:1,
139 obclamp:1,
140 fpc_en:1;
141 struct omap3isp_ccdc_blcomp blcomp;
142 struct omap3isp_ccdc_bclamp clamp;
143 struct ispccdc_fpc fpc;
144 struct ispccdc_lsc lsc;
145 unsigned int update;
146 unsigned int shadow_update;
147
148 bool bt656;
149 unsigned int fields;
150
151 unsigned int underrun:1;
152 enum isp_pipeline_stream_state state;
153 spinlock_t lock;
154 wait_queue_head_t wait;
155 unsigned int stopping;
156 bool running;
157 struct mutex ioctl_lock;
158 };
159
160 struct isp_device;
161
162 int omap3isp_ccdc_init(struct isp_device *isp);
163 void omap3isp_ccdc_cleanup(struct isp_device *isp);
164 int omap3isp_ccdc_register_entities(struct isp_ccdc_device *ccdc,
165 struct v4l2_device *vdev);
166 void omap3isp_ccdc_unregister_entities(struct isp_ccdc_device *ccdc);
167
168 int omap3isp_ccdc_busy(struct isp_ccdc_device *isp_ccdc);
169 int omap3isp_ccdc_isr(struct isp_ccdc_device *isp_ccdc, u32 events);
170 void omap3isp_ccdc_restore_context(struct isp_device *isp);
171 void omap3isp_ccdc_max_rate(struct isp_ccdc_device *ccdc,
172 unsigned int *max_rate);
173
174 #endif