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#ifndef STV06XX_H_
31#define STV06XX_H_
32
33#include <linux/slab.h>
34#include "gspca.h"
35
36#define MODULE_NAME "STV06xx"
37
38#define STV_ISOC_ENDPOINT_ADDR 0x81
39
40#define STV_REG23 0x0423
41
42
43#define STV_I2C_PARTNER 0x1420
44#define STV_I2C_VAL_REG_VAL_PAIRS_MIN1 0x1421
45#define STV_I2C_READ_WRITE_TOGGLE 0x1422
46#define STV_I2C_FLUSH 0x1423
47#define STV_I2C_SUCC_READ_REG_VALS 0x1424
48
49#define STV_ISO_ENABLE 0x1440
50#define STV_SCAN_RATE 0x1443
51#define STV_LED_CTRL 0x1445
52#define STV_STV0600_EMULATION 0x1446
53#define STV_REG00 0x1500
54#define STV_REG01 0x1501
55#define STV_REG02 0x1502
56#define STV_REG03 0x1503
57#define STV_REG04 0x1504
58
59#define STV_ISO_SIZE_L 0x15c1
60#define STV_ISO_SIZE_H 0x15c2
61
62
63
64#define STV_Y_CTRL 0x15c3
65
66
67#define STV_X_CTRL 0x1680
68
69#define STV06XX_URB_MSG_TIMEOUT 5000
70
71#define I2C_MAX_BYTES 16
72#define I2C_MAX_WORDS 8
73
74#define I2C_BUFFER_LENGTH 0x23
75#define I2C_READ_CMD 3
76#define I2C_WRITE_CMD 1
77
78#define LED_ON 1
79#define LED_OFF 0
80
81
82struct sd {
83 struct gspca_dev gspca_dev;
84
85
86 const struct stv06xx_sensor *sensor;
87
88
89 struct sd_desc desc;
90
91
92 void *sensor_priv;
93
94
95
96 int to_skip;
97
98
99 u8 bridge;
100 #define BRIDGE_STV600 0
101 #define BRIDGE_STV602 1
102 #define BRIDGE_STV610 2
103 #define BRIDGE_ST6422 3
104};
105
106int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data);
107int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data);
108
109int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len);
110int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len);
111
112int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value);
113int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value);
114
115#endif
116