]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/media/platform/msm/camss-8x16/csid.h
QC MSM CAMSS: Add initial driver
[karo-tx-linux.git] / drivers / media / platform / msm / camss-8x16 / csid.h
1 /*
2  * csid.h
3  *
4  * Qualcomm MSM Camera Subsystem - CSID Module
5  *
6  * Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
7  * Copyright (C) 2015-2016 Linaro Ltd.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 and
11  * only version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  */
18 #ifndef QC_MSM_CAMSS_CSID_H
19 #define QC_MSM_CAMSS_CSID_H
20
21 #include <linux/clk.h>
22 #include <media/media-entity.h>
23 #include <media/v4l2-ctrls.h>
24 #include <media/v4l2-device.h>
25 #include <media/v4l2-mediabus.h>
26 #include <media/v4l2-subdev.h>
27
28 #define MSM_CSID_PAD_SINK 0
29 #define MSM_CSID_PAD_SRC 1
30 #define MSM_CSID_PADS_NUM 2
31
32 enum csid_payload_mode {
33         CSID_PAYLOAD_MODE_INCREMENTING = 0,
34         CSID_PAYLOAD_MODE_ALTERNATING_55_AA = 1,
35         CSID_PAYLOAD_MODE_ALL_ZEROES = 2,
36         CSID_PAYLOAD_MODE_ALL_ONES = 3,
37         CSID_PAYLOAD_MODE_RANDOM = 4,
38         CSID_PAYLOAD_MODE_USER_SPECIFIED = 5,
39 };
40
41 struct csid_testgen_config {
42         u8 enabled;
43         enum csid_payload_mode payload_mode;
44 };
45
46 struct csid_phy_config {
47         u8 csiphy_id;
48         u8 lane_cnt;
49         u32 lane_assign;
50 };
51
52 struct camss;
53
54 struct csid_device {
55         u8 id;
56         struct v4l2_subdev subdev;
57         struct media_pad pads[MSM_CSID_PADS_NUM];
58         struct camss *camss;
59         void __iomem *base;
60         u32 irq;
61         struct clk **clock;
62         s32 *clock_rate;
63         int nclocks;
64         struct regulator *vdda;
65         struct completion reset_complete;
66         struct csid_testgen_config testgen;
67         struct csid_phy_config phy;
68         struct v4l2_mbus_framefmt fmt[MSM_CSID_PADS_NUM];
69         struct v4l2_ctrl_handler ctrls;
70         struct v4l2_ctrl *testgen_mode;
71 };
72
73 struct resources;
74
75 int msm_csid_subdev_init(struct csid_device *csid, struct camss *camss,
76                          struct resources *res, u8 id);
77
78 int msm_csid_register_entities(struct csid_device *csid,
79                                struct v4l2_device *v4l2_dev);
80
81 void msm_csid_unregister_entities(struct csid_device *csid);
82
83 #endif /* QC_MSM_CAMSS_CSID_H */