xref: /linux/drivers/media/usb/gspca/m5602/m5602_po1030.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Driver for the po1030 sensor.
4  *
5  * Copyright (c) 2008 Erik Andrén
6  * Copyright (c) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project.
7  * Copyright (c) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br>
8  *
9  * Portions of code to USB interface and ALi driver software,
10  * Copyright (c) 2006 Willem Duinker
11  * v4l2 interface modeled after the V4L2 driver
12  * for SN9C10x PC Camera Controllers
13  *
14  * Register defines taken from Pascal Stangs Procyon Armlib
15  */
16 
17 #ifndef M5602_PO1030_H_
18 #define M5602_PO1030_H_
19 
20 #include "m5602_sensor.h"
21 
22 /*****************************************************************************/
23 
24 #define PO1030_DEVID_H		0x00
25 #define PO1030_DEVID_L		0x01
26 #define PO1030_FRAMEWIDTH_H	0x04
27 #define PO1030_FRAMEWIDTH_L	0x05
28 #define PO1030_FRAMEHEIGHT_H	0x06
29 #define PO1030_FRAMEHEIGHT_L	0x07
30 #define PO1030_WINDOWX_H	0x08
31 #define PO1030_WINDOWX_L	0x09
32 #define PO1030_WINDOWY_H	0x0a
33 #define PO1030_WINDOWY_L	0x0b
34 #define PO1030_WINDOWWIDTH_H	0x0c
35 #define PO1030_WINDOWWIDTH_L	0x0d
36 #define PO1030_WINDOWHEIGHT_H	0x0e
37 #define PO1030_WINDOWHEIGHT_L	0x0f
38 
39 #define PO1030_GLOBALIBIAS	0x12
40 #define PO1030_PIXELIBIAS	0x13
41 
42 #define PO1030_GLOBALGAIN	0x15
43 #define PO1030_RED_GAIN		0x16
44 #define PO1030_GREEN_1_GAIN	0x17
45 #define PO1030_BLUE_GAIN	0x18
46 #define PO1030_GREEN_2_GAIN	0x19
47 
48 #define PO1030_INTEGLINES_H	0x1a
49 #define PO1030_INTEGLINES_M	0x1b
50 #define PO1030_INTEGLINES_L	0x1c
51 
52 #define PO1030_CONTROL1		0x1d
53 #define PO1030_CONTROL2		0x1e
54 #define PO1030_CONTROL3		0x1f
55 #define PO1030_CONTROL4		0x20
56 
57 #define PO1030_PERIOD50_H	0x23
58 #define PO1030_PERIOD50_L	0x24
59 #define PO1030_PERIOD60_H	0x25
60 #define PO1030_PERIOD60_L	0x26
61 #define PO1030_REGCLK167	0x27
62 #define PO1030_FLICKER_DELTA50	0x28
63 #define PO1030_FLICKERDELTA60	0x29
64 
65 #define PO1030_ADCOFFSET	0x2c
66 
67 /* Gamma Correction Coeffs */
68 #define PO1030_GC0		0x2d
69 #define PO1030_GC1		0x2e
70 #define PO1030_GC2		0x2f
71 #define PO1030_GC3		0x30
72 #define PO1030_GC4		0x31
73 #define PO1030_GC5		0x32
74 #define PO1030_GC6		0x33
75 #define PO1030_GC7		0x34
76 
77 /* Color Transform Matrix */
78 #define PO1030_CT0		0x35
79 #define PO1030_CT1		0x36
80 #define PO1030_CT2		0x37
81 #define PO1030_CT3		0x38
82 #define PO1030_CT4		0x39
83 #define PO1030_CT5		0x3a
84 #define PO1030_CT6		0x3b
85 #define PO1030_CT7		0x3c
86 #define PO1030_CT8		0x3d
87 
88 #define PO1030_AUTOCTRL1	0x3e
89 #define PO1030_AUTOCTRL2	0x3f
90 
91 #define PO1030_YTARGET		0x40
92 #define PO1030_GLOBALGAINMIN	0x41
93 #define PO1030_GLOBALGAINMAX	0x42
94 
95 #define PO1030_AWB_RED_TUNING	0x47
96 #define PO1030_AWB_BLUE_TUNING	0x48
97 
98 /* Output format control */
99 #define PO1030_OUTFORMCTRL1	0x5a
100 #define PO1030_OUTFORMCTRL2	0x5b
101 #define PO1030_OUTFORMCTRL3	0x5c
102 #define PO1030_OUTFORMCTRL4	0x5d
103 #define PO1030_OUTFORMCTRL5	0x5e
104 
105 #define PO1030_EDGE_ENH_OFF	0x5f
106 #define PO1030_EGA		0x60
107 
108 #define PO1030_Cb_U_GAIN	0x63
109 #define PO1030_Cr_V_GAIN	0x64
110 
111 #define PO1030_YCONTRAST	0x74
112 #define PO1030_YSATURATION	0x75
113 
114 #define PO1030_HFLIP		(1 << 7)
115 #define PO1030_VFLIP		(1 << 6)
116 
117 #define PO1030_HREF_ENABLE	(1 << 6)
118 
119 #define PO1030_RAW_RGB_BAYER	0x4
120 
121 #define PO1030_FRAME_EQUAL	(1 << 3)
122 #define PO1030_AUTO_SUBSAMPLING (1 << 4)
123 
124 #define PO1030_WEIGHT_WIN_2X	(1 << 3)
125 
126 #define PO1030_SHUTTER_MODE	(1 << 6)
127 #define PO1030_AUTO_SUBSAMPLING	(1 << 4)
128 #define PO1030_FRAME_EQUAL	(1 << 3)
129 
130 #define PO1030_SENSOR_RESET	(1 << 5)
131 
132 #define PO1030_SUBSAMPLING	(1 << 6)
133 
134 /*****************************************************************************/
135 
136 #define PO1030_GLOBAL_GAIN_DEFAULT	0x12
137 #define PO1030_EXPOSURE_DEFAULT		0x0085
138 #define PO1030_BLUE_GAIN_DEFAULT	0x36
139 #define PO1030_RED_GAIN_DEFAULT		0x36
140 #define PO1030_GREEN_GAIN_DEFAULT	0x40
141 
142 /*****************************************************************************/
143 
144 /* Kernel module parameters */
145 extern int force_sensor;
146 extern bool dump_sensor;
147 
148 int po1030_probe(struct sd *sd);
149 int po1030_init(struct sd *sd);
150 int po1030_init_controls(struct sd *sd);
151 int po1030_start(struct sd *sd);
152 void po1030_disconnect(struct sd *sd);
153 
154 static const struct m5602_sensor po1030 = {
155 	.name = "PO1030",
156 
157 	.i2c_slave_id = 0xdc,
158 	.i2c_regW = 1,
159 
160 	.probe = po1030_probe,
161 	.init = po1030_init,
162 	.init_controls = po1030_init_controls,
163 	.start = po1030_start,
164 	.disconnect = po1030_disconnect,
165 };
166 #endif
167