stv06xx.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
  4. * Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
  5. * Copyright (c) 2002, 2003 Tuukka Toivonen
  6. * Copyright (c) 2008 Erik Andrén
  7. *
  8. * P/N 861037: Sensor HDCS1000 ASIC STV0600
  9. * P/N 861050-0010: Sensor HDCS1000 ASIC STV0600
  10. * P/N 861050-0020: Sensor Photobit PB100 ASIC STV0600-1 - QuickCam Express
  11. * P/N 861055: Sensor ST VV6410 ASIC STV0610 - LEGO cam
  12. * P/N 861075-0040: Sensor HDCS1000 ASIC
  13. * P/N 961179-0700: Sensor ST VV6410 ASIC STV0602 - Dexxa WebCam USB
  14. * P/N 861040-0000: Sensor ST VV6410 ASIC STV0610 - QuickCam Web
  15. */
  16. #ifndef STV06XX_H_
  17. #define STV06XX_H_
  18. #include <linux/slab.h>
  19. #include "gspca.h"
  20. #define MODULE_NAME "STV06xx"
  21. #define STV_ISOC_ENDPOINT_ADDR 0x81
  22. #define STV_R 0x0509
  23. #define STV_REG23 0x0423
  24. /* Control registers of the STV0600 ASIC */
  25. #define STV_I2C_PARTNER 0x1420
  26. #define STV_I2C_VAL_REG_VAL_PAIRS_MIN1 0x1421
  27. #define STV_I2C_READ_WRITE_TOGGLE 0x1422
  28. #define STV_I2C_FLUSH 0x1423
  29. #define STV_I2C_SUCC_READ_REG_VALS 0x1424
  30. #define STV_ISO_ENABLE 0x1440
  31. #define STV_SCAN_RATE 0x1443
  32. #define STV_LED_CTRL 0x1445
  33. #define STV_STV0600_EMULATION 0x1446
  34. #define STV_REG00 0x1500
  35. #define STV_REG01 0x1501
  36. #define STV_REG02 0x1502
  37. #define STV_REG03 0x1503
  38. #define STV_REG04 0x1504
  39. #define STV_ISO_SIZE_L 0x15c1
  40. #define STV_ISO_SIZE_H 0x15c2
  41. /* Refers to the CIF 352x288 and QCIF 176x144 */
  42. /* 1: 288 lines, 2: 144 lines */
  43. #define STV_Y_CTRL 0x15c3
  44. #define STV_RESET 0x1620
  45. /* 0xa: 352 columns, 0x6: 176 columns */
  46. #define STV_X_CTRL 0x1680
  47. #define STV06XX_URB_MSG_TIMEOUT 5000
  48. #define I2C_MAX_BYTES 16
  49. #define I2C_MAX_WORDS 8
  50. #define I2C_BUFFER_LENGTH 0x23
  51. #define I2C_READ_CMD 3
  52. #define I2C_WRITE_CMD 1
  53. #define LED_ON 1
  54. #define LED_OFF 0
  55. /* STV06xx device descriptor */
  56. struct sd {
  57. struct gspca_dev gspca_dev;
  58. /* A pointer to the currently connected sensor */
  59. const struct stv06xx_sensor *sensor;
  60. /* Sensor private data */
  61. void *sensor_priv;
  62. /* The first 4 lines produced by the stv6422 are no good, this keeps
  63. track of how many bytes we still need to skip during a frame */
  64. int to_skip;
  65. /* Bridge / Camera type */
  66. u8 bridge;
  67. #define BRIDGE_STV600 0
  68. #define BRIDGE_STV602 1
  69. #define BRIDGE_STV610 2
  70. #define BRIDGE_ST6422 3 /* With integrated sensor */
  71. };
  72. int stv06xx_write_bridge(struct sd *sd, u16 address, u16 i2c_data);
  73. int stv06xx_read_bridge(struct sd *sd, u16 address, u8 *i2c_data);
  74. int stv06xx_write_sensor_bytes(struct sd *sd, const u8 *data, u8 len);
  75. int stv06xx_write_sensor_words(struct sd *sd, const u16 *data, u8 len);
  76. int stv06xx_read_sensor(struct sd *sd, const u8 address, u16 *value);
  77. int stv06xx_write_sensor(struct sd *sd, u8 address, u16 value);
  78. #endif