Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ispccdc.h
Go to the documentation of this file.
1 /*
2  * ispccdc.h
3  *
4  * TI OMAP3 ISP - CCDC module
5  *
6  * Copyright (C) 2009-2010 Nokia Corporation
7  * Copyright (C) 2009 Texas Instruments, Inc.
8  *
9  * Contacts: Laurent Pinchart <[email protected]>
10  * Sakari Ailus <[email protected]>
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24  * 02110-1301 USA
25  */
26 
27 #ifndef OMAP3_ISP_CCDC_H
28 #define OMAP3_ISP_CCDC_H
29 
30 #include <linux/omap3isp.h>
31 #include <linux/workqueue.h>
32 
33 #include "ispvideo.h"
34 
41 };
42 
43 #define CCDC_OUTPUT_MEMORY (1 << 0)
44 #define CCDC_OUTPUT_PREVIEW (1 << 1)
45 #define CCDC_OUTPUT_RESIZER (1 << 2)
46 
47 #define OMAP3ISP_CCDC_NEVENTS 16
48 
54 };
55 
57  struct list_head list;
59  unsigned char enable;
61  struct iovm_struct *iovm;
62 };
63 
64 /*
65  * ispccdc_lsc - CCDC LSC parameters
66  * @update_config: Set when user changes config
67  * @request_enable: Whether LSC is requested to be enabled
68  * @config: LSC config set by user
69  * @update_table: Set when user provides a new LSC table to table_new
70  * @table_new: LSC table set by user, ISP address
71  * @table_inuse: LSC table currently in use, ISP address
72  */
73 struct ispccdc_lsc {
76 
77  /* LSC queue of configurations */
79  struct ispccdc_lsc_config_req *request; /* requested configuration */
80  struct ispccdc_lsc_config_req *active; /* active configuration */
81  struct list_head free_queue; /* configurations for freeing */
82 };
83 
84 #define CCDC_STOP_NOT_REQUESTED 0x00
85 #define CCDC_STOP_REQUEST 0x01
86 #define CCDC_STOP_EXECUTED (0x02 | CCDC_STOP_REQUEST)
87 #define CCDC_STOP_CCDC_FINISHED 0x04
88 #define CCDC_STOP_LSC_FINISHED 0x08
89 #define CCDC_STOP_FINISHED \
90  (CCDC_STOP_EXECUTED | CCDC_STOP_CCDC_FINISHED | CCDC_STOP_LSC_FINISHED)
91 
92 #define CCDC_EVENT_VD1 0x10
93 #define CCDC_EVENT_VD0 0x20
94 #define CCDC_EVENT_LSC_DONE 0x40
95 
96 /* Sink and source CCDC pads */
97 #define CCDC_PAD_SINK 0
98 #define CCDC_PAD_SOURCE_OF 1
99 #define CCDC_PAD_SOURCE_VP 2
100 #define CCDC_PADS_NUM 3
101 
102 /*
103  * struct isp_ccdc_device - Structure for the CCDC module to store its own
104  * information
105  * @subdev: V4L2 subdevice
106  * @pads: Sink and source media entity pads
107  * @formats: Active video formats
108  * @crop: Active crop rectangle on the OF source pad
109  * @input: Active input
110  * @output: Active outputs
111  * @video_out: Output video node
112  * @alaw: A-law compression enabled (1) or disabled (0)
113  * @lpf: Low pass filter enabled (1) or disabled (0)
114  * @obclamp: Optical-black clamp enabled (1) or disabled (0)
115  * @fpc_en: Faulty pixels correction enabled (1) or disabled (0)
116  * @blcomp: Black level compensation configuration
117  * @clamp: Optical-black or digital clamp configuration
118  * @fpc: Faulty pixels correction configuration
119  * @lsc: Lens shading compensation configuration
120  * @update: Bitmask of controls to update during the next interrupt
121  * @shadow_update: Controls update in progress by userspace
122  * @underrun: A buffer underrun occurred and a new buffer has been queued
123  * @state: Streaming state
124  * @lock: Serializes shadow_update with interrupt handler
125  * @wait: Wait queue used to stop the module
126  * @stopping: Stopping state
127  * @ioctl_lock: Serializes ioctl calls and LSC requests freeing
128  */
132  struct v4l2_mbus_framefmt formats[CCDC_PADS_NUM];
133  struct v4l2_rect crop;
134 
136  unsigned int output;
138 
139  unsigned int alaw:1,
140  lpf:1,
141  obclamp:1,
142  fpc_en:1;
146  struct ispccdc_lsc lsc;
147  unsigned int update;
148  unsigned int shadow_update;
149 
150  unsigned int underrun:1;
154  unsigned int stopping;
156 };
157 
158 struct isp_device;
159 
160 int omap3isp_ccdc_init(struct isp_device *isp);
161 void omap3isp_ccdc_cleanup(struct isp_device *isp);
163  struct v4l2_device *vdev);
165 
168 void omap3isp_ccdc_restore_context(struct isp_device *isp);
169 void omap3isp_ccdc_max_rate(struct isp_ccdc_device *ccdc,
170  unsigned int *max_rate);
171 
172 #endif /* OMAP3_ISP_CCDC_H */