xref: /OK3568_Linux_fs/kernel/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (c) 2001 Jean-Fredric Clere, Nikolas Zimmermann, Georg Acher
4*4882a593Smuzhiyun  *		      Mark Cave-Ayland, Carlo E Prelz, Dick Streefland
5*4882a593Smuzhiyun  * Copyright (c) 2002, 2003 Tuukka Toivonen
6*4882a593Smuzhiyun  * Copyright (c) 2008 Erik Andrén
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  * P/N 861037:      Sensor HDCS1000        ASIC STV0600
9*4882a593Smuzhiyun  * P/N 861050-0010: Sensor HDCS1000        ASIC STV0600
10*4882a593Smuzhiyun  * P/N 861050-0020: Sensor Photobit PB100  ASIC STV0600-1 - QuickCam Express
11*4882a593Smuzhiyun  * P/N 861055:      Sensor ST VV6410       ASIC STV0610   - LEGO cam
12*4882a593Smuzhiyun  * P/N 861075-0040: Sensor HDCS1000        ASIC
13*4882a593Smuzhiyun  * P/N 961179-0700: Sensor ST VV6410       ASIC STV0602   - Dexxa WebCam USB
14*4882a593Smuzhiyun  * P/N 861040-0000: Sensor ST VV6410       ASIC STV0610   - QuickCam Web
15*4882a593Smuzhiyun  */
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun #ifndef STV06XX_PB0100_H_
18*4882a593Smuzhiyun #define STV06XX_PB0100_H_
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #include "stv06xx_sensor.h"
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /* mode priv field flags */
23*4882a593Smuzhiyun #define PB0100_CROP_TO_VGA	0x01
24*4882a593Smuzhiyun #define PB0100_SUBSAMPLE	0x02
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /* I2C Registers */
27*4882a593Smuzhiyun #define PB_IDENT		0x00	/* Chip Version */
28*4882a593Smuzhiyun #define PB_RSTART		0x01	/* Row Window Start */
29*4882a593Smuzhiyun #define PB_CSTART		0x02	/* Column Window Start */
30*4882a593Smuzhiyun #define PB_RWSIZE		0x03	/* Row Window Size */
31*4882a593Smuzhiyun #define PB_CWSIZE		0x04	/* Column  Window Size */
32*4882a593Smuzhiyun #define PB_CFILLIN		0x05	/* Column Fill-In */
33*4882a593Smuzhiyun #define PB_VBL			0x06	/* Vertical Blank Count */
34*4882a593Smuzhiyun #define PB_CONTROL		0x07	/* Control Mode */
35*4882a593Smuzhiyun #define PB_FINTTIME		0x08	/* Integration Time/Frame Unit Count */
36*4882a593Smuzhiyun #define PB_RINTTIME		0x09	/* Integration Time/Row Unit Count */
37*4882a593Smuzhiyun #define PB_ROWSPEED		0x0a	/* Row Speed Control */
38*4882a593Smuzhiyun #define PB_ABORTFRAME		0x0b	/* Abort Frame */
39*4882a593Smuzhiyun #define PB_R12			0x0c	/* Reserved */
40*4882a593Smuzhiyun #define PB_RESET		0x0d	/* Reset */
41*4882a593Smuzhiyun #define PB_EXPGAIN		0x0e	/* Exposure Gain Command */
42*4882a593Smuzhiyun #define PB_R15			0x0f	/* Expose0 */
43*4882a593Smuzhiyun #define PB_R16			0x10	/* Expose1 */
44*4882a593Smuzhiyun #define PB_R17			0x11	/* Expose2 */
45*4882a593Smuzhiyun #define PB_R18			0x12	/* Low0_DAC */
46*4882a593Smuzhiyun #define PB_R19			0x13	/* Low1_DAC */
47*4882a593Smuzhiyun #define PB_R20			0x14	/* Low2_DAC */
48*4882a593Smuzhiyun #define PB_R21			0x15	/* Threshold11 */
49*4882a593Smuzhiyun #define PB_R22			0x16	/* Threshold0x */
50*4882a593Smuzhiyun #define PB_UPDATEINT		0x17	/* Update Interval */
51*4882a593Smuzhiyun #define PB_R24			0x18	/* High_DAC */
52*4882a593Smuzhiyun #define PB_R25			0x19	/* Trans0H */
53*4882a593Smuzhiyun #define PB_R26			0x1a	/* Trans1L */
54*4882a593Smuzhiyun #define PB_R27			0x1b	/* Trans1H */
55*4882a593Smuzhiyun #define PB_R28			0x1c	/* Trans2L */
56*4882a593Smuzhiyun #define PB_R29			0x1d	/* Reserved */
57*4882a593Smuzhiyun #define PB_R30			0x1e	/* Reserved */
58*4882a593Smuzhiyun #define PB_R31			0x1f	/* Wait to Read */
59*4882a593Smuzhiyun #define PB_PREADCTRL		0x20	/* Pixel Read Control Mode */
60*4882a593Smuzhiyun #define PB_R33			0x21	/* IREF_VLN */
61*4882a593Smuzhiyun #define PB_R34			0x22	/* IREF_VLP */
62*4882a593Smuzhiyun #define PB_R35			0x23	/* IREF_VLN_INTEG */
63*4882a593Smuzhiyun #define PB_R36			0x24	/* IREF_MASTER */
64*4882a593Smuzhiyun #define PB_R37			0x25	/* IDACP */
65*4882a593Smuzhiyun #define PB_R38			0x26	/* IDACN */
66*4882a593Smuzhiyun #define PB_R39			0x27	/* DAC_Control_Reg */
67*4882a593Smuzhiyun #define PB_R40			0x28	/* VCL */
68*4882a593Smuzhiyun #define PB_R41			0x29	/* IREF_VLN_ADCIN */
69*4882a593Smuzhiyun #define PB_R42			0x2a	/* Reserved */
70*4882a593Smuzhiyun #define PB_G1GAIN		0x2b	/* Green 1 Gain */
71*4882a593Smuzhiyun #define PB_BGAIN		0x2c	/* Blue Gain */
72*4882a593Smuzhiyun #define PB_RGAIN		0x2d	/* Red Gain */
73*4882a593Smuzhiyun #define PB_G2GAIN		0x2e	/* Green 2 Gain */
74*4882a593Smuzhiyun #define PB_R47			0x2f	/* Dark Row Address */
75*4882a593Smuzhiyun #define PB_R48			0x30	/* Dark Row Options */
76*4882a593Smuzhiyun #define PB_R49			0x31	/* Reserved */
77*4882a593Smuzhiyun #define PB_R50			0x32	/* Image Test Data */
78*4882a593Smuzhiyun #define PB_ADCMAXGAIN		0x33	/* Maximum Gain */
79*4882a593Smuzhiyun #define PB_ADCMINGAIN		0x34	/* Minimum Gain */
80*4882a593Smuzhiyun #define PB_ADCGLOBALGAIN	0x35	/* Global Gain */
81*4882a593Smuzhiyun #define PB_R54			0x36	/* Maximum Frame */
82*4882a593Smuzhiyun #define PB_R55			0x37	/* Minimum Frame */
83*4882a593Smuzhiyun #define PB_R56			0x38	/* Reserved */
84*4882a593Smuzhiyun #define PB_VOFFSET		0x39	/* VOFFSET */
85*4882a593Smuzhiyun #define PB_R58			0x3a	/* Snap-Shot Sequence Trigger */
86*4882a593Smuzhiyun #define PB_ADCGAINH		0x3b	/* VREF_HI */
87*4882a593Smuzhiyun #define PB_ADCGAINL		0x3c	/* VREF_LO */
88*4882a593Smuzhiyun #define PB_R61			0x3d	/* Reserved */
89*4882a593Smuzhiyun #define PB_R62			0x3e	/* Reserved */
90*4882a593Smuzhiyun #define PB_R63			0x3f	/* Reserved */
91*4882a593Smuzhiyun #define PB_R64			0x40	/* Red/Blue Gain */
92*4882a593Smuzhiyun #define PB_R65			0x41	/* Green 2/Green 1 Gain */
93*4882a593Smuzhiyun #define PB_R66			0x42	/* VREF_HI/LO */
94*4882a593Smuzhiyun #define PB_R67			0x43	/* Integration Time/Row Unit Count */
95*4882a593Smuzhiyun #define PB_R240			0xf0	/* ADC Test */
96*4882a593Smuzhiyun #define PB_R241			0xf1    /* Chip Enable */
97*4882a593Smuzhiyun #define PB_R242			0xf2	/* Reserved */
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun static int pb0100_probe(struct sd *sd);
100*4882a593Smuzhiyun static int pb0100_start(struct sd *sd);
101*4882a593Smuzhiyun static int pb0100_init(struct sd *sd);
102*4882a593Smuzhiyun static int pb0100_init_controls(struct sd *sd);
103*4882a593Smuzhiyun static int pb0100_stop(struct sd *sd);
104*4882a593Smuzhiyun static int pb0100_dump(struct sd *sd);
105*4882a593Smuzhiyun 
106*4882a593Smuzhiyun /* V4L2 controls supported by the driver */
107*4882a593Smuzhiyun static int pb0100_set_gain(struct gspca_dev *gspca_dev, __s32 val);
108*4882a593Smuzhiyun static int pb0100_set_red_balance(struct gspca_dev *gspca_dev, __s32 val);
109*4882a593Smuzhiyun static int pb0100_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val);
110*4882a593Smuzhiyun static int pb0100_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
111*4882a593Smuzhiyun static int pb0100_set_autogain(struct gspca_dev *gspca_dev, __s32 val);
112*4882a593Smuzhiyun static int pb0100_set_autogain_target(struct gspca_dev *gspca_dev, __s32 val);
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun const struct stv06xx_sensor stv06xx_sensor_pb0100 = {
115*4882a593Smuzhiyun 	.name = "PB-0100",
116*4882a593Smuzhiyun 	.i2c_flush = 1,
117*4882a593Smuzhiyun 	.i2c_addr = 0xba,
118*4882a593Smuzhiyun 	.i2c_len = 2,
119*4882a593Smuzhiyun 
120*4882a593Smuzhiyun 	.min_packet_size = { 635, 847 },
121*4882a593Smuzhiyun 	.max_packet_size = { 847, 923 },
122*4882a593Smuzhiyun 
123*4882a593Smuzhiyun 	.init = pb0100_init,
124*4882a593Smuzhiyun 	.init_controls = pb0100_init_controls,
125*4882a593Smuzhiyun 	.probe = pb0100_probe,
126*4882a593Smuzhiyun 	.start = pb0100_start,
127*4882a593Smuzhiyun 	.stop = pb0100_stop,
128*4882a593Smuzhiyun 	.dump = pb0100_dump,
129*4882a593Smuzhiyun };
130*4882a593Smuzhiyun 
131*4882a593Smuzhiyun #endif
132