0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef STV06XX_H_
0018 #define STV06XX_H_
0019
0020 #include <linux/slab.h>
0021 #include "gspca.h"
0022
0023 #define MODULE_NAME "STV06xx"
0024
0025 #define STV_ISOC_ENDPOINT_ADDR 0x81
0026
0027 #define STV_R 0x0509
0028
0029 #define STV_REG23 0x0423
0030
0031
0032 #define STV_I2C_PARTNER 0x1420
0033 #define STV_I2C_VAL_REG_VAL_PAIRS_MIN1 0x1421
0034 #define STV_I2C_READ_WRITE_TOGGLE 0x1422
0035 #define STV_I2C_FLUSH 0x1423
0036 #define STV_I2C_SUCC_READ_REG_VALS 0x1424
0037
0038 #define STV_ISO_ENABLE 0x1440
0039 #define STV_SCAN_RATE 0x1443
0040 #define STV_LED_CTRL 0x1445
0041 #define STV_STV0600_EMULATION 0x1446
0042 #define STV_REG00 0x1500
0043 #define STV_REG01 0x1501
0044 #define STV_REG02 0x1502
0045 #define STV_REG03 0x1503
0046 #define STV_REG04 0x1504
0047
0048 #define STV_ISO_SIZE_L 0x15c1
0049 #define STV_ISO_SIZE_H 0x15c2
0050
0051
0052
0053 #define STV_Y_CTRL 0x15c3
0054
0055 #define STV_RESET 0x1620
0056
0057
0058 #define STV_X_CTRL 0x1680
0059
0060 #define STV06XX_URB_MSG_TIMEOUT 5000
0061
0062 #define I2C_MAX_BYTES 16
0063 #define I2C_MAX_WORDS 8
0064
0065 #define I2C_BUFFER_LENGTH 0x23
0066 #define I2C_READ_CMD 3
0067 #define I2C_WRITE_CMD 1
0068
0069 #define LED_ON 1
0070 #define LED_OFF 0
0071
0072
0073 struct sd {
0074 struct gspca_dev gspca_dev;
0075
0076
0077 const struct stv06xx_sensor *sensor;
0078
0079
0080 void *sensor_priv;
0081
0082
0083
0084 int to_skip;
0085
0086
0087 u8 bridge;
0088 #define BRIDGE_STV600 0
0089 #define BRIDGE_STV602 1
0090 #define BRIDGE_STV610 2
0091 #define BRIDGE_ST6422 3
0092 };
0093
0094 int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data);
0095 int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data);
0096
0097 int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len);
0098 int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len);
0099
0100 int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value);
0101 int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value);
0102
0103 #endif