aboutsummaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0040-mt9v113-Clean-Up-Remove-unneccessary-code-printf.patch
blob: 801216072473032ae155cb392f540084a1d1243a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
From 9c9215eade28a09ac12888e9a02af107955009c5 Mon Sep 17 00:00:00 2001
From: Vaibhav Hiremath <hvaibhav@ti.com>
Date: Tue, 13 Jul 2010 19:39:34 +0530
Subject: [PATCH 40/75] mt9v113:Clean Up: Remove unneccessary code/printf

Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
 drivers/media/video/mt9v113.c |  105 ++++++++++++++++------------------------
 1 files changed, 42 insertions(+), 63 deletions(-)

diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c
index 8f8ba35..9a86cce 100644
--- a/drivers/media/video/mt9v113.c
+++ b/drivers/media/video/mt9v113.c
@@ -22,10 +22,10 @@
 #include <linux/i2c.h>
 #include <linux/delay.h>
 #include <linux/videodev2.h>
+#include <linux/io.h>
+
 #include <media/v4l2-int-device.h>
 #include <media/mt9v113.h>
-#include <mach/hardware.h>
-#include <linux/io.h>
 
 #include "mt9v113_regs.h"
 
@@ -34,21 +34,13 @@
 
 /* Private macros for TVP */
 #define I2C_RETRY_COUNT                 (5)
-#define LOCK_RETRY_COUNT                (5)
-#define LOCK_RETRY_DELAY                (200)
 
 /* Debug functions */
 static int debug = 1;
 module_param(debug, bool, 0644);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
