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