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