1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Medifield PNW Camera Imaging ISP subsystem.
4  *
5  * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version
9  * 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  *
17  */
18 #ifndef __ATOMISP_CSI2_H__
19 #define __ATOMISP_CSI2_H__
20 
21 #include <media/v4l2-subdev.h>
22 #include <media/v4l2-ctrls.h>
23 
24 #define CSI2_PAD_SINK		0
25 #define CSI2_PAD_SOURCE		1
26 #define CSI2_PADS_NUM		2
27 
28 #define CSI2_OUTPUT_ISP_SUBDEV	BIT(0)
29 #define CSI2_OUTPUT_MEMORY	BIT(1)
30 
31 struct atomisp_device;
32 struct v4l2_device;
33 struct atomisp_sub_device;
34 
35 struct atomisp_mipi_csi2_device {
36 	struct v4l2_subdev subdev;
37 	struct media_pad pads[CSI2_PADS_NUM];
38 	struct v4l2_mbus_framefmt formats[CSI2_PADS_NUM];
39 
40 	struct v4l2_ctrl_handler ctrls;
41 	struct atomisp_device *isp;
42 
43 	u32 output; /* output direction */
44 };
45 
46 int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
47 			  struct v4l2_subdev_state *sd_state,
48 			  unsigned int which, uint16_t pad,
49 			  struct v4l2_mbus_framefmt *ffmt);
50 int atomisp_mipi_csi2_init(struct atomisp_device *isp);
51 void atomisp_mipi_csi2_cleanup(struct atomisp_device *isp);
52 void atomisp_mipi_csi2_unregister_entities(
53     struct atomisp_mipi_csi2_device *csi2);
54 int atomisp_mipi_csi2_register_entities(struct atomisp_mipi_csi2_device *csi2,
55 					struct v4l2_device *vdev);
56 
57 void atomisp_csi2_configure(struct atomisp_sub_device *asd);
58 
59 #endif /* __ATOMISP_CSI2_H__ */
60