104 lines · c
1/* SPDX-License-Identifier: GPL-2.0-or-later */2/*3 * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher4 * Mark Cave-Ayland, Carlo E Prelz, Dick Streefland5 * Copyright (c) 2002, 2003 Tuukka Toivonen6 * Copyright (c) 2008 Erik Andrén7 *8 * P/N 861037: Sensor HDCS1000 ASIC STV06009 * P/N 861050-0010: Sensor HDCS1000 ASIC STV060010 * P/N 861050-0020: Sensor Photobit PB100 ASIC STV0600-1 - QuickCam Express11 * P/N 861055: Sensor ST VV6410 ASIC STV0610 - LEGO cam12 * P/N 861075-0040: Sensor HDCS1000 ASIC13 * P/N 961179-0700: Sensor ST VV6410 ASIC STV0602 - Dexxa WebCam USB14 * P/N 861040-0000: Sensor ST VV6410 ASIC STV0610 - QuickCam Web15 */16 17#ifndef STV06XX_H_18#define STV06XX_H_19 20#include <linux/slab.h>21#include "gspca.h"22 23#define MODULE_NAME "STV06xx"24 25#define STV_ISOC_ENDPOINT_ADDR 0x8126 27#define STV_R 0x050928 29#define STV_REG23 0x042330 31/* Control registers of the STV0600 ASIC */32#define STV_I2C_PARTNER 0x142033#define STV_I2C_VAL_REG_VAL_PAIRS_MIN1 0x142134#define STV_I2C_READ_WRITE_TOGGLE 0x142235#define STV_I2C_FLUSH 0x142336#define STV_I2C_SUCC_READ_REG_VALS 0x142437 38#define STV_ISO_ENABLE 0x144039#define STV_SCAN_RATE 0x144340#define STV_LED_CTRL 0x144541#define STV_STV0600_EMULATION 0x144642#define STV_REG00 0x150043#define STV_REG01 0x150144#define STV_REG02 0x150245#define STV_REG03 0x150346#define STV_REG04 0x150447 48#define STV_ISO_SIZE_L 0x15c149#define STV_ISO_SIZE_H 0x15c250 51/* Refers to the CIF 352x288 and QCIF 176x144 */52/* 1: 288 lines, 2: 144 lines */53#define STV_Y_CTRL 0x15c354 55#define STV_RESET 0x162056 57/* 0xa: 352 columns, 0x6: 176 columns */58#define STV_X_CTRL 0x168059 60#define STV06XX_URB_MSG_TIMEOUT 500061 62#define I2C_MAX_BYTES 1663#define I2C_MAX_WORDS 864 65#define I2C_BUFFER_LENGTH 0x2366#define I2C_READ_CMD 367#define I2C_WRITE_CMD 168 69#define LED_ON 170#define LED_OFF 071 72/* STV06xx device descriptor */73struct sd {74 struct gspca_dev gspca_dev;75 76 /* A pointer to the currently connected sensor */77 const struct stv06xx_sensor *sensor;78 79 /* Sensor private data */80 void *sensor_priv;81 82 /* The first 4 lines produced by the stv6422 are no good, this keeps83 track of how many bytes we still need to skip during a frame */84 int to_skip;85 86 /* Bridge / Camera type */87 u8 bridge;88 #define BRIDGE_STV600 089 #define BRIDGE_STV602 190 #define BRIDGE_STV610 291 #define BRIDGE_ST6422 3 /* With integrated sensor */92};93 94int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data);95int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data);96 97int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len);98int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len);99 100int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value);101int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value);102 103#endif104