xref: /linux/drivers/media/usb/gspca/stv06xx/stv06xx_sensor.h (revision 680e6ffa15103ab610c0fc1241d2f98c801b13e2)
1 /*
2  * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
3  *		      Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
4  * Copyright (c) 2002, 2003 Tuukka Toivonen
5  * Copyright (c) 2008 Erik Andrén
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * P/N 861037:      Sensor HDCS1000        ASIC STV0600
18  * P/N 861050-0010: Sensor HDCS1000        ASIC STV0600
19  * P/N 861050-0020: Sensor Photobit PB100  ASIC STV0600-1 - QuickCam Express
20  * P/N 861055:      Sensor ST VV6410       ASIC STV0610   - LEGO cam
21  * P/N 861075-0040: Sensor HDCS1000        ASIC
22  * P/N 961179-0700: Sensor ST VV6410       ASIC STV0602   - Dexxa WebCam USB
23  * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
24  */
25 
26 #ifndef STV06XX_SENSOR_H_
27 #define STV06XX_SENSOR_H_
28 
29 #include "stv06xx.h"
30 
31 #define IS_1020(sd)	((sd)->sensor == &stv06xx_sensor_hdcs1020)
32 
33 extern const struct stv06xx_sensor stv06xx_sensor_vv6410;
34 extern const struct stv06xx_sensor stv06xx_sensor_hdcs1x00;
35 extern const struct stv06xx_sensor stv06xx_sensor_hdcs1020;
36 extern const struct stv06xx_sensor stv06xx_sensor_pb0100;
37 extern const struct stv06xx_sensor stv06xx_sensor_st6422;
38 
39 struct stv06xx_sensor {
40 	/* Defines the name of a sensor */
41 	char name[32];
42 
43 	/* Sensor i2c address */
44 	u8 i2c_addr;
45 
46 	/* Flush value*/
47 	u8 i2c_flush;
48 
49 	/* length of an i2c word */
50 	u8 i2c_len;
51 
52 	/* Isoc packet size (per mode) */
53 	int min_packet_size[4];
54 	int max_packet_size[4];
55 
56 	/* Probes if the sensor is connected */
57 	int (*probe)(struct sd *sd);
58 
59 	/* Performs a initialization sequence */
60 	int (*init)(struct sd *sd);
61 
62 	/* Initializes the controls */
63 	int (*init_controls)(struct sd *sd);
64 
65 	/* Reads a sensor register */
66 	int (*read_sensor)(struct sd *sd, const u8 address,
67 	      u8 *i2c_data, const u8 len);
68 
69 	/* Writes to a sensor register */
70 	int (*write_sensor)(struct sd *sd, const u8 address,
71 	      u8 *i2c_data, const u8 len);
72 
73 	/* Instructs the sensor to start streaming */
74 	int (*start)(struct sd *sd);
75 
76 	/* Instructs the sensor to stop streaming */
77 	int (*stop)(struct sd *sd);
78 
79 	/* Instructs the sensor to dump all its contents */
80 	int (*dump)(struct sd *sd);
81 };
82 
83 #endif
84