1 /*
2  * include/media/i2c/smiapp.h
3  *
4  * Generic driver for SMIA/SMIA++ compliant camera modules
5  *
6  * Copyright (C) 2011--2012 Nokia Corporation
7  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * version 2 as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  */
19 
20 #ifndef __SMIAPP_H_
21 #define __SMIAPP_H_
22 
23 #include <media/v4l2-subdev.h>
24 
25 #define SMIAPP_NAME		"smiapp"
26 
27 #define SMIAPP_DFL_I2C_ADDR	(0x20 >> 1) /* Default I2C Address */
28 #define SMIAPP_ALT_I2C_ADDR	(0x6e >> 1) /* Alternate I2C Address */
29 
30 #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK	0
31 #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE	1
32 #define SMIAPP_CSI_SIGNALLING_MODE_CSI2			2
33 
34 /*
35  * Sometimes due to board layout considerations the camera module can be
36  * mounted rotated. The typical rotation used is 180 degrees which can be
37  * corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
38  * FIXME: rotation also changes the bayer pattern.
39  */
40 enum smiapp_module_board_orient {
41 	SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
42 	SMIAPP_MODULE_BOARD_ORIENT_180,
43 };
44 
45 struct smiapp_flash_strobe_parms {
46 	u8 mode;
47 	u32 strobe_width_high_us;
48 	u16 strobe_delay;
49 	u16 stobe_start_point;
50 	u8 trigger;
51 };
52 
53 struct smiapp_hwconfig {
54 	/*
55 	 * Change the cci address if i2c_addr_alt is set.
56 	 * Both default and alternate cci addr need to be present
57 	 */
58 	unsigned short i2c_addr_dfl;	/* Default i2c addr */
59 	unsigned short i2c_addr_alt;	/* Alternate i2c addr */
60 
61 	uint32_t nvm_size;		/* bytes */
62 	uint32_t ext_clk;		/* sensor external clk */
63 
64 	unsigned int lanes;		/* Number of CSI-2 lanes */
65 	uint32_t csi_signalling_mode;	/* SMIAPP_CSI_SIGNALLING_MODE_* */
66 	uint64_t *op_sys_clock;
67 
68 	enum smiapp_module_board_orient module_board_orient;
69 
70 	struct smiapp_flash_strobe_parms *strobe_setup;
71 };
72 
73 #endif /* __SMIAPP_H_  */
74