1 /* Subdriver for the GL860 chip with the MI2020 sensor
2 * Author Olivier LORIN, from Ice/Soro2005's logs(A), Fret_saw/Hulkie's
3 * logs(B) and Tricid"s logs(C). With the help of Kytrix/BUGabundo/Blazercist.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 static u8 dat_bright1
[] = {0x8c, 0xa2, 0x06};
24 static u8 dat_bright3
[] = {0x8c, 0xa1, 0x02};
25 static u8 dat_bright4
[] = {0x90, 0x00, 0x0f};
26 static u8 dat_bright5
[] = {0x8c, 0xa1, 0x03};
27 static u8 dat_bright6
[] = {0x90, 0x00, 0x05};
29 static u8 dat_dummy1
[] = {0x90, 0x00, 0x06};
30 /*static u8 dummy2[] = {0x8c, 0xa1, 0x02};*/
31 /*static u8 dummy3[] = {0x90, 0x00, 0x1f};*/
33 static u8 dat_hvflip1
[] = {0x8c, 0x27, 0x19};
34 static u8 dat_hvflip3
[] = {0x8c, 0x27, 0x3b};
35 static u8 dat_hvflip5
[] = {0x8c, 0xa1, 0x03};
36 static u8 dat_hvflip6
[] = {0x90, 0x00, 0x06};
38 static u8 dat_freq1
[] = { 0x8c, 0xa4, 0x04 };
40 static u8 dat_multi5
[] = { 0x8c, 0xa1, 0x03 };
41 static u8 dat_multi6
[] = { 0x90, 0x00, 0x05 };
43 static struct validx tbl_common1
[] = {
45 {1, 0xffff}, /* msleep(35); */
46 {0x006a, 0x0007}, {0x0063, 0x0006}, {0x006a, 0x000d}, {0x0000, 0x00c0},
47 {0x0010, 0x0010}, {0x0003, 0x00c1}, {0x0042, 0x00c2}, {0x0004, 0x00d8},
48 {0x0000, 0x0058}, {0x0002, 0x0004}, {0x0041, 0x0000},
51 static struct validx tbl_common2
[] = {
58 {0x0000, 0x00c0}, {0x0010, 0x0010}, {0x0003, 0x00c1}, {0x0042, 0x00c2},
59 {0x0004, 0x00d8}, {0x0000, 0x0058}, {0x0041, 0x0000},
62 static struct idxdata tbl_common3
[] = {
63 {0x32, "\x02\x00\x08"}, {0x33, "\xf4\x03\x1d"},
64 {6, "\xff\xff\xff"}, /* 12 */
65 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"},
66 {2, "\xff\xff\xff"}, /* - */
67 {0x34, "\x1e\x8f\x09"}, {0x32, "\x14\x06\xe6"}, {0x33, "\x8c\x22\x23"},
68 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa2\x0f"}, {0x33, "\x90\x00\x0d"},
69 {0x33, "\x8c\xa2\x10"}, {0x33, "\x90\x00\x0b"}, {0x33, "\x8c\xa2\x11"},
70 {0x33, "\x90\x00\x07"}, {0x33, "\xf4\x03\x1d"}, {0x35, "\xa2\x00\xe2"},
71 {0x33, "\x8c\xab\x05"}, {0x33, "\x90\x00\x01"}, {0x32, "\x6e\x00\x86"},
72 {0x32, "\x70\x0f\xaa"}, {0x32, "\x72\x0f\xe4"}, {0x33, "\x8c\xa3\x4a"},
73 {0x33, "\x90\x00\x5a"}, {0x33, "\x8c\xa3\x4b"}, {0x33, "\x90\x00\xa6"},
74 {0x33, "\x8c\xa3\x61"}, {0x33, "\x90\x00\xc8"}, {0x33, "\x8c\xa3\x62"},
75 {0x33, "\x90\x00\xe1"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"},
76 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"},
77 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"},
78 {0x34, "\xde\x01\x5b"}, {0x34, "\xe6\x01\x13"}, {0x34, "\xee\x0b\xf0"},
79 {0x34, "\xf6\x0b\xa4"}, {0x35, "\x00\xf6\xe7"}, {0x35, "\x08\x0d\xfd"},
80 {0x35, "\x10\x25\x63"}, {0x35, "\x18\x35\x6c"}, {0x35, "\x20\x42\x7e"},
81 {0x35, "\x28\x19\x44"}, {0x35, "\x30\x39\xd4"}, {0x35, "\x38\xf5\xa8"},
82 {0x35, "\x4c\x07\x90"}, {0x35, "\x44\x07\xb8"}, {0x35, "\x5c\x06\x88"},
83 {0x35, "\x54\x07\xff"}, {0x34, "\xe0\x01\x52"}, {0x34, "\xe8\x00\xcc"},
84 {0x34, "\xf0\x0d\x83"}, {0x34, "\xf8\x0c\xb3"}, {0x35, "\x02\xfe\xba"},
85 {0x35, "\x0a\x04\xe0"}, {0x35, "\x12\x1c\x63"}, {0x35, "\x1a\x2b\x5a"},
86 {0x35, "\x22\x32\x5e"}, {0x35, "\x2a\x0d\x28"}, {0x35, "\x32\x2c\x02"},
87 {0x35, "\x3a\xf4\xfa"}, {0x35, "\x4e\x07\xef"}, {0x35, "\x46\x07\x88"},
88 {0x35, "\x5e\x07\xc1"}, {0x35, "\x56\x04\x64"}, {0x34, "\xe4\x01\x15"},
89 {0x34, "\xec\x00\x82"}, {0x34, "\xf4\x0c\xce"}, {0x34, "\xfc\x0c\xba"},
90 {0x35, "\x06\x1f\x02"}, {0x35, "\x0e\x02\xe3"}, {0x35, "\x16\x1a\x50"},
91 {0x35, "\x1e\x24\x39"}, {0x35, "\x26\x23\x4c"}, {0x35, "\x2e\xf9\x1b"},
92 {0x35, "\x36\x23\x19"}, {0x35, "\x3e\x12\x08"}, {0x35, "\x52\x07\x22"},
93 {0x35, "\x4a\x03\xd3"}, {0x35, "\x62\x06\x54"}, {0x35, "\x5a\x04\x5d"},
94 {0x34, "\xe2\x01\x04"}, {0x34, "\xea\x00\xa0"}, {0x34, "\xf2\x0c\xbc"},
95 {0x34, "\xfa\x0c\x5b"}, {0x35, "\x04\x17\xf2"}, {0x35, "\x0c\x02\x08"},
96 {0x35, "\x14\x28\x43"}, {0x35, "\x1c\x28\x62"}, {0x35, "\x24\x2b\x60"},
97 {0x35, "\x2c\x07\x33"}, {0x35, "\x34\x1f\xb0"}, {0x35, "\x3c\xed\xcd"},
98 {0x35, "\x50\x00\x06"}, {0x35, "\x48\x07\xff"}, {0x35, "\x60\x05\x89"},
99 {0x35, "\x58\x07\xff"}, {0x35, "\x40\x00\xa0"}, {0x35, "\x42\x00\x00"},
100 {0x32, "\x10\x01\xfc"}, {0x33, "\x8c\xa1\x18"}, {0x33, "\x90\x00\x3c"},
102 {0x33, "\x78\x00\x00"},
104 {0x35, "\xb8\x1f\x20"}, {0x33, "\x8c\xa2\x06"}, {0x33, "\x90\x00\x10"},
105 {0x33, "\x8c\xa2\x07"}, {0x33, "\x90\x00\x08"}, {0x33, "\x8c\xa2\x42"},
106 {0x33, "\x90\x00\x0b"}, {0x33, "\x8c\xa2\x4a"}, {0x33, "\x90\x00\x8c"},
107 {0x35, "\xba\xfa\x08"}, {0x33, "\x8c\xa2\x02"}, {0x33, "\x90\x00\x22"},
108 {0x33, "\x8c\xa2\x03"}, {0x33, "\x90\x00\xbb"},
111 static struct idxdata tbl_common4
[] = {
112 {0x33, "\x8c\x22\x2e"}, {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\xa4\x08"},
113 {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x21"},
114 {0x33, "\x8c\xa4\x0a"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\xa4\x0b"},
115 {0x33, "\x90\x00\x27"}, {0x33, "\x8c\x24\x11"}, {0x33, "\x90\x00\xa0"},
116 {0x33, "\x8c\x24\x13"}, {0x33, "\x90\x00\xc0"}, {0x33, "\x8c\x24\x15"},
117 {0x33, "\x90\x00\xa0"}, {0x33, "\x8c\x24\x17"}, {0x33, "\x90\x00\xc0"},
120 static struct idxdata tbl_common5
[] = {
121 {0x33, "\x8c\xa4\x04"}, {0x33, "\x90\x00\x80"}, {0x33, "\x8c\xa7\x9d"},
122 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa7\x9e"}, {0x33, "\x90\x00\x00"},
123 {0x33, "\x8c\xa2\x0c"}, {0x33, "\x90\x00\x17"}, {0x33, "\x8c\xa2\x15"},
124 {0x33, "\x90\x00\x04"}, {0x33, "\x8c\xa2\x14"}, {0x33, "\x90\x00\x20"},
125 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x17"},
127 {0x33, "\x90\x21\x11"}, {0x33, "\x8c\x27\x1b"}, {0x33, "\x90\x02\x4f"},
128 {0x33, "\x8c\x27\x25"}, {0x33, "\x90\x06\x0f"}, {0x33, "\x8c\x27\x39"},
129 {0x33, "\x90\x21\x11"}, {0x33, "\x8c\x27\x3d"}, {0x33, "\x90\x01\x20"},
130 {0x33, "\x8c\x27\x47"}, {0x33, "\x90\x09\x4c"}, {0x33, "\x8c\x27\x03"},
131 {0x33, "\x90\x02\x84"}, {0x33, "\x8c\x27\x05"}, {0x33, "\x90\x01\xe2"},
132 {0x33, "\x8c\x27\x07"}, {0x33, "\x90\x06\x40"}, {0x33, "\x8c\x27\x09"},
133 {0x33, "\x90\x04\xb0"}, {0x33, "\x8c\x27\x0d"}, {0x33, "\x90\x00\x00"},
134 {0x33, "\x8c\x27\x0f"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x11"},
135 {0x33, "\x90\x04\xbd"}, {0x33, "\x8c\x27\x13"}, {0x33, "\x90\x06\x4d"},
136 {0x33, "\x8c\x27\x15"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x17"},
137 {0x33, "\x90\x21\x11"}, {0x33, "\x8c\x27\x19"}, {0x33, "\x90\x04\x6c"},
138 {0x33, "\x8c\x27\x1b"}, {0x33, "\x90\x02\x4f"}, {0x33, "\x8c\x27\x1d"},
139 {0x33, "\x90\x01\x02"}, {0x33, "\x8c\x27\x1f"}, {0x33, "\x90\x02\x79"},
140 {0x33, "\x8c\x27\x21"}, {0x33, "\x90\x01\x55"}, {0x33, "\x8c\x27\x23"},
141 {0x33, "\x90\x02\x85"}, {0x33, "\x8c\x27\x25"}, {0x33, "\x90\x06\x0f"},
142 {0x33, "\x8c\x27\x27"}, {0x33, "\x90\x20\x20"}, {0x33, "\x8c\x27\x29"},
143 {0x33, "\x90\x20\x20"}, {0x33, "\x8c\x27\x2b"}, {0x33, "\x90\x10\x20"},
144 {0x33, "\x8c\x27\x2d"}, {0x33, "\x90\x20\x07"}, {0x33, "\x8c\x27\x2f"},
145 {0x33, "\x90\x00\x04"}, {0x33, "\x8c\x27\x31"}, {0x33, "\x90\x00\x04"},
146 {0x33, "\x8c\x27\x33"}, {0x33, "\x90\x04\xbb"}, {0x33, "\x8c\x27\x35"},
147 {0x33, "\x90\x06\x4b"}, {0x33, "\x8c\x27\x37"}, {0x33, "\x90\x00\x00"},
148 {0x33, "\x8c\x27\x39"}, {0x33, "\x90\x21\x11"}, {0x33, "\x8c\x27\x3b"},
149 {0x33, "\x90\x00\x24"}, {0x33, "\x8c\x27\x3d"}, {0x33, "\x90\x01\x20"},
150 {0x33, "\x8c\x27\x41"}, {0x33, "\x90\x01\x69"}, {0x33, "\x8c\x27\x45"},
151 {0x33, "\x90\x04\xed"}, {0x33, "\x8c\x27\x47"}, {0x33, "\x90\x09\x4c"},
152 {0x33, "\x8c\x27\x51"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x53"},
153 {0x33, "\x90\x03\x20"}, {0x33, "\x8c\x27\x55"}, {0x33, "\x90\x00\x00"},
154 {0x33, "\x8c\x27\x57"}, {0x33, "\x90\x02\x58"}, {0x33, "\x8c\x27\x5f"},
155 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x61"}, {0x33, "\x90\x06\x40"},
156 {0x33, "\x8c\x27\x63"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x65"},
157 {0x33, "\x90\x04\xb0"}, {0x33, "\x8c\x22\x2e"}, {0x33, "\x90\x00\xa1"},
158 {0x33, "\x8c\xa4\x08"}, {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa4\x09"},
159 {0x33, "\x90\x00\x21"}, {0x33, "\x8c\xa4\x0a"}, {0x33, "\x90\x00\x25"},
160 {0x33, "\x8c\xa4\x0b"}, {0x33, "\x90\x00\x27"}, {0x33, "\x8c\x24\x11"},
161 {0x33, "\x90\x00\xa1"}, {0x33, "\x8c\x24\x13"}, {0x33, "\x90\x00\xc1"},
162 {0x33, "\x8c\x24\x15"},
165 static struct validx tbl_init_at_startup
[] = {
182 static struct idxdata tbl_init_post_alt_low1
[] = {
183 {0x33, "\x8c\x27\x15"}, {0x33, "\x90\x00\x25"}, {0x33, "\x8c\x22\x2e"},
184 {0x33, "\x90\x00\x81"}, {0x33, "\x8c\xa4\x08"}, {0x33, "\x90\x00\x17"},
185 {0x33, "\x8c\xa4\x09"}, {0x33, "\x90\x00\x1a"}, {0x33, "\x8c\xa4\x0a"},
186 {0x33, "\x90\x00\x1d"}, {0x33, "\x8c\xa4\x0b"}, {0x33, "\x90\x00\x20"},
187 {0x33, "\x8c\x24\x11"}, {0x33, "\x90\x00\x81"}, {0x33, "\x8c\x24\x13"},
188 {0x33, "\x90\x00\x9b"},
191 static struct idxdata tbl_init_post_alt_low2
[] = {
192 {0x33, "\x8c\x27\x03"}, {0x33, "\x90\x03\x24"}, {0x33, "\x8c\x27\x05"},
193 {0x33, "\x90\x02\x58"}, {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
195 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
199 static struct idxdata tbl_init_post_alt_low3
[] = {
200 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"},
202 {0x34, "\x1e\x8f\x09"}, {0x32, "\x14\x06\xe6"}, {0x33, "\x8c\xa1\x20"},
203 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x01"},
204 {0x33, "\x2e\x01\x00"}, {0x34, "\x04\x00\x2a"}, {0x33, "\x8c\xa7\x02"},
205 {0x33, "\x90\x00\x00"}, {0x33, "\x8c\x27\x95"}, {0x33, "\x90\x01\x00"},
207 {0x33, "\x8c\xa1\x20"}, {0x33, "\x90\x00\x72"}, {0x33, "\x8c\xa1\x03"},
208 {0x33, "\x90\x00\x02"}, {0x33, "\x8c\xa7\x02"}, {0x33, "\x90\x00\x01"},
210 {0x33, "\x8c\xa1\x20"}, {0x33, "\x90\x00\x00"}, {0x33, "\x8c\xa1\x03"},
211 {0x33, "\x90\x00\x01"}, {0x33, "\x8c\xa7\x02"}, {0x33, "\x90\x00\x00"},
212 {2, "\xff\xff\xff"}, /* - * */
213 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
215 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
217 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
219 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
223 static struct idxdata tbl_init_post_alt_low4
[] = {
224 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"},
225 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"},
226 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"},
227 {0x34, "\xde\x01\x5b"}, {0x34, "\xe6\x01\x13"}, {0x34, "\xee\x0b\xf0"},
228 {0x34, "\xf6\x0b\xa4"}, {0x35, "\x00\xf6\xe7"}, {0x35, "\x08\x0d\xfd"},
229 {0x35, "\x10\x25\x63"}, {0x35, "\x18\x35\x6c"}, {0x35, "\x20\x42\x7e"},
230 {0x35, "\x28\x19\x44"}, {0x35, "\x30\x39\xd4"}, {0x35, "\x38\xf5\xa8"},
231 {0x35, "\x4c\x07\x90"}, {0x35, "\x44\x07\xb8"}, {0x35, "\x5c\x06\x88"},
232 {0x35, "\x54\x07\xff"}, {0x34, "\xe0\x01\x52"}, {0x34, "\xe8\x00\xcc"},
233 {0x34, "\xf0\x0d\x83"}, {0x34, "\xf8\x0c\xb3"}, {0x35, "\x02\xfe\xba"},
234 {0x35, "\x0a\x04\xe0"}, {0x35, "\x12\x1c\x63"}, {0x35, "\x1a\x2b\x5a"},
235 {0x35, "\x22\x32\x5e"}, {0x35, "\x2a\x0d\x28"}, {0x35, "\x32\x2c\x02"},
236 {0x35, "\x3a\xf4\xfa"}, {0x35, "\x4e\x07\xef"}, {0x35, "\x46\x07\x88"},
237 {0x35, "\x5e\x07\xc1"}, {0x35, "\x56\x04\x64"}, {0x34, "\xe4\x01\x15"},
238 {0x34, "\xec\x00\x82"}, {0x34, "\xf4\x0c\xce"}, {0x34, "\xfc\x0c\xba"},
239 {0x35, "\x06\x1f\x02"}, {0x35, "\x0e\x02\xe3"}, {0x35, "\x16\x1a\x50"},
240 {0x35, "\x1e\x24\x39"}, {0x35, "\x26\x23\x4c"}, {0x35, "\x2e\xf9\x1b"},
241 {0x35, "\x36\x23\x19"}, {0x35, "\x3e\x12\x08"}, {0x35, "\x52\x07\x22"},
242 {0x35, "\x4a\x03\xd3"}, {0x35, "\x62\x06\x54"}, {0x35, "\x5a\x04\x5d"},
243 {0x34, "\xe2\x01\x04"}, {0x34, "\xea\x00\xa0"}, {0x34, "\xf2\x0c\xbc"},
244 {0x34, "\xfa\x0c\x5b"}, {0x35, "\x04\x17\xf2"}, {0x35, "\x0c\x02\x08"},
245 {0x35, "\x14\x28\x43"}, {0x35, "\x1c\x28\x62"}, {0x35, "\x24\x2b\x60"},
246 {0x35, "\x2c\x07\x33"}, {0x35, "\x34\x1f\xb0"}, {0x35, "\x3c\xed\xcd"},
247 {0x35, "\x50\x00\x06"}, {0x35, "\x48\x07\xff"}, {0x35, "\x60\x05\x89"},
248 {0x35, "\x58\x07\xff"}, {0x35, "\x40\x00\xa0"}, {0x35, "\x42\x00\x00"},
249 {0x32, "\x10\x01\xfc"}, {0x33, "\x8c\xa1\x18"},
250 /* Flip/Mirror h/v=1 */
251 {0x33, "\x90\x00\x3c"}, {0x33, "\x8c\x27\x19"}, {0x33, "\x90\x04\x6c"},
252 {0x33, "\x8c\x27\x3b"}, {0x33, "\x90\x00\x24"}, {0x33, "\x8c\xa1\x03"},
253 {0x33, "\x90\x00\x06"},
254 {130, "\xff\xff\xff"},
255 {0x33, "\x90\x00\x06"}, {0x33, "\x90\x00\x06"}, {0x33, "\x90\x00\x06"},
256 {0x33, "\x90\x00\x06"}, {0x33, "\x90\x00\x06"}, {0x33, "\x90\x00\x06"},
257 {100, "\xff\xff\xff"},
259 {0x33, "\x8c\xa1\x02"}, {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa1\x02"},
260 {0x33, "\x90\x00\x1f"}, {0x33, "\x8c\xa1\x02"}, {0x33, "\x90\x00\x1f"},
261 {0x33, "\x8c\xa1\x02"}, {0x33, "\x90\x00\x1f"},
263 {0x33, "\x8c\xa2\x06"}, {0x33, "\x90\x00\x46"}, {0x33, "\x8c\xa1\x02"},
264 {0x33, "\x90\x00\x0f"}, {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
266 {0x32, "\x6c\x14\x08"},
269 static struct idxdata tbl_init_post_alt_big1
[] = {
270 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
272 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
274 {0x34, "\x1e\x8f\x09"}, {0x34, "\x1c\x01\x28"}, {0x34, "\x1e\x8f\x09"},
275 {0x34, "\x1e\x8f\x09"}, {0x32, "\x14\x06\xe6"}, {0x33, "\x8c\xa1\x03"},
276 {0x33, "\x90\x00\x05"},
278 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"},
280 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x05"},
282 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x06"}, {0x33, "\x8c\xa1\x20"},
283 {0x33, "\x90\x00\x72"}, {0x33, "\x8c\xa1\x30"}, {0x33, "\x90\x00\x03"},
284 {0x33, "\x8c\xa1\x31"}, {0x33, "\x90\x00\x02"}, {0x33, "\x8c\xa1\x32"},
285 {0x33, "\x90\x00\x03"}, {0x33, "\x8c\xa1\x34"}, {0x33, "\x90\x00\x03"},
286 {0x33, "\x8c\xa1\x03"}, {0x33, "\x90\x00\x02"}, {0x33, "\x2e\x01\x00"},
287 {0x34, "\x04\x00\x2a"}, {0x33, "\x8c\xa7\x02"}, {0x33, "\x90\x00\x01"},
290 static struct idxdata tbl_init_post_alt_big2
[] = {
291 {0x32, "\x10\x01\xf8"}, {0x34, "\xce\x01\xa8"}, {0x34, "\xd0\x66\x33"},
292 {0x34, "\xd2\x31\x9a"}, {0x34, "\xd4\x94\x63"}, {0x34, "\xd6\x4b\x25"},
293 {0x34, "\xd8\x26\x70"}, {0x34, "\xda\x72\x4c"}, {0x34, "\xdc\xff\x04"},
294 {0x34, "\xde\x01\x5b"}, {0x34, "\xe6\x01\x13"}, {0x34, "\xee\x0b\xf0"},
295 {0x34, "\xf6\x0b\xa4"}, {0x35, "\x00\xf6\xe7"}, {0x35, "\x08\x0d\xfd"},
296 {0x35, "\x10\x25\x63"}, {0x35, "\x18\x35\x6c"}, {0x35, "\x20\x42\x7e"},
297 {0x35, "\x28\x19\x44"}, {0x35, "\x30\x39\xd4"}, {0x35, "\x38\xf5\xa8"},
298 {0x35, "\x4c\x07\x90"}, {0x35, "\x44\x07\xb8"}, {0x35, "\x5c\x06\x88"},
299 {0x35, "\x54\x07\xff"}, {0x34, "\xe0\x01\x52"}, {0x34, "\xe8\x00\xcc"},
300 {0x34, "\xf0\x0d\x83"}, {0x34, "\xf8\x0c\xb3"}, {0x35, "\x02\xfe\xba"},
301 {0x35, "\x0a\x04\xe0"}, {0x35, "\x12\x1c\x63"}, {0x35, "\x1a\x2b\x5a"},
302 {0x35, "\x22\x32\x5e"}, {0x35, "\x2a\x0d\x28"}, {0x35, "\x32\x2c\x02"},
303 {0x35, "\x3a\xf4\xfa"}, {0x35, "\x4e\x07\xef"}, {0x35, "\x46\x07\x88"},
304 {0x35, "\x5e\x07\xc1"}, {0x35, "\x56\x04\x64"}, {0x34, "\xe4\x01\x15"},
305 {0x34, "\xec\x00\x82"}, {0x34, "\xf4\x0c\xce"}, {0x34, "\xfc\x0c\xba"},
306 {0x35, "\x06\x1f\x02"}, {0x35, "\x0e\x02\xe3"}, {0x35, "\x16\x1a\x50"},
307 {0x35, "\x1e\x24\x39"}, {0x35, "\x26\x23\x4c"}, {0x35, "\x2e\xf9\x1b"},
308 {0x35, "\x36\x23\x19"}, {0x35, "\x3e\x12\x08"}, {0x35, "\x52\x07\x22"},
309 {0x35, "\x4a\x03\xd3"}, {0x35, "\x62\x06\x54"}, {0x35, "\x5a\x04\x5d"},
310 {0x34, "\xe2\x01\x04"}, {0x34, "\xea\x00\xa0"}, {0x34, "\xf2\x0c\xbc"},
311 {0x34, "\xfa\x0c\x5b"}, {0x35, "\x04\x17\xf2"}, {0x35, "\x0c\x02\x08"},
312 {0x35, "\x14\x28\x43"}, {0x35, "\x1c\x28\x62"}, {0x35, "\x24\x2b\x60"},
313 {0x35, "\x2c\x07\x33"}, {0x35, "\x34\x1f\xb0"}, {0x35, "\x3c\xed\xcd"},
314 {0x35, "\x50\x00\x06"}, {0x35, "\x48\x07\xff"}, {0x35, "\x60\x05\x89"},
315 {0x35, "\x58\x07\xff"}, {0x35, "\x40\x00\xa0"}, {0x35, "\x42\x00\x00"},
316 {0x32, "\x10\x01\xfc"}, {0x33, "\x8c\xa1\x18"}, {0x33, "\x90\x00\x3c"},
319 static struct idxdata tbl_init_post_alt_big3
[] = {
320 {0x33, "\x8c\xa1\x02"},
321 {0x33, "\x90\x00\x1f"},
322 {0x33, "\x8c\xa1\x02"},
323 {0x33, "\x90\x00\x1f"},
324 {0x33, "\x8c\xa1\x02"},
325 {0x33, "\x90\x00\x1f"},
326 {0x33, "\x8c\xa1\x02"},
327 {0x33, "\x90\x00\x1f"},
330 static u8
*dat_640
= "\xd0\x02\xd1\x08\xd2\xe1\xd3\x02\xd4\x10\xd5\x81";
331 static u8
*dat_800
= "\xd0\x02\xd1\x10\xd2\x57\xd3\x02\xd4\x18\xd5\x21";
332 static u8
*dat_1280
= "\xd0\x02\xd1\x20\xd2\x01\xd3\x02\xd4\x28\xd5\x01";
333 static u8
*dat_1600
= "\xd0\x02\xd1\x20\xd2\xaf\xd3\x02\xd4\x30\xd5\x41";
335 static int mi2020_init_at_startup(struct gspca_dev
*gspca_dev
);
336 static int mi2020_configure_alt(struct gspca_dev
*gspca_dev
);
337 static int mi2020_init_pre_alt(struct gspca_dev
*gspca_dev
);
338 static int mi2020_init_post_alt(struct gspca_dev
*gspca_dev
);
339 static void mi2020_post_unset_alt(struct gspca_dev
*gspca_dev
);
340 static int mi2020_camera_settings(struct gspca_dev
*gspca_dev
);
341 /*==========================================================================*/
343 void mi2020_init_settings(struct gspca_dev
*gspca_dev
)
345 struct sd
*sd
= (struct sd
*) gspca_dev
;
347 sd
->vcur
.backlight
= 0;
348 sd
->vcur
.brightness
= 70;
349 sd
->vcur
.sharpness
= 20;
350 sd
->vcur
.contrast
= 0;
353 sd
->vcur
.saturation
= 60;
354 sd
->vcur
.whitebal
= 50;
359 sd
->vmax
.backlight
= 64;
360 sd
->vmax
.brightness
= 128;
361 sd
->vmax
.sharpness
= 40;
362 sd
->vmax
.contrast
= 3;
364 sd
->vmax
.hue
= 0 + 1; /* 200 */
365 sd
->vmax
.saturation
= 0; /* 100 */
366 sd
->vmax
.whitebal
= 0; /* 100 */
371 sd
->vmax
.contrast
= 0;
373 sd
->vmax
.backlight
= 0;
376 sd
->dev_camera_settings
= mi2020_camera_settings
;
377 sd
->dev_init_at_startup
= mi2020_init_at_startup
;
378 sd
->dev_configure_alt
= mi2020_configure_alt
;
379 sd
->dev_init_pre_alt
= mi2020_init_pre_alt
;
380 sd
->dev_post_unset_alt
= mi2020_post_unset_alt
;
383 /*==========================================================================*/
385 static void common(struct gspca_dev
*gspca_dev
)
387 s32 reso
= gspca_dev
->cam
.cam_mode
[(s32
) gspca_dev
->curr_mode
].priv
;
390 fetch_validx(gspca_dev
, tbl_common1
, ARRAY_SIZE(tbl_common1
));
393 ctrl_out(gspca_dev
, 0x40, 1, 0x0008, 0x0004, 0, NULL
);
395 ctrl_out(gspca_dev
, 0x40, 1, 0x0002, 0x0004, 0, NULL
);
397 fetch_validx(gspca_dev
, tbl_common2
, ARRAY_SIZE(tbl_common2
));
399 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x01");
400 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x86\x25\x00");
402 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0030, 3, "\x1a\x0a\xcc");
403 if (reso
== IMAGE_1600
)
404 msleep(2); /* 1600 */
405 fetch_idxdata(gspca_dev
, tbl_common3
, ARRAY_SIZE(tbl_common3
));
407 if (_MI2020b_
|| _MI2020_
)
408 fetch_idxdata(gspca_dev
, tbl_common4
,
409 ARRAY_SIZE(tbl_common4
));
411 fetch_idxdata(gspca_dev
, tbl_common5
, ARRAY_SIZE(tbl_common5
));
412 if (_MI2020b_
|| _MI2020_
) {
413 /* Different from fret */
414 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x78");
416 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\x24\x17");
417 /* Different from fret */
418 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x90");
420 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x6a");
421 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\x24\x17");
422 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x80");
424 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
425 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x05");
427 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
428 if (reso
== IMAGE_1600
)
429 msleep(14); /* 1600 */
430 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x06");
434 static int mi2020_init_at_startup(struct gspca_dev
*gspca_dev
)
438 ctrl_in(gspca_dev
, 0xc0, 2, 0x0000, 0x0004, 1, &c
);
439 ctrl_in(gspca_dev
, 0xc0, 2, 0x0000, 0x0004, 1, &c
);
441 fetch_validx(gspca_dev
, tbl_init_at_startup
,
442 ARRAY_SIZE(tbl_init_at_startup
));
449 static int mi2020_init_pre_alt(struct gspca_dev
*gspca_dev
)
451 struct sd
*sd
= (struct sd
*) gspca_dev
;
455 sd
->vold
.backlight
= -1;
456 sd
->vold
.brightness
= -1;
457 sd
->vold
.sharpness
= -1;
458 sd
->vold
.contrast
= -1;
461 sd
->vold
.mirror
= -1;
463 sd
->vold
.AC50Hz
= -1;
465 mi2020_init_post_alt(gspca_dev
);
470 static int mi2020_init_post_alt(struct gspca_dev
*gspca_dev
)
472 struct sd
*sd
= (struct sd
*) gspca_dev
;
473 s32 reso
= gspca_dev
->cam
.cam_mode
[(s32
) gspca_dev
->curr_mode
].priv
;
475 s32 backlight
= sd
->vcur
.backlight
;
476 s32 mirror
= (((sd
->vcur
.mirror
> 0) ^ sd
->mirrorMask
) > 0);
477 s32 flip
= (((sd
->vcur
.flip
> 0) ^ sd
->mirrorMask
) > 0);
478 s32 freq
= (sd
->vcur
.AC50Hz
> 0);
480 u8 dat_freq2
[] = {0x90, 0x00, 0x80};
481 u8 dat_multi1
[] = {0x8c, 0xa7, 0x00};
482 u8 dat_multi2
[] = {0x90, 0x00, 0x00};
483 u8 dat_multi3
[] = {0x8c, 0xa7, 0x00};
484 u8 dat_multi4
[] = {0x90, 0x00, 0x00};
485 u8 dat_hvflip2
[] = {0x90, 0x04, 0x6c};
486 u8 dat_hvflip4
[] = {0x90, 0x00, 0x24};
491 dat_freq2
[2] = freq
? 0xc0 : 0x80;
492 dat_multi1
[2] = 0x9d;
493 dat_multi3
[2] = dat_multi1
[2] + 1;
494 dat_multi4
[2] = dat_multi2
[2] = backlight
;
495 dat_hvflip2
[2] = 0x6c + 2 * (1 - flip
) + (1 - mirror
);
496 dat_hvflip4
[2] = 0x24 + 2 * (1 - flip
) + (1 - mirror
);
500 ctrl_out(gspca_dev
, 0x40, 5, 0x0001, 0x0000, 0, NULL
);
501 msleep(3); /* 35 * */
505 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x0000, 0, NULL
);
509 ctrl_out(gspca_dev
, 0x40, 1, 0x0040, 0x0000, 0, NULL
);
511 ctrl_out(gspca_dev
, 0x40, 1, 0x0010, 0x0010, 0, NULL
);
512 ctrl_out(gspca_dev
, 0x40, 1, 0x0003, 0x00c1, 0, NULL
);
513 ctrl_out(gspca_dev
, 0x40, 1, 0x0042, 0x00c2, 0, NULL
);
514 ctrl_out(gspca_dev
, 0x40, 1, 0x006a, 0x000d, 0, NULL
);
519 if (reso
!= IMAGE_800
)
520 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200,
523 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200,
527 fetch_idxdata(gspca_dev
, tbl_init_post_alt_low1
,
528 ARRAY_SIZE(tbl_init_post_alt_low1
));
530 if (reso
== IMAGE_800
)
531 fetch_idxdata(gspca_dev
, tbl_init_post_alt_low2
,
532 ARRAY_SIZE(tbl_init_post_alt_low2
));
534 fetch_idxdata(gspca_dev
, tbl_init_post_alt_low3
,
535 ARRAY_SIZE(tbl_init_post_alt_low3
));
538 ctrl_out(gspca_dev
, 0x40, 1, 0x0001, 0x0010, 0, NULL
);
539 ctrl_out(gspca_dev
, 0x40, 1, 0x0000, 0x00c1, 0, NULL
);
540 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x00c2, 0, NULL
);
542 } else if (_MI2020c_
) {
543 ctrl_out(gspca_dev
, 0x40, 1, 0x0010, 0x0010, 0, NULL
);
544 ctrl_out(gspca_dev
, 0x40, 1, 0x0000, 0x00c1, 0, NULL
);
545 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x00c2, 0, NULL
);
547 ctrl_out(gspca_dev
, 0x40, 1, 0x0040, 0x0000, 0, NULL
);
549 } else if (_MI2020_
) {
550 ctrl_out(gspca_dev
, 0x40, 1, 0x0001, 0x0010, 0, NULL
);
551 ctrl_out(gspca_dev
, 0x40, 1, 0x0000, 0x00c1, 0, NULL
);
552 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x00c2, 0, NULL
);
554 ctrl_out(gspca_dev
, 0x40, 1, 0x0040, 0x0000, 0, NULL
);
558 /* AC power frequency */
559 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq1
);
560 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq2
);
563 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi1
);
564 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi2
);
565 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi3
);
566 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi4
);
567 /* at init time but not after */
568 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa2\x0c");
569 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x17");
570 /* finish the backlight */
571 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi5
);
572 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi6
);
576 fetch_idxdata(gspca_dev
, tbl_init_post_alt_low4
,
577 ARRAY_SIZE(tbl_init_post_alt_low4
));
579 ctrl_in(gspca_dev
, 0xc0, 2, 0x0000, 0x0000, 1, &c
);
580 msleep(14); /* 0xd8 */
583 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
585 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
587 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
589 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
591 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
593 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
596 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
599 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
602 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
605 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
608 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
611 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
613 /* end of flip/mirror main part */
614 msleep(246); /* 146 */
622 if (reso
== IMAGE_1280
) {
623 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200,
625 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
627 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
629 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
631 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
634 ctrl_out(gspca_dev
, 0x40, 3, 0x0000, 0x0200,
636 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
638 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
640 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
642 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033,
646 fetch_idxdata(gspca_dev
, tbl_init_post_alt_big1
,
647 ARRAY_SIZE(tbl_init_post_alt_big1
));
649 if (reso
== IMAGE_1600
)
650 msleep(13); /* 1600 */
651 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\x27\x97");
652 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x01\x00");
654 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x20");
655 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x00");
656 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
657 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x01");
658 if (reso
== IMAGE_1600
)
659 msleep(13); /* 1600 */
660 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa7\x02");
661 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x00");
663 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x20");
664 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x72");
665 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
666 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x02");
667 if (reso
== IMAGE_1600
)
668 msleep(13); /* 1600 */
669 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa7\x02");
670 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x01");
674 ctrl_out(gspca_dev
, 0x40, 1, 0x0001, 0x0010, 0, NULL
);
675 if (reso
== IMAGE_1600
)
676 msleep(500); /* 1600 */
677 ctrl_out(gspca_dev
, 0x40, 1, 0x0000, 0x00c1, 0, NULL
);
678 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x00c2, 0, NULL
);
680 } else if (_MI2020c_
|| _MI2020_
) {
681 ctrl_out(gspca_dev
, 0x40, 1, 0x0001, 0x0010, 0, NULL
);
682 ctrl_out(gspca_dev
, 0x40, 1, 0x0000, 0x00c1, 0, NULL
);
683 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x00c2, 0, NULL
);
685 ctrl_out(gspca_dev
, 0x40, 1, 0x0040, 0x0000, 0, NULL
);
689 /* AC power frequency */
690 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq1
);
691 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq2
);
694 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi1
);
695 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi2
);
696 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi3
);
697 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi4
);
698 /* at init time but not after */
699 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa2\x0c");
700 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x17");
701 /* finish the backlight */
702 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi5
);
703 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi6
);
706 ctrl_in(gspca_dev
, 0xc0, 2, 0x0000, 0x0000, 1, &c
);
710 fetch_idxdata(gspca_dev
, tbl_init_post_alt_big2
,
711 ARRAY_SIZE(tbl_init_post_alt_big2
));
714 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip1
);
715 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip2
);
716 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip3
);
717 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip4
);
718 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip5
);
719 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip6
);
720 /* end of flip/mirror main part */
722 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
723 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x01");
724 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x20");
725 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x00");
726 if (reso
== IMAGE_1600
)
727 msleep(25); /* 1600 */
728 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa7\x02");
729 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x00");
731 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x03");
732 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x02");
733 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa1\x20");
734 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x72");
735 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x8c\xa7\x02");
736 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, "\x90\x00\x01");
740 fetch_idxdata(gspca_dev
, tbl_init_post_alt_big3
,
741 ARRAY_SIZE(tbl_init_post_alt_big3
));
744 sd
->vold
.mirror
= mirror
;
745 sd
->vold
.flip
= flip
;
746 sd
->vold
.AC50Hz
= freq
;
747 sd
->vold
.backlight
= backlight
;
749 mi2020_camera_settings(gspca_dev
);
754 static int mi2020_configure_alt(struct gspca_dev
*gspca_dev
)
756 s32 reso
= gspca_dev
->cam
.cam_mode
[(s32
) gspca_dev
->curr_mode
].priv
;
760 gspca_dev
->alt
= 3 + 1;
766 gspca_dev
->alt
= 1 + 1;
772 static int mi2020_camera_settings(struct gspca_dev
*gspca_dev
)
774 struct sd
*sd
= (struct sd
*) gspca_dev
;
776 s32 backlight
= sd
->vcur
.backlight
;
777 s32 bright
= sd
->vcur
.brightness
;
778 s32 sharp
= sd
->vcur
.sharpness
;
779 s32 cntr
= sd
->vcur
.contrast
;
780 s32 gam
= sd
->vcur
.gamma
;
781 s32 hue
= (sd
->vcur
.hue
> 0);
782 s32 mirror
= (((sd
->vcur
.mirror
> 0) ^ sd
->mirrorMask
) > 0);
783 s32 flip
= (((sd
->vcur
.flip
> 0) ^ sd
->mirrorMask
) > 0);
784 s32 freq
= (sd
->vcur
.AC50Hz
> 0);
786 u8 dat_sharp
[] = {0x6c, 0x00, 0x08};
787 u8 dat_bright2
[] = {0x90, 0x00, 0x00};
788 u8 dat_freq2
[] = {0x90, 0x00, 0x80};
789 u8 dat_multi1
[] = {0x8c, 0xa7, 0x00};
790 u8 dat_multi2
[] = {0x90, 0x00, 0x00};
791 u8 dat_multi3
[] = {0x8c, 0xa7, 0x00};
792 u8 dat_multi4
[] = {0x90, 0x00, 0x00};
793 u8 dat_hvflip2
[] = {0x90, 0x04, 0x6c};
794 u8 dat_hvflip4
[] = {0x90, 0x00, 0x24};
796 /* Less than 4 images received -> too early to set the settings */
803 if (freq
!= sd
->vold
.AC50Hz
) {
804 sd
->vold
.AC50Hz
= freq
;
806 dat_freq2
[2] = freq
? 0xc0 : 0x80;
807 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq1
);
808 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_freq2
);
812 if (mirror
!= sd
->vold
.mirror
|| flip
!= sd
->vold
.flip
) {
813 sd
->vold
.mirror
= mirror
;
814 sd
->vold
.flip
= flip
;
816 dat_hvflip2
[2] = 0x6c + 2 * (1 - flip
) + (1 - mirror
);
817 dat_hvflip4
[2] = 0x24 + 2 * (1 - flip
) + (1 - mirror
);
818 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip1
);
819 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip2
);
820 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip3
);
821 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip4
);
822 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip5
);
823 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_hvflip6
);
825 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
827 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
829 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
831 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
833 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
835 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_dummy1
);
838 /* Sometimes present, sometimes not, useful? */
839 /* ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy2);
840 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy3);
841 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy2);
842 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy3);
843 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy2);
844 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy3);
845 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy2);
846 * ctrl_out(gspca_dev, 0x40, 3, 0x7a00, 0x0033, 3, dummy3);*/
849 if (backlight
!= sd
->vold
.backlight
) {
850 sd
->vold
.backlight
= backlight
;
851 if (backlight
< 0 || backlight
> sd
->vmax
.backlight
)
854 dat_multi1
[2] = 0x9d;
855 dat_multi3
[2] = dat_multi1
[2] + 1;
856 dat_multi4
[2] = dat_multi2
[2] = backlight
;
857 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi1
);
858 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi2
);
859 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi3
);
860 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi4
);
861 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi5
);
862 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi6
);
865 if (gam
!= sd
->vold
.gamma
) {
866 sd
->vold
.gamma
= gam
;
867 if (gam
< 0 || gam
> sd
->vmax
.gamma
)
870 dat_multi1
[2] = 0x6d;
871 dat_multi3
[2] = dat_multi1
[2] + 1;
872 dat_multi4
[2] = dat_multi2
[2] = 0x40 + gam
;
873 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi1
);
874 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi2
);
875 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi3
);
876 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi4
);
877 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi5
);
878 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi6
);
881 if (cntr
!= sd
->vold
.contrast
) {
882 sd
->vold
.contrast
= cntr
;
883 if (cntr
< 0 || cntr
> sd
->vmax
.contrast
)
886 dat_multi1
[2] = 0x6d;
887 dat_multi3
[2] = dat_multi1
[2] + 1;
888 dat_multi4
[2] = dat_multi2
[2] = 0x12 + 16 * cntr
;
889 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi1
);
890 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi2
);
891 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi3
);
892 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi4
);
893 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi5
);
894 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_multi6
);
897 if (bright
!= sd
->vold
.brightness
) {
898 sd
->vold
.brightness
= bright
;
899 if (bright
< 0 || bright
> sd
->vmax
.brightness
)
902 dat_bright2
[2] = bright
;
903 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright1
);
904 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright2
);
905 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright3
);
906 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright4
);
907 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright5
);
908 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0033, 3, dat_bright6
);
911 if (sharp
!= sd
->vold
.sharpness
) {
912 sd
->vold
.sharpness
= sharp
;
913 if (sharp
< 0 || sharp
> sd
->vmax
.sharpness
)
916 dat_sharp
[1] = sharp
;
917 ctrl_out(gspca_dev
, 0x40, 3, 0x7a00, 0x0032, 3, dat_sharp
);
920 if (hue
!= sd
->vold
.hue
) {
928 static void mi2020_post_unset_alt(struct gspca_dev
*gspca_dev
)
930 ctrl_out(gspca_dev
, 0x40, 5, 0x0000, 0x0000, 0, NULL
);
932 if (_MI2020c_
|| _MI2020_
)
933 ctrl_out(gspca_dev
, 0x40, 1, 0x0001, 0x0000, 0, NULL
);
935 ctrl_out(gspca_dev
, 0x40, 1, 0x0041, 0x0000, 0, NULL
);