1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * include/media/i2c/smiapp.h
4  *
5  * Generic driver for SMIA/SMIA++ compliant camera modules
6  *
7  * Copyright (C) 2011--2012 Nokia Corporation
8  * Contact: Sakari Ailus <sakari.ailus@iki.fi>
9  */
10 
11 #ifndef __SMIAPP_H_
12 #define __SMIAPP_H_
13 
14 #include <media/v4l2-subdev.h>
15 
16 #define SMIAPP_NAME		"smiapp"
17 
18 #define SMIAPP_DFL_I2C_ADDR	(0x20 >> 1) /* Default I2C Address */
19 #define SMIAPP_ALT_I2C_ADDR	(0x6e >> 1) /* Alternate I2C Address */
20 
21 #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_CLOCK	0
22 #define SMIAPP_CSI_SIGNALLING_MODE_CCP2_DATA_STROBE	1
23 #define SMIAPP_CSI_SIGNALLING_MODE_CSI2			2
24 
25 /*
26  * Sometimes due to board layout considerations the camera module can be
27  * mounted rotated. The typical rotation used is 180 degrees which can be
28  * corrected by giving a default H-FLIP and V-FLIP in the sensor readout.
29  * FIXME: rotation also changes the bayer pattern.
30  */
31 enum smiapp_module_board_orient {
32 	SMIAPP_MODULE_BOARD_ORIENT_0 = 0,
33 	SMIAPP_MODULE_BOARD_ORIENT_180,
34 };
35 
36 struct smiapp_flash_strobe_parms {
37 	u8 mode;
38 	u32 strobe_width_high_us;
39 	u16 strobe_delay;
40 	u16 stobe_start_point;
41 	u8 trigger;
42 };
43 
44 struct smiapp_hwconfig {
45 	/*
46 	 * Change the cci address if i2c_addr_alt is set.
47 	 * Both default and alternate cci addr need to be present
48 	 */
49 	unsigned short i2c_addr_dfl;	/* Default i2c addr */
50 	unsigned short i2c_addr_alt;	/* Alternate i2c addr */
51 
52 	uint32_t nvm_size;		/* bytes */
53 	uint32_t ext_clk;		/* sensor external clk */
54 
55 	unsigned int lanes;		/* Number of CSI-2 lanes */
56 	uint32_t csi_signalling_mode;	/* SMIAPP_CSI_SIGNALLING_MODE_* */
57 	uint64_t *op_sys_clock;
58 
59 	enum smiapp_module_board_orient module_board_orient;
60 
61 	struct smiapp_flash_strobe_parms *strobe_setup;
62 };
63 
64 #endif /* __SMIAPP_H_  */
65