1 /*
2  * ispccp2.h
3  *
4  * TI OMAP3 ISP - CCP2 module
5  *
6  * Copyright (C) 2010 Nokia Corporation
7  * Copyright (C) 2010 Texas Instruments, Inc.
8  *
9  * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10  *	     Sakari Ailus <sakari.ailus@iki.fi>
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_CCP2_H
28 #define OMAP3_ISP_CCP2_H
29 
30 #include <linux/videodev2.h>
31 
32 struct isp_device;
33 struct isp_csiphy;
34 
35 /* Sink and source ccp2 pads */
36 #define CCP2_PAD_SINK			0
37 #define CCP2_PAD_SOURCE			1
38 #define CCP2_PADS_NUM			2
39 
40 /* CCP2 input media entity */
41 enum ccp2_input_entity {
42 	CCP2_INPUT_NONE,
43 	CCP2_INPUT_SENSOR,
44 	CCP2_INPUT_MEMORY,
45 };
46 
47 /* CCP2 output media entity */
48 enum ccp2_output_entity {
49 	CCP2_OUTPUT_NONE,
50 	CCP2_OUTPUT_CCDC,
51 	CCP2_OUTPUT_MEMORY,
52 };
53 
54 
55 /* Logical channel configuration */
56 struct isp_interface_lcx_config {
57 	int crc;
58 	u32 data_start;
59 	u32 data_size;
60 	u32 format;
61 };
62 
63 /* Memory channel configuration */
64 struct isp_interface_mem_config {
65 	u32 dst_port;
66 	u32 vsize_count;
67 	u32 hsize_count;
68 	u32 src_ofst;
69 	u32 dst_ofst;
70 };
71 
72 /* CCP2 device */
73 struct isp_ccp2_device {
74 	struct v4l2_subdev subdev;
75 	struct v4l2_mbus_framefmt formats[CCP2_PADS_NUM];
76 	struct media_pad pads[CCP2_PADS_NUM];
77 
78 	enum ccp2_input_entity input;
79 	enum ccp2_output_entity output;
80 	struct isp_interface_lcx_config if_cfg;
81 	struct isp_interface_mem_config mem_cfg;
82 	struct isp_video video_in;
83 	struct isp_csiphy *phy;
84 	struct regulator *vdds_csib;
85 	enum isp_pipeline_stream_state state;
86 	wait_queue_head_t wait;
87 	atomic_t stopping;
88 };
89 
90 /* Function declarations */
91 int omap3isp_ccp2_init(struct isp_device *isp);
92 void omap3isp_ccp2_cleanup(struct isp_device *isp);
93 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2,
94 			struct v4l2_device *vdev);
95 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2);
96 void omap3isp_ccp2_isr(struct isp_ccp2_device *ccp2);
97 
98 #endif	/* OMAP3_ISP_CCP2_H */
99