• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * header for cameras.
4  *
5  * Copyright (c) 2017 by Allwinnertech Co., Ltd.  http://www.allwinnertech.com
6  *
7  * Authors:  Zhao Wei <zhaowei@allwinnertech.com>
8  *	Yang Feng <yangfeng@allwinnertech.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14 
15 #ifndef __CAMERA__H__
16 #define __CAMERA__H__
17 
18 #include <media/v4l2-subdev.h>
19 #include <linux/videodev2.h>
20 #include "../../vin-video/vin_core.h"
21 #include "../../utility/vin_supply.h"
22 #include "../../vin-cci/cci_helper.h"
23 #include "camera_cfg.h"
24 #include "../../platform/platform_cfg.h"
25 /*
26  * Basic window sizes.  These probably belong somewhere more globally
27  * useful.
28  */
29 #define ABS_SENSOR(x)                 ((x) > 0 ? (x) : -(x))
30 
31 #define HXGA_WIDTH    4000
32 #define HXGA_HEIGHT   3000
33 #define QUXGA_WIDTH   3264
34 #define QUXGA_HEIGHT  2448
35 #define QSXGA_WIDTH   2592
36 #define QSXGA_HEIGHT  1936
37 #define QXGA_WIDTH    2048
38 #define QXGA_HEIGHT   1536
39 #define HD1080_WIDTH  1920
40 #define HD1080_HEIGHT 1080
41 #define UXGA_WIDTH    1600
42 #define UXGA_HEIGHT   1200
43 #define SXGA_WIDTH    1280
44 #define SXGA_HEIGHT   960
45 #define HD720_WIDTH   1280
46 #define HD720_HEIGHT  720
47 #define XGA_WIDTH     1024
48 #define XGA_HEIGHT    768
49 #define SVGA_WIDTH    800
50 #define SVGA_HEIGHT   600
51 #define VGA_WIDTH     640
52 #define VGA_HEIGHT    480
53 #define QVGA_WIDTH    320
54 #define QVGA_HEIGHT   240
55 #define CIF_WIDTH     352
56 #define CIF_HEIGHT    288
57 #define QCIF_WIDTH    176
58 #define QCIF_HEIGHT   144
59 
60 #define CSI_GPIO_HIGH     1
61 #define CSI_GPIO_LOW     0
62 #define CCI_BITS_8           8
63 #define CCI_BITS_16         16
64 #define SENSOR_MAGIC_NUMBER 0x156977
65 
66 struct sensor_format_struct {
67 	__u8 *desc;
68 	u32 mbus_code;
69 	struct regval_list *regs;
70 	int regs_size;
71 	int bpp; /* Bytes per pixel */
72 };
73 
74 struct sensor_info {
75 	struct v4l2_subdev sd;
76 	struct media_pad sensor_pads[SENSOR_PAD_NUM];
77 	struct mutex lock;
78 	struct sensor_format_struct *fmt;	/* Current format */
79 	struct sensor_win_size *current_wins;
80 	struct sensor_format_struct *fmt_pt;	/* format start */
81 	struct sensor_win_size *win_pt;		/* win start */
82 	unsigned int width;
83 	unsigned int height;
84 	unsigned int use_current_win;
85 	unsigned int capture_mode;	/*V4L2_MODE_VIDEO/V4L2_MODE_IMAGE*/
86 	unsigned int af_first_flag;
87 	unsigned int preview_first_flag;
88 	unsigned int auto_focus;	/*0:not in contin_focus 1: contin_focus*/
89 	unsigned int focus_status;	/*0:idle 1:busy*/
90 	unsigned int low_speed;		/*0:high speed 1:low speed*/
91 	int brightness;
92 	int contrast;
93 	int saturation;
94 	int hue;
95 	unsigned int hflip;
96 	unsigned int vflip;
97 	unsigned int gain;
98 	unsigned int autogain;
99 	unsigned int exp;
100 	int exp_bias;
101 	enum v4l2_exposure_auto_type autoexp;
102 	unsigned int autowb;
103 	enum v4l2_auto_n_preset_white_balance wb;
104 	enum v4l2_colorfx clrfx;
105 	enum v4l2_flash_led_mode flash_mode;
106 	enum v4l2_power_line_frequency band_filter;
107 	struct v4l2_fract tpf;
108 	unsigned int stream_seq;
109 	unsigned int fmt_num;
110 	unsigned int win_size_num;
111 	unsigned int sensor_field;
112 	unsigned int combo_mode;
113 	unsigned int time_hs;
114 	unsigned int isp_wdr_mode;
115 	unsigned int magic_num;
116 	unsigned int lane_num;
117 	unsigned int bit_width;
118 	struct v4l2_ctrl_handler handler;
119 
120 #ifdef CONFIG_SAME_I2C
121 	unsigned char sensor_i2c_addr;
122 #endif
123 };
124 
125 #endif /*__CAMERA__H__*/
126