aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo
diff options
context:
space:
mode:
authorJaswinder Singh <jaswinder@infradead.org>2008-06-27 10:20:40 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-07-14 17:44:32 -0400
commitfb54be8755d386008bfadb7fc8ff89451fa3a9c9 (patch)
tree130eb5a6b60a3dd2c94362785a44dedfae1a2fab /drivers/media/video/usbvideo
parentc466774636b3cc43c2c304b44e52974d9d53f3e0 (diff)
vicam: use request_firmware()
Although it wasn't actually using ihex records before, we use the Intel HEX record format for this firmware -- because that gives us a simple way to split it into separate chunks internally as we need, without loading each part as a separate file. Signed-off-by: Jaswinder Singh <jaswinder@infradead.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r--drivers/media/video/usbvideo/vicam.c317
1 files changed, 21 insertions, 296 deletions
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 17f542dfb366..40d053e0d5bf 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -43,6 +43,8 @@
43#include <linux/vmalloc.h> 43#include <linux/vmalloc.h>
44#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/firmware.h>
47#include <linux/ihex.h>
46#include "usbvideo.h" 48#include "usbvideo.h"
47 49
48// #define VICAM_DEBUG 50// #define VICAM_DEBUG
@@ -70,284 +72,6 @@
70 72
71#define VICAM_HEADER_SIZE 64 73#define VICAM_HEADER_SIZE 64
72 74
73/* Not sure what all the bytes in these char
74 * arrays do, but they're necessary to make
75 * the camera work.
76 */
77
78static unsigned char setup1[] = {
79 0xB6, 0xC3, 0x1F, 0x00, 0x02, 0x64, 0xE7, 0x67,
80 0xFD, 0xFF, 0x0E, 0xC0, 0xE7, 0x09, 0xDE, 0x00,
81 0x8E, 0x00, 0xC0, 0x09, 0x40, 0x03, 0xC0, 0x17,
82 0x44, 0x03, 0x4B, 0xAF, 0xC0, 0x07, 0x00, 0x00,
83 0x4B, 0xAF, 0x97, 0xCF, 0x00, 0x00
84};
85
86static unsigned char setup2[] = {
87 0xB6, 0xC3, 0x03, 0x00, 0x03, 0x64, 0x18, 0x00,
88 0x00, 0x00
89};
90
91static unsigned char setup3[] = {
92 0xB6, 0xC3, 0x01, 0x00, 0x06, 0x64, 0x00, 0x00
93};
94
95static unsigned char setup4[] = {
96 0xB6, 0xC3, 0x8F, 0x06, 0x02, 0x64, 0xE7, 0x07,
97 0x00, 0x00, 0x08, 0xC0, 0xE7, 0x07, 0x00, 0x00,
98 0x3E, 0xC0, 0xE7, 0x07, 0x54, 0x01, 0xAA, 0x00,
99 0xE7, 0x07, 0xC8, 0x05, 0xB6, 0x00, 0xE7, 0x07,
100 0x42, 0x01, 0xD2, 0x00, 0xE7, 0x07, 0x7C, 0x00,
101 0x16, 0x00, 0xE7, 0x07, 0x56, 0x00, 0x18, 0x00,
102 0xE7, 0x07, 0x06, 0x00, 0x92, 0xC0, 0xE7, 0x07,
103 0x00, 0x00, 0x1E, 0xC0, 0xE7, 0x07, 0xFF, 0xFF,
104 0x22, 0xC0, 0xE7, 0x07, 0x04, 0x00, 0x24, 0xC0,
105 0xE7, 0x07, 0xEC, 0x27, 0x28, 0xC0, 0xE7, 0x07,
106 0x16, 0x01, 0x8E, 0x00, 0xE7, 0x87, 0x01, 0x00,
107 0x0E, 0xC0, 0x97, 0xCF, 0xD7, 0x09, 0x00, 0xC0,
108 0xE7, 0x77, 0x01, 0x00, 0x92, 0xC0, 0x09, 0xC1,
109 0xE7, 0x09, 0xFE, 0x05, 0x24, 0x01, 0xE7, 0x09,
110 0x04, 0x06, 0x26, 0x01, 0xE7, 0x07, 0x07, 0x00,
111 0x92, 0xC0, 0xE7, 0x05, 0x00, 0xC0, 0xC0, 0xDF,
112 0x97, 0xCF, 0x17, 0x00, 0x57, 0x00, 0x17, 0x02,
113 0xD7, 0x09, 0x00, 0xC0, 0xE7, 0x77, 0x01, 0x00,
114 0x92, 0xC0, 0x0A, 0xC1, 0xE7, 0x57, 0xFF, 0xFF,
115 0xFA, 0x05, 0x0D, 0xC0, 0xE7, 0x57, 0x00, 0x00,
116 0xFA, 0x05, 0x0F, 0xC0, 0x9F, 0xAF, 0xC6, 0x00,
117 0xE7, 0x05, 0x00, 0xC0, 0xC8, 0x05, 0xC1, 0x05,
118 0xC0, 0x05, 0xC0, 0xDF, 0x97, 0xCF, 0x27, 0xDA,
119 0xFA, 0x05, 0xEF, 0x07, 0x01, 0x00, 0x0B, 0x06,
120 0x73, 0xCF, 0x9F, 0xAF, 0x78, 0x01, 0x9F, 0xAF,
121 0x1A, 0x03, 0x6E, 0xCF, 0xE7, 0x09, 0xFC, 0x05,
122 0x24, 0x01, 0xE7, 0x09, 0x02, 0x06, 0x26, 0x01,
123 0xE7, 0x07, 0x07, 0x00, 0x92, 0xC0, 0xE7, 0x09,
124 0xFC, 0x05, 0xFE, 0x05, 0xE7, 0x09, 0x02, 0x06,
125 0x04, 0x06, 0xE7, 0x09, 0x00, 0x06, 0xFC, 0x05,
126 0xE7, 0x09, 0xFE, 0x05, 0x00, 0x06, 0x27, 0xDA,
127 0xFA, 0x05, 0xE7, 0x57, 0x01, 0x00, 0xFA, 0x05,
128 0x02, 0xCA, 0x04, 0xC0, 0x97, 0xCF, 0x9F, 0xAF,
129 0x66, 0x05, 0x97, 0xCF, 0xE7, 0x07, 0x40, 0x00,
130 0x02, 0x06, 0xC8, 0x09, 0xFC, 0x05, 0x9F, 0xAF,
131 0xDA, 0x02, 0x97, 0xCF, 0xCF, 0x17, 0x02, 0x00,
132 0xEF, 0x57, 0x81, 0x00, 0x09, 0x06, 0x9F, 0xA0,
133 0xB6, 0x01, 0xEF, 0x57, 0x80, 0x00, 0x09, 0x06,
134 0x9F, 0xA0, 0x40, 0x02, 0xEF, 0x57, 0x01, 0x00,
135 0x0B, 0x06, 0x9F, 0xA0, 0x46, 0x03, 0xE7, 0x07,
136 0x01, 0x00, 0x0A, 0xC0, 0x46, 0xAF, 0x47, 0xAF,
137 0x9F, 0xAF, 0x40, 0x02, 0xE7, 0x07, 0x2E, 0x00,
138 0x0A, 0xC0, 0xEF, 0x87, 0x80, 0x00, 0x09, 0x06,
139 0x97, 0xCF, 0x00, 0x0E, 0x01, 0x00, 0xC0, 0x57,
140 0x51, 0x00, 0x9F, 0xC0, 0x9E, 0x02, 0xC0, 0x57,
141 0x50, 0x00, 0x20, 0xC0, 0xC0, 0x57, 0x55, 0x00,
142 0x12, 0xC0, 0xC0, 0x57, 0x56, 0x00, 0x9F, 0xC0,
143 0x72, 0x02, 0x9F, 0xCF, 0xD6, 0x02, 0xC1, 0x0B,
144 0x08, 0x06, 0x01, 0xD0, 0x6F, 0x90, 0x08, 0x06,
145 0xC0, 0x07, 0x08, 0x00, 0xC1, 0x0B, 0x08, 0x06,
146 0x9F, 0xAF, 0x28, 0x05, 0x97, 0xCF, 0x2F, 0x0E,
147 0x02, 0x00, 0x08, 0x06, 0xC0, 0x07, 0x08, 0x00,
148 0xC1, 0x0B, 0x08, 0x06, 0x9F, 0xAF, 0x28, 0x05,
149 0x9F, 0xCF, 0xD6, 0x02, 0x2F, 0x0E, 0x02, 0x00,
150 0x09, 0x06, 0xEF, 0x87, 0x80, 0x00, 0x09, 0x06,
151 0x9F, 0xCF, 0xD6, 0x02, 0xEF, 0x67, 0x7F, 0xFF,
152 0x09, 0x06, 0xE7, 0x67, 0xFF, 0xFD, 0x22, 0xC0,
153 0xE7, 0x67, 0xEF, 0xFF, 0x24, 0xC0, 0xE7, 0x87,
154 0x10, 0x00, 0x28, 0xC0, 0x9F, 0xAF, 0xB8, 0x05,
155 0xE7, 0x87, 0xE0, 0x21, 0x24, 0xC0, 0x9F, 0xAF,
156 0xA8, 0x05, 0xE7, 0x87, 0x08, 0x00, 0x24, 0xC0,
157 0xE7, 0x67, 0xDF, 0xFF, 0x24, 0xC0, 0xC8, 0x07,
158 0x0A, 0x00, 0xC0, 0x07, 0x00, 0x00, 0xC1, 0x07,
159 0x01, 0x00, 0x9F, 0xAF, 0x28, 0x05, 0x9F, 0xAF,
160 0xB8, 0x05, 0xC0, 0x07, 0x9E, 0x00, 0x9F, 0xAF,
161 0x44, 0x05, 0xE7, 0x67, 0xFF, 0xFE, 0x24, 0xC0,
162 0xC0, 0x09, 0x20, 0xC0, 0xE7, 0x87, 0x00, 0x01,
163 0x24, 0xC0, 0xC0, 0x77, 0x00, 0x02, 0x0F, 0xC1,
164 0xE7, 0x67, 0xF7, 0xFF, 0x24, 0xC0, 0xE7, 0x67,
165 0xF7, 0xFF, 0x24, 0xC0, 0xE7, 0x87, 0x08, 0x00,
166 0x24, 0xC0, 0x08, 0xDA, 0x5E, 0xC1, 0xEF, 0x07,
167 0x80, 0x00, 0x09, 0x06, 0x97, 0xCF, 0xEF, 0x07,
168 0x01, 0x00, 0x0A, 0x06, 0x97, 0xCF, 0xEF, 0x07,
169 0x00, 0x00, 0x0B, 0x06, 0xEF, 0x07, 0x00, 0x00,
170 0x0A, 0x06, 0xEF, 0x67, 0x7F, 0xFF, 0x09, 0x06,
171 0xEF, 0x07, 0x00, 0x00, 0x0D, 0x06, 0xE7, 0x67,
172 0xEF, 0xFF, 0x28, 0xC0, 0xE7, 0x67, 0x17, 0xD8,
173 0x24, 0xC0, 0xE7, 0x07, 0x00, 0x00, 0x1E, 0xC0,
174 0xE7, 0x07, 0xFF, 0xFF, 0x22, 0xC0, 0x97, 0xCF,
175 0xC8, 0x07, 0x0E, 0x06, 0x9F, 0xAF, 0xDA, 0x02,
176 0xE7, 0x07, 0x00, 0x00, 0xF2, 0x05, 0xE7, 0x07,
177 0x10, 0x00, 0xF6, 0x05, 0xE7, 0x07, 0x0E, 0x06,
178 0xF4, 0x05, 0xE7, 0x07, 0xD6, 0x02, 0xF8, 0x05,
179 0xC8, 0x07, 0xF2, 0x05, 0xC1, 0x07, 0x00, 0x80,
180 0x50, 0xAF, 0x97, 0xCF, 0x2F, 0x0C, 0x02, 0x00,
181 0x07, 0x06, 0x2F, 0x0C, 0x04, 0x00, 0x06, 0x06,
182 0xE7, 0x07, 0x00, 0x00, 0xF2, 0x05, 0xE7, 0x07,
183 0x10, 0x00, 0xF6, 0x05, 0xE7, 0x07, 0xE2, 0x05,
184 0xF4, 0x05, 0xE7, 0x07, 0xCE, 0x02, 0xF8, 0x05,
185 0xC8, 0x07, 0xF2, 0x05, 0xC1, 0x07, 0x00, 0x80,
186 0x51, 0xAF, 0x97, 0xCF, 0x9F, 0xAF, 0x66, 0x04,
187 0x9F, 0xAF, 0x1A, 0x03, 0x59, 0xAF, 0x97, 0xCF,
188 0xC0, 0x07, 0x0E, 0x00, 0xC1, 0x0B, 0x0C, 0x06,
189 0x41, 0xD1, 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07,
190 0x3C, 0x00, 0x9F, 0xAF, 0x44, 0x05, 0x68, 0x00,
191 0xC0, 0x07, 0x3B, 0x00, 0x9F, 0xAF, 0x44, 0x05,
192 0x6F, 0x00, 0x0C, 0x06, 0x68, 0x00, 0xE0, 0x07,
193 0x04, 0x01, 0xE8, 0x0B, 0x0A, 0x06, 0xE8, 0x07,
194 0x00, 0x00, 0xE0, 0x07, 0x00, 0x02, 0xE0, 0x07,
195 0xEC, 0x01, 0xE0, 0x07, 0xFC, 0xFF, 0x97, 0xCF,
196 0xE7, 0x07, 0xFF, 0xFF, 0xFA, 0x05, 0xEF, 0x07,
197 0x00, 0x00, 0x0B, 0x06, 0xE7, 0x07, 0x0E, 0x06,
198 0x24, 0x01, 0xE7, 0x07, 0x0E, 0x06, 0xFE, 0x05,
199 0xE7, 0x07, 0x40, 0x00, 0x26, 0x01, 0xE7, 0x07,
200 0x40, 0x00, 0x04, 0x06, 0xE7, 0x07, 0x07, 0x00,
201 0x92, 0xC0, 0x97, 0xCF, 0xEF, 0x07, 0x02, 0x00,
202 0x0B, 0x06, 0x9F, 0xAF, 0x78, 0x01, 0xEF, 0x77,
203 0x80, 0x00, 0x07, 0x06, 0x9F, 0xC0, 0x14, 0x04,
204 0xEF, 0x77, 0x01, 0x00, 0x07, 0x06, 0x37, 0xC0,
205 0xEF, 0x77, 0x01, 0x00, 0x0D, 0x06, 0x0F, 0xC1,
206 0xEF, 0x07, 0x01, 0x00, 0x0D, 0x06, 0xC0, 0x07,
207 0x02, 0x00, 0xC1, 0x07, 0x30, 0x00, 0x9F, 0xAF,
208 0x28, 0x05, 0xC0, 0x07, 0x01, 0x00, 0xC1, 0x07,
209 0x02, 0x00, 0x9F, 0xAF, 0x28, 0x05, 0xC8, 0x07,
210 0xFF, 0x4F, 0x9F, 0xAF, 0xA8, 0x05, 0xC0, 0x07,
211 0x38, 0x00, 0x9F, 0xAF, 0x44, 0x05, 0xC1, 0x77,
212 0x03, 0x00, 0x02, 0xC1, 0x08, 0xDA, 0x75, 0xC1,
213 0xC1, 0x77, 0x01, 0x00, 0x0A, 0xC1, 0xC0, 0x07,
214 0x01, 0x00, 0xC1, 0x07, 0x02, 0x00, 0x9F, 0xAF,
215 0x28, 0x05, 0xEF, 0x07, 0x01, 0x00, 0x06, 0x06,
216 0x2C, 0xCF, 0xC0, 0x07, 0x01, 0x00, 0xC1, 0x07,
217 0x04, 0x00, 0x9F, 0xAF, 0x28, 0x05, 0xEF, 0x07,
218 0x00, 0x00, 0x06, 0x06, 0x22, 0xCF, 0xEF, 0x07,
219 0x00, 0x00, 0x0D, 0x06, 0xEF, 0x57, 0x01, 0x00,
220 0x06, 0x06, 0x1B, 0xC0, 0xC0, 0x07, 0x01, 0x00,
221 0xC1, 0x07, 0x01, 0x00, 0x9F, 0xAF, 0x28, 0x05,
222 0xC0, 0x07, 0x02, 0x00, 0xC1, 0x07, 0x30, 0x00,
223 0x9F, 0xAF, 0x28, 0x05, 0xC8, 0x07, 0xFF, 0x4F,
224 0x9F, 0xAF, 0xA8, 0x05, 0xC0, 0x07, 0x38, 0x00,
225 0x9F, 0xAF, 0x44, 0x05, 0xC1, 0x67, 0x03, 0x00,
226 0xC1, 0x57, 0x03, 0x00, 0x02, 0xC0, 0x08, 0xDA,
227 0x73, 0xC1, 0xC0, 0x07, 0x02, 0x00, 0xC1, 0x07,
228 0x12, 0x00, 0xEF, 0x57, 0x00, 0x00, 0x06, 0x06,
229 0x02, 0xC0, 0xC1, 0x07, 0x23, 0x00, 0x9F, 0xAF,
230 0x28, 0x05, 0xC0, 0x07, 0x14, 0x00, 0xC1, 0x0B,
231 0xEA, 0x05, 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07,
232 0x3E, 0x00, 0x9F, 0xAF, 0x0A, 0x05, 0xE7, 0x09,
233 0xE4, 0x05, 0xFA, 0x05, 0x27, 0xD8, 0xFA, 0x05,
234 0xE7, 0x07, 0x0E, 0x06, 0xFC, 0x05, 0xE7, 0x07,
235 0x4E, 0x06, 0x00, 0x06, 0xE7, 0x07, 0x40, 0x00,
236 0x02, 0x06, 0x9F, 0xAF, 0x66, 0x05, 0x9F, 0xAF,
237 0xC6, 0x00, 0x97, 0xCF, 0xC1, 0x0B, 0xE2, 0x05,
238 0x41, 0xD0, 0x01, 0xD2, 0xC1, 0x17, 0x23, 0x00,
239 0x9F, 0xAF, 0xDC, 0x04, 0xC0, 0x07, 0x04, 0x00,
240 0xC1, 0x0B, 0xE3, 0x05, 0x9F, 0xAF, 0x28, 0x05,
241 0xC0, 0x07, 0x06, 0x00, 0xC1, 0x09, 0xE6, 0x05,
242 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07, 0x07, 0x00,
243 0xC1, 0x09, 0xE6, 0x05, 0xC1, 0xD1, 0x9F, 0xAF,
244 0x28, 0x05, 0xC0, 0x07, 0x0B, 0x00, 0xC1, 0x09,
245 0xE8, 0x05, 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07,
246 0x0C, 0x00, 0xC1, 0x09, 0xE8, 0x05, 0xC1, 0xD1,
247 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07, 0x0D, 0x00,
248 0xC1, 0x07, 0x09, 0x00, 0x9F, 0xAF, 0x28, 0x05,
249 0xC0, 0x07, 0x03, 0x00, 0xC1, 0x07, 0x32, 0x00,
250 0x9F, 0xAF, 0x28, 0x05, 0xC0, 0x07, 0x0F, 0x00,
251 0xC1, 0x07, 0x00, 0x00, 0x9F, 0xAF, 0x28, 0x05,
252 0x97, 0xCF, 0xE7, 0x67, 0xFF, 0xD9, 0x24, 0xC0,
253 0xC8, 0x07, 0x0A, 0x00, 0x40, 0x00, 0xC0, 0x67,
254 0x00, 0x02, 0x27, 0x80, 0x24, 0xC0, 0xE7, 0x87,
255 0x00, 0x04, 0x24, 0xC0, 0xE7, 0x67, 0xFF, 0xF9,
256 0x24, 0xC0, 0x01, 0xD2, 0x08, 0xDA, 0x72, 0xC1,
257 0xE7, 0x87, 0x00, 0x20, 0x24, 0xC0, 0x97, 0xCF,
258 0x27, 0x00, 0x1E, 0xC0, 0xE7, 0x87, 0xFF, 0x00,
259 0x22, 0xC0, 0xE7, 0x67, 0x7F, 0xFF, 0x24, 0xC0,
260 0xE7, 0x87, 0x80, 0x00, 0x24, 0xC0, 0xE7, 0x87,
261 0x80, 0x00, 0x24, 0xC0, 0x97, 0xCF, 0x9F, 0xAF,
262 0x0A, 0x05, 0x67, 0x00, 0x1E, 0xC0, 0xE7, 0x67,
263 0xBF, 0xFF, 0x24, 0xC0, 0xE7, 0x87, 0x40, 0x00,
264 0x24, 0xC0, 0xE7, 0x87, 0x40, 0x00, 0x24, 0xC0,
265 0x97, 0xCF, 0x9F, 0xAF, 0x0A, 0x05, 0xE7, 0x67,
266 0x00, 0xFF, 0x22, 0xC0, 0xE7, 0x67, 0xFF, 0xFE,
267 0x24, 0xC0, 0xE7, 0x67, 0xFF, 0xFE, 0x24, 0xC0,
268 0xC1, 0x09, 0x20, 0xC0, 0xE7, 0x87, 0x00, 0x01,
269 0x24, 0xC0, 0x97, 0xCF, 0xC0, 0x07, 0x40, 0x00,
270 0xC8, 0x09, 0xFC, 0x05, 0xE7, 0x67, 0x00, 0xFF,
271 0x22, 0xC0, 0xE7, 0x67, 0xFF, 0xFE, 0x24, 0xC0,
272 0xE7, 0x67, 0xBF, 0xFF, 0x24, 0xC0, 0xE7, 0x67,
273 0xBF, 0xFF, 0x24, 0xC0, 0x00, 0xDA, 0xE8, 0x09,
274 0x20, 0xC0, 0xE7, 0x87, 0x40, 0x00, 0x24, 0xC0,
275 0xE7, 0x87, 0x40, 0x00, 0x24, 0xC0, 0x00, 0xDA,
276 0xE8, 0x09, 0x20, 0xC0, 0x6D, 0xC1, 0xE7, 0x87,
277 0x00, 0x01, 0x24, 0xC0, 0x97, 0xCF, 0xE7, 0x07,
278 0x32, 0x00, 0x12, 0xC0, 0xE7, 0x77, 0x00, 0x80,
279 0x12, 0xC0, 0x7C, 0xC0, 0x97, 0xCF, 0xE7, 0x07,
280 0x20, 0x4E, 0x12, 0xC0, 0xE7, 0x77, 0x00, 0x80,
281 0x12, 0xC0, 0x7C, 0xC0, 0x97, 0xCF, 0x09, 0x02,
282 0x19, 0x00, 0x01, 0x01, 0x00, 0x80, 0x96, 0x09,
283 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
284 0x07, 0x05, 0x81, 0x02, 0x40, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
295 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307};
308
309static unsigned char setup5[] = {
310 0xB6, 0xC3, 0x2F, 0x01, 0x03, 0x64, 0x0E, 0x00,
311 0x14, 0x00, 0x1A, 0x00, 0x20, 0x00, 0x26, 0x00,
312 0x4A, 0x00, 0x64, 0x00, 0x6A, 0x00, 0x92, 0x00,
313 0x9A, 0x00, 0xA0, 0x00, 0xB2, 0x00, 0xB8, 0x00,
314 0xBE, 0x00, 0xC2, 0x00, 0xC8, 0x00, 0xCE, 0x00,
315 0xDC, 0x00, 0xDA, 0x00, 0xE2, 0x00, 0xE0, 0x00,
316 0xE8, 0x00, 0xE6, 0x00, 0xEE, 0x00, 0xEC, 0x00,
317 0xF2, 0x00, 0xF8, 0x00, 0x02, 0x01, 0x0A, 0x01,
318 0x0E, 0x01, 0x12, 0x01, 0x1E, 0x01, 0x22, 0x01,
319 0x28, 0x01, 0x2C, 0x01, 0x32, 0x01, 0x36, 0x01,
320 0x44, 0x01, 0x50, 0x01, 0x5E, 0x01, 0x72, 0x01,
321 0x76, 0x01, 0x7A, 0x01, 0x80, 0x01, 0x88, 0x01,
322 0x8C, 0x01, 0x94, 0x01, 0x9C, 0x01, 0xA0, 0x01,
323 0xA4, 0x01, 0xAA, 0x01, 0xB0, 0x01, 0xB4, 0x01,
324 0xBA, 0x01, 0xD0, 0x01, 0xDA, 0x01, 0xF6, 0x01,
325 0xFA, 0x01, 0x02, 0x02, 0x34, 0x02, 0x3C, 0x02,
326 0x44, 0x02, 0x4A, 0x02, 0x50, 0x02, 0x56, 0x02,
327 0x74, 0x02, 0x78, 0x02, 0x7E, 0x02, 0x84, 0x02,
328 0x8A, 0x02, 0x88, 0x02, 0x90, 0x02, 0x8E, 0x02,
329 0x94, 0x02, 0xA2, 0x02, 0xA8, 0x02, 0xAE, 0x02,
330 0xB4, 0x02, 0xBA, 0x02, 0xB8, 0x02, 0xC0, 0x02,
331 0xBE, 0x02, 0xC4, 0x02, 0xD0, 0x02, 0xD4, 0x02,
332 0xE0, 0x02, 0xE6, 0x02, 0xEE, 0x02, 0xF8, 0x02,
333 0xFC, 0x02, 0x06, 0x03, 0x1E, 0x03, 0x24, 0x03,
334 0x28, 0x03, 0x30, 0x03, 0x2E, 0x03, 0x3C, 0x03,
335 0x4A, 0x03, 0x4E, 0x03, 0x54, 0x03, 0x58, 0x03,
336 0x5E, 0x03, 0x66, 0x03, 0x6E, 0x03, 0x7A, 0x03,
337 0x86, 0x03, 0x8E, 0x03, 0x96, 0x03, 0xB2, 0x03,
338 0xB8, 0x03, 0xC6, 0x03, 0xCC, 0x03, 0xD4, 0x03,
339 0xDA, 0x03, 0xE8, 0x03, 0xF4, 0x03, 0xFC, 0x03,
340 0x04, 0x04, 0x20, 0x04, 0x2A, 0x04, 0x32, 0x04,
341 0x36, 0x04, 0x3E, 0x04, 0x44, 0x04, 0x42, 0x04,
342 0x48, 0x04, 0x4E, 0x04, 0x4C, 0x04, 0x54, 0x04,
343 0x52, 0x04, 0x5A, 0x04, 0x5E, 0x04, 0x62, 0x04,
344 0x68, 0x04, 0x74, 0x04, 0x7C, 0x04, 0x80, 0x04,
345 0x88, 0x04, 0x8C, 0x04, 0x94, 0x04, 0x9A, 0x04,
346 0xA2, 0x04, 0xA6, 0x04, 0xAE, 0x04, 0xB4, 0x04,
347 0xC0, 0x04, 0xCC, 0x04, 0xD8, 0x04, 0x2A, 0x05,
348 0x46, 0x05, 0x6C, 0x05, 0x00, 0x00
349};
350
351/* rvmalloc / rvfree copied from usbvideo.c 75/* rvmalloc / rvfree copied from usbvideo.c
352 * 76 *
353 * Not sure why these are not yet non-statics which I can reference through 77 * Not sure why these are not yet non-statics which I can reference through
@@ -464,28 +188,28 @@ static int send_control_msg(struct vicam_camera *cam,
464static int 188static int
465initialize_camera(struct vicam_camera *cam) 189initialize_camera(struct vicam_camera *cam)
466{ 190{
467 const struct { 191 int err;
468 u8 *data; 192 const struct ihex_binrec *rec;
469 u32 size; 193 const struct firmware *fw;
470 } firmware[] = { 194
471 { .data = setup1, .size = sizeof(setup1) }, 195 err = request_ihex_firmware(&fw, "vicam/firmware.fw", &cam->udev->dev);
472 { .data = setup2, .size = sizeof(setup2) }, 196 if (err) {
473 { .data = setup3, .size = sizeof(setup3) }, 197 printk(KERN_ERR "Failed to load \"vicam/firmware.fw\": %d\n",
474 { .data = setup4, .size = sizeof(setup4) }, 198 err);
475 { .data = setup5, .size = sizeof(setup5) }, 199 return err;
476 { .data = setup3, .size = sizeof(setup3) }, 200 }
477 { .data = NULL, .size = 0 } 201
478 }; 202 for (rec = (void *)fw->data; rec; rec = ihex_next_binrec(rec)) {
479 203 memcpy(cam->cntrlbuf, rec->data, be16_to_cpu(rec->len));
480 int err, i;
481
482 for (i = 0, err = 0; firmware[i].data && !err; i++) {
483 memcpy(cam->cntrlbuf, firmware[i].data, firmware[i].size);
484 204
485 err = send_control_msg(cam, 0xff, 0, 0, 205 err = send_control_msg(cam, 0xff, 0, 0,
486 cam->cntrlbuf, firmware[i].size); 206 cam->cntrlbuf, be16_to_cpu(rec->len));
207 if (err)
208 break;
487 } 209 }
488 210
211 release_firmware(fw);
212
489 return err; 213 return err;
490} 214}
491 215
@@ -1226,3 +950,4 @@ module_exit(usb_vicam_exit);
1226MODULE_AUTHOR(DRIVER_AUTHOR); 950MODULE_AUTHOR(DRIVER_AUTHOR);
1227MODULE_DESCRIPTION(DRIVER_DESC); 951MODULE_DESCRIPTION(DRIVER_DESC);
1228MODULE_LICENSE("GPL"); 952MODULE_LICENSE("GPL");
953MODULE_FIRMWARE("vicam/firmware.fw");