-#define dump_reg(client, reg, val)				\
-	do {							\
-		val = mt9v113_read_reg(client, reg);		\
-		v4l_info(client, "Reg(0x%.2X): 0x%.2X\n", reg, val); \
-	} while (0)
-
-/**
+/*
  * enum mt9v113_std - enum for supported standards
  */
 enum mt9v113_std {
@@ -57,7 +49,7 @@ enum mt9v113_std {
 	MT9V113_STD_INVALID
 };
 
-/**
+/*
  * enum mt9v113_state - enum for different decoder states
  */
 enum mt9v113_state {
@@ -65,7 +57,7 @@ enum mt9v113_state {
 	STATE_DETECTED
 };
 
-/**
+/*
  * struct mt9v113_std_info - Structure to store standard informations
  * @width: Line width in pixels
  * @height:Number of active lines
@@ -79,7 +71,7 @@ struct mt9v113_std_info {
 	struct v4l2_standard standard;
 };
 
-/**
+/*
  * struct mt9v113_decoded - decoder object
  * @v4l2_int_device: Slave handle
  * @pdata: Board specific
@@ -93,7 +85,6 @@ struct mt9v113_std_info {
  * @current_std: Current standard
  * @num_stds: Number of standards
  * @std_list: Standards list
- * @route: input and output routing at chip level
  */
 struct mt9v113_decoder {
 	struct v4l2_int_device *v4l2_int_device;
@@ -112,8 +103,6 @@ struct mt9v113_decoder {
 	enum mt9v113_std current_std;
 	int num_stds;
 	struct mt9v113_std_info *std_list;
-
-	struct v4l2_routing route;
 };
 
 /* MT9V113 register set for VGA mode */
@@ -160,7 +149,7 @@ static struct mt9v113_reg mt9v113_reg_list[] = {
 	{TOK_WRITE, 0x0016, 0x42DF},
 	{TOK_WRITE, 0x0014, 0x2145},
 	{TOK_WRITE, 0x0014, 0x2145},
-	{TOK_WRITE, 0x0010, 0x0431},
+	{TOK_WRITE, 0x0010, 0x0231},
 	{TOK_WRITE, 0x0012, 0x0000},
 	{TOK_WRITE, 0x0014, 0x244B},
 	{TOK_WRITE, 0x0014, 0x304B},
@@ -378,6 +367,10 @@ static const struct v4l2_queryctrl mt9v113_autogain_ctrl = {
 	.default_value = 1,
 };
 
+const struct v4l2_fract mt9v113_frameintervals[] = {
+	{  .numerator = 1, .denominator = 10 }
+};
+
 static int mt9v113_read_reg(struct i2c_client *client, unsigned short reg)
 {
 	int err = 0;
@@ -510,10 +503,6 @@ static int mt9v113_configure(struct mt9v113_decoder *decoder)
 	if (err)
 		return err;
 
-#if 0
-	if (debug)
-		mt9v113_reg_dump(decoder);
-#endif
 	return 0;
 }
 
@@ -534,13 +523,13 @@ static int mt9v113_vga_mode(struct mt9v113_decoder *decoder)
 }
 
 
-/**
+/*
  * ioctl_enum_framesizes - V4L2 sensor if handler for vidioc_int_enum_framesizes
  * @s: pointer to standard V4L2 device structure
  * @frms: pointer to standard V4L2 framesizes enumeration structure
  *
  * Returns possible framesizes depending on choosen pixel format
- **/
+ */
 static int ioctl_enum_framesizes(struct v4l2_int_device *s,
 					struct v4l2_frmsizeenum *frms)
 {
@@ -584,9 +573,14 @@ static int ioctl_enum_frameintervals(struct v4l2_int_device *s,
 	if (ifmt == decoder->num_fmts)
 		return -EINVAL;
 
+	if (frmi->index >= ARRAY_SIZE(mt9v113_frameintervals))
+		return -EINVAL;
+
 	frmi->type = V4L2_FRMSIZE_TYPE_DISCRETE;
-	frmi->discrete.numerator = 1;
-	frmi->discrete.denominator = 10;
+	frmi->discrete.numerator =
+		mt9v113_frameintervals[frmi->index].numerator;
+	frmi->discrete.denominator =
+		mt9v113_frameintervals[frmi->index].denominator;
 	return 0;
 }
 
@@ -631,7 +625,7 @@ static int mt9v113_detect(struct mt9v113_decoder *decoder)
  * mt9v113 decoder driver.
  */
 
-/**
+/*
  * ioctl_querystd - V4L2 decoder interface handler for VIDIOC_QUERYSTD ioctl
  * @s: pointer to standard V4L2 device structure
  * @std_id: standard V4L2 std_id ioctl enum
@@ -660,7 +654,7 @@ static int ioctl_querystd(struct v4l2_int_device *s, v4l2_std_id *std_id)
 	return 0;
 }
 
-/**
+/*
  * ioctl_s_std - V4L2 decoder interface handler for VIDIOC_S_STD ioctl
  * @s: pointer to standard V4L2 device structure
  * @std_id: standard V4L2 v4l2_std_id ioctl enum
@@ -696,7 +690,7 @@ static int ioctl_s_std(struct v4l2_int_device *s, v4l2_std_id *std_id)
 	return 0;
 }
 
-/**
+/*
  * ioctl_s_routing - V4L2 decoder interface handler for VIDIOC_S_INPUT ioctl
  * @s: pointer to standard V4L2 device structure
  * @index: number of the input
@@ -711,7 +705,7 @@ static int ioctl_s_routing(struct v4l2_int_device *s,
 	return 0;
 }
 
-/**
+/*
  * ioctl_queryctrl - V4L2 decoder interface handler for VIDIOC_QUERYCTRL ioctl
  * @s: pointer to standard V4L2 device structure
  * @qctrl: standard V4L2 v4l2_queryctrl structure
@@ -771,7 +765,7 @@ ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qctrl)
 	return err;
 }
 
-/**
+/*
  * ioctl_g_ctrl - V4L2 decoder interface handler for VIDIOC_G_CTRL ioctl
  * @s: pointer to standard V4L2 device structure
  * @ctrl: pointer to v4l2_control structure
@@ -828,7 +822,7 @@ ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl)
 	return 0;
 }
 
-/**
+/*
  * ioctl_s_ctrl - V4L2 decoder interface handler for VIDIOC_S_CTRL ioctl
  * @s: pointer to standard V4L2 device structure
  * @ctrl: pointer to v4l2_control structure
@@ -936,7 +930,7 @@ ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl)
 	return err;
 }
 
-/**
+/*
  * ioctl_enum_fmt_cap - Implement the CAPTURE buffer VIDIOC_ENUM_FMT ioctl
  * @s: pointer to standard V4L2 device structure
  * @fmt: standard V4L2 VIDIOC_ENUM_FMT ioctl structure
@@ -969,7 +963,7 @@ ioctl_enum_fmt_cap(struct v4l2_int_device *s, struct v4l2_fmtdesc *fmt)
 	return 0;
 }
 
-/**
+/*
  * ioctl_try_fmt_cap - Implement the CAPTURE buffer VIDIOC_TRY_FMT ioctl
  * @s: pointer to standard V4L2 device structure
  * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure
@@ -1026,7 +1020,7 @@ ioctl_try_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
 	return 0;
 }
 
-/**
+/*
  * ioctl_s_fmt_cap - V4L2 decoder interface handler for VIDIOC_S_FMT ioctl
  * @s: pointer to standard V4L2 device structure
  * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure
@@ -1058,7 +1052,7 @@ ioctl_s_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
 	return rval;
 }
 
-/**
+/*
  * ioctl_g_fmt_cap - V4L2 decoder interface handler for ioctl_g_fmt_cap
  * @s: pointer to standard V4L2 device structure
  * @f: pointer to standard V4L2 v4l2_format structure
@@ -1087,7 +1081,7 @@ ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
 	return 0;
 }
 
-/**
+/*
  * ioctl_g_parm - V4L2 decoder interface handler for VIDIOC_G_PARM ioctl
  * @s: pointer to standard V4L2 device structure
  * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure
@@ -1125,7 +1119,7 @@ ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
 	return 0;
 }
 
-/**
+/*
  * ioctl_s_parm - V4L2 decoder interface handler for VIDIOC_S_PARM ioctl
  * @s: pointer to standard V4L2 device structure
  * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure
@@ -1161,7 +1155,7 @@ ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
 	return 0;
 }
 
-/**
+/*
  * ioctl_g_ifparm - V4L2 decoder interface handler for vidioc_int_g_ifparm_num
  * @s: pointer to standard V4L2 device structure
  * @p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure
@@ -1193,7 +1187,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
 	return 0;
 }
 
-/**
+/*
  * ioctl_g_priv - V4L2 decoder interface handler for vidioc_int_g_priv_num
  * @s: pointer to standard V4L2 device structure
  * @p: void pointer to hold decoder's private data address
@@ -1210,7 +1204,7 @@ static int ioctl_g_priv(struct v4l2_int_device *s, void *p)
 	return decoder->pdata->priv_data_set(p);
 }
 
-/**
+/*
  * ioctl_s_power - V4L2 decoder interface handler for vidioc_int_s_power_num
  * @s: pointer to standard V4L2 device structure
  * @on: power state to which device is to be set
@@ -1272,7 +1266,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on)
 	return err;
 }
 
-/**
+/*
  * ioctl_init - V4L2 decoder interface handler for VIDIOC_INT_INIT
  * @s: pointer to standard V4L2 device structure
  *
@@ -1289,7 +1283,7 @@ static int ioctl_init(struct v4l2_int_device *s)
 	return err;
 }
 
-/**
+/*
  * ioctl_dev_exit - V4L2 decoder interface handler for vidioc_int_dev_exit_num
  * @s: pointer to standard V4L2 device structure
  *
@@ -1300,7 +1294,7 @@ static int ioctl_dev_exit(struct v4l2_int_device *s)
 	return 0;
 }
 
-/**
+/*
  * ioctl_dev_init - V4L2 decoder interface handler for vidioc_int_dev_init_num
  * @s: pointer to standard V4L2 device structure
  *
@@ -1397,7 +1391,7 @@ static struct v4l2_int_device mt9v113_int_device = {
 	      },
 };
 
-/**
+/*
  * mt9v113_probe - decoder driver i2c probe handler
  * @client: i2c driver client device structure
  *
@@ -1410,30 +1404,15 @@ mt9v113_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	struct mt9v113_decoder *decoder = &mt9v113_dev;
 	int err;
 
-	printk("%s: %d\n", __func__, __LINE__);
 	/* Check if the adapter supports the needed features */
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
 		return -EIO;
 
-	printk("%s: %d\n", __func__, __LINE__);
 	decoder->pdata = client->dev.platform_data;
 	if (!decoder->pdata) {
 		v4l_err(client, "No platform data!!\n");
 		return -ENODEV;
 	}
-	printk("%s: %d\n", __func__, __LINE__);
-	/*
-	 * Fetch platform specific data, and configure the
-	 * mt9v113_reg_list[] accordingly. Since this is one
-	 * time configuration, no need to preserve.
-	 */
-
-	/*mt9v113_reg_list[REG_OUTPUT_FORMATTER2].val |=
-			(decoder->pdata->clk_polarity << 1);
-	mt9v113_reg_list[REG_SYNC_CONTROL].val |=
-			((decoder->pdata->hs_polarity << 2) |
-			(decoder->pdata->vs_polarity << 3));
-	*/
 	/*
 	 * Save the id data, required for power up sequence
 	 */
@@ -1458,7 +1437,7 @@ mt9v113_probe(struct i2c_client *client, const struct i2c_device_id *id)
 	return 0;
 }
 
-/**
+/*
  * mt9v113_remove - decoder driver i2c remove handler
  * @client: i2c driver client device structure
  *
@@ -1511,7 +1490,7 @@ static struct i2c_driver mt9v113_i2c_driver = {
 	.id_table = mt9v113_id,
 };
 
-/**
+/*
  * mt9v113_init
  *
  * Module init function
@@ -1521,7 +1500,7 @@ static int __init mt9v113_init(void)
 	return i2c_add_driver(&mt9v113_i2c_driver);
 }
 
-/**
+/*
  * mt9v113_cleanup
  *
  * Module exit function
-- 
1.6.6.1