• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * linux-5.4/drivers/media/platform/sunxi-vin/vin-mipi/bsp_mipi_csi.h
3  *
4  * Copyright (c) 2007-2017 Allwinnertech Co., Ltd.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
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  */
16 
17 /*
18  * sunxi mipi csi bsp header file
19  * Author:raymonxiu
20  */
21 
22 #ifndef __MIPI__CSI__H__
23 #define __MIPI__CSI__H__
24 
25 #include "protocol.h"
26 #include "../utility/bsp_common.h"
27 #define MAX_MIPI  1
28 #define MAX_MIPI_CH 4
29 
30 struct mipi_para {
31 	unsigned int auto_check_bps;
32 	unsigned int bps;
33 	unsigned int dphy_freq;
34 	unsigned int lane_num;
35 	unsigned int total_rx_ch;
36 };
37 
38 struct mipi_fmt_cfg {
39 	enum v4l2_field field[MAX_MIPI_CH];
40 	enum pkt_fmt packet_fmt[MAX_MIPI_CH];
41 	unsigned int fmt_type;
42 	unsigned int vc[MAX_MIPI_CH];
43 };
44 extern void bsp_mipi_csi_set_version(unsigned int sel, unsigned int ver);
45 extern int bsp_mipi_csi_set_base_addr(unsigned int sel,
46 				unsigned long addr_base);
47 extern int bsp_mipi_dphy_set_base_addr(unsigned int sel,
48 				 unsigned long addr_base);
49 extern void mipi_dphy_cfg_1data(unsigned int sel,
50 				 unsigned int code, unsigned int data);
51 extern void bsp_mipi_csi_dphy_init(unsigned int sel);
52 extern void bsp_mipi_csi_dphy_exit(unsigned int sel);
53 extern void bsp_mipi_csi_dphy_enable(unsigned int sel, unsigned int flags);
54 extern void bsp_mipi_csi_dphy_disable(unsigned int sel, unsigned int flags);
55 extern void bsp_mipi_csi_protocol_enable(unsigned int sel);
56 extern void bsp_mipi_csi_protocol_disable(unsigned int sel);
57 extern void bsp_mipi_csi_set_para(unsigned int sel, struct mipi_para *para);
58 extern void bsp_mipi_csi_set_fmt(unsigned int sel, unsigned int total_rx_ch,
59 				 struct mipi_fmt_cfg *fmt);
60 void bsp_mipi_csi_set_dol(unsigned int sel, unsigned int mode, unsigned int ch);
61 #endif /*__MIPI__CSI__H__*/
62