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