aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2008-12-30 14:48:42 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 20:44:40 -0400
commit74cadfe1314f4cc6060dcfa5cea9ef13c6a824fd (patch)
tree437f0599f3b737876bf83e783c94132e714c9605 /drivers/media
parent4eecb1767e0f1f800948eec9a3705c49a1b768aa (diff)
V4L/DVB (11413): gspca - m5602-mt9m111: Separate mode vectors per sensor.
By separating the supported for each sensor into a separate vector we can eliminate the nmodes variable and instead calculate it at runtime. Signed-off-by: Erik Andr?n <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.c17
-rw-r--r--drivers/media/video/gspca/m5602/m5602_mt9m111.h17
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.c51
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov9650.h47
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c17
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.h15
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.c18
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.h15
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k83a.c18
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k83a.h16
-rw-r--r--drivers/media/video/gspca/m5602/m5602_sensor.h3
11 files changed, 113 insertions, 121 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.c b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
index 69f8f6ce5811..5b57fb1eb4d0 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.c
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.c
@@ -18,6 +18,19 @@
18 18
19#include "m5602_mt9m111.h" 19#include "m5602_mt9m111.h"
20 20
21static struct v4l2_pix_format mt9m111_modes[] = {
22 {
23 640,
24 480,
25 V4L2_PIX_FMT_SBGGR8,
26 V4L2_FIELD_NONE,
27 .sizeimage = 640 * 480,
28 .bytesperline = 640,
29 .colorspace = V4L2_COLORSPACE_SRGB,
30 .priv = 0
31 }
32};
33
21static void mt9m111_dump_registers(struct sd *sd); 34static void mt9m111_dump_registers(struct sd *sd);
22 35
23int mt9m111_probe(struct sd *sd) 36int mt9m111_probe(struct sd *sd)
@@ -62,8 +75,8 @@ int mt9m111_probe(struct sd *sd)
62 return -ENODEV; 75 return -ENODEV;
63 76
64sensor_found: 77sensor_found:
65 sd->gspca_dev.cam.cam_mode = mt9m111.modes; 78 sd->gspca_dev.cam.cam_mode = mt9m111_modes;
66 sd->gspca_dev.cam.nmodes = mt9m111.nmodes; 79 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(mt9m111_modes);
67 sd->desc->ctrls = mt9m111.ctrls; 80 sd->desc->ctrls = mt9m111.ctrls;
68 sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls); 81 sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls);
69 return 0; 82 return 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_mt9m111.h b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
index 23b8e4f57bbf..ff3809f28e41 100644
--- a/drivers/media/video/gspca/m5602/m5602_mt9m111.h
+++ b/drivers/media/video/gspca/m5602/m5602_mt9m111.h
@@ -143,22 +143,7 @@ static struct m5602_sensor mt9m111 = {
143 143
144 .probe = mt9m111_probe, 144 .probe = mt9m111_probe,
145 .init = mt9m111_init, 145 .init = mt9m111_init,
146 .power_down = mt9m111_power_down, 146 .power_down = mt9m111_power_down
147
148 .nmodes = 1,
149 .modes = {
150 {
151 M5602_DEFAULT_FRAME_WIDTH,
152 M5602_DEFAULT_FRAME_HEIGHT,
153 V4L2_PIX_FMT_SBGGR8,
154 V4L2_FIELD_NONE,
155 .sizeimage =
156 M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT,
157 .bytesperline = M5602_DEFAULT_FRAME_WIDTH,
158 .colorspace = V4L2_COLORSPACE_SRGB,
159 .priv = 1
160 }
161 }
162}; 147};
163 148
164static const unsigned char preinit_mt9m111[][4] = 149static const unsigned char preinit_mt9m111[][4] =
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c
index 4d3fc78bdf41..130a29c7c532 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.c
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c
@@ -68,6 +68,50 @@ static
68 { } 68 { }
69}; 69};
70 70
71static struct v4l2_pix_format ov9650_modes[] = {
72 {
73 176,
74 144,
75 V4L2_PIX_FMT_SBGGR8,
76 V4L2_FIELD_NONE,
77 .sizeimage =
78 176 * 144,
79 .bytesperline = 176,
80 .colorspace = V4L2_COLORSPACE_SRGB,
81 .priv = 0
82 }, {
83 320,
84 240,
85 V4L2_PIX_FMT_SBGGR8,
86 V4L2_FIELD_NONE,
87 .sizeimage =
88 320 * 240,
89 .bytesperline = 320,
90 .colorspace = V4L2_COLORSPACE_SRGB,
91 .priv = 0
92 }, {
93 352,
94 288,
95 V4L2_PIX_FMT_SBGGR8,
96 V4L2_FIELD_NONE,
97 .sizeimage =
98 352 * 288,
99 .bytesperline = 352,
100 .colorspace = V4L2_COLORSPACE_SRGB,
101 .priv = 0
102 }, {
103 640,
104 480,
105 V4L2_PIX_FMT_SBGGR8,
106 V4L2_FIELD_NONE,
107 .sizeimage =
108 640 * 480,
109 .bytesperline = 640,
110 .colorspace = V4L2_COLORSPACE_SRGB,
111 .priv = 0
112 }
113};
114
71static void ov9650_dump_registers(struct sd *sd); 115static void ov9650_dump_registers(struct sd *sd);
72 116
73int ov9650_probe(struct sd *sd) 117int ov9650_probe(struct sd *sd)
@@ -110,8 +154,11 @@ int ov9650_probe(struct sd *sd)
110 return -ENODEV; 154 return -ENODEV;
111 155
112sensor_found: 156sensor_found:
113 sd->gspca_dev.cam.cam_mode = ov9650.modes; 157// sd->gspca_dev.cam.cam_mode = ov9650.modes;
114 sd->gspca_dev.cam.nmodes = ov9650.nmodes; 158// sd->gspca_dev.cam.nmodes = ov9650.nmodes;
159 sd->gspca_dev.cam.cam_mode = ov9650_modes;
160 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov9650_modes);
161
115 sd->desc->ctrls = ov9650.ctrls; 162 sd->desc->ctrls = ov9650.ctrls;
116 sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls); 163 sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls);
117 return 0; 164 return 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h
index ebf7291332cc..fb8fe56c4f10 100644
--- a/drivers/media/video/gspca/m5602/m5602_ov9650.h
+++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h
@@ -267,52 +267,7 @@ static struct m5602_sensor ov9650 = {
267 .start = ov9650_start, 267 .start = ov9650_start,
268 .stop = ov9650_stop, 268 .stop = ov9650_stop,
269 .power_down = ov9650_power_down, 269 .power_down = ov9650_power_down,
270 .ctrls = ov9650_ctrls, 270 .ctrls = ov9650_ctrls
271
272 .nmodes = 4,
273 .modes = {
274 {
275 176,
276 144,
277 V4L2_PIX_FMT_SBGGR8,
278 V4L2_FIELD_NONE,
279 .sizeimage =
280 176 * 144,
281 .bytesperline = 176,
282 .colorspace = V4L2_COLORSPACE_SRGB,
283 .priv = 0
284 }, {
285 320,
286 240,
287 V4L2_PIX_FMT_SBGGR8,
288 V4L2_FIELD_NONE,
289 .sizeimage =
290 320 * 240,
291 .bytesperline = 320,
292 .colorspace = V4L2_COLORSPACE_SRGB,
293 .priv = 0
294 }, {
295 352,
296 288,
297 V4L2_PIX_FMT_SBGGR8,
298 V4L2_FIELD_NONE,
299 .sizeimage =
300 352 * 288,
301 .bytesperline = 352,
302 .colorspace = V4L2_COLORSPACE_SRGB,
303 .priv = 0
304 }, {
305 640,
306 480,
307 V4L2_PIX_FMT_SBGGR8,
308 V4L2_FIELD_NONE,
309 .sizeimage =
310 640 * 480,
311 .bytesperline = 640,
312 .colorspace = V4L2_COLORSPACE_SRGB,
313 .priv = 0
314 }
315 }
316}; 271};
317 272
318static const unsigned char preinit_ov9650[][3] = 273static const unsigned char preinit_ov9650[][3] =
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index 7914dcc6e2a2..716b359e7a90 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -18,6 +18,19 @@
18 18
19#include "m5602_po1030.h" 19#include "m5602_po1030.h"
20 20
21static struct v4l2_pix_format po1030_modes[] = {
22 {
23 640,
24 480,
25 V4L2_PIX_FMT_SBGGR8,
26 V4L2_FIELD_NONE,
27 .sizeimage = 640 * 480,
28 .bytesperline = 640,
29 .colorspace = V4L2_COLORSPACE_SRGB,
30 .priv = 0
31 }
32};
33
21static void po1030_dump_registers(struct sd *sd); 34static void po1030_dump_registers(struct sd *sd);
22 35
23int po1030_probe(struct sd *sd) 36int po1030_probe(struct sd *sd)
@@ -59,8 +72,8 @@ int po1030_probe(struct sd *sd)
59 return -ENODEV; 72 return -ENODEV;
60 73
61sensor_found: 74sensor_found:
62 sd->gspca_dev.cam.cam_mode = po1030.modes; 75 sd->gspca_dev.cam.cam_mode = po1030_modes;
63 sd->gspca_dev.cam.nmodes = po1030.nmodes; 76 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(po1030_modes);
64 sd->desc->ctrls = po1030.ctrls; 77 sd->desc->ctrls = po1030.ctrls;
65 sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls); 78 sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls);
66 return 0; 79 return 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h
index afd776a07f9d..b28ab2e85a54 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.h
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.h
@@ -232,21 +232,6 @@ static struct m5602_sensor po1030 = {
232 .power_down = po1030_power_down, 232 .power_down = po1030_power_down,
233 233
234 .ctrls = po1030_ctrls, 234 .ctrls = po1030_ctrls,
235
236 .nmodes = 1,
237 .modes = {
238 {
239 M5602_DEFAULT_FRAME_WIDTH,
240 M5602_DEFAULT_FRAME_HEIGHT,
241 V4L2_PIX_FMT_SBGGR8,
242 V4L2_FIELD_NONE,
243 .sizeimage =
244 M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT,
245 .bytesperline = M5602_DEFAULT_FRAME_WIDTH,
246 .colorspace = V4L2_COLORSPACE_SRGB,
247 .priv = 1
248 }
249 }
250}; 235};
251 236
252static const unsigned char preinit_po1030[][3] = 237static const unsigned char preinit_po1030[][3] =
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index b7f1b045dca7..40ef9ae76482 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -50,6 +50,20 @@ static
50 { } 50 { }
51}; 51};
52 52
53static struct v4l2_pix_format s5k4aa_modes[] = {
54 {
55 640,
56 480,
57 V4L2_PIX_FMT_SBGGR8,
58 V4L2_FIELD_NONE,
59 .sizeimage =
60 640 * 480,
61 .bytesperline = 640,
62 .colorspace = V4L2_COLORSPACE_SRGB,
63 .priv = 0
64 }
65};
66
53static void s5k4aa_dump_registers(struct sd *sd); 67static void s5k4aa_dump_registers(struct sd *sd);
54 68
55int s5k4aa_probe(struct sd *sd) 69int s5k4aa_probe(struct sd *sd)
@@ -115,8 +129,8 @@ int s5k4aa_probe(struct sd *sd)
115 info("Detected a s5k4aa sensor"); 129 info("Detected a s5k4aa sensor");
116 130
117sensor_found: 131sensor_found:
118 sd->gspca_dev.cam.cam_mode = s5k4aa.modes; 132 sd->gspca_dev.cam.cam_mode = s5k4aa_modes;
119 sd->gspca_dev.cam.nmodes = s5k4aa.nmodes; 133 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k4aa_modes);
120 sd->desc->ctrls = s5k4aa.ctrls; 134 sd->desc->ctrls = s5k4aa.ctrls;
121 sd->desc->nctrls = ARRAY_SIZE(s5k4aa_ctrls); 135 sd->desc->nctrls = ARRAY_SIZE(s5k4aa_ctrls);
122 return 0; 136 return 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
index 33ba1621bc69..0f0c6dff1eef 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
@@ -142,21 +142,6 @@ static struct m5602_sensor s5k4aa = {
142 .i2c_slave_id = 0x5a, 142 .i2c_slave_id = 0x5a,
143 .i2c_regW = 2, 143 .i2c_regW = 2,
144 .ctrls = s5k4aa_ctrls, 144 .ctrls = s5k4aa_ctrls,
145
146 .nmodes = 1,
147 .modes = {
148 {
149 640,
150 480,
151 V4L2_PIX_FMT_SBGGR8,
152 V4L2_FIELD_NONE,
153 .sizeimage =
154 640 * 480,
155 .bytesperline = 640,
156 .colorspace = V4L2_COLORSPACE_SRGB,
157 .priv = 1
158 }
159 }
160}; 145};
161 146
162static const unsigned char preinit_s5k4aa[][4] = 147static const unsigned char preinit_s5k4aa[][4] =
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.c b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
index 6880b31575c7..fcc8c3752c75 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k83a.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.c
@@ -18,6 +18,20 @@
18 18
19#include "m5602_s5k83a.h" 19#include "m5602_s5k83a.h"
20 20
21static struct v4l2_pix_format s5k83a_modes[] = {
22 {
23 640,
24 480,
25 V4L2_PIX_FMT_SBGGR8,
26 V4L2_FIELD_NONE,
27 .sizeimage =
28 640 * 480,
29 .bytesperline = 640,
30 .colorspace = V4L2_COLORSPACE_SRGB,
31 .priv = 0
32 }
33};
34
21static void s5k83a_dump_registers(struct sd *sd); 35static void s5k83a_dump_registers(struct sd *sd);
22 36
23int s5k83a_probe(struct sd *sd) 37int s5k83a_probe(struct sd *sd)
@@ -63,8 +77,8 @@ int s5k83a_probe(struct sd *sd)
63 info("Detected a s5k83a sensor"); 77 info("Detected a s5k83a sensor");
64 78
65sensor_found: 79sensor_found:
66 sd->gspca_dev.cam.cam_mode = s5k83a.modes; 80 sd->gspca_dev.cam.cam_mode = s5k83a_modes;
67 sd->gspca_dev.cam.nmodes = s5k83a.nmodes; 81 sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes);
68 sd->desc->ctrls = s5k83a.ctrls; 82 sd->desc->ctrls = s5k83a.ctrls;
69 sd->desc->nctrls = ARRAY_SIZE(s5k83a_ctrls); 83 sd->desc->nctrls = ARRAY_SIZE(s5k83a_ctrls);
70 return 0; 84 return 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k83a.h b/drivers/media/video/gspca/m5602/m5602_s5k83a.h
index ed74d9734972..d56eb4c5ee31 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k83a.h
+++ b/drivers/media/video/gspca/m5602/m5602_s5k83a.h
@@ -129,7 +129,6 @@ static struct ctrl s5k83a_ctrls[] = {
129 } 129 }
130}; 130};
131 131
132
133static struct m5602_sensor s5k83a = { 132static struct m5602_sensor s5k83a = {
134 .name = "S5K83A", 133 .name = "S5K83A",
135 .probe = s5k83a_probe, 134 .probe = s5k83a_probe,
@@ -140,21 +139,6 @@ static struct m5602_sensor s5k83a = {
140 .i2c_slave_id = 0x5a, 139 .i2c_slave_id = 0x5a,
141 .i2c_regW = 2, 140 .i2c_regW = 2,
142 .ctrls = s5k83a_ctrls, 141 .ctrls = s5k83a_ctrls,
143
144 .nmodes = 1,
145 .modes = {
146 {
147 M5602_DEFAULT_FRAME_WIDTH,
148 M5602_DEFAULT_FRAME_HEIGHT,
149 V4L2_PIX_FMT_SBGGR8,
150 V4L2_FIELD_NONE,
151 .sizeimage =
152 M5602_DEFAULT_FRAME_WIDTH * M5602_DEFAULT_FRAME_HEIGHT,
153 .bytesperline = M5602_DEFAULT_FRAME_WIDTH,
154 .colorspace = V4L2_COLORSPACE_SRGB,
155 .priv = 1
156 }
157 }
158}; 142};
159 143
160static const unsigned char preinit_s5k83a[][4] = 144static const unsigned char preinit_s5k83a[][4] =
diff --git a/drivers/media/video/gspca/m5602/m5602_sensor.h b/drivers/media/video/gspca/m5602/m5602_sensor.h
index 5867ee258918..3fd92d370d0a 100644
--- a/drivers/media/video/gspca/m5602/m5602_sensor.h
+++ b/drivers/media/video/gspca/m5602/m5602_sensor.h
@@ -66,9 +66,6 @@ struct m5602_sensor {
66 int (*power_down)(struct sd *sd); 66 int (*power_down)(struct sd *sd);
67 67
68 const struct ctrl *ctrls; 68 const struct ctrl *ctrls;
69
70 char nmodes;
71 struct v4l2_pix_format modes[];
72}; 69};
73 70
74#endif 71#endif