Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
0004  *            Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
0005  * Copyright (c) 2002, 2003 Tuukka Toivonen
0006  * Copyright (c) 2008 Erik Andrén
0007  *
0008  * P/N 861037:      Sensor HDCS1000        ASIC STV0600
0009  * P/N 861050-0010: Sensor HDCS1000        ASIC STV0600
0010  * P/N 861050-0020: Sensor Photobit PB100  ASIC STV0600-1 - QuickCam Express
0011  * P/N 861055:      Sensor ST VV6410       ASIC STV0610   - LEGO cam
0012  * P/N 861075-0040: Sensor HDCS1000        ASIC
0013  * P/N 961179-0700: Sensor ST VV6410       ASIC STV0602   - Dexxa WebCam USB
0014  * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
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 /* Control registers of the STV0600 ASIC */
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 /* Refers to the CIF 352x288 and QCIF 176x144 */
0052 /* 1: 288 lines, 2: 144 lines */
0053 #define STV_Y_CTRL          0x15c3
0054 
0055 #define STV_RESET                       0x1620
0056 
0057 /* 0xa: 352 columns, 0x6: 176 columns */
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 /* STV06xx device descriptor */
0073 struct sd {
0074     struct gspca_dev gspca_dev;
0075 
0076     /* A pointer to the currently connected sensor */
0077     const struct stv06xx_sensor *sensor;
0078 
0079     /* Sensor private data */
0080     void *sensor_priv;
0081 
0082     /* The first 4 lines produced by the stv6422 are no good, this keeps
0083        track of how many bytes we still need to skip during a frame */
0084     int to_skip;
0085 
0086     /* Bridge / Camera type */
0087     u8 bridge;
0088     #define BRIDGE_STV600 0
0089     #define BRIDGE_STV602 1
0090     #define BRIDGE_STV610 2
0091     #define BRIDGE_ST6422 3 /* With integrated sensor */
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