1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/*
* Copyright (C) 2012 Spreadtrum Communications Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _SENSOR_DRV_K_H_
#define _SENSOR_DRV_K_H_
struct sensor_i2c_tag {
uint8_t *i2c_data;
uint16_t i2c_count;
uint16_t slave_addr;
};
struct sensor_reg_tag {
uint16_t reg_addr;
uint16_t reg_value;
};
struct sensor_reg_bits_tag {
uint16_t reg_addr;
uint16_t reg_value;
uint32_t reg_bits;
};
struct sensor_reg_tab_tag {
struct sensor_reg_tag *sensor_reg_tab_ptr;
uint32_t reg_count;
uint32_t reg_bits;
uint32_t burst_mode;
};
struct sensor_flash_level {
uint32_t low_light;
uint32_t high_light;
};
enum INTERFACE_OP_ID {
INTERFACE_OPEN = 0,
INTERFACE_CLOSE
};
enum INTERFACE_TYPE_ID {
INTERFACE_CCIR = 0,
INTERFACE_MIPI
};
struct sensor_if_cfg_tag {
uint32_t is_open;
uint32_t if_type;
uint32_t phy_id;
uint32_t lane_num;
uint32_t bps_per_lane;
};
struct sensor_socid_tag {
uint32_t d_die;
uint32_t a_die;
};
struct sensor_power {
uint32_t af_volt_level;
uint32_t avdd_volt_level;
uint32_t dvdd_volt_level;
uint32_t iovdd_volt_level;
uint32_t power_down_level;
uint32_t reset_level;
uint32_t default_mclk;
};
struct sensor_power_info_tag {
uint32_t is_on;
uint32_t op_sensor_id;
struct sensor_power dev0;
struct sensor_power dev1;
struct sensor_power dev2;
};
struct sensor_name{
char back_name;
char front_name;
};
typedef enum {
SENSOR_OTP_PARAM_NORMAL = 0x00,
SENSOR_OTP_PARAM_CHECKSUM,
SENSOR_OTP_PARAM_READBYTE,
SENSOR_OTP_PARAM_FW_VERSION,
SENSOR_OTP_PARAM_TYPE_MAX
} SENSOR_OTP_PARAM_TYPE_T;
typedef struct _sensor_otp_data_info_tag {
uint32_t size;
void *data_ptr;
} SENSOR_OTP_DATA_INFO_T, *SENSOR_OTP_DATA_INFO_T_PTR;
typedef struct _sensor_otp_param_tag {
uint32_t type;
uint32_t start_addr;
uint32_t len;
uint8_t *buff;
struct _sensor_otp_data_info_tag golden;
struct _sensor_otp_data_info_tag awb;
struct _sensor_otp_data_info_tag lsc;
} SENSOR_OTP_PARAM_T, *SENSOR_OTP_PARAM_T_PTR;
#define SENSOR_IOC_MAGIC 'R'
#define SENSOR_IO_PD _IOW(SENSOR_IOC_MAGIC, 0, uint8_t)
#define SENSOR_IO_SET_AVDD _IOW(SENSOR_IOC_MAGIC, 1, uint32_t)
#define SENSOR_IO_SET_DVDD _IOW(SENSOR_IOC_MAGIC, 2, uint32_t)
#define SENSOR_IO_SET_IOVDD _IOW(SENSOR_IOC_MAGIC, 3, uint32_t)
#define SENSOR_IO_SET_MCLK _IOW(SENSOR_IOC_MAGIC, 4, uint32_t)
#define SENSOR_IO_RST _IOW(SENSOR_IOC_MAGIC, 5, uint32_t)
#define SENSOR_IO_I2C_INIT _IOW(SENSOR_IOC_MAGIC, 6, uint32_t)
#define SENSOR_IO_I2C_DEINIT _IOW(SENSOR_IOC_MAGIC, 7, uint32_t)
#define SENSOR_IO_SET_ID _IOW(SENSOR_IOC_MAGIC, 8, uint32_t)
#define SENSOR_IO_RST_LEVEL _IOW(SENSOR_IOC_MAGIC, 9, uint32_t)
#define SENSOR_IO_I2C_ADDR _IOW(SENSOR_IOC_MAGIC, 10, uint16_t)
#define SENSOR_IO_I2C_READ _IOWR(SENSOR_IOC_MAGIC, 11, struct sensor_reg_bits_tag)
#define SENSOR_IO_I2C_WRITE _IOW(SENSOR_IOC_MAGIC, 12, struct sensor_reg_bits_tag)
#define SENSOR_IO_SET_FLASH _IOW(SENSOR_IOC_MAGIC, 13, uint32_t)
#define SENSOR_IO_I2C_WRITE_REGS _IOW(SENSOR_IOC_MAGIC, 14, struct sensor_reg_tab_tag)
#define SENSOR_IO_SET_CAMMOT _IOW(SENSOR_IOC_MAGIC, 15, uint32_t)
#define SENSOR_IO_SET_I2CCLOCK _IOW(SENSOR_IOC_MAGIC, 16, uint32_t)
#define SENSOR_IO_I2C_WRITE_EXT _IOW(SENSOR_IOC_MAGIC, 17, struct sensor_i2c_tag)
#define SENSOR_IO_GET_FLASH_LEVEL _IOWR(SENSOR_IOC_MAGIC, 18, struct sensor_flash_level)
#define SENSOR_IO_IF_CFG _IOW(SENSOR_IOC_MAGIC, 19, struct sensor_if_cfg_tag)
#define SENSOR_IO_I2C_READ_EXT _IOWR(SENSOR_IOC_MAGIC, 20, struct sensor_i2c_tag)
#define SENSOR_IO_POWER_CFG _IOWR(SENSOR_IOC_MAGIC, 21, struct sensor_power_info_tag)
#define SENSOR_IO_SET_SOCNAME _IOWR(SENSOR_IOC_MAGIC, 22, struct sensor_name)
#define SENSOR_IO_READ_OTPDATA _IOWR(SENSOR_IOC_MAGIC, 254,struct _sensor_otp_param_tag)
#define SENSOR_IO_GET_SOCID _IOWR(SENSOR_IOC_MAGIC, 255,uint32_t)
#endif //_SENSOR_DRV_K_H_
|