diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch | 398 |
1 files changed, 398 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch new file mode 100644 index 00000000..4fa44f00 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch | |||
@@ -0,0 +1,398 @@ | |||
1 | From 5609c8fe642a0517bd151ad477fcd05d0abc7dc4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sergio Aguirre <saaguirre@ti.com> | ||
3 | Date: Fri, 11 Jun 2010 13:51:49 -0500 | ||
4 | Subject: [PATCH 02/75] mt9t111: Fix all checkpatch errors | ||
5 | |||
6 | The code was plagued with checkpatch errors. Fix them! | ||
7 | |||
8 | Signed-off-by: Sergio Aguirre <saaguirre@ti.com> | ||
9 | --- | ||
10 | drivers/media/video/mt9t111.c | 153 ++++++++++++++++++++----------------- | ||
11 | drivers/media/video/mt9t111_reg.h | 6 +- | ||
12 | include/media/mt9t111.h | 2 +- | ||
13 | 3 files changed, 87 insertions(+), 74 deletions(-) | ||
14 | |||
15 | diff --git a/drivers/media/video/mt9t111.c b/drivers/media/video/mt9t111.c | ||
16 | index ecc5115..95e1508 100644 | ||
17 | --- a/drivers/media/video/mt9t111.c | ||
18 | +++ b/drivers/media/video/mt9t111.c | ||
19 | @@ -17,20 +17,21 @@ | ||
20 | #include <media/mt9t111.h> | ||
21 | #include "mt9t111_reg.h" | ||
22 | |||
23 | -#define USE_RAW // YCbCr mode does not work yet | ||
24 | -//#define COLOR_BAR // Create a Color bar test pattern, Blue, Green, Red, Grey | ||
25 | +/* YCbCr mode does not work yet */ | ||
26 | +#define USE_RAW | ||
27 | +/* Create a Color bar test pattern, Blue, Green, Red, Grey */ | ||
28 | +/* #define COLOR_BAR */ | ||
29 | |||
30 | #define SENSOR_DETECTED 1 | ||
31 | #define SENSOR_NOT_DETECTED 0 | ||
32 | |||
33 | static void mt9t111_loaddefault(struct i2c_client *client); | ||
34 | |||
35 | -/* | ||
36 | -* as a place holder for further development | ||
37 | -*/ | ||
38 | +/* | ||
39 | + * as a place holder for further development | ||
40 | + */ | ||
41 | static void debug_dummy(char *in_msg) | ||
42 | { | ||
43 | - | ||
44 | } | ||
45 | |||
46 | /* list of image formats supported by mt9t111 sensor */ | ||
47 | @@ -55,8 +56,8 @@ const static struct v4l2_fmtdesc mt9t111_formats[] = { | ||
48 | * smallest image size to largest. | ||
49 | */ | ||
50 | const static struct capture_size mt9t111_sizes[] = { | ||
51 | - { 640, 480 }, | ||
52 | -// { 2048, 1536} | ||
53 | + { 640, 480 }, | ||
54 | + /* { 2048, 1536} */ | ||
55 | }; | ||
56 | |||
57 | #define NUM_CAPTURE_SIZE ARRAY_SIZE(mt9t111_sizes) | ||
58 | @@ -120,17 +121,17 @@ mt9t111_read_reg(struct i2c_client *client, u16 reg, u16 *val) | ||
59 | msg->addr = client->addr; | ||
60 | msg->flags = 0; | ||
61 | msg->len = 2; | ||
62 | - msg->buf = data; | ||
63 | + msg->buf = data; | ||
64 | data[0] = (reg & 0xff00) >> 8; | ||
65 | data[1] = (reg & 0x00ff); | ||
66 | err = i2c_transfer(client->adapter, msg, 1); | ||
67 | - if (err >= 0) { | ||
68 | - msg->flags = I2C_M_RD; | ||
69 | - msg->len = 2; /* 2 byte read */ | ||
70 | - err = i2c_transfer(client->adapter, msg, 1); | ||
71 | - if (err >= 0) { | ||
72 | - *val = ((data[0] & 0x00ff) << 8) | ||
73 | - | (data[1] & 0x00ff); | ||
74 | + if (err >= 0) { | ||
75 | + msg->flags = I2C_M_RD; | ||
76 | + msg->len = 2; /* 2 byte read */ | ||
77 | + err = i2c_transfer(client->adapter, msg, 1); | ||
78 | + if (err >= 0) { | ||
79 | + *val = ((data[0] & 0x00ff) << 8) | ||
80 | + | (data[1] & 0x00ff); | ||
81 | return 0; | ||
82 | } | ||
83 | } | ||
84 | @@ -159,7 +160,7 @@ mt9t111_write_reg(struct i2c_client *client, u16 reg, u16 val) | ||
85 | msg->len = 4; | ||
86 | msg->buf = data; | ||
87 | data[0] = (u8)((reg & 0xff00) >> 8); | ||
88 | - data[1] = (u8)(reg & 0x00ff); | ||
89 | + data[1] = (u8)(reg & 0x00ff); | ||
90 | data[2] = (u8)((val & 0xff00) >> 8); | ||
91 | data[3] = (u8)(val & 0x00ff); | ||
92 | err = i2c_transfer(client->adapter, msg, 1); | ||
93 | @@ -171,7 +172,7 @@ mt9t111_write_reg(struct i2c_client *client, u16 reg, u16 val) | ||
94 | * mt9t111_write_regs - Write registers to an mt9t111 sensor device | ||
95 | * @client: i2c driver client structure | ||
96 | * @reg_in: pointer to registers to write | ||
97 | - * @cnt: the number of registers | ||
98 | + * @cnt: the number of registers | ||
99 | * | ||
100 | * Write registers . | ||
101 | * Returns zero if successful, or non-zero otherwise. | ||
102 | @@ -182,19 +183,21 @@ mt9t111_write_regs(struct i2c_client *client, mt9t111_regs *reg_in, int cnt) | ||
103 | int err = 0; | ||
104 | int i; | ||
105 | mt9t111_regs *reg = reg_in; | ||
106 | - | ||
107 | - for (i=0;i<cnt;i++) { | ||
108 | + | ||
109 | + for (i = 0; i < cnt; i++) { | ||
110 | if (reg->delay_time == 0) { | ||
111 | err |= mt9t111_write_reg(client, reg->addr, reg->data); | ||
112 | } else if (reg->addr != 0 || reg->data != 0) { | ||
113 | err |= mt9t111_write_reg(client, reg->addr, reg->data); | ||
114 | mdelay(reg->delay_time); | ||
115 | - } else | ||
116 | + } else { | ||
117 | mdelay(reg->delay_time); | ||
118 | - | ||
119 | + } | ||
120 | + | ||
121 | if (err < 0) { | ||
122 | - dev_warn(&client->dev, "write reg error, addr = 0x%x, data = 0x%x \n", \ | ||
123 | - reg->addr, reg->data); | ||
124 | + dev_warn(&client->dev, "write reg error, addr = 0x%x," | ||
125 | + " data = 0x%x \n", | ||
126 | + reg->addr, reg->data); | ||
127 | return err; | ||
128 | } | ||
129 | reg++; | ||
130 | @@ -219,10 +222,11 @@ mt9t111_detect(struct i2c_client *client) | ||
131 | if (mt9t111_read_reg(client, MT9T111_CHIP_ID, &val) < 0) | ||
132 | return -ENODEV; | ||
133 | dev_info(&client->dev, "model id detected 0x%x\n", val); | ||
134 | - | ||
135 | + | ||
136 | if (val != MT9T111_CHIP_ID_VALUE) { | ||
137 | - dev_warn(&client->dev, "model id mismatch received 0x%x expecting 0x%x\n", | ||
138 | - val, MT9T111_CHIP_ID_VALUE); | ||
139 | + dev_warn(&client->dev, "model id mismatch received 0x%x" | ||
140 | + " expecting 0x%x\n", | ||
141 | + val, MT9T111_CHIP_ID_VALUE); | ||
142 | |||
143 | return -ENODEV; | ||
144 | } | ||
145 | @@ -285,14 +289,17 @@ static int ioctl_enum_frameintervals(struct v4l2_int_device *s, | ||
146 | { | ||
147 | int ifmt; | ||
148 | |||
149 | -printk(KERN_INFO "entering ioctl_enum_frameintervals\n"); | ||
150 | -printk(KERN_INFO "index = %d, pixel_format = 0x%x, width = %d, height = %d\n", | ||
151 | - frmi->index, frmi->pixel_format, frmi->width, frmi->height); | ||
152 | -printk(KERN_INFO "mt9t111 format = 0x%x\n", mt9t111_formats[0].pixelformat); | ||
153 | + printk(KERN_INFO "entering ioctl_enum_frameintervals\n"); | ||
154 | + printk(KERN_INFO "index = %d, pixel_format = 0x%x," | ||
155 | + " width = %d, height = %d\n", | ||
156 | + frmi->index, frmi->pixel_format, | ||
157 | + frmi->width, frmi->height); | ||
158 | + printk(KERN_INFO "mt9t111 format = 0x%x\n", | ||
159 | + mt9t111_formats[0].pixelformat); | ||
160 | |||
161 | if (frmi->index >= NUM_CAPTURE_FRAMEINTERVALS) | ||
162 | return -EINVAL; | ||
163 | - | ||
164 | + | ||
165 | for (ifmt = 0; ifmt < NUM_CAPTURE_FORMATS; ifmt++) { | ||
166 | if (frmi->pixel_format == mt9t111_formats[ifmt].pixelformat) | ||
167 | break; | ||
168 | @@ -368,7 +375,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) | ||
169 | if (rval < 0) { | ||
170 | dev_err(&c->dev, "Unable to set the power state: " "mt9t111" | ||
171 | " sensor\n"); | ||
172 | - //sensor->pdata->set_xclk(0); | ||
173 | + /* sensor->pdata->set_xclk(0); */ | ||
174 | return rval; | ||
175 | } | ||
176 | |||
177 | @@ -418,7 +425,7 @@ static int ioctl_g_priv(struct v4l2_int_device *s, void *p) | ||
178 | static int ioctl_s_parm(struct v4l2_int_device *s, | ||
179 | struct v4l2_streamparm *a) | ||
180 | { | ||
181 | - //TODO: set paramters | ||
182 | + /* TODO: set paramters */ | ||
183 | debug_dummy("debug_dummy -- VIDIOC_S_PARM "); | ||
184 | return 0; | ||
185 | } | ||
186 | @@ -483,13 +490,13 @@ static int ioctl_try_fmt_cap(struct v4l2_int_device *s, | ||
187 | |||
188 | pix->width = 640; | ||
189 | pix->height = 480; | ||
190 | -#ifdef USE_RAW | ||
191 | +#ifdef USE_RAW | ||
192 | pix->pixelformat = V4L2_PIX_FMT_SGRBG10; | ||
193 | - pix->bytesperline = pix->width; | ||
194 | + pix->bytesperline = pix->width; | ||
195 | pix->colorspace = V4L2_COLORSPACE_SRGB; | ||
196 | #else | ||
197 | pix->pixelformat = V4L2_PIX_FMT_YUYV; | ||
198 | - pix->bytesperline = pix->width * 2; | ||
199 | + pix->bytesperline = pix->width * 2; | ||
200 | pix->colorspace = V4L2_COLORSPACE_JPEG; | ||
201 | #endif | ||
202 | pix->field = V4L2_FIELD_NONE; | ||
203 | @@ -585,7 +592,7 @@ static int ioctl_s_ctrl(struct v4l2_int_device *s, | ||
204 | static int ioctl_g_ctrl(struct v4l2_int_device *s, | ||
205 | struct v4l2_control *vc) | ||
206 | { | ||
207 | - debug_dummy("debug_dummy -- g ctrl\n"); | ||
208 | + debug_dummy("debug_dummy -- g ctrl\n"); | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | @@ -601,8 +608,8 @@ static int ioctl_g_ctrl(struct v4l2_int_device *s, | ||
213 | static int ioctl_queryctrl(struct v4l2_int_device *s, | ||
214 | struct v4l2_queryctrl *qc) | ||
215 | { | ||
216 | - debug_dummy("debug_dummy -- query ctrl\n"); | ||
217 | - return-EINVAL; | ||
218 | + debug_dummy("debug_dummy -- query ctrl\n"); | ||
219 | + return -EINVAL; | ||
220 | } | ||
221 | |||
222 | /** | ||
223 | @@ -647,12 +654,11 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) | ||
224 | return rval; | ||
225 | } | ||
226 | |||
227 | - p->u.ycbcr.clock_curr = 40*1000000; // temporal value | ||
228 | + p->u.ycbcr.clock_curr = 40 * 1000000; /* temporal value */ | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | - | ||
234 | static struct v4l2_int_ioctl_desc mt9t111_ioctl_desc[] = { | ||
235 | { .num = vidioc_int_enum_framesizes_num, | ||
236 | .func = (v4l2_int_ioctl_func *)ioctl_enum_framesizes }, | ||
237 | @@ -666,8 +672,8 @@ static struct v4l2_int_ioctl_desc mt9t111_ioctl_desc[] = { | ||
238 | .func = (v4l2_int_ioctl_func *)ioctl_s_power }, | ||
239 | { .num = vidioc_int_g_priv_num, | ||
240 | .func = (v4l2_int_ioctl_func *)ioctl_g_priv }, | ||
241 | - {vidioc_int_g_ifparm_num, | ||
242 | - .func = (v4l2_int_ioctl_func*) ioctl_g_ifparm}, | ||
243 | + { .num = vidioc_int_g_ifparm_num, | ||
244 | + .func = (v4l2_int_ioctl_func *)ioctl_g_ifparm }, | ||
245 | { .num = vidioc_int_init_num, | ||
246 | .func = (v4l2_int_ioctl_func *)ioctl_init }, | ||
247 | { .num = vidioc_int_enum_fmt_cap_num, | ||
248 | @@ -688,29 +694,30 @@ static struct v4l2_int_ioctl_desc mt9t111_ioctl_desc[] = { | ||
249 | .func = (v4l2_int_ioctl_func *)ioctl_g_ctrl }, | ||
250 | { .num = vidioc_int_s_ctrl_num, | ||
251 | .func = (v4l2_int_ioctl_func *)ioctl_s_ctrl }, | ||
252 | - {.num = vidioc_int_s_video_routing_num, | ||
253 | - .func = (v4l2_int_ioctl_func *) ioctl_s_routing}, | ||
254 | + { .num = vidioc_int_s_video_routing_num, | ||
255 | + .func = (v4l2_int_ioctl_func *)ioctl_s_routing }, | ||
256 | }; | ||
257 | |||
258 | -static void mt9t111_refresh(struct i2c_client *client){ | ||
259 | - int i; | ||
260 | - unsigned short value; | ||
261 | - // MCU_ADDRESS [SEQ_CMD] -- refresh | ||
262 | - mt9t111_write_reg(client, 0x098E, 0x8400); | ||
263 | - mt9t111_write_reg(client, 0x0990, 0x0006); | ||
264 | - for (i=0;i<100;i++){ | ||
265 | - mt9t111_write_reg(client, 0x098E, 0x8400); | ||
266 | - mt9t111_read_reg(client,0x0990,&value); | ||
267 | - if ( value == 0) | ||
268 | - break; | ||
269 | - mdelay(5); | ||
270 | +static void mt9t111_refresh(struct i2c_client *client) | ||
271 | +{ | ||
272 | + int i; | ||
273 | + unsigned short value; | ||
274 | + /* MCU_ADDRESS [SEQ_CMD] -- refresh */ | ||
275 | + mt9t111_write_reg(client, 0x098E, 0x8400); | ||
276 | + mt9t111_write_reg(client, 0x0990, 0x0006); | ||
277 | + for (i = 0; i < 100; i++) { | ||
278 | + mt9t111_write_reg(client, 0x098E, 0x8400); | ||
279 | + mt9t111_read_reg(client, 0x0990, &value); | ||
280 | + if (value == 0) | ||
281 | + break; | ||
282 | + mdelay(5); | ||
283 | } | ||
284 | } | ||
285 | |||
286 | #ifdef COLOR_BAR | ||
287 | static void mt9t111_color_bar(struct i2c_client *client) | ||
288 | { | ||
289 | - mt9t111_write_reg(client, 0x3210, 0x01B0); // disable lens correction | ||
290 | + mt9t111_write_reg(client, 0x3210, 0x01B0); /* disable lens correction */ | ||
291 | |||
292 | mt9t111_write_reg(client, 0x098E, 0x6003); | ||
293 | mt9t111_write_reg(client, 0x0990, 0x0100); | ||
294 | @@ -721,22 +728,25 @@ static void mt9t111_color_bar(struct i2c_client *client) | ||
295 | |||
296 | static void mt9t111_bayer_format(struct i2c_client *client) | ||
297 | { | ||
298 | - mt9t111_write_regs(client, bayer_pattern_regs, sizeof(bayer_pattern_regs)/sizeof(mt9t111_regs)); | ||
299 | + mt9t111_write_regs(client, bayer_pattern_regs, | ||
300 | + sizeof(bayer_pattern_regs) / sizeof(mt9t111_regs)); | ||
301 | } | ||
302 | |||
303 | static void mt9t111_enable_pll(struct i2c_client *client) | ||
304 | { | ||
305 | int i; | ||
306 | - unsigned short value; | ||
307 | + unsigned short value; | ||
308 | |||
309 | - mt9t111_write_regs(client, pll_regs1, sizeof(pll_regs1)/sizeof(mt9t111_regs)); | ||
310 | - for (i=0;i<100;i++){ | ||
311 | - mt9t111_read_reg(client,0x0014,&value); | ||
312 | - if (( value & 0x8000) != 0) | ||
313 | + mt9t111_write_regs(client, pll_regs1, | ||
314 | + sizeof(pll_regs1) / sizeof(mt9t111_regs)); | ||
315 | + for (i = 0; i < 100; i++) { | ||
316 | + mt9t111_read_reg(client, 0x0014, &value); | ||
317 | + if ((value & 0x8000) != 0) | ||
318 | break; | ||
319 | mdelay(2); | ||
320 | } | ||
321 | - mt9t111_write_regs(client, pll_regs2, sizeof(pll_regs2)/sizeof(mt9t111_regs)); | ||
322 | + mt9t111_write_regs(client, pll_regs2, | ||
323 | + sizeof(pll_regs2) / sizeof(mt9t111_regs)); | ||
324 | } | ||
325 | |||
326 | |||
327 | @@ -746,9 +756,12 @@ static void mt9t111_loaddefault(struct i2c_client *client) | ||
328 | mt9t111_write_reg(client, 0x001A, 0x0218); | ||
329 | |||
330 | mt9t111_enable_pll(client); | ||
331 | - mt9t111_write_regs(client, def_regs1, sizeof(def_regs1)/sizeof(mt9t111_regs)); | ||
332 | - mt9t111_write_regs(client, patch_rev6, sizeof(patch_rev6)/sizeof(mt9t111_regs)); | ||
333 | - mt9t111_write_regs(client, def_regs2, sizeof(def_regs2)/sizeof(mt9t111_regs)); | ||
334 | + mt9t111_write_regs(client, def_regs1, | ||
335 | + sizeof(def_regs1) / sizeof(mt9t111_regs)); | ||
336 | + mt9t111_write_regs(client, patch_rev6, | ||
337 | + sizeof(patch_rev6) / sizeof(mt9t111_regs)); | ||
338 | + mt9t111_write_regs(client, def_regs2, | ||
339 | + sizeof(def_regs2) / sizeof(mt9t111_regs)); | ||
340 | |||
341 | #ifdef USE_RAW | ||
342 | mt9t111_bayer_format(client); | ||
343 | @@ -806,7 +819,7 @@ mt9t111_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
344 | |||
345 | sensor->pix.width = 640; | ||
346 | sensor->pix.height = 480; | ||
347 | -#ifdef USE_RAW | ||
348 | +#ifdef USE_RAW | ||
349 | sensor->pix.pixelformat = V4L2_PIX_FMT_SGRBG10; | ||
350 | #else | ||
351 | sensor->pix.pixelformat = V4L2_PIX_FMT_YUYV; | ||
352 | diff --git a/drivers/media/video/mt9t111_reg.h b/drivers/media/video/mt9t111_reg.h | ||
353 | index e012eeb..e226c37 100644 | ||
354 | --- a/drivers/media/video/mt9t111_reg.h | ||
355 | +++ b/drivers/media/video/mt9t111_reg.h | ||
356 | @@ -25,7 +25,7 @@ typedef struct { | ||
357 | u16 data; | ||
358 | } mt9t111_regs; | ||
359 | |||
360 | -mt9t111_regs patch_rev6[] ={ | ||
361 | +mt9t111_regs patch_rev6[] = { | ||
362 | {0, 0x0982, 0x0}, | ||
363 | {0, 0x098A, 0xCE7}, | ||
364 | {0, 0x0990, 0x3C3C}, | ||
365 | @@ -658,7 +658,7 @@ mt9t111_regs patch_rev6[] ={ | ||
366 | {100, 0x0990, 0x0004} | ||
367 | }; | ||
368 | |||
369 | -mt9t111_regs def_regs1[] ={ | ||
370 | +mt9t111_regs def_regs1[] = { | ||
371 | {0, 0x001A, 0x0218}, | ||
372 | {0, 0x001E, 0x0777}, | ||
373 | {0, 0x3084, 0x2409}, | ||
374 | @@ -1343,7 +1343,7 @@ mt9t111_regs pll_regs2[] = { | ||
375 | {0, 0x0014, 0x3046}, | ||
376 | {0, 0x0022, 0x01E0}, | ||
377 | {0, 0x001E, 0x0707}, | ||
378 | - {0, 0x3B84, 0x011D} | ||
379 | + {0, 0x3B84, 0x011D} | ||
380 | }; | ||
381 | |||
382 | mt9t111_regs bayer_pattern_regs[] = { | ||
383 | diff --git a/include/media/mt9t111.h b/include/media/mt9t111.h | ||
384 | index 7acbeed..0a5161a 100644 | ||
385 | --- a/include/media/mt9t111.h | ||
386 | +++ b/include/media/mt9t111.h | ||
387 | @@ -40,7 +40,7 @@ | ||
388 | #define MT9T111_I2C_UNREGISTERED (0) | ||
389 | |||
390 | /*i2c adress for MT9T111*/ | ||
391 | -#define MT9T111_I2C_ADDR (0x78 >>1) | ||
392 | +#define MT9T111_I2C_ADDR (0x78 >> 1) | ||
393 | |||
394 | #define MT9T111_CLK_MAX (75000000) /* 75MHz */ | ||
395 | #define MT9T111_CLK_MIN (6000000) /* 6Mhz */ | ||
396 | -- | ||
397 | 1.6.6.1 | ||
398 | |||