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 struct atomisp_device;
29 struct v4l2_device;
30 struct atomisp_sub_device;
31 
32 struct atomisp_mipi_csi2_device {
33 	struct v4l2_subdev subdev;
34 	struct media_pad pads[CSI2_PADS_NUM];
35 	struct v4l2_mbus_framefmt formats[CSI2_PADS_NUM];
36 
37 	struct v4l2_ctrl_handler ctrls;
38 	struct atomisp_device *isp;
39 };
40 
41 int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd,
42 			  struct v4l2_subdev_state *sd_state,
43 			  unsigned int which, uint16_t pad,
44 			  struct v4l2_mbus_framefmt *ffmt);
45 int atomisp_mipi_csi2_init(struct atomisp_device *isp);
46 void atomisp_mipi_csi2_cleanup(struct atomisp_device *isp);
47 void atomisp_mipi_csi2_unregister_entities(
48     struct atomisp_mipi_csi2_device *csi2);
49 int atomisp_mipi_csi2_register_entities(struct atomisp_mipi_csi2_device *csi2,
50 					struct v4l2_device *vdev);
51 
52 void atomisp_csi2_configure(struct atomisp_sub_device *asd);
53 
54 #endif /* __ATOMISP_CSI2_H__ */
55