0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef STV06XX_VV6410_H_
0018 #define STV06XX_VV6410_H_
0019
0020 #include "stv06xx_sensor.h"
0021
0022 #define VV6410_COLS 416
0023 #define VV6410_ROWS 320
0024
0025
0026
0027 #define VV6410_DEVICEH 0x00
0028 #define VV6410_DEVICEL 0x01
0029
0030
0031
0032 #define VV6410_STATUS0 0x02
0033
0034
0035 #define VV6410_LINECOUNTH 0x03
0036 #define VV6410_LINECOUNTL 0x04
0037
0038
0039 #define VV6410_XENDH 0x05
0040 #define VV6410_XENDL 0x06
0041
0042
0043 #define VV6410_YENDH 0x07
0044 #define VV6410_YENDL 0x08
0045
0046
0047
0048 #define VV6410_DARKAVGH 0x09
0049 #define VV6410_DARKAVGL 0x0a
0050
0051
0052
0053 #define VV6410_BLACKAVGH 0x0b
0054 #define VV6410_BLACKAVGL 0x0c
0055
0056
0057 #define VV6410_STATUS1 0x0d
0058
0059
0060
0061
0062 #define VV6410_SETUP0 0x10
0063
0064
0065 #define VV6410_SETUP1 0x11
0066
0067
0068 #define VV6410_SYNCVALUE 0x12
0069
0070
0071 #define VV6410_FGMODES 0x14
0072
0073
0074 #define VV6410_PINMAPPING 0x15
0075
0076
0077 #define VV6410_DATAFORMAT 0x16
0078
0079
0080 #define VV6410_OPFORMAT 0x17
0081
0082
0083 #define VV6410_MODESELECT 0x18
0084
0085
0086
0087 #define VV6410_FINEH 0x20
0088 #define VV6410_FINEL 0x21
0089
0090
0091 #define VV6410_COARSEH 0x22
0092 #define VV6410_COARSEL 0x23
0093
0094
0095 #define VV6410_ANALOGGAIN 0x24
0096
0097
0098 #define VV6410_CLKDIV 0x25
0099
0100
0101 #define VV6410_DARKOFFSETH 0x2c
0102 #define VV6410_DARKOFFSETL 0x2d
0103
0104
0105 #define VV6410_DARKOFFSETSETUP 0x2e
0106
0107
0108
0109 #define VV6410_LINELENGTHH 0x52
0110 #define VV6410_LINELENGTHL 0x53
0111
0112
0113 #define VV6410_XOFFSETH 0x57
0114 #define VV6410_XOFFSETL 0x58
0115
0116
0117 #define VV6410_YOFFSETH 0x59
0118 #define VV6410_YOFFSETL 0x5a
0119
0120
0121 #define VV6410_FIELDLENGTHH 0x61
0122 #define VV6410_FIELDLENGTHL 0x62
0123
0124
0125
0126 #define VV6410_BLACKOFFSETH 0x70
0127 #define VV6410_BLACKOFFSETL 0x71
0128
0129
0130 #define VV6410_BLACKOFFSETSETUP 0x72
0131
0132
0133 #define VV6410_CR0 0x75
0134
0135
0136 #define VV6410_CR1 0x76
0137
0138
0139 #define VV6410_AS0 0x77
0140
0141
0142 #define VV6410_AT0 0x78
0143
0144
0145 #define VV6410_AT1 0x79
0146
0147 #define VV6410_HFLIP (1 << 3)
0148 #define VV6410_VFLIP (1 << 4)
0149
0150 #define VV6410_LOW_POWER_MODE (1 << 0)
0151 #define VV6410_SOFT_RESET (1 << 2)
0152 #define VV6410_PAL_25_FPS (0 << 3)
0153
0154 #define VV6410_CLK_DIV_2 (1 << 1)
0155
0156 #define VV6410_FINE_EXPOSURE 320
0157 #define VV6410_COARSE_EXPOSURE 192
0158 #define VV6410_DEFAULT_GAIN 5
0159
0160 #define VV6410_SUBSAMPLE 0x01
0161 #define VV6410_CROP_TO_QVGA 0x02
0162
0163 #define VV6410_CIF_LINELENGTH 415
0164
0165 static int vv6410_probe(struct sd *sd);
0166 static int vv6410_start(struct sd *sd);
0167 static int vv6410_init(struct sd *sd);
0168 static int vv6410_init_controls(struct sd *sd);
0169 static int vv6410_stop(struct sd *sd);
0170 static int vv6410_dump(struct sd *sd);
0171
0172
0173 static int vv6410_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
0174 static int vv6410_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
0175 static int vv6410_set_analog_gain(struct gspca_dev *gspca_dev, __s32 val);
0176 static int vv6410_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
0177
0178 const struct stv06xx_sensor stv06xx_sensor_vv6410 = {
0179 .name = "ST VV6410",
0180 .i2c_flush = 5,
0181 .i2c_addr = 0x20,
0182 .i2c_len = 1,
0183
0184
0185 .min_packet_size = { 1023 },
0186 .max_packet_size = { 1023 },
0187 .init = vv6410_init,
0188 .init_controls = vv6410_init_controls,
0189 .probe = vv6410_probe,
0190 .start = vv6410_start,
0191 .stop = vv6410_stop,
0192 .dump = vv6410_dump,
0193 };
0194
0195
0196 struct stv_init {
0197 u16 addr;
0198 u8 data;
0199 };
0200
0201 static const struct stv_init stv_bridge_init[] = {
0202
0203 {STV_RESET, 0x80},
0204 {STV_RESET, 0x00},
0205 {STV_SCAN_RATE, 0x00},
0206 {STV_I2C_FLUSH, 0x04},
0207 {STV_REG00, 0x0b},
0208 {STV_REG01, 0xa7},
0209 {STV_REG02, 0xb7},
0210 {STV_REG03, 0x00},
0211 {STV_REG04, 0x00},
0212 {0x1536, 0x02},
0213 {0x1537, 0x00},
0214 {0x1538, 0x60},
0215 {0x1539, 0x01},
0216 {0x153a, 0x20},
0217 {0x153b, 0x01},
0218 };
0219
0220 static const u8 vv6410_sensor_init[][2] = {
0221
0222 {VV6410_SETUP0, VV6410_SOFT_RESET},
0223 {VV6410_SETUP0, VV6410_LOW_POWER_MODE},
0224
0225 {VV6410_SETUP1, BIT(6)},
0226
0227 {VV6410_FGMODES, BIT(6) | BIT(4) | BIT(2) | BIT(0)},
0228 {VV6410_PINMAPPING, 0x00},
0229
0230 {VV6410_DATAFORMAT, BIT(7) | BIT(0)},
0231
0232 {VV6410_CLKDIV, VV6410_CLK_DIV_2},
0233
0234
0235
0236 {VV6410_AS0, BIT(6) | BIT(4) | BIT(3) | BIT(2) | BIT(1)},
0237 {VV6410_AT0, 0x00},
0238
0239 {VV6410_AT1, BIT(4) | BIT(0)},
0240 };
0241
0242 #endif