2 * Copyright (c) 2013-2015, NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <media/nvc.h>
21 #include <media/nvc_image.h>
23 #define OV5693_IOCTL_SET_MODE _IOW('o', 1, struct ov5693_mode)
24 #define OV5693_IOCTL_SET_FRAME_LENGTH _IOW('o', 2, __u32)
25 #define OV5693_IOCTL_SET_COARSE_TIME _IOW('o', 3, __u32)
26 #define OV5693_IOCTL_SET_GAIN _IOW('o', 4, __u16)
27 #define OV5693_IOCTL_GET_STATUS _IOR('o', 5, __u8)
28 #define OV5693_IOCTL_SET_BINNING _IOW('o', 6, __u8)
29 #define OV5693_IOCTL_TEST_PATTERN _IOW('o', 7, \
30 enum ov5693_test_pattern)
31 #define OV5693_IOCTL_SET_GROUP_HOLD _IOW('o', 8, struct ov5693_ae)
32 /* IOCTL to set the operating mode of camera.
33 * This can be either stereo , leftOnly or rightOnly */
34 #define OV5693_IOCTL_SET_CAMERA_MODE _IOW('o', 10, __u32)
35 #define OV5693_IOCTL_SYNC_SENSORS _IOW('o', 11, __u32)
36 #define OV5693_IOCTL_GET_FUSEID _IOR('o', 12, struct nvc_fuseid)
37 #define OV5693_IOCTL_SET_HDR_COARSE_TIME _IOW('o', 13, struct ov5693_hdr)
38 #define OV5693_IOCTL_READ_OTP_BANK _IOWR('o', 14, \
39 struct ov5693_otp_bank)
40 #define OV5693_IOCTL_SET_CAL_DATA _IOW('o', 15, \
41 struct ov5693_cal_data)
42 #define OV5693_IOCTL_GET_EEPROM_DATA _IOR('o', 20, __u8 *)
43 #define OV5693_IOCTL_SET_EEPROM_DATA _IOW('o', 21, __u8 *)
44 #define OV5693_IOCTL_GET_CAPS _IOR('o', 22, struct nvc_imager_cap)
45 #define OV5693_IOCTL_SET_POWER _IOW('o', 23, __u32)
47 #define OV5693_INVALID_COARSE_TIME -1
49 #define OV5693_EEPROM_ADDRESS 0x50
50 #define OV5693_EEPROM_SIZE 1024
51 #define OV5693_EEPROM_STR_SIZE (OV5693_EEPROM_SIZE * 2)
52 #define OV5693_EEPROM_BLOCK_SIZE (1 << 8)
53 #define OV5693_EEPROM_NUM_BLOCKS \
54 (OV5693_EEPROM_SIZE / OV5693_EEPROM_BLOCK_SIZE)
56 #define OV5693_OTP_LOAD_CTRL_ADDR 0x3D81
57 #define OV5693_OTP_BANK_SELECT_ADDR 0x3D84
58 #define OV5693_OTP_BANK_START_ADDR 0x3D00
59 #define OV5693_OTP_BANK_END_ADDR 0x3D0F
60 #define OV5693_OTP_NUM_BANKS (32)
61 #define OV5693_OTP_BANK_SIZE \
62 (OV5693_OTP_BANK_END_ADDR - OV5693_OTP_BANK_START_ADDR + 1)
63 #define OV5693_OTP_SIZE \
64 (OV5693_OTP_BANK_SIZE * OV5693_OTP_NUM_BANKS)
65 #define OV5693_OTP_STR_SIZE (OV5693_OTP_SIZE * 2)
67 #define OV5693_FUSE_ID_OTP_START_ADDR 0x3D00
68 #define OV5693_FUSE_ID_OTP_BANK 0
69 #define OV5693_FUSE_ID_SIZE 8
70 #define OV5693_FUSE_ID_STR_SIZE (OV5693_FUSE_ID_SIZE * 2)
72 #define OV5693_FRAME_LENGTH_ADDR_MSB 0x380E
73 #define OV5693_FRAME_LENGTH_ADDR_LSB 0x380F
74 #define OV5693_COARSE_TIME_ADDR_1 0x3500
75 #define OV5693_COARSE_TIME_ADDR_2 0x3501
76 #define OV5693_COARSE_TIME_ADDR_3 0x3502
77 #define OV5693_COARSE_TIME_SHORT_ADDR_1 0x3506
78 #define OV5693_COARSE_TIME_SHORT_ADDR_2 0x3507
79 #define OV5693_COARSE_TIME_SHORT_ADDR_3 0x3508
80 #define OV5693_GAIN_ADDR_MSB 0x350A
81 #define OV5693_GAIN_ADDR_LSB 0x350B
82 #define OV5693_GROUP_HOLD_ADDR 0x3208
90 __u32 coarse_time_short;
97 __u8 frame_length_enable;
99 __u32 coarse_time_short;
100 __u8 coarse_time_enable;
105 struct ov5693_fuseid {
111 __u32 coarse_time_long;
112 __u32 coarse_time_short;
115 struct ov5693_otp_bank {
120 struct ov5693_cal_data {
124 int rg_ratio_typical;
125 int bg_ratio_typical;
129 /* See notes in the nvc.h file on the GPIO usage */
130 enum ov5693_gpio_type {
131 OV5693_GPIO_TYPE_PWRDN = 0,
132 OV5693_GPIO_TYPE_RESET,
135 struct ov5693_eeprom_data {
136 struct i2c_client *i2c_client;
137 struct i2c_adapter *adap;
138 struct i2c_board_info brd;
139 struct regmap *regmap;
142 struct ov5693_power_rail {
143 struct regulator *dvdd;
144 struct regulator *avdd;
145 struct regulator *dovdd;
148 struct ov5693_regulators {
154 struct ov5693_platform_data {
157 const char *dev_name;
158 unsigned gpio_count; /* see nvc.h GPIO notes */
159 struct nvc_gpio_pdata *gpio; /* see nvc.h GPIO notes */
160 struct nvc_imager_static_nvc *static_info;
162 int (*probe_clock)(unsigned long);
163 int (*power_on)(struct ov5693_power_rail *);
164 int (*power_off)(struct ov5693_power_rail *);
165 const char *mclk_name;
166 struct nvc_imager_cap *cap;
167 struct ov5693_regulators regulators;
172 #endif /* __OV5693_H__ */