xref: /linux/drivers/media/usb/gspca/stv06xx/stv06xx_sensor.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
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 
17 #ifndef STV06XX_SENSOR_H_
18 #define STV06XX_SENSOR_H_
19 
20 #include "stv06xx.h"
21 
22 #define IS_1020(sd)	((sd)->sensor == &stv06xx_sensor_hdcs1020)
23 
24 extern const struct stv06xx_sensor stv06xx_sensor_vv6410;
25 extern const struct stv06xx_sensor stv06xx_sensor_hdcs1x00;
26 extern const struct stv06xx_sensor stv06xx_sensor_hdcs1020;
27 extern const struct stv06xx_sensor stv06xx_sensor_pb0100;
28 extern const struct stv06xx_sensor stv06xx_sensor_st6422;
29 
30 struct stv06xx_sensor {
31 	/* Defines the name of a sensor */
32 	char name[32];
33 
34 	/* Sensor i2c address */
35 	u8 i2c_addr;
36 
37 	/* Flush value*/
38 	u8 i2c_flush;
39 
40 	/* length of an i2c word */
41 	u8 i2c_len;
42 
43 	/* Isoc packet size (per mode) */
44 	int min_packet_size[4];
45 	int max_packet_size[4];
46 
47 	/* Probes if the sensor is connected */
48 	int (*probe)(struct sd *sd);
49 
50 	/* Performs a initialization sequence */
51 	int (*init)(struct sd *sd);
52 
53 	/* Initializes the controls */
54 	int (*init_controls)(struct sd *sd);
55 
56 	/* Reads a sensor register */
57 	int (*read_sensor)(struct sd *sd, const u8 address,
58 	      u8 *i2c_data, const u8 len);
59 
60 	/* Writes to a sensor register */
61 	int (*write_sensor)(struct sd *sd, const u8 address,
62 	      u8 *i2c_data, const u8 len);
63 
64 	/* Instructs the sensor to start streaming */
65 	int (*start)(struct sd *sd);
66 
67 	/* Instructs the sensor to stop streaming */
68 	int (*stop)(struct sd *sd);
69 
70 	/* Instructs the sensor to dump all its contents */
71 	int (*dump)(struct sd *sd);
72 };
73 
74 #endif
75